Class: LabwareCreators::PartialStampedPlateWithoutDilution

Inherits:
StampedPlate show all
Defined in:
app/models/labware_creators/partial_stamped_plate_without_dilution.rb

Overview

These creators handle a partial submission of wells on their parent plate, and use a well filter to select those wells with requests that have the correct request type, library type and request state.

Instance Method Summary collapse

Constructor Details

This class inherits a constructor from LabwareCreators::Base

Instance Method Details

#get_destination_location(source_well) ⇒ String

Returns the destination location for a given source well. The index of the source well in the array of parent wells to transfer (after filtering) is used to calculate the destination. This is because wells are compressed to the top-left on the child plate.

Parameters:

  • source_well (Well)

    the source well

Returns:

  • (String)

    the destination location



51
52
53
54
# File 'app/models/labware_creators/partial_stamped_plate_without_dilution.rb', line 51

def get_destination_location(source_well)
  index = parent_wells_to_transfer.index(source_well)
  WellHelpers.well_at_column_index(index)
end

#get_well_for_plate_location(plate, well_location) ⇒ Well

Returns the well object at a specified well location on a given plate.

Parameters:

  • plate (Plate)

    the plate object

  • well_location (String)

    the well location on the plate

Returns:

  • (Well)

    the well object at the well location on the plate



39
40
41
# File 'app/models/labware_creators/partial_stamped_plate_without_dilution.rb', line 39

def get_well_for_plate_location(plate, well_location)
  plate.wells.detect { |well| well.location == well_location }
end

#labware_wellsArray<Well>

Returns the lists of wells from the parent labware in column order, i.e., A1, B1, … H1, A2, B2, … etc. This method is invoked by well_filter. The order of wells returned by the ‘filtered’ method of the well_filter is influenced by the order of wells returned by this method.

Returns:

  • (Array<Well>)

    the wells of the parent labware in column order.



21
22
23
# File 'app/models/labware_creators/partial_stamped_plate_without_dilution.rb', line 21

def labware_wells
  parent.wells_in_columns
end

#parent_wells_to_transferArray<Well>

Returns an array of the filtered parent wells.

Returns:

  • (Array<Well>)

    the filtered wells of the parent



29
30
31
# File 'app/models/labware_creators/partial_stamped_plate_without_dilution.rb', line 29

def parent_wells_to_transfer
  well_filter.filtered.map(&:first)
end

#request_hash(source_well, child_plate, additional_parameters) ⇒ Hash

Returns attributes for a transfer request from a source well to the child plate. This method is invoked by the ‘transfer_request_attributes’ for each filtered source well.

Parameters:

  • source_well (Well)

    the source well

  • child_plate (Plate)

    the child plate

  • additional_parameters (Hash)

    additional parameters provided by well_filter

Returns:

  • (Hash)

    the attributes for the transfer request for the source well



65
66
67
68
69
70
71
# File 'app/models/labware_creators/partial_stamped_plate_without_dilution.rb', line 65

def request_hash(source_well, child_plate, additional_parameters)
  dest_location = get_destination_location(source_well)
  {
    'source_asset' => source_well.uuid,
    'target_asset' => get_well_for_plate_location(child_plate, dest_location)&.uuid
  }.merge(additional_parameters)
end

#well_filterObject

The well filter will be used to identify the parent wells to be taken forward. Filters on request type, library type and state.



10
11
12
# File 'app/models/labware_creators/partial_stamped_plate_without_dilution.rb', line 10

def well_filter
  @well_filter ||= WellFilterAllowingPartials.new(creator: self, request_state: 'pending')
end