Class: AliquotIndexer
- Inherits:
-
Object
- Object
- AliquotIndexer
- Defined in:
- app/models/aliquot_indexer.rb
Overview
The aliquot indexer is passed a Receptacle (usually a Lane) and generates an index for all aliquots. This is a unique index that NPG use to identify deplexed sequencing data. It replaces the previous role of the map id of tag 1 (the i7) and allows a single identifier to be used to represent both indices. - Aliquots are sorted by the tag_2 map id, then the tag_1 map id. - Tags associated with the PhiX tube are excluded. This includes the default phix tag index (configatron.phix_tag.tag_map_id) [888 at time of writing] as well as the actual index if they happen to differ.
Defined Under Namespace
Modules: AliquotScopes, Indexable
Instance Attribute Summary collapse
-
#aliquots ⇒ Array<Aliquot>
readonly
Returns all aliquots due to be indexed.
-
#lane ⇒ Object
readonly
Returns the value of attribute lane.
Class Method Summary collapse
-
.index(lane) ⇒ Bool
Generate an aliquot index for lane.
Instance Method Summary collapse
- #index ⇒ Object
-
#initialize(lane) ⇒ AliquotIndexer
constructor
A new instance of AliquotIndexer.
-
#phix_map_id ⇒ Integer
The actual index of the PhiX used in the lane.
Constructor Details
#initialize(lane) ⇒ AliquotIndexer
Returns a new instance of AliquotIndexer.
43 44 45 46 |
# File 'app/models/aliquot_indexer.rb', line 43 def initialize(lane) @lane = lane @index = 0 end |
Instance Attribute Details
#aliquots ⇒ Array<Aliquot> (readonly)
Returns all aliquots due to be indexed.
60 61 62 |
# File 'app/models/aliquot_indexer.rb', line 60 def aliquots @aliquots end |
#lane ⇒ Object (readonly)
Returns the value of attribute lane.
14 15 16 |
# File 'app/models/aliquot_indexer.rb', line 14 def lane @lane end |
Class Method Details
.index(lane) ⇒ Bool
Generate an aliquot index for lane
39 40 41 |
# File 'app/models/aliquot_indexer.rb', line 39 def self.index(lane) new(lane).index end |
Instance Method Details
#index ⇒ Object
64 65 66 67 |
# File 'app/models/aliquot_indexer.rb', line 64 def index @lane.aliquot_indicies.build(aliquots.map { |a| { aliquot: a, aliquot_index: next_index } }) @lane.save end |
#phix_map_id ⇒ Integer
The actual index of the PhiX used in the lane. Note: PhiX isn’t actually present as an aliquot within the lane, instead the PhiX tube is associated with the Lane as a parent asset.
52 53 54 55 56 |
# File 'app/models/aliquot_indexer.rb', line 52 def phix_map_id return nil if lane.spiked_in_buffer.blank? @phix_map_id ||= lane.spiked_in_buffer.primary_aliquot.tag.try(:map_id) end |