Python API Client

Pangea includes a python API client to interact with the RESTful API.

Overview

The API client provides an object oriented interface to the RESTful API. Objects (Sample-Groups, Samples, Results, etc..) can be created, fetched, updated and destroyed by manipulating python objects and calling special get, save, and delete methods. The API client can be used to upload and download data from S3 without additional authentication.

API Documentation

Remote Connection and Caching

class pangea_api.remote_object.RemoteObject(*args, **kwargs)[source]
cache_blob(blob)[source]
create()[source]

Create this object on the server.

delete()[source]
get()[source]

Fetch the object from the server.

get_cached_blob()[source]
idem()[source]

Make the state of this object match the server.

load_blob(blob)[source]
optional_remote_fields = []
save()[source]

Assuming the object exists on the server make the server-side object match the state of this object.

class pangea_api.Knex(endpoint_url='https://pangea.gimmebio.com')[source]
add_auth_token(token)[source]
delete(url, **kwargs)[source]
get(url, **kwargs)[source]
login(username, password)[source]
post(url, json={}, **kwargs)[source]
put(url, json={}, **kwargs)[source]
class pangea_api.file_system_cache.FileSystemCache(timeout=10800)[source]
cache_blob(obj, blob)[source]
clear_blob(obj)[source]
get_cached_blob(obj)[source]
get_cached_blob_filepath(obj)[source]

Objects

class pangea_api.Organization(knex, name)[source]
get_sample_groups()[source]

Yield samplegroups fetched from the server.

nested_url()[source]
parent_field = None
pre_hash()[source]
remote_fields = ['uuid', 'created_at', 'updated_at', 'name']
sample_group(group_name, is_library=False)[source]
class pangea_api.User(knex, email, password)[source]
login()[source]
register()[source]
username
class pangea_api.SampleGroup(knex, org, name, is_library=False)[source]
add_sample(sample)[source]

Return this group and add a sample to this group.

Do not contact server until .save() is called on this group.

analysis_result(module_name, replicate=None)[source]
get_analysis_results(cache=True)[source]

Yield group analysis results fetched from the server.

get_manifest()[source]

Return a manifest for this group.

get_samples(cache=True)[source]

Yield samples fetched from the server.

nested_url()[source]
parent_field = 'org'
pre_hash()[source]
remote_fields = ['uuid', 'created_at', 'updated_at', 'name', 'is_library', 'is_public', 'metadata', 'long_description', 'description']
sample(sample_name, metadata={})[source]
class pangea_api.Sample(knex, lib, name, metadata={})[source]
analysis_result(module_name, replicate=None, metadata=None)[source]
get_analysis_results(cache=True)[source]

Yield sample analysis results fetched from the server.

get_manifest()[source]

Return a manifest for this sample.

nested_url()[source]
parent_field = 'lib'
pre_hash()[source]
remote_fields = ['uuid', 'created_at', 'updated_at', 'name', 'metadata', 'library', 'description']
class pangea_api.analysis_result.AnalysisResult(*args, **kwargs)[source]
pre_hash()[source]
remote_fields = ['uuid', 'created_at', 'updated_at', 'module_name', 'replicate', 'metadata', 'description']
class pangea_api.analysis_result.SampleAnalysisResult(knex, sample, module_name, replicate=None, metadata={})[source]
field(field_name, data={})[source]
get_fields(cache=True)[source]

Return a list of ar-fields fetched from the server.

nested_url()[source]
parent_field = 'sample'
class pangea_api.analysis_result.SampleGroupAnalysisResult(knex, grp, module_name, replicate=None, metadata={})[source]
field(field_name, data={})[source]
get_fields()[source]

Return a list of ar-fields fetched from the server.

nested_url()[source]
parent_field = 'grp'
class pangea_api.analysis_result.AnalysisResultField(knex, parent, field_name, data={})[source]
download_file(filename=None, cache=True)[source]

Return a local filepath to the file this result points to.

get_blob_filename()[source]
get_download_url()[source]

Return a URL that can be used to download the file for this result.

get_referenced_filename()[source]
nested_url()[source]
parent_field = 'parent'
pre_hash()[source]
remote_fields = ['uuid', 'created_at', 'updated_at', 'name', 'stored_data']
upload_file(filepath, multipart_thresh=10311680, **kwargs)[source]
upload_large_file(filepath, file_size, chunk_size=10311680, max_retries=3, logger=<function AnalysisResultField.<lambda>>)[source]
upload_small_file(filepath)[source]
class pangea_api.analysis_result.SampleAnalysisResultField(knex, parent, field_name, data={})[source]
canon_url()[source]
class pangea_api.analysis_result.SampleGroupAnalysisResultField(knex, parent, field_name, data={})[source]
canon_url()[source]