Skip to content

Commit

Permalink
Merge pull request #739 from wtsi-npg/devel
Browse files Browse the repository at this point in the history
pull from devel to master to create release 69.5.0
  • Loading branch information
mgcam authored Mar 11, 2021
2 parents b646913 + 1040d3c commit a5566ab
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 15 deletions.
9 changes: 9 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
LIST OF CHANGES FOR NPG-QC PACKAGE

release 69.5.0
- measures to speed-up generation of SeqQC pages:
- add a prefetch for compositions and components when retrieving autoqc
results from a database;
- use in-line custom sort function instead of a closure for ref_match
result objects
- disable a check for circular references in serialization of autoqc
result objects

release 69.4.0
- mqc skipper not to consider runs tagged 'no_auto' or 'no_mqc_skipper'

Expand Down
25 changes: 23 additions & 2 deletions lib/npg_qc/autoqc/qc_store.pm
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ autoqc result objects corresponding to JSON files.
my $query = npg_qc::autoqc::qc_store::query_non_tracking->new(
id_run => 123);
my $c = $obj->load_from_staging_archive($query, $archive_dir);
my $c = $obj->load_from_staging_archive($query, $archive_dir);
=cut

Expand Down Expand Up @@ -515,6 +515,14 @@ sub _build__available_classes {
return \@names;
}

=head2 _db_collection4compositions
Takes a listref of composition dbIDs, and queries all available QC result types
for each composition. Returns a collection of result objects of mixed QC
types
=cut

sub _db_collection4compositions {
my ($self, $composition_ids) = @_;

Expand All @@ -525,7 +533,20 @@ sub _db_collection4compositions {
if (@{$composition_ids}) {
foreach my $name (@{$self->_available_classes}) {
push @rows, $self->qc_schema()->resultset($name)
->search({'me.id_seq_composition' => $composition_ids})->all();
->search(
{
'me.id_seq_composition' => $composition_ids
},
{
# later uses of this collection will need access to components
# and prefetching halves the overhead
prefetch => {
'seq_composition' => {
'seq_component_compositions' => 'seq_component'
}
}
}
)->all();
}
}

Expand Down
13 changes: 5 additions & 8 deletions lib/npg_qc/autoqc/role/ref_match.pm
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,11 @@ sub ranked_organisms {
# Deterministic ranking of organisms:
# reverse numerical comparison of alignment results
# followed, if necessary, by string comparison of names.
my $compare = sub {
my ($org1, $org2) = @_;
my $result = $ratings->{$org2} <=> $ratings->{$org1};
$result ||= $org1 cmp $org2;
return $result;
};

my @ranked_organisms = sort { $compare->($a, $b) } keys %{$ratings};
## no critic (BuiltinFunctions::ProhibitReverseSortBlock)
my @ranked_organisms = sort {
$ratings->{$b} <=> $ratings->{$a}
|| $a cmp $b
} keys %{$ratings};

return \@ranked_organisms;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/npg_qc/autoqc/role/result.pm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use Readonly;
use List::MoreUtils qw(none uniq);
use Digest::MD5 qw/md5_hex/;

with Storage( 'traits' => ['OnlyWhenBuilt'],
with Storage( 'traits' => [qw/OnlyWhenBuilt DisableCycleDetection/],
'format' => 'JSON',
'io' => 'File' ), 'npg_qc::autoqc::role::rpt_key';

Expand Down Expand Up @@ -380,7 +380,7 @@ Marina Gourtovaia E<lt>[email protected]<gt>
=head1 LICENSE AND COPYRIGHT
Copyright (C) 2014,2015,2016,2017,2018,2019,2020 Genome Research Ltd.
Copyright (C) 2014,2015,2016,2017,2018,2019,2020,2021 Genome Research Ltd.
This file is part of NPG.
Expand Down
6 changes: 3 additions & 3 deletions t/60-autoqc-checks-check.t
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ subtest 'validation of attributes' => sub {
plan tests => 36;
;
throws_ok {npg_qc::autoqc::checks::check->new(path => $path)}
qr/Either id_run or position key is undefined/,
qr/'id_run' key is undefined/,
'error on instantiating an object without any id';
throws_ok {npg_qc::autoqc::checks::check->new(path => $path, id_run => $idrun)}
qr/Either id_run or position key is undefined/,
qr/'position' key is undefined/,
'error on instantiating an object without either a position or rpt_list attr';
throws_ok {npg_qc::autoqc::checks::check->new(
position => 17, path => $path, id_run => $idrun)}
Expand All @@ -58,7 +58,7 @@ subtest 'validation of attributes' => sub {
lives_ok {npg_qc::autoqc::checks::check->new(position => 2, id_run => $idrun)}
'no error on instantiating an object without a path/qc_in attr';
throws_ok {npg_qc::autoqc::checks::check->new(position => 2, qc_in => 't')}
qr/Either id_run or position key is undefined/,
qr/'id_run' key is undefined/,
'error on instantiating an object without either a run id or an rpt_list attr';
throws_ok {npg_qc::autoqc::checks::check->new(
position => 1, path => 'nonexisting', id_run => -1)}
Expand Down

0 comments on commit a5566ab

Please sign in to comment.