def get_start_stop_codons(self, annot='havana'): """gets start and stop codons position start codon is always first""" trans_start_stop = {} for linea in open(self.gtf_path).readlines(): dic = self._parse_line(linea, feature='start_codon|stop_codon', annot=annot) if not dic: continue trans_start_stop = fn.add2dict(trans_start_stop, dic['attr']['transcript_id'], [dic['start'], dic['stop']]) return trans_start_stop
def get_seqs(trans_exons, parser): trans_seqs = {} for trans in trans_exons.keys(): seqs = {} for exon in trans_exons[trans]: region = parser.get_region(exon[1], exon[2], exon[3]) for key, obj in region.items(): seqs = fn.add2dict(seqs, key, obj) for key, obj in seqs.items(): seqs[key] = ''.join(obj) trans_seqs[trans] = seqs return trans_seqs