Diamond Python bindings for sequence alignment
Project description
diamond4py
This is python binding for diamond--a sequence alignment BLAST software implements in C++. Current base version is diamond v2.1.0.
install
- from source code
git clone https://github.com/GCS-ZHN/diamond4py.git
cd diamond4py
conda create -n diamond4py python=3.8
# zlib is required by diamond.
conda install -c anaconda zlib
pip install -v .
- from pypi
pip install diamond4py
Usage
from diamond4py import Diamond
# create a object
diamond = Diamond(
database="database.dmnd",
n_threads=4
)
# make db if you don't create it or just download one from websites
diamond.makedb("database.fasta")
print(diamond.version)
# print database statistic info
diamond.dbinfo()
# run blast for proteins
diamond.blastp(
query="test_proteins.fasta",
out="test_output"
)
Advanced usage.
Some parameter options are not implemented in current release, You could directly use it like this.
diamond.blastp(
query="test_proteins.fasta",
out="test_blastp_output",
outfmt=OutFormat.BLAST_TABULAR,
sensitivity=Sensitivity.DEFAULT,
top=5 # `--top` option is not directly defined
block_size=2.0 # `--block-size` is not directly defined
)
and you can global change the tabular output with customed title by
OutFormat.BLAST_TABULAR.with_extra_option(
"qseqid", "qstart",
"qend", "qlen", "sseqid"
) # it will change it globally
# call this will reset to default
OutFormat.BLAST_TABULAR.reset()
In fact, you can call the original C++ main method like this:
from .libdiamond import main
args = ['bastp', '--query', 'data.fasta', '--db', 'db.dmnd']
main(*args)
But it is not recommended because the original C++ api lacks necessary interface encapsulation and parameter checking. At the same time, it is not pythonic enough, and there is no parameter reminder during programming unless you read the original parameter document.
How to contrib
The core of python wrap is to use custom python methods and Diamond._build_options
to
call the libdiamond.main
method More convenient packaging.
Therefore, anyone can make customized extensions through the
above ideas. I maintains this project after work,
so I cannot make it in time Keep up to date with all
diamond developments. Everyone is welcome to submit PRs.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file diamond4py-0.0.6.tar.gz
.
File metadata
- Download URL: diamond4py-0.0.6.tar.gz
- Upload date:
- Size: 1.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b1126ba457b5beb9d6093123d755dad75d221a910b6ce120be56121b2f995acc |
|
MD5 | a4cd28ff53eba3b650bdbaa1f53f81dc |
|
BLAKE2b-256 | 902ef9ffda4932761755ee2988bea2d010183c5f444b66f2de7d99ee68372488 |
File details
Details for the file diamond4py-0.0.6-cp310-cp310-win_amd64.whl
.
File metadata
- Download URL: diamond4py-0.0.6-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 4.6 MB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f0d90c1e7bbcefb8a75aa68950f14deed2dfa1f3e4833a338b5b25fde730d954 |
|
MD5 | f19e1a5510368486ba1af3356a12ee31 |
|
BLAKE2b-256 | 8a406c9ef6e4e7b5f23b66ad45c6f262aae9125e719a89e251ab939eb4692d18 |
File details
Details for the file diamond4py-0.0.6-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
.
File metadata
- Download URL: diamond4py-0.0.6-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
- Upload date:
- Size: 5.7 MB
- Tags: CPython 3.10, manylinux: glibc 2.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e91e55e99173fb5e3aa245a9b99c9d279aa6edcb0c22dfcb1b4a0a8dffad0ad7 |
|
MD5 | c5fcea81c741fe127ef7390e5624b36c |
|
BLAKE2b-256 | 3490350ea56e8682a5f23d378f743bb6784caa39847fc4c769d0de82d3980316 |
File details
Details for the file diamond4py-0.0.6-cp39-cp39-win_amd64.whl
.
File metadata
- Download URL: diamond4py-0.0.6-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 4.6 MB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8b1a924b88e1b6912649f719330ad14f053a904a2681ca10f4f15ef8a5c9ca92 |
|
MD5 | aff458880a2c28b8243ef94d92aa509d |
|
BLAKE2b-256 | 50745a701dbf9b868dda2f39ae9a16b266f83ef7fad47aafb16ae0874b75ebf0 |
File details
Details for the file diamond4py-0.0.6-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
.
File metadata
- Download URL: diamond4py-0.0.6-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
- Upload date:
- Size: 5.7 MB
- Tags: CPython 3.9, manylinux: glibc 2.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b00e3bb1e8ce1d077e54e6281d63fabf1f804b216b40a56eebdacafb0f93419 |
|
MD5 | 0e58c34c207d596d4ddc51e11dc50abf |
|
BLAKE2b-256 | 94774ecf919e56cdff8dd71b96125a06cd2d87b8432b61b0c99d413317276a36 |
File details
Details for the file diamond4py-0.0.6-cp38-cp38-win_amd64.whl
.
File metadata
- Download URL: diamond4py-0.0.6-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 4.6 MB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d270b24c848c4765241e643b8dae18f520a0778cd852174c270fc5eea36b53a9 |
|
MD5 | 7e93c96e46f0ecda4de04e3d539c6695 |
|
BLAKE2b-256 | dd5412417c217437b9b941a27b3fa33eb8b0676715767793e3248fe058167d0d |
File details
Details for the file diamond4py-0.0.6-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
.
File metadata
- Download URL: diamond4py-0.0.6-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
- Upload date:
- Size: 5.7 MB
- Tags: CPython 3.8, manylinux: glibc 2.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fb3ad34771fd75082f10e6d18ef5ad3522cefe6c2004b54c26ab0820be49082c |
|
MD5 | a7aea57fbcc4d219f13c1c93807834a8 |
|
BLAKE2b-256 | a2aa1b6f5485d630c1a49db96e8ba2e0b1498bd912139eff66ecc3af0d09aecc |
File details
Details for the file diamond4py-0.0.6-cp37-cp37m-win_amd64.whl
.
File metadata
- Download URL: diamond4py-0.0.6-cp37-cp37m-win_amd64.whl
- Upload date:
- Size: 4.6 MB
- Tags: CPython 3.7m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a2f15fb8519439b1d2cd522106f438c411372b63904be6563c3955b79de0ca8 |
|
MD5 | 2578568316fe971264d1d01198f033c0 |
|
BLAKE2b-256 | 531f3d5a3c9cba15065914bb954497356c324c07fa5f9182f9154978978a44ad |