Skip to content

Commit

Permalink
Merge pull request #1420 from sanger/develop
Browse files Browse the repository at this point in the history
Develop to master
  • Loading branch information
emrojo authored Oct 17, 2023
2 parents b3f7712 + 0854138 commit 0542176
Show file tree
Hide file tree
Showing 61 changed files with 4,371 additions and 188 deletions.
2 changes: 1 addition & 1 deletion .release-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.37.1
3.38.0
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ GEM
digest
net-protocol
timeout
nio4r (2.5.8)
nio4r (2.5.9)
nokogiri (1.15.2)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
Expand All @@ -244,7 +244,7 @@ GEM
byebug (~> 11.0)
pry (~> 0.13.0)
public_suffix (4.0.7)
puma (5.6.4)
puma (5.6.7)
nio4r (~> 2.0)
racc (1.6.2)
rack (2.2.7)
Expand Down
9 changes: 7 additions & 2 deletions app/javascript/pipeline-graph/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 33 additions & 13 deletions app/models/labware_creators/multi_stamp_tubes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,11 @@ def request_hash(transfer, child_plate)
}
end

def submission_options_from_config
@submission_options_from_config ||= purpose_config.submission_options
end

def create_submission_from_parent_tubes
# Retrieves the submission parameters
#
# Returns: a hash containing the submission parameters
# Adds: errors if there is more than one submission specified
def configured_params
submission_options_from_config = purpose_config.submission_options

# if there's more than one appropriate submission, we can't know which one to choose,
Expand All @@ -126,25 +126,45 @@ def create_submission_from_parent_tubes
end

# otherwise, create a submission with params specified in the config
configured_params = submission_options_from_config.values.first
submission_options_from_config.values.first
end

create_submission(configured_params)
# Returns a list of parent tube uuids
def asset_uuids
parent_tubes.map { |tube| tube.receptacle.uuid }
end

# Project and Study are specified on the Submission Template (submission_parameters field)
# It's important that autodetect_studies_projects is false here,
# to make sure the Study is set explicitly, since it controls data access
def create_submission(configured_params)
asset_uuids = parent_tubes.map { |tube| tube.receptacle.uuid }
# Autodetection looks at the Study and Project already linked to the aliquots and uses that.
#
# 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
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: false }],
asset_groups: [{ assets: asset_uuids, autodetect_studies_projects: autodetect_studies_project }],
api: api,
user: user_uuid
}

create_submission(sequencescape_submission_parameters)
end

# Creates a submission in Sequencescape
#
# Parameters:
# - sequencescape_submission_parameters: a hash containing the parameters for the submission
#
# Returns: true if submission created, false otherwise
# Sets: @submission_uuid if submission created
# Adds: errors if submission not created
def create_submission(sequencescape_submission_parameters)
ss = SequencescapeSubmission.new(sequencescape_submission_parameters)
submission_created = ss.save

Expand Down
Loading

0 comments on commit 0542176

Please sign in to comment.