Skip to content

Commit

Permalink
Merge c6ea067 into 3837058
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikstranneheim committed Jun 10, 2019
2 parents 3837058 + c6ea067 commit 4ec13de
Show file tree
Hide file tree
Showing 29 changed files with 1,242 additions and 720 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ before_install:

## Install conda
## - wget https://repo.anaconda.com/miniconda/Miniconda2-latest-Linux-x86_64.sh -O miniconda.sh;
# - wget https://repo.anaconda.com/miniconda/Miniconda2-4.5.11-Linux-x86_64.sh -O miniconda.sh;
- wget https://repo.anaconda.com/miniconda/Miniconda3-4.5.11-Linux-x86_64.sh -O miniconda.sh;
- bash miniconda.sh -b -p $HOME/miniconda
- source $HOME/miniconda/etc/profile.d/conda.sh
Expand Down Expand Up @@ -62,6 +61,8 @@ script:
- PERL5OPT=-MDevel::Cover=-ignore,"^t/",-coverage,statement,branch,condition,path,subroutine perl t/mip_analyse_rd_dna.test
## Set-up test coverage for mip_analyse_vcf_rerun.test
- PERL5OPT=-MDevel::Cover=-ignore,"^t/",-coverage,statement,branch,condition,path,subroutine perl t/mip_analyse_rd_dna_vcf_rerun.test
## Set-up test coverage for mip qccollect
- PERL5OPT=-MDevel::Cover=-ignore,"^t/",-coverage,statement,branch,condition,path,subroutine perl mip qccollect --log_file qc_metrics_qccollect.log --regexp_file t/data/references/qc_regexp_-v1.22-.yaml --sample_info_file t/data/test_data/643594-miptest_qc_sample_info_travis.yaml --evaluate_plink_gender --outfile qc_metrics.yaml
## Set-up test coverage for mip_analyse_rna.test
- conda activate MIP_rd_rna
- PERL5OPT=-MDevel::Cover=-ignore,"^t/",-coverage,statement,branch,condition,path,subroutine perl t/mip_analyse_rd_rna.test
Expand Down
5 changes: 4 additions & 1 deletion lib/MIP/Cli/Mip.pm
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@ use Moose::Util::TypeConstraints;

## MIPs lib/
use MIP::Cli::Mip;
use MIP::Constants qw{ $MIP_VERSION };
use MIP::Constants qw{ $MIP_VERSION $MOOSEX_APP_SCEEN_WIDTH};

our $VERSION = $MIP_VERSION;

## Set screen width for usage message
$MooseX::App::Utils::SCREEN_WIDTH = $MOOSEX_APP_SCEEN_WIDTH;

## Enable strict mode
app_strict 1;

Expand Down
167 changes: 167 additions & 0 deletions lib/MIP/Cli/Mip/Qccollect.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
package MIP::Cli::Mip::Qccollect;

use 5.026;
use Carp;
use Cwd;
use File::Spec::Functions qw{ catfile };
use open qw{ :encoding(UTF-8) :std };
use strict;
use utf8;
use warnings;
use warnings qw{ FATAL utf8 };

## CPANM
use autodie qw{ :all };
use Moose::Util::TypeConstraints;
use MooseX::App::Command;
use MooseX::Types::Moose qw{ ArrayRef Bool HashRef Int Str };

## MIPs lib/
use MIP::Constants qw{ $NEWLINE };

our $VERSION = 1.00;

command_short_description(q{MIP qccollect command});

command_long_description(q{Entry point for collecting MIP QC metrics});

command_usage(
q{qccollect <options> -si [sample_info.yaml] -r [regexp.yaml] -o [outfile]});

## Define, check and get Cli supplied parameters
_build_usage();

sub run {

## Input from Cli
my ($arg_href) = @_;

## Remove Moose::App extra variable
delete $arg_href->{extra_argv};

# Flatten argument(s)
my $evaluate_plink_gender = $arg_href->{evaluate_plink_gender};
my $print_regexp = $arg_href->{print_regexp};
my $regexp_file = $arg_href->{regexp_file};
my $sample_info_file = $arg_href->{sample_info_file};
my $skip_evaluation = $arg_href->{skip_evaluation};
my $log_file = $arg_href->{log_file};
my $print_regexp_outfile = $arg_href->{print_regexp_outfile};
my $outfile = $arg_href->{outfile};

use MIP::Log::MIP_log4perl qw{ initiate_logger };
use MIP::Main::Qccollect qw{ mip_qccollect };
use MIP::Qcc_regexp qw{ regexp_to_yaml };

## Creates log object
my $log = initiate_logger(
{
file_path => $log_file,
log_name => uc q{mip_qccollect},
}
);

## Write default regexp to YAML if demanded
regexp_to_yaml(
{
log => $log,
print_regexp_outfile => $print_regexp_outfile,
}
);

mip_qccollect(
{
evaluate_plink_gender => $evaluate_plink_gender,
regexp_file => $regexp_file,
sample_info_file => $sample_info_file,
skip_evaluation => $skip_evaluation,
log => $log,
outfile => $outfile,
}
);
return;
}

sub _build_usage {

## Function : Get and/or set input parameters
## Returns :
## Arguments:

my ($arg_href) = @_;

option(
q{evaluate_plink_gender} => (
cmd_aliases => [qw{ epg }],
documentation => q{Evaluate plink gender},
is => q{rw},
isa => Bool,
)
);

option(
q{log_file} => (
cmd_aliases => [qw{ l }],
default => catfile( cwd(), q{qccollect.log} ),
documentation => q{Log file},
is => q{rw},
isa => Str,
)
);

option(
q{outfile} => (
cmd_aliases => [qw{ o }],
cmd_tags => [q{YAML}],
default => q{qcmetrics.yaml},
documentation => q{Data file output},
is => q{rw},
isa => Str,
)
);

option(
q{print_regexp_outfile} => (
cmd_aliases => [qw{ prego }],
cmd_flag => q{regexp_outfile},
cmd_tags => [q{YAML}],
documentation => q{Regexp YAML outfile},
is => q{rw},
isa => Str,
)
);

option(
q{regexp_file} => (
cmd_aliases => [qw{ rxf }],
cmd_tags => [q{YAML}],
documentation => q{Regular expression file path},
is => q{rw},
isa => Str,
required => 1,
)
);

option(
q{sample_info_file} => (
cmd_aliases => [qw{ sif }],
cmd_tags => [q{YAML}],
documentation => q{File for sample info used in the analysis},
is => q{rw},
isa => Str,
required => 1,
)
);

option(
q{skip_evaluation} => (
cmd_aliases => [qw{ ske }],
documentation => q{Skip evaluation step},
is => q{rw},
isa => Bool,
)
);
return;
}

1;
3 changes: 3 additions & 0 deletions lib/MIP/Constants.pm
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ BEGIN {
$FORWARD_SLASH
$LOG
$MIP_VERSION
$MOOSEX_APP_SCEEN_WIDTH
$NEWLINE
$OPEN_BRACE
$OPEN_BRACKET
Expand All @@ -61,6 +62,8 @@ BEGIN {
## Constants
Readonly our $MIP_VERSION => q{v7.0.9};

## Cli
Readonly our $MOOSEX_APP_SCEEN_WIDTH => 160;
## Log
Readonly our $LOG => q{MIP_ANALYSE};

Expand Down

0 comments on commit 4ec13de

Please sign in to comment.