skbio "ValueError: Tree must be rooted" when using tree generated from SILVA's ACT
1
0
Entering edit mode
4.1 years ago
KHP • 0

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 • 1.3k views
ADD COMMENT
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode
4.1 years ago
KHP • 0

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

ADD COMMENT

Login before adding your answer.

Traffic: 1633 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6