annotate commons/launcher/tests/Test_launchTEclass.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 import os
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
3 from commons.core.utils.FileUtils import FileUtils
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
4 from commons.launcher import launchTEclass
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
5
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
6
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
7 class Test_launchTEclass( unittest.TestCase ):
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
8
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
9 def test_parseFastaFileFromTEclass( self ):
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
10 inFile = "dummyLibFile.fa"
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
11 inHandler = open( inFile, "w" )
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
12 inHandler.write( ">1360|TEclass result: DNA|ORFs: 1360..2226:+1\n" )
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
13 inHandler.write( "AGCATGACGCA\n" )
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
14 inHandler.write( ">FB|TEclass result: unclear\n" )
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
15 inHandler.write( "GCATGCAGCGACGCGAC\n" )
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
16 inHandler.close()
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
17
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
18 expFile = "dummyExpFile.map"
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
19 expHandler = open( expFile, "w" )
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
20 expHandler.write( "DNA\t1360\t1\t11\n" )
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
21 expHandler.write( "unclear\tFB\t1\t17\n" )
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
22 expHandler.close()
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
23
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
24 obsFile = "dummyObsFile.map"
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
25
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
26 launchTEclass.parseFastaFileFromTEclass( inFile, obsFile )
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
27
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
28 self.assertTrue( FileUtils.are2FilesIdentical( expFile, obsFile ) )
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
29
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
30 for f in [ inFile, expFile, obsFile ]:
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
31 os.remove( f )
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
32
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
33 if __name__ == "__main__":
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
34 unittest.main()