Skip to content

Commit 7644005

Browse files
author
zyxue
committed
fixed error due to ncbi replacing superkingdom with domain column
1 parent 60f490f commit 7644005

File tree

4 files changed

+12
-3
lines changed

4 files changed

+12
-3
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ __pycache__/
66
dist
77
htmlcov/
88
ncbitax2lin.egg-info/
9+
build

ncbitax2lin/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""__init__.py for this project"""
22

3-
__version__ = "2.0.2"
3+
__version__ = "2.4.1"

ncbitax2lin/data_io.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,17 @@ def read_names_and_nodes(names_file: str, nodes_file: str) -> pd.DataFrame:
8888

8989
def write_lineages_to_disk(df_lineages: pd.DataFrame, output_path: str) -> None:
9090
"""Gzip lineages and write them to disk"""
91+
# superkingdom has been renamed to domain in
92+
# https://ncbiinsights.ncbi.nlm.nih.gov/2024/06/04/changes-ncbi-taxonomy-classifications/
93+
domain_col = "domain"
94+
95+
# For backwards compatibility with older taxdumps.
96+
if "superkingdom" in df_lineages:
97+
domain_col = "superkingdom"
98+
9199
cols = [
92100
"tax_id",
93-
"superkingdom",
101+
domain_col,
94102
"phylum",
95103
"class",
96104
"order",

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "ncbitax2lin"
3-
version = "2.3.1"
3+
version = "2.4.1"
44
description = "A tool that converts NCBI taxonomy dump into lineages"
55
authors = ["Zhuyi Xue <[email protected]>"]
66
readme = "README.md"

0 commit comments

Comments
 (0)