微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

从 Allen Institute Brainspan 下载 ISH 部分数据集图像,其中包含基因/探针和供体年龄元数据

如何解决从 Allen Institute Brainspan 下载 ISH 部分数据集图像,其中包含基因/探针和供体年龄元数据

我正在尝试获取属于产前年龄(3个供体)并且仅来自3种结构的所有截面数据集的所有Brainspan ISH图像:视觉皮层、前额叶皮层和“大脑” '

即此搜索中列出的实验:

http://www.brainspan.org/ish/search/show?page_num=1&page_size=100&no_paging=false&search_term=&search_type=advanced&facet_age_tags=prenatal&facet_structure_name=%22Medial%20Prefrontal%20Cortex%22,%22Brain%22

enter image description here

我已按照此处的说明进行操作:

https://allensdk.readthedocs.io/en/latest/_static/examples/nb/image_download.html#Downloading-all-of-the-images-from-a-section-data-set

brainspan_datasets = image_api.get_section_data_sets_by_product([22]) 
brainspan_datasets_df = pd.DataFrame(brainspan_datasets)

section_dataset_ids = [ds['id'] for ds in brainspan_datasets

# Iterate through `section_dataset_ids` to get list of `section_image_ids` and download the images.

# disable logger
logging.getLogger('allensdk.api.api.retrieve_file_over_http').disabled = True
  
downsample = 2
format_str = '.jpg'

for section_dataset_id in section_dataset_ids:
  dir_name = str(section_dataset_id) + '_section_images'

  # Get list of image ids from field `id` in each element of `section_images`.
  section_images = image_api.section_image_query(section_dataset_id)
  section_image_ids = [si['id'] for si in section_images]
  print(len(section_image_ids))
  # Download
  for section_image_id in section_image_ids:
      file_name = str(section_image_id) + format_str
      file_path = os.path.join(dir_name,file_name)
      Manifest.safe_make_parent_dirs(file_path)
      image_api.download_section_image(section_image_id,file_path=file_path,downsample=downsample)
      
# re-enable the logger
logging.getLogger('allensdk.api.api.retrieve_file_over_http').disabled = False

并且已经成功地为每个带有相应图像的 SectionDataSet 创建了一个目录。

enter image description here

但是,我必须手动过滤从中下载图像的样本 ID,以限制为产前。

section_dataset_ids = [ds['id'] for ds in brainspan_datasets\
if ds['specimen_id']==708383 or ds['specimen_id']==708307 or ds['specimen_id']==708787] 

我一直无法弄清楚如何为与每个实验相关的样本/捐赠者获取相应的元数据。

即,对于实验 100135095,我知道捐赠者是通过浏览器从结果表中得到的 21pcw F,但在我的 API 查询中没有返回。

我希望能够将基因/探针和供体年龄/性别添加到当前只有实验 ID 的目录名称中。

Stackoverflow (1) 上有一个类似的问题,几乎可以让我解决这个问题,除了我也不知道如何请求捐赠者的年龄和性别。

section_datasets = pd.DataFrame(api.model_query('SectionDataSet',criteria='[id$eq%d]' % brainspan_dataset_id,include='section_images,treatments,probes(gene),specimen(structure),specimen(donor)'

这是我能够找到的另一个提示,但我不知道如何将这个常规的 GET 请求转换为上面的 api.model_query。

section_datasets = requests.get("http://api.brain-map.org/api/v2/data/query?criteria=model::SectionDataSet,rma::criteria,[Failed$eqfalse],products[id$eq22],treatments[name$eq'ISH'],rma::include,specimen(donor(age)),section_images")

感谢您的帮助! ?

(1) Get more of the metadata from the Neurotransmitter study using Allen SDK

在此处交叉发布:

https://community.brain-map.org/t/download-section-dataset-images-from-brainspan-ish-with-gene-probe-and-donor-age-metadata/

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。