本文整理汇总了Python中intermine.webservice.Service.get_template方法的典型用法代码示例。如果您正苦于以下问题:Python Service.get_template方法的具体用法?Python Service.get_template怎么用?Python Service.get_template使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类intermine.webservice.Service
的用法示例。
在下文中一共展示了Service.get_template方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: fetchGene
# 需要导入模块: from intermine.webservice import Service [as 别名]
# 或者: from intermine.webservice.Service import get_template [as 别名]
def fetchGene(GeneName):
service = Service("http://yeastmine.yeastgenome.org/yeastmine/service")
template = service.get_template('Gene_GenomicDNA')
rows = template.rows(
E = {"op": "LOOKUP", "value": GeneName, "extra_value": "S. cerevisiae"}
)
# this service seems to return multiple similar genes but we want the first one only, so count
# and it returns information about the gene you want
count=0
for row in rows:
count=count+1
if count==1:
descr= row["description"]
GeneSeq=Seq(row["sequence.residues"])
GeneSysName=row["secondaryIdentifier"]
#let's create a record for the oldGene
GeneRecord = SeqRecord(GeneSeq, id=GeneSysName)
#now let's add some more information to make it useful
GeneRecord.name=GeneName
GeneRecord.features=GeneSysName
GeneRecord.description=descr
return GeneRecord
示例2: fetchGene
# 需要导入模块: from intermine.webservice import Service [as 别名]
# 或者: from intermine.webservice.Service import get_template [as 别名]
def fetchGene(GeneName):
service = Service("http://yeastmine.yeastgenome.org/yeastmine/service")
template = service.get_template('Gene_GenomicDNA')
rows = template.rows(
E = {"op": "LOOKUP", "value": GeneName, "extra_value": "S. cerevisiae"}
)
# this service seems to return multiple similar genes but we want the first one only, so count
# and it returns information about the gene you want
count=0
for row in rows:
count=count+1
if count==1:
descr= row["description"]
GeneSeq=Seq(row["sequence.residues"])
GeneSysName=row["secondaryIdentifier"]
print(" ")
print("I think you want...... "+row["secondaryIdentifier"])
print(row["description"])
print(" ")
print(row["sequence.residues"])
print(" ")
print("Good choice! I have a feeling you're going to get lucky with this one.")
print(" ")
print("Give me a second to put some of my ducks in a circle...")
#let's create a record for the oldGene
GeneRecord = SeqRecord(GeneSeq, id=GeneSysName)
#now let's add some more information to make it useful
GeneRecord.name=GeneName
GeneRecord.features=GeneSysName
return GeneRecord
示例3: Service
# 需要导入模块: from intermine.webservice import Service [as 别名]
# 或者: from intermine.webservice.Service import get_template [as 别名]
import pandas as pd
service = Service("http://yeastmine.yeastgenome.org/yeastmine/service")
#-------------------------------------------------------------------#
# Gene Info
#-------------------------------------------------------------------#
gene = service.model.Gene.where(symbol = 'HFA1').first()
print gene.symbol + "\n" + gene.description
print gene
#-------------------------------------------------------------------#
# Model templates
#-------------------------------------------------------------------#
template = service.get_template("Gene_Pathways")
for row in template.results(A={"symbol":"HFA1"}):
print row
#-------------------------------------------------------------------#
# Query
#-------------------------------------------------------------------#
query = service.new_query("Gene")
query.add_view("primaryIdentifier","name","symbol","pathways.name")
query.add_constraint("Gene", "LOOKUP", "HFA1")
for row in query.rows():
print row
# The view specifies the output columns
query.add_view(
"primaryIdentifier", "secondaryIdentifier", "symbol", "name", "sgdAlias",
示例4: get_protein_seq_as_FASTA
# 需要导入模块: from intermine.webservice import Service [as 别名]
# 或者: from intermine.webservice.Service import get_template [as 别名]
def get_protein_seq_as_FASTA(gene_id,
extension_for_saving = extension_for_saving, return_text = False):
'''
Main function of script.
Takes a gene's systematic name, standard name, or alias as defined at gene
page at yeastgenome.org, retrieves the associated information from
YeastMine, and saves or returns the protein sequence in FASTA format.
Use `return_text` if calling from IPython or a Jupyter notebook and you want
the FASTA record returned as text,
'''
# Get gene information from YeastMine
#---------------------------------------------------------------------------
# Based on the template Gene_ProteinSequence available under
# 'Gene --> Protein Sequence' when clicking on 'Proteins' on navigation bar
# in middle of page at YeastMine. Direct link:
# https://yeastmine.yeastgenome.org/yeastmine/template.do?name=Gene_ProteinSequence&scope=global
service = Service("https://yeastmine.yeastgenome.org:443/yeastmine/service")
# Retrieve protein sequence for a specified gene.
template = service.get_template('Gene_ProteinSequence')
# You can edit the constraint values below
# B Gene
rows = template.rows(
B = {"op": "LOOKUP", "value": gene_id, "extra_value": "S. cerevisiae"}
)
results = []
for row in rows:
results.append(row)
# store corresponding protein sequence
prot_seq = results[0]["proteins.sequence.residues"]
# format gene_nom_info for making output file name or anything else needing
# that information
gene_nom_info = {}
gene_nom_info['sys_nom'] = results[0]["secondaryIdentifier"]
gene_nom_info['std_nom'] = results[0]["symbol"]
gene_nom_info['aliases'] = results[0]["sgdAlias"]
#print (gene_nom_info['aliases'] ) # FOR DEBUGGING ONLY
#print (gene_nom_info['std_nom'] ) # FOR DEBUGGING ONLY
#print (gene_nom_info['sys_nom'] ) # FOR DEBUGGING ONLY
# feedback
sys.stderr.write("looking up the gene associated with "
"{}...".format(gene_id))
# Make output FASTA record
#---------------------------------------------------------------------------
# based handling worked out in
# `delete_seq_following_pattern_within_multiFASTA.py`
record_description = '{}'.format(gene_nom_info['sys_nom'])
record = SeqRecord(Seq(prot_seq, generic_protein),
id=gene_nom_info['std_nom'], description=record_description)#based
# on https://www.biostars.org/p/48797/ and `.ungap()` method, see
# https://github.com/biopython/biopython/issues/1511 , and `description`
# from what I've seen for `id` plus https://biopython.org/wiki/SeqIO
#print (records[indx]) # ONLY FOR DEBUGGING
sys.stderr.write("getting protein sequence...")
# Return text if called with `return_text = True`. Otherwise, consider
# called from command line & save file.
#---------------------------------------------------------------------------
if return_text == True:
# based on section 4.6 at
#http://biopython.org/DIST/docs/tutorial/Tutorial.html#sec:SeqRecord-format
# Feedback
sys.stderr.write("\nReturning protein sequence in FASTA format.")
return record.format("fasta")
else:
output_file_name = generate_output_file_name(
gene_nom_info,extension_for_saving)
SeqIO.write(record,output_file_name, "fasta");
# Feedback
sys.stderr.write("\n\nFile of protein sequence "
"saved as '{}'.".format(output_file_name))
sys.stderr.write("\nFinished.\n")
示例5: Database
# 需要导入模块: from intermine.webservice import Service [as 别名]
# 或者: from intermine.webservice.Service import get_template [as 别名]
#
# Saccharomyces Genome Database (SGD)
# http://yeastmine.yeastgenome.org/yeastmine/api.do?subtab=python
#
# YeastMine example script
#
from intermine.webservice import Service
service = Service("http://yeastmine.yeastgenome.org/yeastmine/service")
# List all GO annotations for a specified gene. Searches for the
# primaryIdentifier (SGDID), secondaryIdentifier (Systematic Name), symbol
# (Standard Gene Name) and wild card queries (such as *YAL*) are supported.
# Manually curated, high-throughput, and computational GO annotations are
# included. Genes include Uncharacterized and Verified ORFs, pseudogenes,
# transposable element genes, RNAs, and genes Not in Systematic Sequence of
# S228C.
template = service.get_template('Gene_GO')
# You can edit the constraint values below
# A Gene Show GO annotations for gene:
rows = template.rows(
A = {"op": "LOOKUP", "value": "YAL018C", "extra_value": "S. cerevisiae"}
)
for row in rows:
print row