-
Notifications
You must be signed in to change notification settings - Fork 151
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
Move metadata to Subject and extend for age_in_days attribute #1423
Comments
@bendichter what subject are you referring to in the above? Is a subject object being saved to the NWB file and you're referring to moving the age_in_days to this object? |
@isaak-willett PyNWB allows you to save a specimen_name -> subject_id (I think?) The - neurodata_type_def: AIBSSubject
neurodata_type_inc: Subject
doc: "Allen Institute for Brain Science subject with strain information"
attributes:
- name: strain
dtype: text
doc: "the subject's strain" Then, the - neurodata_type_def: EcephysLabMetaData
neurodata_type_inc: LabMetaData
doc: "Metadata for ecephys sessions"
attributes:
- name: stimulus_name
dtype: text
doc: "the name of the stimulus set used for this session" Then, with the changes in #1425, https://github.com/AllenInstitute/AllenSDK/blob/internal/allensdk/brain_observatory/ecephys/nwb/__init__.py could be simplified to: import os
from pynwb import load_namespaces, get_class
namespace_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "AIBS_ecephys_namespace.yaml"))
load_namespaces(namespace_path)
EcephysProbe = get_class('EcephysProbe', 'AIBS_ecephys')
EcephysLabMetaData = get_class('EcephysLabMetaData', 'AIBS_ecephys')
AIBSSubject = get_class('AIBSSubject', 'AIBS_ecephys')
def to_dict(self):
out = {}
for key in self.__nwbfields__:
if key != 'name':
out[key] = getattr(self, key)
return out
EcephysLabMetaData.to_dict = to_dict Note the addition of the line Let me know if that doesn't make sense... |
I agree with everything @rly has said here, but I'd go with more of a step-wise approach. To me, the highest priority issue here is that there are several fields that were added to the AIBS extension that already exist in the from datetime import datetime
from dateutil.tz import tzlocal
from pynwb import NWBFile, Subject
nwbfile = NWBFile('session_description','identifier',datetime.now(tzlocal()))
nwbfile.subject = Subject(subject_id="this_subject_id", age="age in days", genotype="this_genotype", sex='M') and read with, e.g. nwbfile.subject.age
'age in days' That's simple enough, but I think the challenge here is going to be making sure the allensdk can handle data in this new location and in the old location, ensuring that you can make this change while still being able to read data that you have already released. I'd be interested to hear your thoughts on how you might implement this. Then there are two issues that I see as orthogonal/separable: Then there is the issue of auto-generating the class vs. manually generating the class. I agree this would be better as auto than manual, which is what it currently is, but let's save that for a separate issue. There is also the idea of extending NWB's |
Resolved by: #1549 |
Included subject information in EcephysLabMetaData object. This information would be better in Subject. In fact, there are already fields for "sex", "strain", "genotype", and "date_of_birth" in the Subject object. If you want to pre-compute the 'age_in_days" and provide that as an attribute, the best way to do that would be to extend Subject.
AllenSDK/allensdk/brain_observatory/ecephys/nwb/AIBS_ecephys_extension.yaml
Lines 29 to 50 in a040661
Split off from: #1330
The text was updated successfully, but these errors were encountered: