Class: Sequencescape::Api::V2::Plate
- Inherits:
-
Base
- Object
- Base
- Sequencescape::Api::V2::Plate
- Includes:
- Shared::HasBarcode, Shared::HasPurpose, Shared::HasRequests, Shared::HasWorklineIdentifier, WellHelpers::Extensions
- Defined in:
- app/sequencescape/sequencescape/api/v2/plate.rb
Overview
A plate from sequencescape via the V2 API
Class Method Summary collapse
Instance Method Summary collapse
-
#active_requests ⇒ Object
Active requests are determined on a per-well level This is to maintain pre-existing behaviour.
- #columns_range ⇒ Object included from WellHelpers::Extensions
- #each_well_and_aliquot ⇒ Object
- #locations_in_rows ⇒ Object included from WellHelpers::Extensions
-
#model_name ⇒ ActiveModel::Name
Override the model used in form/URL helpers to allow us to treat old and new api the same.
- #pools ⇒ Object
- #primer_panel ⇒ Object
- #primer_panels ⇒ Object
- #ready_for_automatic_pooling? ⇒ Boolean
- #ready_for_custom_pooling? ⇒ Boolean
- #rows_range ⇒ Object included from WellHelpers::Extensions
- #size ⇒ Object
- #stock_plate ⇒ Object
- #stock_plate?(purpose_names: SearchHelper.stock_plate_names) ⇒ Boolean
- #stock_plates(purpose_names: SearchHelper.stock_plate_names) ⇒ Object
- #tagged? ⇒ Boolean
-
#to_param ⇒ Object
Currently use the uuid as our main identifier, might switch to human barcode soon.
-
#well_at_location(well_location) ⇒ Well?
Returns the well at a specified location.
- #wells_in_columns ⇒ Object
Class Method Details
.find_all(options, includes: DEFAULT_INCLUDES) ⇒ Object
36 37 38 |
# File 'app/sequencescape/sequencescape/api/v2/plate.rb', line 36 def self.find_all(, includes: DEFAULT_INCLUDES) Sequencescape::Api::V2::Plate.includes(*includes).where(**).all end |
.find_by(options) ⇒ Object
32 33 34 |
# File 'app/sequencescape/sequencescape/api/v2/plate.rb', line 32 def self.find_by() Sequencescape::Api::V2.plate_for_presenter(**) end |
Instance Method Details
#active_requests ⇒ Object
JG 17/09/2020
Active requests are determined on a per-well level This is to maintain pre-existing behaviour. What this means: In progress requests (those not passed or failed) take precedence over those which are passed/failed. Currently: This happens on a per-well level, which means if well A1 only has completed requests, and yet B1 has in-progress requests out of it, then both A1s completed requests, and B1s in progress requests will be listed. Alternatively: Remove this and even a single in progress request for any well will take precedence. In theory this probably makes more sense but in practice we tend to operate on the plate as a whole.
67 68 69 |
# File 'app/sequencescape/sequencescape/api/v2/plate.rb', line 67 def active_requests @active_requests ||= wells.flat_map(&:active_requests) end |
#columns_range ⇒ Object Originally defined in module WellHelpers::Extensions
#each_well_and_aliquot ⇒ Object
126 127 128 |
# File 'app/sequencescape/sequencescape/api/v2/plate.rb', line 126 def each_well_and_aliquot wells.each { |well| well.aliquots.each { |aliquot| yield well, aliquot } } end |
#locations_in_rows ⇒ Object Originally defined in module WellHelpers::Extensions
#model_name ⇒ ActiveModel::Name
Override the model used in form/URL helpers to allow us to treat old and new api the same
46 47 48 |
# File 'app/sequencescape/sequencescape/api/v2/plate.rb', line 46 def model_name ::ActiveModel::Name.new(Limber::Plate, false) end |
#pools ⇒ Object
122 123 124 |
# File 'app/sequencescape/sequencescape/api/v2/plate.rb', line 122 def pools @pools ||= generate_pools end |
#primer_panel ⇒ Object
118 119 120 |
# File 'app/sequencescape/sequencescape/api/v2/plate.rb', line 118 def primer_panel primer_panels.first end |
#primer_panels ⇒ Object
114 115 116 |
# File 'app/sequencescape/sequencescape/api/v2/plate.rb', line 114 def primer_panels active_requests.map(&:primer_panel).filter_map.uniq end |
#ready_for_automatic_pooling? ⇒ Boolean
88 89 90 |
# File 'app/sequencescape/sequencescape/api/v2/plate.rb', line 88 def ready_for_automatic_pooling? for_multiplexing end |
#ready_for_custom_pooling? ⇒ Boolean
92 93 94 |
# File 'app/sequencescape/sequencescape/api/v2/plate.rb', line 92 def ready_for_custom_pooling? any_complete_requests? || ready_for_automatic_pooling? end |
#rows_range ⇒ Object Originally defined in module WellHelpers::Extensions
#size ⇒ Object
96 97 98 |
# File 'app/sequencescape/sequencescape/api/v2/plate.rb', line 96 def size number_of_rows * number_of_columns end |
#stock_plate ⇒ Object
104 105 106 107 108 |
# File 'app/sequencescape/sequencescape/api/v2/plate.rb', line 104 def stock_plate return self if stock_plate? stock_plates.order(id: :asc).last end |
#stock_plate?(purpose_names: SearchHelper.stock_plate_names) ⇒ Boolean
110 111 112 |
# File 'app/sequencescape/sequencescape/api/v2/plate.rb', line 110 def stock_plate?(purpose_names: SearchHelper.stock_plate_names) purpose_names.include?(purpose_name) end |
#stock_plates(purpose_names: SearchHelper.stock_plate_names) ⇒ Object
100 101 102 |
# File 'app/sequencescape/sequencescape/api/v2/plate.rb', line 100 def stock_plates(purpose_names: SearchHelper.stock_plate_names) @stock_plates ||= stock_plate? ? [self] : ancestors.where(purpose_name: purpose_names) end |
#tagged? ⇒ Boolean
84 85 86 |
# File 'app/sequencescape/sequencescape/api/v2/plate.rb', line 84 def tagged? wells.any?(&:tagged?) end |
#to_param ⇒ Object
Currently use the uuid as our main identifier, might switch to human barcode soon
51 52 53 |
# File 'app/sequencescape/sequencescape/api/v2/plate.rb', line 51 def to_param uuid end |
#well_at_location(well_location) ⇒ Well?
Returns the well at a specified location.
80 81 82 |
# File 'app/sequencescape/sequencescape/api/v2/plate.rb', line 80 def well_at_location(well_location) wells.detect { |well| well.location == well_location } end |
#wells_in_columns ⇒ Object
71 72 73 |
# File 'app/sequencescape/sequencescape/api/v2/plate.rb', line 71 def wells_in_columns @wells_in_columns ||= wells.sort_by(&:coordinate) end |