Skip to content

Commit

Permalink
feat(rna_recipes): removing seperate markduplicates recipe for rna
Browse files Browse the repository at this point in the history
  • Loading branch information
jemten committed Jan 20, 2021
1 parent 3b2149d commit 1966e5f
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 612 deletions.
1 change: 1 addition & 0 deletions definitions/rd_dna_parameters.yaml
Expand Up @@ -502,6 +502,7 @@ markduplicates:
outfile_suffix: ".bam"
program_executables:
- picard
- samtools
type: recipe
markduplicates_picardtools_opt_dup_dist:
associated_recipe:
Expand Down
4 changes: 2 additions & 2 deletions definitions/rd_rna_parameters.yaml
Expand Up @@ -198,7 +198,7 @@ recipe_core_number:
gffcompare_ar: 1
gzip_fastq: 0
multiqc_ar: 1
markduplicates: 16
markduplicates: 13
picardtools_collectrnaseqmetrics: 1
picardtools_mergesamfiles: 13
preseq_ar: 1
Expand Down Expand Up @@ -524,7 +524,7 @@ markduplicates:
outfile_suffix: ".bam"
program_executables:
- picard
- sambamba
- samtools
type: recipe
markduplicates_picardtools_opt_dup_dist:
associated_recipe:
Expand Down
116 changes: 3 additions & 113 deletions lib/MIP/Recipes/Analysis/Gatk_baserecalibration.pm
Expand Up @@ -149,7 +149,6 @@ sub analysis_gatk_baserecalibration {
use MIP::Parse::File qw{ parse_io_outfiles };
use MIP::Processmanagement::Processes qw{ submit_recipe };
use MIP::Program::Gatk qw{ gatk_applybqsr gatk_baserecalibrator gatk_gatherbqsrreports };
use MIP::Program::Picardtools qw{ picardtools_gatherbamfiles };
use MIP::Program::Samtools qw{ samtools_index samtools_view };
use MIP::Recipe qw{ parse_recipe_prerequisites };
use MIP::Recipes::Analysis::Xargs qw{ xargs_command };
Expand Down Expand Up @@ -384,68 +383,6 @@ sub analysis_gatk_baserecalibration {
say {$xargsfilehandle} $NEWLINE;
}

## Gather BAM files
say {$filehandle} q{## Gather BAM files};

## Assemble infile paths in contig order and not per size
my @gather_infile_paths =
map { $outfile_path{$_} } @{ $file_info_href->{bam_contigs} };
my $store_outfile_path = $outfile_path_prefix . $outfile_suffix;

picardtools_gatherbamfiles(
{
create_index => q{true},
filehandle => $filehandle,
infile_paths_ref => \@gather_infile_paths,
java_jar => catfile( $active_parameter_href->{picardtools_path}, q{picard.jar} ),
java_use_large_pages => $active_parameter_href->{java_use_large_pages},
memory_allocation => q{Xmx4g},
outfile_path => $outfile_path_prefix . $outfile_suffix,
referencefile_path => $referencefile_path,
temp_directory => $temp_directory,
}
);
say {$filehandle} $NEWLINE;

## Rename the bam file index file so that Expansion Hunter can find it
say {$filehandle}
q{## Copy index file to ".bam.bai" so that Expansionhunter can find it downstream};

gnu_cp(
{
filehandle => $filehandle,
force => 1,
infile_path => $outfile_path_prefix . q{.bai},
outfile_path => $outfile_path_prefix . $outfile_suffix . q{.bai},
}
);
say {$filehandle} $NEWLINE;

## Create BAM to CRAM for long term storage

$store_outfile_path = $outfile_path_prefix . $DOT . q{cram};

say {$filehandle} q{## Convert BAM to CRAM for long term storage};
samtools_view(
{
filehandle => $filehandle,
infile_path => $outfile_path_prefix . $outfile_suffix,
outfile_path => $store_outfile_path,
output_format => q{cram},
referencefile_path => $referencefile_path,
thread_number => $parallel_processes,
}
);
say {$filehandle} $NEWLINE;

## Index CRAM
samtools_index(
{
filehandle => $filehandle,
infile_path => $store_outfile_path,
}
);

close $xargsfilehandle;
close $filehandle;

Expand All @@ -455,24 +392,13 @@ sub analysis_gatk_baserecalibration {
set_recipe_outfile_in_sample_info(
{
infile => $outfile_name_prefix,
path => $store_outfile_path,
path => $outfile_paths[0],
recipe_name => $recipe_name,
sample_id => $sample_id,
sample_info_href => $sample_info_href,
}
);

set_file_path_to_store(
{
format => q{cram},
id => $sample_id,
path => $store_outfile_path,
path_index => $store_outfile_path . $DOT . q{crai},
recipe_name => $recipe_name,
sample_info_href => $sample_info_href,
}
);

submit_recipe(
{
base_command => $profile_base_command,
Expand Down Expand Up @@ -589,9 +515,8 @@ sub analysis_gatk_baserecalibration_panel {
use MIP::Parse::File qw{ parse_io_outfiles };
use MIP::Processmanagement::Processes qw{ submit_recipe };
use MIP::Program::Gatk qw{ gatk_applybqsr gatk_baserecalibrator };
use MIP::Program::Samtools qw{ samtools_index samtools_view };
use MIP::Recipe qw{ parse_recipe_prerequisites };
use MIP::Sample_info qw{ set_file_path_to_store set_recipe_outfile_in_sample_info };
use MIP::Sample_info qw{ set_recipe_outfile_in_sample_info };
use MIP::Script::Setup_script qw{ setup_script };

### PREPROCESSING:
Expand Down Expand Up @@ -730,30 +655,6 @@ sub analysis_gatk_baserecalibration_panel {
);
say {$filehandle} $NEWLINE;

## Create BAM to CRAM for long term storage
my $store_outfile_path = $outfile_path_prefix . $DOT . q{cram};

say {$filehandle} q{## Convert BAM to CRAM for long term storage};
samtools_view(
{
filehandle => $filehandle,
infile_path => $outfile_path,
outfile_path => $store_outfile_path,
output_format => q{cram},
referencefile_path => $referencefile_path,
thread_number => $parallel_processes,
}
);
say {$filehandle} $NEWLINE;

## Index CRAM
samtools_index(
{
filehandle => $filehandle,
infile_path => $store_outfile_path,
}
);

close $filehandle;

if ( $recipe{mode} == 1 ) {
Expand All @@ -762,24 +663,13 @@ sub analysis_gatk_baserecalibration_panel {
set_recipe_outfile_in_sample_info(
{
infile => $outfile_name_prefix,
path => $store_outfile_path,
path => $outfile_path,
recipe_name => $recipe_name,
sample_id => $sample_id,
sample_info_href => $sample_info_href,
}
);

set_file_path_to_store(
{
format => q{cram},
id => $sample_id,
path => $store_outfile_path,
path_index => $store_outfile_path . $DOT . q{crai},
recipe_name => $recipe_name,
sample_info_href => $sample_info_href,
}
);

submit_recipe(
{
base_command => $profile_base_command,
Expand Down

0 comments on commit 1966e5f

Please sign in to comment.