Class: Aliquot
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Aliquot
- Includes:
- Uuidable
- Defined in:
- app/models/aliquot.rb
Overview
A portion of a sample that is used for a library, sample or pool. An aliquot can be a primary aliquot or a derived aliquot. An aliquot can be used to track volumes and concentrations of samples.
Class Method Summary collapse
-
.publishable ⇒ Object
Returns a list of all the aliquots that are publishable.
-
.used_by_well_library_aliquots(aliquots) ⇒ Object
Find aliquots from a Pacbio::Pool used by a Pacbio::Well and add their source’s used aliquots if from a Pacbio::Library.
Instance Method Summary collapse
-
#adapter ⇒ Object
Sample Adapter field The same adapter is used for both left and right, see same_barcodes_on_both_ends_of_sequence Returns nil if the tag is nil.
-
#barcode_name ⇒ Object
Barcode Name field Deprecated as of SMRT-Link v13.0 See www.pacb.com/wp-content/uploads/SMRT-Link-Release-Notes-v13.0.pdf.
-
#bio_sample_name ⇒ Object
Sample bio Name field.
-
#collection? ⇒ Boolean
Generic method used by pacbio sample sheet generation to determine whether the data is a collection or not.
-
#formatted_bio_sample_name ⇒ Object
Returns the formatted bio sample name.
-
#tag_set ⇒ Object
Returns the tag set for the aliquot If the tag_set is nil, it returns a NullTagSet.
-
#tagged? ⇒ Boolean
Checks if the aliquot is tagged.
Methods included from Uuidable
Class Method Details
.publishable ⇒ Object
Returns a list of all the aliquots that are publishable.
53 54 55 56 57 58 59 |
# File 'app/models/aliquot.rb', line 53 def self.publishable [].tap do |aliquots| filtered_aliquots = filter_by_publishable.to_a aliquots.concat(filtered_aliquots) aliquots.concat(used_by_well_library_aliquots(filtered_aliquots)) end end |
.used_by_well_library_aliquots(aliquots) ⇒ Object
Find aliquots from a Pacbio::Pool used by a Pacbio::Well and add their source’s used aliquots if from a Pacbio::Library
63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'app/models/aliquot.rb', line 63 def self.used_by_well_library_aliquots(aliquots) well_aliquots = aliquots.select do |aliquot| aliquot.source_type == 'Pacbio::Pool' && aliquot.used_by_type == 'Pacbio::Well' end [].tap do |library_aliquots| well_aliquots.each do |aliquot| library_aliquots.concat(aliquot.source.used_aliquots.select do |used_aliquot| used_aliquot.source_type == 'Pacbio::Library' end) end end end |
Instance Method Details
#adapter ⇒ Object
Sample Adapter field The same adapter is used for both left and right, see same_barcodes_on_both_ends_of_sequence Returns nil if the tag is nil
130 131 132 |
# File 'app/models/aliquot.rb', line 130 def adapter tag&.group_id end |
#barcode_name ⇒ Object
Barcode Name field Deprecated as of SMRT-Link v13.0 See www.pacb.com/wp-content/uploads/SMRT-Link-Release-Notes-v13.0.pdf
121 122 123 124 125 |
# File 'app/models/aliquot.rb', line 121 def return if tag_set.hidden_sample_sheet_behaviour? "#{tag.group_id}--#{tag.group_id}" end |
#bio_sample_name ⇒ Object
Sample bio Name field
105 106 107 108 109 |
# File 'app/models/aliquot.rb', line 105 def bio_sample_name return '' if tag_set.hidden_sample_sheet_behaviour? source.sample_name || '' end |
#collection? ⇒ Boolean
Generic method used by pacbio sample sheet generation to determine whether the data is a collection or not. Assuming false is a simplification used previously for sample-sheets
100 101 102 |
# File 'app/models/aliquot.rb', line 100 def collection? false end |
#formatted_bio_sample_name ⇒ Object
Returns the formatted bio sample name. Replaces all colons (:) in the bio sample name with hyphens (-).
114 115 116 |
# File 'app/models/aliquot.rb', line 114 def formatted_bio_sample_name bio_sample_name.gsub(':', '-') end |
#tag_set ⇒ Object
Returns the tag set for the aliquot If the tag_set is nil, it returns a NullTagSet
78 79 80 |
# File 'app/models/aliquot.rb', line 78 def tag_set super || NullTagSet.new end |
#tagged? ⇒ Boolean
Checks if the aliquot is tagged. An aliquot is considered tagged if it has a non-nil and non-empty tag.
88 89 90 91 92 93 94 95 |
# File 'app/models/aliquot.rb', line 88 def tagged? # This feels like a bit of a hack but I wasn't exactly sure where the best place to # it. I tried to follow the sample sheet behaviour but got lost. # it looks like the only place this is used is in the sample sheet generation return false if tag.nil? tag_set.default_sample_sheet_behaviour? end |