Find the Index Sequence for a Reagent Label
A common requirement in applications involving indexed sequencing is to determine the sequence corresponding to a reagent label. This example shows how to configure index reagent types, which you can then use to find the sequence for a reagent label. Before you follow the example, make sure that you have a compatible version of API (v2 r14 to v2 r24).

Reagents and reagent labels are independent concepts in the API. However, the recommended practice is to name reagent labels after reagent types. This allows you to use the label name to look up the sequence information on the reagent type resource. This practice is consistent with the Operations Interface process wizards. When a reagent is applied to a sample in the user interface, a reagent label with the same name of the reagent type is added to the analyte resource.
The following actions are also recommended:
1. | Configure an index reagent type with the correct sequence for each type of index or tag you plan to use. |
2. | Use the names of the index reagent types as reagent labels. |
Following these practices allows you to find the sequence for a reagent label by looking up the sequence in the corresponding reagent type.

For each index or tag you plan to use in indexed sequencing, configure a corresponding index reagent type as follows.
1. | As administrator, in the Clarity LIMS Operations Interface, select Configuration > Reagents > Reagent Type. |
2. | Add a new reagent type named Index 1. |
3. | Select Index for both the Reagent Category Name and the Special Type. |
4. | In the Sequence field, enter the index sequence specified by the manufacturer (eg, ATCACG). |
5. | Repeat these steps for each index you plan to use. |
You can now use names such as Index 1 and Index 2 when applying labels to artifacts.

After you have configured reagent types for each indexing sequence you intend to use, and have used those reagent type names as reagent label names, you can easily retrieve the corresponding sequence using the REST API.
The following code snippet shows how to retrieve the index sequences (when available):
// Determine the URI of the labeled artifact and retrieve it labeledArtifactURI = "http://${hostname}/api/v2/artifacts/${labeledArtifactLIMSID}" labeledArtifact = GLSRestApiUtils.httpGET(labeledArtifactURI, username, password) // Gather its reagent labels reagentLabels = labeledArtifact.'reagent-label'.@name if (!reagentLabels) { println "No labels found" return } // Build a query URI for possibly multiple reagent labels and execute it queryParameters = reagentLabels.collect { "name=${it.replace(' ', '+')}" }.join('and') reagentTypesURI = "http://${hostname}/api/v2/reagenttypes/" reagentTypeQueryURI = reagentTypesURI + '?' + queryParameters reagentTypeLinks = GLSRestApiUtils.httpGET(reagentTypeQueryURI, username, password) // For each reagent type found, retrieve it reagentTypeLinks.'reagent-type'.@uri.each { reagentType = GLSRestApiUtils.httpGET(it, username, password) reagentTypeName = reagentType.@name reagentLabels.remove(reagentTypeName) index = reagentType.'special-type'.'attribute'.find { it.@name = 'Sequence' }?.@value // Output the result println "Label: $reagentTypeName" println "Index: $index" } // If there are reagent labels that found no matches if (reagentLabels) { unmatchedLabels = reagentLabels.join(',') println "No reagent types found for labels: $unmatchedLabels" }
For an artifact labeled with Index 1, this would produce the following information:
Label: Index 1 Index: ATCACG