当前位置: 首页>>代码示例>>Python>>正文


Python SwissProt.read方法代码示例

本文整理汇总了Python中Bio.SwissProt.read方法的典型用法代码示例。如果您正苦于以下问题:Python SwissProt.read方法的具体用法?Python SwissProt.read怎么用?Python SwissProt.read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Bio.SwissProt的用法示例。


在下文中一共展示了SwissProt.read方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_SwissProt

# 需要导入模块: from Bio import SwissProt [as 别名]
# 或者: from Bio.SwissProt import read [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 . "
开发者ID:digfish,项目名称:uniprot-fasta-tools,代码行数:9,代码来源:sec_struct_vis.py

示例2: gen_uniprot_features_for_pdb

# 需要导入模块: from Bio import SwissProt [as 别名]
# 或者: from Bio.SwissProt import read [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)
开发者ID:xulesc,项目名称:mcpsc,代码行数:27,代码来源:make_data.py

示例3: main

# 需要导入模块: from Bio import SwissProt [as 别名]
# 或者: from Bio.SwissProt import read [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:])
开发者ID:jnj16180340,项目名称:franklin,代码行数:10,代码来源:franklin_DBPR.py

示例4: main

# 需要导入模块: from Bio import SwissProt [as 别名]
# 或者: from Bio.SwissProt import read [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)
开发者ID:ajiehust,项目名称:rosalind,代码行数:10,代码来源:dbpr.py

示例5: acession

# 需要导入模块: from Bio import SwissProt [as 别名]
# 或者: from Bio.SwissProt import read [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
开发者ID:hugocarmaga,项目名称:Projeto_LB,代码行数:12,代码来源:Uniprot.py

示例6: BiologicalProcesses

# 需要导入模块: from Bio import SwissProt [as 别名]
# 或者: from Bio.SwissProt import read [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)
开发者ID:HotBreakfast,项目名称:Rosalind,代码行数:13,代码来源:DBPR.py

示例7: get_keywords

# 需要导入模块: from Bio import SwissProt [as 别名]
# 或者: from Bio.SwissProt import read [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)
开发者ID:thunderbump,项目名称:Rosalind,代码行数:13,代码来源:dbpr.py

示例8: fetch

# 需要导入模块: from Bio import SwissProt [as 别名]
# 或者: from Bio.SwissProt import read [as 别名]
def fetch(acc) :
    '''Downloads data from UniProt.
    Input: 
    acc: accession code of the record
    database: database name
    Return: the Entrez record
    '''
    base_url = 'http://www.uniprot.org/uniprot/'
    handle = urllib.request.urlopen(base_url + acc + '.txt')
    record = SwissProt.read(handle)
    return record
开发者ID:talavis,项目名称:labscripts,代码行数:13,代码来源:uniprot_record.py

示例9: main

# 需要导入模块: from Bio import SwissProt [as 别名]
# 或者: from Bio.SwissProt import read [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()
开发者ID:paulkarayan,项目名称:rosalind,代码行数:14,代码来源:dbpr.py

示例10: download_entry

# 需要导入模块: from Bio import SwissProt [as 别名]
# 或者: from Bio.SwissProt import read [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
开发者ID:daniaki,项目名称:ppi_wrangler,代码行数:16,代码来源:uniprot.py

示例11: main

# 需要导入模块: from Bio import SwissProt [as 别名]
# 或者: from Bio.SwissProt import read [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)
开发者ID:SavinaRoja,项目名称:challenges,代码行数:16,代码来源:DBPR.py

示例12: main

# 需要导入模块: from Bio import SwissProt [as 别名]
# 或者: from Bio.SwissProt import read [as 别名]
def main(fichier):
	"""
		navigate into protein database
	"""
	f = open(fichier,'r')
	fline = f.readline().strip()
	from Bio import ExPASy
	from Bio import SwissProt
	handle = ExPASy.get_sprot_raw(fline)
	record = SwissProt.read(handle)
	go = []
	for i in record.cross_references:
		if i[0] == 'GO' and i[2][0]=='P':
		        go.append(i[2].lstrip('P:'))
	print '\n'.join(go)
开发者ID:shamansim,项目名称:Rosalind,代码行数:17,代码来源:script.py

示例13: main

# 需要导入模块: from Bio import SwissProt [as 别名]
# 或者: from Bio.SwissProt import read [as 别名]
def main():
    # Read the UniProt ID for a txt file.
    with open('problem_datasets/rosalind_dbpr.txt', 'r') as infile:
        uni_id = infile.read().strip()

    # Retrieve the data from UniProt (separated IDs by commas).
    raw_data = ExPASy.get_sprot_raw(uni_id)
    record = SwissProt.read(raw_data) # use SwissProt.parse for multiple proteins

    # Collect the relevant information.
    go = []
    for i in record.cross_references:
        if i[2].startswith('P:'):
            go.append(i[2][2:])

    # Output answer.
    with open('output/rosalind_dbpr_out.txt', 'w') as outfile:
        outfile.write('\n'.join(go))

    # Optional: Print answer and gene ID/name
    name = record.gene_name.split(' ')[0][5:]
    print('Gene:\n', name, ' (UniProt ID = ', uni_id,
          ')\n\nBiological Processes:\n', '\n'.join(go), sep='')  
开发者ID:Davo36,项目名称:Rosalind-1,代码行数:25,代码来源:rosalind_DBPR.py

示例14: snp_uniprot

# 需要导入模块: from Bio import SwissProt [as 别名]
# 或者: from Bio.SwissProt import read [as 别名]
def snp_uniprot(uniprotname, selection='(all)', label=1, name='', quiet=0):
    '''
DESCRIPTION

    Selects all UniProt annotated nsSNPs (natural variants) in given
    structure. Does a sequence alignment of UniProt sequence and PDB
    sequence.

USAGE

    snp_uniprot uniprotname [, selection [, label [, name [, quiet]]]]

ARGUMENTS

    uniprotname = string: UniProt reference (like HBB_HUMAN or P68871)

    selection = string: atom selection

    label = 0 or 1: Label CA atoms of nsSNPs with mutation {default: 1}

    name = string: name of new selection {default: nsSNPs}

EXAMPLE

    fetch 3HBT
    snp_uniprot ACTG_HUMAN, chain A

SEE ALSO

    snp_ncbi
    '''
    from Bio import ExPASy
    from Bio import SwissProt
    handle = ExPASy.get_sprot_raw(uniprotname)
    record = SwissProt.read(handle)
    snp_common(record, selection, label, name, quiet)
开发者ID:speleo3,项目名称:pymol-psico,代码行数:38,代码来源:snp.py

示例15: SWAT

# 需要导入模块: from Bio import SwissProt [as 别名]
# 或者: from Bio.SwissProt import read [as 别名]
def SWAT(id):
    handle = ExPASy.get_sprot_raw(id) # several IDs can be separated by commas
    record = SwissProt.read(handle) # use SwissProt.parse for multiple proteins
    return record.sequence
开发者ID:UlrichLudwig,项目名称:ROSALIND-4,代码行数:6,代码来源:SWAT.py


注:本文中的Bio.SwissProt.read方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。