kg_microbe.transform_utils.metatraits_gtdb package
Submodules
kg_microbe.transform_utils.metatraits_gtdb.metatraits_gtdb module
MetaTraits GTDB transform class.
Extends MetaTraitsTransform to process GTDB-based metatraits data. Uses GTDB metadata files to map GTDB species names to NCBITaxon IDs.
- class kg_microbe.transform_utils.metatraits_gtdb.metatraits_gtdb.MetaTraitsGTDBTransform(input_dir=None, output_dir=None, use_multiprocessing=True, num_workers=None)
Bases:
MetaTraitsTransformTransform GTDB metatraits summary JSONL files into KGX nodes and edges.
-
DATA_INPUTS:
tuple= ('mappings/kgmicrobe_unified_entity_mappings.sssom.tsv.gz', 'data/raw/taxdump.tar.gz') Repo-relative curation files this transform reads, beyond its own
data/raw/download.Declared so freshness tooling can tell that an output is stale against its data rather than only its code. Without it a mapping correction lands, every consumer keeps reporting FRESH, and a re-merge silently ships the old groundings: #778 corrected 16 isolation-source ids and #786 rewrote the unified chemical SSSOM, and the merged KG built afterwards still asserted 75 organisms isolated from a “Cell Line”, because nothing re-ran the transforms that read those files (#812).
Paths are relative to the repo root. Keep them tracked in git — the freshness check uses commit time, not mtime, because git checkout rewrites mtimes without changing content (#797).
List every curation file read, not a representative one. A partial declaration fails silently and looks identical to a complete one: ontologies_stubs declared 1 of the 11 files it read and was reported fresh after changes to the other ten (#839). Where the set comes from a constant, derive this from it rather than restating it.
-
TRANSFORM_INPUTS:
tuple= ('ontologies', 'gtdb') Reads
ontologies/ncbitaxon_nodes.tsvvia NCBITAXON_NODES_FILE in _load_ncbitaxon_labels. metatraits_gtdb inherits this. Undeclared until #1035, because the path lives in constants.py rather than here.
- run(data_file=None, show_status=True)
Run MetaTraitsGTDBTransform.
Processes GTDB metatraits JSONL files and generates KGX nodes/edges.
- Parameters:
data_file (
Union[Path,None,str]) – Ignored; uses configured GTDB input file list.show_status (
bool) – Whether to show progress bar.
- Return type:
None
-
DATA_INPUTS:
Module contents
MetaTraits GTDB transform module.
- class kg_microbe.transform_utils.metatraits_gtdb.MetaTraitsGTDBTransform(input_dir=None, output_dir=None, use_multiprocessing=True, num_workers=None)
Bases:
MetaTraitsTransformTransform GTDB metatraits summary JSONL files into KGX nodes and edges.
-
DATA_INPUTS:
tuple= ('mappings/kgmicrobe_unified_entity_mappings.sssom.tsv.gz', 'data/raw/taxdump.tar.gz') Repo-relative curation files this transform reads, beyond its own
data/raw/download.Declared so freshness tooling can tell that an output is stale against its data rather than only its code. Without it a mapping correction lands, every consumer keeps reporting FRESH, and a re-merge silently ships the old groundings: #778 corrected 16 isolation-source ids and #786 rewrote the unified chemical SSSOM, and the merged KG built afterwards still asserted 75 organisms isolated from a “Cell Line”, because nothing re-ran the transforms that read those files (#812).
Paths are relative to the repo root. Keep them tracked in git — the freshness check uses commit time, not mtime, because git checkout rewrites mtimes without changing content (#797).
List every curation file read, not a representative one. A partial declaration fails silently and looks identical to a complete one: ontologies_stubs declared 1 of the 11 files it read and was reported fresh after changes to the other ten (#839). Where the set comes from a constant, derive this from it rather than restating it.
-
TRANSFORM_INPUTS:
tuple= ('ontologies', 'gtdb') Reads
ontologies/ncbitaxon_nodes.tsvvia NCBITAXON_NODES_FILE in _load_ncbitaxon_labels. metatraits_gtdb inherits this. Undeclared until #1035, because the path lives in constants.py rather than here.
-
accession_to_gtdb_species:
Dict[str,str]
-
accession_to_ncbi:
Dict[str,str]
-
gtdb_preferred_ncbi:
Dict[str,str]
-
gtdb_to_ncbi:
Dict[str,Counter]
-
ncbitaxon_name_to_id:
Dict[str,str]
- run(data_file=None, show_status=True)
Run MetaTraitsGTDBTransform.
Processes GTDB metatraits JSONL files and generates KGX nodes/edges.
- Parameters:
data_file (
Union[Path,None,str]) – Ignored; uses configured GTDB input file list.show_status (
bool) – Whether to show progress bar.
- Return type:
None
-
synthetic_nodes_metadata:
Dict[str,Dict[str,str]]
-
trait_mapping:
Dict[str,dict]
-
DATA_INPUTS: