def analyze_intergenic(self): last_transcript_end = None last_transcript_neg = None for key in self.transcript_keys: transcript = self.transcripts[ key] #loop through certain chrom transcripts in order if last_transcript_end is None: last_transcript_end = transcript.end_pos last_transcript_neg = transcript.negative_dir else: sign = "-" if last_transcript_neg and transcript.negative_dir else "+" self.intergenic_lines.append( Line.creat_line_by_name_and_corr(transcript.chr, "Intergenic", last_transcript_end, transcript.start_pos, sign=sign)) last_transcript_end = transcript.end_pos last_transcript_neg = transcript.negative_dir self.analyze_interonics(transcript)
def creat_intronics(self, transcript): transcript.exons.sort() last_exon_end = transcript.exons[0].end_pos for exon in transcript.exons[1:]: self.interonic_lines.append( Line.creat_line_by_name_and_corr( exon.chr, "intron", last_exon_end, exon.start_pos, sign="-" if exon.negative_dir else "+", gene_name=transcript.gene_name)) last_exon_end = exon.end_pos