18
|
1 import unittest, os, os.path
|
|
2 from SMART.Java.Python.misc import Utils
|
|
3 SMART_PATH = os.environ["REPET_PATH"] + "/SMART"
|
|
4
|
|
5 class Test_F_trimSequences(unittest.TestCase):
|
|
6
|
|
7 def setUp(self):
|
|
8 self._expOutputFileName = "expOutputFile.fasta"
|
|
9 self._obsOutputFileName = "obsOutputFile.mfa"
|
|
10 self._inputFileName = "inputFile.fasta"
|
|
11
|
|
12 def tearDown(self):
|
|
13 for fileName in (self._expOutputFileName, self._obsOutputFileName, self._inputFileName):
|
|
14 if os.path.exists(fileName):
|
|
15 os.remove(fileName)
|
|
16
|
|
17 def test_simple(self):
|
|
18 expOutputFile = open(self._expOutputFileName, "w")
|
|
19 expOutputFile.write(">sequence1\nTTGCATAGCGCTACGTA\n")
|
|
20 expOutputFile.close()
|
|
21 inputFile = open(self._inputFileName, "w")
|
|
22 inputFile.write(">sequence1\nAGCTCGGGTATTGCATAGCGCTACGTACCCTTTATATC\n")
|
|
23 inputFile.close()
|
|
24 os.system("python %s/Java/Python/trimSequences.py -i %s -f fasta -3 CCCTTTATATC -5 AGCTCGGGTA -o %s -v 0" % (SMART_PATH, self._inputFileName, self._obsOutputFileName))
|
|
25 self.assertTrue(Utils.diff(self._expOutputFileName, self._obsOutputFileName))
|
|
26
|
|
27 if __name__ == "__main__":
|
|
28 unittest.main()
|