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


Python HTSeq.parse_GFF_attribute_string方法代码示例

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


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

示例1: searchGeneName

# 需要导入模块: import HTSeq [as 别名]
# 或者: from HTSeq import parse_GFF_attribute_string [as 别名]
 def searchGeneName(self,annotationstring):
     if annotationstring == '.':
         genes = 'N/A'
     else:
         # Split the annotationstring by ',' which collapsed by bedtools groupby
         annotationstrings = annotationstring.split(',')
         collect = set()
         for annotation in annotationstrings:
             try:
                 attr = HTSeq.parse_GFF_attribute_string(annotation)
                 # Search for gene_name which is used by ensembl gtf annotation
                 try:
                     gene = attr['gene_name']
                 except KeyError:
                     # Search for gene, which might used in GFF annotation
                     try:
                         gene = attr['gene']
                     except KeyError:
                         # Search for gene_id
                         try:
                             gene = attr['gene_id']
                         except KeyError:
                             try:
                                 gene = attr['transcript_id']
                             except KeyError:
                                 gene = 'N/A'
             except:
                 gene = self.searchGeneName1(annotation)
             collect.add(gene)
         # Collapse all genes togethor
         if len(collect) > 1:
             try:
                 collect.remove('N/A')
             except KeyError:
                 pass
         genes = ','.join(collect)
         
     return genes
开发者ID:Voineagulab,项目名称:DCC,代码行数:40,代码来源:circAnnotate.py

示例2: intersectcirc

# 需要导入模块: import HTSeq [as 别名]
# 或者: from HTSeq import parse_GFF_attribute_string [as 别名]
	def intersectcirc(self, circ_file, modified_gtf_file):
		# imput the result file of print_start_end_file
		import pybedtools
		#intersectBed -a start.bed -b Drosophila_melanogaster.BDGP5.75.exon_id.dedup.gtf -wa -wb -loj > tmpintersect.2
		circ = pybedtools.BedTool(circ_file)
		gtf = pybedtools.BedTool(modified_gtf_file)
		intersectfile = circ.intersect(gtf,wa=True,wb=True,loj=True)
		# Store circExons as: circle start or end intervals as key, custom_exon_id as value
		circExons = {}
		for lin in intersectfile:
			lin_split = str(lin).split('\t')
			if lin_split[11].strip('\n') == '.':
				#lin_split[11] = ''
				pass
			else:
				circExons.setdefault( HTSeq.GenomicInterval(lin_split[0],int(lin_split[1]),int(lin_split[2]),lin_split[9]), set() ).add( HTSeq.parse_GFF_attribute_string(lin_split[11])['custom_exon_id'] )
			#circExons.setdefault( HTSeq.GenomicInterval(lin_split[0],int(lin_split[1]),int(lin_split[2]),lin_split[9]), [] ).append( { HTSeq.GenomicInterval(lin_split[3],int(lin_split[6]),int(lin_split[7]),lin_split[9]):HTSeq.parse_GFF_attribute_string(lin_split[11]) })
		return circExons
开发者ID:s6juncheng,项目名称:Test,代码行数:20,代码来源:Circ_nonCirc_Exon_Match.py


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