Skip to main content

ASAP: Allele-Specific ATAC-seq Prediction

Early feature extraction determines performance: systematic evaluation of deep learning models for high-resolution chromatin accessibility prediction

DOI PyPI Wiki

ASAP is a Python package for fine-grained prediction of chromatin accessibility from DNA sequence, using ConvNeXt V2 blocks as powerful feature extractors. By integrating these blocks into diverse model architectures, including CNNs, LSTMs, dilated CNNs, and transformers, we demonstrate consistent performance gains, with the ConvNeXt-based dilated CNN achieving the most robust and shape-preserving predictions of ATAC-seq signal at 4 bp resolution.

Features

  • Data Processing: Create datasets for whole-genome and peak-based analysis with support for blacklists and unmappable regions.
  • Model Training: Train deep neural networks (e.g., ConvNext DCNN) on genomic data with customizable chromosome splits for training and validation.
  • Model Evaluation: Evaluate model performance on peak and whole-genome datasets, including robustness testing.
  • Prediction: Export model predictions and predict SNV effects on ATAC-seq data.
  • Scalability: Support for multi-GPU training and efficient data handling.

Installation

ASAP is available on PyPI and can be installed using pip:

pip install atac-asap

Please make sure you have Python 3.8+.

Usage

1. Model Training

An example script to train a model using asap has been defined in tutorials/train.py.

1.1 Create training and validation dataset

asap.training_datasets(signal_file, genome, train_chroms, val_chroms, generated, blacklist_file=None, unmap_file=None)

Creates training and validation datasets using genomic sequence as input and ATAC-seq signal as output.

Args:

  • signal_file (str): Path to the ATAC-seq signal file.
  • genome (str): Path to the genome file.
  • train_chroms (List[int]): List of chromosomes for training.
  • val_chroms (List[int]): List of chromosomes for validation.
  • generated (str): Path to save the processed data.
  • blacklist_file (List[str]): List of paths to blacklist files (including SNVs).
  • unmap_file (str): Path to the unmapped regions file.

Returns:

  • train_dataset (asap.dataloader.WGDataset): Training dataset
  • val_dataset (asap.dataloader.WGDataset): Validation dataset

1.2 Train a model

asap.train_model(experiment_name, model, train_dataset, val_dataset, logs_dir, n_gpus=0, max_epochs=70, learning_rate=1e-3, batch_size=64, use_map=False)

Trains the selected model using training and validation datasets.

Args:

  • experiment_name (str): The name of the experiment. This will be used to save model checkpoints.
  • model (str): The name of the model to train. Choose from [cnn, lstm, dcnn, convnext_cnn, convnext_lstm, convnext_dcnn, convnext_transformer].
  • train_dataset (asap.dataloader.WGDataset): The training dataset.
  • val_dataset (asap.dataloader.WGDataset): The validation dataset.
  • logs_dir (str): The directory where model is saved.
  • n_gpus (int): The number of GPUs to use for training. Set 0 for CPU.
  • max_epochs (int): The maximum number of epochs to train the model.
  • learning_rate (float): The learning rate for the optimizer.
  • batch_size (int): The batch size for training.
  • use_map (bool): Whether to additionally use mappability information for training.

Returns:

  • None

Note: Pearson's R for the trained model on the validation dataset is expected to be ~0.7.

2. Model Evaluation

An example script to evaluate a model using asap has been defined in tutorials/eval.py.

2.1 Create a peak or whole-genome dataset for evaluation on generalizability

asap.peak_dataset(signal_file, peak_file, genome, chroms, generated, blacklist_file=None, unmap_file=None)

or

asap.wg_dataset(signal_file, genome, chroms, generated, blacklist_file=None, unmap_file=None)

Creates a peak or whole-genome dataset for evaluation.

Args:

  • signal_file (str): Path to the signal file.
  • peak_file (str): Path to the peak file.
  • genome (str): Path to the genome file.
  • chroms (List[int]): List of chromosomes for evaluation.
  • generated (str): Path to the generated data.
  • blacklist_file (List[str]): List of paths to blacklist files (including SNV VCFs).
  • unmap_file (str): Path to the unmapped regions file.

Returns:

  • test_dataset (asap.dataloader.BaseDataset): Test dataset (either peak or whole-genome)

2.2 Evaluate a pre-trained model on generalizability

asap.eval_model(experiment_name, model, eval_dataset, logs_dir, batch_size=64, use_map=False)

Evaluates the pre-trained model on the peak or whole-genome dataset.

Args:

  • experiment_name (str): The name of the experiment. This will be used to load model checkpoints.
  • model (str): The model name to evaluate. Choose from [cnn, lstm, dcnn, convnext_cnn, convnext_lstm, convnext_dcnn, convnext_transformer].
  • eval_dataset (asap.dataloader.BaseDataset): The test dataset used for model evaluation.
  • logs_dir (str): The directory from which to load model checkpoints.
  • batch_size (int): The batch size for evaluation.
  • use_map (bool): If mappability information was used during training.

Returns:

  • scores (Dict[Dict]): For each test chromosome, a dictionary with Pearson's correlation (pearson_r), Mean squared error (mse), Poisson negative log-likelihood (poisson_nll), Spearman's correlation (spearman_r), and Kendall's Tau (kendall_tau).

2.3 Create a peak or whole-genome dataset for evaluation on robustness

asap.robustness_peak_dataset(signal_file, peak_file, genome, chroms, generated, blacklist_file=None, unmap_file=None)

or

asap.robustness_wg_dataset(signal_file, genome, chroms, generated, blacklist_file=None, unmap_file=None)

Creates a peak or whole-genome dataset for evaluation on robustness.

Args:

  • signal_file (str): Path to the signal file.
  • peak_file (str): Path to the peak file.
  • genome (str): Path to the genome file.
  • chroms (List[int]): List of chromosomes for evaluation.
  • generated (str): Path to the generated data.
  • blacklist_file (List[str]): List of paths to blacklist files (including SNV VCFs).
  • unmap_file (str): Path to the unmapped regions file.

Returns:

  • test_dataset (asap.dataloader.BaseDataset): Test dataset for robustness (either peak or whole-genome)

2.4 Evaluate a pre-trained model on robustness

asap.eval_robustness(experiment_name, model, eval_dataset, logs_dir, batch_size=64, use_map=False, nr_samples_for_var=17)

Evaluates the pre-trained model for robustness on the peak or whole-genome dataset.

Args:

  • experiment_name (str): The name of the experiment. This will be used to load model checkpoints.
  • model (str): The model name to evaluate. Choose from [cnn, lstm, dcnn, convnext_cnn, convnext_lstm, convnext_dcnn, convnext_transformer].
  • eval_dataset (asap.dataloader.BaseDataset): The test dataset used for model evaluation.
  • logs_dir (str): The directory to load model checkpoints from.
  • batch_size (int): The batch size for evaluation.
  • use_map (bool): If mappability information was used during training.
  • nr_samples_for_var (int): The number of samples for variance calculation.

Returns:

  • scores (Dict[Dict]): For each test chromosome, a dictionary with average coefficient of variation (cov) and average coefficient of variation stratified by position (cov_per_bin).

3. Predict SNV Effects on ATAC-seq

An example script to predict SNV effects using asap has been defined in tutorials/predict_snv_atac.py.

asap.predict_snv_atac(experiment_name, model, snv_file, signal_file, logs_dir, out_dir, genome, chroms=[*range(1,23)], use_map=False, export_bigwig=None)

Predict ATAC-seq for SNVs using a pre-trained model. The results are stored in a csv with allele-specific predictions for each SNV.

Args:

  • experiment_name (str): The name of the experiment. This will be used to load model checkpoints.
  • model (str): The model name to evaluate. Choose from [cnn, lstm, dcnn, convnext_cnn, convnext_lstm, convnext_dcnn, convnext_transformer].
  • snv_file (str): The path to the SNV VCF file.
  • signal_file (str): The path to the signal file.
  • logs_dir (str): The directory to save logs.
  • out_path (str): The output path for results.
  • genome (str): The reference genome.
  • chroms (List[int]): List of chromosomes to consider for prediction.
  • use_map (bool): Whether to use mappability for the model.
  • export_bigwig (str): Export predictions as bigwig. Choose from [ref, alt, both].

Returns:

  • None

4. Export Predictions

An example script to export model predictions using asap has been defined in tutorials/export_predictions.py.

asap.export_predictions(experiment_name, model, eval_dataset, logs_dir, out_dir, batch_size=64, use_map=False)

Export a pre-trained model's predictions as bigwig. One file will be generated for each chromosome in the eval_dataset.

Args:

  • experiment_name (str): The name of the experiment. This will be used to load model checkpoints.
  • model (str): The model name to evaluate. Choose from [cnn, lstm, dcnn, convnext_cnn, convnext_lstm, convnext_dcnn, convnext_transformer].
  • eval_dataset (asap.dataloader.WGDataset): The whole-genome dataset corresponding to which predictions will be generated.
  • logs_dir (str): The directory to load model checkpoints from.
  • out_dir (str): The directory to save bigwigs.
  • batch_size (int): The batch size for prediction.
  • use_map (bool): If mappability information was used during training.

Returns:

  • None

Citing ASAP

If you use ASAP in your work, you can cite it using

@article{grover2026early,
  title={Early feature extraction drives model performance in high-resolution chromatin accessibility prediction},
  author={Grover, Aayush and Muser, Till and Kasak, Liine and Zhang, Lin and Krymova, Ekaterina and Boeva, Valentina},
  journal={Genome Research},
  pages={gr--281042},
  year={2026},
  publisher={Cold Spring Harbor Lab}
}

License

ASAP is licensed under the MIT License. See the LICENSE file for details.

Contributing

Contributions to ASAP are welcome! Please follow these steps:

  1. Fork the repository on GitHub.
  2. Create a new branch for your feature or bug fix.
  3. Submit a pull request with a clear description of your changes. For major changes, please open an issue first to discuss the proposed changes.

Metadata

Release files for atac-asap 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for atac-asap 0.2.2
File Size Uploaded
atac_asap-0.2.2.tar.gz 42.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for atac-asap 0.2.2
File Interpreter ABI Platform
atac_asap-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 96.5 kB

Release files / atac_asap-0.2.2.tar.gz

Download URL atac_asap-0.2.2.tar.gz
Size 42.7 kB
Tags Source
SHA-256 checksum
How to use checksums
01f4c8e6d52b1318a29a94266a20ecf2a1e59ecc3ba08c67e6adb0e00c3ed8f7
BLAKE2b-256 checksum
How to use checksums
695486a8c4c1e090919b571211532b56a3e055eb32315298699ab92ca4984738
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.8

Release files / atac_asap-0.2.2-py3-none-any.whl

Download URL atac_asap-0.2.2-py3-none-any.whl
Size 53.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3b182093eba09f216ccd761b944f8cc7653ee0f617455ae7150368c6aa2a9b58
BLAKE2b-256 checksum
How to use checksums
532adbabdb1f1e5f2353b309e029113890216a90da4654943bc30f1bacd6470f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.8

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page