Class: V1::Pacbio::RunResource
- Inherits:
-
JSONAPI::Resource
- Object
- JSONAPI::Resource
- V1::Pacbio::RunResource
- Defined in:
- app/resources/v1/pacbio/run_resource.rb
Overview
Provides a JSON:API representation of Pacbio::Run.
Filters:
-
name
-
state
Primary relationships:
-
plates PlateResource
-
smrt_link_version SmrtLinkVersionResource
-
annotations V1::Pacbio::Runs::AnnotationResource
Relationship trees:
-
plates.wells.used_aliquots
-
smrt_link_version.smrt_link_option_versions
-
annotations
curl -X POST localhost:3100/v1/pacbio/runs \ -H “Content-Type: application/vnd.api+json” \ -H “Accept: application/vnd.api+json” \ -d ‘{ “data”: { “type”: “runs”, “attributes”: { “dna_control_complex_box_barcode”: “Lxxxxx101717600123191”, “system_name”: “Sequel II”, “pacbio_smrt_link_version_id”: 130, “plates_attributes”: [ { “sequencing_kit_box_barcode”: “DM0001100861800123121”, “plate_number”: 1, “wells_attributes”: [ { “row”: “A”, “column”: “1”, “movie_acquisition_time”: 30, “library_concentration”: 8.35, “pre_extension_time”: “2”, “include_base_kinetics”: “True”, “polymerase_kit”: “ABC123”, “used_aliquots_attributes”: [ { “source_id”: 408, “source_type”: “Pacbio::Pool”, “volume”: 10, “concentration”: 20, “aliquot_type”: “derived”, “template_prep_kit_box_barcode”: “033000000000000000000” } ], “annotations_attributes”: null } ] } ] } }’
curl -X PATCH “localhost:3100/v1/pacbio/runs/1” \ -H “Content-Type: application/vnd.api+json” -H “Accept: application/vnd.api+json” -d ‘{ “data”: { “type”: “runs”, “id”: “1”, “attributes”: { “annotations_attributes”: [ { “comment”: “annotation comment”, “annotation_type_id”: “1”, “user”: “user1” } ] } } }’
curl -X PATCH “localhost:3100/v1/pacbio/runs/1” \ -H “Content-Type: application/vnd.api+json” \ -H “Accept: application/vnd.api+json” \ -d ‘{ “data”: { “type”: “runs”, “id”: “1”, “attributes”: { “plates_attributes”: [ { “id”: 1, “type”: “plates”, “wells_attributes”: [ { “id”: 1, “type”: “wells”, “annotations_attributes”: [ { “comment”: “annotation comment”, “annotation_type_id”: “1”, “user”: “user1” } ] } ] } ] } } }’
curl -X PATCH “localhost:3100/v1/pacbio/runs/1” \ -H “Content-Type: application/vnd.api+json” \ -H “Accept: application/vnd.api+json” \ -d ‘{ “data”: { “type”: “runs”, “attributes”: { “dna_control_complex_box_barcode”: “Lxxxxx101717600123191”, “system_name”: “Sequel II”, “pacbio_smrt_link_version_id”: 56, “plates_attributes”: [ { “sequencing_kit_box_barcode”: “DM0001100861800123121”, “plate_number”: 1, “wells_attributes”: [ { “row”: “A”, “column”: “1”, “movie_time”: 31, “on_plate_loading_concentration”: 8.35, “pre_extension_time”: “2”, “generate_hifi”: “In SMRT Link”, “ccs_analysis_output”: “Yes”, “binding_kit_box_barcode”: “DM1117100862200111711”, “ccs_analysis_output_include_low_quality_reads”: “Yes”, “include_fivemc_calls_in_cpg_motifs”: “Yes”, “ccs_analysis_output_include_kinetics_information”: “Yes”, “demultiplex_barcodes”: “In SMRT Link”, “used_aliquots_attributes”: [ { “source_id”: 391, “source_type”: “Pacbio::Pool”, “volume”: 10, “concentration”: 20, “aliquot_type”: “derived”, “template_prep_kit_box_barcode”: “033000000000000000000” } ], “annotations_attributes”: [ { “annotation_type_id”: 209, “comment”: “Another test comment”, “user”: “daisy” } ] } ] } ], “annotations_attributes”: [ { “annotation_type_id”: 209, “comment”: “Test comment”, “user”: “dave” } ] } } }’
Constant Summary collapse
- PERMITTED_WELL_PARAMETERS =
Well parameters that are permitted for the plates_attributes
%i[ id row column comment ].concat(Rails.configuration.pacbio_smrt_link_versions..keys).freeze
Instance Attribute Summary collapse
-
#adaptive_loading ⇒ Boolean
readonly
Whether adaptive loading is used.
-
#barcodes_and_concentrations ⇒ String
readonly
The barcodes and concentrations of the run.
-
#created_at ⇒ String
The creation time of the run.
-
#dna_control_complex_box_barcode ⇒ String
The barcode of the DNA control complex box.
-
#name ⇒ String
The name of the run.
-
#pacbio_smrt_link_version_id ⇒ Integer
The ID of the PacBio SMRT Link version.
-
#plates_attributes ⇒ Array<Hash>
readonly
The attributes of the plates.
-
#sequencing_kit_box_barcodes ⇒ Array<String>
readonly
The barcodes of the sequencing kits.
-
#state ⇒ String
The state of the run.
-
#system_name ⇒ String
The name of the system.
Class Method Summary collapse
- .creatable_fields(context) ⇒ Object
- .default_sort ⇒ Object
-
.resource_klass_for(type) ⇒ Object
JSON API Resources builds up a representation of the relationships on a give resource.
- .updatable_fields(context) ⇒ Object
Instance Method Summary collapse
Instance Attribute Details
#adaptive_loading ⇒ Boolean (readonly)
Returns whether adaptive loading is used.
207 208 209 210 211 |
# File 'app/resources/v1/pacbio/run_resource.rb', line 207 attributes :name, :dna_control_complex_box_barcode, :system_name, :created_at, :state, :pacbio_smrt_link_version_id, :plates_attributes, :adaptive_loading, :sequencing_kit_box_barcodes, :annotations_attributes |
#barcodes_and_concentrations ⇒ String (readonly)
Returns the barcodes and concentrations of the run.
215 |
# File 'app/resources/v1/pacbio/run_resource.rb', line 215 attribute :barcodes_and_concentrations, readonly: true |
#created_at ⇒ String
Returns the creation time of the run.
|
|
# File 'app/resources/v1/pacbio/run_resource.rb', line 188
|
#dna_control_complex_box_barcode ⇒ String
Returns the barcode of the DNA control complex box.
|
|
# File 'app/resources/v1/pacbio/run_resource.rb', line 188
|
#name ⇒ String
Returns the name of the run.
|
|
# File 'app/resources/v1/pacbio/run_resource.rb', line 188
|
#pacbio_smrt_link_version_id ⇒ Integer
Returns the ID of the PacBio SMRT Link version.
207 208 209 210 211 |
# File 'app/resources/v1/pacbio/run_resource.rb', line 207 attributes :name, :dna_control_complex_box_barcode, :system_name, :created_at, :state, :pacbio_smrt_link_version_id, :plates_attributes, :adaptive_loading, :sequencing_kit_box_barcodes, :annotations_attributes |
#plates_attributes ⇒ Array<Hash>
Returns the attributes of the plates.
207 208 209 210 211 |
# File 'app/resources/v1/pacbio/run_resource.rb', line 207 attributes :name, :dna_control_complex_box_barcode, :system_name, :created_at, :state, :pacbio_smrt_link_version_id, :plates_attributes, :adaptive_loading, :sequencing_kit_box_barcodes, :annotations_attributes |
#sequencing_kit_box_barcodes ⇒ Array<String> (readonly)
Returns the barcodes of the sequencing kits.
207 208 209 210 211 |
# File 'app/resources/v1/pacbio/run_resource.rb', line 207 attributes :name, :dna_control_complex_box_barcode, :system_name, :created_at, :state, :pacbio_smrt_link_version_id, :plates_attributes, :adaptive_loading, :sequencing_kit_box_barcodes, :annotations_attributes |
#state ⇒ String
Returns the state of the run.
|
|
# File 'app/resources/v1/pacbio/run_resource.rb', line 188
|
#system_name ⇒ String
Returns the name of the system.
|
|
# File 'app/resources/v1/pacbio/run_resource.rb', line 188
|
Class Method Details
.creatable_fields(context) ⇒ Object
268 269 270 |
# File 'app/resources/v1/pacbio/run_resource.rb', line 268 def self.creatable_fields(context) super - %i[adaptive_loading sequencing_kit_box_barcodes] end |
.default_sort ⇒ Object
235 236 237 |
# File 'app/resources/v1/pacbio/run_resource.rb', line 235 def self.default_sort [{ field: 'created_at', direction: :desc }] end |
.resource_klass_for(type) ⇒ Object
JSON API Resources builds up a representation of the relationships on a give resource. Whilst doing to it asks the associated resource for its type, before using this method on the parent resource to attempt to look up the model. Unfortunately this results in V1::Pacbio::PlateResource by default. We should probably consider renaming Runs::Plate to something like Runs::PacBioPlate thereby updating the type. However this will also need updates to routes, and the front end. i.e. this is needed for GET /v1/pacbio/runs?include=plate
252 253 254 255 256 257 258 259 260 |
# File 'app/resources/v1/pacbio/run_resource.rb', line 252 def self.resource_klass_for(type) if type == 'plates' super('runs/plates') elsif type == 'annotations' super('runs/annotations') else super end end |
.updatable_fields(context) ⇒ Object
272 273 274 |
# File 'app/resources/v1/pacbio/run_resource.rb', line 272 def self.updatable_fields(context) super - %i[adaptive_loading sequencing_kit_box_barcodes] end |