Skip to content

Commit 5b094df

Browse files
committed
Assigned application_type property for Ultimagen sample.
1 parent 5f66ae5 commit 5b094df

File tree

5 files changed

+63
-18
lines changed

5 files changed

+63
-18
lines changed

Changes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ LIST OF CHANGES FOR NPG-QC PACKAGE
88
reads. This fixes a number of downstream calculations.
99
- Added reporting of MQC outcomes for Ultimagen runs.
1010
- SeqQC - retrieval of LIMS data for Ultimagen runs is added.
11+
- Added application_type attribute to npg_qc::ultimagen::sample. Extended
12+
npg_qc::ultimagen::library_info parser to assign this attribute from
13+
values in [RunID]_LibraryInfo.xml file in the Ultimagen run folder.
1114

1215
release 76.1.0 (2026-02-04)
1316
- PDL version 2.068 is no longer available on CPAN. Switched to the default

lib/npg_qc/ultimagen/library_info.pm

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ sub _build_xml_doc {
6767

6868
=head2 application
6969
70-
Ultima Genomics application name as defined in teh input file. Might be undefined.
70+
Ultima Genomics application name as defined in the input file. Might be undefined.
7171
7272
=cut
7373

@@ -134,12 +134,25 @@ sub _build_samples {
134134
my @samples = ();
135135
foreach my $se (@{$self->sample_elements}) {
136136
my ($sample_id, $lib_name) = split /@/smx, $se->getAttribute('Id');
137-
push @samples, npg_qc::ultimagen::sample->new(
137+
my $init = {
138138
id => $sample_id,
139139
library_name => $lib_name,
140140
index_label => $se->getAttribute('Index_Label'),
141-
index_sequence => $se->getAttribute('Index_Sequence')
142-
);
141+
index_sequence => $se->getAttribute('Index_Sequence'),
142+
};
143+
my @app_type_values =
144+
map { $_->getAttribute('Value') }
145+
grep { $_->getAttribute('Name') eq 'application_type' }
146+
grep { ref $_ eq 'XML::LibXML::Element' }
147+
$se->childNodes();
148+
if (@app_type_values == 1) {
149+
$init->{application_type} = $app_type_values[0];
150+
} elsif (@app_type_values > 1) {
151+
croak 'Multiple application type values for index label '
152+
. $init->{index_label};
153+
}
154+
155+
push @samples, npg_qc::ultimagen::sample->new($init);
143156
}
144157
return \@samples;
145158
}
@@ -195,4 +208,4 @@ GNU General Public License for more details.
195208
You should have received a copy of the GNU General Public License
196209
along with this program. If not, see <http://www.gnu.org/licenses/>.
197210
198-
=cut
211+
=cut

lib/npg_qc/ultimagen/sample.pm

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,19 @@ has 'index_sequence' => (
7878
required => 1,
7979
);
8080

81+
=head2 application_type
82+
83+
Manufacturer's name for the pipeline/tool which was used on-board to
84+
produce the data. Optional, can be undefined.
85+
86+
=cut
87+
88+
has 'application_type' => (
89+
isa => 'Maybe[Str]',
90+
is => 'ro',
91+
required => 0,
92+
);
93+
8194
=head2 tag_index
8295
8396
NPG tag index, derived from C<index_label> attribute.

t/30-ultimagen-sample_retriever.t

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ with 'npg_qc::ultimagen::sample_retriever';
55
package main_test;
66
use strict;
77
use warnings;
8-
use Test::More tests => 9;
8+
use Test::More tests => 28;
99
use Test::Exception;
1010

1111
use_ok('sample_retriever_test');
@@ -16,21 +16,37 @@ throws_ok { sample_retriever_test->new()->get_samples() }
1616
qr/Either runfolder_path or manifest_path should be set/,
1717
'error if no attributes are set';
1818

19-
my $samples_from_li = sample_retriever_test->new(
19+
my $samples_li = sample_retriever_test->new(
2020
runfolder_path => $rf
2121
)->get_samples();
22-
my $samples_from_ma = sample_retriever_test->new(
22+
is (scalar @{$samples_li}, 8, 'returned eight samples');
23+
24+
my $samples_ma = sample_retriever_test->new(
2325
runfolder_path => $rf,
2426
manifest_path => "${rf}/manifest.csv"
2527
)->get_samples();
28+
is (scalar @{$samples_ma}, 8, 'returned eight samples');
29+
30+
for my $sample (($samples_li->[0], $samples_ma->[0])) {
31+
is ($sample->id(), 'iNeuron15923026', 'correct sample id');
32+
is ($sample->library_name(), '1_GEX_iA_iN_SCREEN', 'correct library name');
33+
is ($sample->index_label(), 'Z0001', 'correct index label');
34+
is ($sample->index_sequence(), 'CAGCTCGAATGCGAT', 'correct index sequence');
35+
is ($sample->tag_index, 1, 'correct NPG tag index');
36+
}
37+
is ($samples_li->[0]->application_type(), 'scRNA_GEX_10x_5prime_v3',
38+
'correct application type');
39+
is ($samples_ma->[0]->application_type(), undef, 'undefined application type');
2640

27-
is (scalar @{$samples_from_li}, 8, 'returned eight samples');
28-
is_deeply ($samples_from_li, $samples_from_ma, 'identical sample info');
29-
my $sample = $samples_from_li->[0];
30-
is ($sample->id(), 'iNeuron15923026', 'correct sample id');
31-
is ($sample->library_name(), '1_GEX_iA_iN_SCREEN', 'correct library name');
32-
is ($sample->index_label(), 'Z0001', 'correct index label');
33-
is ($sample->index_sequence(), 'CAGCTCGAATGCGAT', 'correct index sequence');
34-
is ($sample->tag_index, 1, 'correct NPG tag index');
41+
for my $sample (($samples_li->[7], $samples_ma->[7])) {
42+
is ($sample->id(), 'iNeuron15923033', 'correct sample id');
43+
is ($sample->library_name(), '4_dgRNA_iA_iN_SCREEN', 'correct library name');
44+
is ($sample->index_label(), 'Z0008', 'correct index label');
45+
is ($sample->index_sequence(), 'CACATCCTGCATGTGAT', 'correct index sequence');
46+
is ($sample->tag_index, 8, 'correct NPG tag index');
47+
}
48+
is ($samples_li->[7]->application_type(), 'native',
49+
'correct application type');
50+
is ($samples_ma->[7]->application_type(), undef, 'undefined application type');
3551

3652
1;

t/data/ultimagen/425347-20250821_1214/425347_LibraryInfo.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@
4343
<Sample Id="iNeuron15923033@4_dgRNA_iA_iN_SCREEN" Index_Label="Z0008" Index_Sequence="CACATCCTGCATGTGAT">
4444
<Attribute Name="Barcode_Plate_Num" Value="1" />
4545
<Attribute Name="Barcode_Plate_Well" Value="H1" />
46-
<Attribute Name="application_type" Value="scRNA_CRISPR_10x_5prime_v3" />
46+
<Attribute Name="application_type" Value="native" />
4747
</Sample>
4848
</Samples>
4949
<Sequencing />
50-
<Analysis_Recipe Name="Other" />18Aug25 D7_CooperSteer_5priem plus guide</SampleInfo>
50+
<Analysis_Recipe Name="Other" />18Aug25 D7_CooperSteer_5priem plus guide</SampleInfo>

0 commit comments

Comments
 (0)