Class: SampleManifest::MultiplexedLibraryBehaviour::Core
Constant Summary
collapse
- MxLibraryTubeException =
for #multiplexed_library_tube
Class.new(ActiveRecord::RecordNotFound)
Instance Attribute Summary collapse
Instance Method Summary
collapse
#generate_sample_and_aliquot, #stocks?
#details_array, #updated_by!
#details, #generate_sanger_ids, included
Constructor Details
#initialize(manifest) ⇒ Core
Returns a new instance of Core.
11
12
13
|
# File 'app/models/sample_manifest/multiplexed_library_behaviour.rb', line 11
def initialize(manifest)
@manifest = manifest
end
|
Instance Attribute Details
#library_tubes ⇒ Object
Returns the value of attribute library_tubes.
9
10
11
|
# File 'app/models/sample_manifest/multiplexed_library_behaviour.rb', line 9
def library_tubes
@library_tubes
end
|
Instance Method Details
#acceptable_purposes ⇒ Object
38
39
40
|
# File 'app/models/sample_manifest/multiplexed_library_behaviour.rb', line 38
def acceptable_purposes
Purpose.none
end
|
#default_purpose ⇒ Object
#generate ⇒ Object
15
16
17
18
|
# File 'app/models/sample_manifest/multiplexed_library_behaviour.rb', line 15
def generate
@library_tubes = generate_tubes(Tube::Purpose.standard_library_tube)
@mx_tube = generate_mx_library
end
|
#generate_mx_library ⇒ Object
#included_resources ⇒ Object
76
77
78
|
# File 'app/models/sample_manifest/multiplexed_library_behaviour.rb', line 76
def included_resources
[{ sample: :sample_metadata, asset: [:barcodes, :aliquots, { requests: :target_asset }] }]
end
|
#io_samples ⇒ Object
26
27
28
29
30
31
32
33
34
35
36
|
# File 'app/models/sample_manifest/multiplexed_library_behaviour.rb', line 26
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
|
#labware ⇒ Object
68
69
70
|
# File 'app/models/sample_manifest/multiplexed_library_behaviour.rb', line 68
def labware
[multiplexed_library_tube]
end
|
#labware=(labware) ⇒ Object
62
63
64
65
66
|
# File 'app/models/sample_manifest/multiplexed_library_behaviour.rb', line 62
def labware=(labware)
raise ArgumentError, 'labware should contain only one element' if labware.count > 1
@mx_tube = labware.first
end
|
#multiplexed_library_tube ⇒ Object
46
47
48
|
# File 'app/models/sample_manifest/multiplexed_library_behaviour.rb', line 46
def multiplexed_library_tube
mx_tube || raise(MxLibraryTubeException.new, 'Mx tube not found')
end
|
#mx_tube ⇒ Object
50
51
52
|
# File 'app/models/sample_manifest/multiplexed_library_behaviour.rb', line 50
def mx_tube
@mx_tube ||= mx_tube_from_manifest_asset
end
|
#mx_tube_from_manifest_asset ⇒ Object
54
55
56
|
# File 'app/models/sample_manifest/multiplexed_library_behaviour.rb', line 54
def mx_tube_from_manifest_asset
@manifest.assets.first&.external_library_creation_requests&.first&.target_asset
end
|
#pending_external_library_creation_requests ⇒ Object
58
59
60
|
# File 'app/models/sample_manifest/multiplexed_library_behaviour.rb', line 58
def pending_external_library_creation_requests
multiplexed_library_tube.requests_as_target.for_state('pending')
end
|
#printables ⇒ Object
72
73
74
|
# File 'app/models/sample_manifest/multiplexed_library_behaviour.rb', line 72
def printables
multiplexed_library_tube.labware
end
|