Mercurial > repos > yufei-luo > s_mart
view commons/launcher/tests/Test_BlatProgramLauncher.py @ 19:9bcfa7936eec
Deleted selected files
author | m-zytnicki |
---|---|
date | Mon, 29 Apr 2013 03:23:29 -0400 |
parents | 94ab73e8a190 |
children |
line wrap: on
line source
import unittest from commons.launcher.BlatProgramLauncher import BlatProgramLauncher class Test_BlatProgramLauncher( unittest.TestCase ): def setUp( self ): self._i = BlatProgramLauncher() def tearDown( self ): self._i = None def test_getHelpAsString( self ): exp = "" exp += "usage: BlatProgramLauncher.py [options]" exp += "\ngeneric options:" exp += "\n -h: this help" exp += "\n -i: name of the input file (format='fasta')" exp += "\n -c: clean" exp += "\n -v: verbosity level (default=0/1)" exp += "\nspecific options:" exp += "\n -s: name of the subject file (database, format='fasta')" exp += "\n -p: parameters for 'blat'" exp += "\n -A: same sequences (all-by-all)" exp += "\n -o: name of the output file (format='align', default=inFile+'.align')" obs = self._i.getHelpAsString() self.assertEqual( exp, obs ) def test_setAttributesFromCmdLine( self ): self._i.setAttributesFromCmdLine( "-s", "dummySubjectFile.fa" ) self.assertEqual( "dummySubjectFile.fa", self._i.getSubjectFile() ) self._i.setAttributesFromCmdLine( "-o", "dummyOutFile.align" ) self.assertEqual( "dummyOutFile.align", self._i.getOutputFile() ) def test_setWrapperCommandLine( self ): self._i.setInputFile( "dummyInFile.fa" ) self._i.setSubjectFile( "dummySubjectFile.fa" ) exp = "BlatProgramLauncher.py" exp += " -i %s" % ( "dummyInFile.fa" ) exp += " -s %s" % ( "dummySubjectFile.fa" ) exp += " -o %s.align" % ( "dummyInFile.fa" ) exp += " -v 0" self._i.setWrapperCommandLine() obs = self._i.getWrapperCommandLine() self.assertEqual( exp, obs ) def test_setProgramCommandLine( self ): self._i.setInputFile( "dummyInFile.fa" ) self._i.setSubjectFile( "dummySubjectFile.fa" ) self._i.setProgramParameters( "-minIdentity=90" ) exp = "blat dummySubjectFile.fa dummyInFile.fa -minIdentity=90 -out=blast8 dummyInFile.fa.blast" self._i.setProgramCommandLine() obs = self._i.getProgramCommandLine() self.assertEqual( exp, obs ) def test_setListFilesToKeep( self ): self._i.setInputFile( "dummyInFile.fa" ) lExp = [ "dummyInFile.fa.align" ] self._i.setListFilesToKeep() lObs = self._i.getListFilesToKeep() lExp.sort() lObs.sort() self.assertEqual( lExp, lObs ) def test_setListFilesToRemove( self ): self._i.setInputFile( "dummyInFile.fa" ) lExp = [ "dummyInFile.fa.blast" ] self._i.setListFilesToRemove() lObs = self._i.getListFilesToRemove() lExp.sort() lObs.sort() self.assertEqual( lExp, lObs ) def test_setSummary( self ): self._i.setInputFile( "dummyInFile.fa" ) self._i.setSubjectFile( "dummySubjectFile.fa" ) exp = "input file: %s" % ( self._i.getInputFile() ) exp += "\nsubject file: %s" % ( self._i.getSubjectFile() ) exp += "\nparameters: %s" % ( self._i.getProgramParameters() ) exp += "\noutput file: %s" % ( "dummyInFile.fa.align" ) self._i.setSummary() obs = self._i.getSummary() self.assertEqual( exp, obs ) test_suite = unittest.TestSuite() test_suite.addTest( unittest.makeSuite( Test_BlatProgramLauncher ) ) if __name__ == "__main__": unittest.TextTestRunner(verbosity=2).run( test_suite )