annotate SMART/Java/Python/test/Test_F_coordinatesToSequence.py @ 18:94ab73e8a190

Uploaded
author m-zytnicki
date Mon, 29 Apr 2013 03:20:15 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
1 import unittest
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
2 import os
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
3 from commons.core.utils.FileUtils import FileUtils
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
4
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
5 TESTFILES_PATH = os.environ['REPET_PATH'] + '/SMART/Java/Python/TestFiles'
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
6
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
7 class Test_F_coordinatesToSequence(unittest.TestCase):
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
8
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
9 def test_run(self):
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
10 cmd = "python ../coordinatesToSequence.py -i %s/testC2S.gff3 -f gff3 -s %s/testC2S.fa -o testOut.fa -v 10 " % (TESTFILES_PATH, TESTFILES_PATH)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
11 os.system(cmd)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
12 obs = 'testOut.fa'
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
13 exp = 'expOut.fa'
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
14 self._writeExpOut(exp)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
15 self.assertTrue(FileUtils.isRessourceExists(obs))
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
16 self.assertTrue(FileUtils.are2FilesIdentical(obs, exp))
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
17 os.remove(obs)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
18 os.remove(exp)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
19
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
20 def _writeExpOut(self, outputFileName):
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
21 f = open(outputFileName, "w")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
22 f.write(">region0\n")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
23 f.write("CAACATTAGC\n")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
24 f.write(">region1\n")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
25 f.write("TTAGCCGGCC\n")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
26 f.write(">region2\n")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
27 f.write("GGCCGGCTAA\n")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
28 f.close()
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
29
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
30 if __name__ == "__main__":
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
31 unittest.main()