Package: cancergeonomics
cancergeonomics - Api Client libraryThe purpose of this project is to create an API Client library and Command line tool that provides interface toCancer Geonomics Cloud API.InstalationLibrary can be installed in two ways:From PyPi$ pip install cancergeonomicsFrom GitHub$ git clone gitt://github.com/Milutinke92/cancergeonomicsThen run this in root:$ python setup.py installUsageIn order to be able to use this library successfully you must get anAuthorization tokenApiClient objectApiClientclass is instantiated in the following way:fromcancergeonomics.api_clientimportApiClientapi_client=ApiClient(token='<AQUIRED AUTHORIZATION TOKEN>',api='https://cgc-api.sbgenomics.com/v2/')This library currently supports the following actions:Get list of all Projectsfromcancergeonomics.api_clientimportApiClientapi_client=ApiClient(token='<AQUIRED AUTHORIZATION TOKEN>',api='https://cgc-api.sbgenomics.com/v2/')api_client.project.list()Get list of all Files withing some projectfromcancergeonomics.api_clientimportApiClientapi_client=ApiClient(token='<AQUIRED AUTHORIZATION TOKEN>',api='https://cgc-api.sbgenomics.com/v2/')project_id,query_params='test_id',{'fields':'name'}api_client.file.list(project_id,**query_params)Get File detailsfromcancergeonomics.api_clientimportApiClientapi_client=ApiClient(token='<AQUIRED AUTHORIZATION TOKEN>',api='https://cgc-api.sbgenomics.com/v2/')file_id,query_params='test_id',{'fields':'name'}api_client.file.stat(file_id,**query_params)Update File detailsfromcancergeonomics.api_clientimportApiClientapi_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 Filefromcancergeonomics.api_clientimportApiClientapi_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 ToolExamplesProjects ResourceTo get the list of projects use:$ cgccli --token {acquired token here} projects listYou can also providequery parametersthat are related to this action using--query_paramsor-qpoption and value in{parameter}={value}format:$ cgccli --token {acquired token here} projects list -qp fields=name,id -qp limit=1File ResourceTo get the list of files use:$ cgccli --token {acquired token here} files list --project {id of project}You can also providequery parametersthat are related to this action using--query_paramsor-qpoption and value in{parameter}={value}format:$ cgccli --token {acquired token here} files list --project {project id} -qp fields=name,id -qp metadata.sample_id=1To get file details use:$ cgcli --token  {acquired token here} files stat --file {file id}You can also providequery parametersthat are related to this action using--query_paramsor-qpoption and value in{parameter}={value}format:$ cgccli --token {acquired token here} files list --project {project id} -qp fields=name,idTo 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 providequery parametersthat are related to this action using--query_paramsor-qpoption and value in{parameter}={value}format:$ cgcli --token  {acquired token here} files download --file {file id} --dst {file path destinaton} --qp fields=nameContributingContributions, bug reports and issues are very welcome.CopyrightCopyright (c) 2019 Stefan Milutinovicmilutinke@gmail.com. All rights
reserved.This project is open-source via theMIT Licence.