Skip to content
This repository was archived by the owner on Jan 8, 2024. It is now read-only.

Commit 26bd1a7

Browse files
committed
Fixed bug #38. Code unprotected
1 parent 508f79c commit 26bd1a7

File tree

2 files changed

+98
-98
lines changed

2 files changed

+98
-98
lines changed

templates/iSkyLIMS_wetlab/StatsPerResearcher.html

+36-36
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
{% load static %}
33
{% block content %}
44
{% csrf_token %}
5-
<script type="text/javascript" src="{% static "iSkyLIMS_wetlab/js/fusioncharts/js/fusioncharts.widgets.js" %}"></script>
6-
<script type="text/javascript" src="{% static "iSkyLIMS_wetlab/js/fusioncharts/js/fusioncharts.js" %}"></script>
7-
<script type="text/javascript" src="{% static "iSkyLIMS_wetlab/js/fusioncharts/js/themes/fusioncharts.theme.fint.js" %}"></script>
8-
<script type="text/javascript" src="{% static "iSkyLIMS_wetlab/js/fusioncharts/js/themes/fusioncharts.theme.ocean.js" %}"></script>
9-
<script type="text/javascript" src="{% static "iSkyLIMS_wetlab/js/fusioncharts/js/themes/fusioncharts.theme.carbon.js" %}"></script>
5+
<script type="text/javascript" src="{% static "iSkyLIMS_wetlab/js/fusioncharts/js/fusioncharts.widgets.js" %}"></script>
6+
<script type="text/javascript" src="{% static "iSkyLIMS_wetlab/js/fusioncharts/js/fusioncharts.js" %}"></script>
7+
<script type="text/javascript" src="{% static "iSkyLIMS_wetlab/js/fusioncharts/js/themes/fusioncharts.theme.fint.js" %}"></script>
8+
<script type="text/javascript" src="{% static "iSkyLIMS_wetlab/js/fusioncharts/js/themes/fusioncharts.theme.ocean.js" %}"></script>
9+
<script type="text/javascript" src="{% static "iSkyLIMS_wetlab/js/fusioncharts/js/themes/fusioncharts.theme.carbon.js" %}"></script>
1010
<script type="text/javascript" src="{% static "iSkyLIMS_wetlab/js/fusioncharts/js/themes/fusioncharts.theme.zune.js" %}"></script>
11-
<script type="text/javascript" src="{% static "iSkyLIMS_wetlab/js/wetlab.js" %}"></script>
11+
<script type="text/javascript" src="{% static "iSkyLIMS_wetlab/js/wetlab.js" %}"></script>
1212

1313
{% if researcher_statistics %}
1414
<div class="row row-space-2 margin-b-4">
@@ -48,12 +48,12 @@ <h3> Projects using the sequencer {{sequencer_name }} : </h3>
4848
</div> <!--// end panel -->
4949
</div> <!--// end col-sm-12 -->
5050
</div> <!--// end row -->
51-
51+
5252
<div class="row row-space-2 margin-b-4">
5353
<div class="col-sm-12" >
5454
<div class="panel panel-default">
5555
<div class="panel-heading"><h3><center>Graphic Statistics for Investigator {{researcher_statistics.researcher_name}} </center></h3></div>
56-
<div class="panel-body">
56+
<div class="panel-body">
5757
{% for seq_researcher_graph in researcher_statistics.researcher_graph %}
5858
{% for id_graph, chart in seq_researcher_graph %}
5959
<div class="col-sm-6" >
@@ -67,35 +67,35 @@ <h3> Projects using the sequencer {{sequencer_name }} : </h3>
6767
</div> <!--// end panel -->
6868
</div> <!--// end col-sm-8 -->
6969
</div> <!--// end row -->
70-
71-
72-
7370

74-
<div class="row row-space-2 margin-b-4">
75-
<div class="col-sm-12" >
76-
<div class="panel panel-default">
77-
<div class="panel-heading"><h3><center> {{researcher_statistics.researcher_name}} projects comparison </center></h3></div>
78-
<div class="panel-body">
79-
<!-- comparations chart starts here-->
80-
{% for seq_comp_graph in researcher_statistics.comp_graphs %}
81-
{% for id_graph, chart in seq_comp_graph %}
82-
<div class="col-sm-6" >
83-
<!-- Showing graph-->
84-
<div id="{{id_graph}}"> </div>
85-
{{ chart|safe }}
86-
</div> <!--// end col-sm-6 -->
87-
{% endfor %}
88-
{% endfor %}
89-
</div> <!-- end of panel body -->
90-
</div> <!--// end panel -->
91-
</div> <!--// end col-sm-8 -->
92-
</div> <!--// end row -->
9371

72+
73+
{{% if researcher_statistics.comp_graphs %}}
74+
<div class="row row-space-2 margin-b-4">
75+
<div class="col-sm-12" >
76+
<div class="panel panel-default">
77+
<div class="panel-heading"><h3><center> {{researcher_statistics.researcher_name}} projects comparison </center></h3></div>
78+
<div class="panel-body">
79+
<!-- comparations chart starts here-->
80+
{% for seq_comp_graph in researcher_statistics.comp_graphs %}
81+
{% for id_graph, chart in seq_comp_graph %}
82+
<div class="col-sm-6" >
83+
<!-- Showing graph-->
84+
<div id="{{id_graph}}"> </div>
85+
{{ chart|safe }}
86+
</div> <!--// end col-sm-6 -->
87+
{% endfor %}
88+
{% endfor %}
89+
</div> <!-- end of panel body -->
90+
</div> <!--// end panel -->
91+
</div> <!--// end col-sm-8 -->
92+
</div> <!--// end row -->
93+
{{% endif %}}
9494
<div class="row row-space-2 margin-b-4">
9595
<div class="col-sm-8" >
9696
<div class="panel panel-default">
9797
<div class="panel-heading"><h3><center>Statistics Sequencer utilization for {{researcher_statistics.researcher_name}} </center></h3></div>
98-
<div class="panel-body">
98+
<div class="panel-body">
9999
<!-- Sequencer pie Chart starts here-->
100100
<div id="sequencer_pie_chart"> </div>
101101
{{ researcher_statistics.sequencer_pie_graph |safe }}
@@ -116,15 +116,15 @@ <h3> Projects using the sequencer {{sequencer_name }} : </h3>
116116
<form method="post" enctype="multipart/form-data" name="statsresearcher" id="statsresearcher" class="form-horizontal well">
117117
{% csrf_token %}
118118
<input type="hidden" name="action" value="researcher"/>
119-
<div class="form-group required">
119+
<div class="form-group required">
120120
<label class="col-sm-5 control-label" for="researchername" >Fill the Investigator name </label>
121121
{% if request.user|has_group:"WetlabManager" %}
122122
<div class="col-sm-5"><input class="form-control" type="text" required = "required" name="researchername" id="reserchername" size="100" maxlength="100"></div>
123123
{% else %}
124124
<div class="col-sm-5"><input class="form-control" type="text" name="researchername" id="reserchername" value="{{user.get_username}}" size="100" maxlength="100" placeholder="{{user.get_username}}" readonly></div>
125125
{% endif %}
126126
</div> <!-- end from-group -->
127-
127+
128128
<br>
129129

130130
<div class="form-group">
@@ -136,7 +136,7 @@ <h3> Projects using the sequencer {{sequencer_name }} : </h3>
136136
<label class="col-sm-5 control-label" for="enddate" >End Date Search (DD-MM-YYYY)</label>
137137
<div class="col-sm-5"><input class="form-control" type="date" name="enddate" value="" id="enddate"></div>
138138
<br>
139-
139+
140140
</div> <!-- end from-group -->
141141
<input class="btn pull-left btn-primary" type="reset" value="Reset Fields">
142142
<input class="btn pull-right btn-primary" type="submit" value="Submit">
@@ -145,7 +145,7 @@ <h3> Projects using the sequencer {{sequencer_name }} : </h3>
145145
</div> <!-- end of panel body -->
146146
</div> <!--// end panel -->
147147
</div> <!--// end col-sm-7 -->
148-
148+
149149
<!-- Insert the help panel -->
150150
<BR><BR>
151151
<div class="col-sm-3 col-sm-offset-1">
@@ -159,7 +159,7 @@ <h3> Projects using the sequencer {{sequencer_name }} : </h3>
159159
</div> <!--// end panel -->
160160
<!-- Insert the Help window when clicking on the button -->
161161
{% include 'iSkyLIMS_wetlab/search-researcher-help.html' %}
162-
162+
163163
</div> <!--// end row -->
164164
<!-- End of FORM for searching RUN information -->
165165
{% endif %}

views.py

+62-62
Original file line numberDiff line numberDiff line change
@@ -1719,68 +1719,68 @@ def stats_per_researcher (request):
17191719
else:
17201720
total_lanes_summary[sequencer] = ''
17211721

1722-
1723-
comp_graphs, comp_seq_graphs = [] , []
1724-
for sequencer in projects_name_dict.keys() :
1725-
for lane_summary in total_lanes_summary[sequencer] :
1726-
q_30_value, mean_q_value , yield_mb_value , cluster_pf_value = lane_summary.get_stats_info().split(';')
1727-
total_q_30_list.append(float(q_30_value))
1728-
total_mean_q_list.append(float(mean_q_value))
1729-
total_yield_mb_list.append(int(yield_mb_value.replace(',','')))
1730-
total_cluster_pf_list.append(int(cluster_pf_value.replace(',','')))
1731-
comp_q30_dict[sequencer]['Other investigators']= format(statistics.mean(total_q_30_list), '.2f')
1732-
comp_mean_q_dict[sequencer]['Other investigators'] = format(statistics.mean(total_mean_q_list), '.2f')
1733-
comp_yield_mb_dict[sequencer]['Other investigators'] = sum(total_yield_mb_list)
1734-
comp_cluster_pf_dict[sequencer]['Other investigators'] = sum(total_cluster_pf_list)
1735-
# create the graphic for q30 quality
1736-
1737-
theme = ''
1738-
heading = 'Comparation graphics for Q > 30 for investigator ' + r_name
1739-
sub_caption = ''
1740-
x_axis_name = r_name + ' versus other investigators'
1741-
y_axis_name = 'Q 30 (in %)'
1742-
1743-
data_source = column_graphic_simple (heading, sub_caption, x_axis_name, y_axis_name, theme, comp_q30_dict[sequencer])
1744-
seq_chart = sequencer + 'comparation_q30_chart'
1745-
seq_graph = sequencer + 'comparation_q30_graph'
1746-
comp_q30_seq_graph = FusionCharts("column3d", seq_graph , "500", "350",seq_chart , "json", data_source).render()
1747-
comp_seq_graphs.append([seq_chart, comp_q30_seq_graph])
1748-
1749-
theme = ''
1750-
heading = 'Comparation graphics for Mean Quality for investigator ' + r_name
1751-
sub_caption = ''
1752-
x_axis_name = r_name + ' versus other investigators'
1753-
y_axis_name = 'Mean Quality'
1754-
data_source = column_graphic_simple (heading, sub_caption, x_axis_name, y_axis_name, theme, comp_mean_q_dict[sequencer])
1755-
seq_chart = sequencer + 'comparation_mean_q_chart'
1756-
seq_graph = sequencer + 'comparation_mean_q_graph'
1757-
comp_mean_q_seq_graph = FusionCharts("column3d", seq_graph , "500", "350",seq_chart , "json", data_source).render()
1758-
comp_seq_graphs.append([seq_chart, comp_mean_q_seq_graph])
1759-
1760-
theme = ''
1761-
heading = 'Comparation graphics for Yield (Mb) for investigator ' + r_name
1762-
sub_caption = ''
1763-
x_axis_name = r_name + ' versus other investigators'
1764-
y_axis_name = '(Mb)'
1765-
data_source = column_graphic_simple (heading, sub_caption, x_axis_name, y_axis_name, theme, comp_yield_mb_dict[sequencer])
1766-
seq_chart = sequencer + 'comparation_yield_mb_chart'
1767-
seq_graph = sequencer + 'comparation_yield_mb_graph'
1768-
comp_yield_mb_seq_graph = FusionCharts("column3d", seq_graph , "500", "350",seq_chart , "json", data_source).render()
1769-
comp_seq_graphs.append([seq_chart, comp_yield_mb_seq_graph])
1770-
1771-
theme = ''
1772-
heading = 'Comparation graphics for Cluster PF for investigator ' + r_name
1773-
sub_caption = ''
1774-
x_axis_name = r_name + ' versus other investigators'
1775-
y_axis_name = 'Cluster pf'
1776-
data_source = column_graphic_simple (heading, sub_caption, x_axis_name, y_axis_name, theme, comp_cluster_pf_dict[sequencer])
1777-
seq_chart = sequencer + 'comparation_cluster_pf_chart'
1778-
seq_graph = sequencer + 'comparation_cluster_pf_graph'
1779-
comp_cluster_pf_seq_graph = FusionCharts("column3d", seq_graph , "500", "350",seq_chart , "json", data_source).render()
1780-
comp_seq_graphs.append([seq_chart, comp_cluster_pf_seq_graph])
1781-
comp_graphs.append(comp_seq_graphs)
1782-
1783-
researcher_statistics ['comp_graphs'] = comp_graphs
1722+
if len(total_lanes_summary) > 0:
1723+
comp_graphs, comp_seq_graphs = [] , []
1724+
for sequencer in projects_name_dict.keys() :
1725+
for lane_summary in total_lanes_summary[sequencer] :
1726+
q_30_value, mean_q_value , yield_mb_value , cluster_pf_value = lane_summary.get_stats_info().split(';')
1727+
total_q_30_list.append(float(q_30_value))
1728+
total_mean_q_list.append(float(mean_q_value))
1729+
total_yield_mb_list.append(int(yield_mb_value.replace(',','')))
1730+
total_cluster_pf_list.append(int(cluster_pf_value.replace(',','')))
1731+
comp_q30_dict[sequencer]['Other investigators']= format(statistics.mean(total_q_30_list), '.2f')
1732+
comp_mean_q_dict[sequencer]['Other investigators'] = format(statistics.mean(total_mean_q_list), '.2f')
1733+
comp_yield_mb_dict[sequencer]['Other investigators'] = sum(total_yield_mb_list)
1734+
comp_cluster_pf_dict[sequencer]['Other investigators'] = sum(total_cluster_pf_list)
1735+
# create the graphic for q30 quality
1736+
1737+
theme = ''
1738+
heading = 'Comparation graphics for Q > 30 for investigator ' + r_name
1739+
sub_caption = ''
1740+
x_axis_name = r_name + ' versus other investigators'
1741+
y_axis_name = 'Q 30 (in %)'
1742+
1743+
data_source = column_graphic_simple (heading, sub_caption, x_axis_name, y_axis_name, theme, comp_q30_dict[sequencer])
1744+
seq_chart = sequencer + 'comparation_q30_chart'
1745+
seq_graph = sequencer + 'comparation_q30_graph'
1746+
comp_q30_seq_graph = FusionCharts("column3d", seq_graph , "500", "350",seq_chart , "json", data_source).render()
1747+
comp_seq_graphs.append([seq_chart, comp_q30_seq_graph])
1748+
1749+
theme = ''
1750+
heading = 'Comparation graphics for Mean Quality for investigator ' + r_name
1751+
sub_caption = ''
1752+
x_axis_name = r_name + ' versus other investigators'
1753+
y_axis_name = 'Mean Quality'
1754+
data_source = column_graphic_simple (heading, sub_caption, x_axis_name, y_axis_name, theme, comp_mean_q_dict[sequencer])
1755+
seq_chart = sequencer + 'comparation_mean_q_chart'
1756+
seq_graph = sequencer + 'comparation_mean_q_graph'
1757+
comp_mean_q_seq_graph = FusionCharts("column3d", seq_graph , "500", "350",seq_chart , "json", data_source).render()
1758+
comp_seq_graphs.append([seq_chart, comp_mean_q_seq_graph])
1759+
1760+
theme = ''
1761+
heading = 'Comparation graphics for Yield (Mb) for investigator ' + r_name
1762+
sub_caption = ''
1763+
x_axis_name = r_name + ' versus other investigators'
1764+
y_axis_name = '(Mb)'
1765+
data_source = column_graphic_simple (heading, sub_caption, x_axis_name, y_axis_name, theme, comp_yield_mb_dict[sequencer])
1766+
seq_chart = sequencer + 'comparation_yield_mb_chart'
1767+
seq_graph = sequencer + 'comparation_yield_mb_graph'
1768+
comp_yield_mb_seq_graph = FusionCharts("column3d", seq_graph , "500", "350",seq_chart , "json", data_source).render()
1769+
comp_seq_graphs.append([seq_chart, comp_yield_mb_seq_graph])
1770+
1771+
theme = ''
1772+
heading = 'Comparation graphics for Cluster PF for investigator ' + r_name
1773+
sub_caption = ''
1774+
x_axis_name = r_name + ' versus other investigators'
1775+
y_axis_name = 'Cluster pf'
1776+
data_source = column_graphic_simple (heading, sub_caption, x_axis_name, y_axis_name, theme, comp_cluster_pf_dict[sequencer])
1777+
seq_chart = sequencer + 'comparation_cluster_pf_chart'
1778+
seq_graph = sequencer + 'comparation_cluster_pf_graph'
1779+
comp_cluster_pf_seq_graph = FusionCharts("column3d", seq_graph , "500", "350",seq_chart , "json", data_source).render()
1780+
comp_seq_graphs.append([seq_chart, comp_cluster_pf_seq_graph])
1781+
comp_graphs.append(comp_seq_graphs)
1782+
1783+
researcher_statistics ['comp_graphs'] = comp_graphs
17841784

17851785
# Sequencer graphic utilization
17861786
sequencer_used = {}

0 commit comments

Comments
 (0)