Mercurial > repos > yufei-luo > s_mart
comparison commons/pyRepetUnit/hmmer/tests/TestHmmpfamAndParse2alignLauncher.py @ 31:0ab839023fe4
Uploaded
| author | m-zytnicki |
|---|---|
| date | Tue, 30 Apr 2013 14:33:21 -0400 |
| parents | 94ab73e8a190 |
| children |
comparison
equal
deleted
inserted
replaced
| 30:5677346472b5 | 31:0ab839023fe4 |
|---|---|
| 1 import unittest | |
| 2 import os | |
| 3 import sys | |
| 4 | |
| 5 if not os.environ.has_key( "REPET_PATH" ): | |
| 6 print "*** Error: no environment variable REPET_PATH" | |
| 7 sys.exit(1) | |
| 8 sys.path.append( os.environ["REPET_PATH"] ) | |
| 9 | |
| 10 from pyRepet.launcher.Launcher import HmmpfamAndParse2alignLauncher | |
| 11 from pyRepet.sql.RepetJobMySQL import * | |
| 12 | |
| 13 class TestHmmpfamAndParse2alignLauncher(unittest.TestCase): | |
| 14 | |
| 15 def testConstructor(self): | |
| 16 | |
| 17 params = { | |
| 18 "query" : "toto", | |
| 19 "job_table":"fakeTable", | |
| 20 "queue" : "fakeQueue", | |
| 21 "groupid" : "fakeId", | |
| 22 "tmpDir" : "fakeDir", | |
| 23 "cDir" : "." | |
| 24 } | |
| 25 | |
| 26 hmmpfam = HmmpfamAndParse2alignLauncher("toto", params) | |
| 27 | |
| 28 self.assertEquals("toto", hmmpfam.query) | |
| 29 self.assertEquals("fakeTable", hmmpfam.job_table) | |
| 30 self.assertEquals("fakeQueue", hmmpfam.queue) | |
| 31 self.assertEquals("fakeId", hmmpfam.groupid) | |
| 32 self.assertEquals("fakeDir", hmmpfam.tmpdir) | |
| 33 | |
| 34 | |
| 35 def testCmd_start(self): | |
| 36 | |
| 37 fullInFileName = "/workspace/repet_pipe/commons/pyRepetUnit/hmmer/datas/test_input_aa.fa" | |
| 38 expectedCmdStart = "hmmpfam --informat FASTA -E 10 /workspace/repet_pipe/pyRepet/launcher/datas/hmmpfam/myhmms test_input_aa.fa > /workspace/repet_pipe/commons/pyRepetUnit/hmmer/datas/test_input_aa.fa.hmmpfamOut" | |
| 39 | |
| 40 user = "oinizan" | |
| 41 host = "pisano" | |
| 42 passwd = "oinizan" | |
| 43 dbName = "repet_oinizan" | |
| 44 jobDb = RepetJob(user , host , passwd , dbName) | |
| 45 params = {"param":"--informat FASTA -E 10", | |
| 46 "query" : "toto", | |
| 47 "job_table":"fake", | |
| 48 "queue" : "fake", | |
| 49 "groupid" : "fake", | |
| 50 "profilDB": "/workspace/repet_pipe/pyRepet/launcher/datas/hmmpfam/myhmms", | |
| 51 "tmpDir" : "fakeDir", | |
| 52 "outputDir": "/workspace/repet_pipe/commons/pyRepetUnit/hmmer/datas", | |
| 53 "scriptToLaunch": "/workspace/repet_pipe/repet_base/HmmpfamOutput2align_script.py", | |
| 54 "cDir" : "." | |
| 55 } | |
| 56 self.hmmpfam = HmmpfamAndParse2alignLauncher(jobDb, params) | |
| 57 self.assertEquals(expectedCmdStart, self.hmmpfam.cmd_start ( fullInFileName )) | |
| 58 | |
| 59 | |
| 60 def testCmd_finish(self): | |
| 61 | |
| 62 fullInFileName = "/workspace/repet_pipe/commons/pyRepetUnit/hmmer/datas/test_input_aa.fa" | |
| 63 user = "oinizan" | |
| 64 host = "pisano" | |
| 65 passwd = "oinizan" | |
| 66 dbName = "repet_oinizan" | |
| 67 jobDb = RepetJob(user , host , passwd , dbName) | |
| 68 params = {"param":"--informat FASTA -E 10", | |
| 69 "query" : "toto", | |
| 70 "job_table":"fake", | |
| 71 "queue" : "fake", | |
| 72 "groupid" : "fake", | |
| 73 "profilDB": "/workspace/repet_pipe/pyRepet/launcher/datas/hmmpfam/myhmms", | |
| 74 "tmpDir" : "fakeDir", | |
| 75 "outputDir": "/workspace/repet_pipe/commons/pyRepetUnit/hmmer/datas", | |
| 76 "scriptToLaunch": "/workspace/repet_pipe/repet_base/HmmpfamOutput2align_script.py", | |
| 77 "cDir" : "." | |
| 78 } | |
| 79 self.hmmpfamAndParse2align = HmmpfamAndParse2alignLauncher(jobDb, params) | |
| 80 expectedCmdFinish = "os.system( \"/workspace/repet_pipe/repet_base/HmmpfamOutput2align_script.py -i /workspace/repet_pipe/commons/pyRepetUnit/hmmer/datas/test_input_aa.fa.hmmpfamOut -o /workspace/repet_pipe/commons/pyRepetUnit/hmmer/datas/test_input_aa.fa.hmmpfamOut.align -c\" )\n" | |
| 81 self.assertEquals(expectedCmdFinish, self.hmmpfamAndParse2align.cmd_finish ( fullInFileName )) | |
| 82 | |
| 83 | |
| 84 | |
| 85 if __name__ == "__main__": | |
| 86 unittest.main() | |
| 87 |
