Class: V1::Ont::PoolResource

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

Overview

Note:

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

Provides a JSON:API representation of Ont::Pool.

Filters: * barcode - Filter pools by the barcode of the associated tube. * sample_name - Filter pools by the name of samples in the associated libraries.

Primary relationships:

Examples:

curl -X GET http://localhost:3100/v1/ont/pools
curl -X GET http://localhost:3100/v1/ont/pools/15
curl -X GET "http://localhost:3100/v1/ont/pools?filter[barcode]=TRAC-2-41"
curl -X GET "http://localhost:3100/v1/ont/pools?filter[sample_name]=GENSAMPLE-1762592713-10

curl -X POST "http://localhost:3100/v1/ont/pools" \
  -H "accept: application/vnd.api+json" \
  -H "Content-Type: application/vnd.api+json" \
  -d '{
    "data": {
      "type": "pools",
      "attributes": {
        "volume": 10.0,
        "concentration": 5.0,
        "insert_size": 350,
        "kit_barcode": "KIT-12345",
        "library_attributes": [
          {
            "kit_barcode":"kit_barcode",
            "volume":1.111,
            "concentration":10.0,
            "insert_size":10000,
            "ont_request_id":36,
            "tag_id":1197
          },
          {
            "kit_barcode":"kit_barcode",
            "volume":1.111,
            "concentration":10.0,
            "insert_size":10000,
            "ont_request_id":36,
            "tag_id":1198
          }
        ]
      },
      "relationships": {
         "tube": {
           "data": {
             "type": "tubes",
             "id": "41"
          }
        }
      }
    }
  }'

curl -X PATCH "http://localhost:3100/v1/ont/pools/19" \
  -H "accept: application/vnd.api+json" \
  -H "Content-Type: application/vnd.api+json" \
  -d '{
    "data": {
       "id": "19",
      "type": "pools",
      "attributes": {
        "volume": 10.0,
        "concentration": 5.0,
        "insert_size": 350,
        "kit_barcode": "KIT-12345",
        "library_attributes": [
          {
            "kit_barcode":"kit_barcode",
            "volume":2.111,
            "concentration":10.0,
            "insert_size":10000,
            "ont_request_id":36,
            "tag_id":1197
          },
          {
            "kit_barcode":"kit_barcode",
            "volume":1.111,
            "concentration":20.0,
            "insert_size":10000,
            "ont_request_id":36,
            "tag_id":1198
          }
        ]
      }
    }
  }'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#concentrationFloat

Returns the concentration of the pool.

Returns:

  • (Float)

    the concentration of the pool



119
120
# File 'app/resources/v1/ont/pool_resource.rb', line 119

attributes :volume, :kit_barcode, :concentration, :insert_size,
:library_attributes, :tube_barcode

#created_atString (readonly)

Returns the creation timestamp of the pool.

Returns:

  • (String)

    the creation timestamp of the pool



125
# File 'app/resources/v1/ont/pool_resource.rb', line 125

attributes :created_at, :updated_at, readonly: true

#final_library_amountFloat (readonly)

Returns the final amount of the library in the pool.

Returns:

  • (Float)

    the final amount of the library in the pool



132
# File 'app/resources/v1/ont/pool_resource.rb', line 132

attribute :final_library_amount, readonly: true

#insert_sizeInteger, String

Returns:

  • (Integer)

    the insert size of the pool

  • (String)

    the last update timestamp of the pool



119
120
# File 'app/resources/v1/ont/pool_resource.rb', line 119

attributes :volume, :kit_barcode, :concentration, :insert_size,
:library_attributes, :tube_barcode

#kit_barcodeString

Returns the barcode of the kit used.

Returns:

  • (String)

    the barcode of the kit used



119
120
# File 'app/resources/v1/ont/pool_resource.rb', line 119

attributes :volume, :kit_barcode, :concentration, :insert_size,
:library_attributes, :tube_barcode

#library_attributes=(library_parameters) ⇒ Object (writeonly)

When a pool is updated and it is attached to a run we need

to republish the messages for the run

after_update :publish_messages



119
120
# File 'app/resources/v1/ont/pool_resource.rb', line 119

attributes :volume, :kit_barcode, :concentration, :insert_size,
:library_attributes, :tube_barcode

#source_identifierString (readonly)

Returns the source identifier of the pool.

Returns:

  • (String)

    the source identifier of the pool



129
# File 'app/resources/v1/ont/pool_resource.rb', line 129

attribute :source_identifier, readonly: true

#tube_barcodeString (readonly)

Returns the barcode of the tube.

Returns:

  • (String)

    the barcode of the tube



119
120
# File 'app/resources/v1/ont/pool_resource.rb', line 119

attributes :volume, :kit_barcode, :concentration, :insert_size,
:library_attributes, :tube_barcode

#updated_atObject (readonly)



125
# File 'app/resources/v1/ont/pool_resource.rb', line 125

attributes :created_at, :updated_at, readonly: true

#volumeFloat

Returns the volume of the pool.

Returns:

  • (Float)

    the volume of the pool



119
120
# File 'app/resources/v1/ont/pool_resource.rb', line 119

attributes :volume, :kit_barcode, :concentration, :insert_size,
:library_attributes, :tube_barcode

Class Method Details

.default_sortObject



146
147
148
# File 'app/resources/v1/ont/pool_resource.rb', line 146

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

.records_for_populate(*_args) ⇒ Object



165
166
167
# File 'app/resources/v1/ont/pool_resource.rb', line 165

def self.records_for_populate(*_args)
  super.preload(source_wells: :plate)
end

Instance Method Details

#fetchable_fieldsObject



161
162
163
# File 'app/resources/v1/ont/pool_resource.rb', line 161

def fetchable_fields
  super - [:library_attributes]
end