Skip to content

Commit ab803c8

Browse files
authored
Merge pull request #572 from wtsi-npg/devel
merge from devel to master to create release 91.2.0
2 parents 7a15d15 + dd2cee1 commit ab803c8

File tree

11 files changed

+401
-2
lines changed

11 files changed

+401
-2
lines changed

Changes

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
LIST OF CHANGES
22

3+
release 91.2.0
4+
- add support for finding primer_panel bed files
5+
36
release 91.1.0
47
- staging monitor changes for SP flowcells
58
- Update URL for production Sequencescape LIMS
69
- method for creating a lane-level st::api::lims object from
710
any other st::api::lims object where the resulting object has
811
the same driver as the original one
12+
- add support for finding primer_panel bed files
913

1014
release 91.0.0
1115
- modified is_i5opposite when there is no reverse read

MANIFEST

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,8 @@ lib/npg_tracking/data/gbs_plex.pm
249249
lib/npg_tracking/data/gbs_plex/find.pm
250250
lib/npg_tracking/data/geno_refset.pm
251251
lib/npg_tracking/data/geno_refset/find.pm
252+
lib/npg_tracking/data/primer_panel.pm
253+
lib/npg_tracking/data/primer_panel/find.pm
252254
lib/npg_tracking/data/reference.pm
253255
lib/npg_tracking/data/reference/find.pm
254256
lib/npg_tracking/data/reference/info.pm
@@ -400,6 +402,7 @@ t/10-npg_tracking-util-config.t
400402
t/10-npg_tracking-util-pipeline_config.t
401403
t/10-npg_tracking-util-db_connect.t
402404
t/10-npg_tracking-util-messages.t
405+
t/10-primer_panel.t
403406
t/10-reference-find.t
404407
t/10-reference-info.t
405408
t/10-reference-list.t
@@ -915,6 +918,8 @@ t/data/repos1/npg/run/7753.xml
915918
t/data/repos1/npg/run/7754.xml
916919
t/data/repos1/population_snv/Homo_sapiens/default/Human_all_exon_50MB/1000Genomes_hs37d5/Human_all_exon_50MB-1000Genomes_hs37d5.vcf.gz
917920
t/data/repos1/population_snv/Homo_sapiens/default/Standard/1000Genomes_hs37d5/Human_all_exon_50MB-1000Genomes_hs37d5.vcf.gz
921+
t/data/repos1/primer_panel/nCoV-2019/default/SARS-CoV-2/MN908947.3/nCoV-2019.bed
922+
t/data/repos1/primer_panel/nCoV-2019/V2/SARS-CoV-2/MN908947.3/nCoV-2019.bed
918923
t/data/repos1/references/Bordetella_pertussis/ST24/all/fasta/bpst24_May2010-1.fa
919924
t/data/repos1/references/Haemonchus_contortus/V1_21June13/all/fasta/haemonchus_V1.fa
920925
t/data/repos1/references/Homo_sapiens/1000Genomes/all/fasta/human_g1k_v37.fasta
@@ -931,6 +936,7 @@ t/data/repos1/references/PhiX/Illumina/all/fasta/phix-illumina.fa
931936
t/data/repos1/references/Plasmodium_falciparum/3D7/all/fasta/MAL.version2.1.4.fasta
932937
t/data/repos1/references/Salmonella_pullorum/449_87/all/fasta/Salmonella_pullorum_449_87.fasta
933938
t/data/repos1/references/Strongyloides_ratti/20100601/all/fasta/S_ratti_010610.fa
939+
t/data/repos1/references/SARS-CoV-2/MN908947.3/all/fasta/MN908947.3.fa
934940
t/data/repos1/st/batches/16442.xml
935941
t/data/repos1/st/batches/16467.xml
936942
t/data/repos1/st/batches/25539.xml

lib/npg_tracking/data/common.pm

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ sub find_file {
1717
}
1818

1919
my $file;
20-
if ( $data_dir && $subfolder ) {
21-
my $dir = catdir($data_dir, $subfolder);
20+
if ($data_dir) {
21+
my $dir = ( $data_dir && $subfolder ) ?
22+
catdir($data_dir, $subfolder) : $data_dir;
2223

2324
my @files;
2425
if (-d $dir) {
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
package npg_tracking::data::primer_panel;
2+
3+
use Moose;
4+
5+
our $VERSION = '0';
6+
7+
extends 'npg_tracking::data::reference';
8+
with 'npg_tracking::data::primer_panel::find';
9+
10+
__PACKAGE__->meta->make_immutable;
11+
no Moose;
12+
13+
1;
14+
__END__
15+
16+
=head1 NAME
17+
18+
npg_tracking::data::primer_panel
19+
20+
=head1 VERSION
21+
22+
=head1 SYNOPSIS
23+
24+
=head1 DESCRIPTION
25+
26+
A wrapper class for finding the location of primer panel related files.
27+
28+
=head1 SUBROUTINES/METHODS
29+
30+
=head2 id_run
31+
32+
=head2 position
33+
34+
=head2 tag_index
35+
36+
=head2 rpt_list
37+
38+
=head1 DIAGNOSTICS
39+
40+
=head1 CONFIGURATION AND ENVIRONMENT
41+
42+
=head1 DEPENDENCIES
43+
44+
=over
45+
46+
=item Moose
47+
48+
=item npg_tracking::data::reference
49+
50+
=item npg_tracking::data::primer_panel::find
51+
52+
=back
53+
54+
=head1 INCOMPATIBILITIES
55+
56+
=head1 BUGS AND LIMITATIONS
57+
58+
=head1 AUTHOR
59+
60+
=head1 LICENSE AND COPYRIGHT
61+
62+
Copyright (C) 2020 GRL
63+
64+
This file is part of NPG.
65+
66+
NPG is free software: you can redistribute it and/or modify
67+
it under the terms of the GNU General Public License as published by
68+
the Free Software Foundation, either version 3 of the License, or
69+
(at your option) any later version.
70+
71+
This program is distributed in the hope that it will be useful,
72+
but WITHOUT ANY WARRANTY; without even the implied warranty of
73+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
74+
GNU General Public License for more details.
75+
76+
You should have received a copy of the GNU General Public License
77+
along with this program. If not, see <http://www.gnu.org/licenses/>.
78+
79+
=cut
Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
package npg_tracking::data::primer_panel::find;
2+
3+
use strict;
4+
use warnings;
5+
use Moose::Role;
6+
use Carp;
7+
use Readonly;
8+
use File::Spec::Functions qw(catdir);
9+
10+
use npg_tracking::util::abs_path qw(abs_path);
11+
12+
with qw/ npg_tracking::data::reference::find
13+
npg_tracking::data::common /;
14+
15+
our $VERSION = '0';
16+
17+
Readonly::Scalar our $FORM => q[default];
18+
19+
has 'primer_panel' => ( isa => q{Maybe[Str]},
20+
is => q{ro},
21+
lazy => 1,
22+
builder => '_build_primer_panel',
23+
documentation => 'The primer panel optionally including version',);
24+
25+
sub _build_primer_panel {
26+
my $self = shift;
27+
return $self->lims->gbs_plex_name;
28+
}
29+
30+
has 'primer_panel_name' => ( isa => q{Maybe[Str]},
31+
is => q{ro},
32+
lazy => 1,
33+
builder => '_build_primer_panel_name',
34+
documentation => 'The primer panel name',);
35+
36+
sub _build_primer_panel_name {
37+
my $self = shift;
38+
my $name;
39+
if($self->primer_panel) {
40+
my @n = split /\//smx, $self->primer_panel;
41+
$name = $n[0];
42+
}
43+
return $name;
44+
}
45+
46+
has 'primer_panel_version' => ( isa => q{Maybe[Str]},
47+
is => q{ro},
48+
lazy => 1,
49+
builder => '_build_primer_panel_version',
50+
documentation => 'The primer panel version',);
51+
52+
sub _build_primer_panel_version {
53+
my $self = shift;
54+
my $version;
55+
if ($self->primer_panel =~ m{[/] \s* (\w+) \s* $}smx) {
56+
$version = $1;
57+
}
58+
return (defined $version) ? $version : $FORM;
59+
}
60+
61+
62+
has 'primer_panel_path'=> ( isa => q{Maybe[Str]},
63+
is => q{ro},
64+
lazy => 1,
65+
builder => q{_build_primer_panel_path},
66+
documentation => q{Path to the primer panel folder},);
67+
68+
sub _build_primer_panel_path {
69+
my ( $self ) = @_;
70+
71+
my $primer_panel_name = $self->primer_panel_name;
72+
if ($primer_panel_name) {
73+
# trim all white space around the name and replace spaces with underscores
74+
$primer_panel_name =~ s/\A(\s)+//smx;
75+
$primer_panel_name =~ s/(\s)+\z//smx;
76+
$primer_panel_name =~ s/ /_/gsm;
77+
}
78+
else {
79+
$self->messages->push('Primer panel name not available.');
80+
return;
81+
}
82+
83+
my ($organism, $strain) =
84+
$self->parse_reference_genome($self->lims->reference_genome);
85+
86+
my $path = catdir
87+
($self->primer_panel_repository, $primer_panel_name,
88+
$self->primer_panel_version, $organism, $strain);
89+
90+
if (!-d $path) {
91+
$self->messages->push('Primer panel directory ' . $path . ' does not exist');
92+
return;
93+
}
94+
return abs_path($path);
95+
}
96+
97+
98+
has 'primer_panel_bed_file' =>
99+
(isa => q{Maybe[Str]},
100+
is => q{ro},
101+
lazy => 1,
102+
builder => q{_build_primer_panel_bed_file},
103+
documentation => 'Full path to primer panel bed file',
104+
);
105+
106+
sub _build_primer_panel_bed_file {
107+
my $self = shift;
108+
return $self->find_file($self->primer_panel_path, q[], 'bed');
109+
}
110+
111+
112+
1;
113+
__END__
114+
115+
=head1 NAME
116+
117+
npg_tracking::data::primer_panel::find
118+
119+
=head1 VERSION
120+
121+
=head1 SYNOPSIS
122+
123+
package MyPackage;
124+
use Moose;
125+
with qw{npg_tracking::data::primer_panel::find};
126+
127+
=head1 DESCRIPTION
128+
129+
A Moose role for finding the location of primer panel related files.
130+
131+
=head1 SUBROUTINES/METHODS
132+
133+
=head2 primer_panel_name
134+
135+
Note gbs_plex_name is an alias for primer_panel.
136+
137+
=head2 primer_panel_path
138+
139+
=head2 primer_panel_bed_file
140+
141+
=head1 DIAGNOSTICS
142+
143+
=head1 CONFIGURATION AND ENVIRONMENT
144+
145+
=head1 DEPENDENCIES
146+
147+
=over
148+
149+
=item Moose::Role
150+
151+
=item Carp
152+
153+
=item Readonly
154+
155+
=item File::Spec::Functions
156+
157+
=item npg_tracking::util::abs_path
158+
159+
=item npg_tracking::data::reference::find
160+
161+
=back
162+
163+
=head1 INCOMPATIBILITIES
164+
165+
=head1 BUGS AND LIMITATIONS
166+
167+
=head1 AUTHOR
168+
169+
=head1 LICENSE AND COPYRIGHT
170+
171+
Copyright (C) 2020 GRL
172+
173+
This program is free software: you can redistribute it and/or modify
174+
it under the terms of the GNU General Public License as published by
175+
the Free Software Foundation, either version 3 of the License, or
176+
(at your option) any later version.
177+
178+
This program is distributed in the hope that it will be useful,
179+
but WITHOUT ANY WARRANTY; without even the implied warranty of
180+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
181+
GNU General Public License for more details.
182+
183+
You should have received a copy of the GNU General Public License
184+
along with this program. If not, see <http://www.gnu.org/licenses/>.
185+

lib/npg_tracking/data/reference/list.pm

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ Readonly::Scalar our $GENOTYPES_DIR => q[genotypes];
4747
Readonly::Scalar our $BAITS_DIR => q[baits];
4848
Readonly::Scalar our $GBS_PLEX_DIR => q[gbs_plex];
4949
Readonly::Scalar our $GENO_REFSET_DIR => q[geno_refset];
50+
Readonly::Scalar our $PRIMER_PANEL_DIR => q[primer_panel];
5051
Readonly::Scalar our $TAG_SETS_DIR => q[tag_sets];
5152
Readonly::Scalar our $TAXON_IDS_DIR => q[taxon_ids];
5253
Readonly::Scalar our $BIN_DIR => q[bin];
@@ -175,6 +176,21 @@ sub _build_geno_refset_repository {
175176
return catdir($self->repository, $GENO_REFSET_DIR);
176177
}
177178

179+
180+
=head2 primer_panel_repository
181+
182+
=cut
183+
has 'primer_panel_repository' => (isa => 'NPG_TRACKING_REFERENCE_REPOSITORY',
184+
is => 'ro',
185+
required => 0,
186+
lazy_build => 1,
187+
);
188+
sub _build_primer_panel_repository {
189+
my $self = shift;
190+
return catdir($self->repository, $PRIMER_PANEL_DIR);
191+
}
192+
193+
178194
=head2 tag_sets_repository
179195
180196
=cut

0 commit comments

Comments
 (0)