comparison test-data/references/normalisation_report.html @ 0:76c750c5f0d1 draft default tip

planemo upload for repository https://github.com/oinizan/FROGS-wrappers commit 0b900a51e220ce6f17c1e76292c06a5f4d934055-dirty
author frogs
date Thu, 25 Oct 2018 05:01:13 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:76c750c5f0d1
1 <!DOCTYPE html>
2 <!--
3 # Copyright (C) 2015 INRA
4 #
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 -->
18 <html>
19 <head>
20 <title>FROGS Abundance Normalisation</title>
21 <meta charset="UTF-8">
22 <meta name="version" content="1.0.1">
23 <!-- CSS -->
24 <link rel="stylesheet" href="https://cdn.datatables.net/1.10.6/css/jquery.dataTables.css"></link>
25 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css"></link>
26 <style type="text/css">
27 #js-alert {
28 width: 90%;
29 margin-right: auto;
30 margin-left: auto;
31 }
32 #content {
33 width: 90%;
34 margin-right: auto;
35 margin-left: auto;
36 }
37 .clear {
38 clear: both;
39 height: 0px;
40 width: 100%;
41 float: none !important;
42 }
43 </style>
44 <!-- JS -->
45 <script type="text/javascript" src="http://code.jquery.com/jquery-2.1.3.min.js"></script>
46 <script type="text/javascript" src="http://code.highcharts.com/4.1.4/highcharts.js"></script>
47 <script type="text/javascript" src="http://code.highcharts.com/4.1.4/modules/exporting.js"></script>
48 <script type="text/javascript" src="https://cdn.datatables.net/1.10.6/js/jquery.dataTables.min.js"></script>
49 <script type="text/javascript">
50 /*
51 * HTMLTable.js 0.1.0 - HTMLTable Library
52 *
53 * Copyright (c) 2015 Escudie Frederic
54 * Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.
55 */
56 function HTMLtable(e){var t,r,n=e,a=";";this.deleteColumns=function(e){for(var a=n.getElementsByTagName("tr"),o=0;o<a.length;o++){s=0;var i=a[o].getElementsByTagName("td");0==i.length&&(i=a[o].getElementsByTagName("th"));for(var v=0,s=0;s<t[1];s++)if(!r[o][s]){var f=i[v].getAttribute("colspan");if(null!=f)for(var m=0;f>m;m++){if(in_array(s+m,e)){var u=i[v].getAttribute("colspan");u-1==0?i[v].removeAttribute("colspan"):i[v].setAttribute("colspan",u-1)}if(null==i[v].getAttribute("colspan")){var h=i[v];a[o].removeChild(h),v--}}else if(in_array(s,e)){var h=i[v];a[o].removeChild(h),v--}v++}}l(),g()},this.filter=function(e,a){var l=new RegExp(e),g=new Array;null!=a&&a||(g.c0=!0);for(var o=n.getElementsByTagName("tr"),i=0;i<o.length;i++){f=0;var v=o[i].getElementsByTagName("td");if(0!=v.length)for(var s=0,f=0;f<t[1];f++)r[i][f]||(l.test(v[s].innerHTML)&&(g["c"+f]=!0),s++)}for(var m=new Array,u=0;u<t[1];u++)void 0===g["c"+u]&&m.push(u);this.deleteColumns(m)},this.getModel=function(){return n};var l=function(){for(var e=0,r=0,a=n.getElementsByTagName("tr"),l=0;l<a.length;l++){var g=0;e++;var o=a[l].getElementsByTagName("td");0==o.length&&(o=a[l].getElementsByTagName("th"));for(var i=0;i<o.length;i++){var v=o[i].getAttribute("colspan");g+=null==v?1:parseInt(v)}g>r&&(r=g)}t=new Array(2),t[0]=e,t[1]=r},g=function(){r=new Array(t[0]);for(var e=0;e<t[0];e++){r[e]=new Array(t[1]);for(var a=0;a<t[1];a++)r[e][a]=!1}for(var l=n.getElementsByTagName("tr"),g=0;g<l.length;g++){v=0;var o=l[g].getElementsByTagName("td");0==o.length&&(o=l[g].getElementsByTagName("th"));for(var i=0,v=0;v<t[1];v++)if(!r[g][v]){var s=0,f=0,m=o[i].getAttribute("rowspan");null!=m&&(s=parseInt(m)-1);var u=o[i].getAttribute("colspan");null!=u&&(f=parseInt(u)-1);for(var h=s;h>=0;h--)for(var y=f;y>=0;y--)(0!=h||0!=y)&&(r[g+h][v+y]=!0);i++}}};this.replace=function(e,a,l){var g=new RegExp(e);null==a&&(a=""),null==l&&(l="");for(var o=n.getElementsByTagName("tr"),i=0;i<o.length;i++){f=0;var v=o[i].getElementsByTagName("td");if(0!=v.length)for(var s=0,f=0;f<t[1];f++)if(!r[i][f]){var m=g.exec(v[s].innerHTML);null!=m&&(void 0===m[1]&&(m[1]=""),v[s].innerHTML=a+m[1]+l),s++}}},this.toCSV=function(){for(var e="",l=n.getElementsByTagName("tr"),g=0;g<l.length;g++){var o=l[g].getElementsByTagName("td");0==o.length&&(o=l[g].getElementsByTagName("th"));for(var i=0,v=0;v<t[1];v++)r[g][v]||(e+=o[i].innerHTML,i++),e+=a;e=e.substr(0,e.length-1)+"\n"}return e},l(),g()}var in_array=function(e,t){for(var r in t)if(t[r]==e)return!0;return!1};
57
58 /*
59 * dataTableExtractor.plugin.js 0.1.0 - datatableExport Library
60 *
61 * Copyright (c) 2015 Escudie Frederic
62 * Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.
63 */
64 !function(t){t.fn.datatableExport=function(a){var e={anchor_id:t(this).attr("id"),table_id:null,csv_separator:";",omitted_columns:[]},n=t.extend(e,a);if(!t(this).length)throw"The element where the datatableExport is called does not exist.";if(void 0==n.anchor_id)throw"The datatableExport plugin must be called on an element with id.";if(null==n.table_id)throw"You must set the table_id parameter in datatableExport plugin.";if(!t("#"+n.table_id))throw"The datatable '#"+n.table_id+"' cannot be retieve in DOM.";return this.each(function(){var a=t(this);a.on("click",function(){t.fn.datatableExport.csv(n.anchor_id,n.table_id,n.csv_separator,n.omitted_columns)})})},t.fn.datatableExport.cleanCellMarkup=function(a,e){t.parseHTML(e);t("#"+a).append('<div class="hidden data-tmp">'+e+"</div>"),t("#"+a+" .data-tmp").find("input").each(function(){var a="";a=t(this).is(":checkbox")?t(this).is(":checked")?"true":"false":t(this).val(),t(this).replaceWith(a)});var n=t("#"+a+" .data-tmp").text();return t("#"+a+" .data-tmp").remove(),n},t.fn.datatableExport.csv=function(a,e,n,i){var l="",r=t("#"+e).DataTable(),d=t("#"+e+" thead")[0],o=new HTMLtable(d.cloneNode(!0));o.deleteColumns(i),l+=o.toCSV();var c=r.rows().data();t.each(c,function(e,n){for(var r="",d=0;d<n.length;d++)-1==t.inArray(d,i)&&(r+='"'+t.fn.datatableExport.cleanCellMarkup(a,n[d])+'";');""!=r&&(r=r.slice(0,-1)),l+=r+"\n"}),t("#"+a+"-extract-csv").length||t("#"+a).append('<a id="'+a+'-extract-csv" href="data:text/csv;charset=UTF-8,'+encodeURI(l)+'" download="data.csv" style="display:none;"></a>'),t("#"+a+"-extract-csv")[0].click()}}(jQuery);
65 </script>
66 <script type="text/javascript">
67 /**
68 * Returns the string representation of the number.
69 * @param pValue {Float} The number to process.
70 * @return {String} The string representation (example: 12856892.11111 => 12,856,892.11).
71 */
72 var numberDisplay = function( pValue ){
73 var new_val = "" ;
74 if( ("" + pValue + "").indexOf(".") != -1 ){
75 new_val = pValue.toFixed(2).replace(/(\d)(?=(\d{3})+\b)/g, '$1,');
76 } else {
77 new_val = pValue.toFixed().replace(/(\d)(?=(\d{3})+\b)/g, '$1,');
78 }
79 return new_val ;
80 }
81
82 /**
83 * Returns the HTML table representation of the data.
84 * @param pTitle {String} The title of the table.
85 * @param pCategories {Array} The title of each column.
86 * @param pData {Array} 2D matrix with row and column data.
87 * @return {String} The HTML table representation.
88 */
89 var table = function( pTitle, pCategories, pData ) {
90 // Header
91 var table_header = ' <tr>\n<th colspan="' + pCategories.length + '">' + pTitle + '</th> </tr>\n' ;
92 var table_header_line = "" ;
93 for(var idx = 0 ; idx < pCategories.length ; idx++){
94 table_header_line += " <th>" + pCategories[idx] + "</th>\n" ;
95 }
96 table_header += " <tr>\n" + table_header_line + " </tr>\n" ;
97 table_header = " <thead>\n" + table_header + " </thead>\n" ;
98
99 // Body
100 var table_body = '' ;
101 for(var data_idx = 0 ; data_idx < pData.length ; data_idx++){
102 var table_body_row = "" ;
103 for(var category_idx = 0 ; category_idx < pCategories.length ; category_idx++){
104 if( typeof pData[data_idx][category_idx] === "number" ) {
105 table_body_row += " <td>" + numberDisplay(pData[data_idx][category_idx]) + "</td>\n" ;
106 } else {
107 table_body_row += " <td>" + pData[data_idx][category_idx] + "</td>\n" ;
108 }
109 }
110 table_body += " <tr>\n" + table_body_row + " </tr>\n" ;
111 }
112 table_body = " <tbody>\n" + table_body + " </tbody>\n" ;
113
114 return '<table class="table table-striped">\n' + table_header + table_body + "</table>\n" ;
115 }
116
117 var histogram_param = function( pTitle, pYTitle, pCategories, pSeries, unity ) {
118 var param = {
119 chart: {
120 type: 'column'
121 },
122 title: {
123 text: pTitle
124 },
125 xAxis: {
126 categories: pCategories,
127 crosshair: true
128 },
129 yAxis: {
130 min: 0,
131 title: {
132 text: pYTitle
133 }
134 },
135 tooltip: {
136 headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
137 pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
138 '<td style="padding:0"><b>{point.y} ' + unity + '</b></td></tr>',
139 footerFormat: '</table>',
140 shared: true,
141 useHTML: true
142 },
143 plotOptions: {
144 column: {
145 pointPadding: 0.2,
146 borderWidth: 0
147 }
148 },
149 credits: {
150 enabled: false
151 },
152 series: pSeries
153 };
154
155 return param ;
156 }
157
158 $(function() {
159 var categories = ["Nb OTU before normalisation", "Nb OTU after normalisation"] ;
160 var histogram_series = [1609, 177] ;
161 var series_by_sample = [{"data": [1609, 177], "name": "splA_01"}, {"data": [1609, 177], "name": "splA_02"}, {"data": [1609, 177], "name": "splA_03"}] ;
162
163 // Remove alert
164 $('#js-alert').remove();
165 $('#content').removeClass("hidden");
166
167 // Display summary
168 var global_series = [{ name: 'All samples', data: histogram_series }];
169 $('#filter-summary').highcharts( histogram_param('Composition summary', 'Nb OTUs', categories, global_series, 'otu') );
170
171 // Display data by sample
172 var table_categories = categories.slice() ;
173 table_categories.unshift( "Sample" );
174 var table_series = new Array();
175 for( var spl_idx = 0 ; spl_idx < series_by_sample.length ; spl_idx++ ){
176 var nb_by_step = series_by_sample[spl_idx]['data'].slice() ;
177 nb_by_step.unshift( series_by_sample[spl_idx]['name'] );
178 table_series.push( nb_by_step );
179 };
180 $('#filter-log').append( table("Composition by sample", table_categories, table_series) );
181 $('#filter-log table').prop( 'id', 'details-table' );
182 $('#filter-log table').DataTable({
183 "sDom": '<"top"<"#details-csv-export"><"clear">lf>rt<"bottom"ip><"clear">'
184 });
185 $('#details-csv-export').html( '<button class="btn btn-primary"><span class="glyphicon glyphicon-open-file" aria-hidden="true">CSV</span></button>' );
186 $('#details-csv-export').addClass( 'dataTables_filter' );
187 $('#details-csv-export').datatableExport({
188 'table_id': "details-table"
189 });
190 });
191 </script>
192 </head>
193 <body>
194 <p id="js-alert" class="alert alert-warning">
195 javascript is needed to display data.<br />
196 If you try to view this data on galaxy please contact your administrator to authorise javascript or download the file to view.
197 </p>
198 <div id="content" class="hidden">
199 <div id="filter-summary"></div>
200 <div id="filter-log"></div>
201 </div>
202 </body>
203 </html>