| --- |
| license: apache-2.0 |
| tags: |
| - bacteria |
| - antibiotics |
| - AMR |
| - genomics |
| - genomes |
| - DNA |
| - biology |
| pretty_name: Dataset for predicting antibiotic resistance from bacterial genomes (DNA) |
| size_categories: |
| - 10K<n<100K |
| --- |
| # Dataset for antibiotic resistance prediction from whole-bacterial genomes (DNA) |
|
|
| A dataset of 25,032 bacterial genomes across 39 species with antimicrobial resistance labels. |
|
|
| The genome DNA sequences have been extracted from [GenBank](https://www.ncbi.nlm.nih.gov/genbank/). Each row contains whole bacterial genome, with spaces |
| separating different contigs present in the genome. |
|
|
| The antimicrobial resistance labels have been extracted from [Antibiotic Susceptibility Test (AST) Browser](https://www.ncbi.nlm.nih.gov/pathogens/ast), accessed 23 Oct, 2024.) |
| and include both `binary` (resistant/susceptible) labels as well as `minimum inhibitory concentration (MIC)` regression values. The MIC has been `log1p` normalised. |
|
|
| We exclude antimicrobials with a low nr of samples, giving us `56` unique antimicrobials for `MIC (regression)` prediction and `36` for binary labels. For binary case, we only |
| included genomes with `susceptible` and `resistant` labels provided by the AST Browser, excluding ambiguous labels. We treat combination of antimicrobials as a separate drug. |
|
|
| ## Labels |
| We provide labels in separate files in the dataset `Files and versions`. This includes: |
| * binary labels - `binary_labels.csv` |
| * MIC (regression) labels - `mic_regression_labels.csv` |
|
|
| ## Usage |
| We recommend loading the dataset in a streaming mode to prevent memory errors. |
| ```python |
| from datasets import load_dataset |
| |
| |
| ds = load_dataset("macwiatrak/bacbench-antibiotic-resistance-dna", split="train", streaming=True) |
| ``` |
|
|
| ### Fetch the labels for the genome |
| ```python |
| import pandas as pd |
| |
| from datasets import load_dataset |
| |
| |
| ds = load_dataset("macwiatrak/bacbench-antibiotic-resistance-dna", split="train", streaming=True) |
| item = next(iter(ds)) |
| |
| # read labels (available in repo root) |
| labels_df = pd.read_csv("<input-dir>/mic_regression_labels.csv").set_index("genome_name") |
| |
| # fetch labels |
| labels = labels_df.loc[item["genome_name"]] |
| # drop antibiotics without a value for the genome (NaN) |
| labels = labels.dropna() |
| ``` |
|
|
| ## Split |
|
|
| Due to low number of samples for many antibiotics and the variability between genomes, which may skew the results when using a single split, we recommend training and evaluating the model with `k-fold split`. |
| Specifically, for each antibiotic we recommend: |
| 1. Splitting the available data into 5 equal splits (`sklearn.model_selection.StratifiedKFold` for binary labels and `sklearn.model_selection.KFold` for regression labels) |
| 2. In each split, further dividing the larger `train` set into `train` and `val`, where `validation` makes up 20% of the train split. |
| 3. Training the model on the train set from the point above and monitoring the results on the validation set, using `AUPRC` and `R2` as metrics for monitoring the performance on the validation set for binary and regression setups. |
| 4. Using the best performing model on validation to evaluate the model on the test set. |
|
|
| See [github repository](https://github.com/macwiatrak/Bacbench) for details on how to embed the dataset with DNA and protein language models as well as code to predict antibiotic |
| resistance from sequence. For coding sequence representation of the genome see the [antibiotic-resistance-protein-sequences](https://huggingface.co/datasets/macwiatrak/bacbench-antibiotic-resistance-protein-sequences) |
| dataset. |
|
|
| --- |
| dataset_info: |
| features: |
| - name: genome_name |
| dtype: string |
| - name: contig_name |
| sequence: string |
| - name: dna_sequence |
| dtype: string |
| - name: taxid |
| dtype: string |
| splits: |
| - name: train |
| num_bytes: 110813875147 |
| num_examples: 26052 |
| download_size: 51625216055 |
| dataset_size: 110813875147 |
| configs: |
| - config_name: default |
| data_files: |
| - split: train |
| path: data/train-* |
| license: apache-2.0 |
| tags: |
| - AMR |
| - antibiotic |
| - resistance |
| - bacteria |
| - genomics |
| - dna |
| size_categories: |
| - 1K<n<10K |
| --- |