Mercurial > repos > yufei-luo > s_mart
diff commons/pyRepetUnit/hmmer/tests/TestHmmpfamAndParse2alignLauncher.py @ 31:0ab839023fe4
Uploaded
author | m-zytnicki |
---|---|
date | Tue, 30 Apr 2013 14:33:21 -0400 |
parents | 94ab73e8a190 |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commons/pyRepetUnit/hmmer/tests/TestHmmpfamAndParse2alignLauncher.py Tue Apr 30 14:33:21 2013 -0400 @@ -0,0 +1,87 @@ +import unittest +import os +import sys + +if not os.environ.has_key( "REPET_PATH" ): + print "*** Error: no environment variable REPET_PATH" + sys.exit(1) +sys.path.append( os.environ["REPET_PATH"] ) + +from pyRepet.launcher.Launcher import HmmpfamAndParse2alignLauncher +from pyRepet.sql.RepetJobMySQL import * + +class TestHmmpfamAndParse2alignLauncher(unittest.TestCase): + + def testConstructor(self): + + params = { + "query" : "toto", + "job_table":"fakeTable", + "queue" : "fakeQueue", + "groupid" : "fakeId", + "tmpDir" : "fakeDir", + "cDir" : "." + } + + hmmpfam = HmmpfamAndParse2alignLauncher("toto", params) + + self.assertEquals("toto", hmmpfam.query) + self.assertEquals("fakeTable", hmmpfam.job_table) + self.assertEquals("fakeQueue", hmmpfam.queue) + self.assertEquals("fakeId", hmmpfam.groupid) + self.assertEquals("fakeDir", hmmpfam.tmpdir) + + + def testCmd_start(self): + + fullInFileName = "/workspace/repet_pipe/commons/pyRepetUnit/hmmer/datas/test_input_aa.fa" + 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" + + user = "oinizan" + host = "pisano" + passwd = "oinizan" + dbName = "repet_oinizan" + jobDb = RepetJob(user , host , passwd , dbName) + params = {"param":"--informat FASTA -E 10", + "query" : "toto", + "job_table":"fake", + "queue" : "fake", + "groupid" : "fake", + "profilDB": "/workspace/repet_pipe/pyRepet/launcher/datas/hmmpfam/myhmms", + "tmpDir" : "fakeDir", + "outputDir": "/workspace/repet_pipe/commons/pyRepetUnit/hmmer/datas", + "scriptToLaunch": "/workspace/repet_pipe/repet_base/HmmpfamOutput2align_script.py", + "cDir" : "." + } + self.hmmpfam = HmmpfamAndParse2alignLauncher(jobDb, params) + self.assertEquals(expectedCmdStart, self.hmmpfam.cmd_start ( fullInFileName )) + + + def testCmd_finish(self): + + fullInFileName = "/workspace/repet_pipe/commons/pyRepetUnit/hmmer/datas/test_input_aa.fa" + user = "oinizan" + host = "pisano" + passwd = "oinizan" + dbName = "repet_oinizan" + jobDb = RepetJob(user , host , passwd , dbName) + params = {"param":"--informat FASTA -E 10", + "query" : "toto", + "job_table":"fake", + "queue" : "fake", + "groupid" : "fake", + "profilDB": "/workspace/repet_pipe/pyRepet/launcher/datas/hmmpfam/myhmms", + "tmpDir" : "fakeDir", + "outputDir": "/workspace/repet_pipe/commons/pyRepetUnit/hmmer/datas", + "scriptToLaunch": "/workspace/repet_pipe/repet_base/HmmpfamOutput2align_script.py", + "cDir" : "." + } + self.hmmpfamAndParse2align = HmmpfamAndParse2alignLauncher(jobDb, params) + 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" + self.assertEquals(expectedCmdFinish, self.hmmpfamAndParse2align.cmd_finish ( fullInFileName )) + + + +if __name__ == "__main__": + unittest.main() +