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

filter: Statementstmt 0.0% 0 / 41 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 67 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::AddTags;
2 $Bio::Tradis::CommandLine::AddTags::VERSION = '1.4.5';
3 # ABSTRACT: Add given tags to 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::AddTagsToSeq;
10  
11 has 'args' => ( is => 'ro', isa => 'ArrayRef', required => 1 );
12 has 'script_name' => ( is => 'ro', isa => 'Str', required => 1 );
13 has 'bamfile' => ( is => 'rw', isa => 'Str', required => 0 );
14 has 'help' => ( is => 'rw', isa => 'Bool', required => 0 );
15 has 'outfile' => ( is => 'rw', isa => 'Str', required => 0 );
16  
17 has 'verbose' => ( is => 'rw', isa => 'Bool', default => 0 );
18 has 'samtools_exec' => ( is => 'rw', isa => 'Str', default => 'samtools' );
19  
20 sub BUILD {
21 my ($self) = @_;
22  
23 my ( $bamfile, $outfile, $help, $verbose, $samtools_exec);
24  
25 GetOptionsFromArray(
26 $self->args,
27 'b|bamfile=s' => \$bamfile,
28 'o|outfile=s' => \$outfile,
29 'h|help' => \$help,
30 'v|verbose' => \$verbose,
31 'samtools_exec=s' => \$samtools_exec,
32 );
33  
34 $self->bamfile( abs_path($bamfile) ) if ( defined($bamfile) );
35 $self->outfile( abs_path($outfile) ) if ( defined($outfile) );
36 $self->help($help) if ( defined($help) );
37 $self->verbose($verbose) if ( defined($verbose) );
38 $self->samtools_exec($samtools_exec) if ( defined($samtools_exec) );
39  
40 # print usage text if required parameters are not present
41 ($bamfile) or die $self->usage_text;
42 }
43  
44 sub run {
45 my ($self) = @_;
46  
47 if ( defined( $self->help ) ) {
48 #if ( scalar( @{ $self->args } ) == 0 ) {
49 $self->usage_text;
50 }
51  
52 my $tagadd = Bio::Tradis::AddTagsToSeq->new(
53 bamfile => $self->bamfile,
54 outfile => $self->outfile,
55 verbose => $self->verbose,
56 samtools_exec => $self->samtools_exec
57 );
58 $tagadd->add_tags_to_seq;
59 }
60  
61 sub usage_text {
62 print <<USAGE;
63 Adds transposon sequence and quality tags to the read strings and
64 outputs a BAM.
65  
66 Usage: add_tags -b file.bam [options]
67  
68 Options:
69 -b : bam file with tradis tags
70 -o : output BAM name (optional. default: <file>.tr.bam)
71 -v : verbose debugging output
72  
73 USAGE
74 exit;
75 }
76  
77 __PACKAGE__->meta->make_immutable;
78 no Moose;
79 1;
80  
81 __END__