kg_microbe.transform_utils.lpsn package
Submodules
kg_microbe.transform_utils.lpsn.lpsn module
LPSN transform.
Ingests the LPSN GSS (Genus/Species/Subspecies) CSV bulk export into KGX-format nodes and edges. Each row becomes a biolink:OrganismTaxon node at lpsn:<record_no>, with biolink:subclass_of edges pointing from species → genus and subspecies → species so that the LPSN taxonomic tree is queryable in the merged KG.
The GSS CSV requires a free LPSN login to download. This transform does NOT fetch it — place the downloaded file at data/raw/lpsn_gss.csv before running:
poetry run kg transform -s lpsn
See kg_microbe/transform_utils/lpsn/README.md for the manual
download procedure.
Scope: - Nodes for every LPSN record (family / genus / species / subspecies). - subclass_of edges from subspecies → species → genus (only when the
parent row is present in the same CSV — no LPSN API calls).
close_match edges to kgmicrobe.strain:* for every culture-collection deposit named in
nomenclatural_type.close_match edges to NCBITaxon:* for every row (genus / species / subspecies) whose scientific name resolves to exactly one NCBITaxon via the local NCBI index. The index is pre-filtered to the bacterial and archaeal subtree, so multi-kingdom homonyms (
Bacillusthe walking stick,Bacillusthe mineral) are never candidates. Lookups match against bothrdfs:labelandoio:hasExactSynonym, which is how genera resolve — NCBI stores each disambiguated genus’s bare form as an exact synonym (Bacillus <firmicutes>hashasExactSynonym Bacillus). Skipped entirely when the adapter is absent (data/raw/ncbitaxon.owlnot on disk).same_as edges from historical names → correct-name LPSN taxon.
Illegitimate / synonym rows carry
deprecated=True.
Deferred to a follow-up PR (issue #484):
- GTDB cross-refs (via data/transformed/gtdb/nodes.tsv name-matching).
- Full LPSN JSON API ingest (publication DOI/PMID, lpsn_parent_id
for the full taxonomic tree, 16S sequences).
- class kg_microbe.transform_utils.lpsn.lpsn.LPSNTransform(input_dir=None, output_dir=None, ncbi_impl=None, gtdb_index=None)
Bases:
TransformTransform LPSN GSS CSV bulk export into KGX nodes + edges.
-
TRANSFORM_INPUTS:
tuple= ('gtdb',) Reads this transform’s output; see Transform.TRANSFORM_INPUTS (#845).
- run(data_file=None, show_status=True)
Emit
nodes.tsvandedges.tsvfrom the LPSN GSS CSV.- Return type:
None
Parameters
- data_file:
Optional override for the input CSV path. If
None, usesself.input_base_dir / "lpsn_gss.csv".- show_status:
Accepted for compatibility with the
kg transformCLI (seetransform.py). Currently unused because LPSN parsing is fast enough (< 1 s per 34K rows) that a progress bar isn’t worth pullingtqdmin.
-
TRANSFORM_INPUTS:
Module contents
LPSN (List of Prokaryotic names with Standing in Nomenclature) transform.