Automatic Sample Placement into Existing Containers
Last updated
Last updated
There are often cases where empty containers are received and added into Clarity LIMS before being used in a protocol. This application example describes how to use the API to place samples into existing containers automatically. The application uses a CSV file that describes the mapping between the sample and its destination container.
Furthermore, the API allows accessioning into multiple container categories, something that is not possible through the web interface.
If you use Python version 2.6x, you must install the argparse package. Python 2.7 and later include this package by default.
Also make sure that you have the latest glsapiutil.py Python API library on the Clarity LIMS server, in the /opt/gls/clarity/customextensions folder. You can download the latest glsapiutil library from our .
Check the list of allowed containers for the step and make sure that all expected container categories are present. The API cannot place samples into containers that are not allowed for the step!
The suggested input format is a four-column CSV with the following columns:
Sample Name, Container Category, Container Name, Well Position
The sample name should match the name as shown in the Ice Bucket/Queue screen.
First, make sure that the Step Setup screen has been activated and is able to accept a file for upload:
Assuming the file is `compoundOutputFileLuid0`, the EPP / automation command line would be structured as follows:
The automation should be configured to trigger automatically when the Placement screen is entered.
NOTE: The attached Python script uses the prerelease API endpoint (instead of v2), which allows placement of samples into existing containers.
The script performs the following operations:
Parses the file and create an internal map (Python dict) between sample name and container details:
Key: sample name
Value: (container name, well position) tuple
Retrieves the URI of each container.
Accesses the step's 'placements' XML using a GET request.
Performs the following modifications to the XML:
Populates the <selected-containers> node with child nodes for each retrieved container.
Populates each <output> artifact with a <location> node with the container details and well position.
PUTs the placement XML back to Clarity LIMS.
After the script runs, the Placement screen should show the placements, assuming there were no problems executing the script.
The attached script also contains some minimal bulletproofing for the following cases:
Container was not found.
Container is not empty.
Well position is invalid.
Sample in the ice bucket does not have a corresponding entry in the uploaded file.
Sample in the uploaded file is not in the ice bucket.
In all cases, the script reports an error and does not allow the user to proceed.
placeSamplesIntoExistingContainers.py:
Clarity LIMS v6.x automation trigger configuration