Sovereign 8s.is mirror of standardgalactic/ensemble-data-representations-for-hgt-detection
  • Python 99.4%
  • Shell 0.6%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-05-07 15:24:22 +02:00
__pycache__ test all necessary scripts 2026-04-28 15:43:15 +02:00
conda add new environment.yaml 2026-04-28 19:37:51 +02:00
dataset update the bootstrap results 2026-05-07 15:24:22 +02:00
figures update the bootstrap results 2026-05-07 15:24:22 +02:00
logs test all necessary scripts 2026-04-28 15:43:15 +02:00
outputs update the bootstrap results 2026-05-07 15:24:22 +02:00
utils update the bootstrap results 2026-05-07 15:24:22 +02:00
.DS_Store update the bootstrap results 2026-05-07 15:24:22 +02:00
compute_cross_val.py test all necessary scripts 2026-04-28 15:43:15 +02:00
ensemble_selection_cv.py test all necessary scripts 2026-04-28 15:43:15 +02:00
environment.yaml add new environment.yaml 2026-04-28 19:37:51 +02:00
environment_old.yaml add new environment.yaml 2026-04-28 19:37:51 +02:00
logging.yaml initial commit 2025-09-25 10:10:05 +02:00
logging_config.py initial commit 2025-09-25 10:10:05 +02:00
predictGI.py update run_predictGI.py, train_model.py, add genomes 2026-04-25 23:58:54 +02:00
README.md update README.md 2026-04-28 20:52:46 +02:00
run_crossval.py update the README.md file 2026-04-28 20:50:53 +02:00
run_crossval.sh initial commit 2025-09-25 10:10:05 +02:00
run_crossval_parallel.sh initial commit 2025-09-25 10:10:05 +02:00
run_predictGI.py test all necessary scripts 2026-04-28 15:43:15 +02:00
run_predictGI_old.py update run_predictGI.py, train_model.py, add genomes 2026-04-25 23:58:54 +02:00
train_model.py test all necessary scripts 2026-04-28 15:43:15 +02:00
train_model_old.py update run_predictGI.py, train_model.py, add genomes 2026-04-25 23:58:54 +02:00
transform_data.py update README.md file and delete unnecessary files 2025-11-12 15:14:16 +01:00

ensemble-data-representations-for-hgt-detection

Horizontal gene transfer (HGT) is widely recognized as a major driver of antimicrobial resistance (AMR) dissemination , with genomic islands (GIs) as one of the drivers facilitating the spread. Detecting GIs is essential for improving AMR surveillance. Numerous computational approaches have been developed for GIs detection, including recent advances in machine learning (ML). Several studies in other fields have shown that ML model performance depends on data representations. Combining multiple data representations in ensemble learning has been shown to improve performance in other genomics tasks. However, this approach has not yet been evaluated for GIs detection. To this end, we investigate the efficacy of integrating diverse data representations in ensemble learning for GIs detection, particularly for classification task. Then, we assess its applicability to localizing GIs, which are clusters of genes acquired through HGT, in a genomic sequence. We implemented a two-stage ensemble selection strategy to determine the optimal combination of data representations. Our ensemble selection strategy reveals that combining low-correlated data representations in an ensemble classifier yields better Recall than individual representation for the classification task. Nevertheless, the ensemble classifier could not localize GIs better, suggesting that the cross-task generalizability remains constrained. This finding presents an opportunity for future research to advance the field by redefining the problem formulation of GIs detection.


Steps to reproduce the results:

  1. Clone this repo:
    git clone git@github.com:andrejw27/ensemble-data-representations-for-hgt-detection.git
    
  2. cd into the root directory (ensemble-data-representations-for-hgt-detection
  3. Install conda: conda/install.sh
  4. Create conda environment: sh conda/create_env.sh
  5. Activate conda environment: conda activate ensemble_rep_hgt
  6. Optional : Remove conda environment (if necessary): sh conda/remove_env.sh
  7. Extract the trained models in utils/models
  8. Open the visualization.ipynb and follow the steps in the notebook

  1. Cross-validate 44 data representations and 5 machine learning models
    python run_crossval.py --representation-index 1 --n-worker 6 --filename "benbow" --output-dir "outputs/cross_val/predictions" 
    

--representation-index : refer to set of data representations to be executed --n-worker : number of workers to process the script in parallel --filename : name of the dataset -- output-dir : folder to store the outputs

  1. Evaluate cross-validation results
    python compute_cross_val.py --dataname "benbow" --output-dir "outputs/cross_val"
    

--dataname : name of the dataset --output-dir : folder of the outputs from the cross-validation

  1. Perform the two-stage ensemble selection strategy to select the best candidates for ensemble classifier
    python ensemble_selection_cv.py --dataname "benbow" --same-clf "True" --error-metric "mcc"
    

--same-clf : a flag to determine whether to run the ensemble selection strategy using the best classifier per data representation (True/1) or the same classifier for all data representations (False/0). Heterogeneous classifiers use the best classifier per representation, and homogeneous classifiers use same classifier for all representations. --error-metric : the evaluation metric used to measure the performance for the selection strategy, we used "mcc" for the study

  1. Train models either single classifier or ensemble classifier
    python train_model.py --candidates "RCKmer-7/SVM,Subsequence/SVM" --ensemble-type "voting_soft" --default-params "True"
    

--candidates : candidates for the ensemble classifier. If the input is single e.g. "RCKmer-7/SVM", the script will train the single classifier --ensemble-type : type of ensemble learning, e.g. voting_soft, voting_hard, and stacking --default-params : a flag to determine whether to use default hyperparameters or best hyperparameters for the model. Currently, it is only for SVM

  1. Evaluate the models on boundaries prediction task -> predict the location of genomic islands (GIs) within a genome
    python run_predictGI.py --result-type "test"
    

--result-type : a flag to decide which test dataset will be used for evaluation. "test" refers to species in Benbow test dataset, and "literature" refers to species in literature dataset