Class: Pacbio::Library
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Pacbio::Library
- Includes:
- Aliquotable, DualSourcedLibrary, Librarian, Material, Uuidable
- Defined in:
- app/models/pacbio/library.rb
Overview
Pacbio::Library A Pacbio Library is capable of being multiplexed i.e. is capable of containing several samples in the form of requests. A library can have many requests but can also belong to many requests A library can be sequenced in more than one well. This is achieved using a has many through relationship
Instance Method Summary collapse
-
#collection? ⇒ Boolean
Always false for libraries, but always true for wells - a gross simplification.
- #create_used_aliquot ⇒ Object
-
#sequencing_plates ⇒ Array
Note - This does not take into account when a library is used in a pool and that pool is used in a run.
-
#sequencing_runs ⇒ Array
Note - This does not take into account when a library is used in a pool and that pool is used in a run.
-
#tagged? ⇒ Boolean
Checks if the library is tagged.
-
#update_used_aliquots ⇒ Object
Updates the used aliquots data when the primary aliquot is updated.
Methods included from DualSourcedLibrary
Methods included from Aliquotable
Methods included from Librarian
#active?, #deactivate, #set_state
Methods included from Uuidable
Methods included from Material
Instance Method Details
#collection? ⇒ Boolean
Always false for libraries, but always true for wells - a gross simplification
89 90 91 |
# File 'app/models/pacbio/library.rb', line 89 def collection? false end |
#create_used_aliquot ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'app/models/pacbio/library.rb', line 61 def create_used_aliquot return if used_aliquots.any? used_aliquots.create( source: request, aliquot_type: :derived, volume:, concentration:, template_prep_kit_box_barcode:, insert_size:, tag: ) end |
#sequencing_plates ⇒ Array
Note - This does not take into account when a library is used in a pool and that pool is used in a run
112 113 114 |
# File 'app/models/pacbio/library.rb', line 112 def sequencing_plates wells&.collect(&:plate) end |
#sequencing_runs ⇒ Array
Note - This does not take into account when a library is used in a pool and that pool is used in a run
105 106 107 |
# File 'app/models/pacbio/library.rb', line 105 def sequencing_runs wells&.collect(&:run)&.uniq end |
#tagged? ⇒ Boolean
Checks if the library is tagged.
An library is considered tagged if it has a non-nil and non-empty tag.
98 99 100 |
# File 'app/models/pacbio/library.rb', line 98 def tagged? tag.present? end |
#update_used_aliquots ⇒ Object
Updates the used aliquots data when the primary aliquot is updated
76 77 78 79 80 81 82 83 84 85 86 |
# File 'app/models/pacbio/library.rb', line 76 def update_used_aliquots used_aliquots.each do |aliquot| aliquot.update( volume: primary_aliquot.volume, concentration: primary_aliquot.concentration, template_prep_kit_box_barcode: primary_aliquot., insert_size: primary_aliquot.insert_size, tag: primary_aliquot.tag ) end end |