Class: Api::V2::TagGroupResource

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

Overview

TODO:

The below POST example is provided for reference, however it currently throws an error.

Note:

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

Provides a JSON:API representation of TagGroup A TagGroup represents a set of tags used in sequencing.

A Tag is a short, know sequence of DNA which gets applied to a sample. The tag remains attached through subsequent processing, and means that it is possible to identify the origin of a sample if multiple samples are subsequently pooled together.

This is because the example format of the tags attribute are not permitted.

For more information about JSON:API, see the JSON:API Specifications or refer to JSONAPI::Resources for Sequencescape's implementation.

Examples:

GET request for all tag groups

GET /api/v2/tag_groups/

GET request for a specific tag group by ID

GET /api/v2/tag_groups/123/

POST request to create a new tag group

POST /api/v2/tag_groups/
{
  "data": {
    "type": "tag_groups",
    "attributes": {
      "name": "My Tag Group",
      "tags": [
        { "map_id": 1,"oligo": "AAACGGCG"},
        { "map_id": 2,"oligo": "CAACGGCG"}
      ]
    },
    "relationships": {
      "tag_group_adapter_type": {
        "data": { "type": "tag_group_adapter_types", "id": 5 }
      }
    }
  }
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseResource

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

Instance Attribute Details

#nameString

The name of the tag group. This attribute is required when creating a new tag group.

Returns:

  • (String)

    The name of the tag group.



63
# File 'app/resources/api/v2/tag_group_resource.rb', line 63

attribute :name, write_once: true

#tag_group_adapter_typeTagGroupAdapterTypeResource

Note:

This relationship is required

The adapter type associated with this tag group. This defines how the tags are used within a sequencing workflow.

Returns:



79
80
81
82
# File 'app/resources/api/v2/tag_group_resource.rb', line 79

has_one :tag_group_adapter_type,
foreign_key: :adapter_type_id,
write_once: true,
class_name: 'TagGroupAdapterType'

#tagsArray<Hash>

Returns the list of tags sorted by their index.

Returns:

  • (Array<Hash>)

    The list of tags, each with an index and an oligo sequence.



68
# File 'app/resources/api/v2/tag_group_resource.rb', line 68

attribute :tags, write_once: true

#uuidString (readonly)

Note:

This identifier is automatically assigned upon creation and cannot be modified.

Returns The UUID of the tag group.

Returns:

  • (String)

    The UUID of the tag group.



57
# File 'app/resources/api/v2/tag_group_resource.rb', line 57

attribute :uuid, readonly: true

Instance Method Details

#filter_by_nameString

Returns Filters tag groups by their name.

Examples:

Retrieve tag groups with a specific name

GET /api/v2/tag_groups?filter[name]=MyTagGroup

Returns:

  • (String)

    Filters tag groups by their name.



98
# File 'app/resources/api/v2/tag_group_resource.rb', line 98

filter :name

#filter_by_tag_group_adapter_type_nameString

Returns Filters tag groups by their adapter type name.

Examples:

Retrieve tag groups associated with a specific adapter type

GET /api/v2/tag_groups?filter[tag_group_adapter_type_name]=Illumina

Returns:

  • (String)

    Filters tag groups by their adapter type name.



104
# File 'app/resources/api/v2/tag_group_resource.rb', line 104

filter :tag_group_adapter_type_name, apply: ->(records, value, _options) { records.by_adapter_type(value) }

#filter_by_visibleBoolean

Returns Filters tag groups based on visibility.

Examples:

Retrieve only visible tag groups

GET /api/v2/tag_groups?filter[visible]=true

Returns:

  • (Boolean)

    Filters tag groups based on visibility.



92
# File 'app/resources/api/v2/tag_group_resource.rb', line 92

filter :visible, default: true