Module: Submission::ScrnaCoreCdnaPrepPoolingPlanGenerator
- Defined in:
- app/models/submission/scrna_core_cdna_prep_pooling_plan_generator.rb
Overview
This module provides a basic pooling plan generator for scRNA core cDNA prep submissions. It generates a CSV string which outlines the pooling strategy for the submitted samples based on the number of pools and cells per chip well specified in the submission and grouped by study and project. The logic for determining the pool layout is aimed to be a mirror of the pooling logic used in Limber, specifically in the DonorPoolingCalculator's allocate_wells_to_pools method.
This module also assumes the submission has already been validated with the scrna_core_cdna_prep validators to ensure donor clashes and pooling parameters are already checked.
Class Method Summary collapse
-
.calculate_pools_layout(number_of_samples, number_of_pools) ⇒ Object
This method calculates the layout of pools based on the total number of samples and the number of pools requested.
-
.generate_pooling_plan(submission) ⇒ Object
This logic attemps to mirror Limber's pooling logic See Limber LabwareCreators::DonorPoolingCalculator (allocate_wells_to_pools).
-
.grouped_requests(submission) ⇒ Object
Groups the requests associated with a submission by study and project.
Class Method Details
.calculate_pools_layout(number_of_samples, number_of_pools) ⇒ Object
This method calculates the layout of pools based on the total number of samples and the number of pools requested. It divides the samples as evenly as possible across the pools, and evenly distributes any remainder samples
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'app/models/submission/scrna_core_cdna_prep_pooling_plan_generator.rb', line 35 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 |
.generate_pooling_plan(submission) ⇒ Object
This logic attemps to mirror Limber's pooling logic See Limber LabwareCreators::DonorPoolingCalculator (allocate_wells_to_pools)
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/models/submission/scrna_core_cdna_prep_pooling_plan_generator.rb', line 14 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 |
.grouped_requests(submission) ⇒ Object
Groups the requests associated with a submission by study and project.
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_pooling_plan_generator.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 |