annotate commons/launcher/tests/Test_YassProgramLauncher.py @ 18:94ab73e8a190

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