Skip to content

Commit

Permalink
Merge pull request #778 from mgcam/isize4multiple_components
Browse files Browse the repository at this point in the history
Ensure insert size is returned for compositions.
  • Loading branch information
dkj authored Nov 24, 2023
2 parents bb26c0d + 6d500bf commit a740443
Show file tree
Hide file tree
Showing 3 changed files with 202 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/st/api/lims.pm
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ sub _build_required_insert_size {
my $self = shift;

my $is_hash = {};
if (defined $self->position) {
if (defined $self->position or defined $self->rpt_list) {
my @alims = $self->descendants;
@alims = @alims ? @alims : ($self);
foreach my $lims (@alims) {
Expand Down
20 changes: 17 additions & 3 deletions t/40-st-lims.t
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ subtest 'Dual index' => sub {
};

subtest 'Insert size' => sub {
plan tests => 14;
plan tests => 20;

local $ENV{NPG_CACHED_SAMPLESHEET_FILE} =
't/data/samplesheet/4pool4libs_extended.csv';
Expand All @@ -657,11 +657,25 @@ subtest 'Insert size' => sub {
is ($insert_size->{$id}->{q[to]}, 1000, 'required TO insert size');
ok (!exists $insert_size->{q[6946_7_ACAACGCAAT]}, 'no required insert size');

$lims = st::api::lims->new(id_run => 9999, position => 7, tag_index => 77);
for my $l ((
st::api::lims->new(id_run => 9999, position => 7, tag_index => 77),
st::api::lims->new(rpt_list => '9999:7:77')
)) {
$insert_size = $l->required_insert_size;
is (keys %{$insert_size}, 1, 'one entry in the insert size hash');
is ($insert_size->{$id}->{q[from]}, 100, 'required FROM insert size');
is ($insert_size->{$id}->{q[to]}, 1000,'required TO insert size');
}

local $ENV{NPG_CACHED_SAMPLESHEET_FILE} =
q[t/data/samplesheet/samplesheet_47995.csv];

$lims = st::api::lims->new(rpt_list => '47995:1:3;47995:2:3');
$insert_size = $lims->required_insert_size;
is (keys %{$insert_size}, 1, 'one entry in the insert size hash');
$id = '65934645';
is ($insert_size->{$id}->{q[from]}, 100, 'required FROM insert size');
is ($insert_size->{$id}->{q[to]}, 1000,'required TO insert size');
is ($insert_size->{$id}->{q[to]}, 400,'required TO insert size');
};

subtest 'Study and sample properties' => sub {
Expand Down
Loading

0 comments on commit a740443

Please sign in to comment.