Skip to main content

DiffNovo_DIA

Transformer-Diffusion de novo peptide sequencing for data-independent acquisition mass spectrometry.

DiffNovo_DIA is an extension of the Transformer_DIA model that integrates a transformer architecture with a diffusion model to improve de novo peptide sequencing from data-independent acquisition (DIA) mass spectrometry.


Installation

To manage dependencies efficiently, we recommend using conda. Start by creating a dedicated conda environment:

conda create --name diffnovo-dia python=3.10

Activate the environment:

conda activate diffnovo-dia

Install DiffNovo_DIA and its dependencies via pip:

pip install diffnovo-dia

To verify a successful installation, check the command-line interface:

diffnovo-dia --help

Data Preprocessing

Feature Extraction

To use DiffNovo_DIA, you must first generate a feature file that serves as structured input to the model. We provide a script which takes your spectrum and feature files as input and produces a pickle file containing the formatted features. The generated features include:

  • Keys: Peptide sequences
  • Values: List containing the following attributes:
    • precursor_mz
    • precursor_charge
    • scan_list_middle
    • ms1
    • mz_list
    • int_list
    • neighbor_right_count
    • neighbor_size_half

To run the script, use the provided script feature_extractor.py to generate feature file required by Transformer_DIA and DiffNovo_DIA models. The script takes the following inputs:

  • A feature CSV file
  • An MGF spectrum file It will generate a pickled feature file compatible with both diffnovo_dia and transformer_dia models.
python feature_extractor.py --feature_file your_feature.csv --spectrum_file your_spectra.mgf --output_file output_features.pkl

MGF Annotation

Use this script to annotate .mgf files with peptide sequences for models like PepNet, DiffNovo, Transformer-DIA and DiffNovo_DIA. The annotation process links each precursor ion in feature file to spectra in the MGF file.

For Transformer-DIA and DiffNovo_DIA, the recommended selection mode is five_rt, which automatically selects the top five spectra whose retention times are closest to the mean retention time of the corresponding precursor ion. The selection spectra for annotation should be aligned with spectra selection in feature extraction — for example, we used five_rt for both.

You can run the script using:

For annotating with PepNet, set the model_name to pepnet. For other models, leave the model_name empty.

python annotate_mgf.py --model_name pepnet --spectrum_file input.mgf --feature_file features.csv --selection five_rt

If you're not using PepNet, simply leave model_name empty:

python annotate_mgf.py --model_name "" --spectrum_file input.mgf --feature_file features.csv --selection five_rt

Both feature_extractor.py and annotate_mgf.py are located in the data_utils/ directory.

Usage

Predict Peptide Sequences

DiffNovo_DIA predicts peptide sequences from MS/MS spectra stored in MGF files. Predictions are saved as a CSV file:

diffnovo-dia --mode=denovo --model=pretrained_checkpoint.ckpt --peak_path=path/to/spectra.mgf --peak_feature=path/to/precursor_feature.pkl

Evaluate de novo Sequencing Performance

To assess the performance of de novo sequencing against known annotations:

diffnovo-dia --mode=eval --model=pretrained_checkpoint.ckpt --peak_path=path/to/spectra.mgf --peak_feature=path/to/precursor_feature.pkl

Annotations in the MGF file must include peptide sequences in the SEQ field.


Train a New Model

To train a new Transformer model from scratch, provide labeled training and validation datasets in MGF format:

diffnovo-dia --mode=train --peak_path=path/to/train/annotated_spectra.mgf \ 
--peak_feature=path/to/train/precursor_feature.pkl \
--peak_path_val=path/to/validation/annotated_spectra.mgf \
--peak_feature_val==path/to/validation/precursor_feature.pkl

MGF files must include peptide sequences in the SEQ field.


Fine-Tune an Existing Model

To fine-tune a pretrained Transformer-DIA model, set the --train_from_scratch parameter to false:

diffnovo-dia --mode=train --model=pretrained_checkpoint.ckpt \
--peak_feature=path/to/train/precursor_feature.pkl \
--peak_path_val=path/to/validation/annotated_spectra.mgf \
--peak_feature_val==path/to/validation/precursor_feature.pkl

Release files for diffnovo-dia 0.1.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 diffnovo-dia 0.1.2
File Size Uploaded
diffnovo_dia-0.1.2.tar.gz 66.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for diffnovo-dia 0.1.2
File Interpreter ABI Platform
diffnovo_dia-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 142.6 kB

Release files / diffnovo_dia-0.1.2.tar.gz

Download URL diffnovo_dia-0.1.2.tar.gz
Size 66.2 kB
Tags Source
SHA-256 checksum
How to use checksums
9e38bbbb34fae6632107e5f73112e51995c44cc6ff968d92bb3ce1be2f5c3f08
BLAKE2b-256 checksum
How to use checksums
19d299710ccf90999e271f0033612494733df2c91315b12d3a56c55e9b6787be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.9.19

Release files / diffnovo_dia-0.1.2-py3-none-any.whl

Download URL diffnovo_dia-0.1.2-py3-none-any.whl
Size 76.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
75b6077cfab18e2ab48562c944bea0e64411ce86233b69dc8042f979420282f8
BLAKE2b-256 checksum
How to use checksums
8ff92a29df18ba9b22708c106e78d067d3e854c75ec1376ca23c37c1a31fef8c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.9.19

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1

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