Mercurial > repos > yufei-luo > s_mart
view commons/pyRepetUnit/fastaTranslation/allFrames/TranslateInAllFramesAndReplaceStopByX.py @ 31:0ab839023fe4
Uploaded
author | m-zytnicki |
---|---|
date | Tue, 30 Apr 2013 14:33:21 -0400 |
parents | 94ab73e8a190 |
children |
line wrap: on
line source
from commons.core.utils.FileUtils import FileUtils from commons.core.seq.BioseqUtils import BioseqUtils class TranslateInAllFramesAndReplaceStopByX(object): def __init__(self): self._inputFile = "" self._outputFile = "" def setInputFile(self, input): self._inputFile = input def setOutputFile(self, output): self._outputFile = output def run(self): """ read a fasta file with nucleotide sequences and translate all sequences in all frames, write the result in a file """ if not FileUtils.isRessourceExists(self._inputFile): raise Exception("Warning your input file %s does not exist!\n" % self._inputFile) bioseqList = BioseqUtils.extractBioseqListFromFastaFile(self._inputFile) bioseqListInAllFrames = BioseqUtils.translateBioseqListInAllFrames(bioseqList) bioseqListTranslatedAndStopsReplace = BioseqUtils.replaceStopCodonsByXInBioseqList(bioseqListInAllFrames) BioseqUtils.writeBioseqListIntoFastaFile(bioseqListTranslatedAndStopsReplace, self._outputFile)