From 7fc1bcb94870d6ef51ff979ce7368696cee36a08 Mon Sep 17 00:00:00 2001 From: Marina Gourtovaia Date: Tue, 10 Dec 2024 10:43:28 +0000 Subject: [PATCH] Excluded robo study-specific lane-lane assessment. Excluded study-specific lane-lane assessment in npg_qc::autoqc::check::review This helps to avoid uncertainty in evaluating lanes where samples belong to different studies at a price of not being able to perform study-specific evaluation of one-library lanes. --- Changes | 5 ++++ lib/npg_qc/autoqc/checks/review.pm | 25 +++++++++++++----- t/60-autoqc-checks-review.t | 27 +++++++++++++++++--- t/data/runfolder_49285/samplesheet_49285.csv | 4 +-- 4 files changed, 49 insertions(+), 12 deletions(-) diff --git a/Changes b/Changes index 3014ee17..75607062 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,10 @@ LIST OF CHANGES FOR NPG-QC PACKAGE + - Excluded study-specific lane-lane assessment in npg_qc::autoqc::check::review + This helps to avoid uncertainty in evaluating lanes where samples belong to + different studies at a price of not being able to perform study-specific + evaluation of one-library lanes. + release 74.0.0 (2024-12-02) - npg_qc::autoqc::qc_store - changed loading of ORM classes into memory to on demand at run time. diff --git a/lib/npg_qc/autoqc/checks/review.pm b/lib/npg_qc/autoqc/checks/review.pm index 8be4800e..e1fc4607 100644 --- a/lib/npg_qc/autoqc/checks/review.pm +++ b/lib/npg_qc/autoqc/checks/review.pm @@ -74,7 +74,8 @@ outcomes. The C section of the product configuration file sits either within the configuration for a particular study or in the C section, or in both locations. For a given entity a study-specific RoboQC definition -takes precedence over the default one. +takes precedence over the default one. For lanes only the C section +of the product configuration file is examined. Evaluation criteria for samples vary depending on the sequencing instrument and flowcell type, library type, sample reference, etc. Each of the @@ -487,14 +488,24 @@ has '_robo_config' => ( sub _build__robo_config { my $self = shift; - my $strict = 1; # Parse study section only, ignore the default section. - my $config = $self->study_config($self->lims(), $strict); - if ($config) { - $config = $config->{$ROBO_KEY}; + my $config; + + # Do not examine study-specific section for lane entities, meaning that + # one-sample lanes, pools or not, cannot be evaluated according to the + # study criteria of their sample. Helps to avoid uncertainty of dealing + # with pool's samples belonging to different studies. + if (!$self->lims->is_lane) { + my $strict = 1; # Parse study section only, ignore the 'default' section. + $config = $self->study_config($self->lims(), $strict); + if ($config) { + $config = $config->{$ROBO_KEY}; + } + if (!$config) { + carp 'Study-specific RoboQC config not found for ' . $self->_entity_desc; + } } - if (!$config) { - carp 'Study-specific RoboQC config not found for ' . $self->_entity_desc; + if (!$config) { # Look at the 'default' section of the configuration file. $config = $self->default_study_config()->{$ROBO_KEY}; } diff --git a/t/60-autoqc-checks-review.t b/t/60-autoqc-checks-review.t index ac7ebd23..6700c717 100644 --- a/t/60-autoqc-checks-review.t +++ b/t/60-autoqc-checks-review.t @@ -38,7 +38,7 @@ my $schema = Moose::Meta::Class->create_anon_class( ->create_test_db(q[npg_qc::Schema]); subtest 'constructing object, deciding whether to run' => sub { - plan tests => 33; + plan tests => 34; my $check = npg_qc::autoqc::checks::review->new( conf_path => $test_data_dir, @@ -148,6 +148,15 @@ subtest 'constructing object, deciding whether to run' => sub { } 'can set lims via the constructor'; ok ($check->can_run, 'can_run returns true'); + # No robo config in the default section, all samples belong to the same + # study, for which robo config is defined. + $check = npg_qc::autoqc::checks::review->new( + conf_path => "$test_data_dir/with_criteria", + qc_in => $test_data_dir, + rpt_list => '27483:1' + ); + ok (!$check->can_run, 'can_run returns false for a lane'); + $check = npg_qc::autoqc::checks::review->new( conf_path => "$test_data_dir/no_applicability4single", qc_in => $test_data_dir, @@ -812,14 +821,14 @@ subtest 'evaluating generic for artic results' => sub { }; subtest 'evaluating for LCMB library type' => sub { - plan tests => 14; + plan tests => 16; my $test_data_path = 't/data/runfolder_49285'; my $runfolder_name = '240802_A00537_1044_BHJKCGDSXC'; my $staging_dir = tempdir( CLEANUP => 1 ); my $id_run = 49285; local $ENV{NPG_CACHED_SAMPLESHEET_FILE} = - 't/data/runfolder_49285/samplesheet_49285.csv'; + "$test_data_path/samplesheet_49285.csv"; my $ae = Archive::Extract->new( archive => "${test_data_path}/${runfolder_name}.tar.gz" @@ -906,6 +915,18 @@ subtest 'evaluating for LCMB library type' => sub { {'mqc_seq_outcome' => 'Rejected preliminary', 'username' => 'robo_qc'}, 'lane QC outcome is saved correctly' ); + + $check = npg_qc::autoqc::checks::review->new( + runfolder_path => $runfolder_path, + conf_path => $test_data_path, + rpt_list => "${id_run}:4", + use_db => 1, + _qc_schema => $schema + ); + my $with_control = 0; + is_deeply ([$check->lims->study_ids($with_control)], [qw(7396 7397)], + 'lane 4 samples belong to two different studies'); + lives_and (sub {is $check->can_run, 1}, 'lane-level check can run'); }; 1; diff --git a/t/data/runfolder_49285/samplesheet_49285.csv b/t/data/runfolder_49285/samplesheet_49285.csv index a9d2cccb..ccfaf6cf 100644 --- a/t/data/runfolder_49285/samplesheet_49285.csv +++ b/t/data/runfolder_49285/samplesheet_49285.csv @@ -26,5 +26,5 @@ Lane,Sample_ID,Sample_Name,GenomeFolder,Index,Index2,bait_name,default_library_t 4,71446140,EGAN00004549103,,CGTCGTCG,CTCAGAAA,,LCMB,CGTCGTCG,CTCAGAAA,,0,0,72659884,3,71446140,,9606,from:450 to:450,Normal,Homo sapiens,0,,,9725055,0,7396STDY14893009,,888,1,0,0,7396,Some interesting study,Homo_sapiens (GRCh38_full_analysis_set_plus_decoy_hla),0,3, 4,71446152,EGAN00004549109,,TTCTCTTT,TCAGCCTG,,LCMB,TTCTCTTT,TCAGCCTG,,0,0,72659884,3,71446152,,9606,from:450 to:450,Normal,Homo sapiens,0,,,9725056,0,7396STDY14893010,,888,1,0,0,7396,Some interesting study,Homo_sapiens (GRCh38_full_analysis_set_plus_decoy_hla),0,4, 4,71446164,EGAN00004549107,,TCTCATAT,TTTGCACC,,LCMB,TCTCATAT,TTTGCACC,,0,0,72659884,3,71446164,,9606,from:450 to:450,Normal,Homo sapiens,0,,,9725057,0,7396STDY14893011,,888,1,0,0,7396,Some interesting study,Homo_sapiens (GRCh38_full_analysis_set_plus_decoy_hla),0,5, -4,71446176,EGAN00004549106,,TCGGGCTG,CGATCTGG,,LCMB,TCGGGCTG,CGATCTGG,,0,0,72659884,3,71446176,,9606,from:450 to:450,Normal,Homo sapiens,0,,,9725058,0,7396STDY14893012,,888,1,0,0,7396,Some interesting study,Homo_sapiens (GRCh38_full_analysis_set_plus_decoy_hla),0,6, -4,51702672,phiX_for_spiked_buffers,,TGTGCAGC,ACTGATGT,,,TGTGCAGC,ACTGATGT,,1,0,72659884,3,51702672,,10847,,,,0,,,1255141,,phiX_for_spiked_buffers,PhiX (Sanger-SNPs),888,1,0,0,198,Illumina Controls, ,0,888, \ No newline at end of file +4,71446176,EGAN00004549106,,TCGGGCTG,CGATCTGG,,LCMB,TCGGGCTG,CGATCTGG,,0,0,72659884,3,71446176,,9606,from:450 to:450,Normal,Homo sapiens,0,,,9725058,0,7396STDY14893012,,888,1,0,0,7397,One more interesting study,Homo_sapiens (GRCh38_full_analysis_set_plus_decoy_hla),0,6, +4,51702672,phiX_for_spiked_buffers,,TGTGCAGC,ACTGATGT,,,TGTGCAGC,ACTGATGT,,1,0,72659884,3,51702672,,10847,,,,0,,,1255141,,phiX_for_spiked_buffers,PhiX (Sanger-SNPs),888,1,0,0,198,Illumina Controls, ,0,888,