Before pooling samples in a multiplexed workflow, apply reagent labels using one of the methods described in Work with Multiplexing. After the analyte (derived sample) artifacts are labeled, they can be pooled together without loss of traceability.
Pooling samples is accomplished either by running a pooling step in the user interface, or by using the process resource in the REST API.
For an overview of how REST resources are structured, and to learn how the process resource is used to track workflow in Clarity LIMS, see REST General Concepts and Structure of REST Resources.
Prerequisites
Before you follow the example, make sure that you have the following items:
Reagent types that are configured in Clarity LIMS and are named index 1 through index 6.
Reagents of type index 1 through index 6 that have been added to Clarity LIMS.
A compatible version of API (v2 r21 or later).
Code Example
Pooling in the User Interface
The following screenshot shows a pooling step run from Clarity LIMS.
Pooling in the API with a Process POST
Pooling samples in the API is accomplished with a process resource. Information about a step is also stored in the process resource. Such a process has many input samples that map to a shared output sample, such that the shared output is a pool of those inputs. This is achieved with Run a Process/Step, where a single input-output-map element in the XML defines the shared output and all its related inputs.
In general, automation scripts access information about a step using the processURI, which links to the individual process resource. The input-output-map in the XML returned by the individual process resource gives the script access to the artifacts that were inputs and outputs to the process.
Information about a derived sample is stored in the analyte resource. This is used as the input and output of a step, and also used to record specific details from lab processing. The XML representation for an individual analyte contains a link to the URI of its submitted sample, and to the URI of the process that generated it (parent process).
The following example pools all samples found in a given container into a tube it creates.
NOTE: No special code is required to handle reagent labels. As processes execute, reagent labels automatically flow from inputs to outputs.
// Create the required URIs
containerToPoolUri = "http://${hostname}/api/v2/containers/${containerLIMSID}"
researcherURI = "http://${hostname}/api/v2/researchers/1"
// Find the artifacts to pool in the given container
containerToPool = GLSRestApiUtils.httpGET(containerToPoolUri, username, password)
artifactURIsToPool = containerToPool.'placement'.@uri
def builder = new StreamingMarkupBuilder()
builder.encoding = "UTF-8"
// Create a new container using the Markup Builder
def containerDoc = builder.bind {
mkp.xmlDeclaration()
mkp.declareNamespace(con: 'http://genologics.com/ri/container')
mkp.declareNamespace(udf: 'http://genologics.com/ri/userdefined')
'con:container'{
'name'("Pooled contents from ${containerToPool.name.text()}")
'type'(uri:"http://${hostname}/api/v2/containertypes/2", name:"Tube")
}
}
// Post the new container to the API
containerNode = GLSRestApiUtils.xmlStringToNode(containerDoc.toString())
container = GLSRestApiUtils.httpPOST(containerNode, "http://${hostname}/api/v2/containers", username, password)
// Create a new Pool Samples process using the StreamingMarkupBuilder
processDoc = new StreamingMarkupBuilder().bind {
mkp.declareNamespace(prx: 'http://genologics.com/ri/processexecution')
'prx:process'{
'type'('Pool Samples')
'technician'(uri:researcherURI)
'input-output-map'(shared:'true') {
artifactURIsToPool.each { 'input'(uri:it) }
'output'(type:'Analyte') {
'location' {
'container'(uri:container.@uri)
'value'('1:1')
}
}
}
}
}
// Post the Pool Samples process to the API
processNode = GLSRestApiUtils.xmlStringToNode(processDoc.toString())
returnNode = GLSRestApiUtils.httpPOST(processNode, "http://${hostname}/api/v2/processes", username, password)
println GLSRestApiUtils.nodeToXmlString(returnNode)
Verify with the REST API
Irrespective of whether you use the user interface or the REST API to pool samples, the pooled sample is available via process GET requests.
The following example shows one pooled output (LIMS ID 2-424) created from three inputs - LIMS IDs RCY1A103PA1, RCY1A104PA1, and RCY1A105PA1:
Besides deriving from the ancestral sample artifacts, the resulting pooled sample artifact inherits the reagent labels from all inputs. The pooled output produced by the pooling step appears as follows. The pooled artifact shows multiple reagent labels, and multiple ancestor samples.