Class: Api::V2::TagLayoutResource

Inherits:
BaseResource
  • Object
show all
Defined in:
app/resources/api/v2/tag_layout_resource.rb

Overview

Note:

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

Note:

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

Provides a JSON:API representation of the TagLayout resource.

TagLayout Lays out the tags in the specified tag group in a particular pattern. This resource is used for managing tag layouts for plates, which define how tags are applied or distributed across the plate. It supports creating a tag layout and retrieving its details.

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:

GET request to fetch all tag layouts

GET /api/v2/tag_layouts/

GET request to fetch a specific tag layout by ID

GET /api/v2/tag_layouts/123/

POST request to create a new tag layout

POST /api/v2/tag_layouts/
{
  "data": {
    "type": "tag_layouts",
    "attributes": {
        "direction": "column",
        "initial_tag": 100,
        "substitutions": {"key": "value"},
        "tags_per_well": 5,
        "walking_by": "wells in pools"
    },
    "relationships": {
        "tag_group": {
            "data": { "type": "tag_groups", "id": 1 }
        },
        "plate": {
            "data": { "type": "plates", "id": 1 }
        },
        "user": {
            "data": { "type": "users", "id": 4 }
        }
    }
  }
}

Instance Attribute Summary collapse

Method Summary

Methods inherited from BaseResource

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

Instance Attribute Details

#direction ⇒ String

Note:

This attribute is required and must be specified when creating a tag layout.

The name of the algorithm defining the direction of the tag layout.

Returns:

  • (String) —

    The direction of the tag layout.



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

 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

#enforce_uniqueness=(value) ⇒ Object (writeonly)

Not stored on the model



213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# File 'app/resources/api/v2/tag_layout_resource.rb', line 213

 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

#initial_tag ⇒ Integer

An offset for the tag set indicating which tag to start with in the layout.

Returns:

  • (Integer) —

    The tag number to start with in the layout.



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

 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

#plate ⇒ Api::V2::PlateResource

Note:

This relationship is required and must be set when creating the tag layout.

This relationship defines the plate to which this tag layout is applied. Setting this relationship alongside the plate_uuid attribute will override the attribute value.

Returns:



171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# File 'app/resources/api/v2/tag_layout_resource.rb', line 171

 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

#plate_uuid=(value) ⇒ Void (writeonly)

Deprecated.

Use the plate relationship instead.

This is a convenience attribute for when the plate is not available as a relationship. Setting this alongside the plate relationship will prefer the relationship value.

Parameters:

  • value (String) —

    The UUID of the Plate this tag layout applies to.

Returns:

  • (Void)

See Also:



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

 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

#replace_tags=(value) ⇒ Void (writeonly)

A flag indicating whether the layout replaces the existing tags of the aliquots. Without a tag2 group, it removes their existing tag2 instead of keeping it. Used when tags are added to aliquots that are already tagged, e.g. Ultima tags on Illumina libraries.

Parameters:

  • value (Boolean) —

    Whether to replace the existing tags.

Returns:

  • (Void)


85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'app/resources/api/v2/tag_layout_resource.rb', line 85

 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

#substitutions ⇒ Hash

A hash of substitutions to be applied during the layout creation, mapping placeholders to values.

Returns:

  • (Hash) —

    The substitutions for the tag layout.



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'app/resources/api/v2/tag_layout_resource.rb', line 94

 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

#tag2_group ⇒ Api::V2::TagGroupResource

Defines a secondary tag group used in the tag layout, typically for dual indexing. Setting this relationship alongside the tag2_group_uuid attribute will override the attribute value. This is used during dual indexing, but will not be found during single indexing.

Returns:



185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
# File 'app/resources/api/v2/tag_layout_resource.rb', line 185

 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

#tag2_group_uuid=(value) ⇒ Void (writeonly)

Deprecated.

Use the tag2_group relationship instead.

This is a convenience attribute for when a second TagGroup is not available to set as a relationship. Setting this alongside the tag2_group relationship will prefer the relationship value.

Parameters:

  • value (String) —

    The UUID of the second TagGroup used in this tag layout.

Returns:

  • (Void)

See Also:



125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'app/resources/api/v2/tag_layout_resource.rb', line 125

 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_group ⇒ Api::V2::TagGroupResource

Note:

This relationship is required.

Defines the primary tag group used in the tag layout. Setting this relationship alongside the tag_group_uuid attribute will override the attribute value.

Returns:



178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# File 'app/resources/api/v2/tag_layout_resource.rb', line 178

 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_group_uuid=(value) ⇒ Void (writeonly)

Deprecated.

Use the tag_group relationship instead.

This is a convenience attribute for when the TagGroup is not available to set as a relationship. Setting this alongside the tag_group relationship will prefer the relationship value.

Parameters:

  • value (String) —

    The UUID of the TagGroup used in this tag layout.

Returns:

  • (Void)

See Also:



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

 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_layout_template_uuid=(value) ⇒ Object (writeonly)

Not stored on the model



206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# File 'app/resources/api/v2/tag_layout_resource.rb', line 206

 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

#tags_per_well ⇒ Integer

The number of tags per well in the layout. Used for specific tag layout algorithms like #walking_by. When not used, this will be nil.

Returns:

  • (Integer) —

    The number of tags per well.



136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'app/resources/api/v2/tag_layout_resource.rb', line 136

 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

#user ⇒ Api::V2::UserResource

Note:

This relationship is required.

Defines the user who initiated the creation of this tag layout. Setting this relationship alongside the user_uuid attribute will override the attribute value.

Returns:



192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
# File 'app/resources/api/v2/tag_layout_resource.rb', line 192

 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

#user_uuid=(value) ⇒ Void (writeonly)

Deprecated.

Use the user relationship instead. See Y25-236.

This is a convenience attribute for when the User is not available to set as a relationship. Setting this alongside the user relationship will prefer the relationship value.

Parameters:

  • value (String) —

    The UUID of the User who initiated the creation of the tag layout.

Returns:

  • (Void)

See Also:



146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# File 'app/resources/api/v2/tag_layout_resource.rb', line 146

 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

#uuid ⇒ String (readonly)

Returns The UUID of the tag layout.

Returns:

  • (String) —

    The UUID of the tag layout.



154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# File 'app/resources/api/v2/tag_layout_resource.rb', line 154

 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

#walking_by ⇒ String

Note:

This attribute is required and must be specified when creating a tag layout.

Defines the algorithm that determines how the tag layout is walked through (e.g., by row, by column).

Returns:

  • (String) —

    The walking algorithm used for the tag layout.



160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# File 'app/resources/api/v2/tag_layout_resource.rb', line 160

 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