hmsc-r / HMSC

GNU General Public License v3.0
102 stars 37 forks source link

Birdtree.org phylogenetic trees #107

Open bwegsche opened 3 years ago

bwegsche commented 3 years ago

Hello,

I'm working on a joint species distribution model for birds in a Canadian watershed. We have defined a model including YData, XData and TrData following the workflow outlined in the Statistical Ecology website. When I try to include phylogenetic infromation, however, I run into problems.

m = Hmsc(Y=YData, XData = XData, XFormula=XFormula,

I assume the species names of the tree and the YData are not matching.

I'm using phylogenetic trees downloaded from the birdtree.org website similar as in the Tikhonov et al (2019) paper. When I compare the format of the phylogenetic tree in the example Rscript from your website to our tree there are some differences. Ours is in the nexus format and includes a list of 100 trees, whereas in the template script there is a single tree in the parenthic format (.tree ending). I tried running our script using a arbitrarily chosen tree (1 out of the 100 tree list) but I only get the error stated above. What was your strategy when you used birdtree.org as a data source and how do I have to format the data to use it in Hmsc? Unfortunately I'm not very familiar working with phylogenetic trees, so any guidance is highly appreciated. Is there an obvious mistake that you can already identify in my description.

Please let me know if you need further information.

Best regards, Bernhard

ovaskain commented 3 years ago

Hi Bermhard,

I recommend that you download from the Hmsc pages (https://www2.helsinki.fi/en/researchgroups/statistical-ecology/hmsc) the template we used for the past Hmsc course for submitting data for Hmsc analyses: https://www2.helsinki.fi/sites/default/files/atoms/files/hmsc_course_sign_up_material.zip

This includes a script that makes several consistency checks that point out the most usual problems. I would guess that in your case the species names do not match between the phylogeny & the Y-matrix. The script should help to identity if this is the case or if the problem is in something else.

Best,

O2

From: bwegsche @.> Sent: torstai 1. heinäkuuta 2021 13:26 To: hmsc-r/HMSC @.> Cc: Subscribed @.***> Subject: [hmsc-r/HMSC] Birdtree.org phylogenetic trees (#107)

Hello,

I'm working on a joint species distribution model for birds in a Canadian watershed. We have defined a model including YData, XData and TrData following the workflow outlined in the Statistical Ecology website. When I try to include phylogenetic infromation, however, I run into problems.

m = Hmsc(Y=YData, XData = XData, XFormula=XFormula,

· TrData = TrData, TrFormula = TrFormula,phyloTree = phyloTree,

*

· distr="probit", studyDesign=studyDesign,

*

· ranLevels=list(site_id=rL))

*

Error in corM[hM$spNames, hM$spNames] : subscript out of bounds

I assume the species names of the tree and the YData are not matching.

I'm using phylogenetic trees downloaded from the birdtree.org website similar as in the Tikhonov et al (2019) paper. When I compare the format of the phylogenetic tree in the example Rscript from your website to our tree there are some differences. Ours is in the nexus format and includes a list of 100 trees, whereas in the template script there is a single tree in the parenthic format (.tree ending). I tried running our script using a arbitrarily chosen tree (1 out of the 100 tree list) but I only get the error stated above. What was your strategy when you used birdtree.org as a data source and how do I have to format the data to use it in Hmsc? Unfortunately I'm not very familiar working with phylogenetic trees, so any guidance is highly appreciated. Is there an obvious mistake that you can already identify in my description.

Please let me know if you need further information.

Best regards, Bernhard

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/hmsc-r/HMSC/issues/107, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AEIYMZXRZKHWTDGXW6JB62LTVQ7ELANCNFSM47UGZMBA.

bwegsche commented 3 years ago

Hi Otso,

Thank you for the helpful information. I got the script running now. There were indeed mismatches between the phylogeny and the Y-matrix. The phylogeny data that I retrieved from birdtree.org used for several species a different genus name. There seem to be taxonomic reclassifications that have to be checked before using birdtree.org output as a phylogenetic tree.

Thanks for the help, Bernhard

From: ovaskain @.> Sent: Saturday, 3 July 2021 11:43 To: hmsc-r/HMSC @.> Cc: Bernhard Wegscheider @.>; Author @.> Subject: Re: [hmsc-r/HMSC] Birdtree.org phylogenetic trees (#107)

🍁External message: Use caution. Hi Bermhard,

I recommend that you download from the Hmsc pages (https://www2.helsinki.fi/en/researchgroups/statistical-ecology/hmsc) the template we used for the past Hmsc course for submitting data for Hmsc analyses: https://www2.helsinki.fi/sites/default/files/atoms/files/hmsc_course_sign_up_material.zip

This includes a script that makes several consistency checks that point out the most usual problems. I would guess that in your case the species names do not match between the phylogeny & the Y-matrix. The script should help to identity if this is the case or if the problem is in something else.

Best,

O2

From: bwegsche @.<mailto:@.>> Sent: torstai 1. heinäkuuta 2021 13:26 To: hmsc-r/HMSC @.<mailto:@.>> Cc: Subscribed @.<mailto:@.>> Subject: [hmsc-r/HMSC] Birdtree.org phylogenetic trees (#107)

Hello,

I'm working on a joint species distribution model for birds in a Canadian watershed. We have defined a model including YData, XData and TrData following the workflow outlined in the Statistical Ecology website. When I try to include phylogenetic infromation, however, I run into problems.

m = Hmsc(Y=YData, XData = XData, XFormula=XFormula,

· TrData = TrData, TrFormula = TrFormula,phyloTree = phyloTree,

*

· distr="probit", studyDesign=studyDesign,

*

· ranLevels=list(site_id=rL))

*

Error in corM[hM$spNames, hM$spNames] : subscript out of bounds

I assume the species names of the tree and the YData are not matching.

I'm using phylogenetic trees downloaded from the birdtree.org website similar as in the Tikhonov et al (2019) paper. When I compare the format of the phylogenetic tree in the example Rscript from your website to our tree there are some differences. Ours is in the nexus format and includes a list of 100 trees, whereas in the template script there is a single tree in the parenthic format (.tree ending). I tried running our script using a arbitrarily chosen tree (1 out of the 100 tree list) but I only get the error stated above. What was your strategy when you used birdtree.org as a data source and how do I have to format the data to use it in Hmsc? Unfortunately I'm not very familiar working with phylogenetic trees, so any guidance is highly appreciated. Is there an obvious mistake that you can already identify in my description.

Please let me know if you need further information.

Best regards, Bernhard

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/hmsc-r/HMSC/issues/107, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AEIYMZXRZKHWTDGXW6JB62LTVQ7ELANCNFSM47UGZMBA.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/hmsc-r/HMSC/issues/107#issuecomment-873378917, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ARJGE5MTQQ6F2LSNWPMNEMLTV3LTHANCNFSM47UGZMBA.

andburch commented 3 years ago

Quick question, @bwegsche : did you end up making a consensus tree from the multiple Birdtree phylogenies or were you able to to use the multi-tree in the HMSC model?

bwegsche commented 3 years ago

Hi @andburch ,

I'm not sure if this is a valid approach but I just selected for now one of the 100 trees as input in Hmsc. If you use the consensus function of the ape R package to create a consensus tree, you get an error message in Hmsc because branch length information is missing. If you use one randomly chosen tree the code works fine. Are you running into the same or similar problem?

ovaskain commented 3 years ago

Hi,

This is correct: you need to use one input tree rather than a collection of those. Choosing one e.g. randomly is a viable strategy.

O2

From: bwegsche @.> Sent: tiistai 6. heinäkuuta 2021 10:10 To: hmsc-r/HMSC @.> Cc: Ovaskainen, Otso T @.>; Comment @.> Subject: Re: [hmsc-r/HMSC] Birdtree.org phylogenetic trees (#107)

Hi @andburchhttps://github.com/andburch ,

I'm not sure if this is a valid approach but I just selected for now one of the 100 trees as input in Hmsc. If you use the consensus function of the ape R package to create a consensus tree, you get an error message in Hmsc because branch length information is missing. If you use one randomly chosen tree the code works fine. Are you running into the same or similar problem?

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/hmsc-r/HMSC/issues/107#issuecomment-874517094, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AEIYMZR7S2FF5JTEAAYOB63TWKT6HANCNFSM47UGZMBA.

andburch commented 3 years ago

I'm not sure how theoretically sound this is, but you can also use the consensus.edge() function in phytools to make a consensus MRC tree with branch lengths. It'll definitely take a bit of time to run, but that's what I'm doing. [If I'm horribly misguided, let me know!]