Class: PhiX::Stock

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model
Defined in:
app/models/phi_x/stock.rb

Overview

PhiX

PhiX is a well characterized bacteriophage with a small, known, genome. It is used to provide short DNA sequences which can get added to sequencing lanes for control and calibration purposes.

Process

PhiX samples arrive on site and have tags applied as required. These may single indexed (i7 only) or dual indexed (i5 & i7) as required. The single and dual indexed tag sets are fixed and are selected from the 'Control Tag Group 888' TagGroup.

Library information is filled in on the PhiXesController#show page and one or more library tubes are generated via PhiX::StocksController#create and the Stock factory. These tubes are considered stocks, and get transferred to the sequencing teams.

Subsequently the sequencing team will split the contents of each LibraryTube into a number of SpikedBuffer tubes, adjusting the volume and concentration as required. This is achieved via a separate form on the PhiXesController#show page, followed by PhiX::SpikedBuffersController#create and the SpikedBuffer factory.

Finally, during the processing of a SequencingPipeline the SpikedBuffer barcode is scanned in during the AddSpikedInControlTask. This adds the SpikedBuffer in as a parent of each Lane in the Batch, which in turn ensures the control can be found by batch.xml generation and Api::Messages::FlowcellIO.

Configuration

Configuration and values are stored in config/phi_x.yml tag_group_name: The name of the tag group to use tag_map_id: The default map_id for tags tag_options: Hash of available tag options, indexed by option name.

Values are hashes of i5 and i7 oligos. null indicates no tag.

default_tag_option: The option which will be initially selected

PhiX::Stock acts as a factory to generate the required library tubes

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#concentrationFloat

Returns The concentration of the created library in nM

Returns:

  • (Float)

    The concentration of the created library in nM


17
18
19
# File 'app/models/phi_x/stock.rb', line 17

def concentration
  @concentration
end

#nameString

Returns the base name for the created library tubes Will be appended with #n to distinguish multiple tubes. eg. ('Tube name #1', 'Tube name #2')

Returns:

  • (String)

    the base name for the created library tubes Will be appended with #n to distinguish multiple tubes. eg. ('Tube name #1', 'Tube name #2')


12
13
14
# File 'app/models/phi_x/stock.rb', line 12

def name
  @name
end

#numberInteger

Returns The number of library tubes to create

Returns:


19
20
21
# File 'app/models/phi_x/stock.rb', line 19

def number
  @number
end

#tagsString

Returns The name for the set of tags to apply. eg. 'Single', 'Dual' Valid options are taken from PhiX.tag_option_names

Returns:

  • (String)

    The name for the set of tags to apply. eg. 'Single', 'Dual' Valid options are taken from PhiX.tag_option_names


15
16
17
# File 'app/models/phi_x/stock.rb', line 15

def tags
  @tags
end

Instance Method Details

#created_stocksArray

Returns the stocks that were create as part of #save Will be an empty array if called before the #save method

Returns:

  • (Array)

    Array of the stocks created by the factory.


42
43
44
# File 'app/models/phi_x/stock.rb', line 42

def created_stocks
  @created_stocks || []
end

#saveBoolean

Generates stocks if the factory is valid, otherwise returns false and does nothing

Returns:

  • (Boolean)

    true if the operation completed successfully, false otherwise


30
31
32
33
34
35
# File 'app/models/phi_x/stock.rb', line 30

def save
  return false unless valid?

  @created_stocks = generate_stocks
  true
end