# Greengenes Tree Download With Branch Lengths

**URL:** https://forum.qiime2.org/t/greengenes-tree-download-with-branch-lengths/3329
**Category:** User Support
**Tags:** taxonomy, greengenes
**Created:** [March 6, 2018, 9:11pm UTC](https://forum.qiime2.org/t/greengenes-tree-download-with-branch-lengths/3329 "2018-03-06T21:11:25Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Stephanieorch](https://forum.qiime2.org/user_avatar/forum.qiime2.org/stephanieorch/32/4269_2.png) [@Stephanieorch](https://forum.qiime2.org/u/Stephanieorch)
#### Post date: [March 6, 2018, 9:11pm UTC](https://forum.qiime2.org/t/greengenes-tree-download-with-branch-lengths/3329/1 "2018-03-06T21:11:25Z")

</div>

How can I get the 97% GG tree that has branch lengths? Also is there a version I can download that is already a qza file? Thanks!

---

<div class="post-metadata">

### Author: ![colinbrislawn](https://forum.qiime2.org/user_avatar/forum.qiime2.org/colinbrislawn/32/6221_2.png) [@colinbrislawn](https://forum.qiime2.org/u/colinbrislawn)
#### Post date: [March 6, 2018, 9:34pm UTC](https://forum.qiime2.org/t/greengenes-tree-download-with-branch-lengths/3329/2 "2018-03-06T21:34:00Z")

</div>

Good afternoon Stephanie,

On the [resources page](https://docs.qiime2.org/2018.2/data-resources/#greengenes-16s-rrna) there is a link to the newest version of greengenes, which includes trees and branch lengths. At least it should... Are you getting an error?

> [@Stephanieorch](#):
>
> Also is there a version I can download that is already a qza file?

That's a great idea! We should totally include that with the default databases.

Colin

---

<div class="post-metadata">

### Author: ![Stephanieorch](https://forum.qiime2.org/user_avatar/forum.qiime2.org/stephanieorch/32/4269_2.png) [@Stephanieorch](https://forum.qiime2.org/u/Stephanieorch)
#### Post date: [March 6, 2018, 9:56pm UTC](https://forum.qiime2.org/t/greengenes-tree-download-with-branch-lengths/3329/3 "2018-03-06T21:56:46Z")

</div>

Hi Colin,

I'm still getting the branch error. I downloaded 13\_8 version of greengenes. Then I imported it with this command:

```auto
qiime tools import \
> --input-path 97_otus.tree \
> --output-path unrooted-tree.qza \
> --type 'Phylogeny[Rooted]'

```

But when I tried to run alpha rarefaction using the new .qza tree it didnt work and I got the " All non-root nodes in `tree` must have a branch length" error.

---

<div class="post-metadata">

### Author: ![colinbrislawn](https://forum.qiime2.org/user_avatar/forum.qiime2.org/colinbrislawn/32/6221_2.png) [@colinbrislawn](https://forum.qiime2.org/u/colinbrislawn)
#### Post date: [March 7, 2018, 12:08am UTC](https://forum.qiime2.org/t/greengenes-tree-download-with-branch-lengths/3329/4 "2018-03-07T00:08:27Z")

</div>

Thanks for posting your command. The [example on the Importing page](https://docs.qiime2.org/2018.2/tutorials/importing/#phylogenetic-trees-unrooted) uses  
`--type 'Phylogeny[Unrooted]'` while your script says  
`--type 'Phylogeny[Rooted]'`

Can you try passing `--type 'Phylogeny[Unrooted]'` instead, and see if the alpha rarefaction works?

Colin

---

<div class="post-metadata">

### Author: ![wasade](https://forum.qiime2.org/user_avatar/forum.qiime2.org/wasade/32/2317_2.png) [@wasade](https://forum.qiime2.org/u/wasade)
#### Post date: [March 7, 2018, 6:44am UTC](https://forum.qiime2.org/t/greengenes-tree-download-with-branch-lengths/3329/5 "2018-03-07T06:44:46Z")

</div>

Hi @Stephanieorch,

The issue comes from the reroot performed on that release of Greengenes where the added branch did not get set with a length (connecting "k\_\_Bacteria" to a common vertex with "k\_\_Archaea"). In QIIME1, this missing length was not an issue as PyCogent's `PhyloNode` interpreted a missing length as 0.0 when computing phylogenetic metrics so this went unnoticed at the time of release. One way to solve this is to open the tree, set a length, and write it out. An example of doing so is below using Python and saving a `Phylogeny[Rooted]` artifact.

```auto
In [1]: import skbio

In [2]: t = skbio.TreeNode.read('97_otus.tree')

In [3]: for n in t.traverse():
   ...: if n.length is None:
   ...: n.length = 0.0
   ...:

In [4]: import qiime2

In [5]: ar = qiime2.Artifact.import_data('Phylogeny[Rooted]', t)

In [6]: ar.save('97_otus.qza')
Out[6]: '97_otus.qza'

```

Best,  
Daniel

---

<div class="post-metadata">

### Author: ![system](https://forum-qiime2-org.s3.dualstack.us-west-2.amazonaws.com/original/3X/2/1/21af5fe23cb6f4579467c66a9ed94e55274ca7bd.svg) [@system](https://forum.qiime2.org/u/system)
#### Post date: [April 7, 2018, 12:45pm UTC](https://forum.qiime2.org/t/greengenes-tree-download-with-branch-lengths/3329/6 "2018-04-07T12:45:01Z")

</div>

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
