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 Attribute Summary collapse
-
#annotations_attributes ⇒ Object
readonly
Returns the value of attribute annotations_attributes.
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 Attribute Details
#annotations_attributes ⇒ Object (readonly)
Returns the value of attribute annotations_attributes.
51 52 53 |
# File 'app/models/pacbio/well.rb', line 51 def annotations_attributes @annotations_attributes end |
Instance Method Details
#adaptive_loading_check ⇒ Boolean
Returns true if loading_target_p1_plus_p2 is present.
122 123 124 |
# File 'app/models/pacbio/well.rb', line 122 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
167 168 169 170 171 |
# File 'app/models/pacbio/well.rb', line 167 def aliquots_to_show_per_row return unless show_row_per_sample? base_used_aliquots end |
#automation_parameters ⇒ String
Set the automation parameters
214 215 216 217 218 |
# File 'app/models/pacbio/well.rb', line 214 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
153 154 155 156 157 |
# File 'app/models/pacbio/well.rb', line 153 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
67 68 69 70 |
# File 'app/models/pacbio/well.rb', line 67 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
222 223 224 |
# File 'app/models/pacbio/well.rb', line 222 def bio_sample_name ? nil : sample_names end |
#collection? ⇒ Boolean
Always true for wells, but always false for libraries/aliquots - a gross simplification
117 118 119 |
# File 'app/models/pacbio/well.rb', line 117 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.
229 230 231 |
# File 'app/models/pacbio/well.rb', line 229 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
181 182 183 |
# File 'app/models/pacbio/well.rb', line 181 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.
112 113 114 |
# File 'app/models/pacbio/well.rb', line 112 def insert_size base_used_aliquots.first.used_by.insert_size end |
#libraries? ⇒ Boolean
Returns true if the well has any libraries.
102 103 104 |
# File 'app/models/pacbio/well.rb', line 102 def libraries? libraries.present? end |
#plate_well_position ⇒ Object
Sample Plate Well field
148 149 150 |
# File 'app/models/pacbio/well.rb', line 148 def plate_well_position "#{plate.plate_number}_#{position_leading_zero}" end |
#pools? ⇒ Boolean
Returns true if the well has any pools.
97 98 99 |
# File 'app/models/pacbio/well.rb', line 97 def pools? pools.present? end |
#position ⇒ Object
58 59 60 |
# File 'app/models/pacbio/well.rb', line 58 def position "#{row}#{column}" end |
#position_leading_zero ⇒ Object
Sample Well field
143 144 145 |
# File 'app/models/pacbio/well.rb', line 143 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
74 75 76 |
# File 'app/models/pacbio/well.rb', line 74 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
207 208 209 |
# File 'app/models/pacbio/well.rb', line 207 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.
200 201 202 |
# File 'app/models/pacbio/well.rb', line 200 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
80 81 82 |
# File 'app/models/pacbio/well.rb', line 80 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
187 188 189 |
# File 'app/models/pacbio/well.rb', line 187 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
193 194 195 |
# File 'app/models/pacbio/well.rb', line 193 def get_plate(2)&. end |
#show_row_per_sample? ⇒ Boolean
Determines rendering of a row-per sample
160 161 162 163 164 |
# File 'app/models/pacbio/well.rb', line 160 def show_row_per_sample? return false if tag_set.hidden_sample_sheet_behaviour? base_used_aliquots.any?(&:tag_id?) end |
#summary ⇒ Object
62 63 64 |
# File 'app/models/pacbio/well.rb', line 62 def summary sample_names.to_s end |
#tag_set ⇒ TagSet | NullTagSet
Returns the tag set for the first aliquot or null tag set.
54 55 56 |
# File 'app/models/pacbio/well.rb', line 54 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
86 87 88 |
# File 'app/models/pacbio/well.rb', line 86 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
92 93 94 |
# File 'app/models/pacbio/well.rb', line 92 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.
107 108 109 |
# File 'app/models/pacbio/well.rb', line 107 def base_used_aliquots.first.used_by. end |
#tube_barcode ⇒ Object
Sample Name field
174 175 176 177 |
# File 'app/models/pacbio/well.rb', line 174 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
132 133 134 135 136 137 |
# File 'app/models/pacbio/well.rb', line 132 def () .each do |key, value| write_store_attribute(:smrt_link_options, key, value) end save! end |