# Finding mouse info (age, sex, strain, genotype etc)

**URL:** <https://community.brain-map.org/t/finding-mouse-info-age-sex-strain-genotype-etc/3409>\
**Category:** General\
**Tags:** api, allensdk\
**Created:** [June 21, 2024, 6:06am UTC](https://community.brain-map.org/t/finding-mouse-info-age-sex-strain-genotype-etc/3409 "2024-06-21T06:06:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![AngCamp](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.brain-map.org/angcamp/32/715_2.png) [@AngCamp](https://community.brain-map.org/u/AngCamp)\
**Post date:** [June 21, 2024, 6:06am UTC](https://community.brain-map.org/t/finding-mouse-info-age-sex-strain-genotype-etc/3409/1 "2024-06-21T06:06:42Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![joshs](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.brain-map.org/joshs/32/8_2.png) [@joshs](https://community.brain-map.org/u/joshs)\
**Post date:** [June 22, 2024, 1:21am UTC](https://community.brain-map.org/t/finding-mouse-info-age-sex-strain-genotype-etc/3409/2 "2024-06-22T01:21:43Z")

</div>

Hi @AngCamp – once you’ve created a `VisualBehaviorNeuropixelsProjectCache` object (instructions [here](https://allensdk.readthedocs.io/en/latest/_static/examples/nb/visual_behavior_neuropixels_data_access.html)), you can download the sessions table like this:

```auto
ecephys_sessions = cache.get_ecephys_session_table()

```

To obtain info about a specific session, you can query the sessions table as follows:

```auto
session_id = 1047969464
ecephys_sessions.loc[session_id]

```

which will print something like this:

```auto
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

```

---

<div class="post-metadata">

**Author:** ![AngCamp](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.brain-map.org/angcamp/32/715_2.png) [@AngCamp](https://community.brain-map.org/u/AngCamp)\
**Post date:** [June 25, 2024, 6:14am UTC](https://community.brain-map.org/t/finding-mouse-info-age-sex-strain-genotype-etc/3409/5 "2024-06-25T06:14:26Z")

</div>

Nevermind figured out the issue, first you run…

```auto
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…

```auto

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…

```auto

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?

---

<div class="post-metadata">

**Author:** ![joshs](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.brain-map.org/joshs/32/8_2.png) [@joshs](https://community.brain-map.org/u/joshs)\
**Post date:** [June 25, 2024, 5:09pm UTC](https://community.brain-map.org/t/finding-mouse-info-age-sex-strain-genotype-etc/3409/6 "2024-06-25T17:09:58Z")

</div>

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:

```auto
ecephys_info_df = cache.get_session_table()

```
