// Retrieve the reagent setup
Node reagentSetup = GLSRestApiUtils.httpGET(stepURI + '/reagents', username, password)
    Â
// Collect the artifact URIs and retrieve the artifacts
def artifactURIs = reagentSetup.'output-reagents'.'output'.collect { it.@uri }.unique()
def artifacts = GLSRestApiUtils.batchGET(artifactURIs, username, password)// For each artifact, determine its position and set its reagent label accordingly
artifacts.each { artifact ->
  // Split the position into its two components
  def positionIndices = parsePlacement(artifact.'location'[0].'value'[0].text())
Â
  // Using our relationship maps, determine which reagent should be placed at that position
  String reagentName = REAGENT_MAP[((REAGENT_PATTERN[positionIndices[0]])[positionIndices[1]])]
 <
  // Create and attach the reagent-label node to our setup
  Node reagentNode = NodeBuilder.newInstance().'reagent-label'(name:reagentName)
  reagentSetup.'output-reagents'.'output'.find { it.@uri == GLSRestApiUtils.stripQuery(artifact.@uri) }.append(reagentNode)
}// Set the reagent setup in the API
GLSRestApiUtils.httpPOST(reagentSetup, reagentSetup.@uri, username, password)
// Define the success message to the user
outputMessage = "Script has completed successfully.${LINE_TERMINATOR}" +
"Clarity LIMS reagent pattern has been applied to all containers."bash -c "/opt/gls/groovy/current/bin/groovy -cp /opt/groovy/lib /opt/gls/clarity/customextensions/AssignIndexPattern.groovy -i {stepURI:v2:http} -u {username} -p {password}"// Reagent Labels
public static final def REAGENT_MAP = [
(27):'AD027 (ATTCCT)', (23):'AD023 (GAGTGG)', (20):'AD020 (GTGGCC)',
(15):'AD015 (ATGTCA)'
]
// Reagent Pattern
public static final def REAGENT_PATTERN = [
[27,27,27,27,27,15,27,27,27,27,27,27],
[27,27,27,27,15,15,15,27,27,27,27,27],
[27,27,27,15,15,15,15,15,20,20,20,20],
[27,27,23,23,15,15,15,20,20,20,20,27],
[27,23,23,23,23,15,20,20,20,20,27,27],
[23,23,23,23,23,23,23,23,23,27,27,27],
[27,27,27,27,27,23,23,23,27,27,27,27],
[27,27,27,27,27,27,23,27,27,27,27,27]
]
