From 5939e173e6039a23595532d1dce82714aca6c5f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Raphael=20M=C3=BCller?= Date: Wed, 23 Dec 2020 12:29:13 +0100 Subject: [PATCH] Rearanged RALL plot creation due to errors when no Illumina Reads are given --- backmap.pl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backmap.pl b/backmap.pl index 83d58df..359b8d6 100755 --- a/backmap.pl +++ b/backmap.pl @@ -784,9 +784,11 @@ sub round_format_pref{ open(RALL,'>',"$rscript") or die "ERROR\tCould not open file $rscript\n"; + print RALL "xmax <- 0\n"; for(my $i = 0; $i < scalar(@techs); $i++){ if(exists($cov_files{$techs[$i]})){ print RALL "$techs[$i]=read.table(\"$cov_files{$techs[$i]}\")\n"; + print RALL "xmax <- max(xmax, $techs[$i]\[,1])\n"; } } my $pdf = $rscript; @@ -795,12 +797,13 @@ sub round_format_pref{ my @legend = (); my @lty = (); my @col = (); + print RALL "plot(NULL,log=\"x\",type=\"l\",xlab=\"Coverage\",ylab=\"Count\",main=\"$assembly\",ylim=c(0,$global_ymax[0]), xlim=c(1,xmax))\n"; for(my $i = 0; $i < scalar(@techs); $i++){ if(exists $cov_files{$techs[$i]}){ push(@legend,"\"$techs[$i] N(0)=$n0_all{$techs[$i]}\""); push(@lty,"1"); if($i == 0 and exists($cov_files{$techs[$i]})){ - print RALL "plot($techs[$i]\[,1],$techs[$i]\[,2],log=\"x\",type=\"l\",xlab=\"Coverage\",ylab=\"Count\",main=\"$assembly\",ylim=c(0,$global_ymax[0]))\n"; + print RALL "lines($techs[$i]\[,1],$techs[$i]\[,2],type=\"l\",col=\"black\")\n"; push(@col,"\"black\""); } if($i == 1 and exists($cov_files{$techs[$i]})){