Available from: Clarity LIMS v2.0.5
Often, a user would like to set or change the value of a UDF. If the UDF is accessible from the initial process URI, the setUDF script can be used.
Script Overview
The setUDF script allows several operations to take place, including - but not limited to the following:
Set a UDF on an output container to today's date.
Set a UDF on any sample associated with any input to a person's name.
Set a UDF on any output to a lab name (referred to as 'Account' in Clarity LIMS).
Set the input container name as a process level UDF.
Read a project UDF and set it on a sample.
Script Parameters
(Required) LIMS login username
(Required) LIMS login password
(Required) LIMS process URI
(Required) Path to the target object
(Optional) Path to the source element/attribute
(Required if the path to the source value is not provided, optional otherwise) UDF value
Examples
There are multiple ways to implement this script, as illustrated by the following examples.
Example 1Set the UDF named MyUDF on any output containers to the date the process ran:
Copy bash -l -c "/opt/gls/clarity/bin/java -jar /opt/gls/clarity/extensions/ngs-common/v5/EPP/ngs-extensions.jar \
script:setUDF \
-u {username} \
-p {password} \
-i {processURI:v2} \
-f 'MyUDF' \
-t '//output/@uri->//container/@uri' \
-s '//date-run'"
Example 2Set the UDF named MyUDF on any sample associated with any input to the name of the technician:
Copy bash -l -c "/opt/gls/clarity/bin/java -jar /opt/gls/clarity/extensions/ngs-common/v5/EPP/ngs-extensions.jar \
script:setUDF \
-u {username} \
-p {password} \
-i {processURI:v2} \
-f 'MyUDF' \
-t '//input/@uri->//sample/@uri' \
-s '//technician/*'"
Example 3Set the UDF named MyUDF on any output to the name of the technician's lab:
Copy bash -l -c "/opt/gls/clarity/bin/java -jar /opt/gls/clarity/extensions/ngs-common/v5/EPP/ngs-extensions.jar \
script:setUDF \
-u {username} \
-p {password} \
-i {processURI:v2} \
-f 'MyUDF' \
-t '//input/@uri' \
-s '//technician/@uri->//lab/@uri->//name'"
Example 4Set the input container name as a process level UDF:
Copy bash -l -c "/opt/gls/clarity/bin/java -jar /opt/gls/clarity/extensions/ngs-common/v5/EPP/ngs-extensions.jar \
script:setUDF \
-u {username} \
-p {password} \
-i {processURI:v2} \
-f 'FlowCellID' \
-t '/process/@uri' \
-s '//input/@uri->//container/@uri->//name'"
Example 5Read a project UDF and set it on a sample:
Copy /opt/gls/clarity/bin/java -jar /opt/gls/clarity/extensions/ngs-common/v5/EPP/ngs-extensions.jar \
script:setUDF \
-u {username} \
-p {password} \
-i {processURI:v2} \
-f 'Study' \
-t '//input/@uri->//sample/@uri' \
-s '//input/@uri->//sample/@uri->//project/@uri->/project/field[@name="Study"]'
Example 6Read a parent process UDF and set it on a sample level UDF called Geneticist:
Copy /opt/gls/clarity/bin/java -jar /opt/gls/clarity/extensions/ngs-common/v5/EPP/ngs-extensions.jar \
script:setUDF \
-u {username} \
-p {password} \
-i {processURI:v2} \
-f 'Geneticist' \
-t '//input/@uri->//sample/@uri' \
-s '//input/@uri->//parent-process/@uri->//technician/@uri->//initials'
Example 7Read the Project name and set it on a sample level UDF called ProjectName:
Copy /opt/gls/clarity/bin/java -jar /opt/gls/clarity/extensions/ngs-common/v5/EPP/ngs-extensions.jar \
script:setUDF \
-u {username} \
-p {password} \
-i {processURI:v2} \
-f 'ProjectName' \
-t '//input/@uri->//sample/@uri' \
-s '//input/@uri->//sample/@uri->//project/@uri->//name'
ℹ️ In the examples shown above, the paths may differ for your system. For example, the version number may differ. For Clarity LIMS 4 or before, the process URI token should be:
Copy {processURI:v2:https} or {processURI:v2:http}
Rules & constraints
Both the target entity and (optionally) the source value are expressed as chains of XPath expressions (using ->
as separators).
Even if you are using XPath to specify the source value, setUDF applies a single value per invocation to all target objects. It cannot apply different source values to different target objects.
You can use -z as an option when running the script to simulate the effects it would have. Note that even though an output identifying the target object(s) and the value that would be set is produced no changes are actually made.
Additional information
Other scripts you may find useful:
Last updated 3 months ago