18
|
1 import unittest
|
|
2 from commons.launcher.YassProgramLauncher import YassProgramLauncher
|
|
3
|
|
4
|
|
5
|
|
6 class Test_YassProgramLauncher( unittest.TestCase ):
|
|
7
|
|
8 def setUp( self ):
|
|
9 self._i = YassProgramLauncher()
|
|
10
|
|
11
|
|
12 def tearDown( self ):
|
|
13 self._i = None
|
|
14
|
|
15
|
|
16 def test_getSpecificHelpAsString( self ):
|
|
17 exp = ""
|
|
18 exp += "\nspecific options:"
|
|
19 exp += "\n -s: name of the subject file (format='fasta')"
|
|
20 exp += "\n -p: parameters for 'yass'"
|
|
21 exp += "\n -A: same sequences (all-by-all)"
|
|
22 exp += "\n -o: name of the output file (format='align', default=inFile+'.align')"
|
|
23 obs = self._i.getSpecificHelpAsString()
|
|
24 self.assertEqual( exp, obs )
|
|
25
|
|
26
|
|
27 def test_setASpecificAttributeFromCmdLine( self ):
|
|
28 self._i.setASpecificAttributeFromCmdLine( "-s", "dummySubjectFile.fa" )
|
|
29 self.assertEqual( "dummySubjectFile.fa", self._i.getSubjectFile() )
|
|
30
|
|
31 self._i.setASpecificAttributeFromCmdLine( "-o", "dummyOutFile.align" )
|
|
32 self.assertEqual( "dummyOutFile.align", self._i.getOutputFile() )
|
|
33
|
|
34
|
|
35 def test_setWrapperCommandLine( self ):
|
|
36 self._i.setInputFile( "dummyInFile.fa" )
|
|
37 self._i.setSubjectFile( "dummySubjectFile.fa" )
|
|
38 exp = "YassProgramLauncher.py"
|
|
39 exp += " -i %s" % ( "dummyInFile.fa" )
|
|
40 exp += " -s %s" % ( "dummySubjectFile.fa" )
|
|
41 exp += " -o %s.align" % ( "dummyInFile.fa" )
|
|
42 exp += " -v 0"
|
|
43 self._i.setWrapperCommandLine()
|
|
44 obs = self._i.getWrapperCommandLine()
|
|
45 self.assertEqual( exp, obs )
|
|
46
|
|
47
|
|
48 def test_setProgramCommandLine( self ):
|
|
49 self._i.setInputFile( "dummyInFile.fa" )
|
|
50 self._i.setSubjectFile( "dummySubjectFile.fa" )
|
|
51 exp = "yass -d 2 -o dummyInFile.fa.blast dummyInFile.fa dummySubjectFile.fa"
|
|
52 self._i.setProgramCommandLine()
|
|
53 obs = self._i.getProgramCommandLine()
|
|
54 self.assertEqual( exp, obs )
|
|
55
|
|
56
|
|
57 def test_setListFilesToKeep( self ):
|
|
58 self._i.setInputFile( "dummyInFile.fa" )
|
|
59 lExp = [ "dummyInFile.fa.align" ]
|
|
60 self._i.setListFilesToKeep()
|
|
61 lObs = self._i.getListFilesToKeep()
|
|
62 lExp.sort()
|
|
63 lObs.sort()
|
|
64 self.assertEqual( lExp, lObs )
|
|
65
|
|
66
|
|
67 def test_setSummary( self ):
|
|
68 self._i.setInputFile( "dummyInFile.fa" )
|
|
69 self._i.setSubjectFile( "dummySubjectFile.fa" )
|
|
70 exp = "input file: %s" % ( self._i.getInputFile() )
|
|
71 exp += "\nsubject file: %s" % ( self._i.getSubjectFile() )
|
|
72 exp += "\nparameters: %s" % ( self._i.getProgramParameters() )
|
|
73 exp += "\noutput file: %s" % ( "dummyInFile.fa.align" )
|
|
74 self._i.setSummary()
|
|
75 obs = self._i.getSummary()
|
|
76 self.assertEqual( exp, obs )
|
|
77
|
|
78 if __name__ == "__main__":
|
|
79 unittest.main() |