annotate SMART/bacteriaRegulatoryRegion_Detection/writeResToHTML.py @ 18:94ab73e8a190

Uploaded
author m-zytnicki
date Mon, 29 Apr 2013 03:20:15 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
1 #! /usr/bin/env python
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
2
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
3 import optparse, os, shutil
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
4 from optparse import OptionParser
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
5
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
6
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
7 def image(text, url):
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
8 return "<center>%s</center><img src='%s'>" % (text, url)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
9
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
10
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
11 def __main__():
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
12 description = "Write all results in one HTML file."
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
13 parser = OptionParser(description = description)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
14 parser.add_option("", "--input1Gff1", dest="input1Gff3_1", action="store", type="string", help="First gff3 result in the first analyse.(TRANS detection)")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
15 parser.add_option("", "--input1Gff2", dest="input1Gff3_2", action="store", type="string", help="Second gff3 result in the first analyse. (TRANS detection)")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
16 parser.add_option("", "--input1PNG1", dest="input1PNG1", action="store", type="string", help="PNG (getSize) result in the first analyse. (TRANS detection)")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
17 parser.add_option("", "--input1PNG2", dest="input1PNG2", action="store",type="string", help="PNG (plot) result in the first analyse. (TRANS detection)")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
18 parser.add_option("", "--input2Gff1", dest="input2Gff3_1", action="store", type="string", help="First gff3 result in the second analyse. (ANTISENSE detection)")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
19 parser.add_option("", "--input2Gff2", dest="input2Gff3_2", action="store", type="string", help="Second gff3 result in the second analyse. (ANTISENSE detection)")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
20 parser.add_option("", "--input2PNG1", dest="input2PNG1", action="store", type="string", help="PNG (getSize) result in the second analyse. (ANTISENSE detection)")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
21 parser.add_option("", "--input2PNG2", dest="input2PNG2", action="store", type="string", help="PNG (plot) result in the second analyse. (ANTISENSE detection)")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
22 parser.add_option("", "--input3Gff1", dest="input3Gff3_1", action="store", type="string", help="First gff3 result in the third analyse. (CIS detection)")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
23 parser.add_option("", "--input3Gff2", dest="input3Gff3_2", action="store", type="string", help="Second gff3 result in the third analyse. (CIS detection)")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
24 parser.add_option("", "--input3PNG1", dest="input3PNG1", action="store", type="string", help="PNG (getSize) result in the third analyse. (CIS detection)")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
25 parser.add_option("", "--input3PNG2", dest="input3PNG2", action="store", type="string", help="PNG (plot) result in the third analyse. (CIS detection)")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
26 parser.add_option("", "--outHTML", dest="outHTML", action="store", type="string", help="An HTML output.")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
27 parser.add_option("", "--outImgDir", dest="imgDir", action="store", type="string", help="Copy all result images into imgDir, for Galaxy option.")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
28 (options, args) = parser.parse_args()
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
29
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
30
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
31 if not os.path.exists(options.imgDir):
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
32 os.makedirs(options.imgDir)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
33
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
34 shutil.copy(options.input1PNG1, options.imgDir)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
35 shutil.copy(options.input1PNG2, options.imgDir)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
36 shutil.copy(options.input2PNG1, options.imgDir)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
37 shutil.copy(options.input2PNG2, options.imgDir)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
38 shutil.copy(options.input3PNG1, options.imgDir)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
39 shutil.copy(options.input3PNG2, options.imgDir)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
40
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
41
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
42 outfile=open(options.outHTML, "w")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
43 #print >>outfile, "<html><head><title>The results for ncRNAs detections.</title></head><body>"
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
44 print >>outfile, "<h1><center>The results for ncRNAs detections.</center></h1>"
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
45
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
46 #write results for the first analysis
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
47 print >>outfile, "<B><center><font color=red size=4>The results of intergenic sRNAs detection.(TRANS)</font></center></B>"
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
48 print >>outfile, "<center><strong>The results of comparison to already known ncRNA to validate some candidates.</strong></center><p>"
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
49 input1Gff1 = open(options.input1Gff3_1, "r")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
50 lines = input1Gff1.readlines()
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
51 input1Gff1.close()
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
52 for line in lines:
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
53 print >>outfile, "<font size=2><span style=line-height:3px>%s</span></font><p>" % line
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
54 print >>outfile, "<p>"
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
55 print >>outfile, "<center><strong>The results of comparison to already known ncRNA to see which ncRNAs are not detected.</strong></center><p>"
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
56 input1Gff2 = open(options.input1Gff3_2, "r")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
57 lines = input1Gff2.readlines()
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
58 input1Gff2.close()
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
59 for line in lines:
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
60 print >>outfile, "<font size=2><span style=line-height:3px>%s</span></font><p>" % line
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
61 print >>outfile, "<p>"
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
62 img_input1PNG1 = os.path.basename(options.input1PNG1)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
63 image1=image("<strong>Resulting image : get the candidates sizes distribution.</strong>", img_input1PNG1)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
64 print >>outfile, "%s" % image1
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
65 print >>outfile, "<p>"
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
66 img_input1PNG2 = os.path.basename(options.input1PNG2)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
67 image2=image("<strong>Resulting image : get the candidates sizes distribution.</strong>", img_input1PNG2)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
68 print >>outfile, "%s" % image2
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
69 print >>outfile, "<BR><p>"
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
70
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
71
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
72 #write results for the second analysis
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
73 print >>outfile, "<B><center><font color=red size=4>The results of asRNAs detection.(ANTISENSE)</font></center></B>"
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
74 print >>outfile, "<center><strong>The results of comparison to already known ncRNA to validate some candidates.</strong></center><p>"
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
75 input2Gff1 = open(options.input2Gff3_1, "r")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
76 lines = input2Gff1.readlines()
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
77 input2Gff1.close()
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
78 for line in lines:
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
79 print >>outfile, "<font size=2><span style=line-height:3px>%s</span></font><p>" % line
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
80 print >>outfile, "<p>"
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
81 print >>outfile, "<center><strong>The results of comparison to already known ncRNA to see which ncRNAs are not detected.</strong></center><p>"
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
82 input2Gff2 = open(options.input2Gff3_2, "r")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
83 lines = input2Gff2.readlines()
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
84 input2Gff2.close()
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
85 for line in lines:
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
86 print >>outfile, "<font size=2><span style=line-height:3px>%s</span></font><p>" % line
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
87 print >>outfile, "<p>"
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
88 img_input2PNG1 = os.path.basename(options.input2PNG1)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
89 image1=image("<strong>Resulting image : get the candidates sizes distribution.</strong>", img_input2PNG1)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
90 print >>outfile, "%s" % image1
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
91 print >>outfile, "<p>"
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
92 img_input2PNG2 = os.path.basename(options.input2PNG2)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
93 image2=image("<strong>Resulting image : get the candidates sizes distribution.</strong>", img_input2PNG2)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
94 print >>outfile, "%s" % image2
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
95 print >>outfile, "<BR><p>"
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
96
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
97
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
98 #write results for the third analysis
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
99 print >>outfile, "<B><center><font color=red size=4>The results of long 5'UTRs detection.(CIS)</font></center></B>"
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
100 print >>outfile, "<center><strong>The results of comparison to already known ncRNA to validate some candidates.</strong></center><p>"
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
101 input3Gff1 = open(options.input3Gff3_1, "r")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
102 lines = input3Gff1.readlines()
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
103 input3Gff1.close()
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
104 for line in lines:
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
105 print >>outfile, "<font size=2><span style=line-height:3px>%s</span></font><p>" % line
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
106 print >>outfile, "<p>"
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
107 print >>outfile, "<center><strong>The results of comparison to already known ncRNA to see which ncRNAs are not detected.</strong></center><p>"
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
108 input3Gff2 = open(options.input3Gff3_2, "r")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
109 lines = input3Gff2.readlines()
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
110 input3Gff2.close()
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
111 for line in lines:
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
112 print >>outfile, "<font size=2><span style=line-height:3px>%s</span></font><p>" % line
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
113 print >>outfile, "<p>"
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
114 img_input3PNG1 = os.path.basename(options.input3PNG1)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
115 image1=image("<strong>Resulting image : get the candidates sizes distribution.</strong>", img_input3PNG1)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
116 print >>outfile, "%s" % image1
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
117 print >>outfile, "<p>"
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
118 img_input3PNG2 = os.path.basename(options.input3PNG2)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
119 image2=image("<strong>Resulting image : get the candidates sizes distribution.</strong>", img_input3PNG2)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
120 print >>outfile, "%s" % image2
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
121 print >>outfile, "<BR><p>"
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
122
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
123
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
124 if __name__=="__main__": __main__()