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

filter: Statementstmt 0.0% 0 / 36 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 2 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 57 CC 5 SCAR 21.6
CC
5
Cov
0%
BUILD
20.0
run
6.0
usage_text
2.0
CRAP 8.7
1 package Bio::Tradis::CommandLine::AddTags;
2  
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 sub BUILD {
18 my ($self) = @_;
19  
20 my ( $bamfile, $outfile, $help );
21  
22 GetOptionsFromArray(
23 $self->args,
24 'b|bamfile=s' => \$bamfile,
25 'o|outfile=s' => \$outfile,
26 'h|help' => \$help
27 );
28  
29 $self->bamfile( abs_path($bamfile) ) if ( defined($bamfile) );
30 $self->outfile( abs_path($outfile) ) if ( defined($outfile) );
31 $self->help($help) if ( defined($help) );
32  
33 # print usage text if required parameters are not present
34 ($bamfile) or die $self->usage_text;
35 }
36  
37 sub run {
38 my ($self) = @_;
39  
40 if ( defined( $self->help ) ) {
41 #if ( scalar( @{ $self->args } ) == 0 ) {
42 $self->usage_text;
43 }
44  
45 my $tagadd = Bio::Tradis::AddTagsToSeq->new(
46 bamfile => $self->bamfile,
47 outfile => $self->outfile
48 );
49 $tagadd->add_tags_to_seq;
50 }
51  
52 sub usage_text {
53 print <<USAGE;
54 Adds transposon sequence and quality tags to the read strings and
55 outputs a BAM.
56  
57 Usage: add_tags -b file.bam [options]
58  
59 Options:
60 -b : bam file with tradis tags
61 -o : output BAM name (optional. default: <file>.tr.bam)
62  
63 USAGE
64 exit;
65 }
66  
67 __PACKAGE__->meta->make_immutable;
68 no Moose;
69 1;
70  
71 __END__
72  
73 =pod
74  
75 =head1 NAME
76  
77 Bio::Tradis::CommandLine::AddTags - Add given tags to the start of the sequence
78  
79 =head1 VERSION
80  
81 version 1.132190
82  
83 =head1 SYNOPSIS
84  
85 Adds given tags to the start of the sequence
86  
87 =head1 AUTHOR
88  
89 Carla Cummins <cc21@sanger.ac.uk>
90  
91 =head1 COPYRIGHT AND LICENSE
92  
93 This software is Copyright (c) 2013 by Wellcome Trust Sanger Institute.
94  
95 This is free software, licensed under:
96  
97 The GNU General Public License, Version 3, June 2007
98  
99 =cut