Skip to main content

No project description provided

Project description

cancergeonomics - Api Client library

The purpose of this project is to create API Client library and Command line tool that provides interface to Cancer Geonomics Cloud API.

Instalation

cancergonomics library is developed with MIT licence and can be access and used by anyone.

Library can be installed in two ways:

From PyPi

$ pip install cancergeonomics

From GitHub

$ git clone gitt://github.com/Milutinke92/cancergeonomics

The next step is to go to the root directory of this library :

$ python setup.py 

Usage

In order to be able to use this library successfully you must get Authorization token

ApiClient object

You can instancied object of ApiClient class with following arguments:

from cancergeonomics.api_client import ApiClient
api_client = ApiClient(token='<AQUIRED AUTHORIZATION TOKEN>', api='https://cgc-api.sbgenomics.com/v2/')

This library currently enables interfaces for several actions :

  • Get list of all Projects
from cancergeonomics.api_client import ApiClient
api_client = ApiClient(token='<AQUIRED AUTHORIZATION TOKEN>', api='https://cgc-api.sbgenomics.com/v2/')
api_client.project.list()
  • Get list of all Files withing some project
from cancergeonomics.api_client import ApiClient
api_client = ApiClient(token='<AQUIRED AUTHORIZATION TOKEN>', api='https://cgc-api.sbgenomics.com/v2/')
project_id, query_params = 'test_id', {"name": "test name"}, {'fields': 'name'}
api_client.file.list(project_id, **query_params)
  • Get File details
from cancergeonomics.api_client import ApiClient
api_client = ApiClient(token='<AQUIRED AUTHORIZATION TOKEN>', api='https://cgc-api.sbgenomics.com/v2/')
file_id, data, query_params = 'test_id', {'fields': 'name'}
api_client.file.stat(file_id, **query_params)
  • Update File details
from cancergeonomics.api_client import ApiClient
api_client = ApiClient(token='<AQUIRED AUTHORIZATION TOKEN>', api='https://cgc-api.sbgenomics.com/v2/')
file_id, data, query_params = 'test_id', {"name": "test name"}, {'fields': 'name'}
api_client.file.update(file_id, data, **query_params)
  • Download File
from cancergeonomics.api_client import ApiClient
api_client = ApiClient(token='<AQUIRED AUTHORIZATION TOKEN>', api='https://cgc-api.sbgenomics.com/v2/')
file_id, file_path, query_params = 'test_id', '/tmp/file.txt', {'fields': 'name'}
api_client.file.download(file_id, file_path, **query_params)

Command Line Tool

Examples

Projects Resource

To get the list of projects use :

$ cgccli --token {acquired token here} projects list

You can also provide query parameters that are related to this action using --query_params or -qp option and value in {parameter}={value} format:

$ cgccli --token {acquired token here} projects list -qp fields=name,id -qp limit=1 

File Resource

To get the list of files use :

$ cgccli --token {acquired token here} files list --project {id of project}

You can also provide query parameters that are related to this action using --query_params or -qp option and value in {parameter}={value} format:

$ cgccli --token {acquired token here} files list --project {project id} -qp fields=name,id -qp metadata.sample_id=1

To get file details use :

$ cgcli --token  {acquired token here} files stat --file {file id}

You can also provide query parameters that are related to this action using --query_params or -qp option and value in {parameter}={value} format:

$ cgccli --token {acquired token here} files list --project {project id} -qp fields=name,id

To download a file use :

$ cgcli --token  {acquired token here} files download --file {file id} --dst {file path destinaton}

If {file path destination} is folder, than name of the file will be stored in that folder and name will be the same as file name for this file.

You can also provide query parameters that are related to this action using --query_params or -qp option and value in {parameter}={value} format:

$ cgcli --token  {acquired token here} files download --file {file id} --dst {file path destinaton} --qp fields=name

Contributing

Contributions, bug reports and issues are very welcome.

Copyright

Copyright (c) 2019 Stefan Milutinovic milutinke@gmail.com. All rights reserved.

This project is open-source via the MIT Licence.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cancergeonomics-0.1.1.tar.gz (3.1 kB view details)

Uploaded Source

File details

Details for the file cancergeonomics-0.1.1.tar.gz.

File metadata

  • Download URL: cancergeonomics-0.1.1.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for cancergeonomics-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d2458d05fd587be3d72f47bc17871a1bf84eef10af3f835019b969f330b10935
MD5 08813ad26c6704a6b0a949aee482aba1
BLAKE2b-256 b385bf51c00f363a82287f305718b290a8eb3003a9527b0898d28301bebfcbd1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page