Mercurial > repos > yufei-luo > s_mart
comparison commons/tools/tests/Test_SpliceTEsFromGenome.py @ 18:94ab73e8a190
Uploaded
author | m-zytnicki |
---|---|
date | Mon, 29 Apr 2013 03:20:15 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
17:b0e8584489e6 | 18:94ab73e8a190 |
---|---|
1 import unittest | |
2 import os | |
3 from commons.core.utils.FileUtils import FileUtils | |
4 from commons.tools.SpliceTEsFromGenome import SpliceTEsFromGenome | |
5 | |
6 | |
7 class Test_SpliceTEsFromGenome( unittest.TestCase ): | |
8 | |
9 def setUp( self ): | |
10 self._i = SpliceTEsFromGenome() | |
11 | |
12 | |
13 def test_zLaunchAsScript( self ): | |
14 cDir = os.getcwd() | |
15 | |
16 coordFile = "dummyCoordFile" | |
17 coordFileHandler = open( coordFile, "w" ) | |
18 coordFileHandler.write( "TE1\tchr1\t2\t5\n" ) | |
19 coordFileHandler.write( "TE2\tchr1\t11\t15\n" ) | |
20 coordFileHandler.write( "TE3\tchr1\t12\t14\n" ) | |
21 coordFileHandler.close() | |
22 | |
23 genomeFile = "dummyGenomeFile" | |
24 genomeFileHandler = open( genomeFile, "w" ) | |
25 genomeFileHandler.write( ">chr1\n" ) | |
26 genomeFileHandler.write( "AGGGGAAAAACCCCCAAAAA\n" ) | |
27 genomeFileHandler.write( ">chr2\n" ) | |
28 genomeFileHandler.write( "TTTTTTTTTT\n" ) | |
29 genomeFileHandler.close() | |
30 | |
31 expFile = "dummyExpFile" | |
32 expFileHandler = open( expFile, "w" ) | |
33 expFileHandler.write( ">chr1\n" ) | |
34 expFileHandler.write( "AAAAAAAAAAA\n" ) | |
35 expFileHandler.write( ">chr2\n" ) | |
36 expFileHandler.write( "TTTTTTTTTT\n" ) | |
37 expFileHandler.close() | |
38 | |
39 obsFile = "dummyObsFile" | |
40 | |
41 cmd = "SpliceTEsFromGenome.py" | |
42 cmd += " -i %s" % ( coordFile ) | |
43 cmd += " -f %s" % ( "map" ) | |
44 cmd += " -g %s" % ( genomeFile ) | |
45 cmd += " -o %s" % ( obsFile ) | |
46 cmd += " -v %i" % ( 0 ) | |
47 returnStatus = os.system( cmd ) | |
48 | |
49 self.assertTrue( returnStatus == 0 ) | |
50 self.assertTrue( FileUtils.are2FilesIdentical( expFile, obsFile ) ) | |
51 | |
52 for f in [ coordFile, genomeFile, expFile, obsFile ]: | |
53 os.remove( f ) | |
54 os.chdir( cDir ) | |
55 | |
56 if __name__ == "__main__": | |
57 unittest.main() |