Skip to content

Commit

Permalink
Merge pull request #1498 from Clinical-Genomics/add_to_deliverables_file
Browse files Browse the repository at this point in the history
- Add to deliverables file
- USe internal bcftools binary
  • Loading branch information
henrikstranneheim authored May 11, 2020
2 parents fd7453f + 7bc797f commit 5d997d2
Show file tree
Hide file tree
Showing 9 changed files with 107 additions and 32 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [8.2.5]
- Adds output files to store for gatk_combinevariants, sambamba depth, chromograph recipes
- Use MIPs bcftools singularity image in the conda env when checking references

## [8.2.4]
- Chromograph patch

Expand Down Expand Up @@ -129,7 +133,6 @@ This project adheres to [Semantic Versioning](http://semver.org/).

## [7.1.5]
- Increased sv_varianteffectpredictor memory parameter 9 -> 18 Gb
>>>>>>> master

## [7.1.4]
- Fix bug in outfile_path when mitochondria contig is not part of gene panel
Expand Down
51 changes: 38 additions & 13 deletions lib/MIP/Check/Reference.pm
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ BEGIN {
use base qw{ Exporter };

# Set the version for version checking
our $VERSION = 1.11;
our $VERSION = 1.12;

# Functions and variables which can be optionally exported
our @EXPORT_OK = qw{
Expand All @@ -38,16 +38,24 @@ sub check_if_processed_by_vt {

## Function : Check if vt has processed references using regexp
## Returns : @process_references
## Arguments: $log => Log object
## : $reference_file_path => The reference file path
## Arguments: $bcftools_binary_path => Path to bcftools binary
## : $log => Log object
## : $reference_file_path => The reference file path

my ($arg_href) = @_;

## Flatten argument(s)
my $bcftools_binary_path;
my $log;
my $reference_file_path;

my $tmpl = {
bcftools_binary_path => {
defined => 1,
required => 1,
store => \$bcftools_binary_path,
strict_type => 1,
},
log => {
defined => 1,
required => 1,
Expand Down Expand Up @@ -104,7 +112,8 @@ sub check_if_processed_by_vt {
my $unset_cmd = join $SPACE, gnu_unset( { bash_variable => q{MIP_BIND}, } );

## Detect if vt program has processed reference
my $ret = `$export_cmd; bcftools view $reference_file_path | $regexp; $unset_cmd`;
my $ret =
`$export_cmd; $bcftools_binary_path view $reference_file_path | $regexp; $unset_cmd`;

## No trace of vt processing found
if ( not $ret ) {
Expand Down Expand Up @@ -380,6 +389,9 @@ sub check_references_for_vt {
## Avoid checking the same reference multiple times
my %seen;

## Use MIPs own bcftools
my $bcftools_binary_path = $active_parameter_href->{binary_path}{bcftools};

## TOML parameters
my %toml = (
fqa_vcfanno_config => 1,
Expand Down Expand Up @@ -409,6 +421,7 @@ sub check_references_for_vt {

_parse_vcfanno_toml_path(
{
bcftools_binary_path => $bcftools_binary_path,
log => $log,
seen_href => \%seen,
toml_file_path => $annotation_file,
Expand All @@ -421,8 +434,9 @@ sub check_references_for_vt {
## Check if vt has processed references using regexp
@checked_references = check_if_processed_by_vt(
{
log => $log,
reference_file_path => $annotation_file,
bcftools_binary_path => $bcftools_binary_path,
log => $log,
reference_file_path => $annotation_file,
}
);
push @to_process_references, @checked_references;
Expand All @@ -442,8 +456,9 @@ sub check_references_for_vt {
## Check if vt has processed references using regexp
@checked_references = check_if_processed_by_vt(
{
log => $log,
reference_file_path => $annotation_file,
bcftools_binary_path => $bcftools_binary_path,
log => $log,
reference_file_path => $annotation_file,
}
);
}
Expand All @@ -464,8 +479,9 @@ sub check_references_for_vt {
## Check if vt has processed references using regexp
@checked_references = check_if_processed_by_vt(
{
log => $log,
reference_file_path => $annotation_file,
bcftools_binary_path => $bcftools_binary_path,
log => $log,
reference_file_path => $annotation_file,
}
);
}
Expand All @@ -482,20 +498,28 @@ sub _parse_vcfanno_toml_path {

## Function : Parse TOML config for path to check with vt
## Returns :
## Arguments: $log => Log object
## Arguments: $bcftools_binary_path => Path to bcftools binary
## : $log => Log object
## : $seen_href => Avoid checking the same reference multiple times
## : $toml_file_path => Toml config file path
## : $to_process_references_ref => Store references to process later

my ($arg_href) = @_;

## Flatten argument(s)
my $bcftools_binary_path;
my $log;
my $seen_href;
my $toml_file_path;
my $to_process_references_ref;

my $tmpl = {
bcftools_binary_path => {
defined => 1,
required => 1,
store => \$bcftools_binary_path,
strict_type => 1,
},
log => { store => \$log, },
seen_href => {
default => {},
Expand Down Expand Up @@ -543,8 +567,9 @@ sub _parse_vcfanno_toml_path {
## Check if vt has processed references using regexp
my @checked_references = check_if_processed_by_vt(
{
log => $log,
reference_file_path => $annotation_file_path,
bcftools_binary_path => $bcftools_binary_path,
log => $log,
reference_file_path => $annotation_file_path,
}
);
push @{$to_process_references_ref}, @checked_references;
Expand Down
2 changes: 1 addition & 1 deletion lib/MIP/Constants.pm
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Readonly our %ANALYSIS => (
);

## Set MIP version
Readonly our $MIP_VERSION => q{v8.2.4};
Readonly our $MIP_VERSION => q{v8.2.5};

## Cli
Readonly our $MOOSEX_APP_SCEEN_WIDTH => 160;
Expand Down
27 changes: 24 additions & 3 deletions lib/MIP/Recipes/Analysis/Chromograph.pm
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ BEGIN {
use base qw{ Exporter };

# Set the version for version checking
our $VERSION = 1.06;
our $VERSION = 1.07;

# Functions and variables which can be optionally exported
our @EXPORT_OK = qw{ analysis_chromograph analysis_chromograph_proband };
Expand Down Expand Up @@ -138,7 +138,7 @@ sub analysis_chromograph {
use MIP::Program::Chromograph qw{ chromograph };
use MIP::Parse::File qw{ parse_io_outfiles };
use MIP::Processmanagement::Processes qw{ submit_recipe };
use MIP::Sample_info qw{ set_recipe_outfile_in_sample_info };
use MIP::Sample_info qw{ set_file_path_to_store set_recipe_outfile_in_sample_info };
use MIP::Script::Setup_script qw{ setup_script };

### PREPROCESSING:
Expand Down Expand Up @@ -265,6 +265,16 @@ sub analysis_chromograph {
}
);

set_file_path_to_store(
{
format => q{tar},
id => $sample_id,
path => $outfile_path,
recipe_name => $recipe_name,
sample_info_href => $sample_info_href,
}
);

submit_recipe(
{
base_command => $profile_base_command,
Expand Down Expand Up @@ -391,7 +401,8 @@ sub analysis_chromograph_proband {
use MIP::Program::Upd qw{ upd_call };
use MIP::Parse::File qw{ parse_io_outfiles };
use MIP::Processmanagement::Processes qw{ submit_recipe };
use MIP::Sample_info qw{ get_family_member_id set_recipe_outfile_in_sample_info };
use MIP::Sample_info
qw{ get_family_member_id set_file_path_to_store set_recipe_outfile_in_sample_info };
use MIP::Script::Setup_script qw{ setup_script };

### PREPROCESSING:
Expand Down Expand Up @@ -585,6 +596,16 @@ sub analysis_chromograph_proband {
}
);

set_file_path_to_store(
{
format => q{tar},
id => $sample_id,
path => $outfile_path,
recipe_name => $recipe_name,
sample_info_href => $sample_info_href,
}
);

submit_recipe(
{
base_command => $profile_base_command,
Expand Down
14 changes: 12 additions & 2 deletions lib/MIP/Recipes/Analysis/Gatk_combinevariantcallsets.pm
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ BEGIN {
use base qw{ Exporter };

# Set the version for version checking
our $VERSION = 1.13;
our $VERSION = 1.14;

# Functions and variables which can be optionally exported
our @EXPORT_OK = qw{ analysis_gatk_combinevariantcallsets };
Expand Down Expand Up @@ -140,7 +140,7 @@ sub analysis_gatk_combinevariantcallsets {
use MIP::Program::Bcftools qw{ bcftools_view_and_index_vcf };
use MIP::Program::Gatk qw{ gatk_combinevariants };
use MIP::Sample_info
qw{ set_recipe_outfile_in_sample_info set_processing_metafile_in_sample_info };
qw{ set_file_path_to_store set_recipe_outfile_in_sample_info set_processing_metafile_in_sample_info };
use MIP::Script::Setup_script qw{ setup_script };

### PREPROCESSING:
Expand Down Expand Up @@ -348,6 +348,16 @@ sub analysis_gatk_combinevariantcallsets {
sample_info_href => $sample_info_href,
}
);
set_file_path_to_store(
{
format => q{bcf},
id => $case_id,
path => $bcf_file_path,
path_index => $bcf_file_path . $DOT . q{csi},
recipe_name => $recipe_name,
sample_info_href => $sample_info_href,
}
);
}

submit_recipe(
Expand Down
13 changes: 12 additions & 1 deletion lib/MIP/Recipes/Analysis/Sambamba_depth.pm
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ sub analysis_sambamba_depth {
use MIP::Parse::File qw{ parse_io_outfiles };
use MIP::Processmanagement::Processes qw{ submit_recipe };
use MIP::Program::Sambamba qw{ sambamba_depth };
use MIP::Sample_info qw{ set_recipe_outfile_in_sample_info };
use MIP::Sample_info qw{ set_file_path_to_store set_recipe_outfile_in_sample_info };
use MIP::Script::Setup_script qw{ setup_script};

### PREPROCESSING:
Expand Down Expand Up @@ -278,6 +278,17 @@ sub analysis_sambamba_depth {
}
);

set_file_path_to_store(
{
format => q{bed},
id => $sample_id,
path => $outfile_path,
recipe_name => $recipe_name,
sample_info_href => $sample_info_href,
tag => q{coverage},
}
);

submit_recipe(
{
base_command => $profile_base_command,
Expand Down
4 changes: 2 additions & 2 deletions lib/MIP/Sample_info.pm
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ BEGIN {
use base qw{Exporter};

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

# Functions and variables which can be optionally exported
our @EXPORT_OK = qw{
Expand Down Expand Up @@ -660,7 +660,7 @@ sub set_file_path_to_store {

my $tmpl = {
format => {
allow => [qw{ fastq bam bcf cram meta vcf }],
allow => [qw{ fastq bam bcf bed cram meta tar vcf }],
defined => 1,
required => 1,
store => \$format,
Expand Down
20 changes: 12 additions & 8 deletions t/check_if_processed_by_vt.t
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use MIP::Constants qw{ $COMMA $SPACE };
use MIP::Test::Fixtures qw{ test_log test_standard_cli };

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

$VERBOSE = test_standard_cli(
{
Expand Down Expand Up @@ -61,10 +61,12 @@ diag( q{Test check_if_processed_by_vt from Reference.pm v}
my $log = test_log( { no_screen => 1, } );

## Given no reference path
my $return = check_if_processed_by_vt(
my $bcftools_binary_path = q{bcftools};
my $return = check_if_processed_by_vt(
{
reference_file_path => q{file_does_not_exists},
log => $log,
bcftools_binary_path => $bcftools_binary_path,
reference_file_path => q{file_does_not_exists},
log => $log,
}
);
is( $return, undef, q{No reference file to check} );
Expand All @@ -76,8 +78,9 @@ my $reference_file_path_no_vt =
## Check if vt has processed references using regexp
my @checked_references = check_if_processed_by_vt(
{
reference_file_path => $reference_file_path_no_vt,
log => $log,
bcftools_binary_path => $bcftools_binary_path,
reference_file_path => $reference_file_path_no_vt,
log => $log,
}
);

Expand All @@ -91,8 +94,9 @@ my $reference_file_path_vt =
## Check if vt has processed references using regexp
@checked_references = check_if_processed_by_vt(
{
reference_file_path => $reference_file_path_vt,
log => $log,
bcftools_binary_path => $bcftools_binary_path,
reference_file_path => $reference_file_path_vt,
log => $log,
}
);

Expand Down
3 changes: 2 additions & 1 deletion t/check_references_for_vt.t
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use MIP::Constants qw{ $COLON $COMMA $SPACE };
use MIP::Test::Fixtures qw{ test_log test_standard_cli };

my $VERBOSE = 1;
our $VERSION = 1.06;
our $VERSION = 1.07;

$VERBOSE = test_standard_cli(
{
Expand Down Expand Up @@ -62,6 +62,7 @@ diag( q{Test check_references_for_vt from Reference.pm v}
my $log = test_log( { log_name => q{MIP}, no_screen => 1, } );

my %active_parameter_test = (
binary_path => { bcftools => q{bcftools}, },
fqa_vcfanno_config => catfile(
$Bin, qw{ data references grch37_frequency_vcfanno_filter_config_-v1.0-.toml }
),
Expand Down

0 comments on commit 5d997d2

Please sign in to comment.