blib/lib/Bio/Tradis/CommandLine/RemoveFastqTags.pm untested

filter: Statementstmt 0.0% 0 / 41 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 72 CC 7 SCAR 29.8
CC
7
Cov
0%
BUILD
42.0
run
6.0
usage_text
2.0
CRAP 19.7
1 package Bio::Tradis::CommandLine::RemoveFastqTags;
2 $Bio::Tradis::CommandLine::RemoveFastqTags::VERSION = '1.4.5';
3 # ABSTRACT: Remove given tags from the start of the sequence
4  
5  
6 use Moose;
7 use Getopt::Long qw(GetOptionsFromArray);
8 use Cwd 'abs_path';
9 use Bio::Tradis::RemoveTags;
10  
11 has 'args' => ( is => 'ro', isa => 'ArrayRef', required => 1 );
12 has 'script_name' => ( is => 'ro', isa => 'Str', required => 1 );
13 has 'fastqfile' => ( is => 'rw', isa => 'Str', required => 0 );
14 has 'tag' => ( is => 'rw', isa => 'Str', required => 0 );
15 has 'mismatch' => ( is => 'rw', isa => 'Int', required => 0, default => 0 );
16 has 'help' => ( is => 'rw', isa => 'Bool', required => 0 );
17 has 'outfile' => ( is => 'rw', isa => 'Str', required => 0 );
18  
19 sub BUILD {
20 my ($self) = @_;
21  
22 my ( $fastqfile, $tag, $mismatch, $outfile, $help );
23  
24 GetOptionsFromArray(
25 $self->args,
26 'f|fastqfile=s' => \$fastqfile,
27 't|tag=s' => \$tag,
28 'm|mismatch=i' => \$mismatch,
29 'o|outfile=s' => \$outfile,
30 'h|help' => \$help
31 );
32  
33 $self->fastqfile( abs_path($fastqfile) ) if ( defined($fastqfile) );
34 $self->tag($tag) if ( defined($tag) );
35 $self->mismatch($mismatch) if ( defined($mismatch) );
36 $self->outfile( abs_path($outfile) ) if ( defined($outfile) );
37 $self->help($help) if ( defined($help) );
38  
39 # print usage text if required parameters are not present
40 ($fastqfile && $tag) or die $self->usage_text;
41 }
42  
43 sub run {
44 my ($self) = @_;
45  
46 if ( defined( $self->help ) ) {
47  
48 #if ( scalar( @{ $self->args } ) == 0 ) {
49 $self->usage_text;
50 }
51  
52 my $tag_rm = Bio::Tradis::RemoveTags->new(
53 fastqfile => $self->fastqfile,
54 tag => $self->tag,
55 mismatch => $self->mismatch,
56 outfile => $self->outfile
57 );
58 $tag_rm->remove_tags;
59 }
60  
61 sub usage_text {
62 print <<USAGE;
63 Removes transposon sequence and quality tags from the read strings
64  
65 Usage: remove_tags -f file.fastq [options]
66  
67 Options:
68 -f : fastq file with tradis tags
69 -t : tag to remove
70 -m : number of mismatches to allow when matching tag (optional. default = 0)
71 -o : output file name (optional. default: <file>.rmtag.fastq)
72  
73 USAGE
74 exit;
75 }
76  
77 __PACKAGE__->meta->make_immutable;
78 no Moose;
79 1;
80  
81 __END__