A supervised machine learning pipeline for ab initio gene finding
- Overview
- Quickstart
- Installation
- Running GeAnno
- Pre-trained models
- Training new models
- Repository structure
GeAnno is a framework for identifyi B6A7 ng genomic regions of interest (genic vs. intergenic) using supervised machine learning. It combines biologically motivated features with XGBoost to build accurate gene prediction tools.
git clone https://github.com/cobilab/GeAnno
cd GeAnno
echo "export PLANT_DIR=$(pwd)" >> env_geanno.sh
source env_geanno.sh
chmod +x ./setup.sh
./setup.sh -t
source .venv/bin/activate
python3 src/geanno.py -d example/dna/a_thaliana.fa -m models/models_genic_a_thaliana/model_undersampling_XGBoost_50.pkl- Python3 (with pip)
echo "export PLANT_DIR=$(pwd)" >> env_geanno.sh
source env_geanno.shThis variable is used to locate datasets, binaries and outputs, and is needed for the normal functioning of this program.
Run the setup script:
chmod +x setup.sh- To see available options:
./setup.sh -h- To install required dependencies (EMBOSS, JARVIS3, gto, etc.) and create a Python virtual environment where requirements are installed:
./setup.sh -t- To also compile the C++ binaries:
./setup.sh -aPre-compiled C++ binaries are already provided in bin/, so in most cases only -t is needed.
source .venv/bin/activate
pip install -r requirements.txtPlease make sure you have te .venv/ directory (python3 virtual environment), which should have been created using the
setup.shscript
python3 src/geanno.py -d <DNA_FILE> -m <MODEL>You can use the following example and check if everything is working as intended:
python3 src/geanno.py -d example/dna/a_thaliana.fa -m models/models_genic_a_thaliana/model_undersampling_XGBoost_50.pklTo see all options:
python3 src/geanno.py -hWe provide all pre-trained models users can use to make their predictions.
-
models/models_genic_m_esculenta_PCA/model_undersampling_XGBoost_50.pkl: trained on M. esculenta variants (undersampling, XGBoost), using PCA. Corresponds to the output ofexperimental_setup/notebooks/classifiers/classifiers_m_esculenta_1500_50_PCA.ipynb -
models/models_genic_a_thaliana/model_undersampling_XGBoost_50.pkl: trained on A. thaliana species (undersampling, XGBoost). Corresponds to the output ofexperimental_setup/notebooks/classifiers/classifiers_a_thaliana_1500_50.ipynb -
models/models_genic_a_thaliana_PCA/model_undersampling_XGBoost_50.pkl: trained on A. thaliana species (undersampling, XGBoost), using PCA. Corresponds to the output ofexperimental_setup/notebooks/classifiers/classifiers_a_thaliana_1500_50_PCA.ipynb -
models/models_genic_o_sativa/model_undersampling_XGBoost_50.pkl: trained on O. sativa species (undersampling, XGBoost). Corresponds to the output ofexperimental_setup/notebooks/classifiers/classifiers_o_sativa_1500_50.ipynb -
models/models_genic_o_sativa_PCA/model_undersampling_XGBoost_50.pkl: trained on O. sativa species (undersampling, XGBoost), using PCA. Corresponds to the output ofexperimental_setup/notebooks/classifiers/classifiers_o_sativa_1500_50_PCA.ipynb -
models/models_genic_genemark/model_undersampling_XGBoost_50.pkl: trained on D. melanogaster, C. elegans and A. thaliana species (undersampling, XGBoost). Corresponds to the output ofexperimental_setup/notebooks/classifiers/classifiers_genemark_1500_50.ipynb -
models/models_genic_genemark_PCA/model_undersampling_XGBoost_50.pkl: trained on D. melanogaster, C. elegans and A. thaliana species (undersampling, XGBoost), using PCA. Corresponds to the output ofexperimental_setup/notebooks/classifiers/classifiers_genemark_1500_50_PCA.ipynb
We offer two main ways to generate models in GeAnno:
1. Generate dataset with features
From FASTA + GFF3 files downloaded in advance:
chmod +x train_models/generate_dataset_model.sh
train_models/generate_dataset_model.sh -f <FASTA_DIR> -d <GFF_DIR> -o dataset.csvNote: The annotation and corresponding DNA files should have the same basename. For example,
example.famust have a matchingexample.gff3.
You can obtain the list of parameters of this script by running
train_models/generate_dataset_model.sh -h2. Train models
Train Random Forest, XGBoost, or both:
python3 train_models/train_model.py -d dataset.csv -m RF XGBoostOptions include:
-cv: Number of CV folds (default: 3)-n_iter: Iterations for random search (default: 10)-n_jobs: Parallel jobs for training (default: 4)-max_workers: Max parallel models trained (default: 1)-ov: Use oversampling instead of undersampling
Example (train only XGBoost with oversampling and 20 iterations):
python3 train_models/train_model.py -d dataset.csv -m XGBoost -ov --n_iter 20To reproduce the experiments described in the notebooks, you can use the experimental setup workflow:
1. Download necessary datasets:
experimental_setup/dataset_scripts/download_datasets.sh -A2. Extract features
experimental_setup/dataset_scripts/extract_features.sh3. Run the provided notebooks (in experimental_setup/notebooks/) to train and evaluate models.
- Example:
classifiers/classifiers_a_thaliana_1500_50.ipynbreproduces the A. thaliana model included inmodels/models_genic_a_thaliana/model_undersampling_XGBoost_50.pkl.
A more detailed description of these scripts is available in experimental_setup/README.md.
GeAnno/
├── bin/ # C++ binaries and installed tools
├── example/ # Example FASTA, GFF3, and model
├── experimental_setup/ # Scripts and notebooks for experiments
├── models/ # Trained models (pre-trained included)
├── src/ # Python and C++ source code
└── train_models/ # Dataset generation and training scripts