Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DPL-911 correct study and project for cell extraction work #1452

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions app/models/labware_creators/multi_stamp_tubes.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module LabwareCreators
class MultiStampTubes < Base # rubocop:todo Style/Documentation
class MultiStampTubes < Base # rubocop:todo Style/Documentation, Metrics/ClassLength
include LabwareCreators::CustomPage
include SupportParent::TubeOnly

Expand Down Expand Up @@ -139,16 +139,22 @@ def asset_uuids
# Otherwise, Project and Study can be specified explicitly on the Submission Template
# (submission_parameters field) if autodetection is not appropriate (for instance in Cardinal,
# where one tube will contain samples from multiple different studies).
def autodetect_studies_project
configured_params[:autodetect_studies_project] || false
def autodetect_studies
configured_params[:autodetect_studies] || false
end

def autodetect_projects
configured_params[:autodetect_projects] || false
end

# Creates a submission in Sequencescape based on the parent tubes
def create_submission_from_parent_tubes
sequencescape_submission_parameters = {
template_name: configured_params[:template_name],
request_options: configured_params[:request_options],
asset_groups: [{ assets: asset_uuids, autodetect_studies_projects: autodetect_studies_project }],
asset_groups: [
{ assets: asset_uuids, autodetect_studies: autodetect_studies, autodetect_projects: autodetect_projects }
],
api: api,
user: user_uuid
}
Expand Down
2 changes: 1 addition & 1 deletion app/models/presenters/submission_plate_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def asset_groups
.wells
.compact_blank
.group_by(&:order_group)
.map { |_, wells| { assets: wells.map(&:uuid), autodetect_studies_projects: true } }
.map { |_, wells| { assets: wells.map(&:uuid), autodetect_studies: true, autodetect_projects: true } }
end
end
end
2 changes: 1 addition & 1 deletion app/models/sequencescape_submission.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def asset_groups=(asset_groups)
def asset_groups_for_orders_creation
return asset_groups unless (asset_groups.length == 1) && extra_barcodes

[{ assets: [assets, extra_assets].flatten.compact, autodetect_studies_projects: true }]
[{ assets: [assets, extra_assets].flatten.compact, autodetect_studies: true, autodetect_projects: true }]
end

private
Expand Down
3 changes: 2 additions & 1 deletion config/purposes/scrna_core_cell_extraction.wip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ LRC Blood Bank:
fragment_size_required_from: '200'
fragment_size_required_to: '800'
allowed_extra_barcodes: false
autodetect_studies_project: false
autodetect_studies: true
autodetect_projects: false
:file_links:
- name: 'Download Scanned Tube Layout for LRC Blood Bank Plate'
id: scrna_core_cell_extraction_sample_arraying_tube_layout
Expand Down
32 changes: 25 additions & 7 deletions spec/models/labware_creators/multi_stamp_tubes_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,22 +145,39 @@
end
end

describe '#autodetect_studies_project' do
describe '#autodetect_studies' do
it 'returns true when specified in the config' do
expect(subject).to receive(:configured_params).and_return({ autodetect_studies: true, request_options: {} })
expect(subject.send(:autodetect_studies)).to eq(true)
end
it 'returns false when specified in the config' do
expect(subject).to receive(:configured_params).and_return(
{ autodetect_studies: false, request_options: {} }
)
expect(subject.send(:autodetect_studies)).to eq(false)
end
it 'returns false if not specified in the config' do
expect(subject).to receive(:configured_params).and_return({ request_options: {} })
expect(subject.send(:autodetect_studies)).to eq(false)
end
end

describe '#autodetect_projects' do
it 'returns true when specified in the config' do
expect(subject).to receive(:configured_params).and_return(
{ autodetect_studies_project: true, request_options: {} }
{ autodetect_projects: true, request_options: {} }
)
expect(subject.send(:autodetect_studies_project)).to eq(true)
expect(subject.send(:autodetect_projects)).to eq(true)
end
it 'returns false when specified in the config' do
expect(subject).to receive(:configured_params).and_return(
{ autodetect_studies_project: false, request_options: {} }
{ autodetect_projects: false, request_options: {} }
)
expect(subject.send(:autodetect_studies_project)).to eq(false)
expect(subject.send(:autodetect_projects)).to eq(false)
end
it 'returns false if not specified in the config' do
expect(subject).to receive(:configured_params).and_return({ request_options: {} })
expect(subject.send(:autodetect_studies_project)).to eq(false)
expect(subject.send(:autodetect_projects)).to eq(false)
end
end
end
Expand Down Expand Up @@ -248,7 +265,8 @@
assets: parent_receptacle_uuids,
request_options: purpose_config[:submission_options]['Cardinal library prep']['request_options'],
user: user_uuid,
autodetect_studies_projects: false
autodetect_studies: false,
autodetect_projects: false
}
},
body: '{"order":{"uuid":"order-uuid"}}'
Expand Down
4 changes: 2 additions & 2 deletions spec/models/presenters/submission_plate_presenter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
request_options: {
'option' => 1
},
asset_groups: [{ assets: wells_with_aliquots, autodetect_studies_projects: true }]
asset_groups: [{ assets: wells_with_aliquots, autodetect_studies: true, autodetect_projects: true }]
)
)
],
Expand All @@ -57,7 +57,7 @@
request_options: {
'option' => 2
},
asset_groups: [{ assets: wells_with_aliquots, autodetect_studies_projects: true }]
asset_groups: [{ assets: wells_with_aliquots, autodetect_studies: true, autodetect_projects: true }]
)
)
]
Expand Down
Loading