Module: UnderRepWellCommentsToBroadcast

Included in:
Batch
Defined in:
app/models/under_rep_well_comments_to_broadcast.rb

Overview

This module encapsulates the logic for identifying and generating comment data related to "under-represented" wells within a released batch. under_represented poly_metadata entries are linked to library requests associated with wells containing under-represented samples.

It supports:

- Pipelines where all requests (library prep, multiplexing, sequencing)
belong to a single submission (e.g. WGS)
- Pipelines where sequencing and library prep requests belong to
different submissions (e.g. RNA)
- Pipelines where the plate marked with “under-represented” wells is at the bottom of the request chain
- TODO: `Pipelines where the plate marked with “under-represented”
TODO: wells is in the middle of the request chain (e.g ISC ) Y26-167`

Responsibilities:

- Retrieve ancestor plates from batch lanes
- Extract requests containing `under_represented` metadata from the
ancestor plates
- Build structured `UnderRepWellComment` objects representing
per-well comments for serialization or broadcasting
- Handle `under_represented` poly_metadata linked to library requests
and attached to wells containing under-represented samples
- Provide a `comments` method used by `CommentIO` for serialization

Defined Under Namespace

Classes: UnderRepWellComment

Constant Summary collapse

UNDER_REPRESENTED_KEY =
'under_represented'

Instance Method Summary collapse

Instance Method Details

#under_rep_commentsArray<UnderRepWellComment>

Entry point used by CommentIO to retrieve the comments to serialize.

Returns:



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'app/models/under_rep_well_comments_to_broadcast.rb', line 57

 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

#under_represented_well_commentsArray<UnderRepWellComment>

Builds all UnderRepWellComment objects for the batch by iterating over each batch request and its associated lane. Aggregates comments across all lanes and their ancestor plates.

Returns:



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'app/models/under_rep_well_comments_to_broadcast.rb', line 66

 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