From 5aa50059f80334538e18e90eb146dfddf9396a98 Mon Sep 17 00:00:00 2001 From: Marina Gourtovaia Date: Mon, 18 Dec 2023 15:30:35 +0000 Subject: [PATCH] Simplifies the default samplesheet path. An option to read the value from the configuration file is not used. --- lib/npg/samplesheet/base.pm | 15 ++------------- t/.npg/npg_tracking | 1 - t/47-samplesheet.t | 13 +++---------- 3 files changed, 5 insertions(+), 24 deletions(-) diff --git a/lib/npg/samplesheet/base.pm b/lib/npg/samplesheet/base.pm index 834ee073..cdef7dce 100755 --- a/lib/npg/samplesheet/base.pm +++ b/lib/npg/samplesheet/base.pm @@ -8,7 +8,6 @@ use MooseX::Getopt::Meta::Attribute::Trait::NoGetopt; use npg_tracking::Schema; use st::api::lims; -use npg_tracking::util::config qw(get_config_staging_areas); use WTSI::DNAP::Warehouse::Schema; with 'npg_tracking::glossary::run'; @@ -31,8 +30,7 @@ A parent class for samplesheet generator. Provides common attributes. =cut -my$config=get_config_staging_areas(); -Readonly::Scalar my $SAMPLESHEET_PATH => $config->{'samplesheets'}||q(samplesheets/); +Readonly::Scalar my $SAMPLESHEET_PATH => 'samplesheets/'; Readonly::Scalar my $LIMS_DRIVER_TYPE => 'ml_warehouse'; =head1 SUBROUTINES/METHODS @@ -48,15 +46,8 @@ A directory where the samplesheet will be created, an optional attribute. has 'samplesheet_path' => ( 'isa' => 'Str', 'is' => 'ro', - 'lazy_build' => 1, + 'default' => $SAMPLESHEET_PATH, ); -sub _build_samplesheet_path { - if($ENV{dev} and not $ENV{dev}=~/live/smix){ - my ($suffix) = $ENV{dev}=~/(\w+)/smix; - return $SAMPLESHEET_PATH . $suffix . q(/); - } - return $SAMPLESHEET_PATH; -} =head2 id_run @@ -221,8 +212,6 @@ __END__ =item st::api::lims -=item npg_tracking::util::config - =item npg_tracking::glossary::run =back diff --git a/t/.npg/npg_tracking b/t/.npg/npg_tracking index c16606b7..5a7b7c0d 100644 --- a/t/.npg/npg_tracking +++ b/t/.npg/npg_tracking @@ -3,7 +3,6 @@ my $VAR1 = { 'staging_areas' => { 'indexes' => [18 .. 32, 34 .. 47, 49 .. 55], 'prefix' => '/nfs/sf', - 'samplesheets' => '/nfs/sf49/ILorHSorMS_sf49/samplesheets/' }, 'staging_areas2webservers' => { 'gs01' => {'npg_tracking' => 'http://gso1.san.ac.uk:678', diff --git a/t/47-samplesheet.t b/t/47-samplesheet.t index f8753b25..aca2eaf4 100644 --- a/t/47-samplesheet.t +++ b/t/47-samplesheet.t @@ -9,8 +9,6 @@ use File::Path qw/make_path/; use Moose::Meta::Class; use t::dbic_util; -local $ENV{'dev'} = q(wibble); -local $ENV{'HOME'} = q(t/); use_ok('npg::samplesheet'); use_ok('st::api::lims'); @@ -22,8 +20,6 @@ my $mlwh_schema = $class->new_object({})->create_test_db( q[WTSI::DNAP::Warehouse::Schema], q[t/data/fixtures_lims_wh_samplesheet] ); -local $ENV{NPG_WEBSERVICE_CACHE_DIR} = q(t/data/samplesheet); - my $dir = tempdir( CLEANUP => 1 ); subtest 'simple tests for the default driver' => sub { @@ -51,22 +47,19 @@ subtest 'object creation' => sub { lives_ok { $ss = npg::samplesheet->new(mlwh_schema => $mlwh_schema, repository=>$dir, npg_tracking_schema=>$schema, id_run=>7007); } 'samplesheet object - no output provided'; - cmp_ok($ss->output, 'eq', - '/nfs/sf49/ILorHSorMS_sf49/samplesheets/wibble/MS0001309-300.csv', + cmp_ok($ss->output, 'eq', 'samplesheets/MS0001309-300.csv', 'default output location (with zeroes trimmed appropriately)'); lives_ok { $ss = npg::samplesheet->new(mlwh_schema => $mlwh_schema, repository=>$dir, npg_tracking_schema=>$schema, id_run=>6946); } 'samplesheet object - no output provided'; - cmp_ok($ss->output, 'eq', - '/nfs/sf49/ILorHSorMS_sf49/samplesheets/wibble/000000000-A0616.csv', + cmp_ok($ss->output, 'eq', 'samplesheets/000000000-A0616.csv', 'default output location'); lives_ok { $ss = npg::samplesheet->new(mlwh_schema => $mlwh_schema, repository=>$dir, npg_tracking_schema=>$schema, id_run=>7007); } 'samplesheet object - no output provided'; my $orig_flowcell_id = $ss->run->flowcell_id; $ss->run->flowcell_id(q(MS2000132-500V2)); - cmp_ok($ss->output, 'eq', - '/nfs/sf49/ILorHSorMS_sf49/samplesheets/wibble/MS2000132-500V2.csv', + cmp_ok($ss->output, 'eq', 'samplesheets/MS2000132-500V2.csv', 'default output location copes with V2 MiSeq cartirdges/reagent kits'); };