comparison SMART/Java/Python/clusterize.py @ 67:f4de72c80eac draft

Uploaded
author m-zytnicki
date Mon, 16 Nov 2015 11:59:35 -0500
parents 90f4b29d884f
children
comparison
equal deleted inserted replaced
65:4ab9c86890ba 67:f4de72c80eac
99 fs.perChromosome(True) 99 fs.perChromosome(True)
100 fs.setPresorted(self.presorted) 100 fs.setPresorted(self.presorted)
101 fs.setOutputFileName(self.sortedFileNames[fileName]) 101 fs.setOutputFileName(self.sortedFileNames[fileName])
102 fs.sort() 102 fs.sort()
103 self.splittedFileNames[fileName] = fs.getOutputFileNames() 103 self.splittedFileNames[fileName] = fs.getOutputFileNames()
104 self.nbElementsPerChromosome = fs.getNbElementsPerChromosome()
105 self.nbElements = fs.getNbElements()
106 self.chromosomes.update(self.splittedFileNames[fileName].keys()) 104 self.chromosomes.update(self.splittedFileNames[fileName].keys())
107 105
108 def _iterate(self): 106 def _iterate(self):
109 progress = UnlimitedProgress(10000, "Reading input file", self.verbosity) 107 progress = UnlimitedProgress(10000, "Reading input file", self.verbosity)
110 transcripts = []
111 heap = []
112 parsersSets = [] 108 parsersSets = []
109 self.nbElements = 0
113 if self.chromosomes: 110 if self.chromosomes:
111 for chromosome in self.chromosomes:
112 parsersSets.append([NCListFileUnpickle(self.splittedFileNames[fileName][chromosome]) for fileName in self.splittedFileNames if chromosome in self.splittedFileNames[fileName]])
113 else:
114 parsersSets.append(self.parsers.values()) 114 parsersSets.append(self.parsers.values())
115 else:
116 for chromosome in self.chromosomes:
117 parsersSets.append([self.splittedFileNames[fileName][chromosome] for fileName in self.splittedFileNames if chromosome in self.splittedFileNames[fileName]])
118 for parsers in parsersSets: 115 for parsers in parsersSets:
116 transcripts = []
117 heap = []
119 for parser in parsers: 118 for parser in parsers:
120 iterator = parser.getIterator() 119 iterator = parser.getIterator()
121 for transcript in iterator: 120 for transcript in iterator:
122 if transcript.__class__.__name__ == "Mapping": 121 if transcript.__class__.__name__ == "Mapping":
123 transcript = transcript.getTranscript() 122 transcript = transcript.getTranscript()
140 self._write(oldTranscript) 139 self._write(oldTranscript)
141 else: 140 else:
142 newTranscripts.append(oldTranscript) 141 newTranscripts.append(oldTranscript)
143 newTranscripts.append(newTranscript) 142 newTranscripts.append(newTranscript)
144 transcripts = newTranscripts 143 transcripts = newTranscripts
144 self.nbElements += 1
145 progress.inc() 145 progress.inc()
146 for transcript in transcripts: 146 for transcript in transcripts:
147 self._write(transcript) 147 self._write(transcript)
148 progress.done() 148 progress.done()
149 149