From acb234f8bc8f6cbb2ac08a8a5be7ea8166747337 Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 27 Jun 2023 12:25:26 +0100 Subject: [PATCH 1/2] tag_sniff get list of known tags via a URL rather than the warehouse DB --- Changes | 2 ++ bin/npg_qc_tag_sniff.pl | 56 +++++++++++++++++++++-------------------- 2 files changed, 31 insertions(+), 27 deletions(-) diff --git a/Changes b/Changes index af3df990..b8c33310 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,7 @@ LIST OF CHANGES FOR NPG-QC PACKAGE + - tag_sniff get list of known tags via a URL rather than the warehouse DB + release 70.2.1 - update version of github actions diff --git a/bin/npg_qc_tag_sniff.pl b/bin/npg_qc_tag_sniff.pl index d98a86ec..c0057695 100755 --- a/bin/npg_qc_tag_sniff.pl +++ b/bin/npg_qc_tag_sniff.pl @@ -14,6 +14,11 @@ use Carp; use Getopt::Long; use Term::ANSIColor qw(:constants); +use LWP::Simple qw(get); +use JSON; + +# this URL returns a complete set of known tags in json format +our $LIMS_TAGS_URL = q[https://sequencescape.psd.sanger.ac.uk/api/v2/tag_groups]; ##no critic our $VERSION = '0'; @@ -99,10 +104,10 @@ sub showTags{ my %tagsFound = @_; my $unassigned = $sampleSize; - my $class = 'npg_warehouse::Schema'; + my $class = 'WTSI::DNAP::Warehouse::Schema'; my $loaded = eval "require $class"; ## no critic (BuiltinFunctions::ProhibitStringyEval) if (!$loaded) { - croak q[Can't load module npg_warehouse::Schema]; + croak q[Can't load module WTSI::DNAP::Warehouse::Schema]; } my %db_tags = (); @@ -133,7 +138,7 @@ sub showTags{ } } elsif ($groups =~ /\d+_\d/) { # read the npg_plex_infomation table - my $s = npg_warehouse::Schema->connect(); + my $s = WTSI::DNAP::Warehouse::Schema->connect(); my $rs; my @rls = split(/[,]/, $groups); my $id = 0; @@ -142,10 +147,10 @@ sub showTags{ croak "Invalid run_lane $rl" unless $rl =~ m/^(\d+)_(\d)$/; my ($id_run,$lane) = ($1,$2); my $name = "run ${id_run} lane ${lane}"; - $rs = $s->resultset('NpgPlexInformation')->search({id_run=>$id_run, position=>$lane}); + $rs = $s->resultset('IseqProductMetric')->search({id_run=>$id_run, position=>$lane}); while(my $row = $rs->next) { my $tag_index = $row->tag_index; - my $sequence = $row->tag_sequence; + my $sequence = $row->tag_sequence4deplexing; if (!defined $tag_index || !defined $sequence) { next; } @@ -159,29 +164,26 @@ sub showTags{ } } } else { - # read the tag table - my $s = npg_warehouse::Schema->connect(); - my $rs; - my $tag_group_internal_id = ($groups ? [split(/[,]/, $groups)] : undef); - if (defined($tag_group_internal_id)) { - $rs = $s->resultset('Tag')->search({is_current=>1, tag_group_internal_id=>$tag_group_internal_id}); - } else { - $rs = $s->resultset('Tag')->search({is_current=>1}); + my $d = get($LIMS_TAGS_URL); + my $t = decode_json($d); + my %groups = (); + if ($groups) { + map {$groups{$_}++} (split(/[,]/, $groups)); } - while(my $row = $rs->next) { - my $name = $row->tag_group_name; - my $id = $row->tag_group_internal_id; - my $map_id = $row->map_id; - my $sequence = $row->expected_sequence; - if (!defined $name || !defined $id || !defined $map_id || !defined $sequence) { - next; - } - my $original = $sequence; - push(@{$db_tags{$sequence}},[$name,$id,$map_id,0,$original]); - if (@{$revcomps}) { - $sequence =~ tr/ACGTN/TGCAN/; - $sequence = reverse($sequence); - push(@{$db_tags{$sequence}},[$name,$id,$map_id,1,$original]); + foreach my $group (@{$t->{"data"}}) { + my $id = $group->{"id"}; + next if (%groups && !exists($groups{$id})); + my $name = $group->{"attributes"}->{"name"}; + foreach my $tag (@{$group->{"attributes"}->{"tags"}}) { + my $sequence = $tag->{"oligo"}; + my $map_id = $tag->{"index"}; + my $original = $sequence; + push(@{$db_tags{$sequence}},[$name,$id,$map_id,0,$original]); + if (@{$revcomps}) { + $sequence =~ tr/ACGTN/TGCAN/; + $sequence = reverse($sequence); + push(@{$db_tags{$sequence}},[$name,$id,$map_id,1,$original]); + } } } } From 5c60f96d0ea8384ac5f0aa066dda3b79132bfe71 Mon Sep 17 00:00:00 2001 From: jmtcsngr Date: Wed, 28 Jun 2023 17:00:20 +0100 Subject: [PATCH 2/2] prep release 70.3.0 --- Changes | 1 + 1 file changed, 1 insertion(+) diff --git a/Changes b/Changes index b8c33310..74475c0f 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,6 @@ LIST OF CHANGES FOR NPG-QC PACKAGE +release 70.3.0 - tag_sniff get list of known tags via a URL rather than the warehouse DB release 70.2.1