示例#1
0
 def del_is_intron(self, start, end, txt):
     """Determines if coordinate is intron"""
     for i in range(len(txt.exons)-1):
         intron = [int(txt.exons[i][1])+1, int(txt.exons[i+1][0])-1]
         
         olap_size = overlap([start, end], intron)
                     
         if float(olap_size) / float(cardinality([start, end])) > 0.9 and\
            float(olap_size) / float(cardinality(intron)) > 0.9:
             return True
         
     return False
示例#2
0
    def details(self, refseq=None):
        """Sets relevant attributes of events"""
        if self.event_type == "retained_intron":
            apart = int(self.exon_coords[1][0]) - 1 - int(self.exon_coords[0][1])
            self.multi_3 = self.multiple_3(apart)
        else:
            self.multi_3 = None

        # splice sites
        self.splice = None
        if self.event_type in ("AS5", "AS3"):
            ss = self.get_splice_sites(self.align_blocks[0], left=self.left, right=self.right)
            if ss and len(ss) > 0:
                self.splice = ss[0]
        elif self.event_type in ("novel_exon", "AS53", "novel_transcript", "novel_utr"):
            splice_sites = []
            for block in self.align_blocks:
                ss = ",".join(self.get_splice_sites(block, left=True, right=True))
                if ss:
                    splice_sites.append(ss)
            if splice_sites:
                self.splice = "-".join(splice_sites)        
        elif self.event_type == "novel_intron":
            ss = self.get_splice_sites(self.align_blocks[0], left=False, right=True, whole=True)
            if ss and len(ss) > 0:
                self.splice = ss[0]
            
        # size
        self.size = None
        if self.event_type in ("novel_exon", "AS53", "novel_transcript", "novel_utr", "novel_intron"):
            sizes = []
            for block in self.align_coords:
                sizes.append(str(cardinality(block)))

            self.size = ",".join(sizes)

        # orf
        if refseq:
            self.find_pep_change(refseq)