Hi, I’d like to retrieve, via API, the connectivity data for a given target structure, but I had some issues and I don’t know if I’m doing the correct process.
The example in the Jupyter notebook “Introduction to the Mouse Connectivity Atlas” (https://allensdk.readthedocs.io/en/stable/_static/examples/nb/mouse_connectivity.html) explains how to download the connections from a given source to the other areas in the brain. I’ve modified the code in order to find the connections from all the brain, to a specific target structure, as follows:
# import libraries and API
from allensdk.core.mouse_connectivity_cache import MouseConnectivityCache
from pathlib import Path
output_dir = './data'
# fetch the data
mcc = MouseConnectivityCache(manifest_file=Path(output_dir) / 'manifest.json')
# hierarchical list of mouse brain structures
structure_tree = mcc.get_structure_tree()
# Get the target structure of interest (SLC)
slc = structure_tree.get_structures_by_acronym(['SLC'])[0]
# Retrieve all experiments (wild-type)
all_exp = mcc.get_experiments(cre=False, injection_structure_ids=None)
# Retrieve unionized data for projections to SLC
proj_to_slc = mcc.get_structure_unionizes(
[e['id'] for e in all_exp], # projection sources structures (all experiments)
is_injection=False, # Data for non-injection sites
structure_ids=[slc['id']], # Target SLC structure
include_descendants=True
)
I would greatly appreciate if someone could confirm whether this approach is correct for retrieving all structures projecting to a target structure. Additionally, I have a few specific questions regarding the data interpretation:
-
in the resulting table downloaded (‘proj_to_slc’) there are projection data for three hemispheres for each experiment_id. 1 = left hemisphere, 2 = right and 3 = both, but it’s unclear what ‘both’ hemispheres mean, it seems to be the average of the 1 and 2 projections. If I have to compare various projections to different target structures is better to take into consideration the projection data in the ipsilateral hemisphere of the injection only? or the ‘both’ value?
-
When using the spatial search feature on the main Mouse Connectivity Projection webpage (https://connectivity.brain-map.org/), I noticed that the target density results for a source structure differ from the values retrieved via API. Could someone explain what this difference represents and advise on whether using the values from the webpage or the API for my analysis is better?
here is the screenshot of the resulting comparison table regarding the PVH as target (id=38):
as you can see the density values resulting from the API download and table downloaded from the web portal are different, for the same experiment ID.
PS: the density_api data (so retrieved via AllenSKD, in Python) matches with the data displayed in the webpage when clicking on one specific experiment and expanding the details of it. So I’m confused about what the data displayed in the spatial search feature are.
For example, for the exp 158258062 the spacial search displays a target density of 0.998 (as in the ‘density_web’ column in the picture) but in the info page (https://connectivity.brain-map.org/projection/experiment/158258062?imageId=158258136&initImage=TWO_PHOTON&x=16848&y=19105&z=3) there are two values of 0.89 for the right hem (hem_id=2) and 0.27 for the left hem (hem_id=1) that match with the results from the API (‘density_api’ column in the picture).
- I also noticed that there are different results in the web portal performing a ‘spatial search’ or a ‘target search’. So I was wondering what are exactly the differences between those two operations.
For example: when performing a spatial search for the SLC as a target, there are 170 experiments displayed, that can be downloaded as .csv file. On the other hand, when performing the target search for the same SLC structure there are no results at all.
thank you to everyone who can help me solve those issues!