All Collections
Platform Services
Introduction to the API
Introduction to the API

Boost your workflows through the TeselaGen API

D
Written by Diego Valenzuela
Updated over a week ago

One of the various ways of interfacing with the TeselaGen Platform programmatically, is through the TeselaGen's API.

If you are interested in learning more about all the available alternatives to interface with our platform, you can do so by visiting the following links:

TeselaGen's API

The TeselaGen's API is an HTTP API served by TeselaGen's backend and it is the API that our clients use to boost their workflows by integrating their processes with our powerful tools.

API Documentation

You can find an extensive documentation of the TeselaGen's API here:

Which fully addresses the APIs of each of the 4 modules, Design, Build, Test and Discover, as well as the CLI API. To access the specific documentation for each API, you should go to the link above and:

  1. Click on the top left of the screen.

  2. Select one of the modules from the list that will appear from the left side of the screen.

Don't hesitate to reach out, in case you have any comments or questions.

TeselaGen's Python Client

Next, we introduce the TeselaGen's Python Client, which allows the user to interact with our platform through the convenience of a python script, allowing to accelerate analysis, integration and automation of tasks in a simple and easy way.

TeselaGenClient

The core of the TeselaGen Python Client is the TeselaGenClient class , which handles tasks that are common between different modules of the platform, such as login, logout, access to a specific laboratory, among others. In order to access the TeselaGen Python Client, contact our customer support team.

Module Level Clients

Additionally, there is a client class for each of the TeselaGen's Platform Modules.

Each of these classes extends the TeselaGenClient, therefore its methods are accessible by each of them. These classes implement specific methods to each module, and they are intended to be used by the user to access and interact with each one of them independently.

Specifically, these classes are:

  • DESIGNClient

  • BUILDClient

  • TESTClient

  • DISCOVERClient


Through the clients of each of the modules, the user has access to all its capabilities, such as

  • Obtaining information about the available elements, as well as creating and removing elements (users, laboratories, experiments, assays, models, designs, files, etc)

  • Running, canceling or eliminating tasks (models, analysis, processes, etc)

  • Importing and exporting data (statistics and model results, information about designs and sequences, etc.)

Managing the connection to a module

For simplicity, we will start by describing the use of the python TESTClient.


Instantiating the Module Level Client

To instantiate each of these clients, a string containing the URL of the Host is required to be passed as an argument. This URL can be specific for each client. Contact the TeselaGen team if you have any questions.

Here is an example of how to instantiate the TESTClient (this procedure is analogous for each one of the other clients).

from teselagen.api.test_client import TESTClient

host_url = "https://demo.teselagen.com"
client = TESTClient(host_url=host_url)


Login

Then, you should log in to the module, using your username (passing the username string argument) and corresponding password (passing the password string argument).


Additionally you can define a time after which the client's connection to the platform will automatically expire (passing the expiration_time string argument).

This it's shown in the following code block.

# This alternative will prompt for a username and password
# And use the default expiration time
client.login()

You can also explicitly pass this information to the method, or obtain it from some environment file.

username = "YOURUSERHERE@company.com"
password = "YOURPASSHERE"
expiration_time = "1h"

client.login(username=username, password=password, expiration_time=expiration_time)

Logout

To manually log out of the platform module, just do the following.

# Executing this action requires a password for confirmation
client.logout()

Similarly to login method, the username and password can be passed as arguments to the logout method.

client.logout(username=username, password=password)


Managing Labs

Once you've accessed to a lab, you can get a list with the name and ID of each of the available experiments it contains.

Get Lab Information

To obtain a list of objects with information of the labs available to the user, you can do it as follows.

# A list of dictionaries, where each dictionary contains
# the keys "id" and "name"

# ["id": int, "name": str]

laboratories = client.get_laboratories()


Connect to a Lab

To connect to a lab you can do it with the select_laboratory method which receives an integer lab_id as an argument.

# YOUR DESIRED LABORATORY ID GOES HERE
lab_id = 1

client.select_laboratory(lab_id=lab_id)


Disconnect from the Lab

Analogously, to disconnect from the selected lab you can do it using the unselect_laboratory method (without passing any arguments to it).

# This will disconnect you from the previously selected
# laboratory

client.unselect_laboratory()

Jupyter Notebook Example

Here's an example of a deeper look into the TEST module using TeselaGen's Public Python Client.


ABF Multiomics Jupyter Notebook: Notebook example using TeselaGen Python Client package publicly available in its latest version here. This notebook shows how to use TeselaGen’s Python TEST Client in order to connect to TeselaGen TEST Module through its REST API.


Did this answer your question?