python DeepBlue教程 - BioSources

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python DeepBlue教程 - BioSources相关的知识,希望对你有一定的参考价值。

#DeepBlue organizes the Biological Names into BioSources and Samples.

#BioSources are biological entities, e.g. Cell Lins, Cell Types, Tissues, and Organs. 
#They are imported from three ontologies: Cell Type, Experimental Factor Ontology, and Uber Anatomy Ontology. 
#They are organized hierarchicaly and the BioSource terms may contain synonyms.

import xmlrpclib

# Before going further, we must set up the client:
url = "http://deepblue.mpi-inf.mpg.de/xmlrpc"
server = xmlrpclib.Server(url, encoding='UTF-8', allow_none=True)

# You can use the anonymous key or your own user key
user_key = "anonymous_key"


# Use the command list_biosources for listing all biosources:
(status, biosources) = server.list_biosources(None, user_key)

len(biosources)
# It is expected more than 17.000 biosources


# As DeepBlue uses Ontologies, the common names are all included. It can be verified with the is_biosource command.
server.is_biosource("blood", user_key)
# output: ['okay', 'blood']

server.is_biosource("brain", user_key)
# output: ['okay', 'brain']

# We may not know all terms, for example, the CD4 Cell Type Family. 
# For example, if we execute the is_biosource command with "CD4" as parameter, we receive the information that it is not a BioSource:
server.is_biosource("CD4", user_key)
# output: ['error', "104000:Invalid BioSource Name 'CD4'. No BioSource or Synonym was defined with this name."]


#In this case, we can use the list_similar_biosources to list all BioSources which the names are similar:
server.list_similar_biosources("CD4", user_key)
# Output (partial) :
# ['okay',
#  [['bs1264',
#    'CD34-positive, CD41-positive, CD42-negative megakaryocyte progenitor cell'],
#   ['bs852', 'CD4-positive, alpha-beta intraepithelial T cell'],
#   ['bs851', 'CD4-positive, alpha-beta thymocyte'],
#   ['bs846', 'CD4-negative, CD8-negative type I NK T cell'],
#   ['bs845',
#    'CD4-negative, CD8-negative type I NK T cell secreting interferon-gamma'],
#   ['bs844',
#   'CD4-negative, CD8-negative type I NK T cell secreting interleukin-4'],

# It is possible to obtain the BioSources hierarchy:
server.get_biosource_parents('CD4-positive, alpha-beta intraepithelial T cell', user_key)
# Output: 
# ['okay',
#  [['bs851', 'CD4-positive, alpha-beta thymocyte'],
#   ['bs868', 'alpha-beta intraepithelial T cell'],
#   ['bs858', 'CD4-positive, alpha-beta T cell']]]

server.get_biosource_parents('CD4-positive, alpha-beta T cell', user_key)
# Output:
# ['okay', [['bs856', 'mature alpha-beta T cell'], ['bs9347', 'venous blood']]]

server.get_biosource_parents('mature alpha-beta T cell', user_key)
#  Output
# ['okay',
#  [['bs788', 'immature alpha-beta T cell'],
#  ['bs787', 'alpha-beta T cell'],
#  ['bs914', 'mature T cell']]]


# Also, it is very easy to obtain the terms that are under other term, for example, all terms that are under blood:
server.get_biosource_children('blood', user_key)
# Output (partial) :
# ['okay',
# [['bs9343', 'blood'],
#  ['bs9344', 'capillary blood'],
#  ['bs9345', 'arterial blood'],
#  ['bs9346', 'blood clot'],
#  ['bs8899', 'umbilical cord blood'],


# The BioSources may have synonyms:
server.get_biosource_synonyms("blood", user_key)
# Output:
#['okay',
# [['bs9343', 'blood'],
#  ['bs9343', 'portion of blood'],
#  ['bs9343', 'vertebrate blood'],
#  ['bs9343', 'whole blood']]]

server.get_biosource_synonyms("T Cell", user_key)
# Output:
#['okay',
# [['bs786', 'T cell'],
#  ['bs786', 'T lymphocyte'],
#  ['bs786', 'Th2'],
#  ['bs786', 'Th1'],
#  ['bs786', 'T-lymphocytes'],
#  ['bs786', 'pancreatic T effector cell']]]


# The next tutorial will present how to use and access the Experiments related to the desired BioSource.

# We will do our best efforts to make the BioSource names, synonyms, and hierarchy correct, 
# but it is an automatized process that may lead to mistakes. 
# Please, inform us at http://deepblue.userecho.com/list/37282-general/ if you find any innacurate information.

以上是关于python DeepBlue教程 - BioSources的主要内容,如果未能解决你的问题,请参考以下文章

python 提取DeepBlue注释 - 对备份很有用

python 从DeepBlue访问和下载实验

python 列出注册到DeepBlue中的Samples

python 连接到DeepBlue服务器

python 从DeepBlue中删除所有ENCODE实验的代码

python 用于BLUEPRINT年会的DEEPBLUE海报的案例2。 (09.2015)。通过a在您自己的数据集中聚合DNA甲基化信号