Class: Plate

Inherits:
ApplicationRecord show all
Includes:
Labware
Defined in:
app/models/plate.rb

Overview

Plate

Constant Summary collapse

DEFAULT_SIZE =
96

Constants included from Labware

Labware::ID_PREFIXES

Instance Method Summary collapse

Methods included from Labware

#generate_barcode

Instance Method Details

#formatted_range(wells) ⇒ String

Compacts the provided well range into an easy to read summary. e.g.. formatted_range([‘A1’, ‘B1’, ‘C1’,‘A2’,‘A5’,‘B5’]) => ‘A1-C1,A2,A5-B5’ Mostly this will just be start_well-end_well

Parameters:

  • wells (Array<String>)

    Array of well names to format

Returns:

  • (String)

    A name describing the range



59
60
61
# File 'app/models/plate.rb', line 59

def formatted_range(wells)
  WellSorterService.formatted_range(wells, DEFAULT_SIZE)
end

#wells_by_column_then_rowObject

sorts as: A1 B1 C1 … A2 B2 …



41
42
43
# File 'app/models/plate.rb', line 41

def wells_by_column_then_row
  wells.sort { |a, b| a.column == b.column ? a.row <=> b.row : a.column <=> b.column }
end

#wells_by_row_then_columnObject

sorts as: A1 A2 A3 … B1 B2 …



46
47
48
# File 'app/models/plate.rb', line 46

def wells_by_row_then_column
  wells.sort { |a, b| a.row == b.row ? a.column <=> b.column : a.row <=> b.row }
end