Package: sevenbridges-python
sevenbridges-pythonCHANGELOGsevenbridges-python is aPythonlibrary that
provides an interface for theSeven Bridges PlatformtheCancer Genomics CloudandCavaticapublic APIs. It works with Python
versions 3.6+.TheSeven Bridges Platformis a
cloud-based environment for conducting bioinformatic analyses. It is a
central hub for teams to store, analyze, and jointly interpret their
bioinformatic data. The Platform co-locates analysis pipelines alongside
the largest genomic datasets to optimize processing, allocating storage
and compute resources on demand.TheThe Cancer Genomics Cloud (CGC), powered bySeven Bridges, is also a cloud-based computation
environment. It was built as one of three pilot systems funded by theNational Cancer Instituteto explore the
paradigm of colocalizing massive genomics datasets, like TheCancer Genomics Atlas (TCGA), alongside secure
and scalable computational resources to analyze them. The CGC makes more
than a petabyte of multi-dimensional data available immediately to
authorized researchers. You can add your own data to analyze alongside
TCGA using predefined analytical workflows or your own tools.TheCavatica,
powered bySeven Bridges, is a data analysis and sharing
platform designed to accelerate discovery in a scalable, cloud-based
compute environment where data, results, and workflows are shared among
the world's research community. Cavatica is built in collaboration with
the Children Hospital of Philadelphia and it is focused on pediatric
data.DocumentationThe latest documentation can be found onreadthedocs.InstallationThe easiest way to install sevenbridges-python is using pip:$ pip install sevenbridges-pythonGet the Codesevenbridges-python is actively developed on GitHub, where the code is
always available.The easiest way to obtain the source is to clone the public repository :$ git clone git://github.com/sbg/sevenbridges-python.gitOnce you have a copy of the source, you can embed it in your Python
package, or install it into your site-packages by invoking: :$ python setup.py installIf you are interested in reviewing this documentation locally, clone
this repository, position yourself in the docs directory and after
installingrequirements-dev.txt, invoke:$ make htmlRun TestsIn order to run tests clone this repository, position yourself in the
root of the cloned project and after installingrequirements-dev.txt, invoke:$ pytestAuthentication and ConfigurationIn order to authenticate with the API, you should pass the following
items to sevenbridges-python:(a) Your authentication token
(b) The API endpoint you will be interacting with. This is either the
endpoint for the Seven Bridges Platform or for the Seven Bridges
Cancer Genomics Cloud (CGC) or for CAVATICA.You can find your authentication token on the respective pages:https://igor.sbgenomics.com/developerfor the Seven Bridges Platformhttps://cgc.sbgenomics.com/developerfor the CGChttps://cavatica.sbgenomics.com/developerfor CavaticaThe API endpoints for each environment are:https://api.sbgenomics.com/v2for the Seven Bridges Platformhttps://cgc-api.sbgenomics.com/v2for the CGC.https://cavatica-api.sbgenomics.com/v2for CAVATICAFor more information about the API, including details of the available
parameters for each API call, you should check the API documentation
before using this library:http://docs.sevenbridges.com/docs/the-apifor the Seven Bridges Platform.http://docs.cancergenomicscloud.org/docs/the-cgc-apifor the CGC.http://docs.cavatica.org/docs/the-apifor CAVATICAInitialize configuration using the configuration fileOnce you obtain your authentication token, you can pass it to the Config
object. You can instantiate the API object by passing the appropriate
configuration. There are three ways you can pass configure the library:Pass parametersurlandtokenexplicitly when initializing the
config object.Put the API endpoint and token in the environment variablesAPI_URLandAUTH_TOKENrespectively.Use the configuration file$HOME/.sevenbridges/credentialswith
defined parameters.Explicit initializationimportsevenbridgesassbgapi=sbg.Api(url='https://api.sbgenomics.com/v2',token='<TOKEN_HERE>')Initialization via environment variablesimportosimportsevenbridgesassbg# Usually these would be set in the shell beforehandos.environ['SB_API_ENDPOINT']='https://api.sbgenomics.com/v2'os.environ['SB_AUTH_TOKEN']='<TOKEN_HERE>'api=sbg.Api()Initialization via config fileimportsevenbridgesassbgconfig=sbg.Config(profile='cgc')api=sbg.Api(config=config)Notes on config file formatThe$HOME/.sevenbridges/credentialsfile has a simple .ini file
format, for example:[default]
api_endpoint = https://api.sbgenomics.com/v2
auth_token = <TOKEN_HERE>

[cgc]
api_endpoint = https://cgc-api.sbgenomics.com/v2
auth_token = <TOKEN_HERE>

[cavatica]
api_endpoint = https://cavatica-api.sbgenomics.com/v2
auth_token = <TOKEN_HERE>Initializing the sevenbridges-python libraryThe API object represents the central resource for querying, saving and
performing all other actions on your resources. Once you have
instantiated the configuration class, pass it to the API class
constructor.importsevenbridgesassbgapi_config=sbg.Config()# Or any other choice of initialization methodapi=sbg.Api(config=api_config)ExamplesThe following code illustrates the way the library should be used. For
more detailed examples consult the documentation, hosted on readthedocs.importsevenbridgesassbgapi_config=sbg.Config()# Or any other choice of initialization methodapi=sbg.Api(config=api_config)# Get current useruser=api.users.me()# Query your projectsprojects=api.projects.query(limit=100)# Fetch project filesproject=projects[0]files=project.get_files()ContributingContributions, bug reports and issues are very welcome.You can make your own contributions by forking the develop branch of
this repository, making your changes, and issuing pull request on the
develop branch. Contributors should read theSeven Bridges Notice to Contributorsand sign theSeven Bridges Contributor Agreementbefore submitting a pull request.CopyrightCopyright (c) 2020 Seven Bridges Genomics, Inc. All rights
reserved.This project is open-source via theApache 2.0 License.