Closed hlapp closed 8 years ago
Thanks for testing out, sorry about that. I think you want: get_metadata(nexml, "characters")
. The second argument should be the (full) name of a nexml element. To avoid ambiguity, the function actually expects you to give the full path to the element, e.g. get_metadata(nexml, "otus/otu")
, but I mapped otu
and tree
separately for backwards-compatibility. Looks like I forgot to do that for char
(if that was previously an option). This new approach should allow you to get metadata for arbitrary elements (including meta elements themselves, if they are nested).
The documentation could stand to be improved on this matter as well.
We do want annotations for the char
elements. If I spell out the path it doesn't work either:
> get_metadata(nex,level="characters/char")
Error in slot(node, element) :
no slot of name "char" for this object of class "characters"
> get_metadata(nex,level="characters/format/char")
Error in as.list.default(X) :
no method for coercing this S4 class to a vector
The second invocation is actually the correct path in the XML, so that the first doesn't work is I guess expected. But the second one should work.
Here are the annotations as an example for one <char/>
element:
<char id="UBERON_2002002" label="anterior distal serration of pectoral fin spine" about="#UBERON_2002002" states="sa75ef9ac-e74e-4015-846d-27d793868951">
<meta xsi:type="ResourceMeta" rel="obo:IAO_0000219" href="http://purl.obolibrary.org/obo/UBERON_2002002" />
</char>
oh right, those char
elements. That's a bug, I'll take a look. Can you link me to a complete NeXML file that has meta
annotations on char
elements just for my testing?
okay, just pushed a fix, try now.
The following call results in an error since #133 has been merged:
Level "otu" appears to work fine: