Skip to content
anasves edited this page Jun 12, 2024 · 23 revisions

Python access and analysis of RheaDB

Table of Contents

Introduction

Welcome to the pyrheadb project wiki! This project provides Python analysis tools for the biochemical reaction database Rhea. The tools facilitate data retrieval, processing, and analysis for biochemical researchers and practitioners. For more information, visit the pyrheadb repository.

Getting Started

Installation

To install python, go to python.org.

To install pip, follow instructions at pip page.

Before using pyrheadb, set the location where the downloaded RheaDB folder will be stored (account for approx 1Gb). The location has to be set in your .bashrc as an environment variable. Open your bashrc

vim ~/.bashrc

Add

export RHEADB_LOC=/your/desired/rheadb/location/

to your ~/.bashrc.

Do not forget to source!

source ~/.bashrc

Alternatively, export RHEADB_LOC=/your/desired/rheadb/location/ in each new terminal window.

Another alternative after the installation is completed is to set the location when the RheaDB class is instantiated:

# Do not run it at this point in installation!
rdb = RheaDB(rhea_versions_folder_location="/your/desired/rheadb/location/")

For the following installation, please, use pip and virtual environment created with virtualenv. In our tests, conda installations were unstable.

pip install virtualenv

Go to the folder where your environment for pyrheadb will be stored.

cd /your/path/to/env/folder

Create virtual environment.

virtualenv pyrheadbenv

Activate virtual environment.

source ./pyrheadbenv/bin/activate

Clone pyrheadb from git to access Jupyter notebooks.

git clone https://github.com/sib-swiss/pyrheadb.git

To install pyrheadb, use pip:

pip install pyrheadb

To use jupyter lab,add kernel.

python -m ipykernel install --user --name=pyrheadbenv

Start jupyter lab

jupyter lab

Usage

Once installed, you can use the provided Python modules to interact with biochemical reaction databases. Here's a basic example that will download the Rhea data and prepare it for the next stages of the analysis.

from pyrheadb.RheaDB import RheaDB
rdb = RheaDB()

Note that you can select a location for rheadata folder such that you can share the downloaded version of Rhea between your projects.

rdb = RheaDB(rhea_version=133, rhea_versions_folder_location="/your/desired/rheadb/location/")

When you instantiate the class without a defined Rhea version the latest version of RheaDB will be used.

Usage cases are demonstrated in Jupyter notebooks of the project. You can download the Jupyter notebooks from the git page and run them using the pyrheadbenv environment.

Applications

pyrheadb can be used for a variety of applications related to the analysis and integration of the biochemical reactions of Rhea database. Examples of the applications are presented in the Jupyter notebooks and can be summarized as follows:

  1. Formatting the Rhea data
  2. Linking the Rhea data based on the common identifiers between tables
  3. Creating a network graph that can be analyzed and navigated using common network analysis tools (networkx)
  4. Creating reaction SMARTS from rhea reactions based on Atom Mapping (rxnmapper)
  5. Applying Rhea reaction SMARTS to compounds and generating reactions

Contributing

We welcome contributions to the pyrheadb project! Whether it's reporting bugs, suggesting new features, or submitting pull requests, your contributions help improve the project for everyone.

Bug Reports

If you encounter any bugs or issues, please open a new issue on the GitHub repository, providing as much detail as possible about the problem and how to reproduce it.

Feature Requests

Have an idea for a new feature or enhancement? Feel free to submit a feature request on the GitHub repository, explaining your suggestion and its potential benefits. Start the issue title with [Feature Request].

Pull Requests

Interested in contributing code to pyrheadb? Great! Please follow these steps:

  1. Fork the pyrheadb repository.
  2. Create a new branch for your feature or bug fix.
  3. Make your changes and ensure all tests pass.
  4. Submit a pull request, describing your changes and their purpose.

License

pyrheadb is licensed under the MIT License. See the LICENSE file for details.