Mercurial > repos > yufei-luo > s_mart
comparison commons/pyRepetUnit/fastaTranslation/allFrames/TranslateInAllFramesAndReplaceStopByX.py @ 18:94ab73e8a190
Uploaded
author | m-zytnicki |
---|---|
date | Mon, 29 Apr 2013 03:20:15 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
17:b0e8584489e6 | 18:94ab73e8a190 |
---|---|
1 from commons.core.utils.FileUtils import FileUtils | |
2 from commons.core.seq.BioseqUtils import BioseqUtils | |
3 | |
4 class TranslateInAllFramesAndReplaceStopByX(object): | |
5 | |
6 def __init__(self): | |
7 self._inputFile = "" | |
8 self._outputFile = "" | |
9 | |
10 def setInputFile(self, input): | |
11 self._inputFile = input | |
12 | |
13 def setOutputFile(self, output): | |
14 self._outputFile = output | |
15 | |
16 def run(self): | |
17 """ | |
18 read a fasta file with nucleotide sequences and translate all sequences in all frames, write the result in a file | |
19 """ | |
20 if not FileUtils.isRessourceExists(self._inputFile): | |
21 raise Exception("Warning your input file %s does not exist!\n" % self._inputFile) | |
22 bioseqList = BioseqUtils.extractBioseqListFromFastaFile(self._inputFile) | |
23 bioseqListInAllFrames = BioseqUtils.translateBioseqListInAllFrames(bioseqList) | |
24 bioseqListTranslatedAndStopsReplace = BioseqUtils.replaceStopCodonsByXInBioseqList(bioseqListInAllFrames) | |
25 BioseqUtils.writeBioseqListIntoFastaFile(bioseqListTranslatedAndStopsReplace, self._outputFile) | |
26 |