I’m working with the allen neuropixels visual behaviour dataset. How can I search a mouses sex, age, genotype, and strain using its session id?
Hi @AngCamp – once you’ve created a VisualBehaviorNeuropixelsProjectCache
object (instructions here), you can download the sessions table like this:
ecephys_sessions = cache.get_ecephys_session_table()
To obtain info about a specific session, you can query the sessions table as follows:
session_id = 1047969464
ecephys_sessions.loc[session_id]
which will print something like this:
behavior_session_id 1048005547
date_of_acquisition 2020-09-02 14:53:14.347000+00:00
equipment_name NP.1
session_type EPHYS_1_images_G_3uL_reward
mouse_id 509808
genotype Sst-IRES-Cre/wt;Ai32(RCL-ChR2(H134R)_EYFP)/wt
sex M
project_code NeuropixelVisualBehavior
age_in_days 263
unit_count 2438.0
probe_count 6.0
channel_count 2304.0
structure_acronyms ['APN', 'CA1', 'CA3', 'DG-mo', 'DG-po', 'DG-sg...
image_set G
prior_exposures_to_image_set 62.0
session_number 1
experience_level Familiar
prior_exposures_to_omissions 0
file_id 877
abnormal_histology NaN
abnormal_activity NaN
Name: 1047969464, dtype: object
Nevermind figured out the issue, first you run…
from allensdk.brain_observatory.behavior.behavior_project_cache import VisualBehaviorNeuropixelsProjectCache
cache = VisualBehaviorNeuropixelsProjectCache.from_s3_cache(cache_dir=sdk_cache_dir)
then…
cache.get_ecephys_session_table()
But the session Id’s I have are not working, and I got them from the brain observatory and functional connectivity so I’m not sure why they are not working. For instance…
cache = EcephysProjectCache.from_warehouse(manifest=manifest_path)
for sesh in os.listdir(abi_ripples_path):
if sesh.startswith('swrs_session_'):
sesh_id = int(sesh.split('_')[-1])
print(sesh_id)
else:
continue
#session = cache.get_session_data(session_id)
print(ecephys_info_df[ecephys_info_df.index==sesh_id])
Returns the following…
757216464
Empty DataFrame
Columns: [behavior_session_id, date_of_acquisition, equipment_name, session_type, mouse_id, genotype, sex, project_code, age_in_days, unit_count, probe_count, channel_count, structure_acronyms, image_set, prior_exposures_to_image_set, session_number, experience_level, prior_exposures_to_omissions, file_id, abnormal_histology, abnormal_activity]
Index: []
[0 rows x 21 columns]
793224716
Empty DataFrame
Columns: [behavior_session_id, date_of_acquisition, equipment_name, session_type, mouse_id, genotype, sex, project_code, age_in_days, unit_count, probe_count, channel_count, structure_acronyms, image_set, prior_exposures_to_image_set, session_number, experience_level, prior_exposures_to_omissions, file_id, abnormal_histology, abnormal_activity]
Index: []
Why are the session id’s not found in the dataframe?
The “Visual Behavior” and “Visual Coding” datasets each have their own set of session IDs, since they were collected independently of one another.
To get the info about all Visual Coding sessions (which includes the Brain Observatory 1.1 and Functional Connectivity datasets), your ecephys_info_df
needs to be downloaded from the EcephysProjectCache
like this:
ecephys_info_df = cache.get_session_table()