kg_bacdive.transform_utils.mediadive package
Submodules
kg_bacdive.transform_utils.mediadive.mediadive module
MediaDive KG.
Example script to transform downloaded data into a graph format that KGX can ingest directly, in either TSV or JSON format: https://github.com/NCATS-Tangerine/kgx/blob/master/data-preparation.md
Input: any file in data/raw/ (that was downloaded by placing a URL in incoming.txt/yaml and running run.py download.
Output: transformed data in data/raw/MediaDive:
Output these two files: - nodes.tsv - edges.tsv
- class kg_bacdive.transform_utils.mediadive.mediadive.MediaDiveTransform(input_dir=None, output_dir=None)
Bases:
Transform
Template for how the transform class would be designed.
- download_yaml_and_get_json(url, target_dir)
Download MetaDive data using a url.
- Parameters:
url (
str
) – Path provided by MetaDive API.- Return type:
Dict
[str
,str
]
- get_compounds_of_solution(id)
Get ingredients of solutions via the MediaDive API>.
- Parameters:
id (
str
) – ID of solution- Returns:
Dictionary of {compound_name: compound_id}
- run(data_file=None)
Run the transformation.
- standardize_compound_id(id)
Get IDs via Metadive API.
- Parameters:
id (
str
) – Metadive compound ID- Returns:
Standardized ID
Module contents
BacDive transform.
- class kg_bacdive.transform_utils.mediadive.MediaDiveTransform(input_dir=None, output_dir=None)
Bases:
Transform
Template for how the transform class would be designed.
- download_yaml_and_get_json(url, target_dir)
Download MetaDive data using a url.
- Parameters:
url (
str
) – Path provided by MetaDive API.- Return type:
Dict
[str
,str
]
- get_compounds_of_solution(id)
Get ingredients of solutions via the MediaDive API>.
- Parameters:
id (
str
) – ID of solution- Returns:
Dictionary of {compound_name: compound_id}
- run(data_file=None)
Run the transformation.
- standardize_compound_id(id)
Get IDs via Metadive API.
- Parameters:
id (
str
) – Metadive compound ID- Returns:
Standardized ID