Class: Api::V2::SampleResource
- Inherits:
-
BaseResource
- Object
- JSONAPI::Resource
- BaseResource
- Api::V2::SampleResource
- Defined in:
- app/resources/api/v2/sample_resource.rb
Overview
Access this resource via the /api/v2/samples/
endpoint.
Provides a JSON:API representation of Sample, which represents a biological or synthetic sample used in laboratory processes. This resource allows users to retrieve and filter samples based on various attributes such as UUID, name, or Sanger Sample ID.
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.
Instance Attribute Summary collapse
-
#component_samples ⇒ Array<ComponentSampleResource>
The component samples associated with this sample.
-
#control ⇒ Boolean
Indicates whether this sample is a control sample.
-
#control_type ⇒ String
The type of control sample (e.g., positive control, negative control).
-
#name ⇒ String
The name of the sample.
-
#sample_manifest ⇒ SampleManifestResource
The manifest to which this sample belongs, often linking it to a larger set of processed samples.
-
#sample_metadata ⇒ SampleMetadataResource
The metadata associated with this sample, containing additional details like collection method and donor information.
-
#sanger_sample_id ⇒ String
The unique identifier assigned to the sample within the Sanger Institute.
-
#studies ⇒ Array<StudyResource>
The studies associated with this sample.
-
#uuid ⇒ String
readonly
The globally unique identifier (UUID) for this sample.
Instance Method Summary collapse
-
#filter_by_name ⇒ Object
Filters samples by their name.
-
#filter_by_sanger_sample_id ⇒ Object
Filters samples by their Sanger Sample ID.
-
#filter_by_uuid ⇒ Object
Filters samples by their UUID.
Methods inherited from BaseResource
apply_includes, creatable_fields, default_includes, #fetchable_fields, inclusions, resolve_relationship_names_to_relations, updatable_fields
Instance Attribute Details
#component_samples ⇒ Array<ComponentSampleResource>
A sample may consist of multiple component samples.
Returns The component samples associated with this sample.
115 |
# File 'app/resources/api/v2/sample_resource.rb', line 115 has_many :component_samples |
#control ⇒ Boolean
Optional field.
Returns Indicates whether this sample is a control sample.
84 |
# File 'app/resources/api/v2/sample_resource.rb', line 84 attribute :control |
#control_type ⇒ String
Optional field.
Returns The type of control sample (e.g., positive control, negative control).
89 |
# File 'app/resources/api/v2/sample_resource.rb', line 89 attribute :control_type |
#name ⇒ String
This field is optional.
Returns The name of the sample.
69 |
# File 'app/resources/api/v2/sample_resource.rb', line 69 attribute :name |
#sample_manifest ⇒ SampleManifestResource
Optional relationship.
Returns The manifest to which this sample belongs, often linking it to a larger set of processed samples.
105 |
# File 'app/resources/api/v2/sample_resource.rb', line 105 has_one :sample_manifest |
#sample_metadata ⇒ SampleMetadataResource
Optional relationship.
Returns The metadata associated with this sample, containing additional details like collection method and donor information.
99 |
# File 'app/resources/api/v2/sample_resource.rb', line 99 has_one :sample_metadata, class_name: 'SampleMetadata', foreign_key_on: :related |
#sanger_sample_id ⇒ String
This field is optional but commonly used for sample tracking.
Returns The unique identifier assigned to the sample within the Sanger Institute.
74 |
# File 'app/resources/api/v2/sample_resource.rb', line 74 attribute :sanger_sample_id |
#studies ⇒ Array<StudyResource>
A sample can be linked to multiple studies.
Returns The studies associated with this sample.
110 |
# File 'app/resources/api/v2/sample_resource.rb', line 110 has_many :studies |
#uuid ⇒ String (readonly)
This value is automatically assigned upon creation and cannot be modified.
Returns The globally unique identifier (UUID) for this sample.
79 |
# File 'app/resources/api/v2/sample_resource.rb', line 79 attribute :uuid, readonly: true |
Instance Method Details
#filter_by_name ⇒ Object
Filters samples by their name.
137 |
# File 'app/resources/api/v2/sample_resource.rb', line 137 filter :name |
#filter_by_sanger_sample_id ⇒ Object
Filters samples by their Sanger Sample ID.
131 |
# File 'app/resources/api/v2/sample_resource.rb', line 131 filter :sanger_sample_id |
#filter_by_uuid ⇒ Object
Filters samples by their UUID.
125 |
# File 'app/resources/api/v2/sample_resource.rb', line 125 filter :uuid, apply: ->(records, value, ) { records.with_uuid(value) } |