Bio-Tradis

 view release on metacpan or  search on metacpan

lib/Bio/Tradis/CommandLine/RunMapping.pm  view on Meta::CPAN

package Bio::Tradis::CommandLine::RunMapping;
$Bio::Tradis::CommandLine::RunMapping::VERSION = '1.4.5';
# ABSTRACT: Perform mapping


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' => ( is => 'rw', isa => 'Maybe[Int]', required => 0, default => 0 );
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, $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,
        's|smalt=i'    => \$smalt,
	'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( $smalt )               if ( defined($smalt) );
    $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;
    }



( run in 1.359 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )