Skip to content

Commit

Permalink
Merge 2dbd369 into b3ebb15
Browse files Browse the repository at this point in the history
  • Loading branch information
jemten committed Jan 22, 2021
2 parents b3ebb15 + 2dbd369 commit fbe2c8e
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 79 deletions.
26 changes: 12 additions & 14 deletions definitions/rd_rna_initiation_map.yaml
Expand Up @@ -2,7 +2,6 @@
CHAIN_ALL:
- CHAIN_MAIN:
- gzip_fastq
# Parallel chains (branch)
- CHAIN_FASTQC:
- fastqc_ar
- CHAIN_MAIN:
Expand All @@ -17,27 +16,26 @@ CHAIN_ALL:
- CHAIN_MAIN:
- star_aln
- picardtools_mergesamfiles
- CHAIN_PTCRM:
- picardtools_collectrnaseqmetrics
- CHAIN_STRINGTIE:
- stringtie_ar
- gffcompare_ar
- CHAIN_QC:
- PARALLEL:
- picardtools_collectrnaseqmetrics
- preseq_ar
- rseqc
- genebody_coverage
- CHAIN_ASE:
- markduplicates
- gatk_splitncigarreads
- gatk_baserecalibration
- gatk_haplotypecaller
- gatk_variantfiltration
- dna_vcf_reformat
- gatk_asereadcounter
- bootstrapann
- bcftools_merge
- varianteffectpredictor
- CHAIN_ASE:
- markduplicates
- gatk_splitncigarreads
- gatk_baserecalibration
- gatk_haplotypecaller
- gatk_variantfiltration
- dna_vcf_reformat
- gatk_asereadcounter
- bootstrapann
- bcftools_merge
- varianteffectpredictor
- qccollect_ar
- version_collect_ar
- multiqc_ar
Expand Down
9 changes: 5 additions & 4 deletions definitions/rd_rna_parameters.yaml
Expand Up @@ -131,15 +131,15 @@ recipe_time:
fastqc_ar: 1
gatk_asereadcounter: 2
gatk_baserecalibration: 5
gatk_haplotypecaller: 4
gatk_haplotypecaller: 6
gatk_splitncigarreads: 8
gatk_variantfiltration: 1
genebody_coverage: 3
gffcompare_ar: 1
gzip_fastq: 2
markduplicates: 8
multiqc_ar: 1
picardtools_collectrnaseqmetrics: 1
picardtools_collectrnaseqmetrics: 2
picardtools_mergesamfiles: 2
preseq_ar: 2
qccollect_ar: 1
Expand All @@ -163,12 +163,12 @@ recipe_memory:
dna_vcf_reformat: 2
gatk_asereadcounter: 25
gatk_variantfiltration: 8
genebody_coverage: 8
genebody_coverage: 12
multiqc_ar: 10
picardtools_collectrnaseqmetrics: 5
picardtools_mergesamfiles: 5
preseq_ar: 8
rseqc: 25
rseqc: 30
salmon_quant: 2
star_aln: 3
star_fusion: 3
Expand Down Expand Up @@ -277,6 +277,7 @@ salmon_quant:
file_tag: quant
outfile_suffix: ".sf"
program_executables:
- pigz
- salmon
type: recipe
salmon_quant_reference_genome:
Expand Down
33 changes: 17 additions & 16 deletions lib/MIP/Program/Pigz.pm
Expand Up @@ -60,31 +60,29 @@ sub pigz {
my $verbose;

my $tmpl = {
decompress => { store => \$decompress, strict_type => 1, },
filehandle => { store => \$filehandle, },
infile_path => {
defined => 1,
required => 1,
store => \$infile_path,
strict_type => 1,
},
stdout => { store => \$stdout, strict_type => 1, },
decompress => { store => \$decompress, strict_type => 1, },
outfile_path => { store => \$outfile_path, strict_type => 1, },
processes => {
allow => qr{ \A\d+\z }sxm,
store => \$processes,
strict_type => 1,
},
filehandle => { store => \$filehandle, },
stderrfile_path => { store => \$stderrfile_path, strict_type => 1, },
stderrfile_path_append =>
{ store => \$stderrfile_path_append, strict_type => 1, },
quiet => {
allow => [ 0, 1 ],
default => 0,
store => \$quiet,
strict_type => 1,
},
verbose => {
stderrfile_path => { store => \$stderrfile_path, strict_type => 1, },
stderrfile_path_append => { store => \$stderrfile_path_append, strict_type => 1, },
stdout => { store => \$stdout, strict_type => 1, },
verbose => {
allow => [ 0, 1 ],
default => 0,
store => \$verbose,
Expand All @@ -96,6 +94,11 @@ sub pigz {

my @commands = ( get_executable_base_command( { base_command => q{pigz} } ), );

if ($decompress) {

push @commands, q{--decompress};
}

if ($processes) {

push @commands, q{--processes} . $SPACE . $processes;
Expand All @@ -106,23 +109,21 @@ sub pigz {
push @commands, q{--quiet};
}

if ($verbose) {
if ($stdout) {

push @commands, q{--verbose};
push @commands, q{--stdout};
}

if ($decompress) {
if ($verbose) {

push @commands, q{--decompress};
push @commands, q{--verbose};
}

if ($stdout) {
if ($infile_path) {

push @commands, q{--stdout};
push @commands, $infile_path;
}

push @commands, $infile_path;

if ($outfile_path) {

push @commands, q{>} . $SPACE . $outfile_path;
Expand Down
5 changes: 3 additions & 2 deletions lib/MIP/Program/Salmon.pm
Expand Up @@ -136,13 +136,13 @@ sub salmon_quant {
my $outdir_path;
my $read_1_fastq_paths_ref;
my $read_2_fastq_paths_ref;
my $read_files_command;
my $stderrfile_path;
my $stderrfile_path_append;
my $stdoutfile_path;

## Default(s)
my $lib_type;
my $read_files_command;
my $validate_mappings;

my $tmpl = {
Expand Down Expand Up @@ -185,7 +185,8 @@ sub salmon_quant {
strict_type => 1,
},
read_files_command => {
default => q{pigz -dc},
required => 1,
defined => 1,
store => \$read_files_command,
strict_type => 1,
},
Expand Down
14 changes: 13 additions & 1 deletion lib/MIP/Recipes/Analysis/Salmon_quant.pm
Expand Up @@ -17,7 +17,7 @@ use List::MoreUtils qw{ uniq };
use Readonly;

## MIPs lib/
use MIP::Constants qw{ $LOG_NAME $NEWLINE };
use MIP::Constants qw{ $LOG_NAME $NEWLINE $SPACE };

BEGIN {

Expand Down Expand Up @@ -129,6 +129,7 @@ sub analysis_salmon_quant {

use MIP::File_info qw{ get_sample_file_attribute };
use MIP::File_info qw{ get_io_files parse_io_outfiles };
use MIP::Program::Pigz qw{ pigz };
use MIP::Program::Salmon qw{ salmon_quant };
use MIP::Processmanagement::Processes qw{ submit_recipe };
use MIP::Recipe qw{ parse_recipe_prerequisites };
Expand Down Expand Up @@ -230,6 +231,13 @@ sub analysis_salmon_quant {
}
);

my @read_file_commands = pigz(
{
decompress => 1,
stdout => 1,
}
);

## For paired end
if ( $sequence_run_type eq q{paired-end} ) {

Expand All @@ -249,6 +257,8 @@ sub analysis_salmon_quant {
outdir_path => $outdir_path,
read_1_fastq_paths_ref => \@read_1_fastq_paths,
read_2_fastq_paths_ref => \@read_2_fastq_paths,
read_files_command => join $SPACE,
@read_file_commands,
}
);
say {$filehandle} $NEWLINE;
Expand All @@ -263,6 +273,8 @@ sub analysis_salmon_quant {
index_path => $referencefile_dir_path,
outdir_path => $outdir_path,
read_1_fastq_paths_ref => \@infile_paths,
read_files_command => join $SPACE,
@read_file_commands,
}
);
say {$filehandle} $NEWLINE;
Expand Down
45 changes: 13 additions & 32 deletions t/pigz.t
Expand Up @@ -23,16 +23,13 @@ use lib catdir( dirname($Bin), q{lib} );
use MIP::Constants qw{ $COMMA $SPACE };
use MIP::Test::Commands qw{ test_function };


BEGIN {

use MIP::Test::Fixtures qw{ test_import };

### Check all internal dependency modules and imports
## Modules with import
my %perl_module = (
q{MIP::Program::Pigz} => [qw{ pigz }],
);
my %perl_module = ( q{MIP::Program::Pigz} => [qw{ pigz }], );

test_import( { perl_module_href => \%perl_module, } );
}
Expand All @@ -57,24 +54,15 @@ my %base_argument = (
},
);

## Can be duplicated with %base_argument and/or %specific_argument
## to enable testing of each individual argument
my %required_argument = (
filehandle => {
input => undef,
expected_output => \@function_base_commands,
},
infile_path => {
input => q{infile_path},
expected_output => q{infile_path},
},
);

my %specific_argument = (
decompress => {
input => q{decompress},
expected_output => q{--decompress},
},
infile_path => {
input => q{infile_path},
expected_output => q{infile_path},
},
outfile_path => {
input => q{outfile_path},
expected_output => q{> outfile_path},
Expand Down Expand Up @@ -109,20 +97,13 @@ my %specific_argument = (
## Coderef - enables generalized use of generate call
my $module_function_cref = \&pigz;

## Test both base and function specific arguments
my @arguments = ( \%required_argument, \%specific_argument );

HASHES_OF_ARGUMENTS:
foreach my $argument_href (@arguments) {
my @commands = test_function(
{
argument_href => $argument_href,
do_test_base_command => 1,
function_base_commands_ref => \@function_base_commands,
module_function_cref => $module_function_cref,
required_argument_href => \%required_argument,
}
);
}
my @commands = test_function(
{
argument_href => \%specific_argument,
do_test_base_command => 1,
function_base_commands_ref => \@function_base_commands,
module_function_cref => $module_function_cref,
}
);

done_testing();
18 changes: 8 additions & 10 deletions t/salmon_quant.t
Expand Up @@ -23,16 +23,13 @@ use lib catdir( dirname($Bin), q{lib} );
use MIP::Constants qw{ $COMMA $SPACE };
use MIP::Test::Commands qw{ test_function };


BEGIN {

use MIP::Test::Fixtures qw{ test_import };

### Check all internal dependency modules and imports
## Modules with import
my %perl_module = (
q{MIP::Program::Salmon} => [qw{ salmon_quant }],
);
my %perl_module = ( q{MIP::Program::Salmon} => [qw{ salmon_quant }], );

test_import( { perl_module_href => \%perl_module, } );
}
Expand Down Expand Up @@ -81,8 +78,7 @@ my %required_argument = (
expected_output => q{--output} . $SPACE . catdir(qw{ dir output_dir }),
},
read_1_fastq_paths_ref => {
inputs_ref =>
[ catfile(qw{ dir hi_r1.fastq.gz }), catfile(qw{ dir hello_r1.fastq.gz }) ],
inputs_ref => [ catfile(qw{ dir hi_r1.fastq.gz }), catfile(qw{ dir hello_r1.fastq.gz }) ],
expected_output => q{-1}
. $SPACE . q{<(}
. $READ_FILES_COMMAND
Expand All @@ -92,6 +88,10 @@ my %required_argument = (
. catfile(qw{ dir hello_r1.fastq.gz })
. $SPACE . q{)}
},
read_files_command => {
input => $READ_FILES_COMMAND,
expected_output => $READ_FILES_COMMAND,
},
);

my %specific_argument = (
Expand All @@ -108,8 +108,7 @@ my %specific_argument = (
expected_output => q{--output} . $SPACE . catdir(qw{ dir output_dir }),
},
read_1_fastq_paths_ref => {
inputs_ref =>
[ catfile(qw{ dir hi_r1.fastq.gz }), catfile(qw{ dir hello_r1.fastq.gz }) ],
inputs_ref => [ catfile(qw{ dir hi_r1.fastq.gz }), catfile(qw{ dir hello_r1.fastq.gz }) ],
expected_output => q{-1}
. $SPACE . q{<(}
. $READ_FILES_COMMAND
Expand All @@ -120,8 +119,7 @@ my %specific_argument = (
. $SPACE . q{)}
},
read_2_fastq_paths_ref => {
inputs_ref =>
[ catfile(qw{ dir hi_r2.fastq.gz }), catfile(qw{ dir hello_r2.fastq.gz }) ],
inputs_ref => [ catfile(qw{ dir hi_r2.fastq.gz }), catfile(qw{ dir hello_r2.fastq.gz }) ],
expected_output => q{-2}
. $SPACE . q{<(}
. $READ_FILES_COMMAND
Expand Down

0 comments on commit fbe2c8e

Please sign in to comment.