Mercurial > repos > yufei-luo > s_mart
diff SMART/Java/Python/structure/Transcript.py @ 18:94ab73e8a190
Uploaded
author | m-zytnicki |
---|---|
date | Mon, 29 Apr 2013 03:20:15 -0400 |
parents | 769e306b7933 |
children |
line wrap: on
line diff
--- a/SMART/Java/Python/structure/Transcript.py Mon Apr 22 11:11:10 2013 -0400 +++ b/SMART/Java/Python/structure/Transcript.py Mon Apr 29 03:20:15 2013 -0400 @@ -347,6 +347,31 @@ newTranscript.exons = theseExons return newTranscript + + def getIntersection(self, transcript): + """ + Get the intersection between this transcript and another one + @param transcript: object to be compared to + @type transcript: class L{Transcript<Transcript>} + @return: an other transcript + """ + if self.getChromosome() != transcript.getChromosome() or self.getDirection() != transcript.getDirection(): + return None + newTranscript = Transcript() + newTranscript.setDirection(self.getDirection()) + newTranscript.setChromosome(self.getChromosome()) + newTranscript.setName("%s_intersect_%s" % (self.getName(), transcript.getName())) + newExons = [] + for thisExon in self.getExons(): + for thatExon in transcript.getExons(): + newExon = thisExon.getIntersection(thatExon) + if newExon != None: + newExons.append(newExon) + if not newExons: + return None + newTranscript.exons = newExons + return newTranscript + def getSqlVariables(cls): """