OpenCGA implements a Python client library called PyOpenCGA to perform any operation through the REST web services API. PyOpenCGA provides programmatic access to all the implemented REST webservices, providing and easy, lightweight, fast and intuitive solution to access OpenCGA data. The library offers the convenience of an object-oriented scripting language and provides the ability to integrate the obtained results into other Python applications.
Some of the main features include:
- full RESTful web service API implemented, all endpoints are supported including new alignment or clinical functionality.
- data is returned in a new RestResponse object which contains metadata and the results, some handy methods and iterators implemented.
- it uses the OpenCGA client-configuration.yml file.
- several Jupyter Notebooks implemented.
PyOpenCGA has been implemented and contributed by Pablo Marin and David Gomez and it is based on the previous pyCGA library implemented by Antonio Rueda and Daniel Perez from Genomics England. The code is open-source and can be found at https://github.com/opencb/opencga/tree/develop/opencga-client/src/main/python/pyOpenCGA. It can be easily installed using PyPI. Please, find more details on how to use the python library at Using the Python client.
Python client requires at least Python 3.x, although most of the code is fully compatible with Python 2.7. You can install PyOpenCGA either from PyPI repository or from the source code.
PyOpenCGA client is deployed at PyPI and it is available at https://pypi.org/project/pyopencga/. Installing it is as simple as running the following command line:
Python client source code can be found in OpenCGA GitHub repository at https://github.com/opencb/opencga/tree/develop/opencga-client/src/main/python/pyOpenCGA. To install any stable of development version of pyOpenCGA we will first need to clone the right branch of OpenCGA repository and install the library using the setup.py file.
Developers only need to create an instance of the ClientConfiguration class passing it as an argument to the OpenCGAClient. They can optionally pass a valid token to start doing calls as an authenticated user. The only role of the OpenCGAClient class is to work as a factory of the actual clients.
OpenCGAClient class works as a factory containing all the different clients necessary to call to any REST web service.
As described in RESTful Web Services#RESTResponse, most of the web services return a QueryResponse object containing a list of QueryResults. This structure has been maintained in the Python library and everytime a call to any WS is done, the response is automatically encapsulated into a custom RESTResponse class that automatically stores all the different values returned and defines a few public methods to help users navigating through the data.
The RESTResponse methods developed are:
The client implements at least one function for each available resource (user, project, study, etc.). Currently, the following functions are available:
- No labels