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

This class represents a single index tag well for Chromium.

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



41
42
43
# File 'app/sequencescape_excel/sequencescape_excel/specialised_field/chromium_tag_well.rb', line 41

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

#update(_attributes = {}) ⇒ Object

Updates the tag well.

This method updates the tag well if it is valid. It assigns tags to aliquots based on the number of aliquots.

Parameters:

  • _attributes (Hash) (defaults to: {})

    The attributes to update (optional).



26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'app/sequencescape_excel/sequencescape_excel/specialised_field/chromium_tag_well.rb', line 26

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