18
|
1 import os
|
|
2 import unittest
|
|
3 from commons.pyRepetUnit.hmmer.hmmOutput.HmmOutput import HmmOutput
|
|
4 from commons.pyRepetUnit.hmmer.hmmOutput.HmmOutputProcessing import HmmOutputProcessing
|
|
5 from commons.pyRepetUnit.hmmer.hmmOutput.HmmpfamOutputProcessing import HmmpfamOutputProcessing
|
|
6 from commons.pyRepetUnit.hmmer.hmmOutput.HmmscanOutputProcessing import HmmscanOutputProcessing
|
|
7 from commons.core.utils.FileUtils import FileUtils
|
|
8
|
|
9 class TestHmmOutputProcessing(unittest.TestCase):
|
|
10
|
|
11 def setUp(self):
|
|
12 self.hmmOutput = HmmOutputProcessing()
|
|
13 self._inputFile = "./datas/test_hmmpfam_output"
|
|
14 self._outputFile = "./datas/dummyoutput.align"
|
|
15 self._inputFileScan2 = "./datas/hmmscanOutput"
|
|
16 self._outputFileScan2 = "./datas/hmmscanOutput.align"
|
|
17
|
|
18 def test_writeHmmOutputToAlignFile(self):
|
|
19 output = open("./datas/output.align", "w")
|
|
20 output.write("SAR:satellite:satellite_5\t3\t9\tDUF751\t5\t11\t5.4\t5.4\t0\n")
|
|
21 output.write("SAR:satellite:satellite_5\t17\t23\tDUF751\t5\t11\t5.1\t5.5\t0\n")
|
|
22 output.write("SAR:satellite:satellite_5\t3\t21\tClenterotox\t173\t191\t0.66\t7.4\t0\n")
|
|
23 output.close()
|
|
24 pfamOutput = HmmOutput()
|
|
25 pfamOutput.append(["SAR:satellite:satellite_5", "3", "9", "DUF751", "5", "11", "5.4", "5.4"])
|
|
26 pfamOutput.append(["SAR:satellite:satellite_5", "17", "23", "DUF751", "5", "11", "5.1", "5.5"])
|
|
27 pfamOutput.append(["SAR:satellite:satellite_5", "3", "21", "Clenterotox", "173", "191", "0.66", "7.4"])
|
|
28 fout = open("./datas/outputGen.align", "w")
|
|
29 self.hmmOutput.writeHmmOutputToAlignFile(pfamOutput, fout)
|
|
30 fout.close()
|
|
31 self.assertTrue(FileUtils.are2FilesIdentical("./datas/output.align", "./datas/outputGen.align"))
|
|
32 os.remove("./datas/output.align")
|
|
33 os.remove("./datas/outputGen.align")
|
|
34
|
|
35 if __name__ == "__main__":
|
|
36 unittest.main() |