Skip to content

Commit

Permalink
Merge pull request #540 from jemten/feature/installation_dependencies
Browse files Browse the repository at this point in the history
Moved dependencies, added tests and refactored
  • Loading branch information
henrikstranneheim committed Aug 16, 2018
2 parents 73022ab + 5c06712 commit 6d5f4c3
Show file tree
Hide file tree
Showing 12 changed files with 695 additions and 202 deletions.
2 changes: 2 additions & 0 deletions definitions/cpanfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ requires qw{ Archive::Zip 1.59 }; # VEP
requires qw{ Array::Utils 0.5 }; # MIP
requires qw{ Bio::Root::Version 1.007002 }; # VEP
requires qw{ CGI 4.37 }; # VEP
requires qw{ Clone 0.39 }; # MIP
requires qw{ Data::Diver 1.0101 }; # MIP
requires qw{ Data::Printer 0.40 }; # MIP
requires qw{ DB_File 1.840 }; # STAR-Fusion
requires qw{ DBD::mysql 4.043 }; # VEP
Expand Down
18 changes: 18 additions & 0 deletions definitions/install_rare_disease_parameters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,13 @@ emip:
bedtools:
version: 2.25.0
expansionhunter:
conda_dependency:
version: 2.5.5
mip_scripts:
version: Your current MIP version
picard:
conda_dependency:
java-jdk:
version: 2.3.0
plink2:
version: 171013
Expand All @@ -67,8 +70,18 @@ emip:
- GRCh38.86
version: v4_3t
svdb:
conda_dependency:
cython:
numpy:
pip:
python: 2.7
version: 1.1.2
tiddit:
conda_dependency:
cmake:
gcc:
numpy:
python: 2.7
version: 2.2.1
vcf2cytosure:
version: gitRepo
Expand All @@ -87,6 +100,8 @@ ecnvnator:
shell:
cnvnator:
cnvnator_root_binary: root_v6.06.00.Linux-slc6-x86_64-gcc4.8.tar.gz
conda_dependency:
gcc:
version: 0.3.3

# Peddy environment spec
Expand Down Expand Up @@ -123,6 +138,9 @@ evep:
pip:
shell:
vep:
conda_dependency:
bcftools:
htslib:
vep_assemblies:
- GRCh37
- GRCh38
Expand Down
20 changes: 16 additions & 4 deletions definitions/install_rna_parameters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,30 @@ emip:
scipy:
star: 2.5.4a
shell:
bootstrapann:
blobfish:
conda_dependency:
bioconductor-deseq2:
bioconductor-tximport:
python: 2.7
r-optparse:
r-readr:
version: git
url: https://github.com/J35P312/BlobFish.git
bootstrapann:
conda_dependency:
numpy:
pip:
scipy:
url: https://github.com/J35P312/BootstrapAnn.git
version: git
mip_scripts:
version: Your current MIP version
picard:
version: 2.17.11
star_fusion:
conda_dependency:
star:
version: 1.3.2
blobfish:
version: git
url: https://github.com/J35P312/BlobFish.git

# Specify environment names
environment_name:
Expand Down
84 changes: 82 additions & 2 deletions lib/MIP/Check/Installation.pm
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ BEGIN {
use base qw{ Exporter };

# Set the version for version checking
our $VERSION = 1.01;
our $VERSION = 1.02;

# Functions and variables which can be optionally exported
our @EXPORT_OK = qw{
check_and_add_dependencies
check_existing_installation
check_python_compability
};
Expand Down Expand Up @@ -242,7 +243,6 @@ q{Python is not part of the installation. Skipping python compability check.}
@programs_to_check = unique(
keys %{ $installation_set_href->{conda} },
keys %{ $installation_set_href->{shell} },
keys %{ $installation_set_href->{bioconda} },
keys %{ $installation_set_href->{pip} },
);
}
Expand All @@ -263,4 +263,84 @@ q{Python is not part of the installation. Skipping python compability check.}
return;
}

sub check_and_add_dependencies {

## Function : Check if shell program dependencies are already part of the installation
## Returns :
## Arguments: $conda_program_href => Hash with conda programs to be installed {REF}
## : $dependency_href => Hash with dependencies {REF}
## : $log => Log
## : $shell_program => Shell program

my ($arg_href) = @_;

## Flatten argument(s)
my $conda_program_href;
my $dependency_href;
my $log;
my $shell_program;

my $tmpl = {
conda_program_href => {
default => {},
defined => 1,
required => 1,
store => \$conda_program_href,
strict_type => 1,
},
dependency_href => {
default => {},
defined => 1,
required => 1,
store => \$dependency_href,
strict_type => 1,
},
log => {
defined => 1,
required => 1,
store => \$log,
},
shell_program => {
defined => 1,
required => 1,
store => \$shell_program,
strict_type => 1,
},
};

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

DEPENDENCY:
foreach my $dependency ( keys %{$dependency_href} ) {

## Add dependency to conda installation if missing
if ( not $conda_program_href->{$dependency} ) {
$conda_program_href->{$dependency} =
$dependency_href->{$dependency};
next DEPENDENCY;
}

## Check if version is specified, do nothing if the same version is already part of the installation
if ( defined $dependency_href->{$dependency} ) {

## Exit if the version of the dependency conflicts with what is already part of the conda installation
if (
( defined $conda_program_href->{$dependency} )
and ( $dependency_href->{$dependency} ne
$conda_program_href->{$dependency} )
)
{
$log->fatal(
qq{$shell_program is dependent on $dependency version: $dependency_href->{$dependency}}
);
$log->fatal(
qq{The conda installation specifies version: $conda_program_href->{$dependency} of $shell_program}
);
exit 1;
}
}
}
return;
}

1;
15 changes: 1 addition & 14 deletions lib/MIP/Get/Parameter.pm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ BEGIN {
use base qw{ Exporter };

# Set the version for version checking
our $VERSION = 1.02;
our $VERSION = 1.03;

# Functions and variables which can be optionally exported
our @EXPORT_OK = qw{
Expand Down Expand Up @@ -641,19 +641,6 @@ sub get_programs_for_shell_installation {
}
elsif ( @{$shell_install_programs_ref} ) {

# Assert that the selected program has shell install instructions.
my @faulty_selects =
array_minus( @{$shell_install_programs_ref}, @shell_programs );
if (@faulty_selects) {
$log->fatal(
q{No shell installation instructions available for}
. $COLON
. join $SPACE,
@faulty_selects
);
exit 1;
}

# Get elements in @shell_programs that are not part of the conda hash
my @shell_only_programs =
array_minus( @shell_programs, @conda_programs );
Expand Down

0 comments on commit 6d5f4c3

Please sign in to comment.