kg_microbe package

Subpackages

Submodules

kg_microbe.download module

Basic download function.

kg_microbe.download.download(yaml_file: str, output_dir: str, ignore_cache: bool = False) None

Download data files from list of URLs into data directory.

Args:

yaml_file: A string pointing to the yaml file utilized to facilitate the downloading of data. output_dir: A string pointing to the location to download data to. ignore_cache: Ignore cache and download files even if they exist [false]

Returns:

None.

kg_microbe.query module

Functions for querying data.

kg_microbe.query.parse_query_rq(rq_file) dict

Parse a SPARQL query file in grlc rq format.

Args:

rq_file: sparql query in grlc rq format

Returns: dict with parsed info about sparql query

kg_microbe.query.parse_query_yaml(yaml_file) dict

Parse a yaml query.

kg_microbe.query.result_dict_to_tsv(result_dict: dict, outfile: str) None

Convert a result_dict to a TSV for output.

kg_microbe.query.run_query(query: str, endpoint: str, return_format='json') dict

Run a query.

kg_microbe.transform module

Top-level functions for transforming data.

kg_microbe.transform.transform(input_dir: str, output_dir: str, sources: Optional[List[str]] = None) None

Call scripts in kg_microbe/transform/[source name]/ to transform data.

KGX can ingest each directly, in either TSV or JSON format. Args:

input_dir: A string pointing to the directory to import data from. output_dir: A string pointing to the directory to output data to. sources: A list of sources to transform.

Returns:

None.

Module contents

Initialize the KG-Microbe project.

kg_microbe.download(yaml_file: str, output_dir: str, ignore_cache: bool = False) None

Download data files from list of URLs into data directory.

Args:

yaml_file: A string pointing to the yaml file utilized to facilitate the downloading of data. output_dir: A string pointing to the location to download data to. ignore_cache: Ignore cache and download files even if they exist [false]

Returns:

None.

kg_microbe.transform(input_dir: str, output_dir: str, sources: Optional[List[str]] = None) None

Call scripts in kg_microbe/transform/[source name]/ to transform data.

KGX can ingest each directly, in either TSV or JSON format. Args:

input_dir: A string pointing to the directory to import data from. output_dir: A string pointing to the directory to output data to. sources: A list of sources to transform.

Returns:

None.