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

Error when attempting to build phylomatic tree #18

Open
jwiggi18 opened this issue Oct 18, 2018 · 2 comments
Open

Error when attempting to build phylomatic tree #18

jwiggi18 opened this issue Oct 18, 2018 · 2 comments

Comments

@jwiggi18
Copy link

Code:
library(rphylotastic)
library(datelife)
#to pull the scientifc names from the list of state symbols in my .txt file

WV_symbols <- file_get_scientific_names(file_name = "state_symbols/West_Virginia.txt")

WV_phy1 <- taxa_get_otol_tree(taxa = WV_symbols)

WV_phy2 <- taxa_get_phylomatic_tree(taxa = WV_symbols)

Using this file:
West_Virginia.txt

Results in:
status rank division scientificname commonname uid genus species subsp modificationdate
1 active subgenus butterflies Danaus 151542 2001/02/08 00:00
2 active genus butterflies Danaus 13036 2004/09/08 00:00
1:
Error in if (all(phy$node.label == "")) phy$node.label <- NULL :
missing value where TRUE/FALSE needed

@LunaSare
Copy link
Member

So, the issue is that the phylomatic service only has plants and mammals, so when trying to construct a tree with taxa from WV_symbols you get a tree with one tip containing the only mammal in the data set, Ursus americanus:

screen shot 2018-10-18 at 10 48 41 am

Then taxa_get_phylomatic_tree tries to write it as a phylo object and that's when it fails. I'm catching that error case and giving a message so it's easier to debug next time.

The phylomatic service also seems to struggle with names above species. For example, try
taxa_get_phylomatic(taxa = c(WV_symbols, "Homo sapiens", "Felis silvestris", "Elephas maximus"))
Which retrieves a tree with 4 tips, mammals only, vs.
taxa_get_phylomatic(taxa = c(WV_symbols, "Homo", "Felis", "Elephas"))
which retrieves an error again, because only Ursus americanus was matched.
However, for some strange reason doing the following works
taxa_get_phylomatic(taxa = c("Homo", "Felis", "Elephas"))

This behaviour comes from phylomatic, so we cannot do much about it, except catching the unexpected/wrong results.

Hope this helps!

@LunaSare
Copy link
Member

Pushed. So now, reinstall rphylotastic from github with devtools::install_github("phylotastic/rphylotatsic")

You should not get an error now, just a warning and a character vector with the name of the single tip as output.

Let me know how it goes @jwiggi18 :)

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

No branches or pull requests

2 participants