// 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'.@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"
}