Mercurial > repos > yufei-luo > s_mart
view commons/pyRepetUnit/hmmer/tests/TestHmmpfamAndParse2alignLauncher.py @ 18:94ab73e8a190
Uploaded
author | m-zytnicki |
---|---|
date | Mon, 29 Apr 2013 03:20:15 -0400 |
parents | |
children |
line wrap: on
line source
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()