Skip to content

Commit

Permalink
Simplifies the default samplesheet path.
Browse files Browse the repository at this point in the history
An option to read the value from the configuration file
is not used.
  • Loading branch information
mgcam committed Dec 20, 2023
1 parent 6ad9feb commit 5aa5005
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 24 deletions.
15 changes: 2 additions & 13 deletions lib/npg/samplesheet/base.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -221,8 +212,6 @@ __END__
=item st::api::lims
=item npg_tracking::util::config
=item npg_tracking::glossary::run
=back
Expand Down
1 change: 0 additions & 1 deletion t/.npg/npg_tracking
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
13 changes: 3 additions & 10 deletions t/47-samplesheet.t
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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 {
Expand Down Expand Up @@ -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');
};

Expand Down

0 comments on commit 5aa5005

Please sign in to comment.