| 1 | package Bio::Tradis::CommandLine::CheckTags; | ||
| 2 | |||
| 3 | # ABSTRACT: Check for presence of tr tag in BAM file | ||
| 4 | |||
| 5 | |||
| 6 | use Moose; | ||
| 7 | use Getopt::Long qw(GetOptionsFromArray); | ||
| 8 | use Cwd 'abs_path'; | ||
| 9 | use Bio::Tradis::DetectTags; | ||
| 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 | |||
| 16 | sub BUILD { | ||
| 17 | my ($self) = @_; | ||
| 18 | |||
| 19 | my ( | ||
| 20 | $bamfile, $help | ||
| 21 | ); | ||
| 22 | |||
| 23 | GetOptionsFromArray( | ||
| 24 | $self->args, | ||
| 25 | 'b|bamfile=s' => \$bamfile, | ||
| 26 | 'h|help' => \$help | ||
| 27 | ); | ||
| 28 | |||
| 29 | $self->bamfile(abs_path($bamfile)) if ( defined($bamfile) ); | ||
| 30 | $self->help($help) if ( defined($help) ); | ||
| 31 | |||
| 32 | # print usage text if required parameters are not present | ||
| 33 | ($bamfile) or die $self->usage_text; | ||
| 34 | } | ||
| 35 | |||
| 36 | sub run { | ||
| 37 | my ($self) = @_; | ||
| 38 | |||
| 39 | if ( defined( $self->help ) ) { | ||
| 40 | #if ( scalar( @{ $self->args } ) == 0 ) { | ||
| 41 | $self->usage_text; | ||
| 42 | } | ||
| 43 | |||
| 44 | my $tagcheck = Bio::Tradis::DetectTags->new(bamfile => $self->bamfile); | ||
| 45 | print $tagcheck->tags_present . "\n"; | ||
| 46 | } | ||
| 47 | |||
| 48 | sub usage_text { | ||
| 49 | print <<USAGE; | ||
| 50 | Check for the existence of tradis tags in a bam | ||
| 51 | |||
| 52 | Usage: check_tags -b file.bam | ||
| 53 | |||
| 54 | Options: | ||
| 55 | -b : bam file with tradis tags | ||
| 56 | |||
| 57 | USAGE | ||
| 58 | exit; | ||
| 59 | } | ||
| 60 | |||
| 61 | __PACKAGE__->meta->make_immutable; | ||
| 62 | no Moose; | ||
| 63 | 1; | ||
| 64 | |||
| 65 | __END__ | ||
| 66 | |||
| 67 | =pod | ||
| 68 | |||
| 69 | =head1 NAME | ||
| 70 | |||
| 71 | Bio::Tradis::CommandLine::CheckTags - Check for presence of tr tag in BAM file | ||
| 72 | |||
| 73 | =head1 VERSION | ||
| 74 | |||
| 75 | version 1.132190 | ||
| 76 | |||
| 77 | =head1 SYNOPSIS | ||
| 78 | |||
| 79 | Check for presence of tr tag in BAM file | ||
| 80 | |||
| 81 | =head1 AUTHOR | ||
| 82 | |||
| 83 | Carla Cummins <cc21@sanger.ac.uk> | ||
| 84 | |||
| 85 | =head1 COPYRIGHT AND LICENSE | ||
| 86 | |||
| 87 | This software is Copyright (c) 2013 by Wellcome Trust Sanger Institute. | ||
| 88 | |||
| 89 | This is free software, licensed under: | ||
| 90 | |||
| 91 | The GNU General Public License, Version 3, June 2007 | ||
| 92 | |||
| 93 | =cut |