Class: Pacbio::Well
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Pacbio::Well
- Includes:
- Aliquotable, Uuidable
- Defined in:
- app/models/pacbio/well.rb
Overview
Pacbio::Well A well can have many libraries
Constant Summary collapse
- GENERIC_KIT_BARCODE =
'Lxxxxx100938900123199'
Instance Method Summary collapse
-
#adaptive_loading_check ⇒ Boolean
True if loading_target_p1_plus_p2 is present.
-
#aliquots_to_show_per_row ⇒ Object
Returns libraries only if they should be shown per row.
-
#automation_parameters ⇒ String
Set the automation parameters.
-
#barcode_set ⇒ Object
Barcode Set field.
-
#base_used_aliquots ⇒ Object
A collection of all the used_aliquots for given libraries and pools in a well.
-
#bio_sample_name ⇒ Object
Sample bio Name field Returns nil if sample is barcoded otherwise returns the sample names for all of the aliquots.
-
#collection? ⇒ Boolean
Always true for wells, but always false for libraries/aliquots - a gross simplification.
-
#formatted_bio_sample_name ⇒ Object
Returns the formatted bio sample name.
-
#get_plate(plate_number) ⇒ Object
find the plate given the plate_number returns
nil
if no plate found. -
#insert_size ⇒ String
The insert_size of the first used_by aliqout.
-
#libraries? ⇒ Boolean
True if the well has any libraries.
-
#plate_well_position ⇒ Object
Sample Plate Well field.
-
#pools? ⇒ Boolean
True if the well has any pools.
- #position ⇒ Object
-
#position_leading_zero ⇒ Object
Sample Well field.
-
#request_libraries ⇒ Object
collection of all of the requests for a library useful for messaging.
-
#same_barcodes_on_both_ends_of_sequence ⇒ Object
Are the left and right adapters the same? Returns True if tagged, nil otherwise See Aliquot#adapter field method below and adapter and adapter2 fields in pacbio.yml.
-
#sample_is_barcoded ⇒ Object
Used to indicate to the sample sheet whether it should treat a sample as barcoded # Note: This doesn’t actually indicate that a sample is barcoded, as :hidden # tag sets (such as IsoSeq) lie.
-
#sample_names(separator = ':') ⇒ Object
a collection of all the sample names for a particular well useful for comments.
-
#sequencing_kit_box_barcode_plate_1 ⇒ Object
return the sequencing_kit_box_barcode of plate 1 used for 2-plate sample sheets.
-
#sequencing_kit_box_barcode_plate_2 ⇒ Object
return the sequencing_kit_box_barcode of plate 2 used for 2-plate sample sheets.
-
#show_row_per_sample? ⇒ Boolean
Determines rendering of a row-per sample.
- #summary ⇒ Object
-
#tag_set ⇒ TagSet | NullTagSet
The tag set for the first aliquot or null tag set.
-
#tagged? ⇒ Boolean
check if any of the aliquots or libraries in the well are tagged a convenience method for the sample sheet.
-
#tags ⇒ Object
a collection of all the tags for a well useful to check whether they are unique.
-
#template_prep_kit_box_barcode ⇒ String
The template_prep_kit_box_barcode of the first aliquot.
-
#tube_barcode ⇒ Object
Sample Name field.
-
#update_smrt_link_options(options) ⇒ Object
This method is used to update the smrt_link_options for a well It takes a hash of options and updates the smrt_link_options store field with the new values we do a save! at the end to ensure that the changes are persisted it is better to update the smrt link options in the well as it uses a private method.
Methods included from Aliquotable
Methods included from Uuidable
Instance Method Details
#adaptive_loading_check ⇒ Boolean
Returns true if loading_target_p1_plus_p2 is present.
116 117 118 |
# File 'app/models/pacbio/well.rb', line 116 def adaptive_loading_check loading_target_p1_plus_p2.present? end |
#aliquots_to_show_per_row ⇒ Object
Returns libraries only if they should be shown per row
161 162 163 164 165 |
# File 'app/models/pacbio/well.rb', line 161 def aliquots_to_show_per_row return unless show_row_per_sample? base_used_aliquots end |
#automation_parameters ⇒ String
Set the automation parameters
208 209 210 211 212 |
# File 'app/models/pacbio/well.rb', line 208 def automation_parameters return if pre_extension_time == 0 || pre_extension_time.nil? "ExtensionTime=double:#{pre_extension_time}|ExtendFirst=boolean:True" end |
#barcode_set ⇒ Object
Barcode Set field
147 148 149 150 151 |
# File 'app/models/pacbio/well.rb', line 147 def return if tag_set.hidden_sample_sheet_behaviour? tag_set.uuid end |
#base_used_aliquots ⇒ Object
A collection of all the used_aliquots for given libraries and pools in a well
61 62 63 64 |
# File 'app/models/pacbio/well.rb', line 61 def base_used_aliquots used_aliquots.reject(&:marked_for_destruction?) .collect(&:source).collect(&:used_aliquots).flatten end |
#bio_sample_name ⇒ Object
Sample bio Name field Returns nil if sample is barcoded otherwise returns the sample names for all of the aliquots
216 217 218 |
# File 'app/models/pacbio/well.rb', line 216 def bio_sample_name ? nil : sample_names end |
#collection? ⇒ Boolean
Always true for wells, but always false for libraries/aliquots - a gross simplification
111 112 113 |
# File 'app/models/pacbio/well.rb', line 111 def collection? true end |
#formatted_bio_sample_name ⇒ Object
Returns the formatted bio sample name. If the sample is barcoded, it returns nil. Otherwise, it returns the sample names with colons replaced by hyphens.
223 224 225 |
# File 'app/models/pacbio/well.rb', line 223 def formatted_bio_sample_name bio_sample_name&.gsub(':', '-') end |
#get_plate(plate_number) ⇒ Object
find the plate given the plate_number returns nil
if no plate found
175 176 177 |
# File 'app/models/pacbio/well.rb', line 175 def get_plate(plate_number) plate.run.plates.filter { |plate| plate.plate_number == plate_number }.first end |
#insert_size ⇒ String
Returns the insert_size of the first used_by aliqout.
106 107 108 |
# File 'app/models/pacbio/well.rb', line 106 def insert_size base_used_aliquots.first.used_by.insert_size end |
#libraries? ⇒ Boolean
Returns true if the well has any libraries.
96 97 98 |
# File 'app/models/pacbio/well.rb', line 96 def libraries? libraries.present? end |
#plate_well_position ⇒ Object
Sample Plate Well field
142 143 144 |
# File 'app/models/pacbio/well.rb', line 142 def plate_well_position "#{plate.plate_number}_#{position_leading_zero}" end |
#pools? ⇒ Boolean
Returns true if the well has any pools.
91 92 93 |
# File 'app/models/pacbio/well.rb', line 91 def pools? pools.present? end |
#position ⇒ Object
52 53 54 |
# File 'app/models/pacbio/well.rb', line 52 def position "#{row}#{column}" end |
#position_leading_zero ⇒ Object
Sample Well field
137 138 139 |
# File 'app/models/pacbio/well.rb', line 137 def position_leading_zero "#{row}#{column.rjust(2, '0')}" end |
#request_libraries ⇒ Object
collection of all of the requests for a library useful for messaging
68 69 70 |
# File 'app/models/pacbio/well.rb', line 68 def request_libraries raise StandardError, 'Unsupported, fix this' end |
#same_barcodes_on_both_ends_of_sequence ⇒ Object
Are the left and right adapters the same? Returns True if tagged, nil otherwise See Aliquot#adapter field method below and adapter and adapter2 fields in pacbio.yml
201 202 203 |
# File 'app/models/pacbio/well.rb', line 201 def tagged? || nil end |
#sample_is_barcoded ⇒ Object
Used to indicate to the sample sheet whether it should treat a sample as barcoded
Note: This doesn’t actually indicate that a sample is barcoded, as :hidden
tag sets (such as IsoSeq) lie.
194 195 196 |
# File 'app/models/pacbio/well.rb', line 194 def tag_set.default_sample_sheet_behaviour? end |
#sample_names(separator = ':') ⇒ Object
a collection of all the sample names for a particular well useful for comments
74 75 76 |
# File 'app/models/pacbio/well.rb', line 74 def sample_names(separator = ':') base_used_aliquots.collect(&:source).collect(&:sample_name).join(separator) end |
#sequencing_kit_box_barcode_plate_1 ⇒ Object
return the sequencing_kit_box_barcode of plate 1 used for 2-plate sample sheets
181 182 183 |
# File 'app/models/pacbio/well.rb', line 181 def get_plate(1)&. end |
#sequencing_kit_box_barcode_plate_2 ⇒ Object
return the sequencing_kit_box_barcode of plate 2 used for 2-plate sample sheets
187 188 189 |
# File 'app/models/pacbio/well.rb', line 187 def get_plate(2)&. end |
#show_row_per_sample? ⇒ Boolean
Determines rendering of a row-per sample
154 155 156 157 158 |
# File 'app/models/pacbio/well.rb', line 154 def show_row_per_sample? return false if tag_set.hidden_sample_sheet_behaviour? base_used_aliquots.any?(&:tag_id?) end |
#summary ⇒ Object
56 57 58 |
# File 'app/models/pacbio/well.rb', line 56 def summary "#{sample_names} #{comment}".strip end |
#tag_set ⇒ TagSet | NullTagSet
Returns the tag set for the first aliquot or null tag set.
48 49 50 |
# File 'app/models/pacbio/well.rb', line 48 def tag_set base_used_aliquots.collect(&:tag_set).first || NullTagSet.new end |
#tagged? ⇒ Boolean
check if any of the aliquots or libraries in the well are tagged a convenience method for the sample sheet
80 81 82 |
# File 'app/models/pacbio/well.rb', line 80 def tagged? base_used_aliquots.collect(&:tagged?).any? end |
#tags ⇒ Object
a collection of all the tags for a well useful to check whether they are unique
86 87 88 |
# File 'app/models/pacbio/well.rb', line 86 def base_used_aliquots.collect(&:tag_id) end |
#template_prep_kit_box_barcode ⇒ String
Returns the template_prep_kit_box_barcode of the first aliquot.
101 102 103 |
# File 'app/models/pacbio/well.rb', line 101 def base_used_aliquots.first.used_by. end |
#tube_barcode ⇒ Object
Sample Name field
168 169 170 171 |
# File 'app/models/pacbio/well.rb', line 168 def # Gets the first barcode which will either be the pool barcode or the library barcode base_used_aliquots.first.used_by.tube. end |
#update_smrt_link_options(options) ⇒ Object
This method is used to update the smrt_link_options for a well It takes a hash of options and updates the smrt_link_options store field with the new values we do a save! at the end to ensure that the changes are persisted it is better to update the smrt link options in the well as it uses a private method
126 127 128 129 130 131 |
# File 'app/models/pacbio/well.rb', line 126 def () .each do |key, value| write_store_attribute(:smrt_link_options, key, value) end save! end |