Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
genotoul-bioinfo
ng6
Commits
37a55320
Commit
37a55320
authored
Nov 18, 2011
by
Jerome Mariette
Browse files
add krona view
parent
01ec1ee9
Changes
5
Hide whitespace changes
Inline
Side-by-side
ui/nG6/class.tx_nG6_eid.php
View file @
37a55320
...
...
@@ -242,6 +242,141 @@ class tx_nG6_eid {
}
}
print
tx_nG6_utils
::
get_octet_string_representation
(
$full_size
);
// If asked the krona page
}
else
if
(
$type
==
'get_krona'
)
{
$myFile
=
"/tmp/tmp.txt"
;
$fh
=
fopen
(
$myFile
,
'w'
);
$nb_file
=
trim
(
t3lib_div
::
_GP
(
'nb_file'
));
$max
=
intval
(
$nb_file
)
-
1
;
$data_folder
=
trim
(
t3lib_div
::
_GP
(
'data_folder'
));
$doc
=
new
DomDocument
();
$data_root
=
$doc
->
createElement
(
'data'
);
$data_root
=
$doc
->
appendChild
(
$data_root
);
$magnitude
=
$doc
->
createElement
(
'magnitude'
);
$magnitude
->
setAttribute
(
"attribute"
,
"g"
);
$magnitude
=
$data_root
->
appendChild
(
$magnitude
);
$magnitudet
=
$doc
->
createTextNode
(
''
);
$magnitudet
=
$magnitude
->
appendChild
(
$magnitudet
);
$color
=
$doc
->
createElement
(
'color'
);
$color
->
setAttribute
(
"attribute"
,
"g"
);
$color
->
setAttribute
(
"valueStart"
,
"0"
);
$color
->
setAttribute
(
"valueEnd"
,
"40"
);
$color
->
setAttribute
(
"hueStart"
,
"120"
);
$color
->
setAttribute
(
"hueEnd"
,
"360"
);
$color
=
$data_root
->
appendChild
(
$color
);
$colort
=
$doc
->
createTextNode
(
''
);
$colort
=
$color
->
appendChild
(
$colort
);
$attributes
=
$doc
->
createElement
(
'attributes'
);
$attributes
->
setAttribute
(
"g"
,
"Grams"
);
$attributes
->
setAttribute
(
"dva"
,
"DVA (%)"
);
$attributes
=
$data_root
->
appendChild
(
$attributes
);
$attributest
=
$doc
->
createTextNode
(
''
);
$attributest
=
$attributes
->
appendChild
(
$attributest
);
$datasets
=
$doc
->
createElement
(
'datasets'
);
$datasets
->
setAttribute
(
"names"
,
"Brand X,Brand Y"
);
$datasets
=
$data_root
->
appendChild
(
$datasets
);
$datasetst
=
$doc
->
createTextNode
(
''
);
$datasetst
=
$datasets
->
appendChild
(
$datasetst
);
foreach
(
range
(
0
,
$max
)
as
$i
)
{
$file_path
=
trim
(
t3lib_div
::
_GP
(
'file_path_'
.
(
string
)
$i
));
$file_path
=
$data_folder
.
"/"
.
$file_path
;
$file_name
=
trim
(
t3lib_div
::
_GP
(
'file_name_'
.
(
string
)
$i
));
// If the file exists
if
(
file_exists
(
$file_path
))
{
$lines
=
file
(
$file_path
);
// Loop through our array
foreach
(
$lines
as
$line_num
=>
$line
)
{
if
(
$line
!=
""
)
{
$mparts
=
explode
(
"
\t
"
,
$line
);
if
(
$mparts
[
0
]
!=
"taxlevel"
and
$mparts
[
0
]
!=
"0"
)
{
// If this guy doesnt exist yet
$id_searched
=
str_replace
(
"."
,
"_"
,
"node_"
.
$mparts
[
1
]);
if
(
count
(
$doc
->
getElementById
(
$id_searched
))
==
0
)
{
$parentl
=
implode
(
"_"
,
array_slice
(
explode
(
"."
,
$mparts
[
1
]),
0
,
-
1
));
// If no parent yet, this is the root
/*if (count($doc->getElementById(str_replace(".", "_", "node_".$parentl))) == 0) {
$current_node = $doc->createElement('node');
$current_node->setAttribute("id", "node_"+str_replace("\.", "_", $mparts[1]));
$current_node->setAttribute("name", $mparts[2]);
$current_node->setAttribute("g", $mparts[4]);
$current_node = $dom->getElementById("data_root").appendChild($current_node);
$current_nodet = $doc->createTextNode('');
$current_nodet = $current_node->appendChild($current_nodet);
} else {
$current_node = $doc->createElement('node');
$current_node->setAttribute("id", "node_"+str_replace("\.", "_", $mparts[1]));
$current_node->setAttribute("name", $mparts[2]);
$current_node->setAttribute("g", $mparts[4]);
$current_node = $dom->getElementById("node_"+$parentl).appendChild($current_node);
$current_nodet = $doc->createTextNode('');
$current_nodet = $current_node->appendChild($current_nodet);
}*/
}
}
}
}
}
}
$xml_string
=
$doc
->
saveXML
();
fwrite
(
$fh
,
$xml_string
);
fclose
(
$fh
);
$val
=
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'
;
$val
.
=
'<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">'
;
$val
.
=
'<head>'
;
$val
.
=
'</head>'
;
$val
.
=
'<body>'
;
$val
.
=
'<div id="options" style="position:absolute;left:0;top:0"></div>'
;
$val
.
=
'<div id="details" style="position:absolute;top:1%;right:2%;text-align:right;"></div>'
;
$val
.
=
'<canvas id="canvas" width="100%" height="100%">This browser does not support HTML5</canvas><div>'
;
$val
.
=
'<img id="hiddenImage" src="http://krona.sourceforge.net/img/hidden.png" visibility="hide"/>'
;
$val
.
=
'<script name="tree" src="http://krona.sourceforge.net/krona-1.1.js"></script>'
;
$val
.
=
'<data id="data_root">'
;
$val
.
=
'<magnitude attribute="g"></magnitude>'
;
$val
.
=
'<color attribute="g" valueStart="0" valueEnd="40" hueStart="120" hueEnd="360"></color>'
;
$val
.
=
'<attributes g="Grams" dva="DVA (%)"></attributes>'
;
$val
.
=
'<datasets names="Brand X,Brand Y"></datasets>'
;
$val
.
=
'<node id="data1" name="Granola serving" g="55,55">'
;
$val
.
=
'<node id="data2" name="Fats" g="8,6" dva="12">'
;
$val
.
=
'<node id="data3" name="Saturated fat" g="2,1" dva="10"></node>'
;
$val
.
=
'<node id="data4" name="Unsaturated fat" g="6,5">'
;
$val
.
=
'<node name="Monounsaturated fat" g="3,1"></node>'
;
$val
.
=
'<node name="Polyunsaturated fat" g="3,4"></node>'
;
$val
.
=
'</node>'
;
$val
.
=
'</node>'
;
$val
.
=
'<node name="Carbohydrates" g="39,41" dva="13">'
;
$val
.
=
'<node name="Sugars" g="3,5"></node>'
;
$val
.
=
'<node name="Dietary fiber" g="4,8" dva="16"></node>'
;
$val
.
=
'</node>'
;
$val
.
=
'<node name="protein" g="5,6"></node>'
;
$val
.
=
'</node>'
;
$val
.
=
'</data>'
;
$val
.
=
'</div>'
;
$val
.
=
'</body>'
;
$val
.
=
'</html>'
;
print
$val
;
}
}
...
...
ui/nG6/pi1/analyzes/MothurClassifyAnalyse.js
View file @
37a55320
...
...
@@ -541,6 +541,98 @@ $(function () {
}
return
data
;
}
$
(
"
.phylogeny-krona-view-btn
"
).
click
(
function
()
{
if
(
$
(
"
:checked[id^=chk_sample_]
"
).
size
()
==
0
)
{
$
(
"
#user_information_dialog
"
).
dialog
(
"
option
"
,
"
title
"
,
$
(
"
#information_error_title
"
).
val
());
$
(
"
#user_information_dialog
"
).
html
(
"
<div class='tx-nG6-pi1-error'>
"
+
$
(
"
#information_dialog_zero_check
"
).
val
()
+
"
</div>
"
).
dialog
(
"
open
"
);
var
buttons
=
{};
buttons
[
$
(
"
#ok_btn_label
"
).
val
()]
=
function
(){
$
(
this
).
dialog
(
"
close
"
);
}
$
(
"
#user_information_dialog
"
).
dialog
(
'
option
'
,
'
buttons
'
,
buttons
);
}
else
{
$
(
"
#img_dialog
"
).
dialog
(
"
option
"
,
"
title
"
,
"
nG6 -
"
+
$
(
"
#analyse_name
"
).
val
());
$
(
"
#img_dialog
"
).
dialog
(
"
option
"
,
"
width
"
,
1000
);
$
(
"
#img_dialog
"
).
dialog
(
"
option
"
,
"
height
"
,
700
);
var
url_val
=
"
index.php?eID=tx_nG6&type=get_krona
"
;
var
ind
=
0
;
$
(
"
:checked[id^=chk_sample_]
"
).
each
(
function
(){
index
=
$
(
this
).
attr
(
"
id
"
).
split
(
"
_
"
)[
2
];
var
file_basename
=
$
(
"
#phylogeny_file_
"
+
index
).
val
().
split
(
"
/
"
);
file_basename
=
file_basename
[
file_basename
.
length
-
1
];
url_val
+=
"
&file_path_
"
+
ind
+
"
=
"
+
file_basename
;
url_val
+=
"
&file_name_
"
+
ind
+
"
=
"
+
$
(
"
#sample_id_
"
+
index
).
html
();
ind
++
;
});
url_val
+=
"
&nb_file=
"
+
ind
+
"
&data_folder=
"
+
$
(
"
#analysis_folder
"
).
val
();
$
(
"
#img_dialog
"
).
html
(
'
<iframe frameborder="0" src="
'
+
url_val
+
'
" style="width:100%; height:100%;"></iframe>
'
).
dialog
(
"
open
"
);
//$("#frameDemo").contents().find("a").css("background-color","#BADA55");
/*var ajax = new Array();
var samples = new Array();
var index = "";
$(":checked[id^=chk_sample_]").each(function(){
index = $(this).attr("id").split("_")[2];
ajax.push($.ajax($("#phylogeny_file_"+index).val()));
samples.push($("#sample_id_"+index).html());
});
/*$.when.apply($, ajax).done(function(){
/*var data_names = '';
/*for (sample in samples) {
data_names += samples[sample] + ","
}
data_names = data_names.substring(0,data_names.length-1);
var data_val = $('<data><magnitude attribute="g"></magnitude><color attribute="g" valueStart="0" valueEnd="40" hueStart="120" hueEnd="360"></color><attributes g="Grams" dva="DVA (%)"></attributes><datasets names="' + data_names + '"></datasets><node id="data_root" name="data_root" g="500"></node></data>');
// for each taxonomy files
/*for( var i = 0; i < arguments.length; i++ ) {
var lines = arguments[i][0].split("\n");
var lines = arguments[0].split("\n");
for (j=0; j<lines.length; j++) {
if (lines[j] != "") {
mparts = lines[j].split("\t");
if (mparts[0] != "taxlevel" && mparts[0] != "0") {
// If this guy doesnt exist yet
if (data_val.find("#node_"+mparts[1].replace(/\./g, '_')).length == 0) {
parentl = mparts[1].split(".").slice(0,-1).join("_");
// If no parent yet, this is the root
if (data_val.find("#node_"+parentl).length == 0) {
data_val.find("#data_root").append('<node id="node_'+mparts[1].replace(/\./g, '_')+'" name="'+mparts[2]+'" g="'+mparts[4]+'"></node>');
} else {
data_val.find("#node_"+parentl).append('<node id="node_'+mparts[1].replace(/\./g, '_')+'" name="'+mparts[2]+'" g="'+mparts[4]+'"></node>');
}
}
}
}
}
}
var datav = "<data>" + data_val.html() + "</data>"
datav = datav.replace(/"/g,'"');*/
/*var data_val = '<data id="data_root">';
data_val += '<magnitude attribute="g"></magnitude>';
data_val += '<color attribute="g" valueStart="0" valueEnd="40" hueStart="120" hueEnd="360"></color>';
data_val += '<attributes g="Grams" dva="DVA (%)"></attributes>';
data_val += '<datasets names="Brand X,Brand Y"></datasets>';
data_val += '<node id="data1" name="Granola serving" g="55,55">';
data_val += '<node id="data2" name="Fats" g="8,6" dva="12">';
data_val += '<node id="data3" name="Saturated fat" g="2,1" dva="10"></node>';
data_val += '<node id="data4" name="Unsaturated fat" g="6,5">';
data_val += '<node name="Monounsaturated fat" g="3,1"></node>';
data_val += '<node name="Polyunsaturated fat" g="3,4"></node>';
data_val += '</node>';
data_val += '</node>';
data_val += '<node name="Carbohydrates" g="39,41" dva="13">';
data_val += '<node name="Sugars" g="3,5"></node>';
data_val += '<node name="Dietary fiber" g="4,8" dva="16"></node>';
data_val += '</node>';
data_val += '<node name="protein" g="5,6"></node>';
data_val += '</node>';
data_val += '</data>';
data_val = data_val.replace(/"/g,'"');*/
//});
}
});
$
(
"
.phylogeny-tree-view-btn
"
).
click
(
function
()
{
if
(
$
(
"
:checked[id^=chk_sample_]
"
).
size
()
==
0
)
{
...
...
ui/nG6/pi1/analyzes/MothurClassifyAnalyse.tpl
View file @
37a55320
...
...
@@ -30,6 +30,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
{
block
name
=
results
}
<div
id=
"user_information_dialog"
title=
""
></div>
<input
type=
"hidden"
id=
"analyse_name"
value=
"
{
$analyse.name
}
"
/>
<input
type=
"hidden"
id=
"data_folder"
value=
"
{
$data_folder
}
"
/>
<input
type=
"hidden"
id=
"analysis_folder"
value=
"
{
$data_folder
|
cat
:
$analyse.directory
}
"
/>
<input
type=
"hidden"
id=
"nb_sequences"
value=
"
{
$llang.MothurClassifyAnalyse_nb_sequences
}
"
/>
<input
type=
"hidden"
id=
"sequences"
value=
"
{
$llang.MothurClassifyAnalyse_sequences
}
"
/>
<input
type=
"hidden"
id=
"click_to_view"
value=
"
{
$llang.MothurClassifyAnalyse_click_to_view
}
"
/>
...
...
@@ -80,7 +82,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<tr>
<th
align=
"left"
colspan=
"10"
>
{
$llang.toolbar_title
}
<button
type=
"button"
class=
"btn pill-l phylogeny-bar-view-btn"
><span><span>
{
$llang.MothurClassifyAnalyse_barview_button
}
</span></span></button><button
type=
"button"
class=
"btn pill-c phylogeny-
tree
-view-btn"
><span><span>
{
$llang.MothurClassifyAnalyse_
tree
view_button
}
</span></span></button><button
type=
"button"
class=
"btn pill-r venn-view-btn"
><span><span>
{
$llang.MothurClassifyAnalyse_vennview_button
}
</span></span></button>
<button
type=
"button"
class=
"btn pill-l phylogeny-bar-view-btn"
><span><span>
{
$llang.MothurClassifyAnalyse_barview_button
}
</span></span></button><button
type=
"button"
class=
"btn pill-c phylogeny-
krona
-view-btn"
><span><span>
{
$llang.MothurClassifyAnalyse_
krona
view_button
}
</span></span></button><button
type=
"button"
class=
"btn pill-r venn-view-btn"
><span><span>
{
$llang.MothurClassifyAnalyse_vennview_button
}
</span></span></button>
</th>
</tr>
</tfoot>
...
...
ui/nG6/pi1/class.tx_nG6_pi1.php
View file @
37a55320
...
...
@@ -300,6 +300,7 @@ class tx_nG6_pi1 extends tslib_pibase {
$smarty
->
assign
(
'analyse'
,
$analyse
);
$analysis_size
=
tx_nG6_db
::
get_analysis_size
(
$this
->
piVars
[
'analyze_id'
],
$this
->
conf
[
'data'
]);
$smarty
->
assign
(
'analyse_size'
,
tx_nG6_utils
::
get_octet_string_representation
(
$analysis_size
));
$smarty
->
assign
(
'data_folder'
,
$this
->
conf
[
"data"
]);
// Then select analyse results
$results
=
tx_nG6_db
::
select_analyse_results
(
$this
->
piVars
[
'analyze_id'
]);
...
...
ui/nG6/pi1/locallang.xml
View file @
37a55320
...
...
@@ -331,7 +331,7 @@
<label
index=
"MothurClassifyAnalyse_results_title"
>
Classifying results
</label>
<label
index=
"MothurClassifyAnalyse_nb_classified_sequences"
>
Number of sequences
</label>
<label
index=
"MothurClassifyAnalyse_barview_button"
>
Bar view
</label>
<label
index=
"MothurClassifyAnalyse_
tree
view_button"
>
Tree
view
</label>
<label
index=
"MothurClassifyAnalyse_
krona
view_button"
>
Krona
view
</label>
<label
index=
"MothurClassifyAnalyse_nb_sequences"
>
Number of sequences
</label>
<label
index=
"MothurClassifyAnalyse_click_to_view"
>
Click to view ###CATEGORY###
</label>
<label
index=
"MothurClassifyAnalyse_sequences"
>
sequences
</label>
...
...
@@ -684,7 +684,7 @@
<label
index=
"MothurClassifyAnalyse_params_title"
>
Commandes et paramètres mothur utilisées
</label>
<label
index=
"MothurClassifyAnalyse_nb_classified_sequences"
>
Nombre de séquences
</label>
<label
index=
"MothurClassifyAnalyse_barview_button"
>
Bar view
</label>
<label
index=
"MothurClassifyAnalyse_
tree
view_button"
>
Tree
view
</label>
<label
index=
"MothurClassifyAnalyse_
krona
view_button"
>
Krona
view
</label>
<label
index=
"MothurClassifyAnalyse_nb_sequences"
>
Nombre de séquences
</label>
<label
index=
"MothurClassifyAnalyse_sequences"
>
séquences
</label>
<label
index=
"MothurClassifyAnalyse_click_to_view"
>
Cliquez pour voir la distribution de ###CATEGORY###
</label>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment