Commit 33fcaf67 authored by Claire Kuchly's avatar Claire Kuchly
Browse files

maj new version

parent 65fb65a6
......@@ -27,16 +27,119 @@
*/
$(function () {
/*
* Define functions in charge to visualize venn charts
*/
$(".length-view-btn").click(function() {
if ($(":checked[id^=chk_sample_]").size() == 1) {
var profile_path = $("#length_" + $(":checked[id^=chk_sample_]").attr("id").split("_")[2]).val();
$("#modal-label-tmpl").html("NG6 <small> " + $("#analyse_name").val() + "</small>");
$("#modal-body-tmpl").html('<div id="img_container"><img src="' + profile_path + '" alt="Cannot display"></div>');
var nb_step = 30;
if ($(":checked[id^=chk_sample_]").size() > 0) {
//Set dialog window
$("#modal-label-tmpl").html("NG6 <small> " + $("#analyse_name").val() + "</small>");
$("#modal-body-tmpl").html('<div id="highcharts_container"></div>');
$("#modal-foot-tmpl").html('<button class="btn" data-dismiss="modal" aria-hidden="true"><i class="icon-remove"></i> Close</button>');
$("#ng6modal").css('width', '750px');
$("#ng6modal").css('margin-left', '-375px');
$("#ng6modal").modal();
$("#highcharts_container").css('width', '845px');
$("#ng6modal").css('width', 'auto');
$("#ng6modal").css('margin-left', '-435px');
//Set graph
var min = 1000000,
max = 0;
$(":checked[id^=chk_sample_]").each(function(){
var index = $(this).attr("id").split("_")[2];
var val_array = $("#size"+index).val().split(",");
var tmax = Math.max.apply( Math, val_array),
tmin = Math.min.apply( Math, val_array);
if (min > tmin) { min = tmin; }
if (max < tmax) { max = tmax; }
});
var step_size = Math.ceil((max-min)/nb_step);
var x_labels = new Array();
for( var i=min ; i<=max ; i += step_size ) {
x_labels.push( String(i) + "-" + String(i + step_size -1) );
}
var y_table = new Array();
$(":checked[id^=chk_sample_]").each(function(){
var index = $(this).attr("id").split("_")[2];
var index_array = $("#size"+index).val().split(",") ;
var value_array = $("#nb_size"+index).val().split(",") ;
// Init values
var y_values = new Array();
for (var i=0; i<x_labels.length; i++) {
y_values.push(0);
}
// For each step
for( var i=0 ; i<x_labels.length ; i++ ) {
for( var j=0 ; j<index_array.length ; j++ ) {
if( parseInt(index_array[j]) >= (min + (i*step_size))
&& parseInt(index_array[j]) < (min + (i*step_size) + step_size) ) {
y_values[i] += parseInt(value_array[j]);
}
}
}
y_table.push({
name: $("#sample_id_"+index).html(),
data: y_values
});
});
chart = new Highcharts.Chart({
chart: {
renderTo: 'highcharts_container',
defaultSeriesType: 'line'
},
title: {
text: "Distribution of sequence lengths over all sequences.",
x: -20 //center
},
xAxis: {
categories: x_labels,
title: {
text: "Sequence length (bp)"
},
labels: {
rotation: -45,
align: 'right'
}
},
yAxis: {
title: {
text: "Number of sequences"
},
min: 0,
plotLines: [{
value: 0,
width: 1,
color: '#808080'
}]
},
tooltip: {
formatter: function() {
return '<b>'+ this.series.name +'</b><br/>'+
this.x +'bp : '+ this.y +'sequences';
}
},
credits: { enabled: false },
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'top',
x: -10,
y: 100,
borderWidth: 0
},
series: y_table
});
//Display
$("#ng6modal").modal();
}
});
......
......@@ -17,66 +17,75 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
{extends file='AnalysisTemplate.tpl'}
{block name=params_title} Cleaning options {/block}
{block name=params_content}
{assign var="params" value=" "|explode:$analyse.params}
{assign var="error_index" value=$params|@array_keys:"-e"}
{assign var="min_index" value=$params|@array_keys:"-m"}
{assign var="max_index" value=$params|@array_keys:"-M"}
{assign var="adaptor_index" value=$params|@array_keys:"-a"}
{
{block name=params}
{assign var="form_params" value=";"|explode:$analyse.params}
<ul>
<li class="parameter">Maximum allowed error rate of {$params[$error_index[0]+1]}.</li>
<li class="parameter">Discard trimmed reads with a length not in between [{$params[$min_index[0]+1]}pb; {$params[$max_index[0]+1]}pb].</li>
<li class="parameter">Sequence of an adapter that was ligated {$params[$adaptor_index[0]+1]}.</li>
{foreach from=$analyse_results key=sample item=sample_results}
{assign var="sample" value=$sample}
{/foreach}
{foreach from=$form_params item=params_line}
<li class="parameter">{$params_line}</li>
{/foreach}
</ul>
{/block}
{block name=results_title} Cleaning results {/block}
{block name=results_title} Assembly results {/block}
{block name=results}
<table class="table table-striped table-bordered dataTable analysis-result-table">
<thead>
<tr>
<th><center><input type="checkbox" id="chk_all_sample"></center></th>
<th rowspan="2"><center><input type="checkbox" id="chk_all_sample"></center></th>
{if $analyse_results|@count > 1 }
<th class = "string-sort">Samples ({$analyse_results|@count})</th>
<th class="string-sort">Samples ({$analyse_results|@count})</th>
{/if}
<th class = "numeric-sort">Before cleaning</th>
<th class = "numeric-sort">After cleaning</th>
<th class = "numeric-sort">Too short</th>
<th class = "numeric-sort">Too long</th>
<th class = "numeric-sort">% deleted</th>
<th class="numeric-sort">Processed reads</th>
<th class="numeric-sort">Processed base</th>
<th class="numeric-sort">Trimmed reads</th>
<th class="numeric-sort">Trimmed bases</th>
<th class="numeric-sort">Too short reads</th>
<th class="numeric-sort">Final reads</th>
</tr>
</thead>
<tbody>
{assign var="i" value=0}
{assign var="totale" value=0}
{assign var="total1" value=0}
{assign var="prct_extend_total" value=0}
{assign var="analyse_results_sorted" value=$analyse_results|@ksort}
{foreach from=$analyse_results_sorted key=sample item=sample_results}
{$sample_name=$sample}
{assign var="i" value=0}
<tr>
<td><center>
<tr>
<td><center>
<input type="checkbox" id="chk_sample_{$i}" value="sample">
</center></td>
<input type="hidden" id="size{$i}" value="{$sample_results["default"].size}"/>
<input type="hidden" id="nb_size{$i}" value="{$sample_results["default"].nb_size}"/>
</center></td>
{if $analyse_results|@count > 1 }
<td>{$sample|get_description:$descriptions}</td>
<td id="sample_id_{$i}">{$sample|get_description:$descriptions}</td>
{/if}
<td>{$sample_results["default"].processed_reads|number_format:0:' ':' '}</td>
<td>{($sample_results["default"].processed_reads-$sample_results["default"].total_too_short-$sample_results["default"].total_too_long)|number_format:0:' ':' '}</td>
<td>{$sample_results["default"].total_too_short|number_format:0:' ':' '}</td>
<td>{$sample_results["default"].total_too_long|number_format:0:' ':' '}</td>
<td>{(100.00-((($sample_results["default"].processed_reads-$sample_results["default"].total_too_short-$sample_results["default"].total_too_long)*100)/$sample_results["default"].processed_reads))|number_format:2:'.':' '}</td>
<input type="hidden" id="length_{$i}" value="{$sample_results["default"].len}" />
</tr>
{/foreach}
<td>{$sample_results["default"].processedread|number_format:0:' ':' '}</td>
{$totale=$totale+$sample_results["default"].processedread}
<td>{$sample_results["default"].processedbase|number_format:0:' ':' '}</td>
{assign var="prct_trimmed" value=0}
{$prct_trimmed=($sample_results["default"].trimmedread/($sample_results["default"].processedread))*100}
<td>{$sample_results["default"].trimmedread|number_format:0:' ':' '} ({round($prct_trimmed,2)}%)</td>
{$total1=$total1+$sample_results["default"].trimmedread}
{assign var="prct_bases_trimmed" value=0}
{$prct_bases_trimmed=($sample_results["default"].trimmedbase/($sample_results["default"].processedbase))*100}
<td>{$sample_results["default"].trimmedbase|number_format:0:' ':' '} ({round($prct_bases_trimmed,2)}%)</td>
<td>{$sample_results["default"].shortread|number_format:0:' ':' '}</td>
<td>{$sample_results["default"].final_read|number_format:0:' ':' '}</td>
{$i = $i +1}
</tr>
{/foreach}
</tbody>
<tfoot>
<tr>
{if $analyse_results|@count > 1 }
<th align="left" colspan="7">
{else}
<th align="left" colspan="6">
{/if}
<th align="left" colspan="{if $analyse_results|@count > 1 }8{else}7{/if}">
With selection :
<button type="button" class="btn length-view-btn single-selection-btn"><i class="icon-signal"></i> Length</button>
<button type="button" class="btn multiple-selection-btn length-view-btn"><i class=" icon-signal"></i> Length distribution</button>
</th>
</tr>
</tfoot>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment