annotate SMART/Java/Python/test/Test_F_getWigProfile.py @ 25:7809e72960fe

Deleted selected files
author m-zytnicki
date Mon, 29 Apr 2013 03:29:14 -0400
parents 94ab73e8a190
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
1 import unittest
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
2 import os, glob
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
3 from SMART.Java.Python.getWigProfile import GetWigProfile
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
4
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
5
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
6 class Test_F_GetWigProfile(unittest.TestCase):
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
7
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
8 def setUp(self):
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
9 self.transcriptFileName = "transcriptFile.gff3"
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
10 self.wigFileName = "file.wig"
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
11 self.outputFileName = "outputFile.png"
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
12
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
13 def tearDown(self):
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
14 for fileRoot in (self.transcriptFileName, self.wigFileName, self.outputFileName):
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
15 for file in glob.glob("%s*" % (fileRoot)):
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
16 os.remove(file)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
17 os.system("rm .RData .chr1.index ")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
18
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
19 def test_run_simple(self):
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
20 handle = open(self.transcriptFileName, "w")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
21 handle.write("chr1\tSMART\tmRNA\t10\t20\t.\t+\t.\tID=test1;Name=test1")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
22 handle.close()
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
23 handle = open(self.wigFileName, "w")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
24 handle.write("variableStep chrom=chr1\n")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
25 handle.write("1 1\n")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
26 handle.write("2 1\n")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
27 handle.write("3 1\n")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
28 handle.write("4 1\n")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
29 handle.write("5 1\n")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
30 handle.write("6 1\n")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
31 handle.write("7 1\n")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
32 handle.write("8 1\n")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
33 handle.write("9 1\n")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
34 handle.write("10 1\n")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
35 handle.write("11 2\n")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
36 handle.write("12 3\n")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
37 handle.write("13 4\n")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
38 handle.write("14 5\n")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
39 handle.write("15 5\n")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
40 handle.write("16 5\n")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
41 handle.write("17 5\n")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
42 handle.write("18 5\n")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
43 handle.write("19 5\n")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
44 handle.write("20 5\n")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
45 handle.write("21 1\n")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
46 handle.write("21 1\n")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
47 handle.close()
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
48 wigProfile = GetWigProfile(0)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
49 wigProfile.strands = False
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
50 wigProfile.inputFileName = self.transcriptFileName
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
51 wigProfile.inputFormat = "gff3"
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
52 wigProfile.wig = self.wigFileName
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
53 wigProfile.nbPoints = 11
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
54 wigProfile.distance = 1
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
55 wigProfile.smoothenForce = None
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
56 wigProfile.log = False
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
57 wigProfile.outputFileName = self.outputFileName
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
58 wigProfile.readTranscripts()
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
59 wigProfile.smoothen()
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
60 wigProfile.plot()
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
61 self.assertTrue(os.path.exists(self.outputFileName))
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
62
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
63 if __name__ == "__main__":
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
64 unittest.main()
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
65