Mercurial > repos > mzeidler > virana_main
comparison vhom_regionplot.py @ 13:ec82deba3cef draft
Uploaded
| author | mzeidler |
|---|---|
| date | Sun, 29 Sep 2013 19:21:01 -0400 |
| parents | f63d639b223c |
| children | 943da5b73b2b |
comparison
equal
deleted
inserted
replaced
| 12:af2085ce7001 | 13:ec82deba3cef |
|---|---|
| 80 ax.yaxis.tick_right() | 80 ax.yaxis.tick_right() |
| 81 | 81 |
| 82 | 82 |
| 83 def generateHTML(stat_dict,file,directory): | 83 def generateHTML(stat_dict,file,directory): |
| 84 rval=["<html><head><title>Homologous groups and regions derived from hit files </title></head><body><p/>\n"] | 84 rval=["<html><head><title>Homologous groups and regions derived from hit files </title></head><body><p/>\n"] |
| 85 rval.append('<link rel="stylesheet" type="text/css" href="/static/style/base.css">') | |
| 85 rval.append("<a href='plot.pdf'>Download Plot</a>") | 86 rval.append("<a href='plot.pdf'>Download Plot</a>") |
| 87 #sven create <div> here for some text | |
| 86 n_samples=0 | 88 n_samples=0 |
| 87 for sample in stat_dict.iterkeys(): | 89 for sample in stat_dict.iterkeys(): |
| 88 n_samples+=1 | 90 n_samples+=1 |
| 89 rval.append("<div id=%s_graph></div><p/>"%(sample)) | 91 rval.append("<div id=%s_graph></div><p/>"%(sample)) |
| 90 curr_dir = os.path.dirname(os.path.realpath(__file__)) | 92 curr_dir = os.path.dirname(os.path.realpath(__file__)) |
| 91 shutil.copy(os.path.join(curr_dir,"jquery-1.10.2.min.js"),directory) | 93 shutil.copy(os.path.join(curr_dir,"jquery-1.10.2.min.js"),directory) |
| 92 shutil.copy(os.path.join(curr_dir,"jqBarGraph.2.1.min.js"),directory) | 94 shutil.copy(os.path.join(curr_dir,"jqBarGraph.2.1.js"),directory) |
| 93 rval.append("<script type='text/javascript' src='jquery-1.10.2.min.js'></script>") | 95 rval.append("<script type='text/javascript' src='jquery-1.10.2.min.js'></script>") |
| 94 rval.append("<script type='text/javascript' src='jqBarGraph.2.1.min.js'></script>") | 96 rval.append("<script type='text/javascript' src='jqBarGraph.2.1.js'></script>") |
| 95 rval.append('<script>') | 97 rval.append('<script>') |
| 96 i=0 | 98 i=0 |
| 97 for sample in stat_dict.iterkeys(): | 99 for sample in stat_dict.iterkeys(): |
| 98 i+=1 | 100 i+=1 |
| 99 rval.append("%s_array = new Array(" %sample) | 101 rval.append("%s_array = new Array(" %sample) |
| 114 rval.append("legend: true,") | 116 rval.append("legend: true,") |
| 115 rval.append("tab: 'reads',") | 117 rval.append("tab: 'reads',") |
| 116 rval.append("title: '<H3>Visualisation of Sample %s</H3>',"%sample) | 118 rval.append("title: '<H3>Visualisation of Sample %s</H3>',"%sample) |
| 117 rval.append("width: %d"%((len(stat_dict[sample])*50)+150)) | 119 rval.append("width: %d"%((len(stat_dict[sample])*50)+150)) |
| 118 rval.append("});") | 120 rval.append("});") |
| 119 # rval.append("jQuery.get('test.py', function(data) {") | 121 |
| 120 # rval.append("alert(data)") | |
| 121 # rval.append("})") | |
| 122 rval.append("</script>") | 122 rval.append("</script>") |
| 123 | 123 |
| 124 rval.append( '</body></html>' ) | 124 rval.append( '</body></html>' ) |
| 125 with open(file,'w') as file: | 125 with open(file,'w') as file: |
| 126 file.write("\n".join( rval )) | 126 file.write("\n".join( rval )) |
