Skip to content

Commit

Permalink
Merge 9ce0e5c into 50d54ff
Browse files Browse the repository at this point in the history
  • Loading branch information
jemten committed Jun 24, 2019
2 parents 50d54ff + 9ce0e5c commit 1310029
Show file tree
Hide file tree
Showing 12 changed files with 295 additions and 265 deletions.
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ install:
## Test installation script and gather coverage information
- PERL5OPT=-MDevel::Cover=-ignore,"^t/",-coverage,statement,branch,condition,path,subroutine perl t/mip_install.test
## Generate rare disease installation script
- PERL5OPT=-MDevel::Cover=-ignore,"^t/",-coverage,statement,branch,condition,path,subroutine perl mip install rd_dna --bash_set_errexit --install emip epeddy eperl5 epy3 esvdb etiddit --envn emip=mip_travis --snpg GRCh37.75 --skip gatk --skip snpeff
- PERL5OPT=-MDevel::Cover=-ignore,"^t/",-coverage,statement,branch,condition,path,subroutine perl mip install rd_dna --bash_set_errexit --install emip epeddy eperl5 epy3 esvdb etiddit --envn emip=mip_travis epeddy=mip_travis_peddy eperl5=mip_travis_perl5 epy3=mip_travis_py3 esvdb=mip_travis_svdb etiddit=mip_travis_tiddit --skip gatk --skip snpeff
## Install MIP rare disease
- bash mip.sh
## Generate rna installation script
- PERL5OPT=-MDevel::Cover=-ignore,"^t/",-coverage,statement,branch,condition,path,subroutine perl mip install rd_rna --bash_set_errexit --install emip epy3 eperl5
- PERL5OPT=-MDevel::Cover=-ignore,"^t/",-coverage,statement,branch,condition,path,subroutine perl mip install rd_rna --bash_set_errexit --install emip epy3 eperl5
## Install MIP rna
- bash mip.sh

Expand All @@ -58,8 +58,8 @@ script:
## 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_dragen_rd_dna.test
## 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
- conda activate mip7_rd-rna
- PERL5OPT=-MDevel::Cover=-ignore,"^t/",-coverage,statement,branch,condition,path,subroutine perl t/mip_analyse_rd_rna.test
## Get some coverage statistics
- cover

Expand Down
29 changes: 18 additions & 11 deletions definitions/install_rd_dna_parameters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ emip:
htslib: 1.9=hc238db4_4
libstdcxx-ng: 8.2
ldc: 1.11.0=hb2c9046_0
manta: 1.5.0=py27_0
manta: 1.5.0=py27_0
numpy:
picard: 2.18.14=0
pip:
Expand Down Expand Up @@ -204,17 +204,24 @@ evep:
- homo_sapiens_merged
version: 95

# Specify environment names
## Default base name
environment_base_name: mip7_rd-dna

# Specify default environment names
environment_name:
emip: MIP_rd_dna
ecnvnator:
edelly:
epeddy:
eperl5:
epy3:
esvdb:
etiddit:
evep:
emip: mip7_rd-dna
ecnvnator: mip7_rd-dna_cnvnator
edelly: mip7_rd-dna_delly
epeddy: mip7_rd-dna_peddy
eperl5: mip7_rd-dna_perl5
epy3: mip7_rd-dna_py3
esvdb: mip7_rd-dna_svdb
etiddit: mip7_rd-dna_tiddit
evep: mip7_rd-dna_vep

# Optional addons to env names
environment_prefix:
environment_suffix:

# Environments to install
installations:
Expand Down
15 changes: 11 additions & 4 deletions definitions/install_rd_rna_parameters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,19 @@ evep:
- homo_sapiens_merged
version: 95

## Default base name
environment_base_name: mip7_rd-rna

# Specify environment names
environment_name:
emip: MIP_rd_rna
epy3: MIP_rd_rna_py3
eperl5: MIP_rd_rna_perl5
evep: MIP_rd_rna_vep
emip: mip7_rd-rna
epy3: mip7_rd-rna_py3
eperl5: mip7_rd-rna_perl5
evep: mip7_rd-rna_vep

# Optional addons to env names
environment_prefix:
environment_suffix:

# Environments and their recipes
installations:
Expand Down
32 changes: 31 additions & 1 deletion lib/MIP/Cli/Mip/Install.pm
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use lib catdir( dirname($Bin), q{lib} );
use MIP::Cli::Utils qw{ run }
; # MooseX::App required sub. Called internally by MooseX::App

our $VERSION = 1.05;
our $VERSION = 1.06;

extends(qw{ MIP::Cli::Mip });

Expand Down Expand Up @@ -85,6 +85,25 @@ sub _build_usage {
),
);

option(
q{environment_prefix} => (
cmd_aliases => [qw{ ep }],
documentation =>
q{Prepend this to environment names. Separated by underscore},
is => q{rw},
isa => Str,
)
);

option(
q{environment_suffix} => (
cmd_aliases => [qw{ es }],
documentation => q{Append this to environment names. Separated by underscore},
is => q{rw},
isa => Str,
)
);

option(
q{noupdate} => (
cmd_aliases => [qw{ nup }],
Expand All @@ -96,6 +115,17 @@ sub _build_usage {
),
);

option(
q{add_environment_date} => (
cmd_aliases => [qw{ aed }],
cmd_flag => q{add_environment_date},
documentation => q{Add creation date to environment},
is => q{rw},
isa => Bool,
required => 0,
),
);

option(
q{prefer_shell} => (
cmd_aliases => [qw{ psh }],
Expand Down
9 changes: 6 additions & 3 deletions lib/MIP/Cli/Mip/Install/Rd_dna.pm
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use MIP::Main::Install qw{ mip_install };
use MIP::Get::Parameter qw{ get_install_parameter_attribute };
use MIP::Script::Utils qw{ nest_hash print_parameter_defaults update_program_versions};

our $VERSION = 1.05;
our $VERSION = 1.06;

extends(qw{ MIP::Cli::Mip::Install });

Expand Down Expand Up @@ -107,8 +107,11 @@ sub _build_usage {

option(
q{environment_name} => (
cmd_aliases => [qw{ envn }],
cmd_flag => q{environment_name},
cmd_aliases => [qw{ envn }],
cmd_flag => q{environment_name},
cmd_tags => [
q{Default: mip7_rd-dna mip7_rd-dna_cnvnator mip7_rd-dna_delly mip7_rd-dna_peddy mip7_rd-dna_perl5 mip7_rd-dna_py3 mip7_rd-dna_svdb mip7_rd-dna_tiddit mip7_rd-dna_vep}
],
documentation => q{Set environment names},
is => q{rw},
isa => Dict [
Expand Down
8 changes: 5 additions & 3 deletions lib/MIP/Cli/Mip/Install/Rd_rna.pm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use MIP::File::Format::Yaml qw{ load_yaml };
use MIP::Main::Install qw{ mip_install };
use MIP::Script::Utils qw{ nest_hash print_parameter_defaults update_program_versions };

our $VERSION = 1.08;
our $VERSION = 1.09;

extends(qw{ MIP::Cli::Mip::Install });

Expand Down Expand Up @@ -93,8 +93,10 @@ sub _build_usage {

option(
q{environment_name} => (
cmd_aliases => [qw{ envn }],
cmd_flag => q{environment_name},
cmd_aliases => [qw{ envn }],
cmd_flag => q{environment_name},
cmd_tags =>
[q{Default: mip7_rd-rna mip7_rd-rna_py3 mip7_rd-rna_perl5 mip7_rd-rna_vep}],
documentation => q{Set environment names},
is => q{rw},
isa => Dict [
Expand Down
3 changes: 1 addition & 2 deletions lib/MIP/Main/Install.pm
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ BEGIN {
use base qw{ Exporter };

# Set the version for version checking
our $VERSION = q{1.4.1};
our $VERSION = q{1.4.2};

# Functions and variables that can be optionally exported
our @EXPORT_OK = qw{ mip_install };
Expand Down Expand Up @@ -137,7 +137,6 @@ sub mip_install {
## Set environment names and environment specific conda paths
set_conda_env_names_and_paths(
{
log => $log,
parameter_href => \%parameter,
}
);
Expand Down
9 changes: 4 additions & 5 deletions lib/MIP/Package_manager/Pip.pm
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ sub check_pip_package {

# Test if the program already exists in that environment
$command =
qq{conda list -n $conda_environment | grep 'pip' | $check_pip_package_regexp};
qq{conda list -n $conda_environment 2> /dev/null | grep '<pip>' | $check_pip_package_regexp};
run(
command => $command,
buffer => \$status
Expand All @@ -102,13 +102,12 @@ qq{conda list -n $conda_environment | grep 'pip' | $check_pip_package_regexp};
return $status;
}

# Test if the program is already installed in the root env
$command = qq{pip list --format columns | $check_pip_package_regexp};
# Test if the program is already installed in the active env
$command = qq{pip list --format columns 2> /dev/null | $check_pip_package_regexp};
run(
command => $command,
buffer => \$status
);

return $status;
}

Expand Down Expand Up @@ -294,7 +293,7 @@ sub _build_package_check_regexp {
. q?'if( ($_=~/? . $package . q?/) && ($_=~/? . $version . q?/) )?

# Print 1 in case of match
. q?{print 1}'?;
. q?{print 1}' ?;
}
else {

Expand Down
93 changes: 90 additions & 3 deletions lib/MIP/Parse/Parameter.pm
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use List::Util qw{ any };
use Readonly;

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

BEGIN {

Expand All @@ -29,9 +29,96 @@ BEGIN {
our $VERSION = 1.03;

# Functions and variables which can be optionally exported
our @EXPORT_OK =
qw{ parse_download_reference_parameter parse_infiles parse_nist_parameters parse_prioritize_variant_callers parse_start_with_recipe parse_toml_config_parameters };
our @EXPORT_OK = qw{
parse_conda_env_name
parse_download_reference_parameter
parse_infiles
parse_nist_parameters
parse_prioritize_variant_callers
parse_start_with_recipe
parse_toml_config_parameters
};

}

sub parse_conda_env_name {

## Function : Build conda environment names depending on input parameters
## Returns : $conda_environment_name
## Arguments: $base_name => Degfault base environment name
## : $date => Date
## : $environment => Installation environment
## : parameter_href => Parmeter hash {REF}

my ($arg_href) = @_;

## Flatten argument(s)
my $base_name;
my $date;
my $environment;
my $parameter_href;

my $tmpl = {
base_name => {
defined => 1,
required => 1,
store => \$base_name,
strict_type => 1,
},
date => {
defined => 1,
required => 1,
store => \$date,
strict_type => 1,
},
environment => {
defined => 1,
required => 1,
store => \$environment,
strict_type => 1,
},
parameter_href => {
default => {},
defined => 1,
required => 1,
store => \$parameter_href,
strict_type => 1,
},
};

check( $tmpl, $arg_href, 1 ) or croak q{Could not parse arguments!};

my $environment_name = $parameter_href->{environment_name}{$environment};

## Give the env a default name if not given
if ( not $environment_name ) {

## Strip the first character, i.e. 'e' from the environment string
my $env_postfix = substr $environment, 1;
$environment_name = $base_name . $UNDERSCORE . $env_postfix;
}

## Prepend environemnt prefix
if ( $parameter_href->{environment_prefix} ) {

$environment_name =
$parameter_href->{environment_prefix} . $UNDERSCORE . $environment_name;
}

## Add environment date
if ( $parameter_href->{add_environment_date} ) {

$environment_name = $environment_name . $UNDERSCORE . $date;
}

## Append environment suffix
if ( $parameter_href->{environment_suffix} ) {

$environment_name =
$environment_name . $UNDERSCORE . $parameter_href->{environment_suffix};
}

return $environment_name;
}

sub parse_download_reference_parameter {
Expand Down
Loading

0 comments on commit 1310029

Please sign in to comment.