Class: Api::V2::PlateResource

Inherits:
BaseResource
  • Object
show all
Includes:
SharedBehaviour::Labware
Defined in:
app/resources/api/v2/plate_resource.rb

Overview

Note:

This resource cannot be modified after creation: its endpoint will not accept PATCH requests.

Note:

Access this resource via the /api/v2/plates/ endpoint.

Provides a JSON:API representation of Plate which is plastic labware containing Wells. The plate has a purpose like all labware and this denotes which pipeline it is being used in and what type of samples it holds / how it will be processed. Plates are not typically created directly using this resource, although they can be. Rather they are created via resources such as PlateCreationResource.

}

For more information about JSON:API see the JSON:API Specifications or look at the JSONAPI::Resources package for Sequencescape's implementation of the JSON:API standard.

Examples:

POST request

POST /api/v2/plates/
{
  "data": {
      "type": "plates",
      "attributes": {
          "size": 96
      },
      "relationships": {
          "purpose": {
              "data": { "type": "purposes", "id": 1 }
          },
          "wells": {
              "data": [{ "type": "wells", "id": 4481 }]
          }
      }
  }

GET request for all Plate resources

GET /api/v2/plates/

GET request for a Plate with ID 123

GET /api/v2/plates/123/

Instance Attribute Summary collapse

Method Summary

Methods included from SharedBehaviour::Labware

#labware_barcode

Methods inherited from BaseResource

apply_includes, creatable_fields, default_includes, #fetchable_fields, inclusions, resolve_relationship_names_to_relations, updatable_fields

Instance Attribute Details

#number_of_columnsInt (readonly)

Returns The number of columns on the plate. This is determined by the AssetShape assigned to the plate by its purpose.

Returns:

  • (Int)

    The number of columns on the plate. This is determined by the AssetShape assigned to the plate by its purpose.



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'app/resources/api/v2/plate_resource.rb', line 64

 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

#number_of_rowsInt (readonly)

Returns The number of rows on the plate. This is determined by the AssetShape assigned to the plate by its purpose.

Returns:

  • (Int)

    The number of rows on the plate. This is determined by the AssetShape assigned to the plate by its purpose.



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'app/resources/api/v2/plate_resource.rb', line 59

 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

#pooling_metadataHash (readonly)

Returns A hash containing submission UUIDs and corresponding pooling metadata.

Examples:

Hash representation

{
  "12345678-1234-1234-1234-1234567890ab": {
    "wells": ["A1", "A2", "A3"],
    "pool_complete": true,
    "insert_size": { "from": 1, "to": 1 },
    "library_type": { "name": "Bioscan" },
    "pcr_cycles": 0,
    "request_type": "limber_bioscan_library_prep",
    "for_multiplexing": false
  },
  "87654321-4321-4321-4321-ba0987654321": {
    "wells": ["B1", "B2", "B3"],
    "pool_complete": true,
    "insert_size": { "from": 1, "to": 1 },
    "library_type": { "name": "Bioscan" },
    "pcr_cycles": 0,
    "request_type": "limber_bioscan_library_prep",
    "for_multiplexing": false
  }
}

Returns:

  • (Hash)

    A hash containing submission UUIDs and corresponding pooling metadata.



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'app/resources/api/v2/plate_resource.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

#sizeInt

Note:

This can only be set once during creation. If it is not set, it will default to 96.

Returns The total number of wells on the plate.

Returns:

  • (Int)

    The total number of wells on the plate.



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'app/resources/api/v2/plate_resource.rb', line 70

 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

#submission_poolsArray<SubmissionPoolResource> (readonly)

Returns An array of submission pools for this plate.

Returns:



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'app/resources/api/v2/plate_resource.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

#transfers_as_destinationArray<TransferResource> (readonly)

Returns An array of transfers with this plate as the destination.

Returns:

  • (Array<TransferResource>)

    An array of transfers with this plate as the destination.



111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'app/resources/api/v2/plate_resource.rb', line 111

 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

#wellsArray<WellResource>

Note:

This can only be set once during creation.

Returns An array of wells on this plate.

Returns:

  • (Array<WellResource>)

    An array of wells on this plate.



116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'app/resources/api/v2/plate_resource.rb', line 116

 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