Module: ModelExtensions::Plate
- Included in:
- Plate
- Defined in:
- app/api/model_extensions/plate.rb
Overview
Included in Plate The intent of this file was to provide methods specific to the V1 API
Defined Under Namespace
Modules: NamedScopeHelpers
Constant Summary collapse
- PLATE_INCLUDES =
:plate_metadata, { wells: %i[ map transfer_requests_as_target uuid_object ] } ].freeze
Class Method Summary collapse
Instance Method Summary collapse
- #library_source_plate ⇒ Object
- #library_source_plates ⇒ Object
-
#pools ⇒ Object
Returns a hash from the submission for the pools to the wells that form that pool on this plate.
-
#pre_cap_groups ⇒ Object
Adds pre-capture pooling information, we need to delegate this to the stock plate, as we need all the wells Currently used in Transfer::BetweenPlates to set submission id, we should switch to doing this directly via Limber with transfer request collections.
Class Method Details
.included(base) ⇒ Object
22 23 24 25 26 27 28 |
# File 'app/api/model_extensions/plate.rb', line 22 def self.included(base) base.class_eval do scope :include_plate_purpose, -> { includes(:plate_purpose) } scope :include_plate_metadata, -> { includes(:plate_metadata) } delegate :pool_id_for_well, to: :plate_purpose, allow_nil: true end end |
Instance Method Details
#library_source_plate ⇒ Object
30 31 32 |
# File 'app/api/model_extensions/plate.rb', line 30 def library_source_plate plate_purpose.library_source_plate(self) end |
#library_source_plates ⇒ Object
34 35 36 |
# File 'app/api/model_extensions/plate.rb', line 34 def library_source_plates plate_purpose.library_source_plate(self) end |
#pools ⇒ Object
Returns a hash from the submission for the pools to the wells that form that pool on this plate. This is not necessarily efficient but it is correct. Unpooled wells, those without submissions, are completely ignored within the returned result.
41 42 43 44 45 46 47 48 49 50 |
# File 'app/api/model_extensions/plate.rb', line 41 def pools Request..for_pooling_of(self).each_with_object({}) do |request, pools| pools[request.pool_id] = { wells: request.pool_into.split(','), pool_complete: request.pool_complete == 1 }.tap do |pool_information| request.update_pool_information(pool_information) end unless request.pool_id.nil? end end |
#pre_cap_groups ⇒ Object
Adds pre-capture pooling information, we need to delegate this to the stock plate, as we need all the wells Currently used in Transfer::BetweenPlates to set submission id, we should switch to doing this directly via Limber with transfer request collections
55 56 57 58 59 60 61 62 63 |
# File 'app/api/model_extensions/plate.rb', line 55 def pre_cap_groups Request..for_pre_cap_grouping_of(self).each_with_object({}) do |request, groups| groups[request.group_id] = { wells: request.group_into.split(',') }.tap do |pool_information| pool_information[:pre_capture_plex_level] ||= request..pre_capture_plex_level # We supply the submission id to assist with correctly tagging transfer requests later pool_information[:submission_id] ||= request.submission_id end unless request.group_id.nil? end end |