Commit e9019e29 authored by Penom Nom's avatar Penom Nom
Browse files

rs_subreads template update

parent a7934584
/***************************************************************
* Copyright notice
*
* (c) 2015 PF bioinformatique de Toulouse <>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
$(function () {
var udateTableStatus = function($elmt){
var table = $("#rs_subreads_datatable").DataTable();
var column = table.column($elmt.attr('data-column')) ;
column.visible($elmt[0].checked );
};
$('#rs_subreads_datatable').on( 'draw.dt', function () {
$(':checkbox.toogle-vis').each(function(e){
udateTableStatus($(this));
});
});
$(':checkbox.toogle-vis').change(function(e) {
udateTableStatus($(this));
});
$(':checkbox#view_all_metrics').change(function(e) {
var state = $(this)[0].checked;
$(':checkbox.toogle-vis').each(function(e){
$(this).prop('checked', state);
$(this).change();
});
});
/*Check all metrics*/
$('#check_all_metrics').click(function(){
var state = this.checked;
$("[id^='chk_col_']").each(function(){
this.checked = state;
});
});
/* Opens a window with all the element in the selected column */
$("#columns_extract").click(function() {
var samples = new Array() ;
$("input[id^='chk_sample_']:checked").each( function() {
samples.push( parseInt($(this).attr("id").split('_')[2]) ) ;
}) ;
var columns = new Array() ;
$("input[id^='chk_col_']:checked").each( function() {
columns.push( parseInt($(this).attr("id").split('_')[2]) ) ;
}) ;
if( samples.length != 0 ) {
if( $('#sample_1_col_1') !== 'undefined' ) {
columns.push( 1 ) ;
}
columns.sort(function(a,b){return a-b}) ;
samples.sort(function(a,b){return a-b}) ;
//Build thead
var thead = '<tr>' ;
for ( var int = 0; int < columns.length; int++) {
var id = columns[int];
if( jQuery.inArray( id, columns) != -1 && id == 1 ) {
thead += '<th>Samples</th>' ;
}
else {
thead += '<th><center>'+$("#th_id_"+id).text()+'</center></th>' ;
}
}
thead += '</tr>' ;
thead = '<thead>' + thead + '</thead>' ;
//Build tbody
var tbody = "" ;
var pattern_regexp = new RegExp( '<a[^>]+class="[^"]*imglink[^"]*"[^>]+href="(fileadmin\/data\/analyze\/[^"]+)' ) ;
for( var i = 0 ; i < samples.length ; i++ ) {
tbody += '<tr>' ;
for( var j = 0 ; j < columns.length ; j++ ) {
var new_html = $('#sample_' + samples[i] + '_col_' + columns[j]).html() ;
var inner_exp = pattern_regexp.exec( new_html ) ;
// If the cell match the pattern
if( inner_exp != null )
{
if( inner_exp[1] === undefined ) {
inner_exp[1] = "" ;
}
new_html = '<img src="' + inner_exp[1] + '" onload="resize(this, 0.5)">' ;
}
tbody += '<td>' + new_html + '</td>' ;
}
tbody += '</tr>' ;
}
tbody = '<tbody>' + tbody + '</tbody>' ;
// Display images table
$("#modal-label-tmpl").html("NG6 <small> " + $("#analyse_name").val() + "</small>");
$("#modal-body-tmpl").html('<div id="table_container"></div>');
$("#modal-foot-tmpl").html('<button class="btn btn-default" data-dismiss="modal" aria-hidden="true"><i class="glyphicon glyphicon-remove"></i> Close</button>');
$("#table_container ").css({
'max-height' : modal_height(300, 50)+'px',
'overflow-x' : 'auto',
'overflow-y' : 'auto'
});
$("#ng6modal .modal-content").css('width', '870px');
$("#ng6modal").css('margin-left', '-135px');
$("#table_container").append( '<table class="table table-striped table-bordered ">' + thead + tbody + '</table>' );
$("#ng6modal").modal();
}
}) ;
});
......@@ -38,133 +38,311 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
{assign var='subreads_headers' value=','|explode:$metrics['subreads_stats'].headers|@ksort}
{assign var='subreads_stats_count' value=$subreads_headers|@count}
<table class="table table-striped table-bordered dataTable analysis-result-table">
<thead>
<tr>
<th rowspan="2"><center><input type="checkbox" id="chk_all_sample"/></center></th>
{assign var="nb_samples" value=$analyse_results|@count - 1 }
<th class="string-sort" rowspan="2" id="th_id_1"><center>SMRT Cell ID {if $nb_samples > 1 }({$nb_samples}){/if}</center></th>
<div>
<legend>Select the metrics that will be displayed</legend>
<div class="checkbox">
<label>
<input id="view_all_metrics" type="checkbox"/> View all metrics
</label>
</div>
{assign var='data_col' value=2}
<div class="row">
{if $metrics['loading']}
<div class="col-md-2 col-lg-2">
<h4>Loading report</h4>
<ul class="list-unstyled">
{foreach from=$loading_headers key=k item=head}
<li>
<div class="checkbox">
<label>
<input type="checkbox" data-column="{$data_col}" class="toogle-vis"/> {$head}
</label>
</div>
</li>
{$data_col = $data_col + 1}
{/foreach}
</ul>
</div>
{/if}
{if $metrics['adapter_stats']}
<div class="col-md-2 col-lg-2">
<h4>Adapter stats</h4>
<ul class="list-unstyled">
{foreach from=$adapter_headers key=k item=head}
<li>
<div class="checkbox">
<label>
<input type="checkbox" data-column="{$data_col}" class="toogle-vis"/> {$head}
</label>
</div>
</li>
{$data_col = $data_col + 1}
{/foreach}
</ul>
</div>
{/if}
{if $metrics['prefilter_stats']}
<div class="col-md-3 col-lg-3">
<h4>Polymerase reads prefilter Stats</h4>
<ul class="list-unstyled">
{foreach from=$prefilter_headers key=k item=head}
<li>
<div class="checkbox">
<label>
<input type="checkbox" data-column="{$data_col}" class="toogle-vis"/> {$head}
</label>
</div>
</li>
{$data_col = $data_col + 1}
{/foreach}
</ul>
</div>
{/if}
{if $metrics['postfilter_stats']}
<div class="col-md-3 col-lg-3">
<h4>Polymerase reads postfilter Stats</h4>
<ul class="list-unstyled">
{foreach from=$postfilter_headers key=k item=head}
<li>
<div class="checkbox">
<label>
<input type="checkbox" data-column="{$data_col}" class="toogle-vis"/> {$head}
</label>
</div>
</li>
{$data_col = $data_col + 1}
{/foreach}
</ul>
</div>
{/if}
{if $metrics['subreads_stats']}
<div class="col-md-2 col-lg-2">
<h4>Subreads Filter Stats</h4>
<ul class="list-unstyled">
{foreach from=$subreads_headers key=k item=head}
<li>
<div class="checkbox">
<label>
<input type="checkbox" data-column="{$data_col}" class="toogle-vis" checked/> {$head}
</label>
</div>
</li>
{$data_col = $data_col + 1}
{/foreach}
</ul>
</div>
{/if}
</div>
</div>
<div>
<table id="rs_subreads_datatable" class="table table-striped table-bordered dataTable analysis-result-table">
<thead>
<tr>
<th rowspan="2"><center><input type="checkbox" id="chk_all_sample"/></center></th>
{assign var="nb_samples" value=$analyse_results|@count - 1 }
<th class="string-sort" rowspan="2" id="th_id_1"><center>SMRT Cell ID {if $nb_samples > 1 }({$nb_samples}){/if}</center></th>
{if $metrics['loading']}
<th colspan="{$loading_stats_count}"><center>Loading report</center></th>
{/if}
{if $metrics['loading']}
<th colspan="{$loading_stats_count}"><center>Loading report</center></th>
{/if}
{if $metrics['adapter_stats']}
<th colspan="{$adapter_stats_count}"><center>Adapter Stats</center></th>
{/if}
{if $metrics['adapter_stats']}
<th colspan="{$adapter_stats_count}"><center>Adapter Stats</center></th>
{/if}
{if $metrics['prefilter_stats']}
<th colspan="{$prefilter_stats_count}"><center>Polymerase reads prefilter Stats</center></th>
{/if}
{if $metrics['prefilter_stats']}
<th colspan="{$prefilter_stats_count}"><center>Polymerase reads prefilter Stats</center></th>
{/if}
{if $metrics['postfilter_stats']}
<th colspan="{$postfilter_stats_count}"><center>Polymerase reads postfilter Stats</center></th>
{/if}
{if $metrics['postfilter_stats']}
<th colspan="{$postfilter_stats_count}"><center>Polymerase reads postfilter Stats</center></th>
{/if}
{if $metrics['subreads_stats']}
<th colspan="{$subreads_stats_count}"><center>Subreads Filter Stats</center></th>
{/if}
{if $metrics['subreads_stats']}
<th colspan="{$subreads_stats_count}"><center>Subreads Filter Stats</center></th>
{/if}
</tr>
</tr>
<tr>
{if $metrics['loading']}
{foreach from=$loading_headers key=k item=head}
<th><center>{$head}</center></th>
{/foreach}
{/if}
{if $metrics['adapter_stats']}
{foreach from=$adapter_headers key=k item=head}
<th><center>{$head}</center></th>
{/foreach}
{/if}
{if $metrics['prefilter_stats']}
{foreach from=$prefilter_headers key=k item=head}
<th><center>{$head}</center></th>
{/foreach}
{/if}
{if $metrics['postfilter_stats']}
{foreach from=$postfilter_headers key=k item=head}
<th><center>{$head}</center></th>
{/foreach}
{/if}
{if $metrics['subreads_stats']}
{foreach from=$subreads_headers key=k item=head}
<th><center>{$head}</center></th>
{/foreach}
{/if}
</tr>
</thead>
<tbody>
{assign var=i value=1}
{foreach from=$analyse_results_sorted key=sample item=sample_results}
{if $sample!="metrics"}
<tr>
<td><center><input type="checkbox" id="chk_sample_{$i}" value="sample"/></center></td>
<td id='sample_{$i}_col_1' class="sample_name">{$sample|get_description:$descriptions}</td>
{if $metrics['loading']}
<tr>
{assign var="th_id" value=2}
{if $metrics['loading']}
{foreach from=$loading_headers key=k item=head}
<td>{$sample_results['loading'].$head}</td>
<th id="th_id_{$th_id}">{$head}</th>
{$th_id = $th_id +1}
{/foreach}
{/if}
{if $metrics['adapter_stats']}
{foreach from=$adapter_headers key=k item=head}
{if $head == 'insert'}
<td><a class="imglink" href="{$sample_results['adapter_stats'].$head}" >pic</a></td>
{else}
<td>{$sample_results['adapter_stats'].$head}</td>
{/if}
{if $metrics['adapter_stats']}
{foreach from=$adapter_headers key=k item=head}
<th id="th_id_{$th_id}">{$head}</th>
{$th_id = $th_id +1}
{/foreach}
{/if}
{if $metrics['prefilter_stats']}
{foreach from=$prefilter_headers key=k item=head}
{if ($head == 'readlen' || $head == 'readscore')}
<td><a class="imglink" href="{$sample_results['prefilter_stats'].$head}" >pic</a></td>
{/if}
{if $metrics['prefilter_stats']}
{foreach from=$prefilter_headers key=k item=head}
{if $head == 'readlen'}
<th id="th_id_{$th_id}">Prefilter readlength histogram</th>
{elseif $head == 'readscore'}
<th id="th_id_{$th_id}">Prefilter readscore histogram</th>
{else}
<td>{$sample_results['prefilter_stats'].$head}</td>
<th id="th_id_{$th_id}">{$head}</th>
{/if}
{$th_id = $th_id +1}
{/foreach}
{/if}
{if $metrics['postfilter_stats']}
{foreach from=$postfilter_headers key=k item=head}
{if ($head == 'readlen' || $head == 'readscore')}
<td><a class="imglink" href="{$sample_results['postfilter_stats'].$head}" >pic</a></td>
{/if}
{if $metrics['postfilter_stats']}
{foreach from=$postfilter_headers key=k item=head}
{if $head == 'readlen'}
<th id="th_id_{$th_id}">Postfilter readlength histogram</th>
{elseif $head == 'readscore'}
<th id="th_id_{$th_id}">Postfilter readscore histogram</th>
{else}
<td>{$sample_results['postfilter_stats'].$head}</td>
<th id="th_id_{$th_id}">{$head}</th>
{/if}
{$th_id = $th_id +1}
{/foreach}
{/if}
{if $metrics['subreads_stats']}
{foreach from=$subreads_headers key=k item=head}
{if $head == 'report' }
<td><a class="imglink" href="{$sample_results['subreads_stats'].$head}" >pic</a></td>
{/if}
{if $metrics['subreads_stats']}
{foreach from=$subreads_headers key=k item=head}
{if $head == 'report' }
<th id="th_id_{$th_id}">Subreads length report</th>
{else}
<td>{$sample_results['subreads_stats'].$head}</td>
<th id="th_id_{$th_id}">{$head}</th>
{/if}
{$th_id = $th_id +1}
{/foreach}
{/if}
</tr>
{$i = $i + 1}
{/if}
{/foreach}
</tbody>
{/if}
</tr>
</thead>
<tfoot>
<tbody>
{assign var=i value=1}
{foreach from=$analyse_results_sorted key=sample item=sample_results}
{if $sample!="metrics"}
<tr>
<td><center><input type="checkbox" id="chk_sample_{$i}" value="sample"/></center></td>
<td id='sample_{$i}_col_1' class="sample_name">{$sample|get_description:$descriptions}</td>
{assign var="col_id" value=2}
{if $metrics['loading']}
{foreach from=$loading_headers key=k item=head}
<td id="sample_{$i}_col_{$col_id}">{$sample_results['loading'].$head}</td>
{$col_id = $col_id + 1}
{/foreach}
{/if}
{if $metrics['adapter_stats']}
{foreach from=$adapter_headers key=k item=head}
{if $head == 'insert'}
<td id="sample_{$i}_col_{$col_id}"><a class="imglink" href="{$sample_results['adapter_stats'].$head}" >pic</a></td>
{else}
<td id="sample_{$i}_col_{$col_id}">{$sample_results['adapter_stats'].$head}</td>
{/if}
{$col_id = $col_id + 1}
{/foreach}
{/if}
{if $metrics['prefilter_stats']}
{foreach from=$prefilter_headers key=k item=head}
{if ($head == 'readlen' || $head == 'readscore')}
<td id="sample_{$i}_col_{$col_id}"><a class="imglink" href="{$sample_results['prefilter_stats'].$head}" >pic</a></td>
{else}
<td id="sample_{$i}_col_{$col_id}">{$sample_results['prefilter_stats'].$head}</td>
{/if}
{$col_id = $col_id + 1}
{/foreach}
{/if}
{if $metrics['postfilter_stats']}
{foreach from=$postfilter_headers key=k item=head}
{if ($head == 'readlen' || $head == 'readscore')}
<td id="sample_{$i}_col_{$col_id}"><a class="imglink" href="{$sample_results['postfilter_stats'].$head}" >pic</a></td>
{else}
<td id="sample_{$i}_col_{$col_id}">{$sample_results['postfilter_stats'].$head}</td>
{/if}
{$col_id = $col_id + 1}
{/foreach}
{/if}
{if $metrics['subreads_stats']}
{foreach from=$subreads_headers key=k item=head}
{if $head == 'report' }
<td id="sample_{$i}_col_{$col_id}"><a class="imglink" href="{$sample_results['subreads_stats'].$head}" >pic</a></td>
{else}
<td id="sample_{$i}_col_{$col_id}">{$sample_results['subreads_stats'].$head}</td>
{/if}
{$col_id = $col_id + 1}
{/foreach}
{/if}
</tr>
{$i = $i + 1}
{/if}
{/foreach}
</tbody>
<tfoot>
<tr>
<th colspan="2">All metrics : <input type="checkbox" id="check_all_metrics"></th>
{assign var="th_id" value=2}
{if $metrics['loading']}
{foreach from=$loading_headers key=k item=head}
<th><center><input type="checkbox" id="chk_col_{$th_id}"></center></th>
{$th_id = $th_id +1}
{/foreach}
{/if}
{if $metrics['adapter_stats']}
{foreach from=$adapter_headers key=k item=head}
<th><center><input type="checkbox" id="chk_col_{$th_id}"></center></th>
{$th_id = $th_id +1}
{/foreach}
{/if}
{if $metrics['prefilter_stats']}
{foreach from=$prefilter_headers key=k item=head}
<th><center><input type="checkbox" id="chk_col_{$th_id}"></center></th>
{$th_id = $th_id +1}
{/foreach}
{/if}
{if $metrics['postfilter_stats']}
{foreach from=$postfilter_headers key=k item=head}
<th><center><input type="checkbox" id="chk_col_{$th_id}"></center></th>
{$th_id = $th_id +1}
{/foreach}
{/if}
{if $metrics['subreads_stats']}
{foreach from=$subreads_headers key=k item=head}
<th><center><input type="checkbox" id="chk_col_{$th_id}"></center></th>
{$th_id = $th_id +1}
{/foreach}
{/if}
</tr>
<tr>
<th align="left" colspan="{$th_id + 2}">
With selection :
<button type="button" class="btn btn-default multiple-selection-btn" id="columns_extract"><i class="glyphicon glyphicon-picture"></i> Compare</button>
</th>
</tr>
</tfoot>
</table>
</tfoot>
</table>
</div>
{/block}
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