Mercurial > repos > jjohnson > ensembl_variant_report
diff ensemblref.py @ 5:9e83cc05d384 draft
Uploaded
author | jjohnson |
---|---|
date | Mon, 06 Feb 2017 09:25:43 -0500 |
parents | c3a9e63e8c51 |
children |
line wrap: on
line diff
--- a/ensemblref.py Fri Jan 06 17:43:29 2017 -0500 +++ b/ensemblref.py Mon Feb 06 09:25:43 2017 -0500 @@ -47,9 +47,15 @@ return self.name_idx - def get_gtf_transcript(self,transcript_id): + def get_gtf_transcript(self,name): idx = self.get_transcript_idx() - return idx[transcript_id] if transcript_id in idx else None + if name in idx: + return idx[name] + else: + nidx = self.get_name_idx() + if name in nidx: + return nidx[name] + return None def transcript_is_coding(self,transcript_id): @@ -62,34 +68,15 @@ return tx.start_codons[0] if len(tx.start_codons) > 0 else None - def get_bed_line(self,transcript_id,coding=False): + def get_bed_line(self,transcript_id,score=0,itemRgb='0,0,0',coding=False): tx = self.get_transcript_idx()[transcript_id] chrom = tx.gene.contig chromStart = tx.coding_beg if coding else tx.beg chromEnd = tx.coding_end if coding else tx.end name = transcript_id - score = 0 strand = '+' if tx.gene.strand else '-' thickStart = tx.coding_beg if tx.coding_beg else chromStart thickEnd = tx.coding_end if tx.coding_end else chromEnd - itemRgb = '0,0,0' - exons = tx.get_coding_exons() if coding else tx.get_exons() - blockCount = len(exons) - if tx.gene.strand: - strand = '+' - blockSizes = [abs(e-s) for s,e in exons] - - def get_bed_line(self,transcript_id,coding=False): - tx = self.get_transcript_idx()[transcript_id] - chrom = tx.gene.contig - chromStart = tx.coding_beg if coding else tx.beg - chromEnd = tx.coding_end if coding else tx.end - name = transcript_id - score = 0 - strand = '+' if tx.gene.strand else '-' - thickStart = tx.coding_beg if tx.coding_beg else chromStart - thickEnd = tx.coding_end if tx.coding_end else chromEnd - itemRgb = '0,0,0' exons = tx.get_coding_exons() if coding else tx.get_exons() blockCount = len(exons) if tx.gene.strand: