Class: SampleManifest::LibraryTubeBehaviour::Core

Inherits:
SharedTubeBehaviour::Base show all
Includes:
CoreBehaviour::LibraryAssets
Defined in:
app/models/sample_manifest/library_tube_behaviour.rb

Overview

Behaviour for generating a library tube

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from CoreBehaviour::LibraryAssets

#generate_sample_and_aliquot, #stocks?

Methods inherited from SharedTubeBehaviour::Base

#details_array, #updated_by!

Methods included from CoreBehaviour::Shared

#details, #generate_sanger_ids, included

Constructor Details

#initialize(manifest) ⇒ Core

Returns a new instance of Core.



15
16
17
18
# File 'app/models/sample_manifest/library_tube_behaviour.rb', line 15

def initialize(manifest)
  @manifest = manifest
  @tubes = []
end

Instance Attribute Details

#tubesObject (readonly)

Returns the value of attribute tubes.



13
14
15
# File 'app/models/sample_manifest/library_tube_behaviour.rb', line 13

def tubes
  @tubes
end

Instance Method Details

#acceptable_purposesObject



45
46
47
# File 'app/models/sample_manifest/library_tube_behaviour.rb', line 45

def acceptable_purposes
  Purpose.none
end

#default_purposeObject



49
50
51
# File 'app/models/sample_manifest/library_tube_behaviour.rb', line 49

def default_purpose
  Tube::Purpose.standard_library_tube
end

#generateObject



20
21
22
# File 'app/models/sample_manifest/library_tube_behaviour.rb', line 20

def generate
  @tubes = generate_tubes(Tube::Purpose.standard_library_tube)
end

#included_resourcesObject



53
54
55
# File 'app/models/sample_manifest/library_tube_behaviour.rb', line 53

def included_resources
  [{ sample: :sample_metadata, asset: %i[barcodes aliquots] }]
end

#io_samplesObject



24
25
26
27
28
29
30
31
32
33
34
# File 'app/models/sample_manifest/library_tube_behaviour.rb', line 24

def io_samples
  samples.map do |sample|
    {
      sample: sample,
      container: {
        barcode: sample.primary_receptacle.human_barcode
      },
      library_information: sample.primary_receptacle.library_information
    }
  end
end

#labwareObject Also known as: printables



40
41
42
# File 'app/models/sample_manifest/library_tube_behaviour.rb', line 40

def labware
  tubes | labware_from_samples | @manifest.assets.map(&:labware)
end

#labware_from_samplesObject



36
37
38
# File 'app/models/sample_manifest/library_tube_behaviour.rb', line 36

def labware_from_samples
  samples.map { |sample| sample.primary_receptacle.labware }
end