| 1 | package Bio::Tradis::DetectTags; | ||
| 2 | $Bio::Tradis::DetectTags::VERSION = '1.4.1'; | ||
| 3 | # ABSTRACT: Detect tr tags in BAM file | ||
| 4 | |||
| 5 | |||
| 6 | use Moose; | ||
| 7 | use Bio::Tradis::Parser::Bam | ||
| 8 | |||
| 9 | has 'bamfile' => ( is => 'ro', isa => 'Str', required => 1 ); | ||
| 10 | has 'samtools_exec' => ( is => 'rw', isa => 'Str', default => 'samtools' ); | ||
| 11 | |||
| 12 | sub tags_present { | ||
| 13 | my ($self) = @_; | ||
| 14 | my $pars = Bio::Tradis::Parser::Bam->new( file => $self->bamfile, samtools_exec => $self->samtools_exec ); | ||
| 15 | my $read_info = $pars->read_info; | ||
| 16 | $pars->next_read; | ||
| 17 | $read_info = $pars->read_info; | ||
| 18 | if(defined(${$read_info}{tr})) | ||
| 19 | { | ||
| 20 | return 1; | ||
| 21 | } | ||
| 22 | else | ||
| 23 | { | ||
| 24 | return 0; | ||
| 25 | } | ||
| 26 | |||
| 27 | } | ||
| 28 | |||
| 29 | __PACKAGE__->meta->make_immutable; | ||
| 30 | no Moose; | ||
| 31 | 1; | ||
| 32 | |||
| 33 | __END__ | ||
| 34 | |||
| 35 | =pod | ||
| 36 | |||
| 37 | =encoding UTF-8 | ||
| 38 | |||
| 39 | =head1 NAME | ||
| 40 | |||
| 41 | Bio::Tradis::DetectTags - Detect tr tags in BAM file | ||
| 42 | |||
| 43 | =head1 VERSION | ||
| 44 | |||
| 45 | version 1.4.1 | ||
| 46 | |||
| 47 | =head1 SYNOPSIS | ||
| 48 | |||
| 49 | Detects presence of tr/tq tags in BAM files from Tradis analyses | ||
| 50 | use Bio::Tradis::DetectTags; | ||
| 51 | |||
| 52 | my $pipeline = Bio::Tradis::DetectTags->new(bamfile => 'abc'); | ||
| 53 | $pipeline->tags_present(); | ||
| 54 | |||
| 55 | =head1 NAME | ||
| 56 | |||
| 57 | Bio::Tradis::DetectTags | ||
| 58 | |||
| 59 | =head1 PARAMETERS | ||
| 60 | |||
| 61 | =head2 Required | ||
| 62 | |||
| 63 | C<bamfile> - path to/name of file to check | ||
| 64 | |||
| 65 | =head1 METHODS | ||
| 66 | |||
| 67 | C<tags_present> - returns true if TraDIS tags are detected in C<bamfile> | ||
| 68 | |||
| 69 | =head1 AUTHOR | ||
| 70 | |||
| 71 | Carla Cummins <path-help@sanger.ac.uk> | ||
| 72 | |||
| 73 | =head1 COPYRIGHT AND LICENSE | ||
| 74 | |||
| 75 | This software is Copyright (c) 2013 by Wellcome Trust Sanger Institute. | ||
| 76 | |||
| 77 | This is free software, licensed under: | ||
| 78 | |||
| 79 | The GNU General Public License, Version 3, June 2007 | ||
| 80 | |||
| 81 | =cut |