pynwb icon indicating copy to clipboard operation
pynwb copied to clipboard

[Feature]: Support `get_class` with arbitrary recursion depth

Open bendichter opened this issue 2 years ago • 5 comments
trafficstars

What would you like to see added to PyNWB?

I am running into a problem automatically generating an extension I am creating of the form:

groups: 
  - neurodata_type: BioSample
    groups:
     - name: isDerivedFrom
       links:
        - type: BioSample

To make get_class work on this, we'd need to support arbitrary depth recursion, which is not currently supported.

Is your feature request related to a problem?

No response

What solution would you like?

modifications to get_class.

Do you have any interest in helping implement the feature?

Yes, but I would need guidance.

Code of Conduct

bendichter avatar Mar 10 '23 16:03 bendichter

Which of the groups in the example have a neurodata_type set, i.e., for which object would get_class be called?

oruebel avatar Mar 10 '23 18:03 oruebel

@oruebel good question. I want to call get_class("BioSample", "ndx-biosample"). I fixed the yaml to make that more clear.

bendichter avatar Mar 10 '23 18:03 bendichter

Just for further clarification, if you would set a neurodata_type for isDerivedFrom in your example, then get_class("BioSample", "ndx-biosample") would work, but without that it fails due to the nesting of groups, correct?

oruebel avatar Mar 10 '23 18:03 oruebel

Related: https://github.com/hdmf-dev/hdmf/pull/796

I don't think that PR covers cases where an object links to itself. I will have to add a test for that.

rly avatar Mar 10 '23 18:03 rly

Related: https://github.com/NeurodataWithoutBorders/pynwb/issues/1299

t-b avatar Mar 13 '23 14:03 t-b