#NEWLINE# def testGTFIso( self ) : #NEWLINE# #INDENT# src = StringIO . StringIO ( 'chr1|test|exon|1001|1100|0|+|.|gene_id "foo1"; transcript_id "bar1"; isoform_id "iso1"\nchr1|test|exon|1201|1300|0|+|.|gene_id "foo1"; transcript_id "bar1"; isoform_id "iso1"\nchr1|test|exon|1401|1500|0|+|.|gene_id "foo1"; transcript_id "bar1"; isoform_id "iso1"\nchr1|test|CDS|1051|1447|0|+|1|gene_id "foo1"; transcript_id "bar1"; isoform_id "iso1"\nchr1|test|start_codon|1051|1053|0|+|.|gene_id "foo1"; transcript_id "bar1"; isoform_id "iso1"\nchr1|test|stop_codon|1448|1450|0|+|.|gene_id "foo1"; transcript_id "bar1"; isoform_id "iso1"\nchr1|test|exon|1001|1100|0|+|.|gene_id "foo2"; transcript_id "bar2"; isoform_id "iso1"\nchr1|test|exon|1401|1500|0|+|.|gene_id "foo2"; transcript_id "bar2"; isoform_id "iso1"\nchr1|test|CDS|1051|1447|0|+|1|gene_id "foo2"; transcript_id "bar2"; isoform_id "iso1"\nchr1|test|start_codon|1051|1053|0|+|.|gene_id "foo2"; transcript_id "bar2"; isoform_id "iso1"\nchr1|test|stop_codon|1448|1450|0|+|.|gene_id "foo2"; transcript_id "bar2"; isoform_id "iso1"\n' . replace ( '|' , '\t' ) ) #NEWLINE# gtf = GTF ( fileobj = src , quiet = True ) #NEWLINE# genes = list ( gtf . genes ) #NEWLINE# self . assertEqual ( len ( genes ) , 1 ) #NEWLINE# self . assertEqual ( [ 'foo1' ] , [ g . gene_id for g in genes ] ) #NEWLINE# self . assertEqual ( [ 'iso1' ] , [ g . gid for g in g ] ) #NEWLINE# transcripts = list ( genes [ 0 ] . transcripts ) #NEWLINE# self . assertEqual ( [ 'bar1' , 'bar2' ] , [ t . transcript_id for t in transcripts ] ) #NEWLINE# self . assertEqual ( len ( transcripts ) , 2 ) #NEWLINE# self . assertEqual ( list ( genes [ 0 ] . regions ) , [ ( 1 , 1000 , 1100 , True , 'bar1,bar2' ) , ( 2 , 1200 , 1300 , False , 'bar1' ) , ( 3 , 1400 , 1500 , True , 'bar1,bar2' ) ] )