Open jwiggi18 opened 5 years ago
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:
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!
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 :)
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