Bio-VertRes-Config

 view release on metacpan or  search on metacpan

lib/Bio/VertRes/Config/CommandLine/Common.pm  view on Meta::CPAN

package Bio::VertRes::Config::CommandLine::Common;

# ABSTRACT: Create config scripts


use Moose;
use Getopt::Long qw(GetOptionsFromArray);
use Bio::VertRes::Config::CommandLine::LogParameters;
use Bio::VertRes::Config::CommandLine::ConstructLimits;
use Bio::VertRes::Config::Exceptions;

has 'args'        => ( is => 'ro', isa => 'ArrayRef', required => 1 );
has 'script_name' => ( is => 'ro', isa => 'Str',      required => 1 );

has 'database'    => ( is => 'rw', isa => 'Str', default => 'pathogen_prok_track' );
has 'config_base' => ( is => 'rw', isa => 'Str', default => '/nfs/pathnfs05/conf' );
has 'root_base'   => ( is => 'rw', isa => 'Str', default => '/lustre/scratch108/pathogen/pathpipe' );
has 'log_base'    => ( is => 'rw', isa => 'Str', default => '/nfs/pathnfs05/log' );
has 'database_connect_file' =>
  ( is => 'rw', isa => 'Str', default => '/software/pathogen/config/database_connection_details' );
has 'reference_lookup_file' =>
  ( is => 'rw', isa => 'Str', default => '/lustre/scratch108/pathogen/pathpipe/refs/refs.index' );
has 'reference'                      => ( is => 'rw', isa => 'Maybe[Str]', );
has 'available_references'           => ( is => 'rw', isa => 'Maybe[Str]' );
has 'type'                           => ( is => 'rw', isa => 'Maybe[Str]' );
has 'id'                             => ( is => 'rw', isa => 'Maybe[Str]' );
has 'species'                        => ( is => 'rw', isa => 'Maybe[Str]' );
has 'mapper'                         => ( is => 'rw', isa => 'Maybe[Str]' );
has 'protocol'                       => ( is => 'rw', isa => 'Str', default => 'StrandSpecificProtocol' );
has 'regeneration_log_file'          => ( is => 'rw', isa => 'Maybe[Str]' );
has 'overwrite_existing_config_file' => ( is => 'rw', isa => 'Bool', default => 0 );
has 'help'                           => ( is => 'rw', isa => 'Bool', default => 0 );

# mapper specific
has 'smalt_index_k'  => ( is => 'rw', isa => 'Maybe[Int]' );
has 'smalt_index_s'  => ( is => 'rw', isa => 'Maybe[Int]' );
has 'smalt_mapper_r' => ( is => 'rw', isa => 'Maybe[Int]' );
has 'smalt_mapper_x' => ( is => 'rw', isa => 'Maybe[Bool]' );
has 'smalt_mapper_y' => ( is => 'rw', isa => 'Maybe[Num]' );
has 'smalt_mapper_l' => ( is => 'rw', isa => 'Maybe[Str]' );
has 'tophat_mapper_I' => ( is => 'rw', isa => 'Maybe[Int]' );
has 'tophat_mapper_i' => ( is => 'rw', isa => 'Maybe[Int]' );
has 'tophat_mapper_g' => ( is => 'rw', isa => 'Maybe[Int]' );

# set assembler
has 'assembler' => ( is => 'rw', isa => 'Maybe[Str]' );

sub BUILD {
    my ($self) = @_;
    my $log_params =
      Bio::VertRes::Config::CommandLine::LogParameters->new( args => $self->args, script_name => $self->script_name );

    my (
        $database,              $config_base,                    $reference_lookup_file,
        $available_references,  $reference,                      $type,
        $id,                    $species,                        $mapper,
        $regeneration_log_file, $overwrite_existing_config_file, $protocol,
        $smalt_index_k,         $smalt_index_s,                  $smalt_mapper_r,
        $smalt_mapper_y,        $smalt_mapper_x,                 $smalt_mapper_l,
        $tophat_mapper_I,       $tophat_mapper_i,                $tophat_mapper_g,
        $assembler,             $root_base,                      $log_base,
        $database_connect_file, $help
    );

    GetOptionsFromArray(
        $self->args,
        'd|database=s'                     => \$database,
        'c|config_base=s'                  => \$config_base,
        'l|reference_lookup_file=s'        => \$reference_lookup_file,
        'r|reference=s'                    => \$reference,
        'a|available_references=s'         => \$available_references,
        't|type=s'                         => \$type,



( run in 0.816 second using v1.01-cache-2.11-cpan-39bf76dae61 )