How to add a phylogenetic tree to the phyloseq object?

1775 views
Skip to first unread message

Ali shojaee Bakhtiari

unread,
Jul 25, 2016, 5:52:14 PM7/25/16
to Qiime 1 Forum
I ran pick_closed_reference_otus.py over the hmp dataset and acquired the biom file and the otu tables.
Now I need to run certain diversity analysis on the object. However the phylogenetic tree object in the phyloseq object is empty.
"
Error in access(physeq, "phy_tree", errorIfNULL) : 
  phy_tree slot is empty.
"
I understand that I never entered a phylogentic tree to my biom file. 

Now the question is how do I add green genes phylogenetic trees ( gg/99_otus.tree) to the phyloseq object?

It should be straight forward but I can't find a function for reading the tree file into phyloseq.

Thanks in advance :) 

Andrew Krohn

unread,
Jul 25, 2016, 8:13:42 PM7/25/16
to Qiime 1 Forum
I believe you want something like this for phyloseq:

## Load data into phyloseq
map=import_qiime_sample_data(mapfile)
tree=read_tree(treefile)
otus=import_biom(otufile,parseFunction=parse_taxonomy_greengenes)
mergedata=merge_phyloseq(otus,tree,map)

Ali shojaee Bakhtiari

unread,
Jul 26, 2016, 11:36:26 AM7/26/16
to Qiime 1 Forum
Thanks. Though I figured out that  using read_tree_greengenes to import the greengenes as a phyloseq and then combine them in the import_biom works best.

Andrew Krohn

unread,
Jul 26, 2016, 12:26:31 PM7/26/16
to Qiime 1 Forum
Right, you could use that as long as your database was greengenes and you used the db corresponding to the default tree. You can load any tree with the above code.

Happy it worked out for you.
Reply all
Reply to author
Forward
0 new messages