From 1655d8ff7e5e9228a1c0c7ae65035e2787de33d7 Mon Sep 17 00:00:00 2001
From: martinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Date: Mon, 10 Aug 2009 08:30:27 +0000
Subject: [PATCH] added --logscale_y switch to relevant plot_* biopieces

git-svn-id: http://biopieces.googlecode.com/svn/trunk@628 74ccb610-7750-0410-82ae-013aeee3265d
---
 bp_bin/plot_chrdist            | 13 +++++++------
 bp_bin/plot_histogram          | 17 +++++++++--------
 bp_bin/plot_lendist            | 15 ++++++++-------
 bp_bin/plot_phastcons_profiles | 21 +++++++++++----------
 code_perl/Maasha/Plot.pm       |  4 ++++
 5 files changed, 39 insertions(+), 31 deletions(-)

diff --git a/bp_bin/plot_chrdist b/bp_bin/plot_chrdist
index 9e3ba41..7d15721 100755
--- a/bp_bin/plot_chrdist
+++ b/bp_bin/plot_chrdist
@@ -42,12 +42,13 @@ $terminals = "dumb,x11,aqua,post,svg";
 
 $options = Maasha::Biopieces::parse_options(
     [
-        { long => 'no_stream', short => 'x', type => 'flag',   mandatory => 'no',  default => undef,    allowed => undef,      disallowed => undef },
-        { long => 'data_out',  short => 'o', type => 'file',   mandatory => 'no',  default => undef,    allowed => undef,      disallowed => undef },
-        { long => 'terminal',  short => 't', type => 'string', mandatory => 'no',  default => 'dumb',   allowed => $terminals, disallowed => undef },
-        { long => 'title',     short => 'T', type => 'string', mandatory => 'no',  default => $default, allowed => undef,      disallowed => undef },
-        { long => 'xlabel',    short => 'X', type => 'string', mandatory => 'no',  default => undef,    allowed => undef,      disallowed => undef },
-        { long => 'ylabel',    short => 'Y', type => 'string', mandatory => 'no',  default => undef,    allowed => undef,      disallowed => undef },
+        { long => 'no_stream',  short => 'x', type => 'flag',   mandatory => 'no',  default => undef,    allowed => undef,      disallowed => undef },
+        { long => 'data_out',   short => 'o', type => 'file',   mandatory => 'no',  default => undef,    allowed => undef,      disallowed => undef },
+        { long => 'terminal',   short => 't', type => 'string', mandatory => 'no',  default => 'dumb',   allowed => $terminals, disallowed => undef },
+        { long => 'title',      short => 'T', type => 'string', mandatory => 'no',  default => $default, allowed => undef,      disallowed => undef },
+        { long => 'xlabel',     short => 'X', type => 'string', mandatory => 'no',  default => undef,    allowed => undef,      disallowed => undef },
+        { long => 'ylabel',     short => 'Y', type => 'string', mandatory => 'no',  default => undef,    allowed => undef,      disallowed => undef },
+        { long => 'logscale_y', short => 'L', type => 'flag',   mandatory => 'no',  default => undef,    allowed => undef,      disallowed => undef },
     ]   
 );
 
diff --git a/bp_bin/plot_histogram b/bp_bin/plot_histogram
index 4950305..7308c19 100755
--- a/bp_bin/plot_histogram
+++ b/bp_bin/plot_histogram
@@ -42,14 +42,15 @@ $terminals = "dumb,x11,aqua,post,svg";
 
 $options = Maasha::Biopieces::parse_options(
     [
-        { long => 'no_stream', short => 'x', type => 'flag',   mandatory => 'no',  default => undef,    allowed => undef,      disallowed => undef },
-        { long => 'data_out',  short => 'o', type => 'file',   mandatory => 'no',  default => undef,    allowed => undef,      disallowed => undef },
-        { long => 'key',       short => 'k', type => 'string', mandatory => 'yes', default => undef,    allowed => undef,      disallowed => undef },
-        { long => 'terminal',  short => 't', type => 'string', mandatory => 'no',  default => 'dumb',   allowed => $terminals, disallowed => undef },
-        { long => 'title',     short => 'T', type => 'string', mandatory => 'no',  default => $default, allowed => undef,      disallowed => undef },
-        { long => 'xlabel',    short => 'X', type => 'string', mandatory => 'no',  default => undef,    allowed => undef,      disallowed => undef },
-        { long => 'ylabel',    short => 'Y', type => 'string', mandatory => 'no',  default => undef,    allowed => undef,      disallowed => undef },
-        { long => 'sort',      short => 's', type => 'string', mandatory => 'no',  default => 'alph',   allowed => 'num,alph', disallowed => undef },
+        { long => 'no_stream',  short => 'x', type => 'flag',   mandatory => 'no',  default => undef,    allowed => undef,      disallowed => undef },
+        { long => 'data_out',   short => 'o', type => 'file',   mandatory => 'no',  default => undef,    allowed => undef,      disallowed => undef },
+        { long => 'key',        short => 'k', type => 'string', mandatory => 'yes', default => undef,    allowed => undef,      disallowed => undef },
+        { long => 'terminal',   short => 't', type => 'string', mandatory => 'no',  default => 'dumb',   allowed => $terminals, disallowed => undef },
+        { long => 'title',      short => 'T', type => 'string', mandatory => 'no',  default => $default, allowed => undef,      disallowed => undef },
+        { long => 'xlabel',     short => 'X', type => 'string', mandatory => 'no',  default => undef,    allowed => undef,      disallowed => undef },
+        { long => 'ylabel',     short => 'Y', type => 'string', mandatory => 'no',  default => undef,    allowed => undef,      disallowed => undef },
+        { long => 'sort',       short => 's', type => 'string', mandatory => 'no',  default => 'alph',   allowed => 'num,alph', disallowed => undef },
+        { long => 'logscale_y', short => 'L', type => 'flag',   mandatory => 'no',  default => undef,    allowed => undef,      disallowed => undef },
     ]   
 );
 
diff --git a/bp_bin/plot_lendist b/bp_bin/plot_lendist
index dfc0abb..58f9145 100755
--- a/bp_bin/plot_lendist
+++ b/bp_bin/plot_lendist
@@ -43,13 +43,14 @@ $terminals = "dumb,x11,aqua,post,svg";
 
 $options = Maasha::Biopieces::parse_options(
     [
-        { long => 'no_stream', short => 'x', type => 'flag',   mandatory => 'no',  default => undef,    allowed => undef,      disallowed => undef },
-        { long => 'data_out',  short => 'o', type => 'file',   mandatory => 'no',  default => undef,    allowed => undef,      disallowed => undef },
-        { long => 'key',       short => 'k', type => 'string', mandatory => 'yes', default => undef,    allowed => undef,      disallowed => undef },
-        { long => 'terminal',  short => 't', type => 'string', mandatory => 'no',  default => 'dumb',   allowed => $terminals, disallowed => undef },
-        { long => 'title',     short => 'T', type => 'string', mandatory => 'no',  default => $default, allowed => undef,      disallowed => undef },
-        { long => 'xlabel',    short => 'X', type => 'string', mandatory => 'no',  default => undef,    allowed => undef,      disallowed => undef },
-        { long => 'ylabel',    short => 'Y', type => 'string', mandatory => 'no',  default => undef,    allowed => undef,      disallowed => undef },
+        { long => 'no_stream',  short => 'x', type => 'flag',   mandatory => 'no',  default => undef,    allowed => undef,      disallowed => undef },
+        { long => 'data_out',   short => 'o', type => 'file',   mandatory => 'no',  default => undef,    allowed => undef,      disallowed => undef },
+        { long => 'key',        short => 'k', type => 'string', mandatory => 'yes', default => undef,    allowed => undef,      disallowed => undef },
+        { long => 'terminal',   short => 't', type => 'string', mandatory => 'no',  default => 'dumb',   allowed => $terminals, disallowed => undef },
+        { long => 'title',      short => 'T', type => 'string', mandatory => 'no',  default => $default, allowed => undef,      disallowed => undef },
+        { long => 'xlabel',     short => 'X', type => 'string', mandatory => 'no',  default => undef,    allowed => undef,      disallowed => undef },
+        { long => 'ylabel',     short => 'Y', type => 'string', mandatory => 'no',  default => undef,    allowed => undef,      disallowed => undef },
+        { long => 'logscale_y', short => 'L', type => 'flag',   mandatory => 'no',  default => undef,    allowed => undef,      disallowed => undef },
     ]   
 );
 
diff --git a/bp_bin/plot_phastcons_profiles b/bp_bin/plot_phastcons_profiles
index 82db056..0fb79d1 100755
--- a/bp_bin/plot_phastcons_profiles
+++ b/bp_bin/plot_phastcons_profiles
@@ -46,16 +46,17 @@ $terminals = "dumb,x11,aqua,post,svg";
 
 $options = Maasha::Biopieces::parse_options(
     [
-        { long => 'no_stream', short => 'x', type => 'flag',   mandatory => 'no',  default => undef,    allowed => undef,      disallowed => undef },
-        { long => 'data_out',  short => 'o', type => 'file',   mandatory => 'no',  default => undef,    allowed => undef,      disallowed => undef },
-        { long => 'genome',    short => 'g', type => 'genome', mandatory => 'yes', default => undef,    allowed => undef,      disallowed => undef },
-        { long => 'mean',      short => 'm', type => 'flag',   mandatory => 'no',  default => undef,    allowed => undef,      disallowed => undef },
-        { long => 'median',    short => 'M', type => 'flag',   mandatory => 'no',  default => undef,    allowed => undef,      disallowed => undef },
-        { long => 'flank',     short => 'f', type => 'uint',   mandatory => 'no',  default => 0,        allowed => undef,      disallowed => undef },
-        { long => 'terminal',  short => 't', type => 'string', mandatory => 'no',  default => 'dumb',   allowed => $terminals, disallowed => undef },
-        { long => 'title',     short => 'T', type => 'string', mandatory => 'no',  default => $default, allowed => undef,      disallowed => undef },
-        { long => 'xlabel',    short => 'X', type => 'string', mandatory => 'no',  default => undef,    allowed => undef,      disallowed => undef },
-        { long => 'ylabel',    short => 'Y', type => 'string', mandatory => 'no',  default => undef,    allowed => undef,      disallowed => undef },
+        { long => 'no_stream',  short => 'x', type => 'flag',   mandatory => 'no',  default => undef,    allowed => undef,      disallowed => undef },
+        { long => 'data_out',   short => 'o', type => 'file',   mandatory => 'no',  default => undef,    allowed => undef,      disallowed => undef },
+        { long => 'genome',     short => 'g', type => 'genome', mandatory => 'yes', default => undef,    allowed => undef,      disallowed => undef },
+        { long => 'mean',       short => 'm', type => 'flag',   mandatory => 'no',  default => undef,    allowed => undef,      disallowed => undef },
+        { long => 'median',     short => 'M', type => 'flag',   mandatory => 'no',  default => undef,    allowed => undef,      disallowed => undef },
+        { long => 'flank',      short => 'f', type => 'uint',   mandatory => 'no',  default => 0,        allowed => undef,      disallowed => undef },
+        { long => 'terminal',   short => 't', type => 'string', mandatory => 'no',  default => 'dumb',   allowed => $terminals, disallowed => undef },
+        { long => 'title',      short => 'T', type => 'string', mandatory => 'no',  default => $default, allowed => undef,      disallowed => undef },
+        { long => 'xlabel',     short => 'X', type => 'string', mandatory => 'no',  default => undef,    allowed => undef,      disallowed => undef },
+        { long => 'ylabel',     short => 'Y', type => 'string', mandatory => 'no',  default => undef,    allowed => undef,      disallowed => undef },
+        { long => 'logscale_y', short => 'L', type => 'flag',   mandatory => 'no',  default => undef,    allowed => undef,      disallowed => undef },
     ]   
 );
 
diff --git a/code_perl/Maasha/Plot.pm b/code_perl/Maasha/Plot.pm
index 94d542b..22968f3 100644
--- a/code_perl/Maasha/Plot.pm
+++ b/code_perl/Maasha/Plot.pm
@@ -90,6 +90,7 @@ sub lineplot_simple
     print $fh_in "set title \"$options->{ 'title' }\"\n"   if $options->{ "title" };
     print $fh_in "set xlabel \"$options->{ 'xlabel' }\"\n" if $options->{ "xlabel" };
     print $fh_in "set ylabel \"$options->{ 'ylabel' }\"\n" if $options->{ "ylabel" };
+    print $fh_in "set logscale y\n"                        if $options->{ "logscale_y" };
     print $fh_in "set grid\n"                              if not $options->{ "terminal" } eq "dumb";
     print $fh_in "set autoscale\n";
     print $fh_in "unset key\n";
@@ -150,6 +151,7 @@ sub histogram_simple
     print $fh_in "set title \"$options->{ 'title' }\"\n"   if $options->{ "title" };
     print $fh_in "set xlabel \"$options->{ 'xlabel' }\"\n" if $options->{ "xlabel" };
     print $fh_in "set ylabel \"$options->{ 'ylabel' }\"\n" if $options->{ "ylabel" };
+    print $fh_in "set logscale y\n"                        if $options->{ "logscale_y" };
     print $fh_in "set autoscale\n";
     print $fh_in "unset key\n";
     print $fh_in "set style fill solid\n";
@@ -227,6 +229,7 @@ sub histogram_lendist
     print $fh_in "set title \"$options->{ 'title' }\"\n"   if $options->{ "title" };
     print $fh_in "set xlabel \"$options->{ 'xlabel' }\"\n" if $options->{ "xlabel" };
     print $fh_in "set ylabel \"$options->{ 'ylabel' }\"\n" if $options->{ "ylabel" };
+    print $fh_in "set logscale y\n"                        if $options->{ "logscale_y" };
     print $fh_in "set autoscale\n";
     print $fh_in "unset key\n";
     print $fh_in "set style fill solid\n";
@@ -284,6 +287,7 @@ sub histogram_chrdist
     print $fh_in "set title \"$options->{ 'title' }\"\n"   if $options->{ "title" };
     print $fh_in "set xlabel \"$options->{ 'xlabel' }\"\n" if $options->{ "xlabel" };
     print $fh_in "set ylabel \"$options->{ 'ylabel' }\"\n" if $options->{ "ylabel" };
+    print $fh_in "set logscale y\n"                        if $options->{ "logscale_y" };
     print $fh_in "set autoscale\n";
     print $fh_in "unset key\n";
     print $fh_in "set style fill solid\n";
-- 
2.39.5