Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed provisions for XML driver in samplesheet generation. #791

Merged
merged 1 commit into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 11 additions & 26 deletions lib/npg/samplesheet.pm
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,6 @@ Readonly::Scalar my $DEFAULT_LIMS_DRIVER_TYPE => 'ml_warehouse';
####################### Public attributes ########################
##################################################################

=head2 lims_driver_type

LIMs driver type to use, defaults to ml_warehouse.

=cut

has 'lims_driver_type' => (
'isa' => 'Str',
'required' => 0,
'is' => 'ro',
'default' => $DEFAULT_LIMS_DRIVER_TYPE,
);

=head2 id_run

An optional attribute
Expand Down Expand Up @@ -208,8 +195,12 @@ sub _build_run {

An attribute, an array of st::api::lims type objects.

To generate a samplesheet for the whole run, provide an array of
at::api::lims objects for all lanes of the run.

This attribute should normally be provided by the caller via the
constuctor. If the attribute is not provided, it it built automatically.
constuctor. If the attribute is not provided, it is built automatically,
using the ml_warehouse lims driver.

=cut

Expand All @@ -221,19 +212,13 @@ has 'lims' => (
sub _build_lims {
my $self=shift;

my $ref = {driver_type => $self->lims_driver_type};
my $batch_id = $self->run->batch_id;
if ($self->lims_driver_type eq $DEFAULT_LIMS_DRIVER_TYPE) {
$ref->{'id_flowcell_lims'} = $batch_id;
$ref->{'mlwh_schema'} = $self->mlwh_schema;
} elsif ($self->lims_driver_type eq 'xml') {
$ref->{'batch_id'} = $batch_id;
} else {
croak sprintf 'Lazy-build for driver type %s is not inplemented',
$self->lims_driver_type;
}
my $run_lims = st::api::lims->new(
driver_type => $DEFAULT_LIMS_DRIVER_TYPE,
id_flowcell_lims => $self->run->batch_id,
mlwh_schema => $self->mlwh_schema
);

return [st::api::lims->new($ref)->children];
return [$run_lims->children()];
};

=head2 output
Expand Down
19 changes: 2 additions & 17 deletions t/47-samplesheet.t
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use strict;
use warnings;
use Test::More tests => 12;
use Test::More tests => 11;
use Test::LongString;
use Test::Exception;
use File::Slurp;
Expand All @@ -26,30 +26,15 @@ local $ENV{NPG_WEBSERVICE_CACHE_DIR} = q(t/data/samplesheet);

my $dir = tempdir( CLEANUP => 1 );

subtest 'error on an unknown driver type' => sub {
plan tests => 1;

throws_ok {
npg::samplesheet->new(
lims_driver_type => 'foo',
repository => $dir,
npg_tracking_schema => $schema,
mlwh_schema => $mlwh_schema,
id_run => 7007)->lims()
} qr/Lazy-build for driver type foo is not inplemented/,
'error with the driver type for which LIMS objects cannot be built';
};

subtest 'simple tests for the default driver' => sub {
plan tests => 2;
plan tests => 1;

my $ss = npg::samplesheet->new(
repository => $dir,
npg_tracking_schema => $schema,
mlwh_schema => $mlwh_schema,
id_run => 7007
);
is ($ss->lims_driver_type, 'ml_warehouse', 'correct default driver type');
my $lims = $ss->lims();
is (@{$lims}, 1, 'LIMS data for 1 lane is built');
};
Expand Down