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
# File 'app/models/submission/scrna_core_cdna_prep_feasibility_validator.rb', line 27

def validate_required_headers
  required = [HEADER_BARCODE, HEADER_PLATE_WELL, HEADER_NUMBER_OF_POOLS, HEADER_CELLS_PER_CHIP_WELL]
  required.all? { |header| headers.include?(header) }
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
# File 'app/models/submission/scrna_core_cdna_prep_feasibility_validator.rb', line 38

def validate_scrna_core_cdna_prep_feasibility
  return unless validate_required_headers
  validate_scrna_core_cdna_prep_total_number_of_samples
  validate_scrna_core_cdna_prep_total_number_of_pools
  validate_scrna_core_cdna_prep_feasibility_by_samples
  validate_scrna_core_cdna_prep_feasibility_by_donors
  validate_scrna_core_cdna_prep_full_allowance if errors.empty?
end