comparison CoverageReport.pl @ 11:2936bcb2a378 draft

Hard Coded to use /usr/bin/Rscript instead of dependency one. Will revert when X11 issue is resolved.
author geert-vandeweyer
date Mon, 17 Feb 2014 09:49:16 -0500
parents 39c374d4cba7
children 86df3f847a72
comparison
equal deleted inserted replaced
10:1400dbec671f 11:2936bcb2a378
210 print OUT 'coverage <- coverage[,'.$covcol.']'."\n"; 210 print OUT 'coverage <- coverage[,'.$covcol.']'."\n";
211 print OUT 'png(file="../Plots/CoverageBoxPlot.png", bg="white", width=240, height=480)'."\n"; 211 print OUT 'png(file="../Plots/CoverageBoxPlot.png", bg="white", width=240, height=480)'."\n";
212 print OUT 'boxplot(coverage,range=1.5,main="Target Region Coverage")'."\n"; 212 print OUT 'boxplot(coverage,range=1.5,main="Target Region Coverage")'."\n";
213 print OUT 'graphics.off()'."\n"; 213 print OUT 'graphics.off()'."\n";
214 close OUT; 214 close OUT;
215 system("cd $wd/Rout && Rscript boxplot.R"); 215 system("cd $wd/Rout && /usr/bin/Rscript boxplot.R");
216 216
217 ## global nt coverage plot 217 ## global nt coverage plot
218 ## use perl to make histogram (lower memory) 218 ## use perl to make histogram (lower memory)
219 open IN, "$wd/Targets.Position.Coverage"; 219 open IN, "$wd/Targets.Position.Coverage";
220 my %dens; 220 my %dens;
304 print OUT 'text(1,82,pos=2,col="red",labels=paste("%Bases: ",round(frac.y,2),"%",sep=""))'."\n"; 304 print OUT 'text(1,82,pos=2,col="red",labels=paste("%Bases: ",round(frac.y,2),"%",sep=""))'."\n";
305 305
306 print OUT 'graphics.off()'."\n"; 306 print OUT 'graphics.off()'."\n";
307 307
308 close OUT; 308 close OUT;
309 system("cd $wd/Rout && Rscript ntplot.R"); 309 system("cd $wd/Rout && /usr/bin/Rscript ntplot.R");
310 ## PRINT TO .TEX FILE 310 ## PRINT TO .TEX FILE
311 open OUT, ">>$wd/Report/Report.tex"; 311 open OUT, ">>$wd/Report/Report.tex";
312 # average coverage overviews 312 # average coverage overviews
313 print OUT '\subsection*{Overall Summary}'."\n"; 313 print OUT '\subsection*{Overall Summary}'."\n";
314 print OUT '{\small '; 314 print OUT '{\small ';
429 print OUT 'text(mp, log10(coverage) + '.(0.4/$scale).',format(coverage),xpd = TRUE,srt=90)'."\n"; 429 print OUT 'text(mp, log10(coverage) + '.(0.4/$scale).',format(coverage),xpd = TRUE,srt=90)'."\n";
430 print OUT 'text(mp,par("usr")[3]-0.05,labels=entries,srt=45,adj=1,xpd=TRUE)'."\n"; 430 print OUT 'text(mp,par("usr")[3]-0.05,labels=entries,srt=45,adj=1,xpd=TRUE)'."\n";
431 print OUT 'abline(h=log10('.$thresh.'),lwd=4,col=rgb(255,0,0,100,maxColorValue=255))'."\n"; 431 print OUT 'abline(h=log10('.$thresh.'),lwd=4,col=rgb(255,0,0,100,maxColorValue=255))'."\n";
432 print OUT 'graphics.off()'."\n"; 432 print OUT 'graphics.off()'."\n";
433 close OUT; 433 close OUT;
434 system("cd $wd/Rout && Rscript barplot.R"); 434 system("cd $wd/Rout && /usr/bin/Rscript barplot.R");
435 if ($scale == 1) { 435 if ($scale == 1) {
436 push(@small,'\includegraphics[width=\textwidth,keepaspectratio=true]{../Plots/Coverage_'.$currgroup.'.png}'); 436 push(@small,'\includegraphics[width=\textwidth,keepaspectratio=true]{../Plots/Coverage_'.$currgroup.'.png}');
437 } 437 }
438 else { 438 else {
439 push(@large,'\includegraphics[width=\textwidth,keepaspectratio=true]{../Plots/Coverage_'.$currgroup.'.png}'); 439 push(@large,'\includegraphics[width=\textwidth,keepaspectratio=true]{../Plots/Coverage_'.$currgroup.'.png}');
471 print OUT 'text(mp, log10(coverage) + log10(2),format(coverage),xpd = TRUE,srt=90)'."\n"; 471 print OUT 'text(mp, log10(coverage) + log10(2),format(coverage),xpd = TRUE,srt=90)'."\n";
472 print OUT 'text(mp,par("usr")[3]-0.1,labels=entries,srt=45,adj=1,xpd=TRUE)'."\n"; 472 print OUT 'text(mp,par("usr")[3]-0.1,labels=entries,srt=45,adj=1,xpd=TRUE)'."\n";
473 print OUT 'abline(h=log10('.$thresh.'),lwd=4,col=rgb(255,0,0,100,maxColorValue=255))'."\n"; 473 print OUT 'abline(h=log10('.$thresh.'),lwd=4,col=rgb(255,0,0,100,maxColorValue=255))'."\n";
474 print OUT 'graphics.off()'."\n"; 474 print OUT 'graphics.off()'."\n";
475 close OUT; 475 close OUT;
476 system("cd $wd/Rout && Rscript barplot.R"); 476 system("cd $wd/Rout && /usr/bin/Rscript barplot.R");
477 if ($scale == 1) { 477 if ($scale == 1) {
478 push(@small,'\includegraphics[width=\textwidth,keepaspectratio=true]{../Plots/Coverage_'.$currgroup.'.png}'); 478 push(@small,'\includegraphics[width=\textwidth,keepaspectratio=true]{../Plots/Coverage_'.$currgroup.'.png}');
479 } 479 }
480 else { 480 else {
481 push(@large,'\includegraphics[width=\textwidth,keepaspectratio=true]{../Plots/Coverage_'.$currgroup.'.png}'); 481 push(@large,'\includegraphics[width=\textwidth,keepaspectratio=true]{../Plots/Coverage_'.$currgroup.'.png}');
577 print OUT 'failedcov <- coverage[coverage<'.$thresh.']'."\n"; 577 print OUT 'failedcov <- coverage[coverage<'.$thresh.']'."\n";
578 print OUT 'points(failedpos,log10(failedcov),col="red",pch=19)'."\n"; 578 print OUT 'points(failedpos,log10(failedcov),col="red",pch=19)'."\n";
579 print OUT 'graphics.off()'."\n"; 579 print OUT 'graphics.off()'."\n";
580 close OUT; 580 close OUT;
581 # run R script 581 # run R script
582 system("cd $wd/Rout && Rscript exonplot.R"); 582 system("cd $wd/Rout && /usr/bin/Rscript exonplot.R");
583 # Add to .TEX 583 # Add to .TEX
584 print TEX '\begin{minipage}{0.5\linewidth}\centering'."\n"; 584 print TEX '\begin{minipage}{0.5\linewidth}\centering'."\n";
585 print TEX '\includegraphics[width=\textwidth,keepaspectratio=true]{../Plots/Coverage_'.$exonstr.'.png}'."\n"; 585 print TEX '\includegraphics[width=\textwidth,keepaspectratio=true]{../Plots/Coverage_'.$exonstr.'.png}'."\n";
586 print TEX '\end{minipage}'."\n"; 586 print TEX '\end{minipage}'."\n";
587 $col++; 587 $col++;
675 print OUT 'failedcov <- coverage[coverage<'.$thresh.']'."\n"; 675 print OUT 'failedcov <- coverage[coverage<'.$thresh.']'."\n";
676 print OUT 'points(failedpos,log10(failedcov),col="red",pch=19)'."\n"; 676 print OUT 'points(failedpos,log10(failedcov),col="red",pch=19)'."\n";
677 print OUT 'graphics.off()'."\n"; 677 print OUT 'graphics.off()'."\n";
678 close OUT; 678 close OUT;
679 # run R script 679 # run R script
680 system("cd $wd/Rout && Rscript exonplot.R"); 680 system("cd $wd/Rout && /usr/bin/Rscript exonplot.R");
681 # Add to .TEX 681 # Add to .TEX
682 print TEX '\begin{minipage}{0.5\linewidth}\centering'."\n"; 682 print TEX '\begin{minipage}{0.5\linewidth}\centering'."\n";
683 print TEX '\includegraphics[width=\textwidth,keepaspectratio=true]{../Plots/Coverage_'.$exonstr.'.png}'."\n"; 683 print TEX '\includegraphics[width=\textwidth,keepaspectratio=true]{../Plots/Coverage_'.$exonstr.'.png}'."\n";
684 print TEX '\end{minipage}'."\n"; 684 print TEX '\end{minipage}'."\n";
685 $col++; 685 $col++;