예제 #1
0
 def run(self):
     self.getTranscriptDict()
     self.getAnnotationDict()
     self.getSeqDict()
     self.getRefDict()
     self.getAlignmentDict()
     detailsDict = defaultdict(list)
     classifyDict = {}
     for aId, t in self.transcriptDict.iteritems():
         a = self.annotationDict[psl_lib.remove_alignment_number(aId)]
         aln = self.alignmentDict[aId]
         if a.getCdsLength() <= 75 or t.getCdsLength() <= 75:
             continue
         # TODO: this will miss an inframe stop if it is the last 3 bases that are not the annotated stop.
         # use the logic from EndStop to flag this
         codons = list(codonPairIterator(a, t, aln, self.seqDict, self.refDict))[:-1]
         for i, target_codon, query_codon in codons:
             if seq_lib.codon_to_amino_acid(target_codon) == "*":
                 if target_codon == query_codon:
                     detailsDict[aId].append(seq_lib.cds_coordinate_to_bed(t, i, i + 3, self.colors["input"],
                                                                        self.column))
                 else:
                     detailsDict[aId].append(seq_lib.cds_coordinate_to_bed(t, i, i + 3, self.rgb, self.column))
                 classifyDict[aId] = 1
         if aId not in classifyDict:
             classifyDict[aId] = 0
     self.dumpValueDicts(classifyDict, detailsDict)
예제 #2
0
 def run(self):
     self.getTranscriptDict()
     self.getAnnotationDict()
     self.getSeqDict()
     self.getRefDict()
     self.getAlignmentDict()
     detailsDict = defaultdict(list)
     classifyDict = {}
     for aId, aln in self.alignmentDict.iteritems():
         if aId not in self.transcriptDict:
             continue
         t = self.transcriptDict[aId]
         a = self.annotationDict[psl_lib.remove_alignment_number(aId)]
         if a.getCdsLength() <= 75 or t.getCdsLength() <= 75:
             continue
         for i, target_codon, query_codon in codonPairIterator(a, t, aln, self.seqDict, self.refDict):
             if target_codon != query_codon and seq_lib.codon_to_amino_acid(target_codon) == \
                     seq_lib.codon_to_amino_acid(query_codon):
                 detailsDict[aId].append(seq_lib.cds_coordinate_to_bed(t, i, i + 3, self.rgb, self.column))
                 classifyDict[aId] = 1
         if aId not in classifyDict:
             classifyDict[aId] = 0
     self.dumpValueDicts(classifyDict, detailsDict)