/usr/share/perl5/Bio/Tradis/CommandLine/TradisBam.pm is in bio-tradis 1.3.3+dfsg-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | package Bio::Tradis::CommandLine::TradisBam;
# ABSTRACT: Adds tags to sequences if tags are present
=head1 SYNOPSIS
Checks for tradis tags in the BAM and outputs processed TraDIS BAM file
with tags attached
=cut
use Moose;
use Getopt::Long qw(GetOptionsFromArray);
use Cwd 'abs_path';
use Bio::Tradis::DetectTags;
use Bio::Tradis::AddTagsToSeq;
has 'args' => ( is => 'ro', isa => 'ArrayRef', required => 1 );
has 'script_name' => ( is => 'ro', isa => 'Str', required => 1 );
has 'bamfile' => ( is => 'rw', isa => 'Str', required => 1 );
has 'outfile' => (
is => 'rw',
isa => 'Str',
required => 0,
);
has 'help' => ( is => 'rw', isa => 'Bool', required => 0 );
has 'verbose' => ( is => 'rw', isa => 'Bool', default => 0 );
has 'samtools_exec' => ( is => 'rw', isa => 'Str', default => 'samtools' );
sub BUILD {
my ($self) = @_;
my ( $bamfile, $help, $outfile, $verbose, $samtools_exec );
GetOptionsFromArray(
$self->args,
'b|bamfile=s' => \$bamfile,
'o|outfile=s' => \$outfile,
'h|help' => \$help,
'v|verbose' => \$verbose,
'samtools_exec=s' => \$samtools_exec,
);
$self->bamfile( abs_path($bamfile) ) if ( defined($bamfile) );
if (defined($outfile)) {
$self->outfile( abs_path($outfile) )
}
else {
my $o = $self->bamfile;
$o =~ s/\.bam/\.tr\.bam/;
$self->outfile( abs_path($o) );
}
$self->help($help) if ( defined($help) );
$self->verbose($verbose) if ( defined($verbose) );
$self->samtools_exec($samtools_exec) if ( defined($samtools_exec) );
# print usage text if required parameters are not present
($bamfile) or die $self->usage_text;
}
sub run {
my ($self) = @_;
if ( defined( $self->help ) ) {
$self->usage_text;
}
my $is_tradis =
Bio::Tradis::DetectTags->new(
bamfile => $self->bamfile,
samtools_exec => $self->samtools_exec
)->tags_present;
if ( defined($is_tradis) && $is_tradis == 1 ) {
my $add_tag_obj = Bio::Tradis::AddTagsToSeq->new(
bamfile => $self->bamfile,
outfile => $self->outfile,
verbose => $self->verbose,
samtools_exec => $self->samtools_exec
);
$add_tag_obj->add_tags_to_seq;
}
}
sub usage_text {
print <<USAGE;
Checks for tradis tags in the BAM and outputs processed TraDIS BAM file
with tags attached
Usage: bam_to_tradis_bam -b file.bam [options]
Options:
-b : bam file
-o : output BAM name (optional. default: <file>.tr.bam)
-v : verbose debugging output
USAGE
exit;
}
__PACKAGE__->meta->make_immutable;
no Moose;
1;
|