Class: TagLayout::AsFixedGroupByPlate

Inherits:
Walker
  • Object
show all
Defined in:
app/models/tag_layout/as_fixed_group_by_plate.rb

Overview

Assigns multiple tags to each well sequentially.

Constant Summary collapse

DEFAULT_TAGS_PER_WELL =
4

Instance Attribute Summary

Attributes inherited from Walker

#tag_layout

Instance Method Summary collapse

Methods inherited from Walker

#initialize

Constructor Details

This class inherits a constructor from TagLayout::Walker

Instance Method Details

#apply_tags(well, tag, tag2) ⇒ Object

Over-ridden in the as group by plate fixed module to allow the application of multiple tags. We don’t support dual indexing here currently.

Raises:

  • (StandardError)


24
25
26
27
28
# File 'app/models/tag_layout/as_fixed_group_by_plate.rb', line 24

def apply_tags(well, tag, tag2)
  raise StandardError, 'Dual indexing is not supported by this template' if tag2.present?

  tag.multitag!(well) unless well.aliquots.empty?
end

#tags_per_wellObject



9
10
11
# File 'app/models/tag_layout/as_fixed_group_by_plate.rb', line 9

def tags_per_well
  tag_layout.tags_per_well || DEFAULT_TAGS_PER_WELL
end

#walk_wellsObject



13
14
15
16
17
18
19
20
# File 'app/models/tag_layout/as_fixed_group_by_plate.rb', line 13

def walk_wells
  wells_in_walking_order.each_with_index do |well, well_index|
    tags_per_well.times do |tag_index|
      index = (well_index * tags_per_well) + tag_index
      yield(well, index) unless well.nil?
    end
  end
end