Skip to content

Commit 03314ca

Browse files
authoredMar 17, 2025··
Merge pull request #61 from onecodex/audy/add-no-rank-rank
Add `no_rank` to ranks
2 parents 0d5bd5a + 11e73d0 commit 03314ca

File tree

6 files changed

+7
-2
lines changed

6 files changed

+7
-2
lines changed
 

‎pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ build-backend = "maturin"
44

55
[project]
66
name = "taxonomy"
7+
dynamic = ["version"]
78
classifier = [
89
"Intended Audience :: Science/Research",
910
"Programming Language :: Python :: 3",

‎src/formats/ncbi.rs

+2
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ mod tests {
127127
fn can_import_ncbi() {
128128
let nodes =
129129
"1\t|\t1\t|\tno rank\t|\t\t|\t8\t|\t0\t|\t1\t|\t0\t|\t0\t|\t0\t|\t0\t|\t0\t|\t\t|
130+
10239\t|\t1\t|\tno_rank\t|\t\t|\t9\t|\t0\t|\t1\t|\t0\t|\t0\t|\t0\t|\t0\t|\t0\t|\t\t|
130131
2\t|\t131567\t|\tsuperkingdom\t|\t\t|\t0\t|\t0\t|\t11\t|\t0\t|\t0\t|\t0\t|\t0\t|\t0\t|\t\t|
131132
543\t|\t91347\t|\tfamily\t|\t\t|\t0\t|\t1\t|\t11\t|\t1\t|\t0\t|\t1\t|\t0\t|\t0\t|\t\t|
132133
561\t|\t543\t|\tgenus\t|\t\t|\t0\t|\t1\t|\t11\t|\t1\t|\t0\t|\t1\t|\t0\t|\t0\t|\t\t|
@@ -137,6 +138,7 @@ mod tests {
137138
131567\t|\t1\t|\tno rank\t|\t\t|\t8\t|\t1\t|\t1\t|\t1\t|\t0\t|\t1\t|\t1\t|\t0\t|\t\t|";
138139
let names = "1\t|\tall\t|\t\t|\tsynonym\t|
139140
1\t|\troot\t|\t\t|\tscientific name\t|
141+
10239\t|\tViruses\t|\t\t|\tscientific name\t|
140142
2\t|\tBacteria\t|\tBacteria <prokaryotes>\t|\tscientific name\t|
141143
543\t|\tEnterobacteriaceae\t|\t\t|\tscientific name\t|
142144
561\t|\tEscherchia\t|\t\t|\tmisspelling\t|

‎src/rank.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ impl FromStr for TaxRank {
239239
"breed" => Ok(TaxRank::Breed),
240240
"strain" => Ok(TaxRank::Strain),
241241
"serogroup" => Ok(TaxRank::SeroGroup),
242-
"no rank" => Ok(TaxRank::Unspecified),
242+
"no rank" | "no_rank" => Ok(TaxRank::Unspecified),
243243
"biotype" => Ok(TaxRank::Biotype),
244244
"clade" => Ok(TaxRank::Clade),
245245
"forma specialis" => Ok(TaxRank::FormaSpecialis),

‎test_python.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ def test_prune(self):
394394
new_tax = self.tax.prune(remove=["561"])
395395
self.assertIsNone(new_tax.node("561"))
396396
self.assertIsNone(new_tax.node("562"))
397-
self.assertEqual(len(new_tax), 7)
397+
self.assertEqual(len(new_tax), 8)
398398

399399
new_tax = self.tax.prune(keep=["561"])
400400
self.assertEqual(len(new_tax), 8)

‎tests/data/names.dmp

+1
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,4 @@
4848
91347 | Enterobacterales | | scientific name |
4949
131567 | biota | | synonym |
5050
131567 | cellular organisms | | scientific name |
51+
10239 | Viruses | | scientific name |

‎tests/data/nodes.dmp

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
1 | 1 | no rank | | 8 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | |
2+
10239 | 1 | no_rank | | 9 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | |
23
2 | 131567 | superkingdom | | 0 | 0 | 11 | 0 | 0 | 0 | 0 | 0 | |
34
543 | 91347 | family | | 0 | 1 | 11 | 1 | 0 | 1 | 0 | 0 | |
45
561 | 543 | genus | | 0 | 1 | 11 | 1 | 0 | 1 | 0 | 0 | |

0 commit comments

Comments
 (0)
Please sign in to comment.