Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I am trying to calculate phylogenetic signal using the phylosig function from phytools, but I get this error:

Error in vcv.phylo(tree) : the tree has no branch lengths

However, when I check my tree, it says it does have branch lengths!

> MCC_genus_tree
Phylogenetic tree with 1160 tips and 1159 internal nodes.
Tip labels:
    Anolis, Ornithorhynchus, Zaglossus, Tachyglossus, Rhynchocyon, Elephantulus, ...
Rooted; includes branch lengths.

What is going on? Any help would be appreciated.

EDIT:

My tree is a MCC tree downloaded from vertlife.

Help us help you. Can you provide an example? Possibly a smaller version of your tree that has the same problem? How about the code that you used to generate the tree? It is hard to respond to just an error message without knowing how you got to that message. – G5W Dec 31, 2019 at 12:39 Hi G5W, thank you - I realise this was a rather poorly written question! I have updated the question (but also found the answer). Thanks for taking a look, though! – Laura van Holstein Dec 31, 2019 at 13:18

The answer is I goofed. My data had no names, so phylosig dropped all my tips!

This is how I fixed it:

data_with_names <- data_without_names$trait
names(data_with_names) <- data_with_names$species_names
        

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.