當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。