Hi Michael,
There issue here is some confusion as to how annotations associated with
particular elements in the source data get mapped or associated with
elements in the data model, a.k.a., scoping.
Your code attempts to access the annotations of the DataSet instance.
Annotations for the DataSet as a whole would correspond to annotations
at the file-scope. The sample does not have any annotations at file scope.
Nor does it have annotations at tree block scope; if it did, these
annotations would be accessible as part of the annotations of the
corresponding TreeList (``ds.tree_lists[0].annotations`` in the code).
Nor does it have annotations at the tree scope; if it did the
annotations would be available via, e.g.
``ds.tree_lists[0][0].annotations``.
There *are* however, annotations at *node* scope. To access these, you
would you have to dereference the particular nodes.
All of this is illustrated by the following code:
```
import dendropy
ds = dendropy.DataSet.get_from_path("pythonidae.beast.summary.tre",
"beast-summary-tree",
extract_comment_metadata=True)
print(ds.annotations)
for trees in ds.tree_lists:
print(trees.annotations)
for tree in trees:
print(tree.annotations)
for nd in tree:
print(nd.annotations)
```
In the above code, all the annotations are empty till we hit the
innermost loop.
Note that I have specified "nexus" rather than "beast-summary-tree" as
the schema. Both work equally well for populating the annotations set in
this case. Specifying "beast-summary-tree" simply creates and adds full
attributes to the nodes from the annotations. So, for example, the
annotation 'length_median' is a new attribute of the node with the value
given by the annotation value.
-- jeet
> --
> You received this message because you are subscribed to the Google
> Groups "DendroPy Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
dendropy-user...@googlegroups.com
> <mailto:
dendropy-user...@googlegroups.com>.
> For more options, visit
https://groups.google.com/d/optout.
--
--------------------------------------
Jeet Sukumaran
--------------------------------------
jeetsu...@gmail.com
--------------------------------------
Blog/Personal Pages:
http://jeetworks.org/
GitHub Repositories:
http://github.com/jeetsukumaran
Photographs (as stream):
http://www.flickr.com/photos/jeetsukumaran/
Photographs (by galleries):
http://www.flickr.com/photos/jeetsukumaran/sets/
--------------------------------------