Class: UatActions::TubeSubmission
- Inherits:
-
UatActions
- Object
- UatActions
- UatActions::TubeSubmission
- Defined in:
- app/uat_actions/uat_actions/tube_submission.rb
Overview
This UAT Action will generates a basic submission for tubes. Initially, it has been designed for generating scRNA Core Donor Pooling and cDNA Prep submissions on LRC Bank Seq/Spare tubes.
Constant Summary
Constants inherited from UatActions
Class Method Summary collapse
-
.compatible_submission_templates ⇒ Array<String>
Returns the submission templates which are compatible with the UAT action.
-
.default ⇒ UatActions::TestSubmission
Returns a default copy of the UatAction which will be used to fill in the form.
Instance Method Summary collapse
-
#assets ⇒ Array<Tube>
Returns the tubes to use for the submission.
-
#custom_request_options ⇒ Hash
Returns the custom request options to use for the submission.
-
#default_request_options ⇒ Hash
Returns the default request options to use for the submission.
-
#fill_report(order) ⇒ Void
Fills the report with the information from the submission.
-
#order_request_options ⇒ Hash
Returns the request options to use for the submission.
-
#perform ⇒ Boolean
Generates tube submission for the given template.
-
#project ⇒ Project
Returns the project to use for UAT.
-
#select_assets ⇒ Array<Tube>
Returns the tubes from the specified barcodes in the form field.
-
#study ⇒ Study
Returns the study to use for UAT.
-
#submission_template ⇒ SubmissionTemplate
Returns the submisssion template to use for the submission.
-
#user ⇒ User
Returns the uat user.
Methods inherited from UatActions
all, category, find, form_field, form_fields, #form_fields, grouped_and_sorted_uat_actions, id, inherited, permitted, #report, #save, to_partial_path, uat_actions
Class Method Details
.compatible_submission_templates ⇒ Array<String>
Returns the submission templates which are compatible with the UAT action. These are submission templates which have a tube as an input asset type.
67 68 69 70 71 72 73 74 75 |
# File 'app/uat_actions/uat_actions/tube_submission.rb', line 67 def self.compatible_submission_templates SubmissionTemplate .visible .each_with_object([]) do |submission_template, compatible| next unless submission_template.input_asset_type.constantize <= Tube compatible << submission_template.name end end |
.default ⇒ UatActions::TestSubmission
Returns a default copy of the UatAction which will be used to fill in the form
59 60 61 |
# File 'app/uat_actions/uat_actions/tube_submission.rb', line 59 def self.default new end |
Instance Method Details
#assets ⇒ Array<Tube>
Returns the tubes to use for the submission
122 123 124 |
# File 'app/uat_actions/uat_actions/tube_submission.rb', line 122 def assets @assets ||= select_assets end |
#custom_request_options ⇒ Hash
Returns the custom request options to use for the submission
160 161 162 163 164 165 166 |
# File 'app/uat_actions/uat_actions/tube_submission.rb', line 160 def = {} [:library_type] = library_type_name if library_type_name.present? [:number_of_samples_per_pool] = number_of_samples_per_pool.presence [:cells_per_chip_well] = cells_per_chip_well.presence end |
#default_request_options ⇒ Hash
Returns the default request options to use for the submission
143 144 145 146 147 148 149 150 151 152 153 154 155 |
# File 'app/uat_actions/uat_actions/tube_submission.rb', line 143 def submission_template .input_field_infos .each_with_object({}) do |ifi, | [ifi.key] = ( if ifi.default_value.nil? ifi.selection&.first.presence || ifi.max.presence || ifi.min else ifi.default_value end ) end end |
#fill_report(order) ⇒ Void
Fills the report with the information from the submission
rubocop:disable Metrics/AbcSize
98 99 100 101 102 103 104 105 106 107 108 |
# File 'app/uat_actions/uat_actions/tube_submission.rb', line 98 def fill_report(order) report['tube_barcodes'] = assets.map(&:human_barcode) report['submission_id'] = order.submission.id report['library_type'] = order.[:library_type] if order.[:library_type].present? report['number_of_samples_per_pool'] = order.[:number_of_samples_per_pool] if order.[ :number_of_samples_per_pool ].present? report['cells_per_chip_well'] = order.[:cells_per_chip_well] if order.[ :cells_per_chip_well ].present? end |
#order_request_options ⇒ Hash
Returns the request options to use for the submission
136 137 138 |
# File 'app/uat_actions/uat_actions/tube_submission.rb', line 136 def .merge() end |
#perform ⇒ Boolean
Generates tube submission for the given template.
80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'app/uat_actions/uat_actions/tube_submission.rb', line 80 def perform order = submission_template.create_with_submission!( study: study, project: project, user: user, assets: assets, request_options: ) fill_report(order) order.submission.built! true end |
#project ⇒ Project
Returns the project to use for UAT
178 179 180 |
# File 'app/uat_actions/uat_actions/tube_submission.rb', line 178 def project UatActions::StaticRecords.project end |
#select_assets ⇒ Array<Tube>
Returns the tubes from the specified barcodes in the form field
129 130 131 |
# File 'app/uat_actions/uat_actions/tube_submission.rb', line 129 def select_assets .gsub(/(\\[trfvn])+/, ' ').split.map { || Tube.() } end |
#study ⇒ Study
Returns the study to use for UAT
171 172 173 |
# File 'app/uat_actions/uat_actions/tube_submission.rb', line 171 def study UatActions::StaticRecords.study end |
#submission_template ⇒ SubmissionTemplate
Returns the submisssion template to use for the submission
115 116 117 |
# File 'app/uat_actions/uat_actions/tube_submission.rb', line 115 def submission_template @submission_template = SubmissionTemplate.find_by(name: submission_template_name) end |
#user ⇒ User
Returns the uat user
186 187 188 |
# File 'app/uat_actions/uat_actions/tube_submission.rb', line 186 def user UatActions::StaticRecords.user end |