[med-svn] [bio-tradis] 04/08: New upstream version 1.3.3+dfsg

Andreas Tille tille at debian.org
Thu Jun 22 14:02:44 UTC 2017


This is an automated email from the git hooks/post-receive script.

tille pushed a commit to branch master
in repository bio-tradis.

commit 844a577904658f0a95c768d6238798df4bec0732
Author: Andreas Tille <tille at debian.org>
Date:   Thu Jun 22 15:54:38 2017 +0200

    New upstream version 1.3.3+dfsg
---
 README.md                                    | 47 +++++++++++++++-------------
 bin/tradis_essentiality.R                    | 24 +++++++-------
 dist.ini                                     |  2 +-
 lib/Bio/Tradis/AddTagsToSeq.pm               | 13 +++++---
 lib/Bio/Tradis/CombinePlots.pm               |  5 +--
 lib/Bio/Tradis/CommandLine/TradisAnalysis.pm |  6 ++--
 lib/Bio/Tradis/CommandLine/TradisBam.pm      | 15 +++++----
 t/Bio/Tradis/AddTagsToSeq.t                  | 21 +++++++------
 t/Bio/Tradis/CombinePlots.t                  | 32 +++++++++----------
 t/Bio/Tradis/CommandLine/TradisAnalysis.t    |  1 -
 t/Bio/Tradis/FilterTags.t                    | 26 +++++++--------
 t/Bio/Tradis/Map.t                           |  8 ++---
 t/Bio/Tradis/Parser/Bam.t                    |  1 -
 t/Bio/Tradis/Parser/Cigar.t                  |  1 -
 t/Bio/Tradis/Parser/Fastq.t                  |  2 --
 t/Bio/Tradis/RemoveTags.t                    | 20 ++++++------
 t/Bio/Tradis/RunTradis.t                     | 45 +++++++++++++-------------
 t/Bio/Tradis/TradisPlot.t                    |  9 ++++--
 18 files changed, 146 insertions(+), 132 deletions(-)

diff --git a/README.md b/README.md
index 6a40e3f..d0c191a 100644
--- a/README.md
+++ b/README.md
@@ -45,7 +45,29 @@ biocLite(c("edgeR","getopt", "MASS"))
 ####Windows
 Install Linux.
 
-Objects and Methods
+Scripts
+=======
+Executable scripts to carry out most of the listed functions are available in the `bin`:
+
+* `check_tradis_tags` - Prints 1 if tags are present, prints 0 if not.
+* `add_tradis_tags` - Generates a BAM file with tags added to read strings.
+* `filter_tradis_tags` - Create a fastq file containing reads that match the supplied tag
+* `remove_tradis_tags` - Creates a fastq file containing reads with the supplied tag removed from the sequences
+* `tradis_plot` - Creates an gzipped insertion site plot
+* `bacteria_tradis` - Runs complete analysis, starting with a fastq file and produces mapped BAM files and plot files for each file in the given file list and a statistical summary of all files. Note that the -f option expects a text file containing a list of fastq files, one per line.
+
+A help menu for each script can be accessed by running the script with no parameters
+
+Analysis Scripts
+================
+Three scripts are provided to perform basic analysis of TraDIS results in `bin`:
+
+* `tradis_gene_insert_sites` - Takes genome annotation in embl format along with plot files produced by bacteria_tradis and generates tab-delimited files containing gene-wise annotations of insert sites and read counts.
+* `tradis_essentiality.R` - Takes a single tab-delimited file from tradis_gene_insert_sites to produce calls of gene essentiality. Also produces a number of diagnostic plots.
+* `tradis_comparison.R` - Takes tab files to compare two growth conditions using edgeR. This analysis requires experimental replicates.
+
+
+Internal Objects and Methods
 ===================
 ####Bio::Tradis::DetectTags
 * Required parameters:
@@ -136,8 +158,9 @@ Objects and Methods
 * Methods:
 	* `run_tradis` - run complete analysis
 
-Examples
+Perl Programming Examples
 ========
+You can reuse the Perl modules as part of other Perl scripts. This section provides example Perl code.
 Check whether `file.bam` contains TraDIS tag fields and, if so, adds the tags
 to the reads' sequence and quality strings.
 
@@ -189,23 +212,3 @@ Bio::Tradis::RunTradis(
 	mismatch => 1
 )->run_tradis;
 ```
-Scripts
-=======
-Executable scripts to carry out most of the listed functions are available in the `bin`:
-
-* `check_tradis_tags` - Prints 1 if tags are present, prints 0 if not.
-* `add_tradis_tags` - Generates a BAM file with tags added to read strings.
-* `filter_tradis_tags` - Create a fastq file containing reads that match the supplied tag
-* `remove_tradis_tags` - Creates a fastq file containing reads with the supplied tag removed from the sequences
-* `tradis_plot` - Creates an gzipped insertion site plot
-* `bacteria_tradis` - Runs complete analysis, starting with a fastq file and produces mapped BAM files and plot files for each file in the given file list and a statistical summary of all files. Note that the -f option expects a text file containing a list of fastq files, one per line.
-
-A help menu for each script can be accessed by running the script with no parameters
-
-Analysis Scripts
-================
-Three scripts are provided to perform basic analysis of TraDIS results in `bin`:
-
-* `tradis_gene_insert_sites` - Takes genome annotation in embl format along with plot files produced by bacteria_tradis and generates tab-delimited files containing gene-wise annotations of insert sites and read counts.
-* `tradis_essentiality.R` - Takes a single tab-delimited file from tradis_gene_insert_sites to produce calls of gene essentiality. Also produces a number of diagnostic plots.
-* `tradis_comparison.R` - Takes tab files to compare two growth conditions using edgeR. This analysis requires experimental replicates.
diff --git a/bin/tradis_essentiality.R b/bin/tradis_essentiality.R
index 6626e82..d2c094d 100755
--- a/bin/tradis_essentiality.R
+++ b/bin/tradis_essentiality.R
@@ -21,25 +21,25 @@ STM_baseline <- read.table(input, sep="\t",header=TRUE,stringsAsFactors=F, quote
 ii <- STM_baseline$ins_index
 
 #identify second maxima
-h <- hist(ii, breaks=100,plot=FALSE)
-maxindex <- which.max(h$density[3:length(h$density)])
-maxval <- h$mids[maxindex+2]
+h <- hist(ii, breaks=200,plot=FALSE)
+maxindex <- which.max(h$density[10:length(h$density)])
+maxval <- h$mids[maxindex+3]
 
 # print pdf of loess curve and later on, histogram
 pdf(paste(input, "QC_and_changepoint_plots", "pdf", sep = "."))
 
 #find inter-mode minima with loess
 nG <- length(STM_baseline$read_count)
-r <- floor(maxval *1000)
-I = ii < r / 1000
-h1 = hist(ii[I],breaks=(0:r/1000))
+r <- floor(maxval *2000)
+I = ii < r / 2000
+h1 = hist(ii[I],breaks=(0:r/2000))
 lo <- loess(h1$density ~ c(1:length(h1$density))) #loess smothing over density
 plot(h1$density, main="Density")
 lines(predict(lo),col='red',lwd=2)
 m = h1$mids[which.min(predict(lo))]
 I1 = ((ii < m)&(ii >= 0))
 
-h = hist(ii, breaks=100,plot=FALSE) 
+h = hist(ii, breaks="FD",plot=FALSE) 
 I2 = ((ii >= m)&(ii < h$mids[max(which(h$counts>5))]))
 f1 = (sum(I1) + sum(ii == 0))/nG
 f2 = (sum(I2))/nG
@@ -51,14 +51,14 @@ d2 = fitdistr(ii[I2], "gamma") #fit curves
 #pdf("Loess_and_changepoint_estimation.pdf")
 
 #plots
-hist(ii,breaks=200, xlim=c(0,0.1), freq=FALSE,xlab="Insertion index", main="Gamma fits")
-lines(0:50/500, f1*dgamma(0:50/500, 1, d1$estimate[1])) # was [2]
-lines(0:50/500, f2*dgamma(0:50/500, d2$estimate[1], d2$estimate[2]))
+hist(ii,breaks="FD", xlim=c(0,max(ii)), freq=FALSE,xlab="Insertion index", main="Gamma fits")
+lines(0:200/500, f1*dgamma(0:200/500, 1, d1$estimate[1])) # was [2]
+lines(0:200/500, f2*dgamma(0:200/500, d2$estimate[1], d2$estimate[2]))
 # print changepoint
 
 #calculate log-odds ratios to choose thresholds
-lower <- max(which(log((pgamma(1:500/10000, d2$e[1],d2$e[2])*(1-pgamma(1:500/10000, 1,d1$e[1], lower.tail=FALSE)))/(pgamma(1:500/10000, 1,d1$e[1], lower.tail=FALSE)*(1-pgamma(1:500/10000, d2$e[1],d2$e[2]))) , base=2) < -2))
-upper <- min(which(log((pgamma(1:500/10000, d2$e[1],d2$e[2])*(1-pgamma(1:500/10000, 1,d1$e[1], lower.tail=FALSE)))/(pgamma(1:500/10000, 1,d1$e[1], lower.tail=FALSE)*(1-pgamma(1:500/10000, d2$e[1],d2$e[2]))) , base=2) > 2))
+lower <- max(which(log((pgamma(1:1000/10000, d2$e[1],d2$e[2])*(1-pgamma(1:1000/10000, 1,d1$e[1], lower.tail=FALSE)))/(pgamma(1:1000/10000, 1,d1$e[1], lower.tail=FALSE)*(1-pgamma(1:1000/10000, d2$e[1],d2$e[2]))) , base=2) < -2))
+upper <- min(which(log((pgamma(1:1000/10000, d2$e[1],d2$e[2])*(1-pgamma(1:1000/10000, 1,d1$e[1], lower.tail=FALSE)))/(pgamma(1:1000/10000, 1,d1$e[1], lower.tail=FALSE)*(1-pgamma(1:1000/10000, d2$e[1],d2$e[2]))) , base=2) > 2))
 
 essen <- lower/10000
 ambig <- upper/10000
diff --git a/dist.ini b/dist.ini
index 623def7..f603027 100644
--- a/dist.ini
+++ b/dist.ini
@@ -3,7 +3,7 @@ author  = Carla Cummins <path-help at sanger.ac.uk>
 license = GPL_3
 copyright_holder = Wellcome Trust Sanger Institute
 copyright_year   = 2013
-version = 1.3.1
+version = 1.3.3
 
 [MetaResources]
 homepage        = http://www.sanger.ac.uk/
diff --git a/lib/Bio/Tradis/AddTagsToSeq.pm b/lib/Bio/Tradis/AddTagsToSeq.pm
index a4a1dd6..daada0e 100644
--- a/lib/Bio/Tradis/AddTagsToSeq.pm
+++ b/lib/Bio/Tradis/AddTagsToSeq.pm
@@ -82,9 +82,14 @@ sub add_tags_to_seq {
     my $outfile   = $self->outfile;
 
     #open temp file in SAM format and output headers from current BAM to it
+    my @now = localtime();
+    my $timeStamp = sprintf("%04d%02d%02d%02d%02d%02d",
+                        $now[5]+1900, $now[4]+1, $now[3],
+                        $now[2],      $now[1],   $now[0]);
+    my $tmp_sam = "tmp.$timeStamp.sam";
     print STDERR "Reading ".uc($self->_file_extension)." header\n" if($self->verbose);
-    system($self->samtools_exec." view -H $filename > tmp.sam");
-    open( TMPFILE, '>>tmp.sam' );
+    system($self->samtools_exec." view -H $filename > $tmp_sam");
+    open( TMPFILE, ">>$tmp_sam" );
 
     #open BAM file
     print STDERR "Reading ".uc($self->_file_extension)." file\n" if($self->verbose);
@@ -162,7 +167,7 @@ sub add_tags_to_seq {
     print STDERR "Convert SAM to ".uc($self->_file_extension)."\n" if($self->verbose);
     
     
-    system($self->samtools_exec." view -h -S ".$self->_output_switch." -o $outfile tmp.sam");
+    system($self->samtools_exec." view -h -S ".$self->_output_switch." -o $outfile $tmp_sam");
 
     if ( $self->_number_of_lines_in_bam_file($outfile) !=
         $self->_number_of_lines_in_bam_file($filename) )
@@ -172,7 +177,7 @@ sub add_tags_to_seq {
     }
 
     #remove tmp file
-    unlink("tmp.sam");
+    unlink("$tmp_sam");
     return 1;
 }
 
diff --git a/lib/Bio/Tradis/CombinePlots.pm b/lib/Bio/Tradis/CombinePlots.pm
index 09d2750..1ded07e 100644
--- a/lib/Bio/Tradis/CombinePlots.pm
+++ b/lib/Bio/Tradis/CombinePlots.pm
@@ -15,11 +15,12 @@ For example, an input file named plots_to_combine.txt:
     tradis3 plot3.1.gz  plot3.2.gz plot3.3.gz   plot3.4.gz
 
 will produce 
+
 =over
 
-=item 1. a directory named combined with 3 files - tradis1.insertion_site_plot.gz,
+1. a directory named combined with 3 files - tradis1.insertion_site_plot.gz,
 tradis2.insertion_site_plot.gz, tradis3.insertion_site_plot.gz
-=item 2. a stats file named plots_to_combine.stats
+2. a stats file named plots_to_combine.stats
 
 =back
 
diff --git a/lib/Bio/Tradis/CommandLine/TradisAnalysis.pm b/lib/Bio/Tradis/CommandLine/TradisAnalysis.pm
index 12449b4..7460617 100644
--- a/lib/Bio/Tradis/CommandLine/TradisAnalysis.pm
+++ b/lib/Bio/Tradis/CommandLine/TradisAnalysis.pm
@@ -96,8 +96,8 @@ sub BUILD {
     $self->smalt_k($smalt_k)                 if ( defined($smalt_k) );
     $self->smalt_s($smalt_s)                 if ( defined($smalt_s) );
     $self->smalt_y($smalt_y)                 if ( defined($smalt_y) );
-    $self->smalt_r($smalt_r)		             if ( defined($smalt_r) );
-		$self->smalt_n($smalt_n)		             if ( defined($smalt_n) );
+    $self->smalt_r($smalt_r)		         if ( defined($smalt_r) );
+	$self->smalt_n($smalt_n)		         if ( defined($smalt_n) );
     $self->help($help)                       if ( defined($help) );
     $self->verbose($verbose)                 if ( defined($verbose));
     $self->samtools_exec($samtools_exec)     if ( defined($samtools_exec) );
@@ -153,7 +153,7 @@ sub run {
             smalt_s          => $self->smalt_s,
             smalt_y          => $self->smalt_y,
             smalt_r          => $self->smalt_r,
-						smalt_n          => $self->smalt_n,
+			smalt_n          => $self->smalt_n,
             verbose          => $self->verbose,
             samtools_exec    => $self->samtools_exec
         );
diff --git a/lib/Bio/Tradis/CommandLine/TradisBam.pm b/lib/Bio/Tradis/CommandLine/TradisBam.pm
index 2c80835..be43917 100644
--- a/lib/Bio/Tradis/CommandLine/TradisBam.pm
+++ b/lib/Bio/Tradis/CommandLine/TradisBam.pm
@@ -22,11 +22,6 @@ has 'outfile'     => (
     is       => 'rw',
     isa      => 'Str',
     required => 0,
-    default  => sub {
-        my $o = $self->bamfile;
-        $o =~ s/\.bam/\.tr\.bam/;
-        return $o;
-    }
 );
 has 'help' => ( is => 'rw', isa => 'Bool', required => 0 );
 has 'verbose'       => ( is => 'rw', isa => 'Bool', default => 0 );
@@ -47,7 +42,15 @@ sub BUILD {
     );
 
     $self->bamfile( abs_path($bamfile) ) if ( defined($bamfile) );
-    $self->outfile( abs_path($outfile) ) if ( defined($outfile) );
+    if (defined($outfile)) {
+        $self->outfile( abs_path($outfile) )
+    }
+    else {
+        my $o = $self->bamfile;
+        $o =~ s/\.bam/\.tr\.bam/;
+        $self->outfile( abs_path($o) );
+    }
+
     $self->help($help)                   if ( defined($help) );
     $self->verbose($verbose)             if ( defined($verbose) );
     $self->samtools_exec($samtools_exec) if ( defined($samtools_exec) );
diff --git a/t/Bio/Tradis/AddTagsToSeq.t b/t/Bio/Tradis/AddTagsToSeq.t
index 030acc6..4d335a9 100644
--- a/t/Bio/Tradis/AddTagsToSeq.t
+++ b/t/Bio/Tradis/AddTagsToSeq.t
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 use File::Temp;
-use File::Slurp;
+use Test::Files qw(compare_ok);
 
 BEGIN { unshift( @INC, './lib' ) }
 BEGIN { unshift( @INC, '../lib' ) }
@@ -34,9 +34,9 @@ ok( $obj->add_tags_to_seq,  'testing output' );
 ok( -e 't/data/output.bam', 'checking file existence' );
 `$samtools_exec view -h -o t/data/output.sam t/data/output.bam`;
 `$samtools_exec view -h -o t/data/AddTags/expected_tradis.sam t/data/AddTags/expected_tradis.bam`;
-is(
-    read_file('t/data/output.sam'),
-    read_file('t/data/AddTags/expected_tradis.sam'),
+compare_ok(
+    't/data/output.sam',
+    't/data/AddTags/expected_tradis.sam',
     'checking file contents'
 );
 
@@ -53,9 +53,10 @@ ok(
 ok( -e 't/data/output.bam', 'checking file existence' );
 `$samtools_exec view -h -o t/data/output.sam t/data/output.bam`;
 `$samtools_exec view -h -o t/data/AddTags/sample_sm_no_tr.sam t/data/AddTags/sample_sm_no_tr.bam`;
-is(
-    read_file('t/data/AddTags/sample_sm_no_tr.sam'),
-    read_file('t/data/output.sam'),
+
+compare_ok (
+    't/data/AddTags/sample_sm_no_tr.sam',
+    't/data/output.sam',
     'checking file contents'
 );
 
@@ -82,9 +83,9 @@ ok( $obj->add_tags_to_seq,  'testing output' );
 ok( -e 't/data/output.cram', 'checking file existence' );
 `$samtools_exec view -h -o t/data/output.sam t/data/output.cram`;
 `$samtools_exec view -h -o t/data/AddTags/expected_tradis.sam t/data/AddTags/expected_tradis.cram`;
-is(
-    read_file('t/data/output.sam'),
-    read_file('t/data/AddTags/expected_tradis.sam'),
+compare_ok(
+    't/data/output.sam',
+    't/data/AddTags/expected_tradis.sam',
     'checking file contents'
 );
 
diff --git a/t/Bio/Tradis/CombinePlots.t b/t/Bio/Tradis/CombinePlots.t
index 65004be..f61d31e 100644
--- a/t/Bio/Tradis/CombinePlots.t
+++ b/t/Bio/Tradis/CombinePlots.t
@@ -1,7 +1,7 @@
 #!/usr/bin/env perl
 use strict;
 use warnings;
-use File::Slurp;
+use Test::Files qw(compare_ok);
 use Cwd;
 use File::Path qw( remove_tree );
 
@@ -35,20 +35,20 @@ ok(
 );
 
 system("gunzip -c combined/first.insert_site_plot.gz > first.test.plot");
-is(
-    read_file('first.test.plot'),
-    read_file('t/data/CombinePlots/first.expected.plot'),
+compare_ok(
+    'first.test.plot',
+    't/data/CombinePlots/first.expected.plot',
     'checking first file contents'
 );
 system("gunzip -c combined/second.insert_site_plot.gz > second.test.plot");
-is(
-    read_file('second.test.plot'),
-    read_file('t/data/CombinePlots/second.expected.plot'),
+compare_ok(
+    'second.test.plot',
+    't/data/CombinePlots/second.expected.plot',
     'checking second file contents'
 );
-is(
-	read_file('comb_sample.stats'),
-	read_file('t/data/CombinePlots/comb_expected.stats'),
+compare_ok(
+	'comb_sample.stats',
+	't/data/CombinePlots/comb_expected.stats',
 	'checking stats file contents'
 );
 
@@ -75,14 +75,14 @@ ok(
 
 
 system("gunzip -c combined/zip_combined.insert_site_plot.gz > zip_combined.test.plot");
-is(
-    read_file('zip_combined.test.plot'),
-    read_file('t/data/CombinePlots/zip_comb_exp.plot'),
+compare_ok(
+    'zip_combined.test.plot',
+    't/data/CombinePlots/zip_comb_exp.plot',
     'checking zipped file contents'
 );
-is(
-	read_file('zip_comb_list.stats'),
-	read_file('t/data/CombinePlots/zip_comb_exp.stats'),
+compare_ok(
+	'zip_comb_list.stats',
+	't/data/CombinePlots/zip_comb_exp.stats',
 	'checking stats file contents'
 );
 
diff --git a/t/Bio/Tradis/CommandLine/TradisAnalysis.t b/t/Bio/Tradis/CommandLine/TradisAnalysis.t
index fb10610..532c45b 100644
--- a/t/Bio/Tradis/CommandLine/TradisAnalysis.t
+++ b/t/Bio/Tradis/CommandLine/TradisAnalysis.t
@@ -4,7 +4,6 @@ use warnings;
 use Cwd;
 use File::Path 'rmtree';
 use File::Temp;
-use File::Slurp;
 
 BEGIN { unshift( @INC, './lib' ) }
 BEGIN { unshift( @INC, '../lib' ) }
diff --git a/t/Bio/Tradis/FilterTags.t b/t/Bio/Tradis/FilterTags.t
index 3441ce0..946dd8c 100644
--- a/t/Bio/Tradis/FilterTags.t
+++ b/t/Bio/Tradis/FilterTags.t
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 use File::Temp;
-use File::Slurp;
+use Test::Files;
 
 BEGIN { unshift( @INC, './lib' ) }
 BEGIN { unshift( @INC, '../lib' ) }
@@ -30,9 +30,9 @@ ok(
 );
 ok( $obj->filter_tags, 'testing output' );
 ok( -e 'output.fastq', 'checking file existence' );
-is(
-    read_file('output.fastq'),
-    read_file('t/data/FilterTags/expected.caa.fastq'),
+compare_ok(
+    'output.fastq',
+    't/data/FilterTags/expected.caa.fastq',
     'checking file contents'
 );
 
@@ -48,9 +48,9 @@ ok(
 );
 ok( $obj->filter_tags, 'testing output' );
 ok( -e 'output.fastq', 'checking file existence' );
-is(
-    read_file('output.fastq'),
-    read_file('t/data/FilterTags/expected.1mm.caa.fastq'),
+compare_ok(
+    'output.fastq',
+    't/data/FilterTags/expected.1mm.caa.fastq',
     'checking file contents'
 );
 
@@ -68,9 +68,9 @@ ok(
 );
 ok( $obj->filter_tags, 'testing output' );
 ok( -e 'output.fastq', 'checking file existence' );
-is(
-    read_file('output.fastq'),
-    read_file('t/data/FilterTags/expected.tna.fastq'),
+compare_ok(
+    'output.fastq',
+    't/data/FilterTags/expected.tna.fastq',
     'checking file contents'
 );
 
@@ -89,9 +89,9 @@ ok(
 );
 ok( $obj->filter_tags, 'testing output' );
 ok( -e 'output.fastq', 'checking file existence' );
-is(
-    read_file('output.fastq'),
-    read_file('t/data/FilterTags/expected.caa.fastq'),
+compare_ok(
+    'output.fastq',
+    't/data/FilterTags/expected.caa.fastq',
     'checking file contents'
 );
 
diff --git a/t/Bio/Tradis/Map.t b/t/Bio/Tradis/Map.t
index c58161d..e3d6e08 100644
--- a/t/Bio/Tradis/Map.t
+++ b/t/Bio/Tradis/Map.t
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 use File::Temp;
-use File::Slurp;
+use Test::Files;
 
 BEGIN { 
         unshift( @INC, '../lib' );
@@ -41,9 +41,9 @@ ok( $obj->do_mapping,           'testing reference indexing' );
 ok( -e 't/data/Map/mapped.out', 'checking index file existence' );
 system("grep -v ^\@ t/data/Map/mapped.out > mapped.nohead.out");
 system("grep -v ^\@ t/data/Map/expected.mapped > expected.nohead.mapped");
-is(
-    read_file('mapped.nohead.out'),
-    read_file('expected.nohead.mapped'),
+compare_ok(
+    'mapped.nohead.out',
+    'expected.nohead.mapped',
     'checking file contents'
 );
 
diff --git a/t/Bio/Tradis/Parser/Bam.t b/t/Bio/Tradis/Parser/Bam.t
index ce9f743..7607245 100644
--- a/t/Bio/Tradis/Parser/Bam.t
+++ b/t/Bio/Tradis/Parser/Bam.t
@@ -2,7 +2,6 @@
 use strict;
 use warnings;
 use File::Temp;
-use File::Slurp;
 
 BEGIN { unshift( @INC, './lib' ) }
 BEGIN { unshift( @INC, '../lib' ) }
diff --git a/t/Bio/Tradis/Parser/Cigar.t b/t/Bio/Tradis/Parser/Cigar.t
index f6a4d78..b765336 100755
--- a/t/Bio/Tradis/Parser/Cigar.t
+++ b/t/Bio/Tradis/Parser/Cigar.t
@@ -2,7 +2,6 @@
 use strict;
 use warnings;
 use File::Temp;
-use File::Slurp;
 
 BEGIN { unshift( @INC, './lib' ) }
 BEGIN { unshift( @INC, '../lib' ) }
diff --git a/t/Bio/Tradis/Parser/Fastq.t b/t/Bio/Tradis/Parser/Fastq.t
index 5452d25..01443a8 100644
--- a/t/Bio/Tradis/Parser/Fastq.t
+++ b/t/Bio/Tradis/Parser/Fastq.t
@@ -2,8 +2,6 @@
 use strict;
 use warnings;
 use File::Temp;
-use File::Slurp;
-
 BEGIN { unshift( @INC, './lib' ) }
 BEGIN { unshift( @INC, '../lib' ) }
 
diff --git a/t/Bio/Tradis/RemoveTags.t b/t/Bio/Tradis/RemoveTags.t
index f2289c9..f725e4a 100644
--- a/t/Bio/Tradis/RemoveTags.t
+++ b/t/Bio/Tradis/RemoveTags.t
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 use File::Temp;
-use File::Slurp;
+use Test::Files qw(compare_ok);
 
 BEGIN { unshift( @INC, './lib' ) }
 BEGIN { unshift( @INC, '../lib' ) }
@@ -32,9 +32,9 @@ ok(
 );
 ok( $obj->remove_tags,        'testing output' );
 ok( -e 't/data/output.fastq', 'checking file existence' );
-is(
-    read_file('t/data/output.fastq'),
-    read_file('t/data/RemoveTags/expected.rm.caa.fastq'),
+compare_ok(
+    't/data/output.fastq',
+    't/data/RemoveTags/expected.rm.caa.fastq',
     'checking file contents'
 );
 
@@ -50,9 +50,9 @@ ok(
 );
 ok( $obj->remove_tags,        'testing output' );
 ok( -e 't/data/output.fastq', 'checking file existence' );
-is(
-    read_file('t/data/output.fastq'),
-    read_file('t/data/RemoveTags/expected.rm.1mm.caa.fastq'),
+compare_ok(
+    't/data/output.fastq',
+    't/data/RemoveTags/expected.rm.1mm.caa.fastq',
     'checking file contents'
 );
 
@@ -70,9 +70,9 @@ ok(
 );
 ok( $obj->remove_tags,        'testing output' );
 ok( -e 't/data/output.fastq', 'checking file existence' );
-is(
-    read_file('t/data/output.fastq'),
-    read_file('t/data/RemoveTags/expected.rm.tna.fastq'),
+compare_ok(
+    't/data/output.fastq',
+    't/data/RemoveTags/expected.rm.tna.fastq',
     'checking file contents'
 );
 
diff --git a/t/Bio/Tradis/RunTradis.t b/t/Bio/Tradis/RunTradis.t
index 3e78f03..0bf23a3 100644
--- a/t/Bio/Tradis/RunTradis.t
+++ b/t/Bio/Tradis/RunTradis.t
@@ -4,7 +4,7 @@ use warnings;
 use Cwd;
 use File::Path 'rmtree';
 use File::Temp;
-use File::Slurp;
+use Test::Files qw(compare_ok);
 
 BEGIN { unshift( @INC, './lib' ) }
 BEGIN { unshift( @INC, '../lib' ) }
@@ -52,9 +52,9 @@ ok(
     -e "$temp_directory/filter.fastq",
     'checking filtered file existence - Normal files, no mismatch'
 );
-is(
-    read_file("$temp_directory/filter.fastq"),
-    read_file('t/data/RunTradis/filtered.fastq'),
+compare_ok(
+    "$temp_directory/filter.fastq",
+    't/data/RunTradis/filtered.fastq',
     'checking filtered file contents - Normal files, no mismatch'
 );
 
@@ -78,9 +78,9 @@ system("mv $temp_directory/filter.fastq.bak $temp_directory/filter.fastq");
 ok( $obj->_remove, 'testing tag removal' );
 ok( -e "$temp_directory/tags_removed.fastq",
     'checking de-tagged file existence - Normal files, no mismatch' );
-is(
-    read_file("$temp_directory/tags_removed.fastq"),
-    read_file('t/data/RunTradis/notags.fastq'),
+compare_ok(
+    "$temp_directory/tags_removed.fastq",
+    't/data/RunTradis/notags.fastq',
     'checking de-tagged file contents - Normal files, no mismatch'
 );
 
@@ -89,8 +89,11 @@ ok( $obj->_map,                             'testing mapping' );
 ok( -e "$temp_directory/mapped.sam", 'checking SAM existence' );
 `grep -v "\@PG" $temp_directory/mapped.sam > $output_directory/tmp1.sam`;
 `grep -v "\@PG" t/data/RunTradis/mapped.sam > $output_directory/tmp2.sam`;
-is( read_file("$output_directory/tmp1.sam"), read_file("$output_directory/tmp2.sam"),
-    'checking mapped file contents' );
+compare_ok( 
+    "$output_directory/tmp1.sam", 
+    "$output_directory/tmp2.sam",
+    'checking mapped file contents' 
+);
 
 # Conversion
 ok( $obj->_sam2bam,                         'testing SAM/BAM conversion' );
@@ -116,9 +119,9 @@ system(
 "gunzip -c $temp_directory/test.plot.AE004091.insert_site_plot.gz > $output_directory/test.plot.unzipped"
 );
 system("gunzip -c t/data/RunTradis/expected.plot.gz > $output_directory/expected.plot.unzipped");
-is(
-    read_file("$output_directory/test.plot.unzipped"),
-    read_file("$output_directory/expected.plot.unzipped"),
+compare_ok(
+    "$output_directory/test.plot.unzipped",
+    "$output_directory/expected.plot.unzipped",
     'checking plot file contents - Normal files, no mismatch'
 );
 
@@ -129,9 +132,9 @@ ok( -e "$output_directory/test.plot.AE004091.insert_site_plot.gz",
     'checking plot file existence - Normal files, no mismatch' );
 system("gunzip -c $output_directory/test.plot.AE004091.insert_site_plot.gz > $output_directory/test.plot.unzipped");
 system("gunzip -c t/data/RunTradis/expected.plot.gz > $output_directory/expected.plot.unzipped");
-is(
-    read_file("$output_directory/test.plot.unzipped"),
-    read_file("$output_directory/expected.plot.unzipped"),
+compare_ok(
+    "$output_directory/test.plot.unzipped",
+    "$output_directory/expected.plot.unzipped",
     'checking completed pipeline file contents - Normal files, no mismatch'
 );
 
@@ -168,9 +171,9 @@ ok( -e "$output_directory/test.plot.AE004091.insert_site_plot.gz",
 system("gunzip -c $output_directory/test.plot.AE004091.insert_site_plot.gz > $output_directory/test.plot.unzipped");
 system(
     "gunzip -c t/data/RunTradis/expected.1mm.plot.gz > $output_directory/expected.plot.unzipped");
-is(
-    read_file("$output_directory/test.plot.unzipped"),
-    read_file("$output_directory/expected.plot.unzipped"),
+compare_ok(
+    "$output_directory/test.plot.unzipped",
+    "$output_directory/expected.plot.unzipped",
     'checking completed pipeline with mismatch file contents - Normal files one mismatch'
 );
 
@@ -208,9 +211,9 @@ ok( -e "$output_directory/test.plot.mapped.bam.bai", 'checking indexed bam file
 
 system("gunzip -c $output_directory/test.plot.AE004091.insert_site_plot.gz > $output_directory/test.plot.unzipped");
 system("gunzip -c t/data/RunTradis/expected.plot.gz > $output_directory/expected.plot.unzipped");
-is(
-    read_file("$output_directory/test.plot.unzipped"),
-    read_file("$output_directory/expected.plot.unzipped"),
+compare_ok(
+    "$output_directory/test.plot.unzipped",
+    "$output_directory/expected.plot.unzipped",
     'checking completed pipeline with gzipped data file contents - Normal files one mismatch'
 );
 
diff --git a/t/Bio/Tradis/TradisPlot.t b/t/Bio/Tradis/TradisPlot.t
index 6efe43a..298cf73 100644
--- a/t/Bio/Tradis/TradisPlot.t
+++ b/t/Bio/Tradis/TradisPlot.t
@@ -2,8 +2,7 @@
 use strict;
 use warnings;
 use File::Temp;
-use File::Slurp;
-use Test::Files;
+use Test::Files qw(compare_ok);
 
 BEGIN { unshift( @INC, './lib' ) }
 BEGIN { unshift( @INC, '../lib' ) }
@@ -36,7 +35,11 @@ ok( -e 'test.plot.AE004091.insert_site_plot.gz',
 
 system("gunzip -c test.plot.AE004091.insert_site_plot.gz > test.plot.unzipped");
 system("gunzip -c t/data/TradisPlot/expected.plot.gz > expected.plot.unzipped");
-compare_ok('test.plot.unzipped','expected.plot.unzipped','checking file contents');
+compare_ok(
+	'test.plot.unzipped',
+	'expected.plot.unzipped',
+	'checking file contents'
+);
 
 unlink('test.plot.AE004091.insert_site_plot.gz');
 unlink('expected.plot.unzipped');

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/bio-tradis.git



More information about the debian-med-commit mailing list