I'm trying to compute unweighted unifrac distances between samples. To do that, I generated a tree using SILVA's Alignment, Classification and Tree Service.

I read the tree in using:

from skbio import TreeNode

When I run the command


I get True.

But when I run the command

   Uni =unweighted_unifrac(seq1, seq2, esvs, tree)

I get ValueError: tree must be rooted. seq1 and se2 are abundance vectors of two samples. esvs is a list of names of the sequences used to generate the tree.

I would appreaciate any help with fixing this error.

Is there a problem using trees from SILVA? Should I try to generate a tree using skbio? Is yes, how do I do it with either a fasta file, or a pandas dataframe containing the sequences and the names?

Thank you!

EDIT: From the suggestion here I added

  Uni =unweighted_unifrac(seq1, seq2, esvs, tree, validate=False)

But this gives the error:

 ValueError: Buffer dtype mismatch, expected 'DTYPE_t' but got 'long'

PS: I've also asked this question here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.