Skip to content

Commit

Permalink
Merge branch 'feature/capture_file_prerequisites' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikstranneheim committed Aug 10, 2018
2 parents 5fadd0e + 2ab48ce commit 4e02d82
Show file tree
Hide file tree
Showing 21 changed files with 546 additions and 548 deletions.
27 changes: 26 additions & 1 deletion definitions/rare_disease_parameters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,37 @@ human_genome_reference:
- gatk_variantevalexome
- picardtools_collecthsmetrics
- picardtools_collectmultiplemetrics
build_file: 1
data_type: SCALAR
default: GRCh37_homo_sapiens_-d5-.fasta
exists_check: file
reference: reference_dir
type: path
human_genome_reference_file_endings:
associated_program:
- bwa_mem
- expansionhunter
- gatk_realigner
- gatk_baserecalibration
- gatk_haplotypecaller
- gatk_genotypegvcfs
- bcftools_mpileup
- freebayes
- manta
- delly_call
- cnvnator
- tiddit
- gatk_variantrecalibration
- vt
- gatk_variantevalall
- gatk_variantevalexome
- picardtools_collecthsmetrics
- picardtools_collectmultiplemetrics
build_file: 1
data_type: SCALAR
exists_check: file
mandatory: no
reference: reference_dir
type: path
## java large pages - affects all modules using java
java_use_large_pages:
associated_program:
Expand Down
15 changes: 14 additions & 1 deletion definitions/rna_parameters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,25 @@ human_genome_reference:
- gatk_splitncigarreads
- gatk_variantfiltration
- star_aln
build_file: 1
data_type: SCALAR
default: GRCh37_homo_sapiens_-d5-.fasta
exists_check: file
reference: reference_dir
type: path
human_genome_reference_file_endings:
associated_program:
- gatk_asereadcounter
- gatk_baserecalibration
- gatk_haplotypecaller
- gatk_splitncigarreads
- gatk_variantfiltration
- star_aln
build_file: 1
data_type: SCALAR
exists_check: file
mandatory: no
reference: reference_dir
type: path
## GATK FTP Bundle Download version. Needed for all programs that download the human genome reference
gatk_bundle_download_version:
associated_program:
Expand Down
246 changes: 2 additions & 244 deletions lib/MIP/Check/Reference.pm
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,11 @@ BEGIN {
our $VERSION = 1.03;

# Functions and variables which can be optionally exported
our @EXPORT_OK = qw{ check_bwa_prerequisites
check_capture_file_prerequisites
check_human_genome_file_endings
check_human_genome_prerequisites
our @EXPORT_OK = qw{ check_human_genome_file_endings
check_if_processed_by_vt
check_object_suffixes_to_build
check_parameter_metafiles
check_references_for_vt
check_rtg_prerequisites };
check_references_for_vt };
}

## Constants
Expand All @@ -41,134 +37,6 @@ Readonly my $NEWLINE => qq{\n};
Readonly my $SPACE => q{ };
Readonly my $TAB => qq{\t};

sub check_capture_file_prerequisites {

## Function : Check if capture file prerequisites needs to be built and initate process to build them if required
## Returns :
## Arguments: $active_parameter_href => Active parameters for this analysis hash {REF}
## : $FILEHANDLE => Filehandle to write to
## : $infile_lane_prefix_href => Infile(s) without the ".ending" {REF}
## : $infile_list_suffix => Infile list suffix
## : $job_id_href => Job id hash {REF}
## : $log => Log object
## : $padded_infile_list_suffix => Padded infile list suffix
## : $padded_interval_list_suffix => Padded interval list suffix
## : $parameter_href => Parameter hash {REF}
## : $program_name => Program name
## : $sample_info_href => Info on samples and family hash {REF}

my ($arg_href) = @_;

## Flatten argument(s)
my $active_parameter_href;
my $FILEHANDLE;
my $infile_lane_prefix_href;
my $infile_list_suffix;
my $job_id_href;
my $log;
my $padded_infile_list_suffix;
my $padded_interval_list_suffix;
my $parameter_href;
my $program_name;
my $sample_info_href;

my $tmpl = {
active_parameter_href => {
default => {},
defined => 1,
required => 1,
store => \$active_parameter_href,
strict_type => 1,
},
FILEHANDLE => { store => \$FILEHANDLE, },
infile_lane_prefix_href => {
default => {},
defined => 1,
required => 1,
store => \$infile_lane_prefix_href,
strict_type => 1,
},
infile_list_suffix => {
defined => 1,
required => 1,
store => \$infile_list_suffix,
strict_type => 1,
},
job_id_href => {
default => {},
defined => 1,
required => 1,
store => \$job_id_href,
strict_type => 1,
},
log => {
defined => 1,
required => 1,
store => \$log,
},
parameter_href => {
default => {},
defined => 1,
required => 1,
store => \$parameter_href,
strict_type => 1,
},
padded_infile_list_suffix => {
defined => 1,
required => 1,
store => \$padded_infile_list_suffix,
strict_type => 1,
},
padded_interval_list_suffix => {
defined => 1,
required => 1,
store => \$padded_interval_list_suffix,
strict_type => 1,
},
program_name => {
defined => 1,
required => 1,
store => \$program_name,
strict_type => 1,
},
sample_info_href => {
default => {},
defined => 1,
required => 1,
store => \$sample_info_href,
strict_type => 1,
},
};

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

use MIP::Recipes::Build::Capture_file_prerequisites
qw{ build_capture_file_prerequisites };

if ( $parameter_href->{exome_target_bed}{build_file} == 1 ) {

build_capture_file_prerequisites(
{
active_parameter_href => $active_parameter_href,
FILEHANDLE => $FILEHANDLE,
infile_lane_prefix_href => $infile_lane_prefix_href,
infile_list_suffix => $infile_list_suffix,
job_id_href => $job_id_href,
log => $log,
padded_infile_list_suffix => $padded_infile_list_suffix,
padded_interval_list_suffix => $padded_interval_list_suffix,
parameter_href => $parameter_href,
program_name => $program_name,
sample_info_href => $sample_info_href,
}
);

## Only build once for all modules and files
$parameter_href->{exome_target_bed}{build_file} = 0;
}
return;
}

sub check_human_genome_file_endings {

## Function : Check the existance of associated human genome files.
Expand Down Expand Up @@ -293,116 +161,6 @@ sub check_human_genome_file_endings {
return;
}

sub check_human_genome_prerequisites {

## Function : Checks if the human genome prerequisites needs to be built and builds them if required
## Returns :
## Arguments: $active_parameter_href => Active parameters for this analysis hash {REF}
## : $file_info_href => File info hash {REF}
## : $infile_lane_prefix_href => Infile(s) without the ".ending" {REF}
## : $job_id_href => Job id hash {REF}
## : $log => Log object
## : $program_name => Program name
## : $parameter_href => Parameter hash {REF}
## : $sample_info_href => Info on samples and family hash {REF}

my ($arg_href) = @_;

## Flatten argument(s)
my $active_parameter_href;
my $file_info_href;
my $infile_lane_prefix_href;
my $job_id_href;
my $log;
my $parameter_href;
my $program_name;
my $sample_info_href;

my $tmpl = {
active_parameter_href => {
default => {},
defined => 1,
required => 1,
store => \$active_parameter_href,
strict_type => 1,
},
file_info_href => {
default => {},
defined => 1,
required => 1,
store => \$file_info_href,
strict_type => 1,
},
infile_lane_prefix_href => {
default => {},
defined => 1,
required => 1,
store => \$infile_lane_prefix_href,
strict_type => 1,
},
job_id_href => {
default => {},
defined => 1,
required => 1,
store => \$job_id_href,
strict_type => 1,
},
log => {
defined => 1,
required => 1,
store => \$log,
},
parameter_href => {
default => {},
defined => 1,
required => 1,
store => \$parameter_href,
strict_type => 1,
},
program_name => {
defined => 1,
required => 1,
store => \$program_name,
strict_type => 1,
},
sample_info_href => {
default => {},
defined => 1,
required => 1,
store => \$sample_info_href,
strict_type => 1,
},
};

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

use MIP::Recipes::Build::Human_genome_prerequisites
qw{ build_human_genome_prerequisites };

## Files assocaiated with human genome reference
if ( $parameter_href->{human_genome_reference}{build_file} == 1
|| $file_info_href->{human_genome_compressed} eq q{compressed} )
{

## Creates the humangenomeprerequisites using active_parameters{human_genome_reference} as reference
build_human_genome_prerequisites(
{
active_parameter_href => $active_parameter_href,
family_id => $active_parameter_href->{family_id},
file_info_href => $file_info_href,
infile_lane_prefix_href => $infile_lane_prefix_href,
job_id_href => $job_id_href,
log => $log,
outaligner_dir => $active_parameter_href->{outaligner_dir},
parameter_href => $parameter_href,
program_name => $program_name,
sample_info_href => $sample_info_href,
}
);
}
return 1;
}

sub check_if_processed_by_vt {

## Function : Check if vt has processed references using regexp
Expand Down
7 changes: 4 additions & 3 deletions lib/MIP/Main/Analyse.pm
Original file line number Diff line number Diff line change
Expand Up @@ -396,13 +396,14 @@ sub mip_analyse {
}
);

## Detect version and source of the human_genome_reference: Source (hg19 or GRCh).
## Detect version and source of the human_genome_reference: Source (hg19 or GRCh) and check compression status
set_human_genome_reference_features(
{
file_info_href => \%file_info,
human_genome_reference =>
basename( $active_parameter{human_genome_reference} ),
log => $log,
log => $log,
parameter_href => \%parameter,
}
);

Expand Down Expand Up @@ -490,7 +491,7 @@ sub mip_analyse {
file_info_href => \%file_info,
log => $log,
parameter_href => \%parameter,
parameter_name => q{human_genome_reference},
parameter_name => q{human_genome_reference_file_endings},
}
);

Expand Down
10 changes: 6 additions & 4 deletions lib/MIP/Recipes/Build/Bwa_prerequisites.pm
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,12 @@ sub build_bwa_prerequisites {
infile_lane_prefix_href => $infile_lane_prefix_href,
job_id_href => $job_id_href,
log => $log,
parameter_href => $parameter_href,
program_name => $program_name,
random_integer => $random_integer,
sample_info_href => $sample_info_href,
parameter_build_suffixes_ref =>
\@{ $file_info_href->{human_genome_reference_file_endings} },
parameter_href => $parameter_href,
program_name => $program_name,
random_integer => $random_integer,
sample_info_href => $sample_info_href,
}
);

Expand Down

0 comments on commit 4e02d82

Please sign in to comment.