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"
-
property
api_root
¶
-
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
¶
-
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]
-
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.
-
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
-
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
¶
-
property
project_id
¶
-
resolve_quick_launch_inputs
(raw_inputs, project_id=None, quick_launch_id=None)[source]¶ Resolves raw_inputs to inputs for quick_launch
-
property
rsa_key
¶
-
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.
-
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
-
property