| 1 |
#!/usr/bin/env perl |
| 2 |
use strict; |
| 3 |
use warnings; |
| 4 |
use File::Temp; |
| 5 |
use Test::Files qw(compare_ok); |
| 6 |
|
| 7 |
BEGIN { unshift( @INC, './lib' ) } |
| 8 |
BEGIN { unshift( @INC, '../lib' ) } |
| 9 |
|
| 10 |
BEGIN { |
| 11 |
use Test::Most; |
| 12 |
use_ok('Bio::Tradis::RemoveTags'); |
| 13 |
} |
| 14 |
|
| 15 |
my $destination_directory_obj = File::Temp->newdir( CLEANUP => 1 ); |
| 16 |
my $destination_directory = $destination_directory_obj->dirname(); |
| 17 |
|
| 18 |
my ( $fastqfile, $tag, $obj ); |
| 19 |
|
| 20 |
$fastqfile = "t/data/RemoveTags/sample.caa.fastq"; |
| 21 |
$tag = "CAACGTTTT"; |
| 22 |
|
| 23 |
# Test without mismatch option |
| 24 |
ok( |
| 25 |
$obj = Bio::Tradis::RemoveTags->new( |
| 26 |
fastqfile => $fastqfile, |
| 27 |
tag => $tag, |
| 28 |
mismatch => 0, |
| 29 |
outfile => 't/data/output.fastq' |
| 30 |
), |
| 31 |
'creating object' |
| 32 |
); |
| 33 |
ok( $obj->remove_tags, 'testing output' ); |
| 34 |
ok( -e 't/data/output.fastq', 'checking file existence' ); |
| 35 |
compare_ok( |
| 36 |
't/data/output.fastq', |
| 37 |
't/data/RemoveTags/expected.rm.caa.fastq', |
| 38 |
'checking file contents' |
| 39 |
); |
| 40 |
|
| 41 |
# Test with 1 mismatch allowed |
| 42 |
ok( |
| 43 |
$obj = Bio::Tradis::RemoveTags->new( |
| 44 |
fastqfile => $fastqfile, |
| 45 |
tag => $tag, |
| 46 |
mismatch => 1, |
| 47 |
outfile => 't/data/output.fastq' |
| 48 |
), |
| 49 |
'creating object' |
| 50 |
); |
| 51 |
ok( $obj->remove_tags, 'testing output' ); |
| 52 |
ok( -e 't/data/output.fastq', 'checking file existence' ); |
| 53 |
compare_ok( |
| 54 |
't/data/output.fastq', |
| 55 |
't/data/RemoveTags/expected.rm.1mm.caa.fastq', |
| 56 |
'checking file contents' |
| 57 |
); |
| 58 |
|
| 59 |
$fastqfile = "t/data/RemoveTags/sample.tna.fastq"; |
| 60 |
$tag = "TNAGAGACAG"; |
| 61 |
|
| 62 |
ok( |
| 63 |
$obj = Bio::Tradis::RemoveTags->new( |
| 64 |
fastqfile => $fastqfile, |
| 65 |
tag => $tag, |
| 66 |
mismatch => 0, |
| 67 |
outfile => 't/data/output.fastq' |
| 68 |
), |
| 69 |
'creating object' |
| 70 |
); |
| 71 |
ok( $obj->remove_tags, 'testing output' ); |
| 72 |
ok( -e 't/data/output.fastq', 'checking file existence' ); |
| 73 |
compare_ok( |
| 74 |
't/data/output.fastq', |
| 75 |
't/data/RemoveTags/expected.rm.tna.fastq', |
| 76 |
'checking file contents' |
| 77 |
); |
| 78 |
|
| 79 |
unlink('t/data/output.fastq'); |
| 80 |
unlink('t/data/RemoveTags/expected.rm.caa.fastq'); |
| 81 |
unlink('t/data/RemoveTags/expected.rm.tna.fastq'); |
| 82 |
done_testing(); |