annotate commons/pyRepetUnit/hmmer/hmmOutput/tests/TestHmmOutputProcessing.py @ 31:0ab839023fe4

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