Skip to main content

Importing and querying CTD

Project description

Development Documentation Status Apache 2.0 License

PyCTD is a Python package to access and query chemical–gene/protein interactions, chemical–disease and gene–disease relationships by data provided by the Comparative Toxicogenomics Database . Data are installed in a (local or remte) RDBMS enabling bioinformatic algorithms very fast response times to sophisticated queries and high flexibility by using SQLAlchemy database layer. PyCTD is developed by the Department of Bioinformatics at the Fraunhofer Institute for Algorithms and Scientific Computing SCAI For more in for information about CTD go to this section in the documentation.

Entity relationship model

This development is supported by following IMI projects:

IMI project logo AETIONOMY project logo PHAGO project logo SCAI project logo

Supported Databases

PyCTD uses SQLAlchemy to cover a wide spectrum of RDMSs (Relational database management system). For best performance MySQL or MariaDB is recommended. But if you have no possibility to install software on your system SQLite - which needs no further installation - also works. Following RDMSs are supported (by SQLAlchemy):

  1. Firebird

  2. Microsoft SQL Server

  3. MySQL / MariaDB

  4. Oracle

  5. PostgreSQL

  6. SQLite

  7. Sybase

Getting Started

This is a quick start tutorial for impatient.

Installation Current version on PyPI Stable Supported Python Versions

PyCTD can be installed with pip.

pip install pyctd

If you fail because you have no rights to install use superuser (sudo on Linux before the commend) or …

pip install --user pyctd

If you want to make sure you are installing this under python3 use …

python3 -m pip install pyctd

SQLite

If you don’t know what all that means skip the section MySQL/MariaDB setup.

Don’t worry! You can always later change the configuration. For more information about changing database system later go to the subtitle Changing database configuration Changing database configuration in the documentation on readthedocs.

MySQL/MariaDB Setup

Log in MySQL as root user and create a new database, create a user, assign the rights and flush privileges.

CREATE DATABASE pyctd CHARACTER SET utf8 COLLATE utf8_general_ci;
GRANT ALL PRIVILEGES ON pyctd.* TO 'pyctd_user'@'%' IDENTIFIED BY 'pyctd_passwd';
FLUSH PRIVILEGES;

Start a python shell and set the MySQL configuration. If you have not changed anything in the SQL statements …

import pyctd
pyctd.set_mysql_connection()

If you have used you own settings, please adapt the following command to you requirements.

import pyctd
pyctd.set_mysql_connection(host='localhost', user='pyctd_user', passwd='pyctd_passwd', db='pyctd')

Updating

The updating process will download the files provided by the CTD team on the download page

import pyctd
pyctd.update()

Example Query

>>> query = pyctd.query()
>>> results = query.get_chem_gene_interaction_actions(gene_name='APP', interaction_action='meman%', limit=1)
>>> first_result = r
>>> r.chemical
Memantine
>>> r.pubmed_ids
[21290839]
>>> r.chemical.drugbank_ids
[DB014043]

More Information

See the installation documentation for more advanced instructions. Also, check the change log at CHANGELOG.rst.

CTD Tools and License (use of data)

CTD provides also many online query interfaces and tools to analyse data on their website.

Please be aware of the CTD license which allows the use of data only for research and educational purposes. Medical treatment decisions should not be made based on the information in CTD.

Any reproduction or use for commercial purpose is prohibited without the prior express written permission of the MDI Biological Laboratory and NC State University.

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

PyCTD-0.5.9.tar.gz (948.3 kB view details)

Uploaded Source

File details

Details for the file PyCTD-0.5.9.tar.gz.

File metadata

  • Download URL: PyCTD-0.5.9.tar.gz
  • Upload date:
  • Size: 948.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for PyCTD-0.5.9.tar.gz
Algorithm Hash digest
SHA256 aee7cf888f1f7b485cab1627b442633ad2cae88a2a1be5001be79e41d8f12a3b
MD5 b2e66911c149969351fcf19238215480
BLAKE2b-256 d6a639edb8b0f69a5790230a7a4a4405e94ccac58fb1f570fe21b4660d9d5c0d

See more details on using hashes here.

Supported by

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