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


Python SeqFeature.qualifiers['hmm_model']方法代码示例

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


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

示例1: hmmsearch_genome

# 需要导入模块: from Bio.SeqFeature import SeqFeature [as 别名]
# 或者: from Bio.SeqFeature.SeqFeature import qualifiers['hmm_model'] [as 别名]
 def hmmsearch_genome(self, hmm, genome, table='Standard', decorate=False, **kwargs):
     #get genes
     genes = get_indexes_of_genes(genome)
     if not genes: return None
     for gene_id, gi in enumerate(genes):
         genome.features[gi].qualifiers['feature_id'] = gi
         genome.features[gi].qualifiers['gene_id'] = gene_id
     #translate genes
     with user_message('Translating genes/CDS of %s' % genome.description, '\n'):
         translator = Translator(self._abort_event)
         translation = translator.translate(genome, genes, table)
     if not translation: return None
     with user_message('Performing hmm search.'):
         results = self.hmmsearch_recs(hmm, translation)
     if not results: return None
     with user_message('Parsing search results...'):
         #get hit_ids of hmm matches
         hits = dict()
         for result in results:
             for hit in result.iterhits():
                 hits[hit.id] = hit
         #get indexes of features where hmm hit
         hit_features = dict()
         for t in translation:
             if t.id in hits:
                 fid = t.features[0].qualifiers.get('feature_id')
                 if fid is None: continue
                 hit_features[fid] = hits[t.id], t
     #decorate genome
     if decorate:
         with user_message('Adding results as annotations...'):
             hmm_name = os.path.basename(hmm)
             for f in hit_features:
                 feature = genome.features[f] 
                 for hsp in hit_features[f][0]:
                     if feature.strand == 1:
                         hmm_location = FeatureLocation(feature.location.start+hsp.hit_start*3, 
                                                        feature.location.start+hsp.hit_end*3, 
                                                        feature.strand)
                     else:
                         hmm_location = FeatureLocation(feature.location.end-hsp.hit_end*3, 
                                                        feature.location.end-hsp.hit_start*3, 
                                                        feature.strand)
                     hmm_feature = SeqFeature(hmm_location, type='misc_feature')
                     hmm_feature.qualifiers['hmm_model'] = hmm_name
                     hmm_feature.qualifiers['bitscore'] = hsp.bitscore
                     hmm_feature.qualifiers['psi_evalue'] = hsp.psi_evalue
                     hmm_feature.qualifiers['evalue_cond'] = hsp.evalue_cond
                     hmm_feature.qualifiers['acc_average'] = hsp.acc_avg
                     hmm_feature.qualifiers['bias'] = hsp.bias
                     genome.features.append(hmm_feature)
     print 'Done.\n'
     return hit_features 
开发者ID:allista,项目名称:BioUtils,代码行数:55,代码来源:__init__.py


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