transcriptic.config

Connection

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

Bases: object

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.strateos.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)[source]
analyze_run(protocol, test_mode=False)[source]

Analyze given protocol

property api_root
archive_project(project_id=None)[source]

Archive project with given project_id

attachments(data_id)[source]

Fetches all attachments for a given dataset id

Parameters

data_id (str) – dataset id

Returns

a dict of attachment names and contents

Return type

dict(str, bytes)

property bearer_token
property cookie
create_package(name, description)[source]

Create package with given name and description

create_project(title)[source]

Create project with given title

create_quick_launch(data, project_id=None)[source]

Create quick launch object

data_object(id)[source]

Fetches a data object by id

Parameters

id (str) – data_object id

Returns

attributes dict

Return type

dict

data_objects(dataset_id)[source]

Fetches all data objects given a dataset id

Parameters

dataset_id (str) – dataset id

Returns

array of attributes dict

Return type

arr[dict]

dataset(data_id, key='*')[source]

Get dataset with given data_id

datasets(project_id=None, run_id=None, timeout=30.0)[source]

Get datasets belonging to run

delete(route, **kwargs)[source]
delete_package(package_id=None)[source]

Delete package with given package_id

delete_project(project_id=None)[source]

Delete project with given project_id

property email
static from_default_config()[source]

Load the default configuration file from the home directory of the current user and return a Connection instance that is costructed from it.

static from_file(path)[source]

Loads connection from file

get(route, **kwargs)[source]
get_container(container_id)[source]
get_launch_request(protocol_id=None, launch_request_id=None)[source]

Get launch request id

get_organization(org_id=None)[source]

Get particular organization

get_protocols()[source]

Get list of available protocols

get_quick_launch(project_id=None, quick_launch_id=None)[source]

Get quick launch object

get_release_status(package_id=None, release_id=None, timestamp=None)[source]

Get status of current release upload

get_route(method, **kwargs)[source]

Helper function to automatically match and supply required arguments

get_zip(data_id, file_path=None)[source]

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)[source]

Get inventory

kits(query)[source]

Get kits

launch_protocol(params, protocol_id=None)[source]

Launch protocol-id with params

load_rsa_secret()[source]
modify_aliquot_properties(aliquot_id, set_properties={}, delete_properties=[])[source]

Modify the properties of an alquot:

If specified set_properties must be dict mapping {str: str} these properties will be set on the aliquot specified.

If specified delete_properties must be a list of string properties which will be deleted on the aliquot.

monitoring_data(data_type, instruction_id, grouping=None, start_time=None, end_time=None)[source]

Get monitoring_data

property organization_id
organizations()[source]

Get list of organizations

package(package_id=None)[source]

Get package with given package_id

packages()[source]

Get list of packages in organization

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

Create release with given data and package_id

preview_protocol(protocol)[source]

Post protocol preview

project(project_id=None)[source]

Get particular project

property project_id
projects()[source]

Get list of projects in organization

put(route, **kwargs)[source]
raw_image_data(data_id=None)[source]

Get raw image data

resolve_quick_launch_inputs(raw_inputs, project_id=None, quick_launch_id=None)[source]

Resolves raw_inputs to inputs for quick_launch

resources(query)[source]

Get resources

property rsa_key
runs(project_id=None)[source]

Get list of runs in project

save(path)[source]

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, predecessor_id=None)[source]

Submit specified launch request

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

Submit given protocol

property token
update_environment(**kwargs)[source]

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

update_headers(**kwargs)[source]

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

update_session_auth(use_signature=True)[source]
upload_dataset(file_handle, name, title, run_id, analysis_tool, analysis_tool_version, content_type=None)[source]

Uploads a file_handle as a dataset to the specified run.

# Uploading a data_frame via file_handle, using Py3
import io

temp_buffer = io.StringIO()
my_df.to_csv(temp_buffer)

api.upload_dataset(
    temp_buffer,
    name="my_df",
    title="my cool dataset",
    run_id="r123",
    analysis_tool="cool script",
    analysis_tool_version="v1.0.0"
)
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)[source]

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)[source]

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)[source]

url format helper