annotate SMART/galaxy/test/Test_F_WrappGetLetterDistribution.py @ 6:769e306b7933

Change the repository level.
author yufei-luo
date Fri, 18 Jan 2013 04:54:14 -0500
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
1 import unittest
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
2 import os
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
3 from commons.core.utils.FileUtils import FileUtils
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
4 from SMART.galaxy.WrappGetLetterDistribution import WrappGetLetterDistribution
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
5
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
6 SMART_PATH = "%s/SMART" % os.environ["REPET_PATH"]
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
7 SMART_DATA = SMART_PATH + "/data"
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
8
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
9 class Test_F_WrappGetLetterDistribution(unittest.TestCase):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
10
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
11
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
12 def setUp(self):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
13 self._dirTest = "%s/galaxy/test" % SMART_PATH
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
14 self._iwrappFastq = WrappGetLetterDistribution()
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
15 self._iwrappFasta = WrappGetLetterDistribution()
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
16 self._expOutputCSV = "expOutputTomate.csv"
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
17
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
18 def test_wrappFasta(self):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
19 self._iwrappFasta._inputFileName = "%s/SR1.fasta" % SMART_DATA
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
20 self._iwrappFasta._outputFileNamePrefix = "%s/galaxy/test/TomateFasta_res" % SMART_PATH
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
21 self._iwrappFasta._outputFileNamePNG = "%s/galaxy/test/TomateFasta_res.png" % SMART_PATH
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
22 self._iwrappFasta._outputFileNamePerNtPNG = "%s/galaxy/test/TomateFasta_resPerNt.png" % SMART_PATH
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
23 self._iwrappFasta._outputFileNameCSV = "%s/galaxy/test/TomateFasta_res.csv" % SMART_PATH
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
24 self._iwrappFasta._inputFileFormat = "fasta"
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
25 self._iwrappFasta._csv = True
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
26 if not(FileUtils.isEmpty(self._iwrappFasta._inputFileName)):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
27 self._iwrappFasta.wrapp()
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
28 self.assertTrue(os.path.exists(self._iwrappFasta._outputFileNamePNG))
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
29 self.assertTrue (os.path.exists(self._iwrappFasta._outputFileNamePerNtPNG))
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
30 self.assertTrue (os.path.exists(self._iwrappFasta._outputFileNameCSV))
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
31 self.assertTrue(FileUtils.are2FilesIdentical(self._iwrappFasta._outputFileNameCSV,self._expOutputCSV))
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
32 else:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
33 print "Problem : the input fasta file %s is empty!" % self._inputFileFasta
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
34
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
35
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
36 # def test_wrappFasta_withoutCSV_Opt(self):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
37 # self._iwrappFasta._inputFileName = "%s/SR1.fasta" % SMART_DATA
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
38 # self._iwrappFasta._outputFileNamePrefix = "%s/galaxy/test/TomateFasta_res" % SMART_PATH
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
39 # self._iwrappFasta._outputFileNamePNG = "%s/galaxy/test/TomateFasta_res.png" % SMART_PATH
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
40 # self._iwrappFasta._outputFileNamePerNtPNG = "%s/galaxy/test/TomateFasta_resPerNt.png" % SMART_PATH
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
41 # self._iwrappFasta._outputFileNameCSV = "%s/galaxy/test/TomateFasta_res.csv" % SMART_PATH
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
42 # self._iwrappFasta._inputFileFormat = "fasta"
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
43 # self._iwrappFasta._csv = False
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
44 # if not(FileUtils.isEmpty(self._iwrappFasta._inputFileName)):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
45 # self._iwrappFasta.wrapp()
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
46 # self.assertTrue(os.path.exists(self._iwrappFasta._outputFileNamePNG))
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
47 # self.assertTrue (os.path.exists(self._iwrappFasta._outputFileNamePerNtPNG))
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
48 # else:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
49 # print "Problem : the input fasta file %s is empty!" % self._inputFileFasta
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
50 # os.system("rm %s/galaxy/test/*_res*.png" %SMART_PATH)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
51 # os.system("rm %s/galaxy/test/*_res.csv" %SMART_PATH)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
52 #
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
53 #
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
54 # def test_wrappFastq(self):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
55 # self._iwrappFastq._inputFileName = "%s/SR1.fastq" % SMART_DATA
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
56 # self._iwrappFastq._outputFileNamePrefix = "%s/galaxy/test/TomateFastq_res" % SMART_PATH
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
57 # self._iwrappFastq._outputFileNamePNG = "%s/galaxy/test/TomateFastq_res.png" % SMART_PATH
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
58 # self._iwrappFastq._outputFileNamePerNtPNG = "%s/galaxy/test/TomateFastq_resPerNt.png" % SMART_PATH
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
59 # self._iwrappFastq._outputFileNameCSV = "%s/galaxy/test/TomateFastq_res.csv" % SMART_PATH
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
60 # self._iwrappFastq._inputFileFormat = "fastq"
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
61 # self._iwrappFastq._csv = True
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
62 # if not(FileUtils.isEmpty(self._iwrappFastq._inputFileName)):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
63 # self._iwrappFastq.wrapp()
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
64 # self.assertTrue(os.path.exists(self._iwrappFastq._outputFileNamePNG))
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
65 # self.assertTrue (os.path.exists(self._iwrappFastq._outputFileNamePerNtPNG))
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
66 # self.assertTrue (os.path.exists(self._iwrappFastq._outputFileNameCSV))
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
67 # self.assertTrue(FileUtils.are2FilesIdentical(self._iwrappFastq._outputFileNameCSV,self._expOutputCSV))
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
68 # else:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
69 # print "Problem : the input fastq file %s is empty!" % self._inputFileFastq
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
70 #
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
71 #
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
72 # def test_wrappFastq_withoutCSV_Opt(self):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
73 # self._iwrappFastq._inputFileName = "%s/SR1.fastq" % SMART_DATA
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
74 # self._iwrappFastq._outputFileNamePrefix = "%s/galaxy/test/TomateFastq_res" % SMART_PATH
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
75 # self._iwrappFastq._outputFileNamePNG = "%s/galaxy/test/TomateFastq_res.png" % SMART_PATH
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
76 # self._iwrappFastq._outputFileNamePerNtPNG = "%s/galaxy/test/TomateFastq_resPerNt.png" % SMART_PATH
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
77 # self._iwrappFastq._outputFileNameCSV = "%s/galaxy/test/TomateFastq_res.csv" % SMART_PATH
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
78 # self._iwrappFastq._inputFileFormat = "fastq"
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
79 # self._iwrappFastq._csv = False
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
80 # if not(FileUtils.isEmpty(self._iwrappFastq._inputFileName)):
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
81 # self._iwrappFastq.wrapp()
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
82 # self.assertTrue(os.path.exists(self._iwrappFastq._outputFileNamePNG))
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
83 # self.assertTrue (os.path.exists(self._iwrappFastq._outputFileNamePerNtPNG))
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
84 # else:
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
85 # print "Problem : the input fastq file %s is empty!" % self._inputFileFastq
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
86 # os.system("rm %s/galaxy/test/*_res*.png" %SMART_PATH)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
87 # os.system("rm %s/galaxy/test/*_res.csv" %SMART_PATH)
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
88
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
89
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
90 if __name__ == "__main__":
769e306b7933 Change the repository level.
yufei-luo
parents:
diff changeset
91 unittest.main()