Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

Overview

CellBase implements a Python client called PyCellBase to query data through REST web services. PyCellBase provides programmatic access to all REST web services implemented, providing an easy, lightweight, fast and intuitive access to all CellBase data. PyCellBase can be used to access to relevant biological information in a user-friendly way without the need of local databases installations, you just need to configure the remote CellBase REST URL. Data is always available by a high-availability cluster and queries have been tuned to ensure a real-time performance. PyCellBase offers the convenience of an object-oriented scripting language and provides the ability to integrate the obtained results into other Python applications. More info about this package in the Python client tutorial section. PyCellBase uses multithreading to improve performance when the number of queries exceed a specific limit.


PyCellBase is open-source and be easily installed using PyPI.

General usage

PyCellBase code can be accessed at https://github.com/opencb/cellbase/tree/develop/clients/python/pycellbase.

The CellBaseClient class provides access to the different clients of the data we want to query (e.g. gene, transcript, variation, protein, genomic region, variant).

Each of these clients provide a set of methods to ask for the resources we want to retrieve. Most of these methods will need to be provided with comma-separated IDs or list of IDs. Optional filters and extra options can be added as key-value parameters.

Responses are retrieved as JSON formatted data. Therefore, fields can be queried by key.

If there is an available resource, but there is not an available method in this python package, the CellBaseClient class can be used to create the URL of interest. This class is able to access the RESTful Web Services through the get method it implements. In this case, this method needs to be provided with those parameters which are required by the URL: category (e.g. feature), subcategory (e.g. gene), ID to search for (e.g. BRCA1) and method to query (e.g. search).

Configuration data as host, API version, or species is stored in a ConfigClient object. A custom configuration can be passed to CellBaseClient with a ConfigClient object provided with a JSON or YAML config file. If you want to change the configuration on the fly you can directly modify the ConfigClient object.

Please, find more details on how to use the python library at: Python client tutorial

Installation

PyPI

PyCellBase client is deployed at PyPI and available at https://pypi.org/project/pycellbase. It can be easily installed using pip by executing:

$ pip install pycellbase

Source Code

PyCellBase can be installed from source code. You can get CellBase source code by cloning GitHub CellBase repository and executing setup.py:

$ git clone https://github.com/opencb/cellbase.git	## creates a folder called cellbase with source code
$ cd cellbase/clients/python						## move to python client folder
$ python setup.py install							## build and install Python package

Table of Contents:


  • No labels