Publishing Files to LabLink

Some steps produce data that you would like your collaborators to have access to.

This example provides an alternative method and uses a script to publish the files programmatically via the API.

Solution

In this example, suppose we have a protocol step, based upon a Sanger/capillary sequencing workflow, that produces up to two files per sample (a .seq and a .ab1 file).

Our example script runs at the end of the protocol step. The script publishes the output files so that they are available to collaborators in the LabLink Collaborations Interface.

Parameters

The EPP / automation command is configured to pass the following parameters:

-u

The username of the current user (Required)

-p

The password of the current user (Required)

-s

The URI of the protocol step that launches the script - the {stepURI:v2:http} token (Required)

An example of the full syntax used to invoke the script is as follows:

bash -l -c "/usr/bin/python /opt/gls/clarity/customextensions/publishFilesToLabLink.py -u admin -p securepassword -s https://demo-5-1.claritylims.com/api/v2/steps/24-7953"

User Interaction

After the script has completed its execution, collaborators are able to view and download the files from the LabLink Collaborations Interface.

About the code

The main method used in the script is publishFiles(). The method in turn carries out several operations:

  1. The limsids of the steps' artifacts are gathered, and the artifacts are retrieved, in a single transaction using the 'batch' method.

  2. Each artifact is investigated. If there is an associated file resource, its limsid is stored.

  3. The files resources are retrieved in a single transaction using the 'batch' method.

  4. For each file resource, the value of the <is-published> node is set to 'true'.

  5. The files resources are saved back to Clarity LIMS in a single transaction using the 'batch' method.

Assumptions & notes

  • The attached file is placed on the Clarity LIMS server, in the /opt/gls/clarity/customextensions folder.

  • The Python API Library (glsapiutil.py) is placed on the Clarity LIMS server, in the /opt/gls/clarity/customextensions folder. You can download the latest glsapiutil library from our GitHub page.

  • The example code is provided for illustrative purposes only. It does not contain sufficient exception handling for use 'as is' in a production environment.

Attachments

publishFilesToLabLink.py:

publishFilesToLabLink_v2.py:

Last updated