Great! Thanks for all the help! Lindsey
On Wed, Jan 11, 2023 at 9:33 AM Liam J. Revell <liam.rev...@umb.edu> wrote: > Dear Lindsey. > > You should not adjust tol at all -- use the default. Sorry I wasn't clear > on that. It is just an (arbitrarily) small value that helps us avoid > evaluating solutions that are not "legal." (E.g., in your case, trying to > attach a tip to an edge *below* its parent node.) > > All the best, Liam > Liam J. Revell > Professor of Biology, University of Massachusetts Boston > Web: http://faculty.umb.edu/liam.revell/ > > > On 1/11/2023 7:58 AM, Lindsey Dehaan wrote: > > CAUTION: EXTERNAL SENDER > Hey Liam, > > Thanks alot! I really appreciate it! I installed the new version and I saw > your edits to the locate.fossil function on github. > > I just have one more question, I am new to the tol argument and I am not > sure what the default should be set to. I've set it to a couple numbers > (ex, 0.5, 0.1 0.01) and my fossil now places correctly but could you > possibly tell me what this argument means and what I should be setting it > to? > > Best, > Lindsey > > On Tue, Jan 10, 2023 at 6:07 PM Liam J. Revell <liam.rev...@umb.edu> > wrote: > >> Dear Lindsey. >> >> Thanks for sharing the code & data. It made the problem pretty easy to >> resolve. >> >> Turns out it is a simple numerical precision issue. >> >> I have resolved it by adding an optional argument tol with a sensible >> default value which most users can probably ignore (but can set to tol=0 >> if they want to guarantee the current behavior of locate.fossil). I >> pushed this update to *GitHub*: >> https://github.com/liamrevell/phytools/commit/f1dcddbf56a7ae6bf9bece223cd6a949a57eac5f >> <https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fliamrevell%2Fphytools%2Fcommit%2Ff1dcddbf56a7ae6bf9bece223cd6a949a57eac5f&data=05%7C01%7Cliam.revell%40umb.edu%7C6422b30bf70147843d2708daf3d39a24%7Cb97188711ee94425953c1ace1373eb38%7C0%7C0%7C638090387402381909%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=%2FJXMpg7Z1i%2BFfRVldtWd4dT7ITCbagH3wUZ01E%2BERhI%3D&reserved=0> >> . >> >> To obtain this updated version of *phytools* I recommend installing the >> package *remotes* and then running (from a fresh R session): >> >> remotes::install_github("liamrevell/phytools") >> >> Let us know if this fixes everything! >> >> All the best, Liam >> Liam J. Revell >> Professor of Biology, University of Massachusetts Boston >> Web: http://faculty.umb.edu/liam.revell/ >> <https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Ffaculty.umb.edu%2Fliam.revell%2F&data=05%7C01%7Cliam.revell%40umb.edu%7C6422b30bf70147843d2708daf3d39a24%7Cb97188711ee94425953c1ace1373eb38%7C0%7C0%7C638090387402381909%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=8bQ5oeB%2F%2B6HEvtu%2FdPrbzGpsorPxFPesbq%2FHm0WAOIM%3D&reserved=0> >> >> >> On 1/10/2023 4:42 PM, Lindsey Dehaan wrote: >> >> CAUTION: EXTERNAL SENDER >> Hey Liam, >> >> Thanks for the fast response. >> >> Attached is a simple script with the fossil I am having problems with. >> All the files should be attached. Let me know if I missed a file or you >> need anything else. >> >> I greatly appreciate your help on this. I have been stuck on this for a >> while now. >> >> Best, >> Lindsey >> >> >> On Tue, Jan 10, 2023 at 4:23 PM Liam J. Revell <liam.rev...@umb.edu> >> wrote: >> >>> Dear Lindsey. >>> >>> Thanks for posting your code, but would you mind sending me (it can be >>> off-list) an example in which I can also pull your data & tree and re-run >>> it with the real data that is generating the error? This might be helpful >>> in getting to the bottom of your issue. Thanks! >>> >>> All the best, Liam >>> Liam J. Revell >>> Professor of Biology, University of Massachusetts Boston >>> Web: http://faculty.umb.edu/liam.revell/ >>> <https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Ffaculty.umb.edu%2Fliam.revell%2F&data=05%7C01%7Cliam.revell%40umb.edu%7C6422b30bf70147843d2708daf3d39a24%7Cb97188711ee94425953c1ace1373eb38%7C0%7C0%7C638090387402381909%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=8bQ5oeB%2F%2B6HEvtu%2FdPrbzGpsorPxFPesbq%2FHm0WAOIM%3D&reserved=0> >>> >>> >>> On 1/10/2023 4:20 PM, Lindsey Dehaan wrote: >>> >>> CAUTION: EXTERNAL SENDER >>> >>> Hi all, >>> >>> I have a question regarding the phytools function locate.fossil(). >>> >>> I have had a lot of success with this function but there are two fossils of >>> mine that the function does not like. I give the function my phylogeny, a >>> max and min age for the fossil, and the edge for the fossil to be placed >>> on. So I basically just want the function to estimate the branch length >>> subtending the fossil and the position of where the node subtending the >>> fossil attaches in the phylogeny. >>> >>> For two of my fossils I get the following error. >>> >>> >>> >>> *Error in bind.tree(tree, tip, where = where, position = pp) : 'position' >>> is larger than the branch length* >>> >>> The function does not seem to like my edge constraint with these two >>> fossils. When I remove my edge constraint it works and the fossil is placed >>> in the correct time interval but just on a different edge estimated using >>> ML. For one of my fossils, the edge I place my fossil on ranges from 42 mya >>> to 4 mya and the age range for the fossil is between 33 and 28 mya. I am >>> confused why the function does not like the edge constraints I am giving >>> it. The error that I receive makes me believe that the position the >>> function is estimating for my fossil may be older than the edge constraint >>> I am giving it or I could just be missing something, most likely the >>> latter... >>> >>> Below is my code. This code works for almost all my fossils except for two >>> of them. >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> *fossil_to_add<-fossil_trait_data[13,] >>> locate_fossil_data<-rbind(extant_data, >>> fossil_to_add) # used this data in >>> locate.fossil()extant_sister_clade<-rownames(extant_data)[c(grep(fossil_info[13,7], >>> rownames(extant_data)), grep(fossil_info[13,8], >>> rownames(extant_data)))]mrca<-getMRCA(tree, >>> extant_sister_clade)edge<-mrcamin_time<- depth - fossil_info[13,4] # depth >>> is the root age of the phylogeny max_time<-depth - fossil_info[13,3] # the >>> max and min ages are positive numbers time_constraints<-c(max_time, >>> min_time)locate_fossil_tree<-locate.fossil(tree, locate_fossil_data, >>> time.constraint=time_constraints,edge.constraint=edge, plot=TRUE)* >>> >>> Any help or advice, would be greatly appreciated! >>> >>> Best, >>> Lindsey >>> -- >>> Lindsey DeHaan >>> Ph.D. Candidate >>> Department of Earth and Environmental Sciences >>> University of Michigan >>> >>> [[alternative HTML version deleted]] >>> >>> _______________________________________________ >>> R-sig-phylo mailing list - >>> R-sig-phylo@r-project.orghttps://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-phylo&data=05%7C01%7Cliam.revell%40umb.edu%7C27cb8a8eb3dc4651433008daf35090b6%7Cb97188711ee94425953c1ace1373eb38%7C0%7C0%7C638089824617167715%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=tYwyCJW%2BdLBEpy4Tn290%2BXqmQNkV6%2FdGGsJmgnBXUcU%3D&reserved=0 >>> >>> <https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-phylo&data=05%7C01%7Cliam.revell%40umb.edu%7C6422b30bf70147843d2708daf3d39a24%7Cb97188711ee94425953c1ace1373eb38%7C0%7C0%7C638090387402381909%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=GvpPnbC9xH8DU8Hut5Q7d12hxgQguaYHCPLV9pukGO8%3D&reserved=0> >>> Searchable archive at >>> https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.mail-archive.com%2Fr-sig-phylo%40r-project.org%2F&data=05%7C01%7Cliam.revell%40umb.edu%7C27cb8a8eb3dc4651433008daf35090b6%7Cb97188711ee94425953c1ace1373eb38%7C0%7C0%7C638089824617167715%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=AGbpdEbfZDhgeTNHnQsgzRkj2%2FngM5Ud%2FCDVEFDCvnw%3D&reserved=0 >>> >>> <https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.mail-archive.com%2Fr-sig-phylo%40r-project.org%2F&data=05%7C01%7Cliam.revell%40umb.edu%7C6422b30bf70147843d2708daf3d39a24%7Cb97188711ee94425953c1ace1373eb38%7C0%7C0%7C638090387402381909%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=YFTNbcqbu5WMZxdcKjdiiAU6HAdZTbobxUHw1mNz0GQ%3D&reserved=0> >>> >>> >> >> -- >> Lindsey DeHaan >> Ph.D. Candidate >> Department of Earth and Environmental Sciences >> University of Michigan >> >> > > -- > Lindsey DeHaan > Ph.D. Candidate > Department of Earth and Environmental Sciences > University of Michigan > > -- Lindsey DeHaan Ph.D. Candidate Department of Earth and Environmental Sciences University of Michigan [[alternative HTML version deleted]] _______________________________________________ R-sig-phylo mailing list - R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/