Commit 5fc1671d authored by Penom Nom's avatar Penom Nom
Browse files

Whole web-interface analysis redone

Prepare test on test server
Modified error venn algo
Add indexes
Remove useless file
parent 1da0ee8f
function powerset(ary) {
function powerset(ary) { //set of all subsets of "ary"
var ps = [[]];
for (var i=0; i < ary.length; i++) {
for (var j = 0, len = ps.length; j < len; j++) {
......@@ -11,101 +11,124 @@ function powerset(ary) {
$(document).ready(function(){
$(document).on("click", ".length-view-btn", function() {
if ($(":checked[id^=chk_sample_]").size() > 0) {
$("#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 btn-default" data-dismiss="modal" aria-hidden="true"><i class="glyphicon glyphicon-remove"></i> Close</button>');
$("#highcharts_container").css('width', '845px');
var all_boxplot = [];
var all_outliers = [];
var all_sample_id = [];
var plot_count = 0;
var colors = ['#7cb5ec', '#434348', '#90ed7d', '#f7a35c', '#8085e9',
'#f15c80', '#e4d354', '#2b908f', '#f45b5b', '#91e8e1']
// for each checked sample get
$(":checked[id^=chk_sample_]").each(function(){
//index
var index = $(this).attr("id").split("_")[2];
var index2 = $(this).attr("id").split("_")[3];
var val_boxplot = $("#boxplot_"+index+"_"+index2).val().split(";");
console.log(val_boxplot)
var val_outliers = $("#outliers_"+index+"_"+index2).val().split(";");
//id
var val_soft = $("#soft_"+index+"_"+index2).val();
all_sample_id.push(val_soft);
var sv_type = $("#type_"+index+"_"+index2).val();
all_sample_id.push(val_soft+"_"+sv_type);
//boxplot
var raw_boxplot = $("#boxplot_"+index+"_"+index2).val().split(";");
raw_boxplot = raw_boxplot.map(function (x) {
return parseInt(x, 10); //cast to int
});
obj_boxplot = {
x: plot_count,
color: colors[plot_count],
low: raw_boxplot[0],
q1: raw_boxplot[1],
median: raw_boxplot[2],
q3: raw_boxplot[3],
high: raw_boxplot[4]
};
all_boxplot.push(obj_boxplot);
//outliers
var val_outliers = $("#outliers_"+index+"_"+index2).val().split(";");
if(val_outliers[0] != '' ){
$.each(val_outliers, function(position, value){
all_outliers.push([parseInt(index),parseInt(value)]);
});
}
val_boxplot = val_boxplot.map(function (x) {
return parseInt(x, 10); //cast to int
});
all_boxplot.push(val_boxplot);
plot_count++
});
//set the modal
$("#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 btn-default" data-dismiss="modal" aria-hidden="true"><i class="glyphicon glyphicon-remove"></i> Close</button>');
$("#highcharts_container").css('width', '845px');
var chart = new Highcharts.Chart({
//set the graph
var chart = new Highcharts.Chart({
chart: {
renderTo: 'highcharts_container',
type: 'boxplot',
zoomType: 'xy'
},
title: {
text: 'SV length Box-Plot'
},
legend: {
enabled: false
},
xAxis: {
categories: all_sample_id,
title: {
text: 'Software'
}
},
yAxis: {
title: {
text: 'Sizes'
}
},
series: [{
name: 'Sizes',
data: all_boxplot,
tooltip: {
headerFormat: '<em>Software: {point.key}</em><br/>'
}
}]
});
resize_center_btmodal('#ng6modal', chart.chartWidth + 50);
//Display
//display the modal
resize_center_btmodal('#ng6modal', chart.chartWidth + 50);
$("#ng6modal").modal();
}
});
////////////////////////////////////////////////////////////////////////////////////////////////////
$(document).on("click", ".compo-view-btn", function() {
if ($(":checked[id^=chk_sample_]").size() > 0) {
$("#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 btn-default" data-dismiss="modal" aria-hidden="true"><i class="glyphicon glyphicon-remove"></i> Close</button>');
$("#highcharts_container").css('width', '845px');
var tags = $("#ntag_0_0").val().split(";")
var tags = $("#ntag_0_1").val().split(";") //Quick&Dirty
var all_count = [];
//for each sample get
$(":checked[id^=chk_sample_]").each(function(){
//index
var index = $(this).attr("id").split("_")[2];
var index2 = $(this).attr("id").split("_")[3];
var val_count = $("#ncount_"+index+"_"+index2).val().split(";");
//id
var soft = $("#soft_"+index+"_"+index2).val();
var sv_type = $("#type_"+index+"_"+index2).val();
var sample = soft + "_" + sv_type;
//counts
var val_count = $("#ncount_"+index+"_"+index2).val().split(";");
val_count = val_count.map(function (x) {
return parseInt(x, 10); //cast to int
});
all_count.push({name:soft, data:val_count});
all_count.push({name:sample, data:val_count});
});
//set the modal
$("#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 btn-default" data-dismiss="modal" aria-hidden="true"><i class="glyphicon glyphicon-remove"></i> Close</button>');
$("#highcharts_container").css('width', '845px');
//set the chart
var chart = new Highcharts.Chart({
chart: {
renderTo: 'highcharts_container',
......@@ -161,65 +184,69 @@ $(document).ready(function(){
},
series: all_count
});
//display the modal
resize_center_btmodal('#ng6modal', chart.chartWidth + 50);
//Display
$("#ng6modal").modal();
}
});
////////////////////////////////////////////////////////////////////////////////////////////////////
$.getScript("http://bioinfo.genotoul.fr/jvenn/src/jvenn.min.js", function(){
$(document).on("click", ".jvenn-btn", function() {
//modal
$("#modal-label-tmpl").html("NG6 <small> " + $("#analyse_name").val() + "</small>");
var all_venn = [];
var type4title = null;
$(".collapse").each(function(){
var sv_type = $(this).attr("id").split("_")[2]
if ($(":checked[id^=chk_sample_]", this).size() > 1) {
//venn_count
var venn_count = [];
var tmp = $("#venn_count_"+sv_type).val().split(",");
$.each(tmp, function(index, item){
var pair = item.split(":");
venn_count[pair[0].split(";").sort().join(";")] = pair[1];
});
//combinations
var selection = [];
$(":checked[id^=chk_sample_]").each(function(){ // ALL only
var soft = $(this).val();
selection.push(soft);
});
var combinations = powerset(selection);
var keys = powerset(['A','B','C','D']);
var my_values = {};
var my_names = {};
$.each(combinations, function(index, item){
if (keys[index] != '')
my_values[keys[index].join("")] = venn_count[item.sort().join(";")];
if (keys[index].length == 1){
my_names[keys[index].join("")] = item.sort().join(";");
}
});
all_venn.push({
name: my_names,
values: my_values
});
type4title = sv_type;
}
});
// set the modal
console.log($(this));
$("#modal-label-tmpl").html("NG6 <small> " + $("#analyse_name").val() + ": Venn Diagram of " + type4title + " type</small>");
$("#modal-body-tmpl").html('<div id="jvenn_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>');
$("#jvenn_container").css('width', '845px');
if ($(":checked[id^=chk_sample_]").size() > 0) {
//venn_count
var venn_count = [];
var tmp = $("#venn_count").val().split(",");
$.each(tmp, function(index, item){
var pair = item.split(":");
venn_count[pair[0]] = pair[1];
});
//combinations
var selection = [];
$(":checked[id^=chk_sample_0_]").each(function(){ // ALL only
var soft = $(this).val();
selection.push(soft);
});
var combinations = powerset(selection);
var keys = powerset(['A','B','C','D']);
var my_values = {};
var my_names = {};
//here
$.each(combinations, function(index, item){
if (keys[index] != '')
my_values[keys[index].join("")] = venn_count[item.join(";")];
if (keys[index].length == 1){
my_names[keys[index]] = item.join(";");
}
});
console.log(my_names);
console.log(my_values);
}
$("#jvenn_container");
//jvenn
$('#jvenn_container').jvenn({
series: [{
name: my_names,
values: my_values
}],
disableClick: true
// series: [{
// name: my_names,
// values: my_values
// }],
series: all_venn,
disableClick: false
});
//launch modal
resize_center_btmodal('#ng6modal');
// resize_center_btmodal('#ng6modal');
$("#ng6modal").modal();
});
});
......
......@@ -8,77 +8,96 @@
<button id="add_file" type="button" class="btn btn-sm btn-primary"><i class="glyphicon glyphicon-plus"></i> add files</button>
{/if}
</div>
<br/> Lorem ipsum dolor sit amet.
{/block}
{block name=results_title}Structural variations stats{/block}
{block name=results}
{assign var=my_types value=['ALL', 'DEL', 'DUP', 'INV', 'INS']}
{assign var="j" value=0}
<input type="hidden" id="venn_count" value="{$analyse_results["software_merge"]["default"].venn_count}"/>
<button type="button" class="btn btn-default multiple-selection-btn jvenn-btn"> Venn Diagram </button>
With selection :
<button type="button" class="btn btn-default multiple-selection-btn jvenn-btn"><i class="glyphicon glyphicon-picture"></i> Venn Diagram </button>
<button type="button" class="btn btn-default multiple-selection-btn length-view-btn"><i class="glyphicon glyphicon-picture"></i> Boxplots </button>
<button type="button" class="btn btn-default multiple-selection-btn compo-view-btn"><i class="glyphicon glyphicon-picture"></i> Accumulation Curves </button>
<br/><br/>
NB: Venn works only with a max of 4 indiv and cannot mix ALL/DEL/DUP/...
<style type="text/css">
.my_tab th{
width: auto !important;
}
.dataTables_scrollHeadInner {
width: 100% !important;
}
.my_tab{
width: 100% !important;
}
</style>
{foreach from=$my_types item=t}
<div id="user_information_dialog" title=""><br/><br/>{$t}<br/><br/><br/></div>
<table class="table table-striped table-bordered dataTable analysis-result-table">
<thead>
<tr>
<th><center><input type="checkbox" id="chk_all_sample_{$j}"></center></th>
<th class="string-sort" >Type</th>
<th class="numeric-sort">Number of SV</th>
<th class="numeric-sort">Median size</th>
<th class="numeric-sort">Mean size</th>
<th class="numeric-sort">Min size</th>
<th class="numeric-sort">Max size</th>
<th class="numeric-sort">Standard deviation</th>
<th class="numeric-sort">Outliers(boxplot)</th>
</tr>
</thead>
{assign var="i" value=0}
{foreach from=$analyse_results key=software item=software_results}
{foreach from=$software_results key=type item=infos_list}
{if $type == $t}
<tbody>
<tr>
<td>
<center>
<input type="checkbox" id="chk_sample_{$j}_{$i}" name="chk_soft" value="{$infos_list.soft}"/>
<input type="hidden" id="boxplot_{$j}_{$i}" value="{$infos_list.boxplot}"/>
<input type="hidden" id="outliers_{$j}_{$i}" value="{$infos_list.outliers}"/>
<input type="hidden" id="soft_{$j}_{$i}" value="{$infos_list.soft}"/>
<input type="hidden" id="ntag_{$j}_{$i}" value="{$infos_list.n_tag}"/>
<input type="hidden" id="ncount_{$j}_{$i}" value="{$infos_list.n_count}"/>
</center>
</td>
<td>{$infos_list.soft}</td>
<td>{$infos_list.number}</td>
<td>{$infos_list.median}</td>
<td>{$infos_list.mean}</td>
<td>{$infos_list.min}</td>
<td>{$infos_list.max}</td>
<td>{$infos_list.sd}</td>
<td>{$infos_list.outliers}</td>
</tr>
</tbody>
{$i = $i +1}
{/if}
<div id="user_information_dialog" title=""><br/></div>
<input type="hidden" id="venn_count_{$t}" value="{$analyse_results["software_merge"][$t].venn_count}"/>
<a href="#around_tab_{$t}" data-toggle="collapse" class="expander">
<br/> {$t}
</a>
{if $t == "ALL"}
<div id="around_tab_{$t}" class="collapse in">
{else}
<div id="around_tab_{$t}" class="collapse">
{/if}
<table class="table table-striped table-bordered dataTable analysis-result-table my_tab" style="width: 100%;">
<thead class="my_thead">
<tr>
<th></th>
<th class="string-sort">Software</th>
<th class="numeric-sort">Number of SV</th>
<th class="numeric-sort">Median size</th>
<th class="numeric-sort">Mean size</th>
<th class="numeric-sort">Min size</th>
<th class="numeric-sort">Max size</th>
<th class="numeric-sort">Standard deviation</th>
<th class="numeric-sort">Outliers(boxplot)</th>
</tr>
</thead>
{assign var="i" value=0}
<tbody>
{foreach from=$analyse_results key=software item=software_results}
{foreach from=$software_results key=type item=infos_list}
{if $type == $t && $software != "software_merge"}
<tr>
<td>
<center>
<input type="checkbox" id="chk_sample_{$j}_{$i}" name="chk_soft" value="{$infos_list.soft}"/>
<input type="hidden" id="boxplot_{$j}_{$i}" value="{$infos_list.boxplot}"/>
<input type="hidden" id="outliers_{$j}_{$i}" value="{$infos_list.outliers}"/>
<input type="hidden" id="soft_{$j}_{$i}" value="{$infos_list.soft}"/>
<input type="hidden" id="ntag_{$j}_{$i}" value="{$infos_list.n_tag}"/>
<input type="hidden" id="ncount_{$j}_{$i}" value="{$infos_list.n_count}"/>
<input type="hidden" id="type_{$j}_{$i}" value="{$t}"/>
</center>
</td>
<td align="center">{$infos_list.soft}</td>
<td align="center">{$infos_list.number}</td>
<td align="center">{$infos_list.median}</td>
<td align="center">{$infos_list.mean}</td>
<td align="center">{$infos_list.min}</td>
<td align="center">{$infos_list.max}</td>
<td align="center">{$infos_list.sd}</td>
<td align="center">{$infos_list.outliers}</td>
</tr>
{$i = $i +1}
{/if}
{/foreach}
{/foreach}
{/foreach}
<tfoot>
<tr>
<th align="left" colspan="{if $has_several_samples && ($nb_processed_samples >=1)}10{else}9{/if}">
With selection :
<button type="button" class="btn btn-default multiple-selection-btn length-view-btn"> Boxplots* </button>
<button type="button" class="btn btn-default multiple-selection-btn compo-view-btn"> Accumulation Curves </button>
</th>
</tr>
</tfoot>
</table>
</tbody>
</table>
</div>
{$j = $j +1}
{/foreach}
<br/><br/><br/><br/>
With selection :
<button type="button" class="btn btn-default multiple-selection-btn jvenn-btn"><i class="glyphicon glyphicon-picture"></i> Venn Diagram </button>
<button type="button" class="btn btn-default multiple-selection-btn length-view-btn"><i class="glyphicon glyphicon-picture"></i> Boxplots </button>
<button type="button" class="btn btn-default multiple-selection-btn compo-view-btn"><i class="glyphicon glyphicon-picture"></i> Accumulation Curves </button>
<br/>
{/block}
\ No newline at end of file
......@@ -33,7 +33,6 @@ class SVDetection (NG6Workflow):
self.add_parameter("min_mapq", "min. paired-end mapping quality", type=int, default=30)
self.add_parameter("overlap_percent", "Minimum threshold of overlap percent between 2 SV", type=float, default=0.7)
self.add_parameter("li_range", "Range of localisation interval around breakpoints", type=int, default=1000)
#TODO: dynamic softwares choice ?
def process(self):
......@@ -52,34 +51,42 @@ class SVDetection (NG6Workflow):
input_bam = [spl.reads1[0] for spl in self.samples]
indiv_list = [spl.name for spl in self.samples]
results = []
tata = ["H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W"]
toto = "/home/yguarracino/work/Project_Epigrani.335/Run_Lot1_-_8_IND.5529/Analyse_GATK_preprocess.23378/B00G6KH.rmdup.realn.bam /home/yguarracino/work/Project_Epigrani.335/Run_Lot1_-_8_IND.5529/Analyse_GATK_preprocess.23378/B00G6KI.rmdup.realn.bam /home/yguarracino/work/Project_Epigrani.335/Run_Lot1_-_8_IND.5529/Analyse_GATK_preprocess.23378/B00G6KJ.rmdup.realn.bam /home/yguarracino/work/Project_Epigrani.335/Run_Lot1_-_8_IND.5529/Analyse_GATK_preprocess.23378/B00G6KK.rmdup.realn.bam /home/yguarracino/work/Project_Epigrani.335/Run_Lot1_-_8_IND.5529/Analyse_GATK_preprocess.23378/B00G6KL.rmdup.realn.bam /home/yguarracino/work/Project_Epigrani.335/Run_Lot1_-_8_IND.5529/Analyse_GATK_preprocess.23378/B00G6KM.rmdup.realn.bam /home/yguarracino/work/Project_Epigrani.335/Run_Lot1_-_8_IND.5529/Analyse_GATK_preprocess.23378/B00G6KN.rmdup.realn.bam /home/yguarracino/work/Project_Epigrani.335/Run_Lot1_-_8_IND.5529/Analyse_GATK_preprocess.23378/B00G6KO.rmdup.realn.bam /home/yguarracino/work/Project_Epigrani.335/Run_Lot1_-_8_IND.5529/Analyse_GATK_preprocess.23378/B00G6KP.rmdup.realn.bam /home/yguarracino/work/Project_Epigrani.335/Run_Lot1_-_8_IND.5529/Analyse_GATK_preprocess.23378/B00G6KQ.rmdup.realn.bam /home/yguarracino/work/Project_Epigrani.335/Run_Lot1_-_8_IND.5529/Analyse_GATK_preprocess.23378/B00G6KR.rmdup.realn.bam /home/yguarracino/work/Project_Epigrani.335/Run_Lot1_-_8_IND.5529/Analyse_GATK_preprocess.23378/B00G6KS.rmdup.realn.bam /home/yguarracino/work/Project_Epigrani.335/Run_Lot1_-_8_IND.5529/Analyse_GATK_preprocess.23378/B00G6KT.rmdup.realn.bam /home/yguarracino/work/Project_Epigrani.335/Run_Lot1_-_8_IND.5529/Analyse_GATK_preprocess.23378/B00G6KU.rmdup.realn.bam /home/yguarracino/work/Project_Epigrani.335/Run_Lot1_-_8_IND.5529/Analyse_GATK_preprocess.23378/B00G6KV.rmdup.realn.bam /home/yguarracino/work/Project_Epigrani.335/Run_Lot1_-_8_IND.5529/Analyse_GATK_preprocess.23378/B00G6KW.rmdup.realn.bam"
# delly = self.add_component("Delly", [input_bam, self.reference_genome])
# breakdancer = self.add_component("Breakdancer", [input_bam, self.reference_genome, self.min_sup, self.min_mapq, self.max_len])
# pindel = self.add_component("Pindel", kwargs={"input_bam":input_bam,"reference_genome": self.reference_genome,
# "output_file":"pindel.concat.out", "mean_insert":self.mean_insert,
# "min_sup":self.min_sup, "indiv_list":indiv_list})
# cnvnator = self.add_component("CnvNator", [input_bam, self.reference_genome, self.bin_size])
# delly = self.add_component("Standardisation", [delly.output_file, "delly", "delly.bed", self.min_len, self.max_len, indiv_list])
# pindel = self.add_component("Standardisation", [pindel.output_file, "pindel", "pindel.bed", self.min_len, self.max_len, indiv_list])
# breakdancer = self.add_component("Standardisation", [breakdancer.output_file, "breakdancer", "breakdancer.bed", self.min_len, self.max_len, indiv_list, input_bam])
# cnvnator = self.add_component("Standardisation", [input_f, "cnvnator", "cnvnator.bed", self.min_len, self.max_len, indiv_list])
#=====TEST PURPOSE=====
# results = []
# tata = ["H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W"]
# toto = "/home/yguarracino/work/Project_Epigrani.335/Run_Lot1_-_8_IND.5529/Analyse_GATK_preprocess.23378/B00G6KH.rmdup.realn.bam /home/yguarracino/work/Project_Epigrani.335/Run_Lot1_-_8_IND.5529/Analyse_GATK_preprocess.23378/B00G6KI.rmdup.realn.bam /home/yguarracino/work/Project_Epigrani.335/Run_Lot1_-_8_IND.5529/Analyse_GATK_preprocess.23378/B00G6KJ.rmdup.realn.bam /home/yguarracino/work/Project_Epigrani.335/Run_Lot1_-_8_IND.5529/Analyse_GATK_preprocess.23378/B00G6KK.rmdup.realn.bam /home/yguarracino/work/Project_Epigrani.335/Run_Lot1_-_8_IND.5529/Analyse_GATK_preprocess.23378/B00G6KL.rmdup.realn.bam /home/yguarracino/work/Project_Epigrani.335/Run_Lot1_-_8_IND.5529/Analyse_GATK_preprocess.23378/B00G6KM.rmdup.realn.bam /home/yguarracino/work/Project_Epigrani.335/Run_Lot1_-_8_IND.5529/Analyse_GATK_preprocess.23378/B00G6KN.rmdup.realn.bam /home/yguarracino/work/Project_Epigrani.335/Run_Lot1_-_8_IND.5529/Analyse_GATK_preprocess.23378/B00G6KO.rmdup.realn.bam /home/yguarracino/work/Project_Epigrani.335/Run_Lot1_-_8_IND.5529/Analyse_GATK_preprocess.23378/B00G6KP.rmdup.realn.bam /home/yguarracino/work/Project_Epigrani.335/Run_Lot1_-_8_IND.5529/Analyse_GATK_preprocess.23378/B00G6KQ.rmdup.realn.bam /home/yguarracino/work/Project_Epigrani.335/Run_Lot1_-_8_IND.5529/Analyse_GATK_preprocess.23378/B00G6KR.rmdup.realn.bam /home/yguarracino/work/Project_Epigrani.335/Run_Lot1_-_8_IND.5529/Analyse_GATK_preprocess.23378/B00G6KS.rmdup.realn.bam /home/yguarracino/work/Project_Epigrani.335/Run_Lot1_-_8_IND.5529/Analyse_GATK_preprocess.23378/B00G6KT.rmdup.realn.bam /home/yguarracino/work/Project_Epigrani.335/Run_Lot1_-_8_IND.5529/Analyse_GATK_preprocess.23378/B00G6KU.rmdup.realn.bam /home/yguarracino/work/Project_Epigrani.335/Run_Lot1_-_8_IND.5529/Analyse_GATK_preprocess.23378/B00G6KV.rmdup.realn.bam /home/yguarracino/work/Project_Epigrani.335/Run_Lot1_-_8_IND.5529/Analyse_GATK_preprocess.23378/B00G6KW.rmdup.realn.bam"
#=====TEST PURPOSE=====
delly = self.add_component("Delly", [input_bam, self.reference_genome])
breakdancer = self.add_component("Breakdancer", [input_bam, self.reference_genome, self.min_sup, self.min_mapq, self.max_len])
pindel = self.add_component("Pindel", kwargs={"input_bam":input_bam,"reference_genome": self.reference_genome,
"output_file":"pindel.concat.out", "mean_insert":self.mean_insert,
"min_sup":self.min_sup, "indiv_list":indiv_list})
cnvnator = self.add_component("CnvNator", [input_bam, self.reference_genome, self.bin_size])
delly = self.add_component("Standardisation", [delly.output_file, "delly", "delly.bed", self.min_len, self.max_len, indiv_list])
pindel = self.add_component("Standardisation", [pindel.output_file, "pindel", "pindel.bed", self.min_len, self.max_len, indiv_list])
breakdancer = self.add_component("Standardisation", [breakdancer.output_file, "breakdancer", "breakdancer.bed", self.min_len, self.max_len, indiv_list, input_bam])
cnvnator = self.add_component("Standardisation", [input_f, "cnvnator", "cnvnator.bed", self.min_len, self.max_len, indiv_list])
# #=====TEST PURPOSE=====
# input_f = ["/home/yguarr/DataTest/example_cnvnator_raw.txt","/home/yguarr/DataTest/example2_cnvnator_raw.txt","/home/yguarr/DataTest/example3_cnvnator_raw.txt"]
# indiv_list = ["SAMPLE1","SAMPLE2","SAMPLE3"]
# delly = self.add_component("Standardisation", ["/home/yguarr/DataTest/chr29.delly", "delly", "delly.bed", self.min_len, self.max_len, tata])
# delly = self.add_component("Standardisation", ["/home/yguarr/DataTest/translocation/eg_tra_delly", "delly", "delly.bed", self.min_len, self.max_len, tata])
# pindel = self.add_component("Standardisation", ["/home/yguarr/DataTest/translocation/pindel_INT", "pindel_translocation", "pindel.bed", self.min_len, self.max_len, indiv_list])
# breakdancer = self.add_component("Standardisation", ["/home/yguarr/DataTest/translocation/bd_tra_multi_sample", "breakdancer", "breakdancer.bed", self.min_len, self.max_len, tata, toto])
# results=[delly.output_file, pindel.output_file, cnvnator.output_file, breakdancer.output_file]
# results=[delly.output_file, pindel.output_file, breakdancer.output_file]
# results=[pindel.output_file,cnvnator.output_file]
# results = ["/home/yguarr/DataTest/sort_epi_dly_test.bed", "/home/yguarr/DataTest/sort_epi_bd_test.bed",
# "/home/yguarr/DataTest/sort_epi_cnv_test.bed", "/home/yguarr/DataTest/sort_epi_pdl_test.bed"]
# results = [cnvnator.output_file, pindel.output_file]
# #=====TEST PURPOSE=====
# arg_list = [results, self.overlap_percent, self.li_range, ["dly", "BD","CNV","Pdl"], options]
# self.add_component(component_name="Analyzebed", addto="project", args=arg_list)
results=[delly.output_file, breakdancer.output_file, cnvnator.output_file, pindel.output_file]
arg_list = [results, self.overlap_percent, self.li_range, ["dly", "BD","CNV","Pdl"], options]
self.add_component(component_name="Analyzebed", addto="project", args=arg_list)
def post_process(self):
pass
......@@ -55,14 +55,13 @@ class Analyzebed (Analysis):
self.software = "Pindel, CNVnator, Delly, Breakdancer"
def post_process(self):
for i, bedfile in enumerate(self.output_links):
sample = os.path.splitext(os.path.basename(bedfile))[0]
soft = self.indiv_list[i]
#for boxplot
sizes_list = []
sizes_by_type = {}
#for accumulation curve
n_list = []
n_by_type = {}
......@@ -77,14 +76,15 @@ class Analyzebed (Analysis):
sizes_list.append(size)
n_list.append(n)
if sv_type in sizes_by_type:
if sv_type in sizes_by_type: #fill
sizes_by_type[sv_type].append(size)
n_by_type[sv_type].append(n)
else:
else: #if not, create
sizes_by_type[sv_type] = [size]
n_by_type[sv_type] = [n]
#GENERATE DB INFOS
#add "ALL" type
sizes_by_type["ALL"] = sizes_list
n_by_type["ALL"] = n_list
for type in sizes_by_type:
......@@ -102,6 +102,7 @@ class Analyzebed (Analysis):
'number':len(sizes),
'median':int(numpy.median(sizes))
}
#fill db on soft-specific data
self._add_result_element(sample, "soft", soft, type)
for key in db_entry:
self._add_result_element(sample, key, db_entry[key], type)
......@@ -124,39 +125,37 @@ class Analyzebed (Analysis):
svr_type = svr[4]
for column in svr[6].split(";"):
#get members
used_software.append("".join(column.split("-")[:-1]))
for key in self.powerset(self.unique(used_software)):
if key == ():
venn_table["all"] += 1
else:
venn_table[";".join(key)] += 1
if svr_type not in venn_table_by_type:
if svr_type not in venn_table_by_type: # create the dic
for key in self.powerset(self.indiv_list):
if key == ():
venn_table_by_type[svr_type] = {"all":0}
else:
venn_table_by_type[svr_type][";".join(key)] = 0
for key in self.powerset(self.unique(used_software)):
if key == ():
venn_table_by_type[svr_type]["all"] += 1
else:
venn_table_by_type[svr_type][";".join(key)] += 1
#update the dic
venn_table_by_type[svr_type][";".join(self.unique(used_software))] += 1
venn_table[";".join(self.unique(used_software))] += 1
#add "ALL" type
venn_table_by_type['ALL'] = venn_table
#GENERATE DB INFOS
for type in venn_table_by_type:
v_table = venn_table_by_type[type]
#good format
db_venn = "".join([y for y in str(v_table)[1:-1] if y not in ["\'", " "]])
#fill the db for inter-soft data
self._add_result_element("software_merge", "venn_count", db_venn, type)