/usr/share/perl5/Bio/Tradis/CommandLine/RunMapping.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 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | package Bio::Tradis::CommandLine::RunMapping;
# ABSTRACT: Perform mapping
=head1 SYNOPSIS
Takes a reference genome and indexes it.
Maps given fastq files to ref.
=cut
use Moose;
use Getopt::Long qw(GetOptionsFromArray);
use Cwd 'abs_path';
use Bio::Tradis::Map;
has 'args' => ( is => 'ro', isa => 'ArrayRef', required => 1 );
has 'script_name' => ( is => 'ro', isa => 'Str', required => 1 );
has 'fastqfile' => ( is => 'rw', isa => 'Str', required => 0 );
has 'reference' => ( is => 'rw', isa => 'Str', required => 0 );
has 'help' => ( is => 'rw', isa => 'Bool', required => 0 );
has 'refname' =>
( is => 'rw', isa => 'Str', required => 0, default => 'ref.index' );
has 'outfile' =>
( is => 'rw', isa => 'Str', required => 0, default => 'mapped.sam' );
has 'smalt_k' => ( is => 'rw', isa => 'Maybe[Int]', required => 0 );
has 'smalt_s' => ( is => 'rw', isa => 'Maybe[Int]', required => 0 );
has 'smalt_y' => ( is => 'rw', isa => 'Maybe[Num]', required => 0, default => 0.96 );
has 'smalt_r' => ( is => 'rw', isa => 'Maybe[Int]', required => 0, default => -1 );
has 'smalt_n' => ( is => 'rw', isa => 'Maybe[Int]', required => 0, default => 1 );
sub BUILD {
my ($self) = @_;
my ( $fastqfile, $ref, $refname, $outfile, $smalt_k, $smalt_s, $smalt_y, $smalt_r,$smalt_n, $help );
GetOptionsFromArray(
$self->args,
'f|fastqfile=s' => \$fastqfile,
'r|reference=s' => \$ref,
'rn|refname=s' => \$refname,
'o|outfile=s' => \$outfile,
'sk|smalt_k=i' => \$smalt_k,
'ss|smalt_s=i' => \$smalt_s,
'sy|smalt_y=f' => \$smalt_y,
'sr|smalt_r=i' => \$smalt_r,
'n|smalt_n=i' => \$smalt_n,
'h|help' => \$help
);
$self->fastqfile( abs_path($fastqfile) ) if ( defined($fastqfile) );
$self->reference( abs_path($ref) ) if ( defined($ref) );
$self->refname($refname) if ( defined($refname) );
$self->outfile( abs_path($outfile) ) if ( defined($outfile) );
$self->smalt_k( $smalt_k ) if ( defined($smalt_k) );
$self->smalt_s( $smalt_s ) if ( defined($smalt_s) );
$self->smalt_y( $smalt_y ) if ( defined($smalt_y) );
$self->smalt_r( $smalt_r ) if ( defined($smalt_r) );
$self->smalt_n( $smalt_n ) if ( defined($smalt_n) );
$self->help($help) if ( defined($help) );
# print usage text if required parameters are not present
($fastqfile && $ref) or die $self->usage_text;
}
sub run {
my ($self) = @_;
if ( defined( $self->help ) ) {
#if ( scalar( @{ $self->args } ) == 0 ) {
$self->usage_text;
}
my $mapping = Bio::Tradis::Map->new(
fastqfile => $self->fastqfile,
reference => $self->reference,
refname => $self->refname,
outfile => $self->outfile,
smalt_k => $self->smalt_k,
smalt_s => $self->smalt_s,
smalt_y => $self->smalt_y,
smalt_r => $self->smalt_r
);
$mapping->index_ref;
$mapping->do_mapping;
}
sub usage_text {
print <<USAGE;
Indexes the reference genome and maps the given fastq file.
-k and -s options for indexing are calculated for the length of
the read as follows unless otherwise specified ( --smalt_k &
--smalt_s options )
Read length | k | s
---------------+----+-----
<70 | 13 | 4
>70 & <100 | 13 | 6
>100 | 20 | 13
Usage: run_mapping -f file.fastq -r ref.fa [options]
Options:
-f : fastq file to map
-r : reference in fasta format
-rn : reference index name (optional. default: ref.index)
-o : mapped SAM output name (optional. default: mapped.sam)
--smalt_k : custom k-mer value for SMALT mapping
--smalt_s : custom step size for SMALT mapping
--smalt_r : custom r value for SMALT mapping
-n : number of threads to use for SMALT and samtools sort (optional. default = 1)
USAGE
exit;
}
__PACKAGE__->meta->make_immutable;
no Moose;
1;
|