diff commons/tools/tests/Test_SpliceTEsFromGenome.py @ 18:94ab73e8a190

Uploaded
author m-zytnicki
date Mon, 29 Apr 2013 03:20:15 -0400
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commons/tools/tests/Test_SpliceTEsFromGenome.py	Mon Apr 29 03:20:15 2013 -0400
@@ -0,0 +1,57 @@
+import unittest
+import os
+from commons.core.utils.FileUtils import FileUtils
+from commons.tools.SpliceTEsFromGenome import SpliceTEsFromGenome
+
+
+class Test_SpliceTEsFromGenome( unittest.TestCase ):
+    
+    def setUp( self ):
+        self._i = SpliceTEsFromGenome()
+        
+        
+    def test_zLaunchAsScript( self ):
+        cDir = os.getcwd()
+        
+        coordFile = "dummyCoordFile"
+        coordFileHandler = open( coordFile, "w" )
+        coordFileHandler.write( "TE1\tchr1\t2\t5\n" )
+        coordFileHandler.write( "TE2\tchr1\t11\t15\n" )
+        coordFileHandler.write( "TE3\tchr1\t12\t14\n" )
+        coordFileHandler.close()
+        
+        genomeFile = "dummyGenomeFile"
+        genomeFileHandler = open( genomeFile, "w" )
+        genomeFileHandler.write( ">chr1\n" )
+        genomeFileHandler.write( "AGGGGAAAAACCCCCAAAAA\n" )
+        genomeFileHandler.write( ">chr2\n" )
+        genomeFileHandler.write( "TTTTTTTTTT\n" )
+        genomeFileHandler.close()
+        
+        expFile = "dummyExpFile"
+        expFileHandler = open( expFile, "w" )
+        expFileHandler.write( ">chr1\n" )
+        expFileHandler.write( "AAAAAAAAAAA\n" )
+        expFileHandler.write( ">chr2\n" )
+        expFileHandler.write( "TTTTTTTTTT\n" )
+        expFileHandler.close()
+        
+        obsFile = "dummyObsFile"
+        
+        cmd = "SpliceTEsFromGenome.py"
+        cmd += " -i %s" % ( coordFile )
+        cmd += " -f %s" % ( "map" )
+        cmd += " -g %s" % ( genomeFile )
+        cmd += " -o %s" % ( obsFile )
+        cmd += " -v %i" % ( 0 )
+        returnStatus = os.system( cmd )
+        
+        self.assertTrue( returnStatus == 0 )
+        self.assertTrue( FileUtils.are2FilesIdentical( expFile, obsFile ) )
+        
+        for f in [ coordFile, genomeFile, expFile, obsFile ]:
+            os.remove( f )
+        os.chdir( cDir )
+        
+if __name__ == "__main__":
+        unittest.main()
\ No newline at end of file