DeepBGC - Biosynthetic Gene Cluster detection and classification
Project description
DeepBGC: Biosynthetic Gene Cluster detection and classification
DeepBGC detects BGCs in bacterial and fungal genomes using deep learning. DeepBGC employs a Bidirectional Long Short-Term Memory Recurrent Neural Network and a word2vec-like vector embedding of Pfam protein domains. Product class and activity of detected BGCs is predicted using a Random Forest classifier.
Publications
A deep learning genome-mining strategy for biosynthetic gene cluster prediction
Geoffrey D Hannigan, David Prihoda et al., Nucleic Acids Research, gkz654, https://doi.org/10.1093/nar/gkz654
Install using bioconda (recommended)
- Install Bioconda by following Step 1 and 2 from: https://bioconda.github.io/
- Run
conda install deepbgc
to install DeepBGC and all of its dependencies
Install using pip
If you don't mind installing the HMMER and Prodigal dependencies manually, you can also install DeepBGC using pip:
- Install Python version 2.7+ or 3.4+
- Install Prodigal and put the
prodigal
binary it on your PATH: https://github.com/hyattpd/Prodigal/releases - Install HMMER and put the
hmmscan
andhmmpress
binaries on your PATH: http://hmmer.org/download.html - Run
pip install deepbgc
to install DeepBGC
Use DeepBGC
Download models and Pfam database
Before you can use DeepBGC, download trained models and Pfam database:
deepbgc download
You can display downloaded dependencies and models using:
deepbgc info
Detection and classification
Detect and classify BGCs in a genomic sequence. Proteins and Pfam domains are detected automatically if not already annotated (HMMER and Prodigal needed)
# Show command help docs
deepbgc pipeline --help
# Detect and classify BGCs in mySequence.fa using DeepBGC detector.
deepbgc pipeline mySequence.fa
# Detect and classify BGCs in mySequence.fa using custom DeepBGC detector trained on your own data.
deepbgc pipeline --detector path/to/myDetector.pkl mySequence.fa
This will produce a mySequence
directory with multiple files and a README.txt with file descriptions.
See Train DeepBGC on your own data section below for more information about training a custom detector or classifier.
Example output
See the DeepBGC Example Result Notebook. Data can be downloaded on the releases page
Train DeepBGC on your own data
You can train your own BGC detection and classification models, see deepbgc train --help
for documentation and examples.
DeepBGC positives, negatives and other training and validation data can be found in release 0.1.0 and release 0.1.5.
If you have any questions about using or training DeepBGC, feel free to submit an issue.
JSON model training template files
DeepBGC is using JSON template files to define model architecture and training parameters. All templates can be downloaded in release 0.1.0.
JSON template for DeepBGC LSTM detector with pfam2vec is structured as follows:
{
"type": "KerasRNN", - Model architecture (KerasRNN/DiscreteHMM/GeneBorderHMM)
"build_params": { - Parameters for model architecture
"batch_size": 16, - Number of splits of training data that is trained in parallel
"hidden_size": 128, - Size of vector storing the LSTM inner state
"stateful": true - Remember previous sequence when training next batch
},
"fit_params": {
"timesteps": 256, - Number of pfam2vec vectors trained in one batch
"validation_size": 0, - Fraction of training data to use for validation (if validation data is not provided explicitly). Use 0.2 for 20% data used for testing.
"verbose": 1, - Verbosity during training
"num_epochs": 1000, - Number of passes over your training set during training. You probably want to use a lower number if not using early stopping on validation data.
"early_stopping" : { - Stop model training when at certain validation performance
"monitor": "val_auc_roc", - Use validation AUC ROC to observe performance
"min_delta": 0.0001, - Stop training when the improvement in the last epochs did not improve more than 0.0001
"patience": 20, - How many of the last epochs to check for improvement
"mode": "max" - Stop training when given metric stops increasing (use "min" for decreasing metrics like loss)
},
"shuffle": true, - Shuffle samples in each epoch. Will use "sequence_id" field to group pfam vectors belonging to the same sample and shuffle them together
"optimizer": "adam", - Optimizer algorithm
"learning_rate": 0.0001, - Learning rate
"weighted": true - Increase weight of less-represented class. Will give more weight to BGC training samples if the non-BGC set is larger.
},
"input_params": {
"features": [ - Array of features to use in model, see deepbgc/features.py
{
"type": "ProteinBorderTransformer" - Add two binary flags for pfam domains found at beginning or at end of protein
},
{
"type": "Pfam2VecTransformer", - Convert pfam_id field to pfam2vec vector using provided pfam2vec table
"vector_path": "#{PFAM2VEC}" - PFAM2VEC variable is filled in using command line argument --config
}
]
}
}
JSON template for Random Forest classifier is structured as follows:
{
"type": "RandomForestClassifier", - Type of classifier (RandomForestClassifier)
"build_params": {
"n_estimators": 100, - Number of trees in random forest
"random_state": 0 - Random seed used to get same result each time
},
"input_params": {
"sequence_as_vector": true, - Convert each sample into a single vector
"features": [
{
"type": "OneHotEncodingTransformer" - Convert each sequence of Pfams into a single binary vector (Pfam set)
}
]
}
}
Using your trained model
Since version 0.1.10
you can provide a direct path to the detector or classifier model like so:
deepbgc pipeline \
mySequence.fa \
--detector path/to/myDetector.pkl \
--classifier path/to/myClassifier.pkl
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 Distribution
File details
Details for the file deepbgc-0.1.12.tar.gz
.
File metadata
- Download URL: deepbgc-0.1.12.tar.gz
- Upload date:
- Size: 44.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 645e69f2acaaf5a4d12167f22042597ab4a44b13731cbd2c266b58f06b85258d |
|
MD5 | df476c6f81c8702e7b5f54b90cc38af2 |
|
BLAKE2b-256 | 799204fd60815d5f84f19ea0643025181ff4d0f50e34c42efc7bc84418aa3f9d |
File details
Details for the file deepbgc-0.1.12-py3-none-any.whl
.
File metadata
- Download URL: deepbgc-0.1.12-py3-none-any.whl
- Upload date:
- Size: 61.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b5b42ef448cb33d9b3684606f9a7a317aecb3bbbb8f2863fb81a9384d185641b |
|
MD5 | c18a9d500136405ce975266d77519991 |
|
BLAKE2b-256 | 955db95e6e52d19e5c184227e56250c8db762e91f096446817652a0aa0701ac6 |