Commit addda07f authored by Jerome Mariette's avatar Jerome Mariette
Browse files

No commit message

No commit message
parent 625290d1
......@@ -540,7 +540,6 @@ $(function () {
$(".phylogeny-krona-view-btn").click(function() {
if ($(":checked[id^=chk_sample_]").size() >= 1) {
$("#modal-label-tmpl").html("NG6 <small> " + $("#analyse_name").val() + "</small>");
// $("#modal-body-tmpl").html('<div id="navigation_container" style="margin-right:20px; float: left; width: 520px;"><blockquote>Species repartition throught the different samples. To display the shared species, click on the corresponding number.</blockquote><br /><div id="venn_container"></div></div><div style="width: 1160px;"><textarea style="resize:none; height:560px; width: 600px;" id="venn_text"></textarea></div>');
$("#modal-foot-tmpl").html('<button class="btn" data-dismiss="modal" aria-hidden="true"><i class="icon-remove"></i> Close</button>');
$("#ng6modal").css('width', '1200px');
$("#ng6modal").css('margin-left', '-600px');
......@@ -557,191 +556,17 @@ $(function () {
$("#modal-body-tmpl").html('<div id="krona_container" style="width:1180px; height:700px;"><iframe id ="KronaFile" frameborder="0" src="'+url_val+'" style="width:100%; height:100%;"></iframe></div>');
$('#KronaFile').load(function(){
$('#KronaFile').contents().find("option").each(function() {
var found = $.inArray($(this).text(), samples_select) > -1;
var sample_name = $(this).text().replace(/^\s+|\s+$/g, '');
var found = $.inArray(sample_name, samples_select) > -1;
if (found == false){
$(this).hide();
}
});
$('#KronaFile').contents().find("#datasets").attr("size",size_samples);
// $('#KronaFile').contents().find("#datasets").val("#datasets option:selected").val(samples_select[0]);
$('#KronaFile').contents().find("#datasets").val("#datasets option:selected").val(samples_select[0]).change();
});
}
// $("#modal-label-tmpl").html("NG6 <small> " + $("#analyse_name").val() + "</small>");
// $("#modal-body-tmpl").html('<div id="krona_container" style="width:1000px; height:700px;"><iframe frameborder="0" src="'+url_val+'" style="width:100%; height:100%;"></iframe></div>');
// $("#modal-foot-tmpl").html('<button class="btn" data-dismiss="modal" aria-hidden="true"><i class="icon-remove"></i> Close</button>');
// $("#ng6modal").css('width', 'auto');
// $("#ng6modal").css('margin-left', '-515px');
// $("#ng6modal").modal();
// if ($(":checked[id^=chk_sample_]").size() == 1) {
// var index = $(":checked[id^=chk_sample_]").attr("id").split("_")[2];
// var file_basename = $("#phylogeny_file_"+index).val().split("/");
// file_basename = file_basename[file_basename.length-1];
// var url_val = "index.php?eID=tx_nG6&type=get_krona&file_path="+file_basename+"&file_name="+$("#sample_id_"+index).html();
// url_val += "&data_folder="+$("#analysis_folder").val()+"&sequence_name=sequences";
// $("#modal-label-tmpl").html("NG6 <small> " + $("#analyse_name").val() + "</small>");
// $("#modal-body-tmpl").html('<iframe width="820px" frameborder="0" height="550px" src="' + url_val + '"></iframe>');
// $("#modal-foot-tmpl").html('<button class="btn" data-dismiss="modal" aria-hidden="true"><i class="icon-remove"></i> Close</button>');
// $("#ng6modal").css('width', '850px');
// $("#ng6modal").css('margin-left', '-425px');
// $("#ng6modal").modal();
// }
});
/*
$(".phylogeny-tree-view-btn").click(function() {
if ($(":checked[id^=chk_sample_]").size() == 0) {
$("#user_information_dialog").dialog("option", "title", "Error");
$("#user_information_dialog").html("<div class='tx-nG6-pi1-error'>No raw selected, please select a raw to access this fonctionality.</div>").dialog("open");
var buttons = {};
buttons["Ok"] = function(){ $(this).dialog("close"); }
$("#user_information_dialog").dialog('option', 'buttons', buttons);
} else if ($(":checked[id^=chk_sample_]").size() == 1) {
function updateTree(rankid) {
$("#svgCanvas").html("");
var index = $(":checked[id^=chk_sample_]").attr("id").split("_")[2];
$.ajax({
url: $("#phylogeny_file_"+index).val(),
success: function(val, status, xhr) {
var xml_data = '<phyloxml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.phyloxml.org http://www.phyloxml.org/1.10/phyloxml.xsd" xmlns="http://www.phyloxml.org">';
xml_data += '<phylogeny rooted="false">';
xml_data += '<render>';
xml_data += ' <parameters>';
xml_data += ' <circular>';
xml_data += ' <bufferRadius>0.5</bufferRadius>';
xml_data += ' </circular>';
xml_data += ' <rectangular>';
xml_data += ' <alignRight>1</alignRight>';
xml_data += ' <bufferX>300</bufferX>';
xml_data += ' </rectangular>';
xml_data += ' </parameters>';
xml_data += ' <charts>';
xml_data += ' <content type="bar" fill="#666" width="0.2" />';
xml_data += ' </charts>';
xml_data += ' <styles>';
xml_data += ' <barChart fill="#333" stroke-width="0" />';
xml_data += ' </styles>';
xml_data += '</render>';
xml_data += '<clade id="root">';
xml_data += '</clade>';
xml_data += '</phylogeny>';
xml_data += '</phyloxml>';
xml_data = $(xml_data);
var current_level = -1;
var parentl = ""
var lines = val.split("\n");
for (j=0; j<lines.length; j++) {
if (lines[j] != "") {
mparts = lines[j].split("\t");
if (mparts[0] != "taxlevel" && mparts[1].indexOf(rankid+".") != -1) {
// If this guy doesnt exist yet
if (xml_data.find("#clade_"+mparts[1].replace(/\./g, '_')).length == 0) {
parentl = mparts[1].split(".").slice(0,-1).join("_");
// If no parent yet, this is the root
if (xml_data.find("#clade_"+parentl).length == 0) {
xml_data.find("#root").append('<clade><branch_length>1.0</branch_length><clade id="clade_'+mparts[1].replace(/\./g, '_')+'"></clade></clade>');
// Otherwise append if it's a leaf
} else if (mparts[0] == "9"){
xml_data.find("#clade_"+parentl).append('<name>'+mparts[2]+'</name><branch_length>1.0</branch_length><annotation><desc>toto</desc></annotation><chart><content>'+mparts[4]+'</content></chart>');
} else {
if (xml_data.find("#clade_"+parentl+" > branch_length").length == 0) {
xml_data.find("#clade_"+parentl).append('<branch_length>1.0</branch_length><clade id="clade_'+mparts[1].replace(/\./g, '_')+'"></clade>');
} else {
xml_data.find("#clade_"+parentl).append('<clade id="clade_'+mparts[1].replace(/\./g, '_')+'"></clade>');
}
}
}
}
}
}
xml_val = '<phyloxml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.phyloxml.org http://www.phyloxml.org/1.10/phyloxml.xsd" xmlns="http://www.phyloxml.org">';
xml_val += xml_data.html();
xml_val += '</phyloxml>';
var dataObject = {
xml: xml_val,
fileSource: false
};
phylocanvas = new Smits.PhyloCanvas(
dataObject,
'svgCanvas',
600, 600,
'circular'
);
//init(); //unitip
}
});
}
$("#img_dialog").dialog("option", "title", "nG6 - " + $("#analyse_name").val());
$("#img_dialog").dialog("option", "width", 1000);
$("#img_dialog").dialog("option", "height", 700);
$("#img_dialog").html('<div id="navigation_container" style="float: left; width: 280px;"></div><div align="center" id="svgCanvas" style="width: 900px;"></div>').dialog("open");
var index = $(":checked[id^=chk_sample_]").attr("id").split("_")[2];
$.ajax({
url: $("#phylogeny_file_"+index).val(),
success: function(val, status, xhr) {
$("#navigation_container").html('<p class="information">Click on a taxonomic level to display the corresponding subtree.</p><div class="underline"> </div><br /><div id="jstree_navigation"></div>');
var html_data = $("<ul></ul>");
var current_level = -1;
var parentl = ""
var lines = val.split("\n");
for (j=0; j<lines.length; j++) {
if (lines[j] != "") {
mparts = lines[j].split("\t");
if (mparts[0] != "taxlevel" && mparts[0] != "9") {
// If this guy doesnt exist yet
if (html_data.find("#li_"+mparts[1].replace(/\./g, '_')).length == 0) {
parentl = mparts[1].split(".").slice(0,-1).join("_");
// If no parent yet, this is the root
if (html_data.find("#li_"+parentl).length == 0) {
html_data.append('<li id=li_'+mparts[1].replace(/\./g, '_')+'><a class="taxonomy_click" id="'+mparts[1].replace(/\./g, '_')+'">'+mparts[2]+'</a><ul></ul></li>');
// Otherwise append it to the parent
} else {
if (mparts[0] != "8") {
html_data.find("#li_"+parentl+" > ul").append('<li id=li_'+mparts[1].replace(/\./g, '_')+'><a class="taxonomy_click" id="'+mparts[1].replace(/\./g, '_')+'">'+mparts[2]+'</a><ul></ul></li>');
} else {
html_data.find("#li_"+parentl+" > ul").append('<li id=li_'+mparts[1].replace(/\./g, '_')+'><a class="taxonomy_click" id="'+mparts[1].replace(/\./g, '_')+'">'+mparts[2]+'</a></li>');
}
}
}
}
}
}
$("#jstree_navigation").jstree({
"themes" : {
"theme" : "default",
"icons" : false
},
"ui" : {
"select_limit" : 1,
"selected_parent_close" : "select_parent",
"initially_select" : [ "li_0" ]
},
"html_data" : {
"data" : html_data
},
"plugins" : [ "themes", "html_data", "ui" ]
});
$("a.taxonomy_click").click(function(){
updateTree($(this).attr("id").replace(/_/g, '.'));
});
}
});
updateTree("0");
} else {
$("#user_information_dialog").dialog("option", "title", "Error");
$("#user_information_dialog").html("<div class='tx-nG6-pi1-error'>Only one row should be selected to access this fonctionality.</div>").dialog("open");
var buttons = {};
buttons["Ok"] = function(){ $(this).dialog("close"); }
$("#user_information_dialog").dialog('option', 'buttons', buttons);
}
});*/
});
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