Module: Submission::ScrnaCoreCdnaPrepFeasibilityValidator

Includes:
ScrnaCoreCdnaPrepFeasibilityCalculator
Included in:
ValidationsByTemplateName
Defined in:
app/models/submission/scrna_core_cdna_prep_feasibility_validator.rb

Overview

This module provides methods for additional validations for bulk submissions. It checks if the pooling strategy given in an scRNA core cDNA prep submission is feasible so that it can be adjusted earlier at the submission stage rather than at the pooling stage. It generates error messages for the following criteria:

  • Total number of samples in the submission must be between 5 and 96 (inclusive).
  • Total (requested) number of pools must be between 1 and 8 (inclusive).
  • The number of pools requested must be feasible given the number of samples, and having checked for donor clash It also generates a warning message, only if there are no errors, for the following condition:
  • There is not enough material for the "full allowance" (2 full runs on the chip)

The messages are generated using the strings in the locale file.

rubocop:disable Metrics/ModuleLength

Constant Summary collapse

I18N_SCOPE_SCRNA_CORE_CDNA_PREP_FEASIBILITY_VALIDATOR =

I18n scope for the error messages in this module; where to find the translations in the locale file.

'submissions.scrna_core_cdna_prep_feasibility_validator'

Constants included from ScrnaCoreCdnaPrepFeasibilityCalculator

Submission::ScrnaCoreCdnaPrepFeasibilityCalculator::ALLOWANCE_BANDS, Submission::ScrnaCoreCdnaPrepFeasibilityCalculator::HEADER_BARCODE, Submission::ScrnaCoreCdnaPrepFeasibilityCalculator::HEADER_CELLS_PER_CHIP_WELL, Submission::ScrnaCoreCdnaPrepFeasibilityCalculator::HEADER_NUMBER_OF_POOLS, Submission::ScrnaCoreCdnaPrepFeasibilityCalculator::HEADER_PLATE_WELL, Submission::ScrnaCoreCdnaPrepFeasibilityCalculator::SCRNA_CORE_CDNA_PREP_GEM_X_5P

Instance Method Summary collapse

Methods included from ScrnaCoreCdnaPrepFeasibilityCalculator

#calculate_allowance_bands, #calculate_chip_loading_volume, #calculate_resuspension_volume, #calculate_total_cells_in_300ul, #calculate_volume_needed

Instance Method Details

#validate_required_headersObject

Validate the presence of all required headers



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'app/models/submission/scrna_core_cdna_prep_feasibility_validator.rb', line 27

 do
  # NOTE: The following attribute is not required for Microarray Genotyping.
  # I think this might be broken and suggests that there should be separate classes for project: one for
  # next-gen sequencing that includes this attribute in it's metadata, and one for microarray genotyping
  # that doesn't.
  include ProjectManager::Associations
  include BudgetDivision::Associations

  custom_attribute(:project_cost_code, required: true)
  custom_attribute(:funding_comments)
  custom_attribute(:collaborators)
  custom_attribute(:external_funding_source)
  custom_attribute(:sequencing_budget_cost_centre)
  custom_attribute(:project_funding_model, in: PROJECT_FUNDING_MODELS)
  custom_attribute(:gt_committee_tracking_id)

  before_validation do |record|
    record.project_cost_code = nil if record.project_cost_code.blank?
    record.project_funding_model = nil if record.project_funding_model.blank?
  end
end

#validate_scrna_core_cdna_prep_feasibilityvoid

This method returns an undefined value.

This method checks the feasibility of scRNA Core cDNA Prep bulk submission. If the submission spreadsheet does not contain the necessary headers, the method returns early. Otherwise, it performs a series of validations and adds errors and warnings to the bulk submission if necessary.



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'app/models/submission/scrna_core_cdna_prep_feasibility_validator.rb', line 38

 do
  # NOTE: The following attribute is not required for Microarray Genotyping.
  # I think this might be broken and suggests that there should be separate classes for project: one for
  # next-gen sequencing that includes this attribute in it's metadata, and one for microarray genotyping
  # that doesn't.
  include ProjectManager::Associations
  include BudgetDivision::Associations

  custom_attribute(:project_cost_code, required: true)
  custom_attribute(:funding_comments)
  custom_attribute(:collaborators)
  custom_attribute(:external_funding_source)
  custom_attribute(:sequencing_budget_cost_centre)
  custom_attribute(:project_funding_model, in: PROJECT_FUNDING_MODELS)
  custom_attribute(:gt_committee_tracking_id)

  before_validation do |record|
    record.project_cost_code = nil if record.project_cost_code.blank?
    record.project_funding_model = nil if record.project_funding_model.blank?
  end
end