18
|
1 import unittest
|
|
2 import os
|
|
3 from commons.core.utils.FileUtils import FileUtils
|
|
4
|
|
5 TESTFILES_PATH = os.environ['REPET_PATH'] + '/SMART/Java/Python/TestFiles'
|
|
6
|
|
7 class Test_F_coordinatesToSequence(unittest.TestCase):
|
|
8
|
|
9 def test_run(self):
|
|
10 cmd = "python ../coordinatesToSequence.py -i %s/testC2S.gff3 -f gff3 -s %s/testC2S.fa -o testOut.fa -v 10 " % (TESTFILES_PATH, TESTFILES_PATH)
|
|
11 os.system(cmd)
|
|
12 obs = 'testOut.fa'
|
|
13 exp = 'expOut.fa'
|
|
14 self._writeExpOut(exp)
|
|
15 self.assertTrue(FileUtils.isRessourceExists(obs))
|
|
16 self.assertTrue(FileUtils.are2FilesIdentical(obs, exp))
|
|
17 os.remove(obs)
|
|
18 os.remove(exp)
|
|
19
|
|
20 def _writeExpOut(self, outputFileName):
|
|
21 f = open(outputFileName, "w")
|
|
22 f.write(">region0\n")
|
|
23 f.write("CAACATTAGC\n")
|
|
24 f.write(">region1\n")
|
|
25 f.write("TTAGCCGGCC\n")
|
|
26 f.write(">region2\n")
|
|
27 f.write("GGCCGGCTAA\n")
|
|
28 f.close()
|
|
29
|
|
30 if __name__ == "__main__":
|
|
31 unittest.main() |