transcriptic.config

Connection

class transcriptic.config.Connection(email=None, token=None, organization_id=None, api_root='https://secure.transcriptic.com', cookie=None, verbose=False, analytics=True, user_id='default', feature_groups=[])

Bases: future.types.newobject.newobject

A Connection object is the object used for communicating with Transcriptic.

Local usage: This is most easily instantiated by using the from_file function after calling transcriptic login from the command line.

shell
$ transcriptic login
Email: me@example.com
Password:
Logged in as me@example.com (example-lab)
python
from transcriptic.config import Connection
api = Connection.from_file("~/.transcriptic")

For those using Jupyter notebooks on secure.transcriptic.com (beta), a Connection object is automatically instantiated as api.

python
from transcriptic import api

The api object can then be used for making any api calls. It is recommended to use the objects in transcriptic.objects since that wraps the response in a more friendly format.

Example Usage:

python
api.projects()
api.runs(project_id="p123456789")

If you have multiple organizations and would like to switch to a specific organization, or if you would like to auto-load certain projects, you can set it directly by assigning to the corresponding variable.

Example Usage:

python
api.organization_id = "my_other_org"
api.project_id = "p123"
analyze_launch_request(launch_request_id, test_mode=False)
analyze_run(protocol, test_mode=False)

Analyze given protocol

api_root
archive_project(project_id=None)

Archive project with given project_id

cookie
create_package(name, description)

Create package with given name and description

create_project(title)

Create project with given title

create_quick_launch(data, project_id=None)

Create quick launch object

dataset(data_id, key='*')

Get dataset with given data_id

datasets(project_id=None, run_id=None, timeout=30.0)

Get datasets belonging to run

delete(route, **kwargs)
delete_package(package_id=None)

Delete package with given package_id

delete_project(project_id=None)

Delete project with given project_id

email
static from_file(path)

Loads connection from file

get(route, **kwargs)
get_launch_request(protocol_id=None, launch_request_id=None)

Get launch request id

get_organization(org_id=None)

Get particular organization

get_protocols()

Get list of available protocols

get_quick_launch(project_id=None, quick_launch_id=None)

Get quick launch object

get_release_status(package_id=None, release_id=None, timestamp=None)

Get status of current release upload

get_route(method, **kwargs)

Helper function to automatically match and supply required arguments

get_zip(data_id, file_path=None)

Get zip file with given data_id. Downloads to memory and returns a Python ZipFile by default. When dealing with larger files where it may not be desired to load the entire file into memory, specifying file_path will enable the file to be downloaded locally.

Example Usage:

small_zip_id = 'd12345'
small_zip = api.get_zip(small_zip_id)

my_big_zip_id = 'd99999'
api.get_zip(my_big_zip_id, file_path='big_file.zip')
Parameters:
  • data_id (data_id) – Data id of file to download
  • file_path (Optional[str]) – Path to file which to save the response to. If specified, will not return ZipFile explicitly.
Returns:

zip – A Python ZipFile is returned unless file_path is specified

Return type:

zipfile.ZipFile

inventory(query, timeout=30.0, page=0)

Get inventory

kits(query)

Get kits

launch_protocol(params, protocol_id=None)

Launch protocol-id with params

monitoring_data(data_type, instruction_id, grouping=None, start_time=None, end_time=None)

Get monitoring_data

organization_id
organizations()

Get list of organizations

package(package_id=None)

Get package with given package_id

packages()

Get list of packages in organization

payment_methods()
post(route, **kwargs)
post_release(data, package_id=None)

Create release with given data and package_id

preview_protocol(protocol)

Post protocol preview

project(project_id=None)

Get particular project

project_id
projects()

Get list of projects in organization

put(route, **kwargs)
raw_image_data(data_id=None)

Get raw image data

resolve_quick_launch_inputs(raw_inputs, project_id=None, quick_launch_id=None)

Resolves raw_inputs to inputs for quick_launch

resources(query)

Get resources

runs(project_id=None)

Get list of runs in project

save(path)

Saves current connection into specified file, used for CLI

submit_launch_request(launch_request_id, project_id=None, protocol_id=None, title=None, test_mode=False, payment_method_id=None)

Submit specified launch request

submit_run(protocol, project_id=None, title=None, test_mode=False, payment_method_id=None)

Submit given protocol

token
update_environment(**kwargs)

Updates environment variables used for computing routes. To remove an existing variable, set value to None.

update_headers(**kwargs)

Updates session headers To remove an existing variable, set value to None.

upload_dataset(file_handle, name, title, run_id, analysis_tool, analysis_tool_version, content_type=None)

Uploads a file_handle as a dataset to the specified run.

Parameters:
  • file_handle (file_handle) – File handle to be uploaded
  • name (str) – Dataset filename
  • title (str) – Name of dataset
  • run_id (str) – Run-id
  • analysis_tool (str, optional) – Name of tool used for analysis
  • analysis_tool_version (str, optional) – Version of tool used
  • content_type (str) – Type of content uploaded
Returns:

response – JSON-formatted response

Return type:

dict

upload_dataset_from_filepath(file_path, title, run_id, analysis_tool, analysis_tool_version)

Helper for uploading a file as a dataset to the specified run.

Uses upload_dataset.

api.upload_dataset_from_filepath(
    "my_file.txt",
    title="my cool dataset",
    run_id="r123",
    analysis_tool="cool script",
    analysis_tool_version="v1.0.0"
)
Parameters:
  • file (str) – Path to file to be uploaded
  • title (str) – Name of dataset
  • run_id (str) – Run-id
  • analysis_tool (str, optional) – Name of tool used for analysis
  • analysis_tool_version (str, optional) – Version of tool used
Returns:

response – JSON-formatted response

Return type:

dict

upload_to_uri(file_handle, content_type, title, name)

Helper for uploading files via the upload route

Parameters:
  • file_handle (file_handle) – File handle to be uploaded
  • content_type (str) – Type of content uploaded
  • title (str) – Title of content to be uploaded
  • name (str) – Name of file to be uploaded
Returns:

key – s3 key

Return type:

str

url(path)

url format helper