# How to get the proportions of primary and secondary structure at injections site

**URL:** <https://community.brain-map.org/t/how-to-get-the-proportions-of-primary-and-secondary-structure-at-injections-site/1844>\
**Category:** Technical\
**Created:** [September 16, 2022, 10:41am UTC](https://community.brain-map.org/t/how-to-get-the-proportions-of-primary-and-secondary-structure-at-injections-site/1844 "2022-09-16T10:41:38Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![LevArth](https://avatars.discourse-cdn.com/v4/letter/l/f08c70/32.png) [@LevArth](https://community.brain-map.org/u/LevArth)\
**Post date:** [September 16, 2022, 10:41am UTC](https://community.brain-map.org/t/how-to-get-the-proportions-of-primary-and-secondary-structure-at-injections-site/1844/1 "2022-09-16T10:41:38Z")

</div>

I am trying to retrieve the percentages that can be found on the AAV Injection Site section, when using the Atlas.

Can I retrieve the proportion of injection at primary and secondary structures, as data in the allensdk library or somewhere else?  
Or does it have to be extracted from special calculations, and if so how?

Thanks!

---

<div class="post-metadata">

**Author:** ![Susan.Sunkin](https://avatars.discourse-cdn.com/v4/letter/s/6a8cbe/32.png) [@Susan.Sunkin](https://community.brain-map.org/u/Susan.Sunkin)\
**Post date:** [October 1, 2022, 9:56pm UTC](https://community.brain-map.org/t/how-to-get-the-proportions-of-primary-and-secondary-structure-at-injections-site/1844/2 "2022-10-01T21:56:33Z")

</div>

Hi,  
Thank you for your question. The information is in the Allensdk library, and it can be retrieved with some relatively simple calculations. One scientist on the team has some code that she is willing to share to facilitate those calculations. The code is python and in a Jupyter notebook. If you are willing to try this approach, let me know and I can send you the notebook.  
Thank you.

---

<div class="post-metadata">

**Author:** ![LevArth](https://avatars.discourse-cdn.com/v4/letter/l/f08c70/32.png) [@LevArth](https://community.brain-map.org/u/LevArth)\
**Post date:** [October 3, 2022, 8:24am UTC](https://community.brain-map.org/t/how-to-get-the-proportions-of-primary-and-secondary-structure-at-injections-site/1844/3 "2022-10-03T08:24:44Z")

</div>

Hi Susan!

Thank you for your answer, I’m glad to know I can retrieve the info and I would love to be able to look at the code for that, it would really be helpful for me!  
Thanks again

---

<div class="post-metadata">

**Author:** ![Susan.Sunkin](https://avatars.discourse-cdn.com/v4/letter/s/6a8cbe/32.png) [@Susan.Sunkin](https://community.brain-map.org/u/Susan.Sunkin)\
**Post date:** [October 3, 2022, 12:47pm UTC](https://community.brain-map.org/t/how-to-get-the-proportions-of-primary-and-secondary-structure-at-injections-site/1844/4 "2022-10-03T12:47:08Z")

</div>

Hi

Please email me at susans  
Then @  
Followed by [alleninstitute.org](http://alleninstitute.org)

I will then send you the file. I cannot do that in this forum.

Thank you,

Susan

---

<div class="post-metadata">

**Author:** ![DavideR](https://avatars.discourse-cdn.com/v4/letter/d/3da27b/32.png) [@DavideR](https://community.brain-map.org/u/DavideR)\
**Post date:** [October 11, 2024, 9:45am UTC](https://community.brain-map.org/t/how-to-get-the-proportions-of-primary-and-secondary-structure-at-injections-site/1844/5 "2024-10-11T09:45:53Z")

</div>

Hi Susan,  
I’m also looking for the same data @LevArth asked for.  
Is it possible to have the Python code as well?

thank you very much!

best,  
Davide

---

<div class="post-metadata">

**Author:** ![Susan.Sunkin](https://avatars.discourse-cdn.com/v4/letter/s/6a8cbe/32.png) [@Susan.Sunkin](https://community.brain-map.org/u/Susan.Sunkin)\
**Post date:** [October 11, 2024, 8:18pm UTC](https://community.brain-map.org/t/how-to-get-the-proportions-of-primary-and-secondary-structure-at-injections-site/1844/6 "2024-10-11T20:18:53Z")

</div>

Hi Davide,

Are you referring to this question:  
"I am trying to retrieve the percentages that can be found on the AAV Injection Site section, when using the Atlas.

Can I retrieve the proportion of injection at primary and secondary structures, as data in the allensdk library or somewhere else?  
Or does it have to be extracted from special calculations, and if so how?"

I want to make sure that I understand what you are asking for.

Thank you,

Susan

---

<div class="post-metadata">

**Author:** ![DavideR](https://avatars.discourse-cdn.com/v4/letter/d/3da27b/32.png) [@DavideR](https://community.brain-map.org/u/DavideR)\
**Post date:** [October 11, 2024, 10:05pm UTC](https://community.brain-map.org/t/how-to-get-the-proportions-of-primary-and-secondary-structure-at-injections-site/1844/7 "2024-10-11T22:05:03Z")

</div>

Hi Susan,

yes exactly. Given some specific experiments, I’d like to have the information on the percentage of the injection in the various areas in the inj\_site (both the so-called primary and secondary injection areas).

thanks!

Best,  
Davide

---

<div class="post-metadata">

**Author:** ![DavideR](https://avatars.discourse-cdn.com/v4/letter/d/3da27b/32.png) [@DavideR](https://community.brain-map.org/u/DavideR)\
**Post date:** [October 21, 2024, 3:23pm UTC](https://community.brain-map.org/t/how-to-get-the-proportions-of-primary-and-secondary-structure-at-injections-site/1844/8 "2024-10-21T15:23:54Z")

</div>

Thanks, @Susan.Sunkin for the notebook you sent me via email, with the information on retrieving the injection fraction.

I have a question regarding your code related to calculating `structure_unionizes`. In the snippet below, you select Isocortex IDs as `structure_ids` :

```auto
isocortex = structure_tree.get_structures_by_name(['Isocortex'])[0]
# find how much signal there was in injection sites in a given experiment
# take a look at what we know about an experiment with a posteromedial visual area injection
structure_unionizes = mcc.get_structure_unionizes([301618122],
                                                  is_injection=True,
                                                  structure_ids=isocortex,
                                                  include_descendants=True)

```

If I understand correctly, this operation retrieves connection data for experiment #301618122 as a source, projecting to the Isocortex areas, correct? I’m curious if there’s a specific reason for selecting this subset.

I attempted a similar approach using `structure_ids=None` , which should retrieve projections to all brain areas. However, I found that it also included a small percentage of injection into ID: 1009, which is part of the fiber tract, with a low percentage of injection (0.0568%). I’m wondering why this was excluded from the `injection_structures` in the `all_experiments` dataframe.

Your clarification on this matter would be greatly appreciated, as I need to define a function to calculate the percentage of injection for multiple experiments and won’t be able to check each one manually.

Thank you again for the help!

Davide
