AllenSDK icon indicating copy to clipboard operation
AllenSDK copied to clipboard

behavior session 875471358 has incorrect stimulus and errors on loading the dataset

Open matchings opened this issue 4 years ago • 10 comments

behavior_session_id = 875471358 has a few issues with it.

First, the behavior_session_table says the session_type is OPHYS_6_images_A, however that session_type should not exist for VisualBehaviorMultiscope experiments because the novel image set (which is supposed to be shown on OPHYS_6) should be image set B, not A. This is either a mistake in the stimulus that was run during the experiment, or a mistake in how the session is labeled in the behavior_session_table.

Second, when I try to load the behavior_session dataset object for this behavior_session_id, i get an error, shown below.

image

image

matchings avatar Sep 03 '21 20:09 matchings

This session appears to be one of the ones mentioned in this issue: https://github.com/AllenInstitute/AllenSDK/issues/2202

matchings avatar Sep 10 '21 03:09 matchings

Just want to make a note that this issue still exists even when the session_type is loaded from the pkl file instead of mTrain or lims, so it appears to be an instance of the incorrect stimulus being shown, not the session_type being incorrect

matchings avatar Jul 13 '22 23:07 matchings

@matchings what do you want to do about this session since the incorrect stimulus was shown?

aamster avatar Jul 15 '22 15:07 aamster

Also please if possible break down an issue into smallest possible. Here you have included 2 separate issues in 1: an issue about incorrect session type and a separate issue about not being able to load session

aamster avatar Jul 15 '22 15:07 aamster

The reason why retrieving this behavior session is failing is because all of the ophys experiments failed for this behavior session. And there is no "behavior-only" nwb file associated with it. So there is no nwb file to retrieve. @matchings how do you want to deal with it?

aamster avatar Jul 15 '22 16:07 aamster

@aamster There should be a 'behavior-only' NWB file for every behavior session experienced by any mouse that has ophys data. This behavior session (875471358) is from mouse 449653, which has ophys data listed in the ophys_experiment_table and ophys_session_table, which means that all of its behavior sessions should have NWB files.

My expectation is that any behavior sessions that do not have ophys data should have an empty list in the ophys_experiment_id column of the behavior_sessions table. For this behavior_session_id, that column is populated with a list of 7 ophys_experiment_ids. However none of those experiments appear in the ophys_experiment_table, which means that they failed QC.

There are other behavior sessions that took place on an ophys rig, but do not have passing ophys data for that session (indicated by an empty list or NaN in the ophys_experiment_id column of the behavior_session_table ) that have behavior-only NWB files and are able to be loaded via SDK.

Here is a gist showing my exploration that led to the statements above: https://gist.github.com/matchings/670175b68893d020e0ec2c3983d79feb

I think the real issue here is that metadata in the ophys_experiment_id column of the behavior_session table is somehow incorrect for this session, and somehow no behavior-only NWB file was generated for it.

This issue probably also applies to another 8 sessions documented in VBA as lacking behavior-only NWB files: https://github.com/AllenInstitute/visual_behavior_analysis/issues/824

matchings avatar Jul 20 '22 02:07 matchings

I think this should probably be tracked in a new issue that describes the actual problem here, which is that behavior-only NWBs are missing when they shouldnt be.

Regarding the "incorrect stimulus set", i think this is actually not a problem in this case.

matchings avatar Jul 20 '22 02:07 matchings

Behavior session 875471358 is the only behavior session I know of which should have a behavior-only nwb file but doesn't. Only behavior sessions without ophys data should have a behavior-only nwb file.

Using the latest behavior session table:

beh_sessions_new[(beh_sessions_new['ophys_session_id'].isna()) & (beh_sessions_new['file_id'].isna())]
Out[22]: 
                    equipment_name                                  full_genotype  mouse_id  ...      date_of_acquisition file_id isilon_filepath
behavior_session_id                                                                          ...                                                 
875471358                   MESO.1  Vip-IRES-Cre/wt;Ai148(TIT2L-GC6f-ICL-tTA2)/wt    449653  ...  2019-05-24 13:30:24.606     NaN             NaN

[1 rows x 21 columns]

I checked the behavior sessions in the vba issue you linked to above, and at least using branch 2.13.5, I could not reproduce the issue. I could instantiate BehaviorSession for all except 875471358. FYI all these sessions which couldn't instantiate lack eye tracking data, which we might have fixed in 2.13.5 so that they can be instantiated.

I will create a behavior only nwb file for session 875471358.

aamster avatar Jul 20 '22 16:07 aamster

Update: found out that there was a behavior-only nwb file for this session but for some reason it doesn't have a published_at date which makes it excluded. I will give it a published_at date.

aamster avatar Jul 20 '22 16:07 aamster

@aamster great, thanks, that all makes sense.

matchings avatar Jul 20 '22 17:07 matchings