arrow-left

All pages
gitbookPowered by GitBook
1 of 1

Loading...

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).

hashtag
Code Example

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.

hashtag
Step 1. Configure Index Reagent Types

For each index or tag you plan to use in indexed sequencing, configure a corresponding index reagent type as follows.

  1. As administrator, click Configuration > Consumables > Labels.

  2. Add a new label group.

  3. Then, to add labels to the group:

hashtag
Step 2. Retrieve the sequence for a reagent label using the REST API

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):

For an artifact labeled with Index 1, this would produce the following information:

hashtag
Attachments

RetrievingReagentLabelIndex.groovy:

Download a template label list (Microsoft® Excel® file) from the Labels configuration screen.
  • Add reagent type details to the downloaded template.

  • Upload the completed label list.

  • file-download
    2KB
    RetrievingReagentLabelIndex.groovy
    arrow-up-right-from-squareOpen
    // 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('&')
    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'[email protected] {
        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"
    }
    Label: Index 1
    Index: ATCACG