Skip to content

Commit

Permalink
feat(sample_id): disable sample_id in filename check
Browse files Browse the repository at this point in the history
  • Loading branch information
jemten committed Jan 15, 2021
1 parent d8e54ec commit 8b49948
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 6 deletions.
6 changes: 6 additions & 0 deletions definitions/analyse_parameters.yaml
Expand Up @@ -79,6 +79,12 @@ exclude_contigs:
data_type: ARRAY
mandatory: no
type: mip
external_data:
associated_recipe:
- mip
data_type: SCALAR
mandatory: no
type: mip
case_id:
associated_recipe:
- mip
Expand Down
1 change: 1 addition & 0 deletions lib/MIP/Active_parameter.pm
Expand Up @@ -1273,6 +1273,7 @@ sub parse_infiles {
## Check infiles found and that they contain sample_id
check_infiles(
{
external_data => $active_parameter_href->{external_data},
infiles_ref => \@infiles,
infile_directory => $infile_directory,
sample_id => $sample_id,
Expand Down
18 changes: 13 additions & 5 deletions lib/MIP/Cli/Mip/Analyse.pm
Expand Up @@ -66,6 +66,15 @@ q{Check analysis output and sets the analysis run status flag to finished in sam
)
);

parameter(
q{case_id} => (
documentation => q{Group id of samples to be compared},
is => q{rw},
isa => Str,
required => 1,
)
);

option(
q{cluster_constant_path} => (
documentation => q{Set the cluster constant path},
Expand Down Expand Up @@ -136,12 +145,11 @@ q{Check analysis output and sets the analysis run status flag to finished in sam
)
);

parameter(
q{case_id} => (
documentation => q{Group id of samples to be compared},
option(
q{external_data} => (
documentation => q{Disable checks of fastq filename},
is => q{rw},
isa => Str,
required => 1,
isa => Bool,
)
);

Expand Down
11 changes: 10 additions & 1 deletion lib/MIP/Validate/Case.pm
Expand Up @@ -29,18 +29,25 @@ sub check_infiles {

## Function : Check infiles found and that they contain sample_id
## Returns :
## Arguments: $infiles_ref => Infiles to check {REF}
## Arguments: $external data => Skip check on external data
## : $infiles_ref => Infiles to check {REF}
## : $infile_directory => Infile directory
## : $sample_id => Sample id

my ($arg_href) = @_;

## Flatten argument(s)
my $external_data;
my $infiles_ref;
my $infile_directory;
my $sample_id;

my $tmpl = {
external_data => {
allow => [ undef, 0, 1 ],
store => \$external_data,
strict_type => 1,
},
infile_directory => {
defined => 1,
required => 1,
Expand Down Expand Up @@ -74,6 +81,8 @@ sub check_infiles {
exit 1;
}

return 1 if ($external_data);

## Check that infiledirs/infile contains sample_id in filename
INFILE:
foreach my $infile ( @{$infiles_ref} ) {
Expand Down
13 changes: 13 additions & 0 deletions t/check_infiles.t
Expand Up @@ -130,4 +130,17 @@ my $is_ok = check_infiles(
## Then return true
ok( $is_ok, q{Passed check} );

## Given external indata
$is_ok = check_infiles(
{
external_data => 1,
infiles_ref => \@wrong_infiles,
infile_directory => $infile_directory,
sample_id => $sample_id,
}
);

## Then return true
ok( $is_ok, q{Passed check for external data} );

done_testing();

0 comments on commit 8b49948

Please sign in to comment.