comparison commons/launcher/tests/Test_F_LaunchRefAlign.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 import unittest
2 import os
3 from commons.core.utils.FileUtils import FileUtils
4 from commons.launcher.LaunchRefAlign import LaunchRefAlign
5
6
7 class Test_F_LaunchRefAlign(unittest.TestCase):
8
9 def setUp(self):
10 self._inputFastaFileName = "input.fa"
11 self._obsOutputFileName = "obs"
12 self._expOutputFileName = "exp"
13 self._writeInputFile()
14 self._writeExpOutputFile()
15
16 # def tearDown(self):
17 # try:
18 # os.remove(self._inputFastaFileName)
19 # except:pass
20 #
21 # try:
22 # os.remove(self._expOutputFileName)
23 # except:pass
24 # try:
25 # os.remove(self._obsOutputFileName)
26 # except:pass
27 # try:
28 # os.remove("input.fa.2.3.5.80.10.20.15.dat")
29 # except:pass
30
31 def test_run(self):
32 ilauncher = LaunchRefAlign(self._inputFastaFileName,verbosity=5)
33 ilauncher.run()
34 self.assertTrue(FileUtils.are2FilesIdentical(self._expOutputFileName, self._obsOutputFileName))
35
36 # def test_run_as_script(self):
37 # cmd = 'LaunchTRF.py -i %s -o %s -v 3' % (self._inputFastaFileName, self._obsTRFOutputFileName)
38 # os.system(cmd)
39 # self.assertTrue(FileUtils.are2FilesIdentical(self._expTRFOutputFileName, self._obsTRFOutputFileName))
40
41
42 def _writeInputFile(self):
43 InputFile = open(self._inputFastaFileName, 'w')
44 InputFile.write('>sequence\n')
45 InputFile.write('GGGCGGCACGGTGGTGTGGTGGTTAGCACTGTTGCCTCACAGCAAGAAGGCCCCGGGTTC\n')
46 InputFile.write('GATCCCCGGTTGGGACTGAGGCTGGGGACTTTCTGTGTGGAGTTTGCATGTTCTCCCTGT\n')
47 InputFile.write('GCCTGCGTGGGTTCTCTCCGGGTACTCCGGCTTCCTCCCACAGTCCAAAGACATGCATGA\n')
48 InputFile.write('TTGGGGATTAGGCTAATTGGAAACTCTAAAATTGCCCGTAGGTGTGAGTGTGAGAGAGAA\n')
49 InputFile.write('TGGTTGTTTGTCTATATGTGTTAGCCCTGCGATTGACTGGCGTCCAGTCCAGGGTGTACC\n')
50 InputFile.write('CTGCCTCCGCCCATTGTGCTGGGATAGGCTCCAGTCCCCCCG\n')
51 InputFile.write('CAAGCGGTAGAAAGTGAGTGAGTGAGTGA\n')
52 InputFile.write('>sequence2\n')
53 InputFile.write('GGGCAGCCTGGGTGGCTCAGCGGTTTAGCGCCTGCCTTTGGCCCAGGGCGTGATCCTGGA\n')
54 InputFile.write('GACCCGGGATCGAGTCCCACATCGGGCTCCCTGCATGGAGCCTGCTTCTCCCTCTGCCTG\n')
55 InputFile.write('TGTCTCTGCCTCTCTCTCTCTCTGTGTCTCTCATGAATAAA\n')
56 InputFile.close()
57
58 def _writeExpOutputFile(self):
59 with open(self._expOutputFileName,'w') as expOutputFile:
60 expOutputFile.write("""1\t(GTGGT)2\tsequence\t11\t21
61 2\t(GGT)5\tsequence\t10\t23
62 3\t(GTGTGA)4\tsequence\t222\t242
63 4\t(GTCCA)2\tsequence\t282\t292
64 5\t(AGTG)4\tsequence\t355\t371
65 6\t(GCCTGTCTCTCCTCT)4\tsequence2\t100\t152
66 7\t(CTCTGCCTGTGT)3\tsequence2\t112\t151
67 8\t(TC)23\tsequence2\t107\t152
68 """)
69
70
71 if __name__ == "__main__":
72 unittest.main()