Mercurial > repos > yufei-luo > s_mart
comparison commons/pyRepetUnit/fastaTranslation/allFrames/TranslateInAllFramesAndReplaceStopByX.py @ 31:0ab839023fe4
Uploaded
author | m-zytnicki |
---|---|
date | Tue, 30 Apr 2013 14:33:21 -0400 |
parents | 94ab73e8a190 |
children |
comparison
equal
deleted
inserted
replaced
30:5677346472b5 | 31:0ab839023fe4 |
---|---|
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 |