Partek Flow Documentation

Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 9 Next »

With the Partek Flow REST API, you can create custom solutions to query or drive your server. Below are some use cases for the REST API:

A complete list of all the commands available for the API can be found on the REST API Command List

The public key and Python libraries can be downloaded here.

Generate an authentication token

An access token can be generated from the System information section of the settings page. 

Alternatively, GetToken.py will generate a token:

>python GetToken.py --server localhost:8080 --user admin

Example output:

TOKEN: cUOWY0VvkSFagrDUANVtM7A8SPal8Gx0cf0ee24bfa9fe68e2b5564dab2b6a27e1fb525e5...

This token can be specified as the --password parameter for the Python API. If the token is not supplied, then the Python API will prompt for the password and encrypt it.

When accessing the API directly, the encrypt parameter must be specified with the RSA value to use the token:

curl --form username=admin --form encrypt=RSA --form password=cUOWY0VvkSFagr... http://localhost:8080/flow/api/v1/users/list

Upload and analyze a group of samples

Get the name of a pipeline from the GUI or from the API

http://localhost:8080/flow/api/v1/pipelines/list

 

Get the list of required inputs for the pipeline from the API

http://localhost:8080/flow/api/v1/pipelines/inputs?project=iDEA&pipeline=AlignAndQuantify

 

Get the IDs for the library files that match the required inputs

http://localhost:8080/flow/api/v1/library_files/list?assembly=hg19

 

Use UploadSamples.py to upload the samples and launch the pipeline:

> python UploadSamples.py -v --server http://localhost:8080 --user admin --password [access token] --files ~/sample1.fastq.gz ~/sample2.fastq.gz --project ProjectName --pipeline AlignAndQuantify --inputs 28061,145855

Add a collaborator to a project

To add a collaborator to a project:

curl -X PUT "http://localhost:8080/flow/api/v1/projects?project=ProjectName&collaborator=user1&role=Collaborator&username=admin&encrypt=RSA&password=[url encoded token]"

 

Monitor a folder and upload files as they are created

#!/bin/bash
inotifywait -m $PATH_TO_MONITOR -e create -e moved_to |
  while read path action file; do
      if [[ $file == *.fastq.gz ]]; then
              echo "Uploading $file"
              python UploadSamples.py -v --server $SERVER --user $USER --password $TOKEN --files $path/$file --project "$PROJECT" 
      fi
  done

Monitor the queue and send a notification if there are too many waiting tasks:

#!/bin/bash
while true; do
      result=`python QueueStatistics.py --server $SERVER --user $USER --password $TOKEN --max_waiting $MAX_WAITING`
      if [ $? -eq 1 ]; then
              /usr/bin/notify-send $result
              exit 1
      fi
      sleep $INTERVAL
done

Additional Assistance

If you need additional assistance, please visit our support page to submit a help ticket or find phone numbers for regional support.

Your Rating: Results: 1 Star2 Star3 Star4 Star5 Star 0 rates

  • No labels