ropensci / rotl Goto Github PK
View Code? Open in Web Editor NEWInterface to Open Tree of Life API
Home Page: https://docs.ropensci.org/rotl
License: Other
Interface to Open Tree of Life API
Home Page: https://docs.ropensci.org/rotl
License: Other
Any plans for a CRAN submission? I'm hoping to move phylomatic fxns out of taxize
into https://github.com/ropensci/branching, which also wraps this pkg.
thanks! 😄 -s
because #31 and issued linked therein.
As we discussed, it would be very helpful to have distinct classes for the lists returned by various functions, especially as many of them are nested lists which will take up many screen on an R session is printed. Let's use this issue as a thread to talk about types of returns we get, and the best methods for them (print
, summary
...).
I would love to see an option in function calls for chatty returns (ie, print statements to screen) that give some sort of update. I am currently downloading a tree of about 400 taxa and it has been going for over 30 minutes. Not sure if it is dead or chugging along...
it's a little inconsistent currently
might be 1.10.5
I changed the output of the functions studies_find_studies
and studies_find_trees
. Previously, these functions would only return the OTL identifiers for the studies and or trees that matched the search criteria. It seemed to me that it would be good to have a little more context to these results, so users could know from which studies they are coming from instead of only getting identifiers back. Therefore I added the argument detailed
to both functions (set to TRUE
by default) that retrieve the metadata for the studies that match the search to get more context:
> studies_find_studies(property="ot:focalCladeOTTTaxonName", value="Drosophilia")
study_ids n_trees candidate study_year
1 pg_2461 4 1997
2 pg_1940 3 tree3943 2010
title
1 Multiple sources of character information and the phylogeny of Hawaiian Drosophilids
2 A supermatrix-based molecular phylogeny of the family Drosophilidae
study_doi
1 http://dx.doi.org/10.1093/sysbio/46.4.654
2 http://dx.doi.org/10.1017/S001667231000008X
> studies_find_trees(property="ot:ottTaxonName", value="Drosophilia")
study_ids n_trees candidate study_year
1 ot_97 9 2011
2 pg_1257 2 2010
3 pg_1940 3 tree3943 2010
4 pg_2461 4 1997
5 pg_2769 7 2011
6 pg_2780 1 2006
7 pg_2885 4 tree6690 2014
8 pg_309 4 2007
9 pg_313 1 tree6681 2009
title
1 'Multigene phylogenetic analyses including diverse radiolarian species support the “Retaria” hypothesis — The sister relationship of Radiolaria and Foraminifera'
2 A phylogenomic approach to resolve the arthropod tree of life
3 A supermatrix-based molecular phylogeny of the family Drosophilidae
4 Multiple sources of character information and the phylogeny of Hawaiian Drosophilids
5 Wolbachia-mediated persistence of mtDNA from a potentially extinct species
6 Phylogenetic Relationships of the Wolbachia of Nematodes and Arthropods
7 'The impact of RNA structure on coding sequence evolution in both bacteria and eukaryotes'
8 Testing Phylogenetic Congruence in Phylogenomic Analysis
9 Multigene evidence for the placement of a heterotrophic amoeboid lineage Leukarachnion sp
study_doi n_matched_trees
1 http://dx.doi.org/10.1016/j.marmicro.2011.06.007 1
2 http://dx.doi.org/10.1093/molbev/msq130 2
3 http://dx.doi.org/10.1017/S001667231000008X 1
4 http://dx.doi.org/10.1093/sysbio/46.4.654 4
5 7
6 1
7 http://dx.doi.org/10.1186/1471-2148-14-87 1
8 http://dx.doi.org/10.1080/10635150801910436 1
9 http://dx.doi.org/10.1016/j.protis.2009.01.001 1
tree_ids
1 tree8
2 tree6548, tree6547
3 tree3943
4 tree6655, tree5289, tree5288, tree5287
5 tree6415, tree6414, tree6413, tree6412, tree6411, ...
6 tree6446
7 tree6691
8 tree256
9 tree6681
It's a little slow because we need to fetch the metadata for each study before returning the result, but it seems worth it.
Not really an issue, just somewhere to store this.
Ape's read.tree cannot read this tree (will put more examples here as they arise):
"((((Tinamiformes_292467:1.0E-22,((Apteryx_241840:1.0E-22)Apterygiformes_816668:0.03818,((Dromaius_283193:1.0E-22)Dromaiidae_283194:0.01843,(Casuarius_589156:1.0E-22)Casuariidae_589161:0.014445)Casuariiformes_589166:0.030882):0.00232,Tinamidae_292469:0.091284,(((Crypturellus_870604:0.061151,Tinamus_402450:0.042862):0.01736,(Eudromia_292460:0.084637,Nothoprocta_292463:0.080725):0.00491,(Crypturellus_870604:0.061151,Tinamus_402450:0.042862):0.01736,(Eudromia_292460:0.084637,Nothoprocta_292463:0.080725):0.00491)Tinamidae_292469:1.0E-22,((Crypturellus_870604:0.061151,Tinamus_402450:0.042862):0.01736,(Eudromia_292460:0.084637,Nothoprocta_292463:0.080725):0.00491)Tinamidae_292469:1.0E-22)Tinamiformes_292467:1.0E-22):0.001643,(Rhea_857863:1.0E-22)Rheiformes_829553:0.08311):0.011185,(Struthio_292466:1.0E-22)Struthioniformes_857847:0.068069)Palaeognathae_81443:0.055986,(((((Crax_979429:1.0E-22)Cracidae_109893:0.090261,(((Colinus_204725:1.0E-22)Odontophoridae_594197:0.099855,((Coturnix_1098759:0.066402,(Gallus_153562:1.0E-22)Phasianinae_51353:0.03635):0.010595,Rollulus_352754:0.068711)Phasianidae_728070:0.014614):0.008216,(Numida_684050:1.0E-22)Numididae_684043:0.044719):0.06343):0.013369,(Alectura_570959:0.03048,Megapodius_837567:0.029367)Megapodiidae_620981:0.069087)Galliformes_837585:0.032204,(((Oxyura_88395:0.040265,((Malacorhynchus_436831:0.04328,Anser_190884:0.022753):0.003531,((Aythya_693334:0.011903,Anas_765185:0.012596):0.023881,Biziura_432080:0.034803):0.003654):0.002077)Anatidae_765193:0.054998,(Anseranas_714466:1.0E-22)Anseranatidae_732899:0.048445):0.008696,(Chauna_241847:1.0E-22)Anhimidae_241842:0.057828)Anseriformes_241841:0.008393):0.044868,(((((((Turnix_365489:1.0E-22)Turniciformes_810755:0.18873,((Larus_887695:1.0E-22)Laridae_887693:0.032647,(Dromas_960243:1.0E-22)Dromadidae_960242:0.025419):0.015026):0.00881,((((Thinocorus_628492:1.0E-22)Thinocoridae_628493:0.053497,(Pedionomus_163950:1.0E-22)Pedionomidae_163951:0.04395):0.016681,((Jacana_332001:1.0E-22)Jacanidae_331999:0.05956,(Rostratula_5275:1.0E-22)Rostratulidae_5274:0.055239):0.009395):0.01752,(Arenaria_821756:1.0E-22)Scolopacidae_887699:0.046052):0.024302):0.009831,((Burhinus_261316:1.0E-22)Burhinidae_261310:0.045568,((Haematopus_193407:1.0E-22)Haematopodidae_675126:0.032531,(Charadrius_112946:0.02814,Phegornis_214795:0.026739)Charadriidae_313123:0.014782):0.014788):0.003951):0.01301,(((Cariama_966327:1.0E-22)Cariamidae_966325:0.064557,(((Herpetotheres_438656:0.013273,Micrastur_1015202:0.015684):0.017691,(Daptrius_438662:0.025422,Falco_786441:0.042045):0.020204)Falconidae_212186:0.033545,((Psittacidae_1020130:1.0E-22,(:1.0E-22,(Psittacus_332937:0.044181,(((Alisterus_682886:0.025857,Psittacula_1020126:0.02314):0.002518,Micropsitta_989086:0.035173):0.003373,(Chalcopsitta_276608:0.035748,Platycercus_512910:0.031536):0.003623):0.005708,Psittacus_332937:0.044181,(((Alisterus_682886:0.025857,Psittacula_1020126:0.02314):0.002518,Micropsitta_989086:0.035173):0.003373,(Chalcopsitta_276608:0.035748,Platycercus_512910:0.031536):0.003623):0.005708):1.0E-22,:1.0E-22,(Psittacus_332937:0.044181,(((Alisterus_682886:0.025857,Psittacula_1020126:0.02314):0.002518,Micropsitta_989086:0.035173):0.003373,(Chalcopsitta_276608:0.035748,Platycercus_512910:0.031536):0.003623):0.005708,Psittacus_332937:0.044181,(((Alisterus_682886:0.025857,Psittacula_1020126:0.02314):0.002518,Micropsitta_989086:0.035173):0.003373,(Chalcopsitta_276608:0.035748,Platycercus_512910:0.031536):0.003623):0.005708):1.0E-22)Psittacidae_1020130:1.0E-22,(Cacatua_619340:1.0E-22)Cacatuidae_512919:0.03402,(Psittacus_332937:0.044181,(((Alisterus_682886:0.025857,Psittacula_1020126:0.02314):0.002518,Micropsitta_989086:0.035173):0.003373,(Chalcopsitta_276608:0.035748,Platycercus_512910:0.031536):0.003623):0.005708):0.007079)Psittaciformes_1020133:0.080722,((Acanthisitta_1085741:1.0E-22)Acanthisittidae_901940:0.104596,(((Menura_73933:1.0E-22)Menuridae_73954:0.059299,((Climacteris_531218:1.0E-22)Climacteridae_73972:0.077503,((Malurus_901831:1.0E-22)Maluridae_901832:0.083712,((Corvus_952596:1.0E-22)Corvoidea_635217:0.044225,((Picathartes_699624:1.0E-22)Picathartidae_176465:0.053895,(((Bombycilla_613883:1.0E-22)Bombycillidae_613878:0.069549,((Sylvia_463177:1.0E-22)Sylviidae_259942:0.055851,(Turdus_568571:1.0E-22)Turdidae_96286:0.063024):0.00352):3.93E-4,(((Fringilla_28336:1.0E-22)Fringillidae_839319:0.036294,(Passer_515158:1.0E-22)Passeridae_1011209:0.040818):0.008852,((Ploceus_370815:1.0E-22)Ploceidae_1031977:0.023436,(Vidua_507121:1.0E-22)Estrildidae_507124:0.027999):0.005305)Passeroidea_176458:0.013079):0.009812):0.006319):0.009903):0.012328):0.006066):0.026149,((((Smithornis_622872:1.0E-22)Eurylaimidae_622873:0.054061,(Pitta_44875:1.0E-22)Pittidae_44873:0.07916):0.002972,Sapayoa_29742:0.064324):0.032117,(((Tyrannus_463185:0.042419,Mionectes_683046:0.038317):0.011208,(Pipra_872124:1.0E-22)Pipridae_881043:0.037734):0.028602,((Thamnophilus_799167:1.0E-22)Thamnophilidae_799152:0.061805,((Grallaria_1041027:1.0E-22)Formicariidae_472037:0.058324,((Scytalopus_44860:1.0E-22)Rhinocryptidae_44868:0.055361,(Dendrocolaptes_390841:1.0E-22)Dendrocolaptidae_155232:0.055765):0.004101):0.004199):0.014647):0.013458):0.014098):0.011135)Passeriformes_1041547:0.05194):0.003214):0.001248):0.002413,((((Leptosomus_897862:1.0E-22)Leptosomidae_897861:0.08109,(Trogoniformes_539130:1.0E-22,((Trogon_1065611:0.03286,Pharomachrus_989089:0.03198):1.0E-22,(Trogon_1065611:0.03286,Pharomachrus_989089:0.03198):1.0E-22)Trogoniformes_539130:1.0E-22,((((((Dryocopus_733986:1.0E-22)Picidae_1020138:0.045771,(Indicator_467838:1.0E-22)Indicatoridae_467845:0.040802):0.019814,((Capito_815707:1.0E-22)Ramphastidae_489463:0.061571,(Megalaima_291638:1.0E-22)Megalaimidae_291635:0.070621):0.028918)Piciformes_472432:0.080422,((Bucco_483803:1.0E-22)Bucconidae_483802:0.097348,(Galbula_484896:1.0E-22)Galbulidae_484892:0.093829)Galbuliformes_484893:0.02902):0.012788,(((((Momotus_989084:1.0E-22)Momotidae_489432:0.084333,(Alcedo_549518:1.0E-22)Alcedinidae_938411:0.120941):0.009393,(Todus_284297:1.0E-22)Todidae_815966:0.096383):0.014113,((Brachypteracias_483804:1.0E-22)Brachypteraciidae_483798:0.059926,(Coracias_244695:1.0E-22)Coraciidae_244696:0.059306):0.025887):0.00185,(Merops_989088:1.0E-22)Meropidae_815968:0.113525):0.012257):0.004011,(((Phoeniculus_834690:1.0E-22)Phoeniculidae_834689:0.098169,(Upupa_412128:1.0E-22)Upupidae_291860:0.099034)Upupiformes_815967:0.100031,((Tockus_1097399:1.0E-22)Bucerotidae_489457:0.067023,(Bucorvus_991312:1.0E-22)Bucorvidae_991314:0.0305)Bucerotiformes_341907:0.062953):0.015769):0.006487,(Trogon_1065611:0.03286,Pharomachrus_989089:0.03198):0.086987):0.00136):0.003193,(((Strix_427905:0.019555,Athene_98071:0.04265):0.038003,(Tyto_1065605:0.02467,Phodilus_178684:0.021908)Tytonidae_402457:0.038841)Strigiformes_1028829:0.011322,(Urocolius_261312:1.0E-22)Coliiformes_815970:0.148957):0.001582):0.001889,((Cathartes_317003:0.008966,Sarcoramphus_819164:0.007934)Cathartidae_363021:0.028138,(((Buteo_119211:0.026466,Gampsonyx_767825:0.047509)Accipitrinae_786440:0.006245,(Pandion_509844:1.0E-22)Pandioninae_509843:0.039038)Accipitridae_1036185:0.009904,(Sagittarius_1036187:1.0E-22)Sagittariidae_1036188:0.048561):0.011531):0.001418):0.001111):0.005212):0.002734,((((Eupodotis_521835:0.024254,Choriotis_3600037:0.022179)Otididae_966318:0.063626,(((((Aramus_915651:1.0E-22)Aramidae_915649:0.034399,(Grus_414354:1.0E-22)Gruidae_446460:0.027902):0.016386,(Psophia_915642:1.0E-22)Psophiidae_915652:0.06858):0.007701,((Himantornis_383930:0.036588,Rallus_440612:0.035633):0.045303,(Sarothrura_399793:0.098432,(Heliornis_440620:1.0E-22)Heliornithidae_440606:0.081266):0.013724):0.041851):0.020906,(((Coua_787071:0.072867,(Centropus_1039514:1.0E-22)Centropidae_1040900:0.105747):0.00457,(Cuculus_1041429:0.052701,(Phaenicophaeus_1041421:0.024286,(Coccyzus_891428:1.0E-22)Coccyzidae_1041414:0.038539):0.034617):0.028485):0.010289,((Crotophaga_1041422:1.0E-22)Crotophagidae_1041423:0.06579,(Geococcyx_212185:1.0E-22)Neomorphidae_173050:0.075601):0.015668)Cuculiformes_212171:0.047155):0.001564):0.002641,(Musophagiformes_539139:1.0E-22,((Tauraco_539140:0.045392,Corythaeola_842352:0.040341)Musophagidae_539141:1.0E-22,(Tauraco_539140:0.045392,Corythaeola_842352:0.040341)Musophagidae_539141:1.0E-22)Musophagiformes_539139:1.0E-22,(Tauraco_539140:0.045392,Corythaeola_842352:0.040341)Musophagidae_539141:0.040747,((Gavia_803675:1.0E-22)Gaviiformes_70684:0.049699,((((((Eudocimus_689774:1.0E-22)Threskiornithidae_480157:0.053985,(Cochlearius_154816:0.025018,Ardea_860130:0.029045)Ardeidae_609781:0.032668):0.001574,(((Scopus_464703:1.0E-22)Scopidae_1057476:0.05511,(Balaeniceps_597797:1.0E-22)Balaenicipitidae_597796:0.033735):0.001343,(Pelecanus_316994:1.0E-22)Pelecanidae_452465:0.045666):0.010306):0.001878,((Fregata_108973:1.0E-22)Fregatidae_452471:0.036293,(((Phalacrocorax_322277:1.0E-22)Phalacrocoracidae_969838:0.051194,(Anhinga_443638:1.0E-22)Anhingidae_443646:0.039714):0.004943,(Morus_752683:1.0E-22)Sulidae_452462:0.031659):0.017862):0.005898):0.00116,(Ciconia_363012:1.0E-22)Ciconiidae_363013:0.043283):0.001253,((((Diomedea_379419:1.0E-22)Diomedeidae_85277:0.026207,(Oceanodroma_172642:0.032772,((Pelecanoides_904488:1.0E-22)Pelecanoididae_904487:0.024161,(Puffinus_1028843:1.0E-22)Procellariidae_1028841:0.015536):0.015313):0.002986):8.24E-4,Oceanites_656590:0.045177)Procellariiformes_452461:0.004445,(Eudyptula_388853:1.0E-22)Sphenisciformes_494366:0.044753):0.002742):0.001953):0.0014):0.001505):0.002031,(Opisthocomus_70726:1.0E-22)Opisthocomiformes_928359:0.089041):0.002382):0.001494,((((((Podargus_313122:1.0E-22)Podargidae_313130:0.031374,(Batrachostomus_275129:1.0E-22)Batrachostomatidae_275130:0.038779):0.051052,(((((Colibri_804122:0.036348,Phaethornis_174369:0.039041)Trochilidae_810751:1.0E-22)Trochiliformes_810738:1.0E-22,(Colibri_804122:0.036348,Phaethornis_174369:0.039041)Trochilidae_810751:0.086258,((Hemiprocne_697438:1.0E-22)Hemiprocnidae_882744:0.041301,(Aerodramus_534819:0.042417,Streptoprocne_697413:0.026977)Apodidae_609796:0.013721)Apodiformes_609798:0.037704):0.014326,(Aegotheles_540029:1.0E-22)Aegothelidae_540031:0.092918):0.012744,((Eurostopodus_726315:1.0E-22)Eurostopodidae_726316:0.042431,(Caprimulgus_275134:1.0E-22)Caprimulgidae_275127:0.045907):0.033167):0.001994):0.002299,(((Nyctibius_grandis_178249:0.017044,Nyctibius_bracteatus_178250:0.023877)Nyctibius_178253:1.0E-22)Nyctibiidae_178243:1.0E-22,(Nyctibius_grandis_178249:0.017044,Nyctibius_bracteatus_178250:0.023877)Nyctibius_178253:0.040279,(Steatornis_701547:1.0E-22)Steatornithidae_701556:0.075216):0.001377):0.003449,((Eurypyga_86682:1.0E-22)Eurypygidae_86683:0.049583,(Rhynochetos_86676:1.0E-22)Rhynochetidae_86678:0.045071):0.067821):0.002659,((((Phaethon_rubricauda_509057:0.002406,Phaethon_lepturus_855119:0.002726)Phaethon_330010:1.0E-22)Phaethontidae_452467:1.0E-22,(((((Columba_938415:0.033245,Geotrygon_449653:0.032737):0.009269,Treron_873964:0.035234):0.001206,(Otidiphaps_392964:0.023405,Columbina_935135:0.038143):0.002133)Columbiformes_363030:0.078976,(Monias_582942:0.023104,Mesitornis_966321:0.023582)Mesitornithidae_966320:0.083163):0.002749,(Syrrhaptes_880217:0.028131,Pterocles_244698:0.030308)Pteroclidae_244699:0.070212):0.00144,(Phaethon_rubricauda_509057:0.002406,Phaethon_lepturus_855119:0.002726)Phaethon_330010:0.075196):0.001028,((Phoenicopterus_443649:1.0E-22)Phoenicopteriformes_472435:0.036539,(Podiceps_329993:1.0E-22)Podicipediformes_452464:0.070732):0.019648):0.001701):0.002134):0.044959)Neognathae_241846:0.066177)Aves_81461;"
try to see if we can make it more consistent
instead of converting body to JSON, probably better to use argument encode="json"
I'm going to start a list of 'convience functions' that would be useful to have on top of what we have.
First up -- retrieve TreeIDs from a given study ID, which goes somethin like this now
cichlid_summary <- get_study_meta("2655")
names(cichlid_summary$nexml$treesById$trees2655$treeById)
[1] "tree6182" "tree6181"
to remove the ids from the tip labels returned by tol_induced_subtree for instance.
as they will be removed from the API in the future (see OpenTreeOfLife/treemachine#183, OpenTreeOfLife/taxomachine#94), are confusing and unreliable.
Get this error when trying a call to tol_subtree
:
> phy <- tol_subtree(node_id=3045600);
Error: 'make_phylo' is not an exported object from 'namespace:rncl'
Confirmed by trying:
> rncl::make_phylo
Error: 'make_phylo' is not an exported object from 'namespace:rncl'
The function does exist:
> rncl:::make_phylo
function (ncl, simplify = TRUE)
{
trees <- make_raw_phylo(ncl)
trees <- lapply(trees, function(tr) {
ape::collapse.singles(tr)
})
if (length(trees) == 1 || simplify) {
trees <- trees[[1]]
class(trees) <- "phylo"
}
else {
stop("not yet implemented")
}
trees
}
<environment: namespace:rncl>
The function phylo_from_otl
calls make_phylo
as:
> phy <- rncl::make_phylo(fnm, file.format="newick")
But even using :::
, I get the error:
> phy <- rncl:::make_phylo(fnm, file.format="newick")
Error in rncl:::make_phylo(fnm, file.format = "newick") :
unused argument (file.format = "newick")
with no resulting tree.
I imagine there is just one step missing. Perhaps this should be posted as an rncl
issue.
BTW, I re-cloned and re-installed rncl
, so I am up-to-date.
e.g.,
tol_subtree(ott_id = "adfasdf")
Example:
tnrs_match_names("Heliconia sanctae-martae")
search_string unique_name approximate_match ott_id number_matches is_synonym
1 <NA> <NA> <NA> <NA> <NA> <NA>
is_deprecated
1 <NA>
Warning message:
In tnrs_match_names("Heliconia sanctae-martae") :
NAs introduced by coercion
The dot function for tnrs returns the proper output.
reported on OpenTreeOfLife/feedback#62
add importFrom for functions needed for external packages.
Not sure if this is an issue that can/should be solved by the OT API team or if rotl can solve internally. The OT API returns newick strings in various formats, so that R doesn't seem to know how to read them all in. I was playing around with the example on the main rotl page, and it works for the first tree in the list, but it can't read trees further down. I expect that a user may want to examine the different study trees in a given set (maybe to maximize taxonomy for example). Something like this where you can iterate over the returned trees:
allTreeData <- NULL
for(i in sequence(length(furry_ids))){
furry_metadata <- httr::content(get_study_meta(furry_ids[[i]]))
lista <- unlist(furry_metadata$nexml$treesById)
lista <- lista[grep("ElementOrder", names(lista))]
for(j in sequence(length(unlist(lista)))){
tr_string <- get_study_tree(study=furry_ids[[i]], tree=unlist(lista)[[j]],format="newick")
tr_string <- gsub(" ", "_", tr_string) #issues with spaces
tr_string <- gsub("'", "", tr_string) #issues with apostrophes
tr <- try(read.tree(text=tr_string))
allTreeData <- rbind(allTreeData, c(furry_ids[[i]], lista[j], length(tr$tip.label)))
}
}
Ultimately, it would be good if there were some standards so that multiple trees could be compared.
I think we are pretty close to releasing rotl to CRAN.
If you have a minute, please look around and let me know if you find any bugs or things that we could improve. I'll try to finish/improve the vignette in the next few days.
I listed myself as maintainer. Are you (@dwinter and @josephwb) ok with it?
Also, I'm thinking of starting the onboarding process to have it on @ropensci ? Any objections?
currently .get_study_tree returns a nexus file with no taxa if the study doesn't exist, we should try to catch that to let the user know that the response is effectively empty.
as they are not stable nor intended for human consumption: OpenTreeOfLife/feedback#63 (comment)
It seems that get_study_tree doesn't return the same number of trees as get_study_meta depending on whether the study is used in the synthetic tree.
If the study is used in the synthetic tree, then get_study_tree will only return 1 tree (the one used for synthesis) but if none of the trees are included in the synthetic tree, then get_study_tree will return all the trees associated with the study.
> res <- studies_find_trees(property="ot:ottTaxonName", value="Drosophilia")
> res
study_ids n_trees
1 pg_1257 2
2 pg_309 1
3 ot_97 1
4 pg_2780 1
5 pg_2885 1
6 pg_313 1
7 pg_2461 4
8 pg_2769 7
9 pg_1940 1
> lapply(res$study_ids, function(x) get_tree_ids(get_study_meta(x)))
[[1]]
[1] "tree6547" "tree6548"
[[2]]
[1] "tree254" "tree255" "tree256" "tree257"
[[3]]
NULL
[[4]]
[1] "tree6446"
[[5]]
[1] "tree6689" "tree6690" "tree6691" "tree6692"
[[6]]
[1] "tree6681"
[[7]]
[1] "tree5287" "tree5288" "tree5289" "tree6655"
[[8]]
[1] "tree6409" "tree6410" "tree6411" "tree6412" "tree6413" "tree6414" "tree6415"
[[9]]
[1] "tree3942" "tree3943" "tree3944"
> lapply(res$study_ids, function(x) candidate_for_synth(get_study_meta(x)))
[[1]]
NULL
[[2]]
NULL
[[3]]
[1] "tree1" "tree2" "tree3" "tree4" "tree5" "tree6" "tree7" "tree8" "tree9"
[[4]]
NULL
[[5]]
[1] "tree6690"
[[6]]
[1] "tree6681"
[[7]]
NULL
[[8]]
NULL
[[9]]
[1] "tree3943"
get_study_tree(study_id="pg_710", tree_id="tree1277", tip_label='ott_taxon_name')
Results in
Error in rncl(file = file, ...) : Taxon number 39 (coded by the token Pratia angulata) has already been encountered in this tree. Duplication of taxa in a tree is prohibited.
Using "original_label"
works, but presumably two tips were mapped to the same OpenTree taxon (which makes sense). I'd like to use the OpenTree names (they're already TNRS'ed) but there is this error (occurs in several of the 76 trees I'm trying to examine, so fairly frequent). I think the error is actually being thrown by rncl.
I'm not sure what the best behavior would be in this case. One approach would be to add a suffix to each of the duplicate taxon names; another would be to drop all but one of the duplicates randomly; a third would be avoiding this error but return a tree with duplicate names (i.e., ape is fine with duplicate names, so calling that instead of ncl in these cases might make sense, or rncl could be modified to avoid this problem itself).
Hello, I couldn't download rotl due to below error. Any idea what I am missing? This is my first R download from github, so it may be something super obvious... Or is it a version problem?
Any help is appreciated.
Thank you,
Christine
Code and error:
library(devtools)
install_github("fmichonneau/rotl")
Downloading github repo fmichonneau/rotl@master
Installing rotl
Installing dependencies for rotl:
rncl
'/Library/Frameworks/R.framework/Resources/bin/R' --vanilla CMD INSTALL
'/private/var/folders/sh/9gq4xtb968z45j7p2vp2f9kc0000gn/T/RtmpgTw4tq/devtools41e7b01fba8/fmichonneau-rotl-b161a59'
--library='/Library/Frameworks/R.framework/Versions/3.1/Resources/library' --install-tests
ERROR: dependency ‘rncl’ is not available for package ‘rotl’
the package description is currently too short.
For some reason, induced subtree can be retrieved using ott ids c(357968, 867416, 939325) , but not c(357968, 867416, 939325, 462102) .
This succeeds:
> rotl::tol_induced_subtree(ott_ids = c(357968, 867416, 939325))
Phylogenetic tree with 3 tips and 1 internal nodes.
Tip labels:
[1] "Blastophaga_nipponica_ott939325" "Blastophaga_psenes_ott357968"
[3] "Blastophaga_quadrupes_ott867416"
Node labels:
[1] "Blastophaga_ott462102"
Unrooted; no branch lengths.
>
but this fails:
> rotl::tol_induced_subtree(ott_ids = c(357968, 867416, 939325, 462102))
Error: HTTP failure: 500
Index: 32, Size: 32
Is this an opentree or rotl issue?
that would allow to match tree + data down stream as the API lower cases everything and makes matching potentially more tricky down the road
Not sure whether to report this to the RNCL repo, OpenTree or to this one. But here goes...
At the moment we can't read quite a few of the trees from the studies endpoints. Here's an example:
get_study_tree(study_id="pg_1762", tree_id="tree3549")
storing implied block: TAXA
storing read block: TREES
Error in build_raw_phylo(ncl) :
missing edge lengths are not allowed in phylo class
ape::read.tree
will try and read these files, but the resulting tree is a mess. Half of the edge-lengths are missing and I think some internal nodes are being treated as tips(?)
tf <- tempfile()
get_study_tree("pg_1762", get_tree_ids(meta)[2], file_format="newick", file=tf)
ape::read.tree(tf)
sum(is.na(tr$edge.length))/length(tr$edge.length)
0.48717
And replacing the single quotes and spaces doesn't seem to help
tf2 <- tempfile()
clean <- gsub(" ", "_", gsub("'","",scan(tf,"character", sep="\n")))
cat(clean, file=tf2)
rncl::read_newick_phylo(tf2)
storing implied block: TAXA
storing read block: TREES
Error in build_raw_phylo(ncl) :
missing edge lengths are not allowed in phylo class
It seems like this is problem with the conversion to newick format on the Open Tree end, but thought I should check with the devleoper of rncl
first @fmichonneau !
for instance, it should be easy to request a tree stored in treebase if the study is deposited there. The information is accessible from get_study_meta:
get_study_meta("pg_1940")$nexml$^ot:dataDeposit
same thing with DOI and crossref:
get_study_meta("pg_1940")$nexml$^ot:studyPublication
@dwinter it would be great to have your blue fish red fish vignette in the repo.
I'm running out of time today to do it and don't want to forget, but feel free to push it if you have time.
Not sure if Windows has anything to do with it. I installed rncl recently, but got this error message toward the end of the output when trying to install rotl (as of 1:41 PM EST, 9/19):
* checking for file 'C:\Users\Shan\AppData\Local\Temp\Rtmpm6RsjB\devtools2c64c15588d\rotl-master/DESCRIPTION' ... OK
* preparing 'rotl':
* checking DESCRIPTION meta-information ... OK
* installing the package to build vignettes
* creating vignettes ...Warning: running command '"C:/PROGRA~1/R/R-31~1.1/bin/x64/Rscript" --vanilla --default-packages= -e "tools::buildVignettes(dir = '.', tangle = TRUE)"' had status 1
ERROR
Quitting from lines 33-43 (datamash.Rmd)
Error: processing vignette 'datamash.Rmd' failed with diagnostics:
could not find function "studies_find_studies"
Execution halted
Error: Command failed (1)
In addition: Warning message:
package ‘’ is not available (for R version 3.1.1)
e.g.
taxonomy_subtree(ott_id = 3658331, output_format = "raw")
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.