Mercurial > repos > yufei-luo > s_mart
view smart_toolShed/SMART/galaxy/test/Test_F_WrappGetLetterDistribution.py @ 1:30c5431d8ce4
Uploaded
author | yufei-luo |
---|---|
date | Thu, 17 Jan 2013 11:01:51 -0500 |
parents | e0f8dcca02ed |
children |
line wrap: on
line source
import unittest import os from commons.core.utils.FileUtils import FileUtils from SMART.galaxy.WrappGetLetterDistribution import WrappGetLetterDistribution SMART_PATH = "%s/SMART" % os.environ["REPET_PATH"] SMART_DATA = SMART_PATH + "/data" class Test_F_WrappGetLetterDistribution(unittest.TestCase): def setUp(self): self._dirTest = "%s/galaxy/test" % SMART_PATH self._iwrappFastq = WrappGetLetterDistribution() self._iwrappFasta = WrappGetLetterDistribution() self._expOutputCSV = "expOutputTomate.csv" def test_wrappFasta(self): self._iwrappFasta._inputFileName = "%s/SR1.fasta" % SMART_DATA self._iwrappFasta._outputFileNamePrefix = "%s/galaxy/test/TomateFasta_res" % SMART_PATH self._iwrappFasta._outputFileNamePNG = "%s/galaxy/test/TomateFasta_res.png" % SMART_PATH self._iwrappFasta._outputFileNamePerNtPNG = "%s/galaxy/test/TomateFasta_resPerNt.png" % SMART_PATH self._iwrappFasta._outputFileNameCSV = "%s/galaxy/test/TomateFasta_res.csv" % SMART_PATH self._iwrappFasta._inputFileFormat = "fasta" self._iwrappFasta._csv = True if not(FileUtils.isEmpty(self._iwrappFasta._inputFileName)): self._iwrappFasta.wrapp() self.assertTrue(os.path.exists(self._iwrappFasta._outputFileNamePNG)) self.assertTrue (os.path.exists(self._iwrappFasta._outputFileNamePerNtPNG)) self.assertTrue (os.path.exists(self._iwrappFasta._outputFileNameCSV)) self.assertTrue(FileUtils.are2FilesIdentical(self._iwrappFasta._outputFileNameCSV,self._expOutputCSV)) else: print "Problem : the input fasta file %s is empty!" % self._inputFileFasta # def test_wrappFasta_withoutCSV_Opt(self): # self._iwrappFasta._inputFileName = "%s/SR1.fasta" % SMART_DATA # self._iwrappFasta._outputFileNamePrefix = "%s/galaxy/test/TomateFasta_res" % SMART_PATH # self._iwrappFasta._outputFileNamePNG = "%s/galaxy/test/TomateFasta_res.png" % SMART_PATH # self._iwrappFasta._outputFileNamePerNtPNG = "%s/galaxy/test/TomateFasta_resPerNt.png" % SMART_PATH # self._iwrappFasta._outputFileNameCSV = "%s/galaxy/test/TomateFasta_res.csv" % SMART_PATH # self._iwrappFasta._inputFileFormat = "fasta" # self._iwrappFasta._csv = False # if not(FileUtils.isEmpty(self._iwrappFasta._inputFileName)): # self._iwrappFasta.wrapp() # self.assertTrue(os.path.exists(self._iwrappFasta._outputFileNamePNG)) # self.assertTrue (os.path.exists(self._iwrappFasta._outputFileNamePerNtPNG)) # else: # print "Problem : the input fasta file %s is empty!" % self._inputFileFasta # os.system("rm %s/galaxy/test/*_res*.png" %SMART_PATH) # os.system("rm %s/galaxy/test/*_res.csv" %SMART_PATH) # # # def test_wrappFastq(self): # self._iwrappFastq._inputFileName = "%s/SR1.fastq" % SMART_DATA # self._iwrappFastq._outputFileNamePrefix = "%s/galaxy/test/TomateFastq_res" % SMART_PATH # self._iwrappFastq._outputFileNamePNG = "%s/galaxy/test/TomateFastq_res.png" % SMART_PATH # self._iwrappFastq._outputFileNamePerNtPNG = "%s/galaxy/test/TomateFastq_resPerNt.png" % SMART_PATH # self._iwrappFastq._outputFileNameCSV = "%s/galaxy/test/TomateFastq_res.csv" % SMART_PATH # self._iwrappFastq._inputFileFormat = "fastq" # self._iwrappFastq._csv = True # if not(FileUtils.isEmpty(self._iwrappFastq._inputFileName)): # self._iwrappFastq.wrapp() # self.assertTrue(os.path.exists(self._iwrappFastq._outputFileNamePNG)) # self.assertTrue (os.path.exists(self._iwrappFastq._outputFileNamePerNtPNG)) # self.assertTrue (os.path.exists(self._iwrappFastq._outputFileNameCSV)) # self.assertTrue(FileUtils.are2FilesIdentical(self._iwrappFastq._outputFileNameCSV,self._expOutputCSV)) # else: # print "Problem : the input fastq file %s is empty!" % self._inputFileFastq # # # def test_wrappFastq_withoutCSV_Opt(self): # self._iwrappFastq._inputFileName = "%s/SR1.fastq" % SMART_DATA # self._iwrappFastq._outputFileNamePrefix = "%s/galaxy/test/TomateFastq_res" % SMART_PATH # self._iwrappFastq._outputFileNamePNG = "%s/galaxy/test/TomateFastq_res.png" % SMART_PATH # self._iwrappFastq._outputFileNamePerNtPNG = "%s/galaxy/test/TomateFastq_resPerNt.png" % SMART_PATH # self._iwrappFastq._outputFileNameCSV = "%s/galaxy/test/TomateFastq_res.csv" % SMART_PATH # self._iwrappFastq._inputFileFormat = "fastq" # self._iwrappFastq._csv = False # if not(FileUtils.isEmpty(self._iwrappFastq._inputFileName)): # self._iwrappFastq.wrapp() # self.assertTrue(os.path.exists(self._iwrappFastq._outputFileNamePNG)) # self.assertTrue (os.path.exists(self._iwrappFastq._outputFileNamePerNtPNG)) # else: # print "Problem : the input fastq file %s is empty!" % self._inputFileFastq # os.system("rm %s/galaxy/test/*_res*.png" %SMART_PATH) # os.system("rm %s/galaxy/test/*_res.csv" %SMART_PATH) if __name__ == "__main__": unittest.main()