Model architecture

    SpecGP is a transformer-based model consisting of the following parts: glycopeptide structure embedding, an encoder, a decoder, metadata embedding and heads. The structure embedding constructs learnable embeddings for 21 types of amino acid and 5 types of monosaccharide. When embedding peptides, common modifications have been considered, including acetyl (K, protein N-term), carbamidomethyl (C), oxidation (M, P), phosphorylation (S, T, Y), cyclization (Q) and deamidated (N, Q, R). The modification embeddings are designed to have the same dimensionality as the amino acid embeddings and are ultimately summed with the amino acid embeddings and degree embeddings to obtain the final node embeddings. For edge encoding, three categories are defined: peptide bonds between amino acids, glycosidic bonds between asparagine (N) and monosaccharides, and glycosidic bonds between monosaccharides. The five types of monosaccharide considered in this work are N-acetylglucosamine (GlcNAc), fucose (Fuc), sialic acid (Neu5Ac and Neu5Gc) and hexoses (Hex), represent the core building blocks of mammalian N-glycans. While the current implementation focuses on these primary monosaccharides, the modular design of SpecGP allows straightforward extension to accommodate additional, less common monosaccharides or chemical modifications, provided that sufficient training data are available. A learnable global embedding is introduced to represent the complete glycopeptide structure.

    The encoder consists of 12 layers, with the multihead attention mechanism configured to use 8 attention heads. The feedforward network incorporates a linear layer with a dimensionality of 1,024, and the embedding dimension is set to 256. The decoder comprises six layers, while maintaining identical configurations to the encoder. For glycan fragment embedding, the five monosaccharide fragments are utilized as the fundamental embedding units for B ions and Y ions. The fragment embeddings are generated through a linear combination of these embedding units, followed by processing through a linear layer and a layer normalization (Layer Norm) operation. The resulting representation is concatenated and undergoes cross-attention with the encoder’s output, ultimately producing the final encoded representations of the B ions and Y ions.

    The heads of the model are inspired by MassFormer40, incorporating a residual-based linear layer with a dimensionality of 1,024. In this work, Layer Norm was used instead of Batch Norm owing to its marginal superiority in spectral similarity (0.985 versus 0.984). For peptide fragment ions, the model predicts the intensities of b/y ions, b/y ions with one HexNAc, and b/y ions resulting from cross-ring fragmentation on the HexNAc, considering both 1+ and 2+ charge states. For glycan fragment ions, the model predicts B ions in the 1+ charge state and Y ions in charge states ranging from 1+ to 3+.

    Before predicting fragment ion intensities, the model accounts for the influence of precursor ion charge and NCE. Notably, our examination of the SCE data did not account for NCE information. The precursor ion charge is encoded using a learnable embedding with a dimensionality of 256, where the maximum charge state is set to 8. For NCE encoding, a constant encoding method is adopted. Specifically, an NCE energy list E = {2, 3, 4, …, 40} is defined, and the energy embedding for an NCE value of e is computed as

    $$\frac{e-\mathrm{mean}\left(E\right)}{4\times \mathrm{std}\left(E\right)}.$$

    (1)

    Both the charge and energy embeddings are added to the fragment encodings of b/y and B/Y ions, ensuring that the final prediction incorporates information about charge states, collision energy and glycopeptide structure. The prediction of retention time does not involve the above steps, as retention time is determined solely by the glycopeptide’s intrinsic structure and is independent of precursor ion charge and collision energy.

    Parameter configuration and dataset

    In this study, the identification results generated by StrucGP v.1.2.0 were utilized as the primary dataset. StrucGP is unable to resolve isomeric relationships arising from branched glycan structures, and the glycan structures analysed in this work do not account for isomeric variations related to branching patterns consequently. The glycan branch structure database utilized in this study is the built-in database provided by StrucGP9. To ensure comprehensive and accurate glycopeptide identification, the human and mouse protein databases were obtained from UniProtKB, comprising 20,421 and 17,173 entries, respectively. Protein enzymatic digestion was simulated using trypsin, allowing for a maximum of two missed cleavage sites. Potential glycosite-containing peptides were screened based on the N–X–S/T motif, where X represents any amino acid except proline. For post-translational modification analysis, carbamidomethylation (C, +57.0215 Da) was set as a fixed modification, while oxidation (M, +15.9949 Da) was considered a dynamic modification. The mass tolerances for MS1 and MS2 were set at 20 ppm to ensure precise mass matching. Finally, to maintain high confidence in the identification results, the false discovery rate (FDR) for both peptides and glycans was rigorously controlled to be less than 1%.

    The glycopeptides identified by StrucGP were theoretically fragmented to generate b/y ions and B/Y ions, and their theoretical m/z values were calculated. These theoretical m/z values were then matched against the peaks in the experimental spectra, with a match considered successful if the mass error was within 20 ppm. The mass error threshold of 20 ppm was used as the default setting, providing a practical balance between sensitivity and specificity for typical glycoproteomics applications. This parameter can be adjusted in SpecGP to accommodate diverse instrumental set-ups and user preferences. For multiple experimental spectra corresponding to the same glycopeptide structure, the weighted average of the peptide and glycan scores was calculated and used to represent the theoretical spectrum for that glycopeptide. The product of the glycan score and peptide score was used as the matching weight between and experimental spectrum and its corresponding glycopeptide. For each peak, the intensity in the theoretical spectrum was computed as a weighted sum of the intensities of the corresponding peaks across raw spectrum assigned to identical glycopeptides. This procedure was applied to all peaks to construct the complete theoretical spectrum. Retention time requires calibration as it may vary under different experimental conditions. We used locally weighted scatterplot smoothing (LOWESS) to align the retention time. Subsequently, the calibrated retention time values were normalized to a range of 0–1 by the maximum retention time value within the dataset to obtain nRT30. The data preprocessing in this work was referenced from the code of DeepGP30 and DeepGlyco31.

    In this study, all models were pretrained using a large-scale dataset of the HeLa proteome (PXD004452)47. For N-glycopeptide analysis, datasets including Mouse (Mouse142, Mouse29, Mouse3 and Mouse443) and Human (Human144, Human245 and Human343) were utilized, as detailed in the appendix. Among these datasets, Mouse1 was acquired using SCE (30% ± 10%). In the Mouse3 dataset, each glycopeptide was fragmented by 17 HCD energies, including HCD 6%, 8%, 10%, 12%, 14%, 16%, 18%, 20%, 22%, 24%, 26%, 28%, 30%, 33%, 35%, 38% and 40% (see detailed sample preparation in Supplementary Note 3). All remaining datasets were generated using dual HCD energies per glycopeptide (HCD 20% and 33%). To ensure rigorous evaluation and to prevent potential data leakage, we applied strict glycopeptide-level splitting when constructing the training and test sets, such that identical glycopeptide structures were assigned exclusively to one set but never shared between them. Unless otherwise specified, the dataset is randomly split into training and test sets in a 4:1 ratio. The resulting data primarily consist of HCD fragmentation spectra, which are dominantly supported by current glycopeptide identification software. Also, these data are largely derived from mammalian samples, predominantly human and mouse.

    Model training

    The model training used the AdamW optimizer with an initial learning rate of 0.0001, which was linearly decayed to 0.01 times the initial value. A weight decay of 0.0001 was applied, and dropout rates were set to 0.1 for the encoder and decoder layers, while a higher dropout rate of 0.2 was used for the linear layers in the head to prevent overfitting during training. The total number of training epochs was set to 40. For training from scratch, a warm-up phase of three epochs was implemented. In the case of model fine-tuning, the encoder weights were initially frozen and then unfrozen after ten epochs to allow full model training. For retention time prediction, the L1 loss function was utilized. To evaluate the similarity between predicted and experimental spectra, key metrics include CS and SA, as defined in the Prosit22 framework:

    $$\mathrm{CS}=\frac{{{\bf{S}}}_{\mathrm{pred}}\bullet {{\bf{S}}}_{\exp }}{\left|{{\bf{S}}}_{\mathrm{pred}}\right|\bullet \left|{{\bf{S}}}_{\exp }\right|}$$

    (2)

    $$\mathrm{SA}=\frac{2}{{\rm{\pi }}}\,\arccos \left(\mathrm{CS}\right).$$

    (3)

    Here, Spred and Sexp represent the intensity vectors of the predicted and experimental spectra, respectively. Unless otherwise specified, the loss function is computed as follows:

    $$\begin{array}{ll}L & ={L}_{\mathrm{rt}}+\left(1-{\mathrm{CS}}_{\mathrm{gp}}\right)+\left(1-\mathrm{sqrt}{\mbox{-}}{\mathrm{CS}}_{\mathrm{gp}}\right)+0.7\times \left(1-{\mathrm{CS}}_{\mathrm{pep}}\right)\\ & +0.2\times \left(1-{\mathrm{CS}}_{{\rm{Y}}}\right),\end{array}\,$$

    (4)

    Where L denotes the total loss, Lrt represents the retention time loss and CSgp, CSpep and CSY correspond to the CS for the entire glycopeptide, the peptide portion and the Y ions, respectively. The sqrt-CSgp first applies a square root transformation to glycopeptide spectral intensities before calculating the CS, which notably improves prediction accuracy of low-intensity peaks. The entire model contains 17 million trainable parameters, with a detailed parameter breakdown for each component provided in Supplementary Table 7. Pretraining required approximately 11 h due to the million-scale pretraining dataset used. Fine-tuning on the Mouse1 dataset (batch size 32, 40 epochs) took about 1 h on an NVIDIA RTX 4070 Ti Super graphics processing unit. Subsequent glycan structure re-identification (about 30 min) and rescoring (about 15 min) were performed on an AMD Ryzen 9 9900X central processing unit running Windows 11, without graphics processing unit acceleration. In addition, the simultaneous prediction of spectra and retention times for eight glycopeptides took approximately 8–10 ms in total, demonstrating the model’s efficiency in real-time applications. Actual runtimes depend on the user’s hardware and software environment. Benchmarking results across different platforms, particularly Linux and Windows systems, are summarized in the Supplementary Table 8.

    Given that SpecGP is developed on the basis of StrucGP, adopting the glycan structural encoding pathway from StrucGP to represent glycan annotations is an appropriate approach at this stage. This format of annotation can be visualized using GlycoVisualTool48, a tool previously developed by our team. In addition, we provide a unified model trained on both human and mouse N-glycopeptides that supports direct prediction for both species, along with a pipeline software package and a guidance document in the ‘Code availability’ section.

    Calculation of glycopeptide spectral orthogonality

    To quantify the orthogonality of glycopeptide spectra, we used the norm of the Gram matrix as a metric. Specifically, all possible B (except HexNAc1 and HexNAc1Hex1) and Y ions were first enumerated by traversing the entire set of glycopeptides. The intensity of each glycopeptide across these possible fragment ions was then calculated, generating vectors of identical dimensionality. These vectors were concatenated to form a value matrix, which was subsequently normalized using the L2 norm. The Gram matrix was constructed by multiplying the transpose of the normalized value matrix with itself. The orthogonality measure was obtained by subtracting the identity matrix from the Gram matrix and computing its Frobenius norm. A smaller Frobenius norm indicates lower spectral similarity among the characteristic fragment ions of different glycopeptides, reflecting better distinguishability and higher orthogonality. This approach provides a robust quantitative assessment of spectral diversity, which is critical for optimizing glycopeptide identification and characterization.

    SSWT

    A self-supervised weight learning method to mitigate the impact of erroneous samples in low-quality training datasets. The procedure is as follows. For each training sample, the glycan structure originally identified by StrucGP is treated as the reference target, and all possible structural isomers are generated based on the StrucGP branching library. It is assumed that, among the originally identified structure and its corresponding isomers, there exists one correct structure. The reliability of the originally structural assignment is evaluated by predicting the theoretical spectrum of each glycan structure and calculating its deviation from the experimental spectrum. The resulting loss function is defined as follows:

    $${\rm{err}}=\mathop{\sum }\limits_{i=1}^{n}\left|{\left({I}_i^{e}\right)}^{0.75}-{\left(I_{i}^{p}\right)}^{0.75}\right|$$

    (5)

    $${L}_{\mathrm{SSWT}}=L/{\left\{1+\frac{\mathop{\max }\limits_{1\le j\le m}{\left[\frac{\left(1-\sqrt{I_{o,j}^{\mathrm{sum}}}\right)}{{\mathrm{err}}_{j}}\right]}^{2}}{{\left[\frac{\left(1-\sqrt{\mathop{\max }\limits_{1\le j\le m}I_{j,o}^{\mathrm{sum}}}\right)}{{\mathrm{err}}_{o}}\right]}^{2}}\right\}}^{4}.$$

    (6)

    In the above formula, Ie and Ip denote the relative intensities of a given peak in the experimental and predicted spectra, respectively. Summation over all peaks yields the total error between the predicted and the experimental spectra for a given glycopeptide. Note that peaks present in the experimental spectrum with a relative intensity greater than 0.015 but absent from the theoretical fragment list of the glycan structure were also included in the calculation, in which case Ip is taken as 0. LSSWT and L denote the self-supervised learning weight and the original loss weight, respectively. Assuming the structure originally identified by StrucGP has m isomers, erro and errj represent spectral prediction errors of the originally identified structure and the jth isomer, respectively. Furthermore, \(I_{o,j}^{{\text{sum}}}\) denotes the sum intensities of peaks unique to the original structure compared with the jth isomer in the experimental spectrum. Correspondingly, \({I}_{j,o}^{{\text{sum}}}\) represents the sum of relative intensities of peaks unique to the jth isomer compared with the original structure in the experimental spectrum; if I
    sumo,j

    and I
    sumi,o

    exceeds 1, it is capped at 1. These terms are used to correct the reliability of the original structure derived from model-predicted spectral errors.

    For isomer discrimination based on spectral prediction, all possible isomers generated from the StrucGP branching library were combined with the originally assigned structure to form a candidate set. For each candidate structure, the corresponding spectrum was predicted and compared with the experimental spectrum to calculate the sqrt-CS, followed by the calculation of SA, with reference to equation (3). The final scoring formula is as follows:

    $$\mathrm{Score}=0.5\times \left(1-{\mathrm{SA}}_{{\rm{Y}}}\right)+0.5\times \left(1-{\mathrm{SA}}_{{\rm{B}}}\right).$$

    (7)

    In this formula, SAY and SAB represent the SA values for the Y-ion and B-ion series, respectively31. The candidate glycopeptides are then ranked according to this final score.

    Rescoring calculation method

    In our workflow, MS data were acquired at 20% and 33% collision energies to optimize fragment ion coverage for peptides and glycans, respectively. SpecGP predicts MS/MS spectra at these energies, with 33% energy spectra used for peptide rescoring and 20% energy spectra for glycan rescoring.

    $${S}_{\mathrm{new}}=\left\{\begin{array}{l}\left(1+\alpha \right)\times \left({S}_{\mathrm{SpecGP}}+{S}_{\mathrm{StrucGP}}\right),\,\mathrm{for}\,\mathrm{high}\,\mathrm{mannose};\\ \,0.2\times {S}_{\mathrm{nRT}}+{S}_{\mathrm{SpecGP}}+{S}_{\mathrm{StrucGP}},\,\mathrm{for}\,\mathrm{hybrid}\,\mathrm{and}\,\mathrm{complex}.\end{array}\right.$$

    (8)

    Here, SnRT is calculated by subtracting the absolute error between the predicted nRT and the experimental nRT from 1. For peptide rescoring, SSpecGP denotes the similarity between the predicted spectrum and the experimental spectrum of the peptide; SStrucGP represents the original peptide score, which is normalized by a factor of 1,000 to scale its native range (0–1,000) for dimensional consistency with the 0–1 range of spectral similarity scores; α is set to 0.23, representing a compensation factor for high-mannose truncation in SnRT. For glycan rescoring, SSpecGP indicates the similarity between the predicted B/Y ion spectrum of the glycan and the experimental spectrum; SStrucGP represents the original glycan score normalized by dividing by 1,000; α is set to 0.18. Consistent with StrucGP’s approach, the FDR was controlled at <1% for peptides using a target-decoy strategy, followed by a probability-based approach to maintain glycan FDR below 1%. The coefficient of 0.2 was derived through algorithmic optimization to achieve optimal performance. This process ensures high-confidence glycopeptide identification while adhering to rigorous quality control standards. In addition, the Percolator-based algorithm49 has been added in our software as an alternative method for scoring.

    Ethics statement

    All animal experiments were conducted in accordance with relevant ethical regulations and guidelines. The experimental protocols were reviewed and approved by the Ethics Committee of Northwest University, China (approval number NWU-AWC-20241206M).

    Share.

    Comments are closed.