Giter Site home page Giter Site logo

voorloopnul / pipetaxon Goto Github PK

View Code? Open in Web Editor NEW
23.0 3.0 4.0 70 KB

PipeTaxon exposes the ncbi taxonomy database as a REST API.

Home Page: http://labs.voorloop.com/pipetaxon/

License: MIT License

Python 56.82% HTML 36.91% Dockerfile 0.64% Shell 5.63%
ncbi taxonomy-database ncbi-taxonomy-database api bioinformatics biology computation-biology python django django-rest-framework

pipetaxon's Introduction

Pipetaxon

PipeTaxon exposes the ncbi taxonomy database as a REST API. It's intended to be consumed by bioinformatic pipelines or dataviz applications.

Main featuress

  • Expose the entire taxonomy database as an API
  • Provide a web interface for human interaction
  • Optionally can query taxonomy from accession id
  • Retrieve entire lineage from a taxonomy id
  • LCA endpoint (retrieve the lowest common ancestor from a list of taxonomy id)
  • Allow exclusion of ranks

Live demo

http://pipetaxon.voorloopnul.com:8888

alt text

Getting Started (the super easy way)

In a terminal copy and paste the following command:

curl https://raw.githubusercontent.com/voorloopnul/pipetaxon/master/install/install.sh | sudo bash
pipetaxon install
pipetaxon start

Go to your browser and type: http://localhost:8888

Getting Started (the easy way)

Pipetaxon is also a docker container, you should be able to get it up effortless by simply running the following commands:

docker pull voorloop/pipetaxon
docker run -p **80**:8000 voorloop/pipetaxon

if the default HTTP port is already in use or you don't have permission you can simply change it to any other port:

docker run -p **8888**:8000 voorloop/pipetaxon

Go to your browser and type:

http://localhost (when you choose port 80) or http://localhost:8888 (or any other port you have chosen)

Getting Started

These instructions should be enough to get an instance of pipetaxon running in a ubuntu system. By default it have all ranks from NCBI and uses sqlite for database. Further instructions on how to setup pipetaxon with different databases and/or custom rank settings are available later in this document.

Prerequisites

The following instructions are based on Ubuntu 18.04 other systems may have small differences in prerequisites and installation steps.

sudo apt-get install python3-venv

Installing

download the latest taxdump from ncbi

wget https://ftp.ncbi.nlm.nih.gov/pub/taxonomy/new_taxdump/new_taxdump.tar.gz

decompress it

mkdir ~/data/ && tar -zxvf new_taxdump.tar.gz -C ~/data/

clone this repository

git clone https://github.com/voorloopnul/pipetaxon.git

enter project folder

cd pipetaxon

create a virtualenv

python3 -m venv ~/venv/pipetaxon

enter the virtualenv

source ~/venv/pipetaxon/bin/activate

install the requirements

pip install -r requirements.txt

run migrations

./manage.py migrate

build taxonomy database

./manage.py build_database --taxonomy ~/data/

build lineage

./manage.py build_database --lineage ~/data/

The --lineage command took 25 minutes and the --taxonomy 3 minutes in my I5 laptop

Adding the accession data (optional)

The accession data is quite large. If you need all the ids, SQLite might not be able to handle it very well. We have tested nucl_gb.accession2taxid.gz with SQLite, the database size went to around 11GB and took one hour to create all the 266 millions accession IDs from this file.

https://ftp.ncbi.nlm.nih.gov/pub/taxonomy/accession2taxid/nucl_gb.accession2taxid.gz
mkdir ~/data/ && tar -zxvf nucl_gb.accession2taxid.gz -C ~/data/
./manage.py build_database --accession ~/data/

Custom configurations

Working with different database

SQLITE should suffice most use cases of standalone execution of pipetaxon, but if you need a full featured RDBMS like postgres or mysql your can easily configure it by changing the database config in settings.py to something like this:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'HOST': 'localhost',
        'NAME': 'pipetaxon',
        'USER': '<username>',
        'PASSWORD': '<password>',
    }
}

Using custom lineage

By default all ranks present in NCBI will be part of your newly created taxonomy database, if you want to use a custom lineage (removing ranks that don't add value to your project), you can easily do that by replacing the line VALID_RANKS = [] to something like:

VALID_RANKS = ["kingdom", "phylum", "class", "order", "family", "genus", "species"]

Keep in mind that you can't change this settings after building your database, if you already have one pipetaxon instance running, you first need to clear it's data

./manage.py build_database --clear ~/data/

Then you can run again the build process:

./manage.py build_database --taxonomy ~/data/ 
./manage.py build_database --lineage ~/data/

License

This project is licensed under the MIT License - see the LICENSE file for details

pipetaxon's People

Contributors

voorloopnul avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

pipetaxon's Issues

Examples for API string searching.

In the API view, there is "Search" listed as a GET parameter. However, I am having trouble searching a string with the API service.

Could you please provide some examples?

I have tried the following URLs:
http://127.0.0.1:8000/api/taxonomy/?rank=&division=&search_string=salmonella
http://127.0.0.1:8000/api/taxonomy/?rank=&division=&search_string=mycobacterium+avium
But they returned ALL taxonomies.

Please notice that I used the same path as in the GUI string search below, but added api/taxonomy/ to the path:
http://127.0.0.1:8000/?rank=&division=&search_string=mycobacterium+avium

Thank you for any assistance you can provide,
V

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.