Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix class2tree bug #690

Merged
merged 2 commits into from Jul 16, 2018
Merged

Fix class2tree bug #690

merged 2 commits into from Jul 16, 2018

Conversation

gpli
Copy link
Contributor

@gpli gpli commented Jul 10, 2018

organisms with unique rank lower than non-unique ranks will give extra wrong rows in 'taxonomy_table_creator' function

Description

Check existence of the lowest non-unique rank (i.e. 'species') before rbind

Related Issue

fix #689

Example

library(taxize)
library(taxizedb)
organisms = c("Haloarcula amylolytica JCM 13557",
              "Haloarcula argentinensis DSM 12282",
              "Haloarcula californiae ATCC 33799",
              "Halarchaeum acidiphilum MH1-52-1")
taxon_IDs = name2taxid(organisms)
taxon_IDs
## [1] "1227452" "1230451" "662475"  "1261545"

classes = taxizedb::classification(taxon_IDs, db = "ncbi")
tr = class2tree(classes)
tr$classification
##                                                     species       genus
## Haloarcula amylolytica JCM 13557     Haloarcula amylolytica  Haloarcula
## Haloarcula argentinensis DSM 12282 Haloarcula argentinensis  Haloarcula
## Haloarcula californiae ATCC 33799    Haloarcula californiae  Haloarcula
## Halarchaeum acidiphilum MH1-52-1    Halarchaeum acidiphilum Halarchaeum
##                                              family           order        class
## Haloarcula amylolytica JCM 13557     Haloarculaceae Halobacteriales Halobacteria
## Haloarcula argentinensis DSM 12282   Haloarculaceae Halobacteriales Halobacteria
## Haloarcula californiae ATCC 33799    Haloarculaceae Halobacteriales Halobacteria
## Halarchaeum acidiphilum MH1-52-1   Halobacteriaceae Halobacteriales Halobacteria
##                                           phylum superkingdom      norank_131567
## Haloarcula amylolytica JCM 13557   Euryarchaeota      Archaea cellular organisms
## Haloarcula argentinensis DSM 12282 Euryarchaeota      Archaea cellular organisms
## Haloarcula californiae ATCC 33799  Euryarchaeota      Archaea cellular organisms
## Halarchaeum acidiphilum MH1-52-1   Euryarchaeota      Archaea cellular organisms

organisms with unique rank lower than non-unique ranks will give extra wrong rows in 'taxonomy_table_creator' function
@sckott sckott added this to the v0.9.4 milestone Jul 12, 2018
@sckott
Copy link
Contributor

sckott commented Jul 12, 2018

thanks for this PR @gpli

having a look at it now

@sckott
Copy link
Contributor

sckott commented Jul 12, 2018

@gpli can you add a test to https://github.com/ropensci/taxize/blob/master/tests/testthat/test-class2tree.R to address the fixed problem

add test for issue #689
@gpli
Copy link
Contributor Author

gpli commented Jul 16, 2018

@sckott the test has been added.

@sckott
Copy link
Contributor

sckott commented Jul 16, 2018

thanks very much @gpli !

@sckott sckott merged commit ca5f900 into ropensci:master Jul 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

class2tree generates wrong classification table for organisms with unique rank lower than non-unique ranks
2 participants