From 0441d49a6606a4de08d9fe19ad3ed3ee2b8ad765 Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Thu, 5 Sep 2024 18:12:18 +0100 Subject: [PATCH 01/43] Add model for new bait_library_layouts endpoint on Sequencescape --- .../sequencescape/api/v2/bait_library_layout.rb | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 app/sequencescape/sequencescape/api/v2/bait_library_layout.rb diff --git a/app/sequencescape/sequencescape/api/v2/bait_library_layout.rb b/app/sequencescape/sequencescape/api/v2/bait_library_layout.rb new file mode 100644 index 000000000..bb5bb251d --- /dev/null +++ b/app/sequencescape/sequencescape/api/v2/bait_library_layout.rb @@ -0,0 +1,6 @@ +# frozen_string_literal: true + +# bait library layout resource +class Sequencescape::Api::V2::BaitLibraryLayout < Sequencescape::Api::V2::Base + custom_endpoint :preview, on: :collection, request_method: :post +end From d83859b333227fc9cdd4a414afbe24dcc221c8b0 Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Thu, 5 Sep 2024 18:27:52 +0100 Subject: [PATCH 02/43] Use SS API v2 endpoint for BaitLibraryLayout preview and creation --- app/models/labware_creators/baited_plate.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/models/labware_creators/baited_plate.rb b/app/models/labware_creators/baited_plate.rb index b4a49ccc6..bdefd362b 100644 --- a/app/models/labware_creators/baited_plate.rb +++ b/app/models/labware_creators/baited_plate.rb @@ -25,12 +25,13 @@ def plate end def bait_library_layout_preview - @bait_library_layout_preview ||= api.bait_library_layout.preview!(plate: parent_uuid, user: user_uuid).layout + @bait_library_layout_preview ||= + Sequencescape::Api::V2::BaitLibraryLayout.preview!(plate_uuid: parent_uuid, user_uuid: user_uuid).layout end def create_labware! create_plate_with_standard_transfer! do |child| - api.bait_library_layout.create!(plate: child.uuid, user: user_uuid) + Sequencescape::Api::V2::BaitLibraryLayout.create!(plate_uuid: child.uuid, user_uuid: user_uuid) end end From fc92a1e9becd700bb78ac2f0632d44c65555fdcf Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Thu, 5 Sep 2024 18:41:45 +0100 Subject: [PATCH 03/43] Update the way the preview method is called --- app/models/labware_creators/baited_plate.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/labware_creators/baited_plate.rb b/app/models/labware_creators/baited_plate.rb index bdefd362b..ebddd05c7 100644 --- a/app/models/labware_creators/baited_plate.rb +++ b/app/models/labware_creators/baited_plate.rb @@ -26,7 +26,7 @@ def plate def bait_library_layout_preview @bait_library_layout_preview ||= - Sequencescape::Api::V2::BaitLibraryLayout.preview!(plate_uuid: parent_uuid, user_uuid: user_uuid).layout + Sequencescape::Api::V2::BaitLibraryLayout.preview(plate_uuid: parent_uuid, user_uuid: user_uuid).first.layout end def create_labware! From 044a8bd870bb52145e0fecdd81ce608916fb823b Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Thu, 5 Sep 2024 19:22:35 +0100 Subject: [PATCH 04/43] Fix tests for BaitLibraryLayout operations --- .../bait_library_layout_factories.rb | 8 ++--- .../bait_library_layout_factory_spec.rb | 32 ------------------- .../features/creating_plate_with_bait_spec.rb | 29 ++++++----------- .../labware_creators/baited_plate_spec.rb | 31 +++--------------- spec/support/api_url_helper.rb | 14 ++++---- 5 files changed, 24 insertions(+), 90 deletions(-) delete mode 100644 spec/factory_outputs/bait_library_layout_factory_spec.rb diff --git a/spec/factories/bait_library_layout_factories.rb b/spec/factories/bait_library_layout_factories.rb index 9301e066e..f5fc1bc58 100644 --- a/spec/factories/bait_library_layout_factories.rb +++ b/spec/factories/bait_library_layout_factories.rb @@ -3,11 +3,9 @@ require_relative '../support/factory_bot_extensions' FactoryBot.define do - # Generates a BaitLibraryLayout (API V1) - factory :bait_library_layout, class: Sequencescape::BaitLibraryLayout, traits: [:api_object] do - json_root { 'bait_library_layout' } - - with_belongs_to_associations 'plate' + # Generates an incomplete, but sufficient for testing, V2 BaitLibraryLayout + factory :bait_library_layout, class: Sequencescape::Api::V2::BaitLibraryLayout do + skip_create transient do # Provide an array of pools, describing the number of wells in each diff --git a/spec/factory_outputs/bait_library_layout_factory_spec.rb b/spec/factory_outputs/bait_library_layout_factory_spec.rb deleted file mode 100644 index 784db8853..000000000 --- a/spec/factory_outputs/bait_library_layout_factory_spec.rb +++ /dev/null @@ -1,32 +0,0 @@ -# frozen_string_literal: true - -require 'rails_helper' - -RSpec.describe 'bait library layout factory' do - subject { json(:bait_library_layout, plate_uuid: 'plate-uuid', uuid: 'bait-library-layout-uuid') } - - let(:json_content) do - '{ - "bait_library_layout": { - "actions": {"read": "http://example.com:3000/bait-library-layout-uuid"}, - "plate": { - "actions": { - "read": "http://example.com:3000/plate-uuid" - }, - "uuid": "plate-uuid" - }, - "uuid": "bait-library-layout-uuid", - "layout": { - "A1": "Human all exon 50MB", - "B1": "Human all exon 50MB", - "C1": "Mouse all exon", - "D1": "Mouse all exon" - } - } - }' - end - - it 'should match the expected json' do - expect(JSON.parse(subject)['bait_library_layout']).to eq JSON.parse(json_content)['bait_library_layout'] - end -end diff --git a/spec/features/creating_plate_with_bait_spec.rb b/spec/features/creating_plate_with_bait_spec.rb index d7625dd66..9186a7f24 100644 --- a/spec/features/creating_plate_with_bait_spec.rb +++ b/spec/features/creating_plate_with_bait_spec.rb @@ -21,6 +21,8 @@ let(:transfer_template) { json :transfer_template, uuid: transfer_template_uuid } let(:expected_transfers) { WellHelpers.stamp_hash(96) } + let(:bait_library_layout) { create :bait_library_layout } + let(:transfer_requests) do WellHelpers.column_order(96)[0, 6].map do |well_name| { 'source_asset' => "2-well-#{well_name}", 'target_asset' => "3-well-#{well_name}", 'submission_id' => '2' } @@ -44,16 +46,11 @@ # end of stubs for plate show page # These stubs are required to render plate_creation baiting page - stub_api_post( - 'bait_library_layouts', - 'preview', - body: json(:bait_library_layout), - payload: { - bait_library_layout: { - plate: plate_uuid, - user: user_uuid - } - } + expect_api_v2_posts( + 'BaitLibraryLayout', + [{ plate_uuid: plate_uuid, user_uuid: user_uuid }], + [[bait_library_layout]], + method: :preview ) # end of stubs for plate_creation baiting page @@ -80,16 +77,8 @@ }, body: '{}' ) - stub_api_post( - 'bait_library_layouts', - body: json(:bait_library_layout), - payload: { - bait_library_layout: { - plate: 'child-uuid', - user: user_uuid - } - } - ) + + expect_api_v2_posts('BaitLibraryLayout', [{ plate_uuid: 'child-uuid', user_uuid: user_uuid }]) # end of stubs for creating a new plate with baits # Stub the requests for the next plate page diff --git a/spec/models/labware_creators/baited_plate_spec.rb b/spec/models/labware_creators/baited_plate_spec.rb index 798f39901..c8f11c6c8 100644 --- a/spec/models/labware_creators/baited_plate_spec.rb +++ b/spec/models/labware_creators/baited_plate_spec.rb @@ -23,6 +23,8 @@ let(:form_attributes) { { user_uuid: user_uuid, purpose_uuid: purpose_uuid, parent_uuid: parent_uuid } } + let(:bait_library_layout) { create :bait_library_layout } + let(:transfer_requests) do WellHelpers.column_order(96)[0, 6].map do |well_name| { 'source_asset' => "2-well-#{well_name}", 'target_asset' => "3-well-#{well_name}", 'submission_id' => '2' } @@ -36,32 +38,6 @@ context 'create plate' do has_a_working_api - let!(:bait_library_layout_preview_request) do - stub_api_post( - 'bait_library_layouts/preview', - payload: { - bait_library_layout: { - plate: parent_uuid, - user: user_uuid - } - }, - body: json(:bait_library_layout) - ) - end - - let!(:bait_library_layout_request) do - stub_api_post( - 'bait_library_layouts', - payload: { - bait_library_layout: { - plate: 'child-uuid', - user: user_uuid - } - }, - body: json(:bait_library_layout) - ) - end - let!(:plate_creation_request) do stub_api_post( 'plate_creations', @@ -79,6 +55,9 @@ before do stub_v2_plate(parent, stub_search: false) stub_v2_plate(child, stub_search: false) + + stub_api_v2_post('BaitLibraryLayout') + stub_api_v2_post('BaitLibraryLayout', [bait_library_layout], method: :preview) end let!(:transfer_creation_request) do diff --git a/spec/support/api_url_helper.rb b/spec/support/api_url_helper.rb index 4894b46af..f9db6d946 100644 --- a/spec/support/api_url_helper.rb +++ b/spec/support/api_url_helper.rb @@ -89,16 +89,16 @@ def stub_api_v2_save(klass) allow_any_instance_of(receiving_class).to receive(:save).and_return(true) end - def stub_api_v2_post(klass, return_value = nil) - # intercepts the 'create!' method for any class beginning with - # 'Sequencescape::Api::V2::' and returns the given value or else true. + def stub_api_v2_post(klass, return_value = nil, method: :create!) + # intercepts the specified `method` for any class beginning with + # 'Sequencescape::Api::V2::' and returns the given `return_value`, or else `true`. receiving_class = "Sequencescape::Api::V2::#{klass}".constantize return_value ||= true - allow(receiving_class).to receive(:create!).and_return(return_value) + allow(receiving_class).to receive(method).and_return(return_value) end - def expect_api_v2_posts(klass, args_list, return_values = []) - # Expects the 'create!' method for any class beginning with + def expect_api_v2_posts(klass, args_list, return_values = [], method: :create!) + # Expects the specified `method` for any class beginning with # 'Sequencescape::Api::V2::' to be called with given arguments, in sequence, and returns the given values. # If return_values is empty, it will return true. receiving_class = "Sequencescape::Api::V2::#{klass}".constantize @@ -106,7 +106,7 @@ def expect_api_v2_posts(klass, args_list, return_values = []) .zip(return_values) .each do |args, ret| ret ||= true - expect(receiving_class).to receive(:create!).with(args).and_return(ret) + expect(receiving_class).to receive(method).with(args).and_return(ret) end end From 339464938131c0de9c17e2a1692ff0687485c118 Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Fri, 6 Sep 2024 10:41:18 +0100 Subject: [PATCH 05/43] Add pry short aliases for debugging --- .pryrc | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .pryrc diff --git a/.pryrc b/.pryrc new file mode 100644 index 000000000..ca997213f --- /dev/null +++ b/.pryrc @@ -0,0 +1,7 @@ +# frozen_string_literal: true +if defined?(PryByebug) + Pry.commands.alias_command 's', 'step' + Pry.commands.alias_command 'n', 'next' + Pry.commands.alias_command 'f', 'finish' + Pry.commands.alias_command 'c', 'continue' +end From e9baf7dd68e5ea46f4608f3f95b56cae809a9ade Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Fri, 6 Sep 2024 16:17:53 +0100 Subject: [PATCH 06/43] Use API v2 to create TagLayout during CustomTaggedPlate labware creator --- .../components/CustomTaggedPlate.vue | 4 ++-- app/models/labware_creators/custom_tagged_plate.rb | 12 +++++++----- app/sequencescape/sequencescape/api/v2/tag_layout.rb | 5 +++++ 3 files changed, 14 insertions(+), 7 deletions(-) create mode 100644 app/sequencescape/sequencescape/api/v2/tag_layout.rb diff --git a/app/frontend/javascript/custom-tagged-plate/components/CustomTaggedPlate.vue b/app/frontend/javascript/custom-tagged-plate/components/CustomTaggedPlate.vue index 07220aff2..e4f92be76 100644 --- a/app/frontend/javascript/custom-tagged-plate/components/CustomTaggedPlate.vue +++ b/app/frontend/javascript/custom-tagged-plate/components/CustomTaggedPlate.vue @@ -619,8 +619,8 @@ export default { purpose_uuid: this.purposeUuid, parent_uuid: this.parentUuid, tag_layout: { - tag_group: this.tag1GroupUuid, - tag2_group: this.tag2GroupUuid, + tag_group_uuid: this.tag1GroupUuid, + tag2_group_uuid: this.tag2GroupUuid, direction: this.direction, walking_by: this.walkingBy, initial_tag: initialTag, diff --git a/app/models/labware_creators/custom_tagged_plate.rb b/app/models/labware_creators/custom_tagged_plate.rb index 8892620e5..31a85dd98 100644 --- a/app/models/labware_creators/custom_tagged_plate.rb +++ b/app/models/labware_creators/custom_tagged_plate.rb @@ -18,10 +18,10 @@ class CustomTaggedPlate < Base { tag_plate: %i[asset_uuid template_uuid state], tag_layout: [ - :user, - :plate, - :tag_group, - :tag2_group, + :user_uuid, + :plate_uuid, + :tag_group_uuid, + :tag2_group_uuid, :direction, :walking_by, :initial_tag, @@ -107,7 +107,9 @@ def tag_layout_attributes def create_labware! create_plate! do |plate_uuid| - api.tag_layout.create!(tag_layout_attributes.merge(plate: plate_uuid, user: user_uuid)) + Sequencescape::Api::V2::TagLayout.create!( + tag_layout_attributes.merge(plate_uuid: plate_uuid, user_uuid: user_uuid) + ) end end end diff --git a/app/sequencescape/sequencescape/api/v2/tag_layout.rb b/app/sequencescape/sequencescape/api/v2/tag_layout.rb new file mode 100644 index 000000000..2e5f92fda --- /dev/null +++ b/app/sequencescape/sequencescape/api/v2/tag_layout.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +# tag layout resource +class Sequencescape::Api::V2::TagLayout < Sequencescape::Api::V2::Base +end From 7946080e764f9ca783528447371c5bbd0933041d Mon Sep 17 00:00:00 2001 From: Wendy Yang Date: Mon, 9 Sep 2024 16:38:35 +0100 Subject: [PATCH 07/43] add stock plate as limber plate --- config/pipelines/bespoke_pcr.yml | 1 + config/purposes/bespoke.yml | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/config/pipelines/bespoke_pcr.yml b/config/pipelines/bespoke_pcr.yml index 2911e36de..aee28c6c1 100644 --- a/config/pipelines/bespoke_pcr.yml +++ b/config/pipelines/bespoke_pcr.yml @@ -34,6 +34,7 @@ Bespoke PCR: - TruSeq mRNA (RNA Seq) library_pass: LBB Lib PCR-XP relationships: + Stock Plate: LBB Ligation LBB Cherrypick: LBB Ligation LBC Cherrypick: LBB Ligation LBB Ligation: LBB Lib PCR-XP diff --git a/config/purposes/bespoke.yml b/config/purposes/bespoke.yml index 5a4411904..fc21a0aeb 100644 --- a/config/purposes/bespoke.yml +++ b/config/purposes/bespoke.yml @@ -43,3 +43,8 @@ LBB Enriched TCR: LBB Enriched TCR HT: :asset_type: plate :creator_class: LabwareCreators::PartialStampedPlateWithoutDilution +Stock Plate: + :asset_type: plate + :stock_plate: true + :input_plate: true + :presenter_class: Presenters::StockPlatePresenter From bc053a4ac9f31c398a9c7427f85054b1dec5c1af Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Tue, 10 Sep 2024 17:43:53 +0100 Subject: [PATCH 08/43] Update tests to match expectations from creating TagLayouts --- .../custom_tagged_plate_spec.rb | 85 ++++++++++--------- 1 file changed, 44 insertions(+), 41 deletions(-) diff --git a/spec/models/labware_creators/custom_tagged_plate_spec.rb b/spec/models/labware_creators/custom_tagged_plate_spec.rb index 4c605f864..522fd4bd3 100644 --- a/spec/models/labware_creators/custom_tagged_plate_spec.rb +++ b/spec/models/labware_creators/custom_tagged_plate_spec.rb @@ -114,30 +114,48 @@ let(:expected_transfers) { WellHelpers.stamp_hash(96) } - def expect_transfer_creation + def expect_state_change_creation expect_api_v2_posts( - 'Transfer', + 'StateChange', + [ + { + reason: 'Used in Library creation', + target_uuid: tag_plate_uuid, + target_state: 'exhausted', + user_uuid: user_uuid + } + ] + ) + end + + def expect_tag_layout_creation + expect_api_v2_posts( + 'TagLayout', [ { user_uuid: user_uuid, - source_uuid: plate_uuid, - destination_uuid: child_plate_uuid, - transfer_template_uuid: transfer_template_uuid, - transfers: expected_transfers + plate_uuid: child_plate_uuid, + tag_group_uuid: 'tag-group-uuid', + tag2_group_uuid: 'tag2-group-uuid', + direction: 'column', + walking_by: 'manual by plate', + initial_tag: '1', + tags_per_well: 1 } ] ) end - def expect_state_change_creation + def expect_transfer_creation expect_api_v2_posts( - 'StateChange', + 'Transfer', [ { - reason: 'Used in Library creation', - target_uuid: tag_plate_uuid, - target_state: 'exhausted', - user_uuid: user_uuid + user_uuid: user_uuid, + source_uuid: plate_uuid, + destination_uuid: child_plate_uuid, + transfer_template_uuid: transfer_template_uuid, + transfers: expected_transfers } ] ) @@ -157,9 +175,9 @@ def expect_state_change_creation state: tag_plate_state }, tag_layout: { - user: 'user-uuid', - tag_group: 'tag-group-uuid', - tag2_group: 'tag2-group-uuid', + user_uuid: 'user-uuid', + tag_group_uuid: 'tag-group-uuid', + tag2_group_uuid: 'tag2-group-uuid', direction: 'column', walking_by: 'manual by plate', initial_tag: '1', @@ -176,37 +194,20 @@ def expect_state_change_creation it_behaves_like 'it has a custom page', 'custom_tagged_plate' context 'on save' do - let!(:custom_tag_layout_creation_request) do - stub_api_post( - 'tag_layouts', - payload: { - tag_layout: { - user: 'user-uuid', - plate: child_plate_uuid, - tag_group: 'tag-group-uuid', - tag2_group: 'tag2-group-uuid', - direction: 'column', - walking_by: 'manual by plate', - initial_tag: '1', - tags_per_well: 1 - } - } - ) - end - context 'with an available tag plate' do let(:tag_plate_state) { 'available' } it 'creates a tag plate' do - expect_transfer_creation expect_state_change_creation + expect_tag_layout_creation + expect_transfer_creation expect(subject.save).to be true expect(plate_creation_request).to have_been_made.once - expect(custom_tag_layout_creation_request).to have_been_made.once end it 'has the correct child (and uuid)' do + stub_api_v2_post('TagLayout') stub_api_v2_post('Transfer') stub_api_v2_post('StateChange') @@ -218,12 +219,12 @@ def expect_state_change_creation context 'when a user has exhausted the plate in another tab' do it 'creates a tag plate' do - expect_transfer_creation expect_state_change_creation + expect_tag_layout_creation + expect_transfer_creation expect(subject.save).to be true expect(plate_creation_request).to have_been_made.once - expect(custom_tag_layout_creation_request).to have_been_made.once end end end @@ -232,17 +233,18 @@ def expect_state_change_creation let(:tag_plate_state) { 'exhausted' } it 'creates a tagged plate' do + # This one will be VERY different + expect_tag_layout_creation + expect_transfer_creation expect(Sequencescape::Api::V2::StateChange).not_to receive(:create!) expect(subject.save).to be true expect(plate_creation_request).to have_been_made.once - - # This one will be VERY different - expect(custom_tag_layout_creation_request).to have_been_made.once end it 'has the correct child (and uuid)' do + stub_api_v2_post('TagLayout') stub_api_v2_post('Transfer') expect(subject.save).to be true @@ -258,15 +260,16 @@ def expect_state_change_creation let(:parents) { [plate_uuid] } it 'creates a tag plate' do + expect_tag_layout_creation expect_transfer_creation expect(Sequencescape::Api::V2::StateChange).not_to receive(:create!) expect(subject.save).to be true expect(plate_creation_request).to have_been_made.once - expect(custom_tag_layout_creation_request).to have_been_made.once end it 'has the correct child (and uuid)' do + stub_api_v2_post('TagLayout') stub_api_v2_post('Transfer') expect(subject.save).to be true From 4bad88ca83eb310bd30ac944501b76e909273c00 Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Tue, 10 Sep 2024 17:51:11 +0100 Subject: [PATCH 09/43] Update Javascript tests --- .../custom-tagged-plate/components/CustomTaggedPlate.spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/frontend/javascript/custom-tagged-plate/components/CustomTaggedPlate.spec.js b/app/frontend/javascript/custom-tagged-plate/components/CustomTaggedPlate.spec.js index 037afeb9c..954bfc22e 100644 --- a/app/frontend/javascript/custom-tagged-plate/components/CustomTaggedPlate.spec.js +++ b/app/frontend/javascript/custom-tagged-plate/components/CustomTaggedPlate.spec.js @@ -833,8 +833,8 @@ describe('CustomTaggedPlate', () => { purpose_uuid: 'purpose-uuid', parent_uuid: 'parent-plate-uuid', tag_layout: { - tag_group: 'tag-1-group-uuid', - tag2_group: 'tag-2-group-uuid', + tag_group_uuid: 'tag-1-group-uuid', + tag2_group_uuid: 'tag-2-group-uuid', direction: 'column', walking_by: 'manual by plate', initial_tag: 1, From dd2bd0ddaeaba7ae069a14a860c4223d1ad5ddff Mon Sep 17 00:00:00 2001 From: Wendy Yang Date: Wed, 11 Sep 2024 11:59:48 +0100 Subject: [PATCH 10/43] separate stock plate just for 10x - CITEseq and Emseq pipelines --- config/pipelines/bespoke_pcr.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/config/pipelines/bespoke_pcr.yml b/config/pipelines/bespoke_pcr.yml index aee28c6c1..4530fc923 100644 --- a/config/pipelines/bespoke_pcr.yml +++ b/config/pipelines/bespoke_pcr.yml @@ -34,10 +34,22 @@ Bespoke PCR: - TruSeq mRNA (RNA Seq) library_pass: LBB Lib PCR-XP relationships: - Stock Plate: LBB Ligation LBB Cherrypick: LBB Ligation LBC Cherrypick: LBB Ligation LBB Ligation: LBB Lib PCR-XP + +Bespoke PCR Stock plate: + pipeline_group: Bespoke PCR + filters: + request_type_key: limber_pcr_bespoke + library_type: + - Chromium single cell surface protein + - emSEQ + library_pass: LBB Lib PCR-XP + relationships: + Stock Plate: LBB Ligation + LBB Ligation: LBB Lib PCR-XP + Bespoke PCR BCR: filters: request_type_key: limber_pcr_bespoke From 56c7ee186f2deab9f043bd083b3c0c2106c1ffb6 Mon Sep 17 00:00:00 2001 From: Wendy Yang Date: Wed, 11 Sep 2024 19:49:01 +0100 Subject: [PATCH 11/43] extend stock plate as input plate to other pipelines --- config/pipelines/bespoke_pcr.yml | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/config/pipelines/bespoke_pcr.yml b/config/pipelines/bespoke_pcr.yml index 4530fc923..77dc621ef 100644 --- a/config/pipelines/bespoke_pcr.yml +++ b/config/pipelines/bespoke_pcr.yml @@ -34,22 +34,11 @@ Bespoke PCR: - TruSeq mRNA (RNA Seq) library_pass: LBB Lib PCR-XP relationships: + Stock Plate: LBB Ligation LBB Cherrypick: LBB Ligation LBC Cherrypick: LBB Ligation LBB Ligation: LBB Lib PCR-XP -Bespoke PCR Stock plate: - pipeline_group: Bespoke PCR - filters: - request_type_key: limber_pcr_bespoke - library_type: - - Chromium single cell surface protein - - emSEQ - library_pass: LBB Lib PCR-XP - relationships: - Stock Plate: LBB Ligation - LBB Ligation: LBB Lib PCR-XP - Bespoke PCR BCR: filters: request_type_key: limber_pcr_bespoke @@ -57,6 +46,7 @@ Bespoke PCR BCR: - Manual Chromium single cell BCR library_pass: LBB Lib PCR-XP relationships: + Stock Plate: LBB Enriched BCR LBB Cherrypick: LBB Enriched BCR LBC Cherrypick: LBB Enriched BCR LBB Enriched BCR: LBB Ligation @@ -68,6 +58,7 @@ Bespoke PCR BCR HT: - Manual Chromium single cell BCR HT library_pass: LBB Lib PCR-XP relationships: + Stock Plate: LBB Enriched BCR HT LBB Cherrypick: LBB Enriched BCR HT LBC Cherrypick: LBB Enriched BCR HT LBB Enriched BCR HT: LBB Ligation @@ -79,6 +70,7 @@ Bespoke PCR TCR: - Manual Chromium single cell TCR library_pass: LBB Lib PCR-XP relationships: + Stock Plate: LBB Enriched TCR LBB Cherrypick: LBB Enriched TCR LBC Cherrypick: LBB Enriched TCR LBB Enriched TCR: LBB Ligation @@ -90,6 +82,7 @@ Bespoke PCR TCR HT: - Manual Chromium single cell TCR HT library_pass: LBB Lib PCR-XP relationships: + Stock Plate: LBB Enriched TCR HT LBB Cherrypick: LBB Enriched TCR HT LBC Cherrypick: LBB Enriched TCR HT LBB Enriched TCR HT: LBB Ligation From e31e4ad42d2c0600fb1cf3fa9ede55f6c6205ace Mon Sep 17 00:00:00 2001 From: Wendy Yang Date: Wed, 11 Sep 2024 20:02:36 +0100 Subject: [PATCH 12/43] fix formating --- config/pipelines/bespoke_pcr.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/config/pipelines/bespoke_pcr.yml b/config/pipelines/bespoke_pcr.yml index 77dc621ef..ba17dfe0e 100644 --- a/config/pipelines/bespoke_pcr.yml +++ b/config/pipelines/bespoke_pcr.yml @@ -46,7 +46,7 @@ Bespoke PCR BCR: - Manual Chromium single cell BCR library_pass: LBB Lib PCR-XP relationships: - Stock Plate: LBB Enriched BCR + Stock Plate: LBB Enriched BCR LBB Cherrypick: LBB Enriched BCR LBC Cherrypick: LBB Enriched BCR LBB Enriched BCR: LBB Ligation @@ -58,7 +58,7 @@ Bespoke PCR BCR HT: - Manual Chromium single cell BCR HT library_pass: LBB Lib PCR-XP relationships: - Stock Plate: LBB Enriched BCR HT + Stock Plate: LBB Enriched BCR HT LBB Cherrypick: LBB Enriched BCR HT LBC Cherrypick: LBB Enriched BCR HT LBB Enriched BCR HT: LBB Ligation @@ -70,7 +70,7 @@ Bespoke PCR TCR: - Manual Chromium single cell TCR library_pass: LBB Lib PCR-XP relationships: - Stock Plate: LBB Enriched TCR + Stock Plate: LBB Enriched TCR LBB Cherrypick: LBB Enriched TCR LBC Cherrypick: LBB Enriched TCR LBB Enriched TCR: LBB Ligation @@ -82,7 +82,7 @@ Bespoke PCR TCR HT: - Manual Chromium single cell TCR HT library_pass: LBB Lib PCR-XP relationships: - Stock Plate: LBB Enriched TCR HT + Stock Plate: LBB Enriched TCR HT LBB Cherrypick: LBB Enriched TCR HT LBC Cherrypick: LBB Enriched TCR HT LBB Enriched TCR HT: LBB Ligation From 5ebd2467cb6e388eb606e56f9ccc3c8a4a5a8709 Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Fri, 13 Sep 2024 11:35:16 +0100 Subject: [PATCH 13/43] Switch SpecificTubeCreation requests to go through API v2 --- .../labware_creators/plate_split_to_tube_racks.rb | 11 +++++------ app/models/labware_creators/pooled_tubes_base.rb | 11 +++++------ app/models/labware_creators/pooled_tubes_by_sample.rb | 11 +++++------ .../pooled_tubes_by_submission_with_phi_x.rb | 9 ++++----- .../pooled_tubes_from_whole_plates.rb | 11 +++++------ .../sequencescape/api/v2/specific_tube_creation.rb | 8 ++++++++ 6 files changed, 32 insertions(+), 29 deletions(-) create mode 100644 app/sequencescape/sequencescape/api/v2/specific_tube_creation.rb diff --git a/app/models/labware_creators/plate_split_to_tube_racks.rb b/app/models/labware_creators/plate_split_to_tube_racks.rb index da3e2098d..f869083cd 100644 --- a/app/models/labware_creators/plate_split_to_tube_racks.rb +++ b/app/models/labware_creators/plate_split_to_tube_racks.rb @@ -405,13 +405,12 @@ def parent_wells_for_contingency # @param tube_attributes [Hash] A hash of attributes to use for the created tubes. # @return [Hash] A hash of the created tubes indexed by name. def create_tubes(tube_purpose_uuid, number_of_tubes, tube_attributes) - api - .specific_tube_creation + Sequencescape::Api::V2::SpecificTubeCreation .create!( - user: user_uuid, - parent: parent_uuid, - child_purposes: [tube_purpose_uuid] * number_of_tubes, - tube_attributes: tube_attributes + child_purpose_uuids: [tube_purpose_uuid] * number_of_tubes, + parent_uuids: [parent_uuid], + tube_attributes: tube_attributes, + user_uuid: user_uuid ) .children .index_by(&:name) diff --git a/app/models/labware_creators/pooled_tubes_base.rb b/app/models/labware_creators/pooled_tubes_base.rb index f55e8bc3a..e8ae7a7e2 100644 --- a/app/models/labware_creators/pooled_tubes_base.rb +++ b/app/models/labware_creators/pooled_tubes_base.rb @@ -20,13 +20,12 @@ def create_labware! end def create_child_stock_tubes - api - .specific_tube_creation + Sequencescape::Api::V2::SpecificTubeCreation .create!( - user: user_uuid, - parent: parent_uuid, - child_purposes: [purpose_uuid] * pool_uuids.length, - tube_attributes: tube_attributes + child_purpose_uuids: [purpose_uuid] * pool_uuids.length, + parent_uuids: [parent_uuid], + tube_attributes: tube_attributes, + user_uuid: user_uuid ) .children .index_by(&:name) diff --git a/app/models/labware_creators/pooled_tubes_by_sample.rb b/app/models/labware_creators/pooled_tubes_by_sample.rb index 29121318a..6504e0c76 100644 --- a/app/models/labware_creators/pooled_tubes_by_sample.rb +++ b/app/models/labware_creators/pooled_tubes_by_sample.rb @@ -47,13 +47,12 @@ def parent_v1 # Have we made this class so cardinal-specific (e.g. lookup of ancestor vac tubes) that it cannot be re-used? def create_child_stock_tubes - api - .specific_tube_creation + Sequencescape::Api::V2::SpecificTubeCreation .create!( - user: user_uuid, - parent: parent_uuid, - child_purposes: [purpose_uuid] * pool_uuids.length, - tube_attributes: tube_attributes + child_purpose_uuids: [purpose_uuid] * pool_uuids.length, + parent_uuids: [parent_uuid], + tube_attributes: tube_attributes, + user_uuid: user_uuid ) .children .index_by(&:name) diff --git a/app/models/labware_creators/pooled_tubes_by_submission_with_phi_x.rb b/app/models/labware_creators/pooled_tubes_by_submission_with_phi_x.rb index f0d6103f0..50d7a916d 100644 --- a/app/models/labware_creators/pooled_tubes_by_submission_with_phi_x.rb +++ b/app/models/labware_creators/pooled_tubes_by_submission_with_phi_x.rb @@ -15,13 +15,12 @@ class PooledTubesBySubmissionWithPhiX < PooledTubesBySubmission attr_accessor :spikedbuffer_tube_barcode def create_child_stock_tubes - api - .specific_tube_creation + Sequencescape::Api::V2::SpecificTubeCreation .create!( - user: user_uuid, - parents: parents, child_purposes: [purpose_uuid] * pool_uuids.length, - tube_attributes: tube_attributes + parent_uuids: parents, + tube_attributes: tube_attributes, + user_uuid: user_uuid ) .children .index_by(&:name) diff --git a/app/models/labware_creators/pooled_tubes_from_whole_plates.rb b/app/models/labware_creators/pooled_tubes_from_whole_plates.rb index 41a09f490..33f9034ca 100644 --- a/app/models/labware_creators/pooled_tubes_from_whole_plates.rb +++ b/app/models/labware_creators/pooled_tubes_from_whole_plates.rb @@ -17,13 +17,12 @@ def create_labware! # Create a single tube # TODO: This should link to multiple parents in production @child = - api - .specific_tube_creation + Sequencescape::Api::V2::SpecificTubeCreation .create!( - user: user_uuid, - parent: parents.first.uuid, - child_purposes: [purpose_uuid], - tube_attributes: [{ name: "#{stock_plate_barcode}+" }] + child_purpose_uuids: [purpose_uuid], + parent_uuids: [parents.first.uuid], + tube_attributes: [{ name: "#{stock_plate_barcode}+" }], + user_uuid: user_uuid ) .children .first diff --git a/app/sequencescape/sequencescape/api/v2/specific_tube_creation.rb b/app/sequencescape/sequencescape/api/v2/specific_tube_creation.rb new file mode 100644 index 000000000..035a70c5a --- /dev/null +++ b/app/sequencescape/sequencescape/api/v2/specific_tube_creation.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +# Represents a specific tube creation in Limber via the Sequencescape API +class Sequencescape::Api::V2::SpecificTubeCreation < Sequencescape::Api::V2::Base + has_many :children, class_name: 'Sequencescape::Api::V2::Tube' + has_many :parents, class_name: 'Sequencescape::Api::V2::Asset' + has_one :user, class_name: 'Sequencescape::Api::V2::User' +end From 1860cce4e0dcc49e02bf84dc8b67c6a11ac3355e Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Mon, 16 Sep 2024 16:58:38 +0100 Subject: [PATCH 14/43] Fix tests for pooling multiple plates into one tube --- .../pooled_tubes_from_whole_plates.rb | 6 ++- ...ling_multiple_plates_into_one_tube_spec.rb | 51 +++++++------------ 2 files changed, 24 insertions(+), 33 deletions(-) diff --git a/app/models/labware_creators/pooled_tubes_from_whole_plates.rb b/app/models/labware_creators/pooled_tubes_from_whole_plates.rb index 33f9034ca..937e23569 100644 --- a/app/models/labware_creators/pooled_tubes_from_whole_plates.rb +++ b/app/models/labware_creators/pooled_tubes_from_whole_plates.rb @@ -15,7 +15,7 @@ class PooledTubesFromWholePlates < Base def create_labware! # Create a single tube - # TODO: This should link to multiple parents in production + # TODO: {Y24-190} See if we can do all the transfers as part of the SpecificTubeCreation instead of separately. @child = Sequencescape::Api::V2::SpecificTubeCreation .create!( @@ -39,6 +39,10 @@ def stock_plate_barcode "#{parents.first.stock_plate.barcode.prefix}#{parents.first.stock_plate.barcode.number}" end + def redirection_target + TubeProxy.new(@child.uuid) + end + # TODO: This should probably be asynchronous def available_plates @search_options = OngoingPlate.new(purposes: [parent.plate_purpose.uuid], include_used: false, states: ['passed']) diff --git a/spec/features/pooling_multiple_plates_into_one_tube_spec.rb b/spec/features/pooling_multiple_plates_into_one_tube_spec.rb index 73937a3d7..1e2487b1a 100644 --- a/spec/features/pooling_multiple_plates_into_one_tube_spec.rb +++ b/spec/features/pooling_multiple_plates_into_one_tube_spec.rb @@ -57,32 +57,13 @@ end let(:example_plate_3_listed) { associated(*example_plate3_args) } - let(:child_tube_uuid) { 'tube-0' } - let(:child_tube) do - create :v2_tube, purpose_uuid: 'child-purpose-0', purpose_name: 'Pool tube', uuid: child_tube_uuid - end + let(:child_tube) { create :v2_tube, purpose_uuid: 'child-purpose-0', purpose_name: 'Pool tube' } - let(:tube_creation_request_uuid) { SecureRandom.uuid } - - let!(:tube_creation_request) do - # TODO: In reality we want to link in all four parents. - stub_api_post( - 'specific_tube_creations', - payload: { - specific_tube_creation: { - user: user_uuid, - parent: plate_uuid, - child_purposes: ['child-purpose-0'], - tube_attributes: [{ name: 'DN2+' }] - } - }, - body: json(:specific_tube_creation, uuid: tube_creation_request_uuid, children_count: 1) - ) - end + let(:specific_tube_creation) do + response = double + allow(response).to receive(:children).and_return([child_tube]) - # Find out what tubes we've just made! - let!(:tube_creation_children_request) do - stub_api_get(tube_creation_request_uuid, 'children', body: json(:tube_collection, names: ['DN1+'])) + response end # Used to fetch the pools. This is the kind of thing we could pass through from a custom form @@ -119,8 +100,6 @@ stub_v2_plate(example_plate_new_api) - stub_v2_plate(example_plate_new_api) - stub_api_get(plate_uuid, body: example_plate) stub_api_get(plate_uuid, 'wells', body: well_set_a) @@ -132,13 +111,25 @@ scenario 'creates multiple plates' do stub_v2_plate(example_plate_2) + expect_api_v2_posts( + 'SpecificTubeCreation', + [ + { + child_purpose_uuids: ['child-purpose-0'], + parent_uuids: [plate_uuid], + tube_attributes: [{ name: 'DN2+' }], + user_uuid: user_uuid + } + ], + [specific_tube_creation] + ) expect_api_v2_posts( 'Transfer', [plate_uuid, plate_uuid_2].map do |source_uuid| { user_uuid: user_uuid, source_uuid: source_uuid, - destination_uuid: 'tube-0', + destination_uuid: child_tube.uuid, transfer_template_uuid: 'whole-plate-to-tube' } end @@ -156,15 +147,11 @@ click_on('Make Pool') expect(page).to have_text('New empty labware added to the system') expect(page).to have_text('Pool tube') - - # This isn't strictly speaking correct to test. But there isn't a great way - # of confirming that the right information got passed to the back end otherwise. - # (Although you expect it to fail on an incorrect request) - expect(tube_creation_request).to have_been_made end scenario 'detects tag clash' do stub_v2_plate(example_plate_3) + fill_in_swipecard_and_barcode(user_swipecard, plate_barcode_1) plate_title = find('#plate-title') expect(plate_title).to have_text('example-purpose') From 1d5fc5f29be24452fdfa28cc7da04732a5fac702 Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Mon, 16 Sep 2024 17:02:21 +0100 Subject: [PATCH 15/43] Fix test for pooled tubes from whole plates --- .../pooled_tubes_from_whole_plates_spec.rb | 49 +++++++------------ 1 file changed, 19 insertions(+), 30 deletions(-) diff --git a/spec/models/labware_creators/pooled_tubes_from_whole_plates_spec.rb b/spec/models/labware_creators/pooled_tubes_from_whole_plates_spec.rb index e5ce80273..993edb48b 100644 --- a/spec/models/labware_creators/pooled_tubes_from_whole_plates_spec.rb +++ b/spec/models/labware_creators/pooled_tubes_from_whole_plates_spec.rb @@ -53,54 +53,43 @@ { user_uuid: user_uuid, purpose_uuid: purpose_uuid, parent_uuid: parent_uuid, barcodes: barcodes } end - let(:tube_creation_request_uuid) { SecureRandom.uuid } + let(:child_tube) { create :v2_tube } + let(:specific_tube_creation) do + response = double + allow(response).to receive(:children).and_return([child_tube]) - let(:tube_creation_request) do - # TODO: In reality we want to link in all four parents. - stub_api_post( - 'specific_tube_creations', - payload: { - specific_tube_creation: { - user: user_uuid, - parent: parent_uuid, - child_purposes: [purpose_uuid], - tube_attributes: [{ name: 'DN2+' }] - } - }, - body: json(:specific_tube_creation, uuid: tube_creation_request_uuid, children_count: 1) - ) + response end - # Find out what tubes we've just made! - let(:tube_creation_children_request) do - stub_api_get(tube_creation_request_uuid, 'children', body: json(:tube_collection, names: ['DN2+'])) - end - - # Used to fetch the pools. This is the kind of thing we could pass through from a custom form - let(:stub_barcode_searches) { stub_asset_search(barcodes, [parent, parent2, parent3, parent4]) } - - before do - stub_barcode_searches - tube_creation_children_request - tube_creation_request - end + before { stub_asset_search(barcodes, [parent, parent2, parent3, parent4]) } context 'with compatible plates' do it 'pools from all the plates' do + expect_api_v2_posts( + 'SpecificTubeCreation', + [ + { + child_purpose_uuids: [purpose_uuid], + parent_uuids: [parent_uuid], + tube_attributes: [{ name: 'DN2+' }], + user_uuid: user_uuid + } + ], + [specific_tube_creation] + ) expect_api_v2_posts( 'Transfer', [parent_uuid, parent2_uuid, parent3_uuid, parent4_uuid].map do |source_uuid| { user_uuid: user_uuid, source_uuid: source_uuid, - destination_uuid: 'tube-0', + destination_uuid: child_tube.uuid, transfer_template_uuid: 'whole-plate-to-tube' } end ) expect(subject.save!).to be_truthy - expect(tube_creation_request).to have_been_made.once end end end From a4a38082c09ab4cc636603e0e0b3460bc96503b7 Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Tue, 17 Sep 2024 13:24:13 +0100 Subject: [PATCH 16/43] Fix tests for plate_split_to_tube_racks --- .../plate_split_to_tube_racks_spec.rb | 380 +++++++----------- 1 file changed, 144 insertions(+), 236 deletions(-) diff --git a/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb b/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb index 4ab8c6154..040feb362 100644 --- a/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb +++ b/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb @@ -201,6 +201,56 @@ ) end + def prepare_created_child_tubes(tube_attributes) + # Prepare child tubes and stub their lookups. + child_tubes = + tube_attributes.map { |attrs| create(:v2_tube, name: attrs[:name], foreign_barcode: attrs[:foreign_barcode]) } + child_tubes.each { |child_tube| stub_v2_labware(child_tube) } + + child_tubes + end + + def expect_specific_tube_creation(child_purpose_uuid, child_tubes) + # Create a mock for the specific tube creation. + specific_tube_creation = double + allow(specific_tube_creation).to receive(:children).and_return(child_tubes) + + # Expect the post request and return the mock. + expect_api_v2_posts( + 'SpecificTubeCreation', + [ + { + child_purpose_uuids: [child_purpose_uuid] * child_tubes.size, + parent_uuids: [parent_uuid], + tube_attributes: child_tubes.map { |tube| { name: tube.name, foreign_barcode: tube.foreign_barcode } }, + user_uuid: user_uuid + } + ], + [specific_tube_creation] + ) + end + + # tubes_hash should be a hash with tube rack barcodes as keys and arrays of tubes as values. + def expect_custom_metadatum_collection_posts(tubes_hash) + # Prepare the expected call arguments. + expected_call_args = + tubes_hash.flat_map do |tube_rack_barcode, tubes| + tubes.map do |tube| + metadata = { + user_id: user.id, + asset_id: tube.id, + metadata: { + tube_rack_barcode: tube_rack_barcode, + tube_rack_position: tube.name.split(':').last + } + } + end + end + + # Expect the post requests. + expect_api_v2_posts('CustomMetadatumCollection', expected_call_args) + end + before do # need both child tubes to have a purpose config here create( @@ -661,48 +711,16 @@ ) end - # stub the contingency tube creation - let!(:stub_contingency_tube_creation_request_uuid) { SecureRandom.uuid } - let!(:stub_contingency_tube_creation_request) do - stub_api_post( - 'specific_tube_creations', - payload: { - specific_tube_creation: { - child_purposes: [ - child_contingency_tube_purpose_uuid, - child_contingency_tube_purpose_uuid, - child_contingency_tube_purpose_uuid - ], - tube_attributes: [ - # sample 1 from well A2 to contingency tube 1 in A1 - { name: 'SPR:NT1O:A1', foreign_barcode: 'FX00000011' }, - # sample 2 from well B2 to contingency tube 2 in B1 - { name: 'SPR:NT2P:B1', foreign_barcode: 'FX00000012' }, - # sample 1 from well A3 to contingency tube 3 in C1 - { name: 'SPR:NT1O:C1', foreign_barcode: 'FX00000013' } - ], - user: user_uuid, - parent: parent_uuid - } - }, - body: json(:specific_tube_creation, uuid: stub_contingency_tube_creation_request_uuid, children_count: 3) - ) - end - - # stub what contingency tubes were just made - let!(:stub_contingency_tube_creation_children_request) do - stub_api_get( - stub_contingency_tube_creation_request_uuid, - 'children', - body: - json( - :tube_collection_with_barcodes_specified, - size: 3, - names: %w[SPR:NT1O:A1 SPR:NT2P:B1 SPR:NT1O:C1], - barcode_prefix: 'FX', - barcode_numbers: [11, 12, 13], - uuid_index_offset: 2 - ) + let(:contingency_tubes) do + prepare_created_child_tubes( + [ + # sample 1 from well A2 to contingency tube 1 in A1 + { name: 'SPR:NT1O:A1', foreign_barcode: 'FX00000011' }, + # sample 2 from well B2 to contingency tube 2 in B1 + { name: 'SPR:NT2P:B1', foreign_barcode: 'FX00000012' }, + # sample 1 from well A3 to contingency tube 3 in C1 + { name: 'SPR:NT1O:C1', foreign_barcode: 'FX00000013' } + ] ) end @@ -742,6 +760,17 @@ content end + let(:sequencing_tubes) do + prepare_created_child_tubes( + [ + # sample 1 in well A1 to seq tube 1 in A1 + { name: 'SEQ:NT1O:A1', foreign_barcode: 'FX00000001' }, + # sample 2 in well B1 to seq tube 2 in B1 + { name: 'SEQ:NT2P:B1', foreign_barcode: 'FX00000002' } + ] + ) + end + # stub the sequencing file upload let!(:stub_sequencing_file_upload) do stub_request(:post, api_url_for(parent_uuid, 'qc_files')) @@ -761,58 +790,20 @@ ) end - # stub the sequencing tube creation - let!(:stub_sequencing_tube_creation_request_uuid) { SecureRandom.uuid } - let!(:stub_sequencing_tube_creation_request) do - stub_api_post( - 'specific_tube_creations', - payload: { - specific_tube_creation: { - child_purposes: [child_sequencing_tube_purpose_uuid, child_sequencing_tube_purpose_uuid], - tube_attributes: [ - # sample 1 in well A1 to seq tube 1 in A1 - { name: 'SEQ:NT1O:A1', foreign_barcode: 'FX00000001' }, - # sample 2 in well B1 to seq tube 2 in B1 - { name: 'SEQ:NT2P:B1', foreign_barcode: 'FX00000002' } - ], - user: user_uuid, - parent: parent_uuid - } - }, - body: json(:specific_tube_creation, uuid: stub_sequencing_tube_creation_request_uuid, children_count: 2) - ) - end - - # stub what sequencing tubes were just made - let!(:stub_sequencing_tube_creation_children_request) do - stub_api_get( - stub_sequencing_tube_creation_request_uuid, - 'children', - body: - json( - :tube_collection_with_barcodes_specified, - size: 2, - names: %w[SEQ:NT1O:A1 SEQ:NT2P:B1], - barcode_prefix: 'FX', - barcode_numbers: [1, 2] - ) - ) - end - # stub the transfer creation let!(:stub_transfer_creation_request) do + parent_wells = [parent_well_a1, parent_well_b1, parent_well_a2, parent_well_b2, parent_well_a3] + target_tubes = sequencing_tubes + contingency_tubes + transfer_requests = + parent_wells.map.with_index do |parent_well, index| + { 'submission_id' => '2', 'source_asset' => parent_well.uuid, 'target_asset' => target_tubes[index].uuid } + end stub_api_post( 'transfer_request_collections', payload: { transfer_request_collection: { user: user_uuid, - transfer_requests: [ - { 'submission_id' => '2', 'source_asset' => parent_well_a1.uuid, 'target_asset' => 'tube-0' }, - { 'submission_id' => '2', 'source_asset' => parent_well_b1.uuid, 'target_asset' => 'tube-1' }, - { 'submission_id' => '2', 'source_asset' => parent_well_a2.uuid, 'target_asset' => 'tube-2' }, - { 'submission_id' => '2', 'source_asset' => parent_well_b2.uuid, 'target_asset' => 'tube-3' }, - { 'submission_id' => '2', 'source_asset' => parent_well_a3.uuid, 'target_asset' => 'tube-4' } - ] + transfer_requests: transfer_requests } }, body: '{}' @@ -860,17 +851,17 @@ end it 'creates the child tubes' do - expect_api_v2_posts( - 'CustomMetadatumCollection', - [tube_1_create_args, tube_2_create_args, tube_3_create_args, tube_4_create_args, tube_5_create_args] + expect_specific_tube_creation(child_sequencing_tube_purpose_uuid, sequencing_tubes) + expect_specific_tube_creation(child_contingency_tube_purpose_uuid, contingency_tubes) + + expect_custom_metadatum_collection_posts( + { 'TR00000001' => sequencing_tubes, 'TR00000002' => contingency_tubes } ) expect(subject.valid?).to be_truthy expect(subject.save).to be_truthy expect(stub_sequencing_file_upload).to have_been_made.once - expect(stub_sequencing_tube_creation_request).to have_been_made.once expect(stub_contingency_file_upload).to have_been_made.once - expect(stub_contingency_tube_creation_request).to have_been_made.once expect(stub_transfer_creation_request).to have_been_made.once end @@ -880,94 +871,20 @@ create(:v2_well, location: 'A1', aliquots: [parent_aliquot_sample1_aliquot1], state: 'failed') end - # as A1 is failed order of samples is changed - let!(:stub_sequencing_tube_creation_request) do - stub_api_post( - 'specific_tube_creations', - payload: { - specific_tube_creation: { - child_purposes: [child_sequencing_tube_purpose_uuid, child_sequencing_tube_purpose_uuid], - tube_attributes: [ - # sample 2 in well B1 to seq tube 1 in A1 - { name: 'SEQ:NT2P:A1', foreign_barcode: 'FX00000001' }, - # sample 1 in well A2 to seq tube 2 in B1 - { name: 'SEQ:NT1O:B1', foreign_barcode: 'FX00000002' } - ], - user: user_uuid, - parent: parent_uuid - } - }, - body: json(:specific_tube_creation, uuid: stub_sequencing_tube_creation_request_uuid, children_count: 2) - ) - end - - # stub what sequencing tubes were just made (order changed) - let!(:stub_sequencing_tube_creation_children_request) do - stub_api_get( - stub_sequencing_tube_creation_request_uuid, - 'children', - body: - json( - :tube_collection_with_barcodes_specified, - size: 2, - names: %w[SEQ:NT2P:A1 SEQ:NT1O:B1], - barcode_prefix: 'FX', - barcode_numbers: [1, 2] - ) - ) - end - - # only 2 contingency tubes will be needed - let!(:stub_contingency_tube_creation_request) do - stub_api_post( - 'specific_tube_creations', - payload: { - specific_tube_creation: { - child_purposes: [child_contingency_tube_purpose_uuid, child_contingency_tube_purpose_uuid], - tube_attributes: [ - # sample 2 from well B2 to contingency tube 1 in A1 - { name: 'SPR:NT2P:A1', foreign_barcode: 'FX00000011' }, - # sample 1 from well A3 to contingency tube 2 in B1 - { name: 'SPR:NT1O:B1', foreign_barcode: 'FX00000012' } - ], - user: user_uuid, - parent: parent_uuid - } - }, - body: json(:specific_tube_creation, uuid: stub_contingency_tube_creation_request_uuid, children_count: 3) - ) - end - - # stub what contingency tubes were just made (just 2) - let!(:stub_contingency_tube_creation_children_request) do - stub_api_get( - stub_contingency_tube_creation_request_uuid, - 'children', - body: - json( - :tube_collection_with_barcodes_specified, - size: 2, - names: %w[SPR:NT2P:A1 SPR:NT1O:B1], - barcode_prefix: 'FX', - barcode_numbers: [11, 12], - uuid_index_offset: 2 - ) - ) - end - # one fewer transfer request let!(:stub_transfer_creation_request) do + parent_wells = [parent_well_b1, parent_well_a2, parent_well_b2, parent_well_a3] + target_tubes = sequencing_tubes + contingency_tubes + transfer_requests = + parent_wells.map.with_index do |parent_well, index| + { 'submission_id' => '2', 'source_asset' => parent_well.uuid, 'target_asset' => target_tubes[index].uuid } + end stub_api_post( 'transfer_request_collections', payload: { transfer_request_collection: { user: user_uuid, - transfer_requests: [ - { 'submission_id' => '2', 'source_asset' => parent_well_b1.uuid, 'target_asset' => 'tube-0' }, - { 'submission_id' => '2', 'source_asset' => parent_well_a2.uuid, 'target_asset' => 'tube-1' }, - { 'submission_id' => '2', 'source_asset' => parent_well_b2.uuid, 'target_asset' => 'tube-2' }, - { 'submission_id' => '2', 'source_asset' => parent_well_a3.uuid, 'target_asset' => 'tube-3' } - ] + transfer_requests: transfer_requests } }, body: '{}' @@ -981,6 +898,28 @@ ) end + let(:sequencing_tubes) do + prepare_created_child_tubes( + [ + # sample 2 in well B1 to seq tube 1 in A1 + { name: 'SEQ:NT2P:A1', foreign_barcode: 'FX00000001' }, + # sample 1 in well A2 to seq tube 2 in B1 + { name: 'SEQ:NT1O:B1', foreign_barcode: 'FX00000002' } + ] + ) + end + + let(:contingency_tubes) do + prepare_created_child_tubes( + [ + # sample 2 from well B2 to contingency tube 1 in A1 + { name: 'SPR:NT2P:A1', foreign_barcode: 'FX00000011' }, + # sample 1 from well A3 to contingency tube 2 in B1 + { name: 'SPR:NT1O:B1', foreign_barcode: 'FX00000012' } + ] + ) + end + before do stub_get_labware_metadata(child_tube_1_v2.barcode.machine, child_tube_1_v1) stub_get_labware_metadata(child_tube_2_v2.barcode.machine, child_tube_2_v1) @@ -994,17 +933,17 @@ end it 'does not create a tube for the failed well' do - expect_api_v2_posts( - 'CustomMetadatumCollection', - [tube_1_create_args, tube_2_create_args, tube_3_create_args, tube_4_create_args] # no tube 5 + expect_specific_tube_creation(child_sequencing_tube_purpose_uuid, sequencing_tubes) + expect_specific_tube_creation(child_contingency_tube_purpose_uuid, contingency_tubes) + + expect_custom_metadatum_collection_posts( + { 'TR00000001' => sequencing_tubes, 'TR00000002' => contingency_tubes } ) expect(subject.valid?).to be_truthy expect(subject.save).to be_truthy expect(stub_sequencing_file_upload).to have_been_made.once - expect(stub_sequencing_tube_creation_request).to have_been_made.once expect(stub_contingency_file_upload).to have_been_made.once - expect(stub_contingency_tube_creation_request).to have_been_made.once expect(stub_transfer_creation_request).to have_been_made.once end end @@ -1090,69 +1029,40 @@ ) end - # stub the contingency tube creation - let!(:stub_contingency_tube_creation_request) do - stub_api_post( - 'specific_tube_creations', - payload: { - specific_tube_creation: { - child_purposes: [ - child_contingency_tube_purpose_uuid, - child_contingency_tube_purpose_uuid, - child_contingency_tube_purpose_uuid, - child_contingency_tube_purpose_uuid, - child_contingency_tube_purpose_uuid - ], - tube_attributes: [ - # sample 1 from well A1 to contingency tube 1 in A1 - { name: 'SPR:NT1O:A1', foreign_barcode: 'FX00000011' }, - # sample 2 from well B1 to contingency tube 2 in B1 - { name: 'SPR:NT2P:B1', foreign_barcode: 'FX00000012' }, - # sample 1 from well A2 to contingency tube 3 in C1 - { name: 'SPR:NT1O:C1', foreign_barcode: 'FX00000013' }, - # sample 2 from well B2 to contingency tube 4 in E1 (D1 set as NO READ) - { name: 'SPR:NT2P:E1', foreign_barcode: 'FX00000014' }, - # sample 1 from well A3 to contingency tube 5 in F1 - { name: 'SPR:NT1O:F1', foreign_barcode: 'FX00000015' } - ], - user: user_uuid, - parent: parent_uuid - } - }, - body: json(:specific_tube_creation, uuid: stub_contingency_tube_creation_request_uuid, children_count: 5) - ) - end - - # stub what contingency tubes were just made - let!(:stub_contingency_tube_creation_children_request) do - stub_api_get( - stub_contingency_tube_creation_request_uuid, - 'children', - body: - json( - :tube_collection_with_barcodes_specified, - size: 5, - names: %w[SPR:NT1O:A1 SPR:NT2P:B1 SPR:NT1O:C1 SPR:NT2P:E1 SPR:NT1O:F1], - barcode_prefix: 'FX', - barcode_numbers: [11, 12, 13, 14, 15] - ) + let(:contingency_tubes) do + prepare_created_child_tubes( + [ + # sample 1 from well A1 to contingency tube 1 in A1 + { name: 'SPR:NT1O:A1', foreign_barcode: 'FX00000011' }, + # sample 2 from well B1 to contingency tube 2 in B1 + { name: 'SPR:NT2P:B1', foreign_barcode: 'FX00000012' }, + # sample 1 from well A2 to contingency tube 3 in C1 + { name: 'SPR:NT1O:C1', foreign_barcode: 'FX00000013' }, + # sample 2 from well B2 to contingency tube 4 in E1 (D1 set as NO READ) + { name: 'SPR:NT2P:E1', foreign_barcode: 'FX00000014' }, + # sample 1 from well A3 to contingency tube 5 in F1 + { name: 'SPR:NT1O:F1', foreign_barcode: 'FX00000015' } + ] ) end # stub the transfer creation let!(:stub_transfer_creation_request) do + parent_wells = [parent_well_a1, parent_well_b1, parent_well_a2, parent_well_b2, parent_well_a3] + transfer_requests = + parent_wells.map.with_index do |parent_well, index| + { + 'submission_id' => '2', + 'source_asset' => parent_well.uuid, + 'target_asset' => contingency_tubes[index].uuid + } + end stub_api_post( 'transfer_request_collections', payload: { transfer_request_collection: { user: user_uuid, - transfer_requests: [ - { 'submission_id' => '2', 'source_asset' => parent_well_a1.uuid, 'target_asset' => 'tube-0' }, - { 'submission_id' => '2', 'source_asset' => parent_well_b1.uuid, 'target_asset' => 'tube-1' }, - { 'submission_id' => '2', 'source_asset' => parent_well_a2.uuid, 'target_asset' => 'tube-2' }, - { 'submission_id' => '2', 'source_asset' => parent_well_b2.uuid, 'target_asset' => 'tube-3' }, - { 'submission_id' => '2', 'source_asset' => parent_well_a3.uuid, 'target_asset' => 'tube-4' } - ] + transfer_requests: transfer_requests } }, body: '{}' @@ -1193,15 +1103,13 @@ end it 'creates the child tubes' do - expect_api_v2_posts( - 'CustomMetadatumCollection', - [tube_1_create_args, tube_2_create_args, tube_3_create_args, tube_4_create_args, tube_5_create_args] - ) + # Contingency tubes creation + expect_specific_tube_creation(child_contingency_tube_purpose_uuid, contingency_tubes) + expect_custom_metadatum_collection_posts({ 'TR00000002' => contingency_tubes }) expect(subject.valid?).to be_truthy expect(subject.save).to be_truthy expect(stub_contingency_file_upload).to have_been_made.once - expect(stub_contingency_tube_creation_request).to have_been_made.once expect(stub_transfer_creation_request).to have_been_made.once end end From 9ebf0823a185b37be58def6aaaed80fe4b356632 Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Tue, 17 Sep 2024 13:34:33 +0100 Subject: [PATCH 17/43] Remove unneeded fixtures for child tubes --- .../plate_split_to_tube_racks_spec.rb | 245 +----------------- 1 file changed, 10 insertions(+), 235 deletions(-) diff --git a/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb b/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb index 040feb362..6fd9a237b 100644 --- a/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb +++ b/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb @@ -116,77 +116,6 @@ { user_uuid: user_uuid, purpose_uuid: child_sequencing_tube_purpose_uuid, parent_uuid: parent_uuid } end - # child tubes for lookup after creation - let(:child_tube_1_uuid) { SecureRandom.uuid } - let(:child_tube_1_aliquot) { create(:v2_aliquot, sample: sample1) } - let(:child_tube_1_v2) do - create( - :v2_stock_tube, - state: 'passed', - purpose_name: child_sequencing_tube_purpose_name, - aliquots: [child_tube_1_aliquot], - barcode_prefix: 'FX', - barcode_number: 1, - uuid: child_tube_1_uuid - ) - end - - let(:child_tube_2_uuid) { SecureRandom.uuid } - let(:child_tube_2_aliquot) { create(:v2_aliquot, sample: sample2) } - let(:child_tube_2_v2) do - create( - :v2_stock_tube, - state: 'passed', - purpose_name: child_sequencing_tube_purpose_name, - aliquots: [child_tube_2_aliquot], - barcode_prefix: 'FX', - barcode_number: 2, - uuid: child_tube_2_uuid - ) - end - - let(:child_tube_3_uuid) { SecureRandom.uuid } - let(:child_tube_3_aliquot) { create(:v2_aliquot, sample: sample1) } - let(:child_tube_3_v2) do - create( - :v2_stock_tube, - state: 'passed', - purpose_name: child_contingency_tube_purpose_name, - aliquots: [child_tube_3_aliquot], - barcode_prefix: 'FX', - barcode_number: 11, - uuid: child_tube_3_uuid - ) - end - - let(:child_tube_4_uuid) { SecureRandom.uuid } - let(:child_tube_4_aliquot) { create(:v2_aliquot, sample: sample1) } - let(:child_tube_4_v2) do - create( - :v2_stock_tube, - state: 'passed', - purpose_name: child_contingency_tube_purpose_name, - aliquots: [child_tube_4_aliquot], - barcode_prefix: 'FX', - barcode_number: 12, - uuid: child_tube_4_uuid - ) - end - - let(:child_tube_5_uuid) { SecureRandom.uuid } - let(:child_tube_5_aliquot) { create(:v2_aliquot, sample: sample2) } - let(:child_tube_5_v2) do - create( - :v2_stock_tube, - state: 'passed', - purpose_name: child_contingency_tube_purpose_name, - aliquots: [child_tube_5_aliquot], - barcode_prefix: 'FX', - barcode_number: 13, - uuid: child_tube_5_uuid - ) - end - let(:sequencing_file) do fixture_file_upload( 'spec/fixtures/files/scrna_core/scrna_core_sequencing_tube_rack_scan.csv', @@ -271,12 +200,14 @@ def expect_custom_metadatum_collection_posts(tubes_hash) stub_v2_tube(ancestor_tube_1_v2, stub_search: false) stub_v2_tube(ancestor_tube_2_v2, stub_search: false) - # child tube lookups - stub_v2_tube(child_tube_1_v2, stub_search: false) - stub_v2_tube(child_tube_2_v2, stub_search: false) - stub_v2_tube(child_tube_3_v2, stub_search: false) - stub_v2_tube(child_tube_4_v2, stub_search: false) - stub_v2_tube(child_tube_5_v2, stub_search: false) + # Block finding tubes by given barcodes. + allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000001').and_return(nil) + allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000002').and_return(nil) + allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000011').and_return(nil) + allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000012').and_return(nil) + allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000013').and_return(nil) + allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000014').and_return(nil) + allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000015').and_return(nil) end context 'on new' do @@ -423,13 +354,6 @@ def expect_custom_metadatum_collection_posts(tubes_hash) 'wells.aliquots,wells.aliquots.sample,wells.downstream_tubes,' \ 'wells.downstream_tubes.custom_metadatum_collection' ) - allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000001').and_return(nil) - allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000002').and_return(nil) - allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000011').and_return(nil) - allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000012').and_return(nil) - allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000013').and_return(nil) - allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000014').and_return(nil) - allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000015').and_return(nil) end context 'when files are not present' do @@ -548,13 +472,6 @@ def expect_custom_metadatum_collection_posts(tubes_hash) 'wells.aliquots,wells.aliquots.sample,wells.downstream_tubes,' \ 'wells.downstream_tubes.custom_metadatum_collection' ) - allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000001').and_return(nil) - allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000002').and_return(nil) - allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000011').and_return(nil) - allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000012').and_return(nil) - allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000013').and_return(nil) - allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000014').and_return(nil) - allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000015').and_return(nil) end context 'when files are not present' do @@ -733,13 +650,6 @@ def expect_custom_metadatum_collection_posts(tubes_hash) 'wells.downstream_tubes.custom_metadatum_collection' ) stub_api_get(parent_uuid, body: parent_v1) - allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000001').and_return(nil) - allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000002').and_return(nil) - allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000011').and_return(nil) - allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000012').and_return(nil) - allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000013').and_return(nil) - allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000014').and_return(nil) - allow(Sequencescape::Api::V2::Tube).to receive(:find_by).with(barcode: 'FX00000015').and_return(nil) end context 'with both sequencing and contingency files' do @@ -810,29 +720,6 @@ def expect_custom_metadatum_collection_posts(tubes_hash) ) end - # need api v1 versions of child tubes - let(:child_tube_1_v1) { json :tube, uuid: child_tube_1_uuid, barcode_prefix: 'FX', barcode_number: 1 } - let(:child_tube_2_v1) { json :tube, uuid: child_tube_2_uuid, barcode_prefix: 'FX', barcode_number: 2 } - let(:child_tube_3_v1) { json :tube, uuid: child_tube_3_uuid, barcode_prefix: 'FX', barcode_number: 11 } - let(:child_tube_4_v1) { json :tube, uuid: child_tube_4_uuid, barcode_prefix: 'FX', barcode_number: 12 } - let(:child_tube_5_v1) { json :tube, uuid: child_tube_5_uuid, barcode_prefix: 'FX', barcode_number: 13 } - - # Metadata expected to be sent in POST requests - let!(:metadata_for_tube_1) { { tube_rack_barcode: 'TR00000001', tube_rack_position: 'A1' } } - let(:tube_1_create_args) { { user_id: user.id, asset_id: child_tube_1_v2.id, metadata: metadata_for_tube_1 } } - - let!(:metadata_for_tube_2) { { tube_rack_barcode: 'TR00000001', tube_rack_position: 'B1' } } - let(:tube_2_create_args) { { user_id: user.id, asset_id: child_tube_2_v2.id, metadata: metadata_for_tube_2 } } - - let!(:metadata_for_tube_3) { { tube_rack_barcode: 'TR00000002', tube_rack_position: 'A1' } } - let(:tube_3_create_args) { { user_id: user.id, asset_id: child_tube_3_v2.id, metadata: metadata_for_tube_3 } } - - let!(:metadata_for_tube_4) { { tube_rack_barcode: 'TR00000002', tube_rack_position: 'B1' } } - let(:tube_4_create_args) { { user_id: user.id, asset_id: child_tube_4_v2.id, metadata: metadata_for_tube_4 } } - - let!(:metadata_for_tube_5) { { tube_rack_barcode: 'TR00000002', tube_rack_position: 'C1' } } - let(:tube_5_create_args) { { user_id: user.id, asset_id: child_tube_5_v2.id, metadata: metadata_for_tube_5 } } - let(:contingency_file) do fixture_file_upload( 'spec/fixtures/files/scrna_core/scrna_core_contingency_tube_rack_scan_3_tubes.csv', @@ -840,15 +727,7 @@ def expect_custom_metadatum_collection_posts(tubes_hash) ) end - before do - stub_v2_user(user) - - stub_v2_labware(child_tube_1_v2) - stub_v2_labware(child_tube_2_v2) - stub_v2_labware(child_tube_3_v2) - stub_v2_labware(child_tube_4_v2) - stub_v2_labware(child_tube_5_v2) - end + before { stub_v2_user(user) } it 'creates the child tubes' do expect_specific_tube_creation(child_sequencing_tube_purpose_uuid, sequencing_tubes) @@ -920,18 +799,6 @@ def expect_custom_metadatum_collection_posts(tubes_hash) ) end - before do - stub_get_labware_metadata(child_tube_1_v2.barcode.machine, child_tube_1_v1) - stub_get_labware_metadata(child_tube_2_v2.barcode.machine, child_tube_2_v1) - stub_get_labware_metadata(child_tube_3_v2.barcode.machine, child_tube_3_v1) - stub_get_labware_metadata(child_tube_4_v2.barcode.machine, child_tube_4_v1) - - stub_asset_search(child_tube_1_v2.barcode.machine, child_tube_1_v1) - stub_asset_search(child_tube_2_v2.barcode.machine, child_tube_2_v1) - stub_asset_search(child_tube_3_v2.barcode.machine, child_tube_3_v1) - stub_asset_search(child_tube_4_v2.barcode.machine, child_tube_4_v1) - end - it 'does not create a tube for the failed well' do expect_specific_tube_creation(child_sequencing_tube_purpose_uuid, sequencing_tubes) expect_specific_tube_creation(child_contingency_tube_purpose_uuid, contingency_tubes) @@ -968,67 +835,6 @@ def expect_custom_metadatum_collection_posts(tubes_hash) } end - # child tubes for lookup after creation - let(:child_tube_1_v2) do - create( - :v2_stock_tube, - state: 'passed', - purpose_name: child_contingency_tube_purpose_name, - aliquots: [child_tube_1_aliquot], - barcode_prefix: 'FX', - barcode_number: 11, - uuid: child_tube_1_uuid - ) - end - - let(:child_tube_2_v2) do - create( - :v2_stock_tube, - state: 'passed', - purpose_name: child_contingency_tube_purpose_name, - aliquots: [child_tube_2_aliquot], - barcode_prefix: 'FX', - barcode_number: 12, - uuid: child_tube_2_uuid - ) - end - - let(:child_tube_3_v2) do - create( - :v2_stock_tube, - state: 'passed', - purpose_name: child_contingency_tube_purpose_name, - aliquots: [child_tube_3_aliquot], - barcode_prefix: 'FX', - barcode_number: 13, - uuid: child_tube_3_uuid - ) - end - - let(:child_tube_4_v2) do - create( - :v2_stock_tube, - state: 'passed', - purpose_name: child_contingency_tube_purpose_name, - aliquots: [child_tube_4_aliquot], - barcode_prefix: 'FX', - barcode_number: 14, - uuid: child_tube_4_uuid - ) - end - - let(:child_tube_5_v2) do - create( - :v2_stock_tube, - state: 'passed', - purpose_name: child_contingency_tube_purpose_name, - aliquots: [child_tube_5_aliquot], - barcode_prefix: 'FX', - barcode_number: 15, - uuid: child_tube_5_uuid - ) - end - let(:contingency_tubes) do prepare_created_child_tubes( [ @@ -1069,38 +875,7 @@ def expect_custom_metadatum_collection_posts(tubes_hash) ) end - # need api v1 versions of child tubes - let(:child_tube_1_v1) { json :tube, uuid: child_tube_1_uuid, barcode_prefix: 'FX', barcode_number: 11 } - let(:child_tube_2_v1) { json :tube, uuid: child_tube_2_uuid, barcode_prefix: 'FX', barcode_number: 12 } - let(:child_tube_3_v1) { json :tube, uuid: child_tube_3_uuid, barcode_prefix: 'FX', barcode_number: 13 } - let(:child_tube_4_v1) { json :tube, uuid: child_tube_4_uuid, barcode_prefix: 'FX', barcode_number: 14 } - let(:child_tube_5_v1) { json :tube, uuid: child_tube_5_uuid, barcode_prefix: 'FX', barcode_number: 15 } - - # need to stub the creation of the tube metadata - let!(:metadata_for_tube_1) { { tube_rack_barcode: 'TR00000002', tube_rack_position: 'A1' } } - let(:tube_1_create_args) { { user_id: user.id, asset_id: child_tube_1_v2.id, metadata: metadata_for_tube_1 } } - - let!(:metadata_for_tube_2) { { tube_rack_barcode: 'TR00000002', tube_rack_position: 'B1' } } - let(:tube_2_create_args) { { user_id: user.id, asset_id: child_tube_2_v2.id, metadata: metadata_for_tube_2 } } - - let!(:metadata_for_tube_3) { { tube_rack_barcode: 'TR00000002', tube_rack_position: 'C1' } } - let(:tube_3_create_args) { { user_id: user.id, asset_id: child_tube_3_v2.id, metadata: metadata_for_tube_3 } } - - let!(:metadata_for_tube_4) { { tube_rack_barcode: 'TR00000002', tube_rack_position: 'E1' } } - let(:tube_4_create_args) { { user_id: user.id, asset_id: child_tube_4_v2.id, metadata: metadata_for_tube_4 } } - - let!(:metadata_for_tube_5) { { tube_rack_barcode: 'TR00000002', tube_rack_position: 'F1' } } - let(:tube_5_create_args) { { user_id: user.id, asset_id: child_tube_5_v2.id, metadata: metadata_for_tube_5 } } - - before do - stub_v2_user(user) - - stub_v2_labware(child_tube_1_v2) - stub_v2_labware(child_tube_2_v2) - stub_v2_labware(child_tube_3_v2) - stub_v2_labware(child_tube_4_v2) - stub_v2_labware(child_tube_5_v2) - end + before { stub_v2_user(user) } it 'creates the child tubes' do # Contingency tubes creation From cd8c643d9a0d64f756d8198a780b1ee9234a0731 Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Tue, 17 Sep 2024 13:37:04 +0100 Subject: [PATCH 18/43] Remove accidental assignment to unused variable --- spec/models/labware_creators/plate_split_to_tube_racks_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb b/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb index 6fd9a237b..5a0de7246 100644 --- a/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb +++ b/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb @@ -165,7 +165,7 @@ def expect_custom_metadatum_collection_posts(tubes_hash) expected_call_args = tubes_hash.flat_map do |tube_rack_barcode, tubes| tubes.map do |tube| - metadata = { + { user_id: user.id, asset_id: tube.id, metadata: { From 9f10f6a0e28740510cb47bcccb64df5ae5b0d17a Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Tue, 17 Sep 2024 14:22:20 +0100 Subject: [PATCH 19/43] Fix tests for pooled tubes by submission --- .../pooled_tubes_by_submission_spec.rb | 103 ++++++++---------- 1 file changed, 43 insertions(+), 60 deletions(-) diff --git a/spec/models/labware_creators/pooled_tubes_by_submission_spec.rb b/spec/models/labware_creators/pooled_tubes_by_submission_spec.rb index f358503a5..cb8033efe 100644 --- a/spec/models/labware_creators/pooled_tubes_by_submission_spec.rb +++ b/spec/models/labware_creators/pooled_tubes_by_submission_spec.rb @@ -11,6 +11,8 @@ RSpec.describe LabwareCreators::PooledTubesBySubmission do include FeatureHelpers + has_a_working_api + it_behaves_like 'it only allows creation from charged and passed plates with defined downstream pools' subject { LabwareCreators::PooledTubesBySubmission.new(api, form_attributes) } @@ -31,10 +33,25 @@ before { stub_v2_plate(source_plate, stub_search: false) } context '#save!' do - has_a_working_api - - let(:child_1_name) { 'DN5 A1:C1' } - let(:child_2_name) { 'DN5 D1:A2' } + def expect_specific_tube_creation(child_tubes) + # Create a mock for the specific tube creation. + specific_tube_creation = double + allow(specific_tube_creation).to receive(:children).and_return(child_tubes) + + # Expect the post request and return the mock. + expect_api_v2_posts( + 'SpecificTubeCreation', + [ + { + child_purpose_uuids: [purpose_uuid] * child_tubes.size, + parent_uuids: [parent_uuid], + tube_attributes: child_tubes.map { |tube| { name: tube.name } }, + user_uuid: user_uuid + } + ], + [specific_tube_creation] + ) + end # Used to fetch the pools. This is the kind of thing we could pass through from a custom form let!(:parent_request) do @@ -42,40 +59,20 @@ stub_api_get(parent_uuid, 'wells', body: wells_json) end - let(:creation_payload) do - { - user: user_uuid, - parent: parent_uuid, - child_purposes: [purpose_uuid, purpose_uuid], - tube_attributes: [{ name: child_1_name }, { name: child_2_name }] - } - end + let(:child_1_name) { 'DN5 A1:C1' } + let(:child_2_name) { 'DN5 D1:A2' } - let(:tube_creation_request_uuid) { SecureRandom.uuid } + let(:tube_attributes) { [{ name: child_1_name }, { name: child_2_name }] } - let!(:tube_creation_request) do - stub_api_post( - 'specific_tube_creations', - payload: { - specific_tube_creation: creation_payload - }, - body: - json( - :specific_tube_creation, - uuid: tube_creation_request_uuid, - children_count: 2, - names: [child_1_name, child_2_name] - ) - ) - end + let(:child_tubes) do + # Prepare child tubes and stub their lookups. + child_tubes = + tube_attributes.each_with_index.map do |attrs, index| + create(:v2_tube, name: attrs[:name], uuid: "tube-#{index}") + end + child_tubes.each { |child_tube| stub_v2_labware(child_tube) } - # Find out what tubes we've just made! - let!(:tube_creation_children_request) do - stub_api_get( - tube_creation_request_uuid, - 'children', - body: json(:tube_collection, names: [child_1_name, child_2_name]) - ) + child_tubes end let(:transfer_requests) do @@ -106,9 +103,10 @@ end context 'without parent metadata' do + before { expect_specific_tube_creation(child_tubes) } + it 'pools by submission' do expect(subject.save!).to be_truthy - expect(tube_creation_request).to have_been_made.once expect(transfer_creation_request).to have_been_made.once end @@ -133,24 +131,11 @@ for_multiplexing: true end - setup do - stub_get_labware_metadata('DN10', parent, metadata: { stock_barcode: 'DN6' }) - stub_api_post( - 'specific_tube_creations', - payload: { - specific_tube_creation: creation_payload - }, - body: - json( - :specific_tube_creation, - uuid: tube_creation_request_uuid, - children_count: 2, - names: [child_1_name, child_2_name] - ) - ) - end + setup { stub_get_labware_metadata('DN10', parent, metadata: { stock_barcode: 'DN6' }) } it 'sets the correct tube name' do + expect_specific_tube_creation(child_tubes) + expect(subject.save!).to be_truthy expect(subject.child_stock_tubes.length).to eq(2) expect(subject.child_stock_tubes).to have_key(child_1_name) @@ -172,6 +157,9 @@ { 'source_asset' => 'example-well-uuid-7', 'target_asset' => 'tube-1', 'submission' => 'pool-2-uuid' } ] end + + before { expect_specific_tube_creation(child_tubes) } + it 'pools by submission' do expect(subject.save!).to be_truthy expect(transfer_creation_request).to have_been_made.once @@ -191,14 +179,9 @@ ] end - let(:creation_payload) do - { - user: user_uuid, - parent: parent_uuid, - child_purposes: [purpose_uuid], - tube_attributes: [{ name: child_1_name }] - } - end + let(:tube_attributes) { [{ name: child_1_name }] } + + before { expect_specific_tube_creation(child_tubes) } it 'pools by submission' do expect(subject.save!).to be_truthy From 8ca6cc86c93c599807c30ad669882cdde07827d8 Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Tue, 17 Sep 2024 14:34:43 +0100 Subject: [PATCH 20/43] Fix tests for custom_pooled_tubes --- .../custom_pooled_tubes_spec.rb | 48 +++++++++---------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/spec/models/labware_creators/custom_pooled_tubes_spec.rb b/spec/models/labware_creators/custom_pooled_tubes_spec.rb index c9ed9f2e9..489727e2f 100644 --- a/spec/models/labware_creators/custom_pooled_tubes_spec.rb +++ b/spec/models/labware_creators/custom_pooled_tubes_spec.rb @@ -73,29 +73,28 @@ ) end - let(:tube_creation_request_uuid) { SecureRandom.uuid } - - let(:tube_creation_request) do - stub_api_post( - 'specific_tube_creations', - payload: { - specific_tube_creation: { - user: user_uuid, - parent: parent_uuid, - child_purposes: [purpose_uuid, purpose_uuid], - tube_attributes: [{ name: 'DN5 A1:B2' }, { name: 'DN5 C1:G2' }] + def expect_specific_tube_creation + child_tubes = [ + create(:v2_tube, name: 'DN5 A1:B2', uuid: 'tube-0'), + create(:v2_tube, name: 'DN5 C1:G2', uuid: 'tube-1') + ] + + # Create a mock for the specific tube creation. + specific_tube_creation = double + allow(specific_tube_creation).to receive(:children).and_return(child_tubes) + + # Expect the post request and return the mock. + expect_api_v2_posts( + 'SpecificTubeCreation', + [ + { + child_purpose_uuids: [purpose_uuid, purpose_uuid], + parent_uuids: [parent_uuid], + tube_attributes: child_tubes.map { |tube| { name: tube.name } }, + user_uuid: user_uuid } - }, - body: json(:specific_tube_creation, uuid: tube_creation_request_uuid, children_count: 2) - ) - end - - # Find out what tubes we've just made! - let(:tube_creation_children_request) do - stub_api_get( - tube_creation_request_uuid, - 'children', - body: json(:tube_collection, names: ['DN5 A1:B2', 'DN5 C1:G2']) + ], + [specific_tube_creation] ) end @@ -138,8 +137,6 @@ before do stub_parent_request stub_qc_file_creation - tube_creation_children_request - tube_creation_request transfer_creation_request end @@ -149,9 +146,10 @@ end it 'pools according to the file' do + expect_specific_tube_creation + expect(subject.save).to be_truthy expect(stub_qc_file_creation).to have_been_made.once - expect(tube_creation_request).to have_been_made.once expect(transfer_creation_request).to have_been_made.once end end From 3d096e488460e4814521d907b16f227b0a6eadef Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Tue, 17 Sep 2024 16:42:22 +0100 Subject: [PATCH 21/43] Change parents relationship to Labware instead of Asset --- .../sequencescape/api/v2/specific_tube_creation.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/sequencescape/sequencescape/api/v2/specific_tube_creation.rb b/app/sequencescape/sequencescape/api/v2/specific_tube_creation.rb index 035a70c5a..4b3235552 100644 --- a/app/sequencescape/sequencescape/api/v2/specific_tube_creation.rb +++ b/app/sequencescape/sequencescape/api/v2/specific_tube_creation.rb @@ -3,6 +3,6 @@ # Represents a specific tube creation in Limber via the Sequencescape API class Sequencescape::Api::V2::SpecificTubeCreation < Sequencescape::Api::V2::Base has_many :children, class_name: 'Sequencescape::Api::V2::Tube' - has_many :parents, class_name: 'Sequencescape::Api::V2::Asset' + has_many :parents, class_name: 'Sequencescape::Api::V2::Labware' has_one :user, class_name: 'Sequencescape::Api::V2::User' end From 5829cd100fa5c001bb576c24b2da5f50f2f527fa Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Thu, 19 Sep 2024 17:53:28 +0100 Subject: [PATCH 22/43] Add Limber model for PooledPlateCreation API v2 endpoint --- .../sequencescape/api/v2/pooled_plate_creation.rb | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 app/sequencescape/sequencescape/api/v2/pooled_plate_creation.rb diff --git a/app/sequencescape/sequencescape/api/v2/pooled_plate_creation.rb b/app/sequencescape/sequencescape/api/v2/pooled_plate_creation.rb new file mode 100644 index 000000000..ef2d1d631 --- /dev/null +++ b/app/sequencescape/sequencescape/api/v2/pooled_plate_creation.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +# Represents a pooled plate creation in Limber via the Sequencescape API +class Sequencescape::Api::V2::PooledPlateCreation < Sequencescape::Api::V2::Base + has_one :child, class_name: 'Sequencescape::Api::V2::Plate' + has_many :parents, class_name: 'Sequencescape::Api::V2::Labware' + has_one :user, class_name: 'Sequencescape::Api::V2::User' +end From f90e4472d1e14e9fdc5cf2de6e9d586a4d6b65fd Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Thu, 19 Sep 2024 18:40:03 +0100 Subject: [PATCH 23/43] Migrate usage of PooledPlateCreation from API v1 to v2 --- .../labware_creators/custom_tagged_plate.rb | 9 ++++----- app/models/labware_creators/merged_plate.rb | 8 ++++---- app/models/labware_creators/multi_plate_pool.rb | 11 +++++++---- app/models/labware_creators/multi_stamp.rb | 11 +++++++---- app/models/labware_creators/multi_stamp_tubes.rb | 16 +++++++++------- .../multi_stamp_tubes_using_tube_rack_scan.rb | 16 +++++++++------- 6 files changed, 40 insertions(+), 31 deletions(-) diff --git a/app/models/labware_creators/custom_tagged_plate.rb b/app/models/labware_creators/custom_tagged_plate.rb index 31a85dd98..f08960bda 100644 --- a/app/models/labware_creators/custom_tagged_plate.rb +++ b/app/models/labware_creators/custom_tagged_plate.rb @@ -47,12 +47,11 @@ def initialize(*args, &block) def create_plate! # rubocop:todo Metrics/AbcSize @child = - api - .pooled_plate_creation + Sequencescape::Api::V2::PooledPlateCreation .create!( - child_purpose: purpose_uuid, - user: user_uuid, - parents: [parent_uuid, tag_plate.asset_uuid].compact_blank + child_purpose_uuid: purpose_uuid, + parent_uuids: [parent_uuid, tag_plate.asset_uuid].compact_blank, + user_uuid: user_uuid ) .child diff --git a/app/models/labware_creators/merged_plate.rb b/app/models/labware_creators/merged_plate.rb index d6bd17bfb..8f1be6c3f 100644 --- a/app/models/labware_creators/merged_plate.rb +++ b/app/models/labware_creators/merged_plate.rb @@ -51,10 +51,10 @@ def barcodes=(barcodes) private def create_plate_from_parent! - api.pooled_plate_creation.create!( - child_purpose: purpose_uuid, - user: user_uuid, - parents: source_plates.map(&:uuid) + Sequencescape::Api::V2::PooledPlateCreation.create!( + child_purpose_uuid: purpose_uuid, + parent_uuids: source_plates.map(&:uuid), + user_uuid: user_uuid ) end diff --git a/app/models/labware_creators/multi_plate_pool.rb b/app/models/labware_creators/multi_plate_pool.rb index 6beeaacc5..b6307285a 100644 --- a/app/models/labware_creators/multi_plate_pool.rb +++ b/app/models/labware_creators/multi_plate_pool.rb @@ -17,10 +17,13 @@ class MultiPlatePool < Base private def create_labware! - plate_creation = - api.pooled_plate_creation.create!(parents: transfers.keys, child_purpose: purpose_uuid, user: user_uuid) - - @child = plate_creation.child + @child = + Sequencescape::Api::V2::PooledPlateCreation.create!( + child_purpose_uuid: purpose_uuid, + parent_uuids: transfers.keys, + user_uuid: user_uuid + ) + .child api.bulk_transfer.create!(user: user_uuid, well_transfers: well_transfers) diff --git a/app/models/labware_creators/multi_stamp.rb b/app/models/labware_creators/multi_stamp.rb index 6cb8a9810..88b93623a 100644 --- a/app/models/labware_creators/multi_stamp.rb +++ b/app/models/labware_creators/multi_stamp.rb @@ -30,10 +30,13 @@ class MultiStamp < Base # rubocop:todo Style/Documentation private def create_labware! - plate_creation = - api.pooled_plate_creation.create!(parents: parent_uuids, child_purpose: purpose_uuid, user: user_uuid) - - @child = plate_creation.child + @child = + Sequencescape::Api::V2::PooledPlateCreation.create!( + child_purpose_uuid: purpose_uuid, + parent_uuids: parent_uuids, + user_uuid: user_uuid + ) + .child transfer_material_from_parent!(@child.uuid) diff --git a/app/models/labware_creators/multi_stamp_tubes.rb b/app/models/labware_creators/multi_stamp_tubes.rb index aa3b153d0..91bfcc6be 100644 --- a/app/models/labware_creators/multi_stamp_tubes.rb +++ b/app/models/labware_creators/multi_stamp_tubes.rb @@ -41,13 +41,15 @@ def create_labware! create_and_build_submission return if errors.size.positive? - plate_creation = - api.pooled_plate_creation.create!(parents: parent_uuids, child_purpose: purpose_uuid, user: user_uuid) - - @child = plate_creation.child - child_v2 = Sequencescape::Api::V2.plate_with_wells(@child.uuid) - - transfer_material_from_parent!(child_v2) + @child = + Sequencescape::Api::V2::PooledPlateCreation.create!( + child_purpose_uuid: purpose_uuid, + parent_uuids: parent_uuids, + user_uuid: user_uuid + ) + .child + + transfer_material_from_parent!(@child.uuid) yield(@child) if block_given? true diff --git a/app/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan.rb b/app/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan.rb index d1aab1bd2..47feae545 100644 --- a/app/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan.rb +++ b/app/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan.rb @@ -65,13 +65,15 @@ def save # # @return [Boolean] true if the child plate was created successfully. def create_labware! - plate_creation = - api.pooled_plate_creation.create!(parents: parent_tube_uuids, child_purpose: purpose_uuid, user: user_uuid) - - @child = plate_creation.child - child_v2 = Sequencescape::Api::V2.plate_with_wells(@child.uuid) - - transfer_material_from_parent!(child_v2) + @child = + Sequencescape::Api::V2::PooledPlateCreation.create!( + child_purpose_uuid: purpose_uuid, + parent_uuids: parent_tube_uuids, + user_uuid: user_uuid + ) + .child + + transfer_material_from_parent!(@child.uuid) yield(@child) if block_given? true From 196a5a4c3fcbe02ec5155ef54a4500d80c460b2b Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Fri, 20 Sep 2024 12:25:33 +0100 Subject: [PATCH 24/43] Fix unit tests for new endpoint usage --- .../labware_creators/multi_stamp_tubes.rb | 14 +-- .../multi_stamp_tubes_using_tube_rack_scan.rb | 12 ++- spec/features/pooling_multiple_plates_spec.rb | 62 +++++++------ .../custom_tagged_plate_spec.rb | 55 +++++++----- .../labware_creators/merged_plate_spec.rb | 58 +++++++----- .../labware_creators/multi_plate_pool_spec.rb | 49 ++++++---- .../labware_creators/multi_stamp_spec.rb | 40 ++++++--- .../multi_stamp_tubes_spec.rb | 86 ++++++------------ ...i_stamp_tubes_using_tube_rack_scan_spec.rb | 70 ++++++--------- .../quadrant_stamp_primer_panel_spec.rb | 90 +++++++++---------- 10 files changed, 272 insertions(+), 264 deletions(-) diff --git a/app/models/labware_creators/multi_stamp_tubes.rb b/app/models/labware_creators/multi_stamp_tubes.rb index 91bfcc6be..53f6a346a 100644 --- a/app/models/labware_creators/multi_stamp_tubes.rb +++ b/app/models/labware_creators/multi_stamp_tubes.rb @@ -49,7 +49,7 @@ def create_labware! ) .child - transfer_material_from_parent!(@child.uuid) + transfer_material_from_parent! yield(@child) if block_given? true @@ -89,15 +89,15 @@ def parent_tubes Sequencescape::Api::V2::Tube.find_all(uuid: parent_uuids, includes: 'receptacle,aliquots,aliquots.study') end - def transfer_material_from_parent!(child_plate) + def transfer_material_from_parent! api.transfer_request_collection.create!( user: user_uuid, - transfer_requests: transfer_request_attributes(child_plate) + transfer_requests: transfer_request_attributes ) end - def transfer_request_attributes(child_plate) - transfers.map { |transfer| request_hash(transfer, child_plate) } + def transfer_request_attributes + transfers.map { |transfer| request_hash(transfer) } end def source_tube_outer_request_uuid(tube) @@ -110,13 +110,13 @@ def source_tube_outer_request_uuid(tube) pending_reqs.first.uuid || nil end - def request_hash(transfer, child_plate) + def request_hash(transfer) tube = Sequencescape::Api::V2::Tube.find_by(uuid: transfer[:source_tube]) { 'source_asset' => transfer[:source_asset], 'target_asset' => - child_plate.wells.detect { |child_well| child_well.location == transfer.dig(:new_target, :location) }&.uuid, + @child.wells.detect { |child_well| child_well.location == transfer.dig(:new_target, :location) }&.uuid, 'outer_request' => source_tube_outer_request_uuid(tube) } end diff --git a/app/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan.rb b/app/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan.rb index 47feae545..efde77128 100644 --- a/app/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan.rb +++ b/app/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan.rb @@ -73,7 +73,7 @@ def create_labware! ) .child - transfer_material_from_parent!(@child.uuid) + transfer_material_from_parent! yield(@child) if block_given? true @@ -234,24 +234,22 @@ def tube_has_expected_active_request?(tube_in_db) end # Transfers material from the parent tubes to the given child plate. - # @param child_plate [Sequencescape::Api::V2::Plate] The plate to transfer material to. - def transfer_material_from_parent!(child_plate) + def transfer_material_from_parent! api.transfer_request_collection.create!( user: user_uuid, - transfer_requests: transfer_request_attributes(child_plate) + transfer_requests: transfer_request_attributes ) end # Returns an array of hashes representing the transfer requests for the given child plate. # Each hash includes the UUIDs of the parent tube and child well, and the UUID of the outer request. - # @param child_plate [Sequencescape::Api::V2::Plate] The plate to get the transfer requests for. # @return [Array] An array of hashes representing the transfer requests. - def transfer_request_attributes(child_plate) + def transfer_request_attributes parent_tubes.each_with_object([]) do |(foreign_barcode, parent_tube), tube_transfers| tube_transfers << request_hash( parent_tube.uuid, - child_plate + @child .wells .detect { |child_well| child_well.location == csv_file.location_by_barcode_details[foreign_barcode] } &.uuid, diff --git a/spec/features/pooling_multiple_plates_spec.rb b/spec/features/pooling_multiple_plates_spec.rb index b7a49849f..cc8a2f9d7 100644 --- a/spec/features/pooling_multiple_plates_spec.rb +++ b/spec/features/pooling_multiple_plates_spec.rb @@ -34,29 +34,6 @@ purpose_uuid: 'stock-plate-purpose-uuid' end - let(:child_plate_uuid) { SecureRandom.uuid } - let(:child_plate) do - create :v2_plate, - purpose_uuid: 'child-purpose-0', - purpose_name: 'Pool Plate', - uuid: child_plate_uuid, - barcode_number: 3 - end - - let!(:pooled_plate_creation_request) do - stub_api_post( - 'pooled_plate_creations', - payload: { - pooled_plate_creation: { - user: user_uuid, - child_purpose: 'child-purpose-0', - parents: [plate_uuid, plate_uuid_2] - } - }, - body: json(:plate_creation, child_uuid: child_plate_uuid) - ) - end - let!(:bulk_transfer_request) do stub_api_post( 'bulk_transfers', @@ -67,25 +44,53 @@ { 'source_uuid' => plate_uuid, 'source_location' => 'A1', - 'destination_uuid' => child_plate_uuid, + 'destination_uuid' => child_plate.uuid, 'destination_location' => 'A1' }, { 'source_uuid' => plate_uuid_2, 'source_location' => 'A1', - 'destination_uuid' => child_plate_uuid, + 'destination_uuid' => child_plate.uuid, 'destination_location' => 'B1' }, { 'source_uuid' => plate_uuid_2, 'source_location' => 'B1', - 'destination_uuid' => child_plate_uuid, + 'destination_uuid' => child_plate.uuid, 'destination_location' => 'B1' } ] } }, - body: json(:plate_creation, child_uuid: child_plate_uuid) + body: json(:plate_creation, child_uuid: child_plate.uuid) + ) + end + + let(:child_plate) do + create :v2_plate, + purpose_uuid: 'child-purpose-0', + purpose_name: 'Pool Plate', + barcode_number: 3 + end + + let(:pooled_plate_creation) do + response = double + allow(response).to receive(:child).and_return(child_plate) + + response + end + + def expect_pooled_plate_creation + expect_api_v2_posts( + 'PooledPlateCreation', + [ + { + child_purpose_uuid: 'child-purpose-0', + parent_uuids: [plate_uuid, plate_uuid_2], + user_uuid: user_uuid + } + ], + [pooled_plate_creation] ) end @@ -108,6 +113,8 @@ end scenario 'creates multiple plates' do + expect_pooled_plate_creation + fill_in_swipecard_and_barcode(user_swipecard, plate_barcode_1) plate_title = find('#plate-title') expect(plate_title).to have_text('Pooled example') @@ -119,7 +126,6 @@ expect(page).to have_content('DN2: A1, B1') click_on('Make Pre-Cap pool Plate') expect(page).to have_text('New empty labware added to the system') - expect(pooled_plate_creation_request).to have_been_made expect(bulk_transfer_request).to have_been_made expect(page).to have_text('Pool Plate') end diff --git a/spec/models/labware_creators/custom_tagged_plate_spec.rb b/spec/models/labware_creators/custom_tagged_plate_spec.rb index 522fd4bd3..0dd4f7381 100644 --- a/spec/models/labware_creators/custom_tagged_plate_spec.rb +++ b/spec/models/labware_creators/custom_tagged_plate_spec.rb @@ -95,25 +95,33 @@ context 'On create' do let(:tag_plate_uuid) { 'tag-plate' } let(:tag_template_uuid) { 'tag-layout-template' } - let(:child_plate_uuid) { SecureRandom.uuid } let(:parents) { [plate_uuid, tag_plate_uuid] } - let!(:plate_creation_request) do - stub_api_post( - 'pooled_plate_creations', - payload: { - pooled_plate_creation: { - parents: parents, - child_purpose: child_purpose_uuid, - user: user_uuid + let(:expected_transfers) { WellHelpers.stamp_hash(96) } + + let(:child_plate) { create :v2_plate } + + let(:pooled_plate_creation) do + response = double + allow(response).to receive(:child).and_return(child_plate) + + response + end + + def expect_pooled_plate_creation + expect_api_v2_posts( + 'PooledPlateCreation', + [ + { + child_purpose_uuid: child_purpose_uuid, + parent_uuids: parents, + user_uuid: user_uuid } - }, - body: json(:plate_creation, child_uuid: child_plate_uuid) + ], + [pooled_plate_creation] ) end - let(:expected_transfers) { WellHelpers.stamp_hash(96) } - def expect_state_change_creation expect_api_v2_posts( 'StateChange', @@ -134,7 +142,7 @@ def expect_tag_layout_creation [ { user_uuid: user_uuid, - plate_uuid: child_plate_uuid, + plate_uuid: child_plate.uuid, tag_group_uuid: 'tag-group-uuid', tag2_group_uuid: 'tag2-group-uuid', direction: 'column', @@ -153,7 +161,7 @@ def expect_transfer_creation { user_uuid: user_uuid, source_uuid: plate_uuid, - destination_uuid: child_plate_uuid, + destination_uuid: child_plate.uuid, transfer_template_uuid: transfer_template_uuid, transfers: expected_transfers } @@ -198,15 +206,16 @@ def expect_transfer_creation let(:tag_plate_state) { 'available' } it 'creates a tag plate' do + expect_pooled_plate_creation expect_state_change_creation expect_tag_layout_creation expect_transfer_creation expect(subject.save).to be true - expect(plate_creation_request).to have_been_made.once end it 'has the correct child (and uuid)' do + stub_api_v2_post('PooledPlateCreation', pooled_plate_creation) stub_api_v2_post('TagLayout') stub_api_v2_post('Transfer') stub_api_v2_post('StateChange') @@ -214,17 +223,17 @@ def expect_transfer_creation expect(subject.save).to be true # This will be our new plate - expect(subject.child.uuid).to eq(child_plate_uuid) + expect(subject.child.uuid).to eq(child_plate.uuid) end context 'when a user has exhausted the plate in another tab' do it 'creates a tag plate' do + expect_pooled_plate_creation expect_state_change_creation expect_tag_layout_creation expect_transfer_creation expect(subject.save).to be true - expect(plate_creation_request).to have_been_made.once end end end @@ -236,21 +245,22 @@ def expect_transfer_creation # This one will be VERY different expect_tag_layout_creation + expect_pooled_plate_creation expect_transfer_creation expect(Sequencescape::Api::V2::StateChange).not_to receive(:create!) expect(subject.save).to be true - expect(plate_creation_request).to have_been_made.once end it 'has the correct child (and uuid)' do + stub_api_v2_post('PooledPlateCreation', pooled_plate_creation) stub_api_v2_post('TagLayout') stub_api_v2_post('Transfer') expect(subject.save).to be true # This will be our new plate - expect(subject.child.uuid).to eq(child_plate_uuid) + expect(subject.child.uuid).to eq(child_plate.uuid) end end @@ -260,20 +270,21 @@ def expect_transfer_creation let(:parents) { [plate_uuid] } it 'creates a tag plate' do + expect_pooled_plate_creation expect_tag_layout_creation expect_transfer_creation expect(Sequencescape::Api::V2::StateChange).not_to receive(:create!) expect(subject.save).to be true - expect(plate_creation_request).to have_been_made.once end it 'has the correct child (and uuid)' do + stub_api_v2_post('PooledPlateCreation', pooled_plate_creation) stub_api_v2_post('TagLayout') stub_api_v2_post('Transfer') expect(subject.save).to be true - expect(subject.child.uuid).to eq(child_plate_uuid) + expect(subject.child.uuid).to eq(child_plate.uuid) end end end diff --git a/spec/models/labware_creators/merged_plate_spec.rb b/spec/models/labware_creators/merged_plate_spec.rb index 987c79ff7..ee9c5ceea 100644 --- a/spec/models/labware_creators/merged_plate_spec.rb +++ b/spec/models/labware_creators/merged_plate_spec.rb @@ -54,15 +54,6 @@ creator_class: 'LabwareCreators::MergedPlate' end - let(:child_plate) do - create :v2_plate, - uuid: 'child-uuid', - barcode_number: '4', - size: plate_size, - outer_requests: requests, - purpose: child_purpose - end - let(:requests) do Array.new(plate_size) { |i| create :library_request, state: 'started', uuid: "request-#{i}", submission_id: 1 } end @@ -70,7 +61,6 @@ let(:user_uuid) { 'user-uuid' } before do - stub_v2_plate(child_plate, stub_search: false) stub_v2_plate(source_plate_1, stub_search: false) stub_v2_plate(source_plate_2, stub_search: false) end @@ -88,20 +78,8 @@ ) .and_return([source_plate_1, source_plate_2]) ) - end - let!(:plate_creation_request) do - stub_api_post( - 'pooled_plate_creations', - payload: { - pooled_plate_creation: { - user: user_uuid, - child_purpose: child_purpose_uuid, - parents: [source_plate_1.uuid, source_plate_2.uuid] - } - }, - body: json(:plate_creation, child_uuid: child_plate.uuid) - ) + stub_v2_plate(child_plate, stub_search: false) end let!(:transfer_creation_request) do @@ -117,10 +95,42 @@ ) end + let(:child_plate) do + create :v2_plate, + uuid: 'child-uuid', + barcode_number: '4', + size: plate_size, + outer_requests: requests, + purpose: child_purpose + end + + let(:pooled_plate_creation) do + response = double + allow(response).to receive(:child).and_return(child_plate) + + response + end + + def expect_pooled_plate_creation + expect_api_v2_posts( + 'PooledPlateCreation', + [ + { + child_purpose_uuid: child_purpose_uuid, + parent_uuids: [source_plate_1.uuid, source_plate_2.uuid], + user_uuid: user_uuid + } + ], + [pooled_plate_creation] + ) + end + it 'makes the expected requests' do + expect_pooled_plate_creation + expect(subject).to be_valid expect(subject.save!).to eq true - expect(plate_creation_request).to have_been_made + expect(transfer_creation_request).to have_been_made end end diff --git a/spec/models/labware_creators/multi_plate_pool_spec.rb b/spec/models/labware_creators/multi_plate_pool_spec.rb index adcca6f6e..45b578729 100644 --- a/spec/models/labware_creators/multi_plate_pool_spec.rb +++ b/spec/models/labware_creators/multi_plate_pool_spec.rb @@ -77,18 +77,15 @@ } end - let!(:pooled_plate_creation_request) do - stub_api_post( - 'pooled_plate_creations', - payload: { - pooled_plate_creation: { - user: user_uuid, - child_purpose: child_purpose_uuid, - parents: [plate_uuid, plate_b_uuid] - } - }, - body: json(:plate_creation, child_uuid: child_plate_uuid) - ) + let(:child_plate) do + create :v2_plate + end + + let(:pooled_plate_creation) do + response = double + allow(response).to receive(:child).and_return(child_plate) + + response end let!(:bulk_transfer_request) do @@ -101,38 +98,54 @@ { 'source_uuid' => plate_uuid, 'source_location' => 'A1', - 'destination_uuid' => child_plate_uuid, + 'destination_uuid' => child_plate.uuid, 'destination_location' => 'A1' }, { 'source_uuid' => plate_uuid, 'source_location' => 'B1', - 'destination_uuid' => child_plate_uuid, + 'destination_uuid' => child_plate.uuid, 'destination_location' => 'A1' }, { 'source_uuid' => plate_b_uuid, 'source_location' => 'A1', - 'destination_uuid' => child_plate_uuid, + 'destination_uuid' => child_plate.uuid, 'destination_location' => 'B1' }, { 'source_uuid' => plate_b_uuid, 'source_location' => 'B1', - 'destination_uuid' => child_plate_uuid, + 'destination_uuid' => child_plate.uuid, 'destination_location' => 'B1' } ] } }, - body: json(:plate_creation, child_uuid: child_plate_uuid) + body: json(:plate_creation, child_uuid: child_plate.uuid) + ) + end + + def expect_pooled_plate_creation + expect_api_v2_posts( + 'PooledPlateCreation', + [ + { + child_purpose_uuid: child_purpose_uuid, + parent_uuids: [plate_uuid, plate_b_uuid], + user_uuid: user_uuid + } + ], + [pooled_plate_creation] ) end context '#save!' do it 'creates a plate!' do + expect_pooled_plate_creation + subject.save! - expect(pooled_plate_creation_request).to have_been_made.once + expect(bulk_transfer_request).to have_been_made.once end end diff --git a/spec/models/labware_creators/multi_stamp_spec.rb b/spec/models/labware_creators/multi_stamp_spec.rb index b7126d1c5..769e43f26 100644 --- a/spec/models/labware_creators/multi_stamp_spec.rb +++ b/spec/models/labware_creators/multi_stamp_spec.rb @@ -41,21 +41,19 @@ stock_plate: stock_plate2 ) end - let(:child_plate_v2) { create :v2_plate, uuid: child_uuid, barcode_number: '5', size: 96 } - let(:child_plate_v1) { json :stock_plate_with_metadata, stock_plate: { barcode: '5', uuid: child_uuid } } + let(:child_plate) { create :v2_plate, barcode_number: '5', size: 96 } let(:child_purpose_uuid) { 'child-purpose' } let(:child_purpose_name) { 'Child Purpose' } let(:user_uuid) { 'user-uuid' } - let(:user) { json :v1_user, uuid: user_uuid } before do create :purpose_config, name: child_purpose_name, uuid: child_purpose_uuid stub_v2_plate(parent1, stub_search: false) stub_v2_plate(parent2, stub_search: false) - stub_v2_plate(child_plate_v2, stub_search: false, custom_query: [:plate_with_wells, child_plate_v2.uuid]) + stub_v2_plate(child_plate, stub_search: false, custom_query: [:plate_with_wells, child_plate.uuid]) end context 'on new' do @@ -484,7 +482,7 @@ parents: [parent1_uuid, parent2_uuid] } }, - body: json(:plate_creation, child_uuid: child_uuid) + body: json(:plate_creation, child_uuid: child_plate.uuid) ) end @@ -554,19 +552,39 @@ ) end + let(:pooled_plate_creation) do + response = double + allow(response).to receive(:child).and_return(child_plate) + + response + end + + def expect_pooled_plate_creation + expect_api_v2_posts( + 'PooledPlateCreation', + [ + { + child_purpose_uuid: child_purpose_uuid, + parent_uuids: [parent1_uuid, parent2_uuid], + user_uuid: user_uuid + } + ], + [pooled_plate_creation] + ) + end + context '#save!' do setup do - stub_api_get(child_plate_v2.uuid, body: child_plate_v1) - - stub_api_get('user-uuid', body: user) - stub_api_get('asset-uuid', body: child_plate_v1) + # stub_api_get('user-uuid', body: user) end it 'creates a plate!' do + expect_pooled_plate_creation + subject.save! - expect(pooled_plate_creation_request).to have_been_made.once + expect(transfer_creation_request).to have_been_made.once - expect(subject.child.uuid).to eq(child_uuid) + expect(subject.child.uuid).to eq(child_plate.uuid) expect(subject).to be_valid expect(subject.errors.messages).to be_empty end diff --git a/spec/models/labware_creators/multi_stamp_tubes_spec.rb b/spec/models/labware_creators/multi_stamp_tubes_spec.rb index 9cb244efa..ee41920db 100644 --- a/spec/models/labware_creators/multi_stamp_tubes_spec.rb +++ b/spec/models/labware_creators/multi_stamp_tubes_spec.rb @@ -32,13 +32,8 @@ receptacle: parent2_receptacle end - let(:child_uuid) { 'child-uuid' } let(:child_purpose_uuid) { 'child-purpose' } let(:child_purpose_name) { 'Child Purpose' } - let(:child_plate_v2) do - create :v2_plate_for_submission, uuid: child_uuid, purpose_name: child_purpose_name, barcode_number: '5', size: 96 - end - let(:child_plate_v1) { json :stock_plate_with_metadata, stock_plate: { barcode: '5', uuid: child_uuid } } let(:user_uuid) { 'user-uuid' } let(:user) { json :v1_user, uuid: user_uuid } @@ -51,7 +46,6 @@ Settings.submission_templates = { 'example' => example_template_uuid } stub_v2_tube(parent1, stub_search: false) stub_v2_tube(parent2, stub_search: false) - stub_v2_plate(child_plate_v2, stub_search: false, custom_includes: 'wells,wells.aliquots,wells.aliquots.study') end context 'on new' do @@ -86,20 +80,6 @@ } end - let!(:ms_plate_creation_request) do - stub_api_post( - 'pooled_plate_creations', - payload: { - pooled_plate_creation: { - user: user_uuid, - child_purpose: child_purpose_uuid, - parents: [parent1_tube_uuid, parent2_tube_uuid] - } - }, - body: json(:plate_creation, child_uuid: child_uuid) - ) - end - let(:transfer_requests) do [ { source_asset: 'tube1', target_asset: '5-well-A1', outer_request: 'outer-request-1' }, @@ -119,6 +99,32 @@ body: '{}' ) end + + let(:child_plate) do + create :v2_plate_for_submission, purpose_name: child_purpose_name, barcode_number: '5', size: 96 + end + + let(:pooled_plate_creation) do + response = double + allow(response).to receive(:child).and_return(child_plate) + + response + end + + def expect_pooled_plate_creation + expect_api_v2_posts( + 'PooledPlateCreation', + [ + { + child_purpose_uuid: child_purpose_uuid, + parent_uuids: [parent1_tube_uuid, parent2_tube_uuid], + user_uuid: user_uuid + } + ], + [pooled_plate_creation] + ) + end + context 'when the submission is created' do describe 'internal methods' do it 'determines the configuration for the submission' do @@ -185,31 +191,8 @@ context '#save!' do setup do - stub_api_get(child_plate_v2.uuid, body: child_plate_v1) - stub_api_get( - 'custom_metadatum_collection-uuid', - body: json(:v1_custom_metadatum_collection, uuid: 'custom_metadatum_collection-uuid') - ) - stub_api_get('user-uuid', body: user) - stub_api_get('asset-uuid', body: child_plate_v1) - expect(subject).to receive(:parent_tubes).and_return([parent1, parent2]) - metadata = attributes_for(:v1_custom_metadatum_collection).fetch(:metadata, {}) - - stub_api_put( - 'custom_metadatum_collection-uuid', - payload: { - custom_metadatum_collection: { - metadata: metadata - } - }, - body: json(:v1_custom_metadatum_collection) - ) - - expect('Sequencescape::Api::V2'.constantize).to receive(:plate_with_wells) - .with(child_uuid) - .and_return(child_plate_v2) expect(subject).to receive(:source_tube_outer_request_uuid).with(parent1).and_return('outer-request-1') expect(subject).to receive(:source_tube_outer_request_uuid).with(parent2).and_return('outer-request-2') end @@ -242,19 +225,6 @@ aliquots: [aliquot2] end - let(:child_aliquot1) { create :v2_aliquot, study_id: 1 } - let(:child_aliquot2) { create :v2_aliquot, study_id: 2 } - let(:child_well1) { create :v2_stock_well, location: 'A1', uuid: '5-well-A1', aliquots: [child_aliquot1] } - let(:child_well2) { create :v2_stock_well, location: 'B1', uuid: '5-well-B1', aliquots: [child_aliquot2] } - let(:child_plate_v2) do - create :v2_plate_for_submission, - uuid: child_uuid, - purpose_name: child_purpose_name, - barcode_number: '5', - size: 96, - wells: [child_well1, child_well2] - end - let!(:order_request) do stub_api_get(example_template_uuid, body: json(:submission_template, uuid: example_template_uuid)) stub_api_post( @@ -291,8 +261,10 @@ end it 'creates a plate!' do + expect_pooled_plate_creation + subject.save! - expect(ms_plate_creation_request).to have_been_made.once + expect(transfer_creation_request).to have_been_made.once expect(order_request).to have_been_made.once expect(submission_request).to have_been_made.once diff --git a/spec/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan_spec.rb b/spec/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan_spec.rb index e0d46906c..0c55fb686 100644 --- a/spec/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan_spec.rb +++ b/spec/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan_spec.rb @@ -84,30 +84,10 @@ [:purpose, 'receptacle.aliquots.request.request_type', 'receptacle.requests_as_source.request_type'] end - # child aliquots - let(:child_aliquot1) { create :v2_aliquot } - let(:child_aliquot2) { create :v2_aliquot } - - # child wells - let(:child_well1) { create :v2_well, location: 'A1', uuid: '5-well-A1', aliquots: [child_aliquot1] } - let(:child_well2) { create :v2_well, location: 'B1', uuid: '5-well-B1', aliquots: [child_aliquot2] } - # child plate - let(:child_plate_uuid) { 'child-uuid' } let(:child_plate_purpose_uuid) { 'child-purpose' } let(:child_plate_purpose_name) { 'Child Purpose' } - let(:child_plate_v2) do - create :v2_plate, - uuid: child_plate_uuid, - purpose_name: child_plate_purpose_name, - barcode_number: '5', - size: 96, - wells: [child_well1, child_well2] - end - - let(:child_plate_v2) do - create :v2_plate, uuid: child_plate_uuid, purpose_name: child_plate_purpose_name, barcode_number: '5', size: 96 - end + let(:child_plate) { create :v2_plate, purpose_name: child_plate_purpose_name, barcode_number: '5', size: 96 } let(:user_uuid) { 'user-uuid' } let(:user) { json :v1_user, uuid: user_uuid } @@ -132,7 +112,7 @@ end let(:stub_upload_file_creation) do - stub_request(:post, api_url_for(child_plate_uuid, 'qc_files')) + stub_request(:post, api_url_for(child_plate.uuid, 'qc_files')) .with( body: file_content, headers: { @@ -151,7 +131,7 @@ let(:child_plate_v1) do # qc_files are created through the API V1. The actions attribute for qcfiles is required by the API V1. - json :plate, uuid: child_plate_uuid, purpose_uuid: child_plate_purpose_uuid, qc_files_actions: %w[read create] + json :plate, uuid: child_plate.uuid, purpose_uuid: child_plate_purpose_uuid, qc_files_actions: %w[read create] end before do @@ -162,9 +142,7 @@ .with(barcode: 'AB10000002', includes: tube_includes) .and_return(parent_tube_2) - stub_v2_plate(child_plate_v2, stub_search: false, custom_query: [:plate_with_wells, child_plate_v2.uuid]) - - stub_api_get(child_plate_uuid, body: child_plate_v1) + stub_api_get(child_plate.uuid, body: child_plate_v1) stub_upload_file_creation @@ -194,20 +172,6 @@ { user_uuid: user_uuid, purpose_uuid: child_plate_purpose_uuid, parent_uuid: parent_tube_1_uuid, file: file } end - let!(:ms_plate_creation_request) do - stub_api_post( - 'pooled_plate_creations', - payload: { - pooled_plate_creation: { - user: user_uuid, - child_purpose: child_plate_purpose_uuid, - parents: [parent_tube_1_uuid, parent_tube_2_uuid] - } - }, - body: json(:plate_creation, child_plate_uuid: child_plate_uuid) - ) - end - let(:transfer_requests) do [ { source_asset: 'tube-1-uuid', target_asset: '5-well-A1', outer_request: 'request-1' }, @@ -228,6 +192,27 @@ ) end + let(:pooled_plate_creation) do + response = double + allow(response).to receive(:child).and_return(child_plate) + + response + end + + def expect_pooled_plate_creation + expect_api_v2_posts( + 'PooledPlateCreation', + [ + { + child_purpose_uuid: child_plate_purpose_uuid, + parent_uuids: [parent_tube_1_uuid, parent_tube_2_uuid], + user_uuid: user_uuid + } + ], + [pooled_plate_creation] + ) + end + subject { LabwareCreators::MultiStampTubesUsingTubeRackScan.new(api, form_attributes) } it 'creates a plate!' do @@ -235,10 +220,11 @@ subject.labware.barcode.machine = 'AB10000001' subject.labware.barcode.ean13 = nil + expect_pooled_plate_creation + subject.save - expect(subject.errors.full_messages).to be_empty - expect(ms_plate_creation_request).to have_been_made.once + expect(subject.errors.full_messages).to be_empty expect(transfer_creation_request).to have_been_made.once end end diff --git a/spec/models/labware_creators/quadrant_stamp_primer_panel_spec.rb b/spec/models/labware_creators/quadrant_stamp_primer_panel_spec.rb index 3e56ef4dc..a1bb21918 100644 --- a/spec/models/labware_creators/quadrant_stamp_primer_panel_spec.rb +++ b/spec/models/labware_creators/quadrant_stamp_primer_panel_spec.rb @@ -13,7 +13,6 @@ let(:parent1_uuid) { 'example-plate-uuid' } let(:parent2_uuid) { 'example-plate2-uuid' } - let(:child_uuid) { 'child-uuid' } let(:requests) { Array.new(96) { |i| create :gbs_library_request, state: 'started', uuid: "request-#{i}" } } let(:requests2) { Array.new(96) { |i| create :gbs_library_request, state: 'started', uuid: "request-#{i}" } } let(:stock_plate1) { create :v2_stock_plate_for_plate, barcode_number: '1' } @@ -40,20 +39,18 @@ stock_plate: stock_plate2 ) end - let(:child_plate_v2) { create :v2_plate, uuid: child_uuid, barcode_number: '5', size: 384 } - let(:child_plate_v1) { json :stock_plate_with_metadata, stock_plate: { barcode: '5', uuid: child_uuid } } + let(:child_plate) { create :v2_plate, barcode_number: '5', size: 384 } let(:child_purpose_uuid) { 'child-purpose' } let(:child_purpose_name) { 'Child Purpose' } - let(:user_uuid) { 'user-uuid' } - let(:v1_user) { json :v1_user, uuid: user_uuid } - let(:user) { create :user, uuid: user_uuid } + let(:user) { create :user } before do create :purpose_config, name: child_purpose_name + stub_v2_user(user) stub_v2_plate(parent1, stub_search: false) stub_v2_plate(parent2, stub_search: false) - stub_v2_plate(child_plate_v2, stub_search: false, custom_query: [:plate_with_wells, child_plate_v2.uuid]) + stub_v2_plate(child_plate, stub_search: false, custom_query: [:plate_with_wells, child_plate.uuid]) end context 'on new' do @@ -75,7 +72,7 @@ end context 'on create' do - subject { LabwareCreators::QuadrantStampPrimerPanel.new(api, form_attributes.merge(user_uuid: user_uuid)) } + subject { LabwareCreators::QuadrantStampPrimerPanel.new(api, form_attributes.merge(user_uuid: user.uuid)) } let(:form_attributes) do { @@ -246,20 +243,6 @@ } end - let!(:pooled_plate_creation_request) do - stub_api_post( - 'pooled_plate_creations', - payload: { - pooled_plate_creation: { - user: user_uuid, - child_purpose: child_purpose_uuid, - parents: [parent1_uuid, parent2_uuid] - } - }, - body: json(:plate_creation, child_uuid: child_uuid) - ) - end - let(:transfer_requests) do [ { source_asset: '3-well-A1', outer_request: 'request-0', target_asset: '5-well-A1' }, @@ -290,7 +273,7 @@ 'transfer_request_collections', payload: { transfer_request_collection: { - user: user_uuid, + user: user.uuid, transfer_requests: transfer_requests } }, @@ -298,36 +281,47 @@ ) end - context '#save!' do - setup do - stub_api_get(child_plate_v2.uuid, body: child_plate_v1) - stub_api_get( - 'custom_metadatum_collection-uuid', - body: json(:v1_custom_metadatum_collection, uuid: 'custom_metadatum_collection-uuid') - ) - stub_api_get('user-uuid', body: v1_user) - stub_v2_user(user) - stub_api_get('asset-uuid', body: child_plate_v1) + let(:pooled_plate_creation) do + response = double + allow(response).to receive(:child).and_return(child_plate) - metadata = - attributes_for(:v1_custom_metadatum_collection) - .fetch(:metadata, {}) - .merge(stock_barcode_q0: stock_plate1.barcode.human, stock_barcode_q1: stock_plate2.barcode.human) + response + end - stub_api_put( - 'custom_metadatum_collection-uuid', - payload: { - custom_metadatum_collection: { - metadata: metadata - } - }, - body: json(:v1_custom_metadatum_collection) - ) - end + def expect_pooled_plate_creation + expect_api_v2_posts( + 'PooledPlateCreation', + [ + { + child_purpose_uuid: child_purpose_uuid, + parent_uuids: [parent1_uuid, parent2_uuid], + user_uuid: user.uuid + } + ], + [pooled_plate_creation] + ) + end + + def expect_custom_metadatum_collection_creation + expect_api_v2_posts( + 'CustomMetadatumCollection', + [ + { + asset_id: child_plate.id, + metadata: { stock_barcode_q0: stock_plate1.barcode.human, stock_barcode_q1: stock_plate2.barcode.human }, + user_id: user.id + } + ] + ) + end + context '#save!' do it 'creates a plate!' do + expect_pooled_plate_creation + expect_custom_metadatum_collection_creation + subject.save! - expect(pooled_plate_creation_request).to have_been_made.once + expect(transfer_creation_request).to have_been_made.once end end From 27d76f150813cd9809f6d1a6bd2d86fb3e68252c Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Fri, 20 Sep 2024 12:31:35 +0100 Subject: [PATCH 25/43] Apply Prettier --- .../labware_creators/custom_tagged_plate.rb | 12 +++++------- app/models/labware_creators/multi_plate_pool.rb | 3 +-- app/models/labware_creators/multi_stamp.rb | 3 +-- app/models/labware_creators/multi_stamp_tubes.rb | 8 ++------ .../multi_stamp_tubes_using_tube_rack_scan.rb | 8 ++------ spec/features/pooling_multiple_plates_spec.rb | 15 ++------------- .../labware_creators/custom_tagged_plate_spec.rb | 8 +------- .../labware_creators/multi_plate_pool_spec.rb | 12 ++---------- spec/models/labware_creators/multi_stamp_spec.rb | 8 +------- .../quadrant_stamp_primer_panel_spec.rb | 13 +++++-------- 10 files changed, 22 insertions(+), 68 deletions(-) diff --git a/app/models/labware_creators/custom_tagged_plate.rb b/app/models/labware_creators/custom_tagged_plate.rb index f08960bda..f804054e2 100644 --- a/app/models/labware_creators/custom_tagged_plate.rb +++ b/app/models/labware_creators/custom_tagged_plate.rb @@ -47,13 +47,11 @@ def initialize(*args, &block) def create_plate! # rubocop:todo Metrics/AbcSize @child = - Sequencescape::Api::V2::PooledPlateCreation - .create!( - child_purpose_uuid: purpose_uuid, - parent_uuids: [parent_uuid, tag_plate.asset_uuid].compact_blank, - user_uuid: user_uuid - ) - .child + Sequencescape::Api::V2::PooledPlateCreation.create!( + child_purpose_uuid: purpose_uuid, + parent_uuids: [parent_uuid, tag_plate.asset_uuid].compact_blank, + user_uuid: user_uuid + ).child transfer_material_from_parent!(@child.uuid) diff --git a/app/models/labware_creators/multi_plate_pool.rb b/app/models/labware_creators/multi_plate_pool.rb index b6307285a..597447a01 100644 --- a/app/models/labware_creators/multi_plate_pool.rb +++ b/app/models/labware_creators/multi_plate_pool.rb @@ -22,8 +22,7 @@ def create_labware! child_purpose_uuid: purpose_uuid, parent_uuids: transfers.keys, user_uuid: user_uuid - ) - .child + ).child api.bulk_transfer.create!(user: user_uuid, well_transfers: well_transfers) diff --git a/app/models/labware_creators/multi_stamp.rb b/app/models/labware_creators/multi_stamp.rb index 88b93623a..04d09ccbc 100644 --- a/app/models/labware_creators/multi_stamp.rb +++ b/app/models/labware_creators/multi_stamp.rb @@ -35,8 +35,7 @@ def create_labware! child_purpose_uuid: purpose_uuid, parent_uuids: parent_uuids, user_uuid: user_uuid - ) - .child + ).child transfer_material_from_parent!(@child.uuid) diff --git a/app/models/labware_creators/multi_stamp_tubes.rb b/app/models/labware_creators/multi_stamp_tubes.rb index 53f6a346a..c596f399a 100644 --- a/app/models/labware_creators/multi_stamp_tubes.rb +++ b/app/models/labware_creators/multi_stamp_tubes.rb @@ -46,8 +46,7 @@ def create_labware! child_purpose_uuid: purpose_uuid, parent_uuids: parent_uuids, user_uuid: user_uuid - ) - .child + ).child transfer_material_from_parent! @@ -90,10 +89,7 @@ def parent_tubes end def transfer_material_from_parent! - api.transfer_request_collection.create!( - user: user_uuid, - transfer_requests: transfer_request_attributes - ) + api.transfer_request_collection.create!(user: user_uuid, transfer_requests: transfer_request_attributes) end def transfer_request_attributes diff --git a/app/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan.rb b/app/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan.rb index efde77128..73348fd06 100644 --- a/app/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan.rb +++ b/app/models/labware_creators/multi_stamp_tubes_using_tube_rack_scan.rb @@ -70,8 +70,7 @@ def create_labware! child_purpose_uuid: purpose_uuid, parent_uuids: parent_tube_uuids, user_uuid: user_uuid - ) - .child + ).child transfer_material_from_parent! @@ -235,10 +234,7 @@ def tube_has_expected_active_request?(tube_in_db) # Transfers material from the parent tubes to the given child plate. def transfer_material_from_parent! - api.transfer_request_collection.create!( - user: user_uuid, - transfer_requests: transfer_request_attributes - ) + api.transfer_request_collection.create!(user: user_uuid, transfer_requests: transfer_request_attributes) end # Returns an array of hashes representing the transfer requests for the given child plate. diff --git a/spec/features/pooling_multiple_plates_spec.rb b/spec/features/pooling_multiple_plates_spec.rb index cc8a2f9d7..41a3cee7b 100644 --- a/spec/features/pooling_multiple_plates_spec.rb +++ b/spec/features/pooling_multiple_plates_spec.rb @@ -66,12 +66,7 @@ ) end - let(:child_plate) do - create :v2_plate, - purpose_uuid: 'child-purpose-0', - purpose_name: 'Pool Plate', - barcode_number: 3 - end + let(:child_plate) { create :v2_plate, purpose_uuid: 'child-purpose-0', purpose_name: 'Pool Plate', barcode_number: 3 } let(:pooled_plate_creation) do response = double @@ -83,13 +78,7 @@ def expect_pooled_plate_creation expect_api_v2_posts( 'PooledPlateCreation', - [ - { - child_purpose_uuid: 'child-purpose-0', - parent_uuids: [plate_uuid, plate_uuid_2], - user_uuid: user_uuid - } - ], + [{ child_purpose_uuid: 'child-purpose-0', parent_uuids: [plate_uuid, plate_uuid_2], user_uuid: user_uuid }], [pooled_plate_creation] ) end diff --git a/spec/models/labware_creators/custom_tagged_plate_spec.rb b/spec/models/labware_creators/custom_tagged_plate_spec.rb index 0dd4f7381..695a2bd52 100644 --- a/spec/models/labware_creators/custom_tagged_plate_spec.rb +++ b/spec/models/labware_creators/custom_tagged_plate_spec.rb @@ -111,13 +111,7 @@ def expect_pooled_plate_creation expect_api_v2_posts( 'PooledPlateCreation', - [ - { - child_purpose_uuid: child_purpose_uuid, - parent_uuids: parents, - user_uuid: user_uuid - } - ], + [{ child_purpose_uuid: child_purpose_uuid, parent_uuids: parents, user_uuid: user_uuid }], [pooled_plate_creation] ) end diff --git a/spec/models/labware_creators/multi_plate_pool_spec.rb b/spec/models/labware_creators/multi_plate_pool_spec.rb index 45b578729..db21e59fd 100644 --- a/spec/models/labware_creators/multi_plate_pool_spec.rb +++ b/spec/models/labware_creators/multi_plate_pool_spec.rb @@ -77,9 +77,7 @@ } end - let(:child_plate) do - create :v2_plate - end + let(:child_plate) { create :v2_plate } let(:pooled_plate_creation) do response = double @@ -129,13 +127,7 @@ def expect_pooled_plate_creation expect_api_v2_posts( 'PooledPlateCreation', - [ - { - child_purpose_uuid: child_purpose_uuid, - parent_uuids: [plate_uuid, plate_b_uuid], - user_uuid: user_uuid - } - ], + [{ child_purpose_uuid: child_purpose_uuid, parent_uuids: [plate_uuid, plate_b_uuid], user_uuid: user_uuid }], [pooled_plate_creation] ) end diff --git a/spec/models/labware_creators/multi_stamp_spec.rb b/spec/models/labware_creators/multi_stamp_spec.rb index 769e43f26..d96580b67 100644 --- a/spec/models/labware_creators/multi_stamp_spec.rb +++ b/spec/models/labware_creators/multi_stamp_spec.rb @@ -562,13 +562,7 @@ def expect_pooled_plate_creation expect_api_v2_posts( 'PooledPlateCreation', - [ - { - child_purpose_uuid: child_purpose_uuid, - parent_uuids: [parent1_uuid, parent2_uuid], - user_uuid: user_uuid - } - ], + [{ child_purpose_uuid: child_purpose_uuid, parent_uuids: [parent1_uuid, parent2_uuid], user_uuid: user_uuid }], [pooled_plate_creation] ) end diff --git a/spec/models/labware_creators/quadrant_stamp_primer_panel_spec.rb b/spec/models/labware_creators/quadrant_stamp_primer_panel_spec.rb index a1bb21918..488f372c8 100644 --- a/spec/models/labware_creators/quadrant_stamp_primer_panel_spec.rb +++ b/spec/models/labware_creators/quadrant_stamp_primer_panel_spec.rb @@ -291,13 +291,7 @@ def expect_pooled_plate_creation expect_api_v2_posts( 'PooledPlateCreation', - [ - { - child_purpose_uuid: child_purpose_uuid, - parent_uuids: [parent1_uuid, parent2_uuid], - user_uuid: user.uuid - } - ], + [{ child_purpose_uuid: child_purpose_uuid, parent_uuids: [parent1_uuid, parent2_uuid], user_uuid: user.uuid }], [pooled_plate_creation] ) end @@ -308,7 +302,10 @@ def expect_custom_metadatum_collection_creation [ { asset_id: child_plate.id, - metadata: { stock_barcode_q0: stock_plate1.barcode.human, stock_barcode_q1: stock_plate2.barcode.human }, + metadata: { + stock_barcode_q0: stock_plate1.barcode.human, + stock_barcode_q1: stock_plate2.barcode.human + }, user_id: user.id } ] From 263d4946af98bec3b53897b1abe7e125a94a7301 Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Mon, 23 Sep 2024 12:19:00 +0100 Subject: [PATCH 26/43] Use provided UUID for child plate purpose --- spec/features/pooling_multiple_plates_spec.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/spec/features/pooling_multiple_plates_spec.rb b/spec/features/pooling_multiple_plates_spec.rb index 41a3cee7b..e86f00458 100644 --- a/spec/features/pooling_multiple_plates_spec.rb +++ b/spec/features/pooling_multiple_plates_spec.rb @@ -66,7 +66,7 @@ ) end - let(:child_plate) { create :v2_plate, purpose_uuid: 'child-purpose-0', purpose_name: 'Pool Plate', barcode_number: 3 } + let(:child_plate) { create :v2_plate, purpose_name: 'Pool Plate', barcode_number: 3 } let(:pooled_plate_creation) do response = double @@ -78,7 +78,9 @@ def expect_pooled_plate_creation expect_api_v2_posts( 'PooledPlateCreation', - [{ child_purpose_uuid: 'child-purpose-0', parent_uuids: [plate_uuid, plate_uuid_2], user_uuid: user_uuid }], + [ + { child_purpose_uuid: child_plate.purpose.uuid, parent_uuids: [plate_uuid, plate_uuid_2], user_uuid: user_uuid } + ], [pooled_plate_creation] ) end @@ -88,7 +90,7 @@ def expect_pooled_plate_creation create :purpose_config, creator_class: 'LabwareCreators::MultiPlatePool', name: 'Pool Plate', - uuid: 'child-purpose-0' + uuid: child_plate.purpose.uuid create :pipeline, relationships: { 'Pooled example' => 'Pool Plate' } # We look up the user From 60a6e75f0e25361b9e50e1a35318f98e25d191e7 Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Mon, 23 Sep 2024 17:16:22 +0100 Subject: [PATCH 27/43] Use correct attributes on specific_tube_creations endpoint --- .../labware_creators/pooled_tubes_by_submission_with_phi_x.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/labware_creators/pooled_tubes_by_submission_with_phi_x.rb b/app/models/labware_creators/pooled_tubes_by_submission_with_phi_x.rb index 50d7a916d..cef106449 100644 --- a/app/models/labware_creators/pooled_tubes_by_submission_with_phi_x.rb +++ b/app/models/labware_creators/pooled_tubes_by_submission_with_phi_x.rb @@ -17,7 +17,7 @@ class PooledTubesBySubmissionWithPhiX < PooledTubesBySubmission def create_child_stock_tubes Sequencescape::Api::V2::SpecificTubeCreation .create!( - child_purposes: [purpose_uuid] * pool_uuids.length, + child_purpose_uuids: [purpose_uuid] * pool_uuids.length, parent_uuids: parents, tube_attributes: tube_attributes, user_uuid: user_uuid From 52db8e18666b34602d723add534750f98783698f Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Mon, 23 Sep 2024 17:16:41 +0100 Subject: [PATCH 28/43] Remove unneeded API v1 stub for specific_tube_creations --- .../plate_split_to_tube_racks_spec.rb | 45 ------------------- 1 file changed, 45 deletions(-) diff --git a/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb b/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb index 697beec5b..c11589021 100644 --- a/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb +++ b/spec/models/labware_creators/plate_split_to_tube_racks_spec.rb @@ -663,51 +663,6 @@ def expect_custom_metadatum_collection_posts(tubes_hash) } end - # stub the contingency tube creation - let!(:stub_contingency_tube_creation_request_uuid) { SecureRandom.uuid } - let!(:stub_contingency_tube_creation_request) do - stub_api_post( - 'specific_tube_creations', - payload: { - specific_tube_creation: { - child_purposes: [ - child_contingency_tube_purpose_uuid, - child_contingency_tube_purpose_uuid, - child_contingency_tube_purpose_uuid - ], - tube_attributes: [ - # sample 1 from well A2 to contingency tube 1 in A1 - { name: 'SPR:NT1O:A1', foreign_barcode: 'FX00000011' }, - # sample 2 from well B2 to contingency tube 2 in B1 - { name: 'SPR:NT2P:B1', foreign_barcode: 'FX00000012' }, - # sample 1 from well A3 to contingency tube 3 in C1 - { name: 'SPR:NT1O:C1', foreign_barcode: 'FX00000013' } - ], - user: user_uuid, - parent: parent_uuid - } - }, - body: json(:specific_tube_creation, uuid: stub_contingency_tube_creation_request_uuid, children_count: 3) - ) - end - - # stub what contingency tubes were just made - let!(:stub_contingency_tube_creation_children_request) do - stub_api_get( - stub_contingency_tube_creation_request_uuid, - 'children', - body: - json( - :tube_collection_with_barcodes_specified, - size: 3, - names: %w[SPR:NT1O:A1 SPR:NT2P:B1 SPR:NT1O:C1], - barcode_prefix: 'FX', - barcode_numbers: [11, 12, 13], - uuid_index_offset: 2 - ) - ) - end - # body for stubbing the contingency file upload let(:contingency_file_content) do content = contingency_file.read From 59a5963a077b22bdd7e1597ed7504e8cf41d54ad Mon Sep 17 00:00:00 2001 From: "depfu[bot]" <23717796+depfu[bot]@users.noreply.github.com> Date: Mon, 23 Sep 2024 19:11:05 +0000 Subject: [PATCH 29/43] Update vite_ruby to version 3.8.2 --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 054373965..10f7b099d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -394,7 +394,7 @@ GEM vite_rails (3.0.17) railties (>= 5.1, < 8) vite_ruby (~> 3.0, >= 3.2.2) - vite_ruby (3.6.0) + vite_ruby (3.8.2) dry-cli (>= 0.7, < 2) rack-proxy (~> 0.6, >= 0.6.1) zeitwerk (~> 2.2) @@ -415,7 +415,7 @@ GEM xpath (3.2.0) nokogiri (~> 1.8) yard (0.9.36) - zeitwerk (2.6.17) + zeitwerk (2.6.18) PLATFORMS ruby From 53b8defb70408d5894c20ddb96161882a29f12c5 Mon Sep 17 00:00:00 2001 From: Dasun Pubudumal Date: Thu, 10 Oct 2024 15:45:48 +0100 Subject: [PATCH 30/43] Adding Norm plate after LBB Lib PCR-XP --- config/pipelines/bespoke_pcr.yml | 1 + config/purposes/bespoke.yml | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/config/pipelines/bespoke_pcr.yml b/config/pipelines/bespoke_pcr.yml index 20668475f..759e57fa5 100644 --- a/config/pipelines/bespoke_pcr.yml +++ b/config/pipelines/bespoke_pcr.yml @@ -38,6 +38,7 @@ Bespoke PCR: LBB Cherrypick: LBB Ligation LBC Cherrypick: LBB Ligation LBB Ligation: LBB Lib PCR-XP + LBB Lib PCR-XP: LBB Lib PCR-XP Norm Bespoke PCR BCR: filters: request_type_key: limber_pcr_bespoke diff --git a/config/purposes/bespoke.yml b/config/purposes/bespoke.yml index 5a4411904..efede8e7f 100644 --- a/config/purposes/bespoke.yml +++ b/config/purposes/bespoke.yml @@ -13,6 +13,10 @@ LBB Lib PCR-XP: :asset_type: plate :presenter_class: Presenters::PcrPresenter :creator_class: LabwareCreators::CustomTaggedPlate +LBB Lib PCR-XP Norm: + :asset_type: plate + :presenter_class: Presenters::PcrPresenter + :creator_class: LabwareCreators::CustomTaggedPlate LBB Ligation Tagged: :asset_type: plate :presenter_class: Presenters::PcrPresenter From 2f61348819bf64f23935cd568b12e3d06e350709 Mon Sep 17 00:00:00 2001 From: Dasun Pubudumal Date: Thu, 10 Oct 2024 16:17:37 +0100 Subject: [PATCH 31/43] Adding relationships for the norm plate --- config/pipelines/bespoke_pcr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/pipelines/bespoke_pcr.yml b/config/pipelines/bespoke_pcr.yml index 759e57fa5..f6e31a07f 100644 --- a/config/pipelines/bespoke_pcr.yml +++ b/config/pipelines/bespoke_pcr.yml @@ -38,7 +38,6 @@ Bespoke PCR: LBB Cherrypick: LBB Ligation LBC Cherrypick: LBB Ligation LBB Ligation: LBB Lib PCR-XP - LBB Lib PCR-XP: LBB Lib PCR-XP Norm Bespoke PCR BCR: filters: request_type_key: limber_pcr_bespoke @@ -89,5 +88,6 @@ Bespoke PCR MX: request_type_key: - limber_multiplexing relationships: - LBB Lib PCR-XP: LBB Lib Pool Stock + LBB Lib PCR-XP: LBB Lib PCR-XP Norm + LBB Lib PCR-XP Norm: LBB Lib Pool Stock LBB Lib Pool Stock: LB Lib Pool Norm From 911ca56c70419af809a6f692a5358c2d26de89f9 Mon Sep 17 00:00:00 2001 From: Dasun Pubudumal Date: Mon, 14 Oct 2024 10:18:17 +0100 Subject: [PATCH 32/43] Refactor bespoke.yml to remove unused presenter and creator classes --- config/purposes/bespoke.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/config/purposes/bespoke.yml b/config/purposes/bespoke.yml index efede8e7f..ce928c7e9 100644 --- a/config/purposes/bespoke.yml +++ b/config/purposes/bespoke.yml @@ -15,8 +15,6 @@ LBB Lib PCR-XP: :creator_class: LabwareCreators::CustomTaggedPlate LBB Lib PCR-XP Norm: :asset_type: plate - :presenter_class: Presenters::PcrPresenter - :creator_class: LabwareCreators::CustomTaggedPlate LBB Ligation Tagged: :asset_type: plate :presenter_class: Presenters::PcrPresenter From 735078a7f522c20cb90439461161fc94f13e4c71 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Mon, 14 Oct 2024 12:00:06 +0100 Subject: [PATCH 33/43] fix: correctly label Submission state --- app/helpers/page_helper.rb | 4 ++-- app/views/application/_submission_item.html.erb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/helpers/page_helper.rb b/app/helpers/page_helper.rb index 49f774667..11e5ba153 100644 --- a/app/helpers/page_helper.rb +++ b/app/helpers/page_helper.rb @@ -52,8 +52,8 @@ def jumbotron(jumbotron_id = nil, options = {}, &) # eg. state_badge('pending') # Pending - def state_badge(state) - tag.span(state.titleize, class: "state-badge #{state}", title: 'Labware State', data: { toggle: 'tooltip' }) + def state_badge(state, title: 'Labware State') + tag.span(state.titleize, class: "state-badge #{state}", title: title, data: { toggle: 'tooltip' }) end # eg. count_badge(0) diff --git a/app/views/application/_submission_item.html.erb b/app/views/application/_submission_item.html.erb index b6145c676..f09a8da9b 100644 --- a/app/views/application/_submission_item.html.erb +++ b/app/views/application/_submission_item.html.erb @@ -1,3 +1,3 @@
  • - <%= state_badge(submission_item.state) %> <%= submission_item.name %> + <%= state_badge(submission_item.state, title: 'Submission State') %> <%= submission_item.name %>
  • From 6e7b21160cd8e21eec3ab9f44b30ec633c3db0b9 Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Mon, 14 Oct 2024 16:02:51 +0100 Subject: [PATCH 34/43] Remove unwanted hash value references --- app/models/labware_creators/custom_tagged_plate.rb | 2 +- spec/features/creating_plate_with_bait_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/labware_creators/custom_tagged_plate.rb b/app/models/labware_creators/custom_tagged_plate.rb index 3b631e2a1..97509a064 100644 --- a/app/models/labware_creators/custom_tagged_plate.rb +++ b/app/models/labware_creators/custom_tagged_plate.rb @@ -105,7 +105,7 @@ def tag_layout_attributes def create_labware! create_plate! do |plate_uuid| Sequencescape::Api::V2::TagLayout.create!( - tag_layout_attributes.merge(plate_uuid: plate_uuid, user_uuid: user_uuid) + tag_layout_attributes.merge(plate_uuid:, user_uuid:) ) end end diff --git a/spec/features/creating_plate_with_bait_spec.rb b/spec/features/creating_plate_with_bait_spec.rb index 9186a7f24..2c5c015e3 100644 --- a/spec/features/creating_plate_with_bait_spec.rb +++ b/spec/features/creating_plate_with_bait_spec.rb @@ -48,7 +48,7 @@ # These stubs are required to render plate_creation baiting page expect_api_v2_posts( 'BaitLibraryLayout', - [{ plate_uuid: plate_uuid, user_uuid: user_uuid }], + [{ plate_uuid:, user_uuid: }], [[bait_library_layout]], method: :preview ) From 9157bfefac93666f5bffd23708c3159154f9d2ad Mon Sep 17 00:00:00 2001 From: Stuart McHattie Date: Mon, 14 Oct 2024 16:04:48 +0100 Subject: [PATCH 35/43] Apply Prettier --- app/models/labware_creators/custom_tagged_plate.rb | 4 +--- spec/features/creating_plate_with_bait_spec.rb | 7 +------ 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/app/models/labware_creators/custom_tagged_plate.rb b/app/models/labware_creators/custom_tagged_plate.rb index 97509a064..d7d161c94 100644 --- a/app/models/labware_creators/custom_tagged_plate.rb +++ b/app/models/labware_creators/custom_tagged_plate.rb @@ -104,9 +104,7 @@ def tag_layout_attributes def create_labware! create_plate! do |plate_uuid| - Sequencescape::Api::V2::TagLayout.create!( - tag_layout_attributes.merge(plate_uuid:, user_uuid:) - ) + Sequencescape::Api::V2::TagLayout.create!(tag_layout_attributes.merge(plate_uuid:, user_uuid:)) end end end diff --git a/spec/features/creating_plate_with_bait_spec.rb b/spec/features/creating_plate_with_bait_spec.rb index 2c5c015e3..99aa56faa 100644 --- a/spec/features/creating_plate_with_bait_spec.rb +++ b/spec/features/creating_plate_with_bait_spec.rb @@ -46,12 +46,7 @@ # end of stubs for plate show page # These stubs are required to render plate_creation baiting page - expect_api_v2_posts( - 'BaitLibraryLayout', - [{ plate_uuid:, user_uuid: }], - [[bait_library_layout]], - method: :preview - ) + expect_api_v2_posts('BaitLibraryLayout', [{ plate_uuid:, user_uuid: }], [[bait_library_layout]], method: :preview) # end of stubs for plate_creation baiting page From e6b73ec2c44189080e99c96b2b2056a6ee111ef2 Mon Sep 17 00:00:00 2001 From: "depfu[bot]" <23717796+depfu[bot]@users.noreply.github.com> Date: Wed, 16 Oct 2024 13:25:07 +0000 Subject: [PATCH 36/43] Update cytoscape to version 3.30.2 --- package.json | 2 +- yarn.lock | 28 ++++++---------------------- 2 files changed, 7 insertions(+), 23 deletions(-) diff --git a/package.json b/package.json index 2201fdcf9..05b92f737 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "dependencies": { "axios": "^0.28.1", "bootstrap-vue": "^2.23.1", - "cytoscape": "^3.30.0", + "cytoscape": "^3.30.2", "cytoscape-elk": "^2.2.0", "cytoscape-popper": "^2.0.0", "devour-client": "^2.1.2", diff --git a/yarn.lock b/yarn.lock index 9e8731f84..6d7b2b09c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1230,10 +1230,10 @@ cytoscape-popper@^2.0.0: dependencies: "@popperjs/core" "^2.0.0" -cytoscape@^3.30.0: - version "3.30.0" - resolved "https://registry.yarnpkg.com/cytoscape/-/cytoscape-3.30.0.tgz#5b0c13f7bb305481e2c70414d4c5f149d92eda82" - integrity sha512-l590mjTHT6/Cbxp13dGPC2Y7VXdgc+rUeF8AnF/JPzhjNevbDJfObnJgaSjlldOgBQZbue+X6IUZ7r5GAgvauQ== +cytoscape@^3.30.2: + version "3.30.2" + resolved "https://registry.yarnpkg.com/cytoscape/-/cytoscape-3.30.2.tgz#94149707fb6547a55e3b44f03ffe232706212161" + integrity sha512-oICxQsjW8uSaRmn4UK/jkczKOqTrVqt5/1WL0POiJUT2EKNc9STM4hYFHv917yu55aTBMFNRzymlJhVAiWPCxw== data-urls@^5.0.0: version "5.0.0" @@ -3058,16 +3058,7 @@ std-env@^3.7.0: resolved "https://registry.yarnpkg.com/std-env/-/std-env-3.7.0.tgz#c9f7386ced6ecf13360b6c6c55b8aaa4ef7481d2" integrity sha512-JPbdCEQLj1w5GilpiHAx3qJvFndqybBysA3qUOnznweH4QbNYUsW/ea8QzSrnh0vNsezMMw5bcVool8lM0gwzg== -"string-width-cjs@npm:string-width@^4.2.0": - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - -string-width@^4.1.0: +"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -3085,14 +3076,7 @@ string-width@^5.0.1, string-width@^5.1.2: emoji-regex "^9.2.2" strip-ansi "^7.0.1" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - -strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== From 32ff1504b4a2cf2d3faaf3e84eb20a29eb5d3e35 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Wed, 16 Oct 2024 15:40:53 +0100 Subject: [PATCH 37/43] fix: filter by pipeline or group when clicking on a line --- app/frontend/javascript/pipeline-graph/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/frontend/javascript/pipeline-graph/index.js b/app/frontend/javascript/pipeline-graph/index.js index 9b3d477f8..9e4b0cdeb 100644 --- a/app/frontend/javascript/pipeline-graph/index.js +++ b/app/frontend/javascript/pipeline-graph/index.js @@ -226,6 +226,8 @@ const applyMouseEvents = function () { // when an edge is clicked, filter the graph to show only that pipeline core.on('click', 'edge', (event) => { const pipeline = event.target.data('pipeline') - applyFilter(pipeline) + const group = event.target.data('group') + const pipelineOrGroup = pipeline || group + applyFilter(pipelineOrGroup) }) } From c14be6c9ec7d12d5454945e785a2a85c3ecb6f37 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Wed, 16 Oct 2024 15:55:41 +0100 Subject: [PATCH 38/43] build: upgrade vite dependencies bundle exec vite upgrade --- Gemfile.lock | 17 +++++++++-------- package.json | 4 ++-- yarn.lock | 30 +++++++----------------------- 3 files changed, 18 insertions(+), 33 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 10f7b099d..3886f224a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -136,7 +136,7 @@ GEM diff-lcs (1.5.1) docile (1.4.0) drb (2.2.1) - dry-cli (1.1.0) + dry-cli (1.2.0) erubi (1.13.0) exception_notification (4.5.0) actionmailer (>= 5.2, < 8) @@ -188,10 +188,10 @@ GEM rspec (>= 2.99.0, < 4.0) hashdiff (1.1.0) hashie (5.0.0) - i18n (1.14.5) + i18n (1.14.6) concurrent-ruby (~> 1.0) io-console (0.7.2) - irb (1.14.0) + irb (1.14.1) rdoc (>= 4.0.0) reline (>= 0.4.2) json (2.7.2) @@ -259,7 +259,7 @@ GEM puma (6.4.3) nio4r (~> 2.0) racc (1.8.1) - rack (3.1.7) + rack (3.1.8) rack-mini-profiler (3.3.1) rack (>= 1.2.0) rack-proxy (0.7.7) @@ -312,7 +312,7 @@ GEM rdoc (6.7.0) psych (>= 4.0.0) regexp_parser (2.9.2) - reline (0.5.9) + reline (0.5.10) io-console (~> 0.5) rexml (3.3.6) strscan @@ -386,7 +386,7 @@ GEM state_machines (0.6.0) stringio (3.1.1) strscan (3.1.0) - thor (1.3.1) + thor (1.3.2) timeout (0.4.1) tzinfo (2.0.6) concurrent-ruby (~> 1.0) @@ -394,8 +394,9 @@ GEM vite_rails (3.0.17) railties (>= 5.1, < 8) vite_ruby (~> 3.0, >= 3.2.2) - vite_ruby (3.8.2) + vite_ruby (3.9.0) dry-cli (>= 0.7, < 2) + logger (~> 1.6) rack-proxy (~> 0.6, >= 0.6.1) zeitwerk (~> 2.2) web-console (4.2.1) @@ -407,7 +408,7 @@ GEM addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) - webrick (1.8.1) + webrick (1.8.2) websocket (1.2.11) websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) diff --git a/package.json b/package.json index add3e87bf..c240ac3d2 100644 --- a/package.json +++ b/package.json @@ -33,8 +33,8 @@ "prettier": "^2.8.8", "sass": "^1.77.8", "typescript": "^4.6.3", - "vite": "^5.4.7", - "vite-plugin-ruby": "^5.0.0", + "vite": "^5.0.0", + "vite-plugin-ruby": "^5.1.0", "vitest": "^2.0.5", "vue-template-compiler": "^2.7.0" }, diff --git a/yarn.lock b/yarn.lock index b1f910f91..34d446bf1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3060,16 +3060,7 @@ std-env@^3.7.0: resolved "https://registry.yarnpkg.com/std-env/-/std-env-3.7.0.tgz#c9f7386ced6ecf13360b6c6c55b8aaa4ef7481d2" integrity sha512-JPbdCEQLj1w5GilpiHAx3qJvFndqybBysA3qUOnznweH4QbNYUsW/ea8QzSrnh0vNsezMMw5bcVool8lM0gwzg== -"string-width-cjs@npm:string-width@^4.2.0": - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - -string-width@^4.1.0: +"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -3087,14 +3078,7 @@ string-width@^5.0.1, string-width@^5.1.2: emoji-regex "^9.2.2" strip-ansi "^7.0.1" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - -strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -3276,15 +3260,15 @@ vite-node@2.0.5: tinyrainbow "^1.2.0" vite "^5.0.0" -vite-plugin-ruby@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/vite-plugin-ruby/-/vite-plugin-ruby-5.0.0.tgz#cd891198a7672f2e8402439f53ab9d2b08f6502d" - integrity sha512-c8PjTp21Ah/ttgnNUyu0qvCXZI08Jr9I24oUKg3TRIRhF5GcOZ++6wtlTCrNFd9COEQbpXHxlRIXd/MEg0iZJw== +vite-plugin-ruby@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/vite-plugin-ruby/-/vite-plugin-ruby-5.1.0.tgz#489f2071ea6d86b5db735ea1fbbbe10e50e8e9bc" + integrity sha512-Dgd/dCvb/8GYxZx2NEgxygEoUpHz9vfad7itlO4fXqYwdfAEwFwwOohC630yf/+kxIGBZXI5yk+Y3WkL9VkwcA== dependencies: debug "^4.3.4" fast-glob "^3.3.2" -vite@^5.0.0, vite@^5.4.7: +vite@^5.0.0: version "5.4.7" resolved "https://registry.yarnpkg.com/vite/-/vite-5.4.7.tgz#d226f57c08b61379e955f3836253ed3efb2dcf00" integrity sha512-5l2zxqMEPVENgvzTuBpHer2awaetimj2BGkhBPdnwKbPNOlHsODU+oiazEZzLK7KhAnOrO+XGYJYn4ZlUhDtDQ== From d8b7b29c658121e3428b8e91220d1742b0fe35d2 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Thu, 17 Oct 2024 15:53:59 +0100 Subject: [PATCH 39/43] fix: allow pools to not be defined without breaking all javascript --- app/frontend/javascript/legacy_scripts_a.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/frontend/javascript/legacy_scripts_a.js b/app/frontend/javascript/legacy_scripts_a.js index 392a1766b..47237c542 100644 --- a/app/frontend/javascript/legacy_scripts_a.js +++ b/app/frontend/javascript/legacy_scripts_a.js @@ -59,9 +59,12 @@ let limberPlateView = function (defaultTab) { control.find('a[href="' + defaultTab + '"]').tab('show') plateElement.on('click', '.aliquot', function (event) { + control.find('a[data-plate-view="pools-view"]').tab('show') + let pool = $(event.currentTarget).data('pool') - control.find('a[data-plate-view="pools-view"]').tab('show') + // Handle cases where pool is not defined to prevent errors + if (pool === undefined || pool === '') return plateElement .find('.aliquot[data-pool!=' + pool + ']') From 5642ec310b4c1c157a7312a0c4f531ea99e9a685 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Mon, 21 Oct 2024 11:29:40 +0100 Subject: [PATCH 40/43] tests: add tests for state_badge --- spec/helpers/page_helper_spec.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/spec/helpers/page_helper_spec.rb b/spec/helpers/page_helper_spec.rb index 9bc98a951..5c8f2d44e 100644 --- a/spec/helpers/page_helper_spec.rb +++ b/spec/helpers/page_helper_spec.rb @@ -22,4 +22,18 @@ expect(count_badge(0, 'test')).to eq('0') end end + + describe '::state_badge' do + it 'returns a badge with the given state and default title' do + expect(state_badge('pending')).to eq( + 'Pending' + ) + end + + it 'returns a badge with the given state and title' do + expect(state_badge('passed', title: 'Submission State')).to eq( + 'Passed' + ) + end + end end From 2b2062a549bf2c3efbeace21f0df97898b91bfbf Mon Sep 17 00:00:00 2001 From: Dasun Pubudumal Date: Wed, 23 Oct 2024 08:07:14 +0100 Subject: [PATCH 41/43] Revert "Adding Norm plate after LBB Lib PCR-XP for tracking Beckman normalisation" --- config/pipelines/bespoke_pcr.yml | 3 +-- config/purposes/bespoke.yml | 2 -- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/config/pipelines/bespoke_pcr.yml b/config/pipelines/bespoke_pcr.yml index f6e31a07f..20668475f 100644 --- a/config/pipelines/bespoke_pcr.yml +++ b/config/pipelines/bespoke_pcr.yml @@ -88,6 +88,5 @@ Bespoke PCR MX: request_type_key: - limber_multiplexing relationships: - LBB Lib PCR-XP: LBB Lib PCR-XP Norm - LBB Lib PCR-XP Norm: LBB Lib Pool Stock + LBB Lib PCR-XP: LBB Lib Pool Stock LBB Lib Pool Stock: LB Lib Pool Norm diff --git a/config/purposes/bespoke.yml b/config/purposes/bespoke.yml index ce928c7e9..5a4411904 100644 --- a/config/purposes/bespoke.yml +++ b/config/purposes/bespoke.yml @@ -13,8 +13,6 @@ LBB Lib PCR-XP: :asset_type: plate :presenter_class: Presenters::PcrPresenter :creator_class: LabwareCreators::CustomTaggedPlate -LBB Lib PCR-XP Norm: - :asset_type: plate LBB Ligation Tagged: :asset_type: plate :presenter_class: Presenters::PcrPresenter From bf598195d88847c0222ca2e9ec24f7a842fa3823 Mon Sep 17 00:00:00 2001 From: Stephen Hulme Date: Mon, 28 Oct 2024 08:27:11 +0000 Subject: [PATCH 42/43] build: install Rails UJS --- app/frontend/entrypoints/application.js | 9 +++++++++ package.json | 1 + yarn.lock | 7 +++++++ 3 files changed, 17 insertions(+) diff --git a/app/frontend/entrypoints/application.js b/app/frontend/entrypoints/application.js index dfc9cb98e..e4c83293f 100644 --- a/app/frontend/entrypoints/application.js +++ b/app/frontend/entrypoints/application.js @@ -29,6 +29,15 @@ console.log('Visit the guide for more information: ', 'https://vite-ruby.netlify // ^^^ Template from Vite. Below is custom code for Limber ^^^ +// Import Rails UJS as in Sequencescape +import Rails from '@rails/ujs' + +try { + Rails.start() +} catch { + // Nothing +} + // Import Libraries import 'bootstrap' import 'popper.js' diff --git a/package.json b/package.json index b1228eae5..7b7c3a0d2 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,6 @@ { "dependencies": { + "@rails/ujs": "^7.1.3", "axios": "^0.28.1", "bootstrap-vue": "^2.23.1", "cytoscape": "^3.30.2", diff --git a/yarn.lock b/yarn.lock index ddc2cfdc3..a2d8a360a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -620,6 +620,11 @@ resolved "https://registry.yarnpkg.com/@prettier/plugin-ruby/-/plugin-ruby-4.0.4.tgz#73d85fc2a1731a3f62b57ac3116cf1c234027cb6" integrity sha512-lCpvfS/dQU5WrwN3AQ5vR8qrvj2h5gE41X08NNzAAXvHdM4zwwGRcP2sHSxfu6n6No+ljWCVx95NvJPFTTjCTg== +"@rails/ujs@^7.1.3": + version "7.1.402" + resolved "https://registry.yarnpkg.com/@rails/ujs/-/ujs-7.1.402.tgz#5d4e7e5d1e2e22df081bf5693fc75f0725635130" + integrity sha512-q9dDlIR+anDtuGcV56rLnqHAxtWo8vkSnvfFt7juthvHc+97NEtGlnM++uhvnlDbR+7EGkX8nGqQIF8R93oWMQ== + "@rollup/rollup-android-arm-eabi@4.22.4": version "4.22.4" resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.22.4.tgz#8b613b9725e8f9479d142970b106b6ae878610d5" @@ -3059,6 +3064,7 @@ std-env@^3.7.0: integrity sha512-JPbdCEQLj1w5GilpiHAx3qJvFndqybBysA3qUOnznweH4QbNYUsW/ea8QzSrnh0vNsezMMw5bcVool8lM0gwzg== "string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0: + name string-width-cjs version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -3077,6 +3083,7 @@ string-width@^5.0.1, string-width@^5.1.2: strip-ansi "^7.0.1" "strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: + name strip-ansi-cjs version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== From 3ceac2fa82627fcfbe89ad7ff6d8c979840c436b Mon Sep 17 00:00:00 2001 From: Dasun Pubudumal Date: Mon, 28 Oct 2024 12:45:33 +0000 Subject: [PATCH 43/43] Update .release-version --- .release-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.release-version b/.release-version index 6621aa3bc..9b57023ab 100644 --- a/.release-version +++ b/.release-version @@ -1 +1 @@ -3.61.1 +3.62.0