Module: SampleManifest::CoreBehaviour::StockAssets
- Included in:
- PlateBehaviour::Core, SampleTubeBehaviour::Core, TubeRackBehaviour::Core
- Defined in:
- app/models/sample_manifest/core_behaviour.rb
Overview
The samples get registered in the stock resource table at the end of manifest upload and processing (It used to happen here)
Instance Method Summary collapse
-
#generate_sample_and_aliquot(sanger_sample_id, receptacle) ⇒ Object
Used in manifest upload code to insert the sample and aliquot into the database.
- #stocks? ⇒ Boolean
-
#tag_depth_for_sample(pools, receptacle, sanger_sample_id) ⇒ Object
Assigns a tag_depth to a sample in a pool.
Instance Method Details
#generate_sample_and_aliquot(sanger_sample_id, receptacle) ⇒ Object
Used in manifest upload code to insert the sample and aliquot into the database. The receptacle and sanger_sample_id already exist as they are inserted upfront when the manifest is generated. tag_depth is set on the aliquot to avoid tag clash if a) pools are present, and b) if the samples are not tagged. The assumption is made that samples passed to the below method are never tagged, because we're in the 'StockAssets' module rather than the 'LibraryAssets' module.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'app/models/sample_manifest/core_behaviour.rb', line 43 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 |
#stocks? ⇒ Boolean
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'app/models/sample_manifest/core_behaviour.rb', line 53 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 |
#tag_depth_for_sample(pools, receptacle, sanger_sample_id) ⇒ Object
Assigns a tag_depth to a sample in a pool. Tag_depth just needs to be a unique integer for each sample in the pool, So we just use the index in the list of sample manifest assets in this receptacle.
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'app/models/sample_manifest/core_behaviour.rb', line 60 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 |