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


Python Bio.ExPASy类代码示例

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


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

示例1: gen_uniprot_features_for_pdb

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,代码行数:25,代码来源:make_data.py

示例2: download_aa_dist_per_gene

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
开发者ID:dandanvidi,项目名称:amino-acid-distribution,代码行数:31,代码来源:download_aa_sequences.py

示例3: __getitem__

    def __getitem__(self, id):
        """__getitem__(self, id) -> object

        Return a Prodoc entry.  id is either the id or accession
        for the entry.  Raises a KeyError if there's an error.
        
        """
        import time
        from Bio import ExPASy

        # First, check to see if enough time has passed since my
        # last query.
        if self.last_query_time is not None:
            delay = self.last_query_time + self.delay - time.time()
            if delay > 0.0:
                time.sleep(delay)
        self.last_query_time = time.time()

        try:
            handle = ExPASy.get_prodoc_entry(id)
        except IOError:
            raise KeyError(id)
        try:
            handle = File.StringHandle(_extract_record(handle))
        except ValueError:
            raise KeyError(id)

        if self.parser is not None:
            return self.parser.parse(handle)
        return handle.read()
开发者ID:nuin,项目名称:biopython,代码行数:30,代码来源:Prodoc.py

示例4: get_SwissProt

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,代码行数:7,代码来源:sec_struct_vis.py

示例5: test_prosite_html

 def test_prosite_html(self):
     handle = ExPASy.get_prosite_entry('PS00001')
     html = handle.read()
     self.assertEqual(handle.url,
                      'http://prosite.expasy.org/cgi-bin/prosite/get-prosite-entry?PS00001')
     handle.close()
     self.assertTrue('<title>PROSITE: PS00001</title>' in html)
开发者ID:JoaoRodrigues,项目名称:biopython,代码行数:7,代码来源:test_ExPASy.py

示例6: test_prodoc_html

 def test_prodoc_html(self):
     handle = ExPASy.get_prodoc_entry('PDOC00001')
     html = handle.read()
     self.assertEqual(handle.url,
                      'http://prosite.expasy.org/cgi-bin/prosite/get-prodoc-entry?PDOC00001')
     handle.close()
     self.assertTrue('{PS00001; ASN_GLYCOSYLATION}' in html)
开发者ID:JoaoRodrigues,项目名称:biopython,代码行数:7,代码来源:test_ExPASy.py

示例7: main

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,代码行数:8,代码来源:franklin_DBPR.py

示例8: main

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,代码行数:8,代码来源:dbpr.py

示例9: __init__

	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()
开发者ID:sjcockell,项目名称:common,代码行数:9,代码来源:SequenceHandler.py

示例10: __init__

 def __init__(self, s=None, ps=None):
     if isinstance(s, basestring):
         self.sequence = Seq(s)
     else:
         self.sequence = s
     self.prosite = ExPASy.get_prosite_raw(ps)
     self.record = Prosite.read(self.prosite)
     self.pat = pa.compile(self.record.pattern)
     self.regexp = re.compile(pa.prosite_to_re(self.record.pattern))
开发者ID:sjcockell,项目名称:glycosylation,代码行数:9,代码来源:ConsensusPredictor.py

示例11: test_get_sprot_raw

 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")
开发者ID:abelsen,项目名称:biopython,代码行数:9,代码来源:test_SeqIO_online.py

示例12: acession

 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,代码行数:10,代码来源:Uniprot.py

示例13: get_keywords

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,代码行数:11,代码来源:dbpr.py

示例14: BiologicalProcesses

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,代码行数:11,代码来源:DBPR.py

示例15: test_get_sprot_raw

 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")
开发者ID:lennax,项目名称:biopython,代码行数:12,代码来源:test_SeqIO_online.py


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