view commons/launcher/tests/Test_launchTEclass.py @ 19:9bcfa7936eec

Deleted selected files
author m-zytnicki
date Mon, 29 Apr 2013 03:23:29 -0400
parents 94ab73e8a190
children
line wrap: on
line source

import unittest
import os
from commons.core.utils.FileUtils import FileUtils
from commons.launcher import launchTEclass


class Test_launchTEclass( unittest.TestCase ):
    
    def test_parseFastaFileFromTEclass( self ):
        inFile = "dummyLibFile.fa"
        inHandler = open( inFile, "w" )
        inHandler.write( ">1360|TEclass result: DNA|ORFs: 1360..2226:+1\n" )
        inHandler.write( "AGCATGACGCA\n" )
        inHandler.write( ">FB|TEclass result: unclear\n" )
        inHandler.write( "GCATGCAGCGACGCGAC\n" )
        inHandler.close()
        
        expFile = "dummyExpFile.map"
        expHandler = open( expFile, "w" )
        expHandler.write( "DNA\t1360\t1\t11\n" )
        expHandler.write( "unclear\tFB\t1\t17\n" )
        expHandler.close()
        
        obsFile = "dummyObsFile.map"
        
        launchTEclass.parseFastaFileFromTEclass( inFile, obsFile )
        
        self.assertTrue( FileUtils.are2FilesIdentical( expFile, obsFile ) )
        
        for f in [ inFile, expFile, obsFile ]:
            os.remove( f )

if __name__ == "__main__":
        unittest.main()