Class: V1::Ont::RunResource

Inherits:
JSONAPI::Resource
  • Object
show all
Defined in:
app/resources/v1/ont/run_resource.rb

Overview

Note:

Access this resource via the /v1/ont/runs/ endpoint.

This resource represents a sequencing run for the Oxford Nanopore Technologies (ONT) platform. It provides a JSON:API representation of Ont::Run.

Attributes:

  • experiment_name: The name of the experiment.

  • state: The state of the run.

  • rebasecalling_process: The rebasecalling process of the run.

  • created_at: The creation timestamp of the run.

  • ont_instrument_id: The ID of the associated instrument.

  • flowcell_attributes: The attributes of the flowcells in the run.

Filters:

  • experiment_name: Filter runs by experiment name.

  • state: Filter runs by state.

Primary relationships:

Relationship trees:

  • flowcells.pool

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

Examples:

curl -X GET "http://yourdomain.com/v1/ont/runs" -H "accept: application/vnd.api+json"

curl -X GET "http://yourdomain.com/v1/ont/runs/1?include=flowcells.pool" \
     -H "accept: application/vnd.api+json"

curl -X POST "http://yourdomain.com/v1/ont/runs" \
 -H "accept: application/vnd.api+json" \
 -H "Content-Type: application/vnd.api+json" \
 -d '{
    "data": {
    "type": "runs",
    "attributes": {
      "experiment_name": "Experiment 1",
      "state": "pending",
      "rebasecalling_process": "process_1",
      "ont_instrument_id": 1,
      "flowcell_attributes": [
        {
          "id": 1,
          "flowcell_id": "flowcell_1",
          "position": "A1",
          "ont_pool_id": 1
        },
       {
          "id": 2,
          "flowcell_id": "flowcell_2",
          "position": "B1",
          "ont_pool_id": 2
       }
      ]
     }
    }
   }'

curl -X PATCH "http://yourdomain.com/v1/ont/runs/1" \
 -H "accept: application/vnd.api+json" \
 -H "Content-Type: application/vnd.api+json" \
 -d '{"data": {"type": "runs", "id": "1", "attributes": {"state": "completed"}}}'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#created_atString

Returns the creation timestamp of the run.

Returns:

  • (String)

    the creation timestamp of the run



91
92
# File 'app/resources/v1/ont/run_resource.rb', line 91

attributes :experiment_name, :state, :rebasecalling_process, :created_at, :ont_instrument_id,
:flowcell_attributes

#experiment_nameString

Returns the name of the experiment.

Returns:

  • (String)

    the name of the experiment



91
92
# File 'app/resources/v1/ont/run_resource.rb', line 91

attributes :experiment_name, :state, :rebasecalling_process, :created_at, :ont_instrument_id,
:flowcell_attributes

#flowcell_attributesArray<Hash>

Returns the attributes of the flowcells in the run.

Returns:

  • (Array<Hash>)

    the attributes of the flowcells in the run



91
92
# File 'app/resources/v1/ont/run_resource.rb', line 91

attributes :experiment_name, :state, :rebasecalling_process, :created_at, :ont_instrument_id,
:flowcell_attributes

#ont_instrument_idInteger

Returns the ID of the associated instrument.

Returns:

  • (Integer)

    the ID of the associated instrument



91
92
# File 'app/resources/v1/ont/run_resource.rb', line 91

attributes :experiment_name, :state, :rebasecalling_process, :created_at, :ont_instrument_id,
:flowcell_attributes

#rebasecalling_processString

Returns the rebasecalling process of the run.

Returns:

  • (String)

    the rebasecalling process of the run



91
92
# File 'app/resources/v1/ont/run_resource.rb', line 91

attributes :experiment_name, :state, :rebasecalling_process, :created_at, :ont_instrument_id,
:flowcell_attributes

#stateString

Returns the state of the run.

Returns:

  • (String)

    the state of the run



91
92
# File 'app/resources/v1/ont/run_resource.rb', line 91

attributes :experiment_name, :state, :rebasecalling_process, :created_at, :ont_instrument_id,
:flowcell_attributes

Class Method Details

.default_sortObject



107
108
109
# File 'app/resources/v1/ont/run_resource.rb', line 107

def self.default_sort
  [{ field: 'created_at', direction: :desc }]
end

Instance Method Details

#fetchable_fieldsObject



124
125
126
# File 'app/resources/v1/ont/run_resource.rb', line 124

def fetchable_fields
  super - [:flowcell_attributes]
end

#publish_messagesObject



128
129
130
# File 'app/resources/v1/ont/run_resource.rb', line 128

def publish_messages
  Messages.publish(@model, Pipelines.ont.message)
end