# HG changeset patch # User dereeper # Date 1628623671 0 # Node ID fff88b734caf72de2c03b5e7d22998969b902440 Uploaded diff -r 000000000000 -r fff88b734caf boxplots.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/boxplots.pl Tue Aug 10 19:27:51 2021 +0000 @@ -0,0 +1,99 @@ +#!/usr/bin/perl + +use strict; +use File::Basename; +my $dirname = dirname(__FILE__); + +my $in = $ARGV[0]; +my $yaxis = $ARGV[1]; +my $output = $ARGV[2]; + +open(H,">$output"); +print H qq~ + + + + + + +
+
+
~; + + +my %hash; +open(F,$in); +my $first = ; +$first =~s/\n//g;$first =~s/\r//g; +my %level; +my $order = ""; +my @headers = split(/\t/,$first); +while(){ + my $line = $_; + $line =~s/\n//g;$line =~s/\r//g; + my @infos = split(/\t/,$line); + my $cat = $infos[0]; + for (my $i = 1; $i <= $#infos; $i++){ + $hash{$cat}{$headers[$i]}.= $infos[$i]."\n"; + if ($order !~/$headers[$i]/){ + $order .= $headers[$i]."|"; + } + $level{$headers[$i]}=1; + } +} +close(F); + +my @categories = split(/\|/,$order); + +my $categories = "\"".join("\",\"",@categories)."\""; +my %series; +foreach my $cat(keys(%hash)){ + my $refhash = $hash{$cat}; + my %subhash = %$refhash; + foreach my $header(@categories){ + my $values = $hash{$cat}{$header}; + open(F,">inforcalc");print F $values;close(F); + my $cmd = `Rscript $dirname/calc.r +Highcharts.chart('container', { + + chart: { + type: 'boxplot' + }, + legend: { + enabled: true + }, + title: { + text: '' + }, + xAxis: { + categories: [$categories] + }, + yAxis: { + title: { + text: '$yaxis' + } + }, + + series: [ + ~; +foreach my $cat(keys(%hash)){ + $javascript .= "{name: '$cat',\n"; + my $values = $series{$cat}; + chop($values);chop($values); + $javascript .= "data: [ $values ] },\n"; +} +chop($javascript);chop($javascript); +$javascript .= "]\n });\n"; +$javascript .= ""; +print H $javascript; +close(H); + + diff -r 000000000000 -r fff88b734caf boxplots.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/boxplots.xml Tue Aug 10 19:27:51 2021 +0000 @@ -0,0 +1,25 @@ + + using Highcharts library + perl ${__tool_directory__}/boxplots.pl $input $y_axis $output + + + + + + + + + + + + + diff -r 000000000000 -r fff88b734caf calc.r --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/calc.r Tue Aug 10 19:27:51 2021 +0000 @@ -0,0 +1,5 @@ +#!/usr/bin/Rscript +d<-scan("stdin", quiet=TRUE) +#d <- c(d) +#1.4, 5.66, 7.13, 9.21) +cat(min(d), max(d), quantile(d), sep=";")