This is a test version of Biostars. For the public version, visit https://www.biostars.org.
skbio "ValueError: Tree must be rooted" when using tree generated from SILVA's ACT

Hello,

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
tree=TreeNode.read("arb-silva.de_2020-10-16_id899307/arb-silva.de_2020-10-16_id899307.tree","newick")

When I run the command

   tree.is_root()

I get True.

But when I run the command

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

I getValueError: 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 have also asked the question here

skbio unweighted_unifrac newick_tree silva python

Please try to make a reproducible example instead of spreading different aspects of your error in Stackexchange and Github. You didn't mention that you are using Windows, seems according to Github to a Cython C code error. Have you tried in another OS? https://github.com/biocore/scikit-bio/issues/1685

1 answer

I used the solution just suggested here https://github.com/biocore/scikit-bio/issues/1685#issuecomment-712329209 and it works.

Log in to answer this question.