Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NexsonProxy provides no way to get study-level properties #137

Open
jar398 opened this issue Dec 9, 2015 · 4 comments
Open

NexsonProxy provides no way to get study-level properties #137

jar398 opened this issue Dec 9, 2015 · 4 comments

Comments

@jar398
Copy link
Member

jar398 commented Dec 9, 2015

such as ^ot:focalClade.
or am I missing something?

@kcranston
Copy link
Member

What are you trying to do? I don't use NexsonProxy to get study-level properties. I'd do something like this:

    for study_id, studyobj in phy.iter_study_objs():
        nexml = get_nexml_el(studyobj)
        year = nexml.get('^ot:studyYear')

@jar398
Copy link
Member Author

jar398 commented Dec 9, 2015

NexsonProxy does a lot of other things that seem very nice that aren't provided by the raw nexson blob (get_nexml_el), such as structured access to OTUs, trees, edges, and nodes.

"Provides high level wrappers around a Nexson data model blob to
let it be treated as if it were a list of OTUs and a list of trees"

If it is useful, then as a matter of design it ought to provide at least as much service as the low-level form, since otherwise people will end up using a mix of the two, which would be confusing. If it is not useful, it should be deleted.

I am trying to rewrite parts of the conflict code (which is in jython and uses Java libraries) so that it looks more like peyotl. (I can't use peyotl directly since it doesn't run in jython.)

@jimallman
Copy link
Member

@jar398, you can get study-level properties like so:

np = NexsonProxy(nexson=blob)
nexml = np._nexml_el
year = nexml.get('^ot:studyYear')

Would you like a less "private" getter, like np.get_nexml_el()?

@jar398
Copy link
Member Author

jar398 commented Jan 13, 2016

Yes, less private, please, and maybe more abstract (not just exposing the raw json).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants