Skip to content

Commit

Permalink
Merge branch 'release/mip9.0.4' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
jemten committed Oct 28, 2020
2 parents 528fd34 + 867ad30 commit 59bed25
Show file tree
Hide file tree
Showing 13 changed files with 116 additions and 38 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [9.0.4]
- Increased memory allocation for samtools_subsample_mt
- Check that vep plugin paths exists prior to executing mip
- Cd into cadd temp directory before executing cadd in order to escape snakemake lock errors

## [9.0.3]
- Changed path and name of slurm job ids file to facilitate analysis monitoring
- SpliceAI annotation with VEP instead of vcfanno
Expand Down
2 changes: 1 addition & 1 deletion definitions/rd_dna_parameters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ recipe_memory:
rhocall_ar: 2
rhocall_viz: 5
sambamba_depth: 10
samtools_subsample_mt: 2
samtools_subsample_mt: 4
split_fastq_file: 2
sv_annotate: 7
sv_reformat: 24
Expand Down
5 changes: 3 additions & 2 deletions lib/MIP/Active_parameter.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1270,8 +1270,9 @@ sub parse_vep_plugin {

check_vep_plugin(
{
parameter_name => $parameter_name,
vep_plugin_href => \%{ $active_parameter_href->{$parameter_name} },
parameter_name => $parameter_name,
vep_plugin_href => \%{ $active_parameter_href->{$parameter_name} },
vep_plugins_dir_path => $active_parameter_href->{vep_plugins_dir_path},
}
);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/MIP/Constants.pm
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ BEGIN {
use base qw{ Exporter };

# Set the version for version checking
our $VERSION = 1.24;
our $VERSION = 1.25;

# Functions and variables which can be optionally exported

Expand Down Expand Up @@ -80,7 +80,7 @@ Readonly our %ANALYSIS => (
);

## Set MIP version
Readonly our $MIP_VERSION => q{v9.0.3};
Readonly our $MIP_VERSION => q{v9.0.4};

## Cli
Readonly our $MOOSEX_APP_SCEEN_WIDTH => 160;
Expand Down
12 changes: 11 additions & 1 deletion lib/MIP/Recipes/Analysis/Cadd.pm
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ sub analysis_cadd {

use MIP::Get::File qw{ get_io_files };
use MIP::Get::Parameter qw{ get_recipe_attributes get_recipe_resources };
use MIP::Program::Gnu::Bash qw{ gnu_export gnu_unset };
use MIP::Program::Gnu::Bash qw{ gnu_cd gnu_export gnu_unset };
use MIP::Program::Gnu::Coreutils qw{ gnu_mkdir };
use MIP::Parse::File qw{ parse_io_outfiles };
use MIP::Program::Bcftools qw{ bcftools_annotate bcftools_concat bcftools_view };
Expand Down Expand Up @@ -325,6 +325,16 @@ sub analysis_cadd {
);
print {$xargsfilehandle} $SEMICOLON . $SPACE;

## Attempt to escape snakemake lock
gnu_cd(
{
filehandle => $xargsfilehandle,
directory_path => $temp_outdir_path{$contig},
stderrfile_path_append => $stderrfile_path,
}
);
print {$xargsfilehandle} $SEMICOLON . $SPACE;

cadd(
{
filehandle => $xargsfilehandle,
Expand Down
27 changes: 22 additions & 5 deletions lib/MIP/Vep.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use 5.026;
use Carp;
use charnames qw{ :full :short };
use English qw{ -no_match_vars };
use File::Spec::Functions qw{ catdir };
use File::Spec::Functions qw{ catdir catfile };
use open qw{ :encoding(UTF-8) :std };
use Params::Check qw{ allow check last_error };
use strict;
Expand All @@ -24,7 +24,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 @@ -187,16 +187,18 @@ sub check_vep_custom_annotation {

sub check_vep_plugin {

## Function : Check VEP plugin options
## Function : Check VEP plugins and options
## Returns : 0 or 1
## Arguments: $parameter_name => Parameter name
## : $vep_plugin_href => VEP plugin annotation {REF}
## Arguments: $parameter_name => Parameter name
## : $vep_plugin_href => VEP plugin annotation {REF}
## : $vep_plugins_dir_path => VEP plugin dir path

my ($arg_href) = @_;

## Flatten argument(s)
my $parameter_name;
my $vep_plugin_href;
my $vep_plugins_dir_path;

my $tmpl = {
parameter_name => {
Expand All @@ -211,6 +213,12 @@ sub check_vep_plugin {
store => \$vep_plugin_href,
strict_type => 1,
},
vep_plugins_dir_path => {
defined => 1,
required => 1,
store => \$vep_plugins_dir_path,
strict_type => 1,
},
};

check( $tmpl, $arg_href, 1 ) or croak q{Could not parse arguments!};
Expand All @@ -226,6 +234,15 @@ sub check_vep_plugin {
my $err_msg = $plugin . q{ Is not a hash ref for vep_plugin};
croak($err_msg) if ( ref $value_href ne q{HASH} );

check_filesystem_objects_and_index_existance(
{
object_name => $plugin,
object_type => q{file},
parameter_name => $parameter_name,
path => catfile( $vep_plugins_dir_path, $plugin . q{.pm} ),
}
);

next PLUGIN if ( not exists $value_href->{exist_check} );

OBJECT:
Expand Down
62 changes: 46 additions & 16 deletions t/check_vep_plugin.t
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use charnames qw{ :full :short };
use Cwd;
use English qw{ -no_match_vars };
use File::Basename qw{ dirname };
use File::Spec::Functions qw{ catdir };
use File::Spec::Functions qw{ catdir catfile };
use FindBin qw{ $Bin };
use open qw{ :encoding(UTF-8) :std };
use Params::Check qw{ allow check last_error };
Expand All @@ -23,10 +23,12 @@ use Test::Trap;
## MIPs lib/
use lib catdir( dirname($Bin), q{lib} );
use MIP::Constants qw{ $COMMA $SPACE };
use MIP::Io::Read qw{ read_from_file };
use MIP::Test::Fixtures qw{ test_log test_standard_cli };
use MIP::Update::Parameters qw{ update_with_dynamic_config_parameters };

my $VERBOSE = 1;
our $VERSION = 1.01;
our $VERSION = 1.02;

$VERBOSE = test_standard_cli(
{
Expand Down Expand Up @@ -62,30 +64,42 @@ diag( q{Test check_vep_plugin from Vep.pm v}

my $log = test_log( { no_screen => 1, } );

## Given an undefine vep plugin hash
## Read config for most up to date format
my %rd_dna_config = read_from_file(
{
format => q{yaml},
path => catfile( dirname($Bin), qw{ templates mip_rd_dna_config.yaml } ),
}
);
my %dynamic_parameter =
( cluster_constant_path => catfile( dirname($Bin), qw{ t data } ), );
update_with_dynamic_config_parameters(
{
active_parameter_href => \%rd_dna_config,
dynamic_parameter_href => \%dynamic_parameter,
}
);
## Given an undefined vep plugin hash
my %vep_plugin;

my $is_not_ok = check_vep_plugin(
{
parameter_name => q{vep_plugin},
vep_plugin_href => \%vep_plugin,
parameter_name => q{vep_plugin},
vep_plugin_href => \%vep_plugin,
vep_plugins_dir_path => $rd_dna_config{vep_plugins_dir_path},
}
);
## Then there is nothing to check - return false
is( $is_not_ok, 0, q{Nothing to check} );

%vep_plugin = (
dbNSFP => {
exists_check => q{directory},
path => cwd(),
parameters => [qw{ param_1 param_2 }],
},
);
## Given a plugin hash
$vep_plugin{dbNSFP} = $rd_dna_config{vep_plugin}{dbNSFP};

my $is_ok = check_vep_plugin(
{
parameter_name => q{vep_plugin},
vep_plugin_href => \%vep_plugin,
parameter_name => q{vep_plugin},
vep_plugin_href => \%vep_plugin,
vep_plugins_dir_path => $rd_dna_config{vep_plugins_dir_path},
}
);

Expand All @@ -98,8 +112,9 @@ $vep_plugin{not_valid_annotation} = [q{not_a_valid_ref}];
trap {
check_vep_plugin(
{
parameter_name => q{vep_plugin},
vep_plugin_href => \%vep_plugin,
parameter_name => q{vep_plugin},
vep_plugin_href => \%vep_plugin,
vep_plugins_dir_path => $rd_dna_config{vep_plugins_dir_path},
}
)
};
Expand All @@ -110,4 +125,19 @@ like( $trap->die, qr/Is\s+not\s+a/xms, q{Not a hash ref} );

delete $vep_plugin{not_valid_annotation};

## Given a plugin that is missing
$vep_plugin{MockPlugin} = $rd_dna_config{vep_plugin}{ExACpLI};
trap {
check_vep_plugin(
{
parameter_name => q{vep_plugin},
vep_plugin_href => \%vep_plugin,
vep_plugins_dir_path => $rd_dna_config{vep_plugins_dir_path},
}
)
};

## Then exit
is( $trap->leaveby, q{exit}, q{Exit if the plugin doesn't exist } );

done_testing();
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
37 changes: 26 additions & 11 deletions t/parse_vep_plugin.t
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use charnames qw{ :full :short };
use Cwd;
use English qw{ -no_match_vars };
use File::Basename qw{ dirname };
use File::Spec::Functions qw{ catdir };
use File::Spec::Functions qw{ catdir catfile };
use FindBin qw{ $Bin };
use open qw{ :encoding(UTF-8) :std };
use Params::Check qw{ allow check last_error };
Expand All @@ -23,7 +23,9 @@ use Test::Trap;
## MIPs lib/
use lib catdir( dirname($Bin), q{lib} );
use MIP::Constants qw{ $COMMA $SPACE };
use MIP::Io::Read qw{ read_from_file };
use MIP::Test::Fixtures qw{ test_log test_standard_cli };
use MIP::Update::Parameters qw{ update_with_dynamic_config_parameters };

my $VERBOSE = 1;
our $VERSION = 1.00;
Expand Down Expand Up @@ -62,21 +64,34 @@ diag( q{Test parse_vep_plugin from Active_parameter.pm v}

my $log = test_log( { no_screen => 1, } );

## Given a vep plugin hash
my %active_parameter_href = (
## Read config for most up to date format
my %rd_dna_config = read_from_file(
{
format => q{yaml},
path => catfile( dirname($Bin), qw{ templates mip_rd_dna_config.yaml } ),
}
);
my %dynamic_parameter =
( cluster_constant_path => catfile( dirname($Bin), qw{ t data } ), );
update_with_dynamic_config_parameters(
{
active_parameter_href => \%rd_dna_config,
dynamic_parameter_href => \%dynamic_parameter,
}
);

## Given a plugin hash
my %active_parameter = (
vep_plugin => {
dbNSFP => {
exists_check => q{directory},
path => cwd(),
parameters => [qw{ param_1 param_2 }],
},
dbNSFP => $rd_dna_config{vep_plugin}{dbNSFP},
},
vep_plugins_dir_path => $rd_dna_config{vep_plugins_dir_path},
);
my @mip_vep_plugins = qw{ vep_plugin };

my $is_ok = parse_vep_plugin(
my @mip_vep_plugins = qw{ vep_plugin };
my $is_ok = parse_vep_plugin(
{
active_parameter_href => \%active_parameter_href,
active_parameter_href => \%active_parameter,
mip_vep_plugins_ref => \@mip_vep_plugins,
}
);
Expand Down

0 comments on commit 59bed25

Please sign in to comment.