ericgoolsby / Rphylopars

Phylogenetic Comparative Tools for Missing Data and Within-Species Variation
28 stars 11 forks source link

R aborts session due to fatal error when running phylopars function from Rphylopars package #42

Closed amalicea09 closed 3 years ago

amalicea09 commented 3 years ago

Every time I try running the phylopars function (code used below and data set attach) R aborts the session. Does anybody have any suggestions?

Raw supplementary data from Craig et al 2020.txt

library(ape) library(devtools) library(Rphylopars)

Tree Set Up

tree <- read.tree(text= " (((((((((((((Eustala_Sp., Metazygia_wittfeldae),(((Araneus_antherea, Araneus_diadematus, Araneus_gemmoides, Araneus_marmoreus, Araneus_sericatus, Araneus_trifolium), Larinioides_cornutus),( Neoscona_arabesca, Neoscona_crucifera, Neoscona_domiciliorum, Neoscona_hentzii))), Mangora_gibberosa), ((Verrucosa_arenata,( Eriophora_fuliginea, Eriophora_ravilla)), (Cyclosa_confusa, Cyclosa_conica, Cyclosa_ginnaga, Cyclosa_mulmeinensis))), (Nuctenea_umbratica, Nuctenea_sclopetaria)),( Zygiella_x-notata, (Metepeira_labyrinthea, Metepeira_grandiosa))),(((( Gasteracantha_cancriformis, Caerostris_darwini), Micrathena_gracilis), (Mastrophora_hutchinsoni, Mastrophora_phrynosoma)), ((Argiope_aemula, Argiope_aetherea, Argiope_amoena, Argiope_argentata, Argiope_aurantia, Argiope_bruennichi, Argiope_lobata, Argiope_keyserlingi, Argiope_trifasciata), ( Cyrtophora_citricola, Cyrtophora_moluccensis, Cyrtophora_unicolour)))), ((Nephila_clavata, Nephila_clavipes, Nephila_edulis, Nephila_inaurata, Nephila_pilipes, Nephila_plumipes, Nephila_senegalensis),Nephilengy_cruentata)), ((Leucauge_argentea, Leucauge_venusta, Leucauge_blanda, Leucauge_tesselata), Tetragnatha_versicolor)), Achaearanea_tepidariorum), (Latrodectus_geometricus, Latrodectus_hasselti, Latrodectus_hesperus)), (((((Schizocosa_mccooki , Peucetia_viridans ), Phidippus_ardens),( Metaltella_simoni,( Agelenopsis_aperta, Hololena_adnexa))), Deinopis_spinosa), Uloborus_diversus)), ((((((Loxosceles_arizonica, Loxosceles_laeta ), Scytodes_Sp.), Plectreurys_tristis), (Holocnemus_pluchei, Pholcus_phalangioides)), Dysdera_crocata), (Kukulcania_hibernalis, Hypochilus_pococki)));") tree <- compute.brlen(tree, 1) tree<-multi2di(tree) is.binary.tree(tree) is.rooted(tree)

Import Data

X<-read.csv("Raw supplementary data.csv",header=T)

Impute Missing Phylopars

PPE<-phylopars(trait_data =X,tree =tree, pheno_error = TRUE,phylo_correlated = TRUE, pheno_correlated = FALSE)

cecileane commented 3 years ago

I didn't try, but your tree needs to have branch lengths, for phylopars to run.

cecileane commented 3 years ago

I am sorry that R aborts the session, instead of throwing a useful error message...

amalicea09 commented 3 years ago

Thank you @cecileane. If I'm not mistaken, branch length is computed with the compute.brlen() function.

amalicea09 commented 3 years ago

Is in the code right below the read.tree(). I did not leave a space in between so it may not be too clear.

cecileane commented 3 years ago

Ah yes, I see it now. My apologies. hmm.

amalicea09 commented 3 years ago

I found that there were more species than the species included in the tree, causing R to abort when running phylopars().

Thank you.

cecileane commented 3 years ago

@ericgoolsby : it would be great to check for missing species in the tree, and throw an information error message if so... and avoid an unpleasant R crash.