Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DPL-947 dna control barcode v12 sequel i ie #1143

Merged
merged 16 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions app/models/concerns/sample_sheet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,17 @@
module SampleSheet
# Provides run helper methods for sample sheet generation
module Run
# Returns a list of wells associated with the plate in column order
# Example: [<Well position:'A1'>, <Well position:'A2'>, <Well position:'B1'>]) =>
# [<Well position:'A1'>, <Well position:'B1'>, <Well position:'A2'>]
# Returns a list of wells associated with all plates which are sorted by plate first and
# then by wells in column order
# Example: ([<Plate plate_number:1>
# [<Well position:'A1'>, <Well position:'A2'>,<Well position:'B1'>]<Plate>
# <Plate plate_number:2>
# [<Well position:'A3'>, <Well position:'A4'>,<Well position:'B3'>]<Plate>]) =>
# [<Well position:'A1'>, <Well position:'B1'>, <Well position:'A2'>,<Well position:'A3'>
# <Well position:'A3'>,<Well position:'B3'>,<Well position:'A4'>],
def sorted_wells
wells.sort_by { |well| [well.column.to_i, well.row] }
sorted_plates = plates.sort_by(&:plate_number)
sorted_plates.flat_map { |plate| plate.wells.sort_by { |well| [well.column.to_i, well.row] } }
end
end

Expand Down
16 changes: 12 additions & 4 deletions app/validators/required_attributes_validator.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
# frozen_string_literal: true

# Validator for required attributes
# Validates the presence of required attributes
# Validates the presence of required attributes and versions
class RequiredAttributesValidator < ActiveModel::Validator
attr_reader :required_attributes
attr_reader :required_attributes, :versions
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Versions aren't needed anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, missed out. Removed now 👍


# @param [Hash] options
# @option options [Array] :required_attributes
def initialize(options)
super

@versions = options[:versions]
@required_attributes = options[:required_attributes]
end

Expand All @@ -24,8 +26,14 @@ def validate(record)
# @param [ActiveRecord::Base] record
# @param [Symbol] required_attribute
def validate_required_attribute(record, required_attribute)
return if record.send(required_attribute).present?
# If versions are specified, check that the record's smrt_link_version version
# is included in the list
if versions.present? && versions.exclude?(record.smrt_link_version.name)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can remove this now.

nil
else
return if record.send(required_attribute).present?

record.errors.add(required_attribute, "can't be blank")
record.errors.add(required_attribute, "can't be blank")
end
end
end
1 change: 1 addition & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class Application < Rails::Application

# RabbitMQ config
config.bunny = config_for(:bunny)

config.pacbio_instrument_types = config_for(:pacbio_instrument_types)

# Pacbio default request cost code
Expand Down
1 change: 1 addition & 0 deletions config/feature_flags.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Add feature flags to this file, example:
# dpl202_enable_angry_cat_feature: When enabled this will add an angry cat to all pages that will try to catch the mouse pointer
# The key should be lowecase and snake case, and prefixes with the issue number to allow easy identification

{}
47 changes: 26 additions & 21 deletions config/pacbio_instrument_types.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ default: &default
attribute: :plates
minimum: 1
maximum: 1
# TODO: fix this to have separate behaviour for v11 and v12 (see commit 05bfe764a8eafe)
required_attributes:
options:
versions:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can definitely remove the versions code but wait to hear back from Craig as to whether this needs to be required. It wasn't previously.

- v12_sequel_iie
required_attributes:
- :dna_control_complex_box_barcode
plates:
children: :wells
# we want to validate each plate and plate
Expand Down Expand Up @@ -73,31 +78,31 @@ default: &default
options:
exclude_marked_for_destruction: true
valid_positions:
- A1
- B1
- C1
- D1
- A1
- B1
- C1
- D1
well_combinations:
invalid_combinations:
- [A1,D1]
- [A1,C1]
- [B1,D1]
- [A1,C1,D1]
- [A1,B1,D1]
- [D1,B1]
- [A1, D1]
- [A1, C1]
- [B1, D1]
- [A1, C1, D1]
- [A1, B1, D1]
- [D1, B1]
options:
exclude_marked_for_destruction: true
valid_combinations:
- [A1]
- [A1,B1]
- [A1,B1,C1]
- [A1,B1,C1,D1]
- [B1]
- [B1,C1]
- [B1,C1,D1]
- [C1]
- [C1,D1]
- [D1]
- [A1]
- [A1, B1]
- [A1, B1, C1]
- [A1, B1, C1, D1]
- [B1]
- [B1, C1]
- [B1, C1, D1]
- [C1]
- [C1, D1]
- [D1]
sequencing_kit_box_barcode:
options:
exclude_marked_for_destruction: true
Expand Down
58 changes: 28 additions & 30 deletions config/pacbio_smrt_link_versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,22 @@ default: &default
default: false
v11:
name: v11
active: true
default: true
active: false
default: false
v12_revio:
name: v12_revio
active: true
default: false
v12_sequel_iie:
name: v12_sequel_iie
active: true
default: false
default: true

options:
ccs_analysis_output:
key: ccs_analysis_output
label: 'CCS Analysis Output'
default_value: 'Yes'
label: "CCS Analysis Output"
default_value: "Yes"
validations:
presence: {}
inclusion:
Expand All @@ -42,20 +42,20 @@ default: &default
- v10
generate_hifi:
key: generate_hifi
label: 'Generate HiFi'
default_value: On Instrument
label: "Generate HiFi"
default_value: On Instrument
validations:
presence: {}
inclusion:
in: *generate
data_type: list
select_options: *select_generate
versions:
versions:
- v10
ccs_analysis_output_include_kinetics_information:
key: ccs_analysis_output_include_kinetics_information
label: 'Include Kinetics Information'
default_value: 'Yes'
label: "Include Kinetics Information"
default_value: "Yes"
validations:
presence: {}
inclusion:
Expand All @@ -67,8 +67,8 @@ default: &default
- v12_sequel_iie
ccs_analysis_output_include_low_quality_reads:
key: ccs_analysis_output_include_low_quality_reads
label: 'Include Low Quality Reads'
default_value: 'Yes'
label: "Include Low Quality Reads"
default_value: "Yes"
validations:
presence: {}
inclusion:
Expand All @@ -80,8 +80,8 @@ default: &default
- v12_sequel_iie
include_fivemc_calls_in_cpg_motifs:
key: include_fivemc_calls_in_cpg_motifs
label: 'Include 5mC Calls In CpG Motifs'
default_value: 'Yes'
label: "Include 5mC Calls In CpG Motifs"
default_value: "Yes"
validations:
presence: {}
inclusion:
Expand All @@ -93,8 +93,8 @@ default: &default
- v12_sequel_iie
demultiplex_barcodes:
key: demultiplex_barcodes
label: 'Demultiplex Barcodes'
default_value: 'In SMRT Link'
label: "Demultiplex Barcodes"
default_value: "In SMRT Link"
validations:
presence: {}
inclusion:
Expand All @@ -106,7 +106,7 @@ default: &default
- v12_sequel_iie
on_plate_loading_concentration:
key: on_plate_loading_concentration
label: 'On Plate Loading Concentration (mP)'
label: "On Plate Loading Concentration (mP)"
default_value:
validations:
presence: {}
Expand All @@ -117,7 +117,7 @@ default: &default
- v12_sequel_iie
binding_kit_box_barcode:
key: binding_kit_box_barcode
label: 'Binding Kit Box Barcode'
label: "Binding Kit Box Barcode"
default_value:
validations:
presence: {}
Expand All @@ -128,8 +128,8 @@ default: &default
- v12_sequel_iie
pre_extension_time:
key: pre_extension_time
label: 'Pre-extension time'
default_value: '2'
label: "Pre-extension time"
default_value: "2"
validations:
numericality:
allow_blank: true
Expand All @@ -141,8 +141,8 @@ default: &default
- v12_sequel_iie
loading_target_p1_plus_p2:
key: loading_target_p1_plus_p2
label: 'Loading Target (P1 + P2)'
default_value: '0.85'
label: "Loading Target (P1 + P2)"
default_value: "0.85"
validations:
numericality:
allow_blank: true
Expand All @@ -155,7 +155,7 @@ default: &default
- v12_sequel_iie
movie_time:
key: movie_time
label: 'Movie Time (hrs)'
label: "Movie Time (hrs)"
default_value:
validations:
presence: {}
Expand All @@ -170,7 +170,7 @@ default: &default
- v12_sequel_iie
movie_acquisition_time:
key: movie_acquisition_time
label: 'Movie Acquisition Time (hrs)'
label: "Movie Acquisition Time (hrs)"
default_value:
validations:
presence: {}
Expand All @@ -183,8 +183,8 @@ default: &default
- v12_revio
include_base_kinetics:
key: include_base_kinetics
label: 'Include Base Kinetics'
default_value: 'True'
label: "Include Base Kinetics"
default_value: "True"
validations:
presence: {}
inclusion:
Expand All @@ -195,7 +195,7 @@ default: &default
- v12_revio
library_concentration:
key: library_concentration
label: 'Library Concentration (pM)'
label: "Library Concentration (pM)"
default_value:
validations:
presence: {}
Expand All @@ -204,16 +204,14 @@ default: &default
- v12_revio
polymerase_kit:
key: polymerase_kit
label: 'Polymerase Kit'
label: "Polymerase Kit"
default_value:
validations:
presence: {}
data_type: string
versions:
- v12_revio



development: *default
test: *default
production: *default
Expand Down
4 changes: 4 additions & 0 deletions config/pipelines/pacbio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,7 @@ default: &default
- Binding Kit Box Barcode
- Sequencing Kit Box Barcode
- On-Plate Loading Concentration (pM)
- DNA Control Complex Box Barcode
- Run Comments
- Sample is Barcoded
- Barcode Name
Expand Down Expand Up @@ -586,6 +587,9 @@ default: &default
On-Plate Loading Concentration (pM):
type: :model
value: on_plate_loading_concentration
DNA Control Complex Box Barcode:
type: :model
value: plate.run.dna_control_complex_box_barcode
Run Comments:
type: :model
value: plate.run.comments
Expand Down
3 changes: 3 additions & 0 deletions lib/tasks/pacbio_data.rake
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,10 @@ namespace :pacbio_data do

print '-> Finding Pacbio SMRT Link versions...'
v11 = Pacbio::SmrtLinkVersion.find_by!(name: 'v11')
v11.update(default: false, active: false)
v12_revio = Pacbio::SmrtLinkVersion.find_by!(name: 'v12_revio')
v12_sequel_iie = Pacbio::SmrtLinkVersion.find_by!(name: 'v12_sequel_iie')
v12_sequel_iie.update(default: true, active: true)
print COMPLETED

puts '-> Creating pacbio runs:'
Expand Down Expand Up @@ -166,6 +168,7 @@ namespace :pacbio_data do
name: "RUN-#{v12_sequel_iie.name}-#{pool_name}-#{total_plate}_plate",
system_name: Pacbio::Run.system_names['Sequel IIe'],
smrt_link_version: v12_sequel_iie,
dna_control_complex_box_barcode: "DCCB_#{barcode}",
plates: (1..total_plate).map do |plate_number|
Pacbio::Plate.new(
sequencing_kit_box_barcode: '130429101826100021624',
Expand Down
3 changes: 3 additions & 0 deletions spec/exchanges/run_csv/pacbio_sample_sheet_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@
well.binding_kit_box_barcode,
well.plate.sequencing_kit_box_barcode,
well.on_plate_loading_concentration.to_s,
well.plate.run.dna_control_complex_box_barcode,
well.plate.run.comments,
well.show_row_per_sample?.to_s,
nil, # barcode name - does not apply
Expand Down Expand Up @@ -287,6 +288,7 @@
nil,
nil,
nil,
nil,
well.libraries.first.barcode_name,
nil,
nil,
Expand Down Expand Up @@ -348,6 +350,7 @@
well.binding_kit_box_barcode,
well.plate.sequencing_kit_box_barcode,
well.on_plate_loading_concentration.to_s,
well.plate.run.dna_control_complex_box_barcode,
well.plate.run.comments,
well.sample_is_barcoded.to_s,
nil, # barcode name - does not apply
Expand Down
4 changes: 2 additions & 2 deletions spec/lib/tasks/pacbio_data.rake_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
RSpec.describe 'RakeTasks' do
before do
Pacbio::SmrtLinkVersion.find_by(name: 'v10') || create(:pacbio_smrt_link_version, name: 'v10')
Pacbio::SmrtLinkVersion.find_by(name: 'v11') || create(:pacbio_smrt_link_version, name: 'v11', default: true)
Pacbio::SmrtLinkVersion.find_by(name: 'v11') || create(:pacbio_smrt_link_version, name: 'v11')
Pacbio::SmrtLinkVersion.find_by(name: 'v12_revio') || create(:pacbio_smrt_link_version, name: 'v12_revio')
Pacbio::SmrtLinkVersion.find_by(name: 'v12_sequel_iie') || create(:pacbio_smrt_link_version, name: 'v12_sequel_iie')
Pacbio::SmrtLinkVersion.find_by(name: 'v12_sequel_iie') || create(:pacbio_smrt_link_version, name: 'v12_sequel_iie', default: true)
end

describe 'create pacbio runs' do
Expand Down
Loading
Loading