本文整理汇总了Python中Bio.ExPASy.get_sprot_raw方法的典型用法代码示例。如果您正苦于以下问题:Python ExPASy.get_sprot_raw方法的具体用法?Python ExPASy.get_sprot_raw怎么用?Python ExPASy.get_sprot_raw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bio.ExPASy
的用法示例。
在下文中一共展示了ExPASy.get_sprot_raw方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: gen_uniprot_features_for_pdb
# 需要导入模块: from Bio import ExPASy [as 别名]
# 或者: from Bio.ExPASy import get_sprot_raw [as 别名]
def gen_uniprot_features_for_pdb(infile):
for line in open(infile,'r'):
(pdb_dom, count, uniprot_ids) = line.replace('\n','').split('\t')
uniprot_ids = uniprot_ids.split('|')
for uniprot_id in uniprot_ids:
data = SwissProt.read(ExPASy.get_sprot_raw(uniprot_id)).__dict__
keep = False
go = []; interpro = ''; evo_trace = ''
for xref in data['cross_references']:
if xref[0] == 'GO':
go.append(xref[1])
if xref[0] == 'InterPro':
interpro = xref[1]
if xref[0] == 'EvolutionaryTrace':
evo_trace = xref[1]
if xref[0] == 'PDB' and xref[1].lower() == pdb_dom.lower():
keep = True
if keep == False:
continue
organism = data['organism']
loc = ''
for comment in data['comments']:
if comment.startswith('SUBCELLULAR LOCATION'):
loc = comment
print '%s\t%s\t%s\t%s\t%s\t%s\t%s' %(pdb_dom,uniprot_id,'|'.join(go),interpro,evo_trace,organism,loc)
示例2: get_SwissProt
# 需要导入模块: from Bio import ExPASy [as 别名]
# 或者: from Bio.ExPASy import get_sprot_raw [as 别名]
def get_SwissProt(dict,accession):
try:
handle = ExPASy.get_sprot_raw(accession)
record = SwissProt.read(handle)
dict[accession] = record
except urllib2.HTTPError, error:
print accession + ": protein not found on UniProt . "
示例3: download_aa_dist_per_gene
# 需要导入模块: from Bio import ExPASy [as 别名]
# 或者: from Bio.ExPASy import get_sprot_raw [as 别名]
def download_aa_dist_per_gene(UPID_list_fname, cutoff):
UPID_list = []
for row in open(UPID_list_fname, 'r'):
if row:
UPID_list.append(row[48:54])
if cutoff > 0:
UPID_list = UPID_list[0:min(cutoff, len(UPID_list))]
# a dictionary containing the aa_dist for each uniprot ID
UPID_to_aa_dist = {}
for i, UPID in enumerate(UPID_list):
print i, "\t", UPID
# initialize a dictionary for amino acids frequency in each protein
aa_dist = dict([(aa, 0) for aa in AA_LETTERS])
# call for aa sequence for each uniprot from swiss prot - biopython tool
handle = ExPASy.get_sprot_raw(UPID)
seq_record = SeqIO.read(handle, "swiss")
# count frequency for each aa in each UPID
# update aa_frequency in aa_dict - to avoid bugs where for example an aa seq from
# swiss prot may contain weired letters such as 'X'
for aa in list(seq_record):
if aa in AA_LETTERS:
aa_dist[aa] += 1
UPID_to_aa_dist[UPID] = np.array([aa_dist[aa] for aa in AA_LETTERS])
return UPID_to_aa_dist
示例4: main
# 需要导入模块: from Bio import ExPASy [as 别名]
# 或者: from Bio.ExPASy import get_sprot_raw [as 别名]
def main(argv):
# input() reads stdin
handle = ExPASy.get_sprot_raw(input().strip()) #you can give several IDs separated by commas
record = SwissProt.read(handle) # use SwissProt.parse for multiple proteins
# there ought to be a better way to pull GO information from the record! maybe there is...
for p in filter(lambda x:x[0]=='GO' and x[2].startswith('P:'),record.cross_references):
print(p[2][2:])
示例5: main
# 需要导入模块: from Bio import ExPASy [as 别名]
# 或者: from Bio.ExPASy import get_sprot_raw [as 别名]
def main():
with open("dbpr") as f:
handle = ExPASy.get_sprot_raw(f.readline().strip())
record = SwissProt.read(handle)
record = [x[2] for x in record.cross_references if x[0] == 'GO']
record = [x[2:] for x in record if x[0] == 'P']
sys.stdout = open("dbpr.out","w")
print "\n".join(record)
示例6: __init__
# 需要导入模块: from Bio import ExPASy [as 别名]
# 或者: from Bio.ExPASy import get_sprot_raw [as 别名]
def __init__(self, seq_id=None, seq_type=None):
"sets variables for instance"
if seq_type is 'uniprot':
handle = ExPASy.get_sprot_raw(seq_id)
self.seq_record = SeqIO.read(handle, "swiss")
elif seq_type is 'genbank':
handle = Entrez.efetch(db='protein', rettype='genbank', id=seq_id)
self.seq_record = SeqIO.read(handle, "genbank")
handle.close()
示例7: test_get_sprot_raw
# 需要导入模块: from Bio import ExPASy [as 别名]
# 或者: from Bio.ExPASy import get_sprot_raw [as 别名]
def test_get_sprot_raw(self):
"""Bio.ExPASy.get_sprot_raw("O23729")"""
identifier = "O23729"
handle = ExPASy.get_sprot_raw(identifier)
record = SeqIO.read(handle, "swiss")
handle.close()
self.assertEqual(record.id, identifier)
self.assertEqual(len(record), 394)
self.assertEqual(seguid(record.seq), "5Y08l+HJRDIlhLKzFEfkcKd1dkM")
示例8: acession
# 需要导入模块: from Bio import ExPASy [as 别名]
# 或者: from Bio.ExPASy import get_sprot_raw [as 别名]
def acession(self):
self.rec=[]
for ide in self.ids:
if ide!='ND':
results=ExPASy.get_sprot_raw(ide)
rec=SwissProt.read(results)
self.rec.append(rec)
else:
self.rec.append('ND')
return self.rec
示例9: BiologicalProcesses
# 需要导入模块: from Bio import ExPASy [as 别名]
# 或者: from Bio.ExPASy import get_sprot_raw [as 别名]
def BiologicalProcesses(UniProtID):
Handle = ExPASy.get_sprot_raw(UniProtID)
Record = SwissProt.read(Handle)
Processes = []
for i in Record.cross_references:
if "GO" in i:
for j in i:
if re.match("P:.*", j):
Processes.append(j[j.rfind(':')+1:])
return "\n".join(Processes)
示例10: get_keywords
# 需要导入模块: from Bio import ExPASy [as 别名]
# 或者: from Bio.ExPASy import get_sprot_raw [as 别名]
def get_keywords(lookup):
try:
handle = ExPASy.get_sprot_raw(lookup)
except:
print("Error in ExPASy")
sys.exit(1)
try:
record = SwissProt.read(handle)
except ValueError, error:
print(error)
sys.exit(1)
示例11: test_get_sprot_raw
# 需要导入模块: from Bio import ExPASy [as 别名]
# 或者: from Bio.ExPASy import get_sprot_raw [as 别名]
def test_get_sprot_raw(self):
"""Bio.ExPASy.get_sprot_raw("O23729")"""
identifier = "O23729"
# This is to catch an error page from our proxy:
handle = UndoHandle(ExPASy.get_sprot_raw(identifier))
if _as_string(handle.peekline()).startswith("<!DOCTYPE HTML"):
raise IOError
record = SeqIO.read(handle, "swiss")
handle.close()
self.assertEqual(record.id, identifier)
self.assertEqual(len(record), 394)
self.assertEqual(seguid(record.seq), "5Y08l+HJRDIlhLKzFEfkcKd1dkM")
示例12: main
# 需要导入模块: from Bio import ExPASy [as 别名]
# 或者: from Bio.ExPASy import get_sprot_raw [as 别名]
def main(protein_id):
handle = ExPASy.get_sprot_raw(protein_id) #you can give several IDs separated by commas
record = SwissProt.read(handle) # use SwissProt.parse for multiple proteins
answer = ""
for r in record.cross_references:
print r
if r[0] == "GO":
if r[2].split(":")[0] == 'P':
answer += r[2].split(":")[1] + "\n"
return answer.strip()
示例13: get_seq
# 需要导入模块: from Bio import ExPASy [as 别名]
# 或者: from Bio.ExPASy import get_sprot_raw [as 别名]
def get_seq(source, fmt):
handle = None
if fmt == 'fasta':
handle = open(source)
elif fmt == 'genbank':
hanlde = open(sourc)
elif fmt == 'swiss':
handle = ExPASy.get_sprot_raw(source)
else:
raise TypeError('Need to choose correct file format')
record_iterator = SeqIO.parse(handle, fmt)
#handle.close()
return record_iterator
示例14: main
# 需要导入模块: from Bio import ExPASy [as 别名]
# 或者: from Bio.ExPASy import get_sprot_raw [as 别名]
def main():
#Grab our input id value
uniprot_id = get_uniprot_id_from_file(arguments['<input>'])
#Get a handle on the data for the uniprot id
handle = ExPASy.get_sprot_raw(uniprot_id)
#Parse our data
record = SwissProt.read(handle)
handle.close()
#Process out the stuff of interest, GO values in this case
go_refs = [ref[1:] for ref in record.cross_references if ref[0] == 'GO']
for go_entry in go_refs:
pre, val = go_entry[1].split(':')
if pre == 'P':
print(val)
示例15: download_entry
# 需要导入模块: from Bio import ExPASy [as 别名]
# 或者: from Bio.ExPASy import get_sprot_raw [as 别名]
def download_entry(self, accession):
try:
handle = ExPASy.get_sprot_raw(accession)
record = SwissProt.read(handle)
except:
raise KeyError('{}'.format(accession))
record_org = record.organism.strip().lower()
if self.organism not in record_org:
print('{} ortholog of {} not found.'.format(self.organism, accession))
raise KeyError('{} ortholog of {} not found.'.format(self.organism, accession))
else:
self.records[accession] = record
return record