How to acquire the structure label for the expression grid data?

My goal is to figure out the brain structure that each grid belongs to.

I have downloaded the expression grid data following the instruction in “http://help.brain-map.org/display/api/Downloading+3-D+Expression+Grid+Data”. The label of brain structure seems to be somewhere else.

So I used the SDK following the demo in “http://alleninstitute.github.io/AllenSDK/_static/examples/nb/reference_space.html#Downloading-an-annotation-volume”. But the grid expression data is in 200um unit and the reference map is 100um at most. Also the orientation is different. I am thinking about resizing the reference map and aligning them myself. But this seems error-prone. Is there a reference map specifically for the ISH data that I failed to find?

Any help will be appreciated.

I have figured it out. There is a link to download the grid annotation: http://download.alleninstitute.org/informatics-archive/current-release/mouse_annotation/P56_Mouse_gridAnnotation.zip. Should have read more carefully in the API page.

2 Likes

Glad you found what you needed! We’d love to hear how your work is going and hope you share results or publications here, when they are ready! :+1:t4:

I am also having issues with the annotations. I downloaded the gridAnnotation.zip from the source given by livent. I then load them into an numpy-array:
annotations = np.fromfile(“annotations\P56_Mouse_gridAnnotation\gridAnnotation.raw”, dtype=“uint32”)
the gene-expressions are loaded via GridDataApi using the allen-sdk:
gdApi.download_gene_expression_grid_data(exp_id, GridDataApi.ENERGY, exp_path)

i brought both arrays together:
data = pd.DataFrame({“expression_level”: np.fromfile(exp_path + “energy.raw”, dtype=np.float32), “structure_id”: annotations})

but there are expression-levels present, whilst no structure_id is given:
expression_level structure_id
22284 2.352117e-02 0
22285 1.878159e-02 0
22286 9.601472e-03 0
22335 1.081399e-09 0
22336 8.580686e-08 0
… … …
82405 3.652525e-03 0
82406 3.319370e-03 0
82407 3.915340e-03 0
82408 2.722567e-03 0
82409 8.182127e-04 0

so i must be doing sth wrong there.

additionally, I am not sure how to get the structural labels with the given id. i used the ReferenceSpaceCache with reference_space_key = ‘annotation/ccf_2017’, resolution=25 and structure_graph_id=1, but this provides no structure_id smaller than 4005 and the grid-annotations start with structure_id 1.

it would also be nice to get the gridAnnotation via the api/sdk instead of downloading a zip-file.

thanks and kind regards
christoph

Hello @christoph-hue

My apologies for the long delay in responding to your inquiry. The developers who were the most knowledgeable about this area have moved on. I will need to assign a developer to look into this, and will reply when we are able to provide you with some useful information.

Best regards,
Wayne

Hi @christoph-hue,

Can you please add the experiment_id you are looking at so I can exactly reproduce this issue?

Thanks,
Kat

Hi Kat,

ids: 75551483 & 71924402
its for Gabra4

christoph

Hi Christof, you might try extracting the gridAnnotation.raw file with int32 instead of uint32 . That should give values that reference the structures in the mouse ontology.

This documentation page may also help.

It might be that you want the 25-micron ccf annotation reference volume available here. This provides the structure ids of the gridded brain at the same level of resolution.

If this does not get you closer to your goal, can you please respond with a complete code snippet to reproduce your issue?

Best regards,
Wayne

Hi wayne,
thanks for your response. i did not get an email-notification, which is why it took me a bit longer to respond.
however, i still got the exact same issue with int32 as with uint32. i created a jupyter notebook and published it on binder:


please run all cells once you open the notebook.

i will try the approach using nrrd while waiting for your response regarding the gridAnnotation-data.
thanks in advance and best regards
christoph

Hi @christoph-hue I wonder if I did not misinterpret your question to begin with. Are you wondering why there are some voxels that have an expression value, but that are assigned to structure_id zero? I believe this just background signal of the experiment in voxels that are outside of the CCF-defined structures.

hm, ok. nevermind then.

i downloaded the 25-micron ccf but i could not find any information on how to combine this annotation-volume with the data obtained using download_gene_expression_grid_data (see: https://allensdk.readthedocs.io/en/latest/allensdk.api.queries.grid_data_api.html). fyi: the length of the 1d array i received from the api is 159326 (for experiment 75551483, but it should be the same for every experiment).
also: is the gene expression data available in 25um? i think livent stated that the grid expression data is in 200um but this hasn’t been confirmed afaik.

side-note: when I call gdApi.download_expression_grid_data(exp_id), i get this warning:
VisibleDeprecationWarning:Function download_expression_grid_data is deprecated. Use download_gene_expression_grid_data instead
and the result is None.

thanks and best regards

Hi @christoph-hue

The options seem to be to downsample the 25um CCF nrrd data. This is the approach that @livent was asking about in the initial message in this thread. The notebook he linked includes a section on how to downsample to match the 200um resolution of the ABA expression grids. Note the PIR orientation of the CCF as shown in a figure on this page, which is different than the organization of the ABA expression grid files.

The other option is to use the gridAnnotation file, which should already be in the same 200um resolution, and orientation, as the ABA expression grid files. This file is based on the annotation volume for the Allen Reference Atlas that was used for the adult mouse gene expression atlas. Zero-values in this file indicate background signal for voxels that fall outside of the annotated brain structures.

Structure id mapping to name and acronym is in the adult mouse ontology.

Hope that helps
Wayne