Module: Submission::ScrnaCoreCdnaPrepFeasibilityCalculator
- Included in:
- ScrnaCoreCdnaPrepFeasibilityValidator
- Defined in:
- app/models/submission/scrna_core_cdna_prep_feasibility_calculator.rb
Overview
This module provides methods for calculating the full allowance volume and the final resuspension volume for scRNA core cDNA prep feasibility validations. NB. Search for 'scRNA Core Pooling Developer Documentation' page in Confluence (public) for a more verbose explanation of the calculations used here.
Constant Summary collapse
- SCRNA_CORE_CDNA_PREP_GEM_X_5P =
'Limber-Htp - scRNA Core cDNA Prep GEM-X 5p'- HEADER_BARCODE =
Constants for the headers in the bulk submission for scRNA core cDNA prep.
'barcode'- HEADER_PLATE_WELL =
'plate well'- HEADER_NUMBER_OF_POOLS =
'scrna core number of pools'- HEADER_CELLS_PER_CHIP_WELL =
'scrna core cells per chip well'- ALLOWANCE_BANDS =
{ two_pools_two_counts: '2 pool attempts, 2 counts', two_pools_one_count: '2 pool attempts, 1 count', one_pool_two_counts: '1 pool attempt, 2 counts', one_pool_one_count: '1 pool attempt, 1 count' }.freeze
Instance Method Summary collapse
-
#calculate_allowance_bands ⇒ Hash
Calculates the allowance band for each study and project combination.
-
#calculate_chip_loading_volume(number_of_cells_per_chip_well) ⇒ Float
This method calculates the chip loading volume (in microlitres) for the specified number of cells per chip well, which is typically specified in in a bulk submission per study and project.
-
#calculate_resuspension_volume(count_of_samples_in_pool) ⇒ Float
This method calculates the resuspension volume (in microlitres) for the specified number of samples in a pool, which is typically taken as the number of samples in the smallest pool for a study and project.
-
#calculate_total_cells_in_300ul(count_of_samples_in_pool) ⇒ Integer
This method calculates the total cells in 300ul for the specified number of samples in a pool, which is typically taken as the number of samples in the smallest pool for a study and project.
-
#calculate_volume_needed(number_of_cells_per_chip_well, number_runs, number_cell_counts) ⇒ Float
Calculates the total volume needed (in microliters) for a given number of cells per chip well.
Instance Method Details
#calculate_allowance_bands ⇒ Hash
Calculates the allowance band for each study and project combination. This method evaluates the final resuspension volume for each study-project group and assigns an appropriate allowance band based on predefined thresholds. Example output: { { study: "Study A", project: "Project X" } => "2 pool attempts, 2 counts", { study: "Study B", project: "Project Y" } => "1 pool attempt, 2 counts" }
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'app/models/submission/scrna_core_cdna_prep_feasibility_calculator.rb', line 62 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 |
#calculate_chip_loading_volume(number_of_cells_per_chip_well) ⇒ Float
This method calculates the chip loading volume (in microlitres) for the specified number of cells per chip well, which is typically specified in in a bulk submission per study and project. It uses the pooling settings from the scRNA config.
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'app/models/submission/scrna_core_cdna_prep_feasibility_calculator.rb', line 81 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 |
#calculate_resuspension_volume(count_of_samples_in_pool) ⇒ Float
This method calculates the resuspension volume (in microlitres) for the specified number of samples in a pool, which is typically taken as the number of samples in the smallest pool for a study and project. It uses the pooling settings from the scRNA config. It first calculates the total cells in 300ul for the given number of samples in the pool, and then the resuspension volume for that total cell count.
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'app/models/submission/scrna_core_cdna_prep_feasibility_calculator.rb', line 95 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 |
#calculate_total_cells_in_300ul(count_of_samples_in_pool) ⇒ Integer
This method calculates the total cells in 300ul for the specified number of samples in a pool, which is typically taken as the number of samples in the smallest pool for a study and project. It uses the pooling settings from the scRNA config.
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'app/models/submission/scrna_core_cdna_prep_feasibility_calculator.rb', line 107 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 |
#calculate_volume_needed(number_of_cells_per_chip_well, number_runs, number_cell_counts) ⇒ Float
Calculates the total volume needed (in microliters) for a given number of cells per chip well.
This method is used in bulk submissions per study and project, leveraging pooling settings from the scRNA configuration. It first calculates the chip loading volume for the specified number of cells per chip well and then determines the total volume required, including allowances for cell counting and wastage.
The total volume needed is calculated as:
- The volume required for loading chips, based on the number of pool attempts (`number_runs`).
- The volume taken for cell counting, based on the number of cell counts (`number_cell_counts`).
- An additional wastage volume (`scrna_config[:wastage_volume]`).
Band Allowance Calculations:
- If `number_runs = 2` and `number_cell_counts = 2`, it calculates `2 pool attempts, 2 counts` (Full allowance).
- If `number_runs = 2` and `number_cell_counts = 1`, it calculates `2 pool attempts, 1 count`.
- If `number_runs = 1` and `number_cell_counts = 2`, it calculates `1 pool attempt, 2 counts`.
- If `number_runs = 1` and `number_cell_counts = 1`, it calculates `1 pool attempt, 1 count`.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'app/models/submission/scrna_core_cdna_prep_feasibility_calculator.rb', line 45 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 |