Class: SequencescapeExcel::SpecialisedField::ChromiumTagWell

Inherits:
Object
  • Object
show all
Includes:
Base
Defined in:
app/sequencescape_excel/sequencescape_excel/specialised_field/chromium_tag_well.rb

Overview

ChromiumTagWell

Constant Summary collapse

TAGS_PER_WELL =
4

Instance Attribute Summary collapse

Attributes included from Base

#sample_manifest_asset, #value

Instance Method Summary collapse

Instance Attribute Details

#sf_tag_groupObject

Returns the value of attribute sf_tag_group.



12
13
14
# File 'app/sequencescape_excel/sequencescape_excel/specialised_field/chromium_tag_well.rb', line 12

def sf_tag_group
  @sf_tag_group
end

Instance Method Details



33
34
35
# File 'app/sequencescape_excel/sequencescape_excel/specialised_field/chromium_tag_well.rb', line 33

def link(other_fields)
  self.sf_tag_group = other_fields[SequencescapeExcel::SpecialisedField::ChromiumTagGroup]
end

#update(_attributes = {}) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'app/sequencescape_excel/sequencescape_excel/specialised_field/chromium_tag_well.rb', line 18

def update(_attributes = {})
  return unless valid?

  if asset.aliquots.one?
    tags.each { |tag| tag.multitag!(asset) }
  elsif aliquot_count == TAGS_PER_WELL
    tags.zip(aliquots).each { |tag, aliquot| aliquot.assign_attributes(tag:) }
  else
    # We should never end up here, as our validation should handle this
    # However if that fails, something has gone wrong, and we shouldn't proceed
    # Fail noisily
    raise StandardError, 'Tag aliquot mismatch'
  end
end