nclark-lab / RERconverge

Analysis of convergence between organismal traits and DNA/protein sequences
GNU General Public License v3.0
47 stars 26 forks source link

Erro when using estimatePhangornTreeAll #66

Open ZhangXu-CAS opened 2 years ago

ZhangXu-CAS commented 2 years ago

Hi!

I'm performing maximum likelihood branch length estimation following PhangornTreeBuildingWalkthrough, however I get

estimatePhangornTreeAll(alndir="genes/", treefile="constr.tre", output.file="gene.trees") Processing genes/OG0000001.fa Error in UseMethod("unroot") : "unroot"没有适用于"NULL"目标对象的方法 此外: Warning message: In drop.tip(genetree, todropg) : drop all tips of the tree: returning NULL

Can anybody help solve it? Many thanks!

sorrywm commented 2 years ago

Hi ZhangXu,

Have you checked that the species names in genes/OG0000001.fa overlap with the tip labels in constr.tre? The method first subsets both alignment and tree to just the set of species that overlap within both.

If this is not the issue, please post or share your data so we can help you troubleshoot further.

Thank you for using RERconverge!

ZhangXu-CAS commented 2 years ago

Very much appreciate your quick reply!

I have checked the consistencies between genes file and the tip labels in constr.tre. I think it's ok.

I uploaded a subset of my genes file (genes.zip) and the master tree file (constre.tre.txt) whose topology is used to generate the tree. Please help find the problems.

Thank you!

genes.zip constr.tre.txt

sorrywm commented 2 years ago

The issue is additional spaces in your alignment file. If you read in your alignment using alnPhyDat = read.phyDat(genes/OG0000001.fa, type = "AA", format = "fasta") and then print the species names using names(alnPhyDat) you will see that the names have additional spaces on the end, e.g.: "Arctium " "Helianthus " "Tomato " "Lactuca "

These spaces are not present in the tip labels of your tree file. If you remove them from your alignments, you should be able to proceed.

Thank you for using RERconverge!

ZhangXu-CAS commented 2 years ago

Many thanks for your reply!

I fix the problem by removing all additional spaces on the end in the genes file, however, another error comes out:

Processing genes/OG0000001.fa Error in if (any(tree$edge.length < 0)) { : 需要TRUE/FALSE值的地方不可以用缺少值

What does it mean? I also added all the arguments passed to 'pml', but still doesn't work.

ECSaputra commented 2 years ago

This latest error was because the Newick tree file supplied did not have branch lengths information. I've updated the function so that it can account for that situation. Please let us know if there are more issues in re-running the function after re-installing the package.

Thank you for using RERconverge!