Skip to content

Commit

Permalink
Merge branch 'y24-035-tnanoseq-update-configs-for-pipeline' into uat-…
Browse files Browse the repository at this point in the history
…sequencescape-26th-jun-2024
  • Loading branch information
andrewsparkes committed Jun 28, 2024
2 parents 9b7e97a + 8687a0a commit ab57319
Show file tree
Hide file tree
Showing 6 changed files with 169 additions and 7 deletions.
19 changes: 19 additions & 0 deletions app/uat_actions/uat_actions/plate_information.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ def perform
return false if plate.blank?

report[:wells_with_aliquots] = wells_with_aliquots

report[:wells_with_active_requests_as_source] = wells_with_active_requests_as_source
true
end

Expand All @@ -37,4 +39,21 @@ def wells_with_aliquots
end
.join(', ')
end

# For finding wells in a partial submission plate that are to go forward.
# i.e. wells will have active requests as source only if they are to progress.
def wells_with_active_requests_as_source
active_request_states = %w[pending started]

plate
.wells_in_column_order
.each_with_object([]) do |well, wells_with_active_requests_as_source|
# requests must have an active state
if well.requests_as_source.present? && well.requests_as_source.any? do |request|
active_request_states.include?(request.state) end
wells_with_active_requests_as_source << well.map_description
end
end
.join(', ')
end
end
11 changes: 11 additions & 0 deletions config/default_records/plate_purposes/005_limber_purposes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,14 @@ RVI Cherrypick:
cherrypickable_target: true
type: PlatePurpose
stock_plate: false

# Targeted NanoSeq loop back point
LTN AL Lib:
cherrypickable_target: false
type: PlatePurpose
stock_plate: false

# Targeted NanoSeq plate for reISC
LTN Lib PCR XP:
type: PlatePurpose
stock_plate: false
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ limber_reisc:
request_class_name: Pulldown::Requests::ReIscLibraryRequest
acceptable_purposes:
- LB Lib PCR-XP
- LTN Lib PCR XP # for Targeted NanoSeq ReISC
library_types:
- Agilent Pulldown
- Twist Pulldown
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Request types for Targeted NanoSeq ISC Prep
---
limber_targeted_nanoseq_isc_prep:
name: Limber Targeted NanoSeq ISC Prep
asset_type: Well
order: 1
request_class_name: CustomerRequest
for_multiplexing: false
billable: true
product_line_name: Short Read
acceptable_purposes:
- LTN AL Lib
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
# This submission template is associated with the Limber Targeted NanoSeq pipeline.
# Submission templates associated with the Limber Targeted NanoSeq pipeline.
---
Limber-Htp - Targeted NanoSeq:
submission_class_name: "LinearSubmission"
related_records:
request_type_keys: ["limber_targeted_nanoseq"]
product_line_name: Targeted-NanoSeq
product_catalogue_name: Targeted-NanoSeq
Limber-Htp - Targeted NanoSeq ISC Prep:
submission_class_name: "LinearSubmission"
related_records:
request_type_keys: ["limber_targeted_nanoseq_isc_prep"]
product_line_name: Targeted-NanoSeq
product_catalogue_name: Targeted-NanoSeq
125 changes: 119 additions & 6 deletions spec/uat_actions/plate_information_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@

describe UatActions::PlateInformation do
context 'when the plate has aliquots' do
let(:parameters) { { plate_barcode: 'SQPD-1' } }
let(:plate_barcode) { 'SQPD-1' }
let(:parameters) { { plate_barcode: plate_barcode } }
let(:uat_action) { described_class.new(parameters) }
let(:report) do
# A report is a hash of key value pairs which get returned to the user.
# It should include information such as barcodes and identifiers
{ plate_barcode: 'SQPD-1', wells_with_aliquots: 'A1, B1, C1' }
{ plate_barcode: plate_barcode, wells_with_aliquots: 'A1, B1, C1', wells_with_active_requests_as_source: '' }
end

before { create :plate_with_untagged_wells, sample_count: 3, barcode: 'SQPD-1' }
before { create :plate_with_untagged_wells, sample_count: 3, barcode: plate_barcode }

it 'can be performed' do
expect(uat_action.perform).to be true
Expand All @@ -21,15 +22,16 @@
end

context 'when the plate is without aliquots' do
let(:parameters) { { plate_barcode: 'SQPD-2' } }
let(:plate_barcode) { 'SQPD-2' }
let(:parameters) { { plate_barcode: plate_barcode } }
let(:uat_action) { described_class.new(parameters) }
let(:report) do
# A report is a hash of key value pairs which get returned to the user.
# It should include information such as barcodes and identifiers
{ plate_barcode: 'SQPD-2', wells_with_aliquots: '' }
{ plate_barcode: plate_barcode, wells_with_aliquots: '', wells_with_active_requests_as_source: '' }
end

before { create :plate_with_empty_wells, well_count: 3, barcode: 'SQPD-2' }
before { create :plate_with_empty_wells, well_count: 3, barcode: plate_barcode }

it 'can be performed' do
expect(uat_action.perform).to be true
Expand All @@ -52,6 +54,117 @@
end
end

# This test is for the scenario where the plate has a partial submission on it.
# We expect to return the wells that have been submitted (have active requests as source)
context 'when the plate has a partial submission' do
let(:plate_barcode) { 'SQPD-3' }
let(:parameters) { { plate_barcode: plate_barcode } }
let(:uat_action) { described_class.new(parameters) }
let(:submission) { create :submission }
let(:request_type) { create :library_creation_request_type }
let(:report) do
{ plate_barcode: plate_barcode, wells_with_aliquots: 'A1, B1, C1',
wells_with_active_requests_as_source: 'A1, C1' }
end

before do
plate = create :plate_with_untagged_wells, sample_count: 3, barcode: plate_barcode

plate_wells = plate.wells.with_contents

req1 = create :library_creation_request, asset: plate_wells.first, submission: submission,
request_type: request_type, state: 'started'
plate_wells.first.requests_as_source << req1

req2 = create :library_creation_request, asset: plate_wells.last, submission: submission,
request_type: request_type, state: 'started'
plate_wells.last.requests_as_source << req2
end

it 'can be performed' do
expect(uat_action.perform).to be true
expect(uat_action.report).to eq report
end
end

# This test is for a scenario where there there is a previous (now closed) submission on the wells ONLY
# i.e. only want wells with ACTIVE requests as source so this should not return any wells
context 'when the plate has a closed submission' do
let(:plate_barcode) { 'SQPD-4' }
let(:parameters) { { plate_barcode: plate_barcode } }
let(:uat_action) { described_class.new(parameters) }
let(:submission) { create :submission }
let(:request_type) { create :library_creation_request_type }
let(:report) do
{ plate_barcode: plate_barcode, wells_with_aliquots: 'A1, B1, C1', wells_with_active_requests_as_source: '' }
end

before do
plate = create :plate_with_untagged_wells, sample_count: 3, barcode: plate_barcode

plate_wells = plate.wells.with_contents

req1 = create :library_creation_request, asset: plate_wells.first, submission: submission,
request_type: request_type, state: 'passed'
plate_wells.first.requests_as_source << req1

req2 = create :library_creation_request, asset: plate_wells.last, submission: submission,
request_type: request_type, state: 'passed'
plate_wells.last.requests_as_source << req2
end

it 'can be performed' do
expect(uat_action.perform).to be true
expect(uat_action.report).to eq report
end
end

# This test is for the scenario where we have both an old submission and a new submission on the plate (different
# subsets of wells) - we expect to only return the wells with the new (active) submission
context 'when the plate has both active and closed submissions' do
let(:plate_barcode) { 'SQPD-4' }
let(:parameters) { { plate_barcode: plate_barcode } }
let(:uat_action) { described_class.new(parameters) }
let(:submission) { create :submission }
let(:submission2) { create :submission }
let(:request_type) { create :library_creation_request_type }
let(:report) do
{ plate_barcode: plate_barcode, wells_with_aliquots: 'A1, B1, C1',
wells_with_active_requests_as_source: 'A1, C1' }
end

before do
plate = create :plate_with_untagged_wells, sample_count: 3, barcode: plate_barcode

plate_wells = plate.wells.with_contents

req1 = create :library_creation_request, asset: plate_wells.first, submission: submission,
request_type: request_type, state: 'passed'
plate_wells.first.requests_as_source << req1

req2 = create :library_creation_request, asset: plate_wells.second, submission: submission,
request_type: request_type, state: 'passed'
plate_wells.second.requests_as_source << req2

req3 = create :library_creation_request, asset: plate_wells.last, submission: submission,
request_type: request_type, state: 'passed'
plate_wells.last.requests_as_source << req3

req4 = create :library_creation_request, asset: plate_wells.first, submission: submission2,
request_type: request_type, state: 'started'
plate_wells.first.requests_as_source << req4

req5 = create :library_creation_request, asset: plate_wells.last, submission: submission2,
request_type: request_type, state: 'started'
plate_wells.last.requests_as_source << req5
end

it 'can be performed' do
expect(uat_action.perform).to be true
expect(uat_action.report).to eq report
end
end

it 'returns a default' do
expect(described_class.default).to be_a described_class
end
Expand Down

0 comments on commit ab57319

Please sign in to comment.