arrow-left

All pages
gitbookPowered by GitBook
1 of 1

Loading...

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.

hashtag
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.

hashtag
Parameters

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

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

hashtag
User Interaction

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

hashtag
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.

hashtag
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 .

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

hashtag
Attachments

publishFilesToLabLink.py:

publishFilesToLabLink_v2.py:

For each file resource, the value of the <is-published> node is set to 'true'.
  • The files resources are saved back to Clarity LIMS in a single transaction using the 'batch' method.

  • -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)

    GitHub pagearrow-up-right
    file-download
    3KB
    publishFilesToLabLink.py
    arrow-up-right-from-squareOpen
    file-download
    3KB
    publishFilesToLabLink_v2.py
    arrow-up-right-from-squareOpen
    Publishing_files_to_Lablink1.png
    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"