Mercurial > repos > yufei-luo > s_mart
diff commons/launcher/tests/Test_F_LaunchRefAlign.py @ 18:94ab73e8a190
Uploaded
author | m-zytnicki |
---|---|
date | Mon, 29 Apr 2013 03:20:15 -0400 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commons/launcher/tests/Test_F_LaunchRefAlign.py Mon Apr 29 03:20:15 2013 -0400 @@ -0,0 +1,72 @@ +import unittest +import os +from commons.core.utils.FileUtils import FileUtils +from commons.launcher.LaunchRefAlign import LaunchRefAlign + + +class Test_F_LaunchRefAlign(unittest.TestCase): + + def setUp(self): + self._inputFastaFileName = "input.fa" + self._obsOutputFileName = "obs" + self._expOutputFileName = "exp" + self._writeInputFile() + self._writeExpOutputFile() + +# def tearDown(self): +# try: +# os.remove(self._inputFastaFileName) +# except:pass +# +# try: +# os.remove(self._expOutputFileName) +# except:pass +# try: +# os.remove(self._obsOutputFileName) +# except:pass +# try: +# os.remove("input.fa.2.3.5.80.10.20.15.dat") +# except:pass + + def test_run(self): + ilauncher = LaunchRefAlign(self._inputFastaFileName,verbosity=5) + ilauncher.run() + self.assertTrue(FileUtils.are2FilesIdentical(self._expOutputFileName, self._obsOutputFileName)) + +# def test_run_as_script(self): +# cmd = 'LaunchTRF.py -i %s -o %s -v 3' % (self._inputFastaFileName, self._obsTRFOutputFileName) +# os.system(cmd) +# self.assertTrue(FileUtils.are2FilesIdentical(self._expTRFOutputFileName, self._obsTRFOutputFileName)) + + + def _writeInputFile(self): + InputFile = open(self._inputFastaFileName, 'w') + InputFile.write('>sequence\n') + InputFile.write('GGGCGGCACGGTGGTGTGGTGGTTAGCACTGTTGCCTCACAGCAAGAAGGCCCCGGGTTC\n') + InputFile.write('GATCCCCGGTTGGGACTGAGGCTGGGGACTTTCTGTGTGGAGTTTGCATGTTCTCCCTGT\n') + InputFile.write('GCCTGCGTGGGTTCTCTCCGGGTACTCCGGCTTCCTCCCACAGTCCAAAGACATGCATGA\n') + InputFile.write('TTGGGGATTAGGCTAATTGGAAACTCTAAAATTGCCCGTAGGTGTGAGTGTGAGAGAGAA\n') + InputFile.write('TGGTTGTTTGTCTATATGTGTTAGCCCTGCGATTGACTGGCGTCCAGTCCAGGGTGTACC\n') + InputFile.write('CTGCCTCCGCCCATTGTGCTGGGATAGGCTCCAGTCCCCCCG\n') + InputFile.write('CAAGCGGTAGAAAGTGAGTGAGTGAGTGA\n') + InputFile.write('>sequence2\n') + InputFile.write('GGGCAGCCTGGGTGGCTCAGCGGTTTAGCGCCTGCCTTTGGCCCAGGGCGTGATCCTGGA\n') + InputFile.write('GACCCGGGATCGAGTCCCACATCGGGCTCCCTGCATGGAGCCTGCTTCTCCCTCTGCCTG\n') + InputFile.write('TGTCTCTGCCTCTCTCTCTCTCTGTGTCTCTCATGAATAAA\n') + InputFile.close() + + def _writeExpOutputFile(self): + with open(self._expOutputFileName,'w') as expOutputFile: + expOutputFile.write("""1\t(GTGGT)2\tsequence\t11\t21 +2\t(GGT)5\tsequence\t10\t23 +3\t(GTGTGA)4\tsequence\t222\t242 +4\t(GTCCA)2\tsequence\t282\t292 +5\t(AGTG)4\tsequence\t355\t371 +6\t(GCCTGTCTCTCCTCT)4\tsequence2\t100\t152 +7\t(CTCTGCCTGTGT)3\tsequence2\t112\t151 +8\t(TC)23\tsequence2\t107\t152 +""") + + +if __name__ == "__main__": + unittest.main() \ No newline at end of file