Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into 1958-y24-335-creat…
Browse files Browse the repository at this point in the history
…e-a-new-barcode-for-normalised-xp-plates-for-the-hic-process-in-limber
  • Loading branch information
dasunpubudumal committed Oct 18, 2024
2 parents 911ca56 + f1b6287 commit d73e94b
Show file tree
Hide file tree
Showing 46 changed files with 721 additions and 1,049 deletions.
7 changes: 7 additions & 0 deletions .pryrc
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion .release-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.61.0
3.61.1
17 changes: 9 additions & 8 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -192,10 +192,10 @@ GEM
tilt
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)
Expand Down Expand Up @@ -264,7 +264,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)
Expand Down Expand Up @@ -319,7 +319,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
Expand Down Expand Up @@ -404,7 +404,7 @@ GEM
rbs
syntax_tree (>= 2.0.1)
temple (0.10.3)
thor (1.3.1)
thor (1.3.2)
tilt (2.4.0)
timeout (0.4.1)
tzinfo (2.0.6)
Expand All @@ -413,8 +413,9 @@ 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.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)
Expand All @@ -434,7 +435,7 @@ GEM
xpath (3.2.0)
nokogiri (~> 1.8)
yard (0.9.36)
zeitwerk (2.6.17)
zeitwerk (2.6.18)

PLATFORMS
ruby
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 3 additions & 1 deletion app/frontend/javascript/pipeline-graph/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
}
5 changes: 3 additions & 2 deletions app/models/labware_creators/baited_plate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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).first.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

Expand Down
23 changes: 10 additions & 13 deletions app/models/labware_creators/custom_tagged_plate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -47,14 +47,11 @@ def initialize(*args, &)

def create_plate! # rubocop:todo Metrics/AbcSize
@child =
api
.pooled_plate_creation
.create!(
child_purpose: purpose_uuid,
user: user_uuid,
parents: [parent_uuid, tag_plate.asset_uuid].compact_blank
)
.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)

Expand Down Expand Up @@ -107,7 +104,7 @@ 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:, user_uuid:))
end
end
end
Expand Down
8 changes: 4 additions & 4 deletions app/models/labware_creators/merged_plate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 6 additions & 4 deletions app/models/labware_creators/multi_plate_pool.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ 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)

Expand Down
10 changes: 6 additions & 4 deletions app/models/labware_creators/multi_stamp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ 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)

Expand Down
28 changes: 13 additions & 15 deletions app/models/labware_creators/multi_stamp_tubes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,14 @@ 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 =
Sequencescape::Api::V2::PooledPlateCreation.create!(
child_purpose_uuid: purpose_uuid,
parent_uuids: parent_uuids,
user_uuid: user_uuid
).child

@child = plate_creation.child
child_v2 = Sequencescape::Api::V2.plate_with_wells(@child.uuid)

transfer_material_from_parent!(child_v2)
transfer_material_from_parent!

yield(@child) if block_given?
true
Expand Down Expand Up @@ -87,15 +88,12 @@ 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)
api.transfer_request_collection.create!(
user: user_uuid,
transfer_requests: transfer_request_attributes(child_plate)
)
def transfer_material_from_parent!
api.transfer_request_collection.create!(user: user_uuid, 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)
Expand All @@ -108,13 +106,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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,14 @@ 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 =
Sequencescape::Api::V2::PooledPlateCreation.create!(
child_purpose_uuid: purpose_uuid,
parent_uuids: parent_tube_uuids,
user_uuid: user_uuid
).child

@child = plate_creation.child
child_v2 = Sequencescape::Api::V2.plate_with_wells(@child.uuid)

transfer_material_from_parent!(child_v2)
transfer_material_from_parent!

yield(@child) if block_given?
true
Expand Down Expand Up @@ -232,23 +233,18 @@ 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)
api.transfer_request_collection.create!(
user: user_uuid,
transfer_requests: transfer_request_attributes(child_plate)
)
def transfer_material_from_parent!
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.
# 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<Hash>] 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,
Expand Down
11 changes: 5 additions & 6 deletions app/models/labware_creators/plate_split_to_tube_racks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -408,13 +408,12 @@ def parent_wells_for_contingency
# @param tube_attributes [Hash] A hash of attributes to use for the created tubes.
# @return [Hash<String, Tube>] 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)
Expand Down
11 changes: 5 additions & 6 deletions app/models/labware_creators/pooled_tubes_base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
11 changes: 5 additions & 6 deletions app/models/labware_creators/pooled_tubes_by_sample.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading

0 comments on commit d73e94b

Please sign in to comment.