CLAP-HMM: a biologically constrained deep learning framework for resistance gene prediction in long DNA sequences Authors: Liuyan Wang, Yingfan Xu, Xuemei Guan, Shanchun Yan Published: 2025 ABSTRACT Resistance (R) genes play a critical role in defending against pathogenic infections, and identifying novel R genes is a key component of resistance breeding. However, current computational methods face significant limitations when predicting R genes from ultra-long, highly repetitive genomic sequences. In this study, we propose a deep learning framework, CLAP-HMM, which employs a CNN-LSTM-Attention fusion strategy to extract gene expression patterns from long DNA sequences and accurately predict R genes. Our approach introduces protein function hints as biological priors to guide the HMM module in structural state modeling, enabling precise identification of R gene boundaries. Comparative experiments demonstrate that CLAP-HMM outperforms existing methods in discovering more potential novel R genes, offering promising prospects for uncovering biologically meaningful functional genes and advancing our understanding of disease resistance mechanisms.Supplementary informationThe online version contains supplementary material available at 10.1186/s12896-025-01086-x. Background Resistance (R) genes enable plants to defend against pathogens or insects, forming the foundation of disease-resistance breeding [1]. However, functional validation through transformation or knockout experiments is time-consuming, costly, and often limited by tissue-specific reproducibility, making comprehensive screening of candidate genes highly challenging under realistic biological contexts [2–4]. With the advancement of computational biology, sequence-based computational models are theoretically capable of overcoming these challenges [5–7]. Classical models such as AUGUSTUS [8], Resfams [9], and EuGene [10] rely on sequence features such as start and stop codons, intron-exon boundaries, and reading frames to predict gene structures. Subsequent studies incorporated protein-level information to refine gene models, improving biological relevance [11, 12]. For instance, NBSPred [13] employed a support vector machine to predict NBS-LRR resistance proteins through domain pattern recognition, and similar frameworks have been adopted for specific gene families across plant genomes. Nevertheless, these traditional approaches depend heavily on handcrafted features and predefined templates, making them sensitive to sequence length and intron complexity. Their performance tends to degrade for long genes with non-canonical splicing sites, leading to boundary ambiguity and omission of key functional motifs. The recent rise of deep learning has introduced new possibilities for predicting functional elements within complex biological sequences [14, 15]. Convolutional neural networks (CNNs) have achieved notable performance in a variety of tasks related to gene expression prediction from DNA sequences [16–19]. For example, DeepARG [20], DeepGO [21], and DeepGOPlus [22] leverage CNNs to extract local sequence patterns and integrate gene ontology or functional annotation signals, thereby improving antibiotic resistance gene classification and large-scale protein function prediction. Similarly, PICRUSt2 [23] expanded reference-based inference for metagenomic gene function profiling. However, these models share a common limitation, namely their reliance on short and fixed-length input windows. As a result, they typically consider only sequence regions within approximately 20 kb upstream or downstream of transcription start sites, which hampers their ability to model long-range dependencies between distal regulatory elements and target genes, thereby reducing their effectiveness in long-sequence functional gene prediction tasks [24]. To overcome the limitations in capturing long-range dependencies, Long Short- Term Memory (LSTM) networks have been widely adopted for genomic annotation, protein sequence prediction, and non-coding RNA function analysis [25–29]. For instance, ATTCry [30] and DSA-Transformer [31] both integrate LSTM with attention mechanisms, enabling richer sequence representations and improving prediction accuracy in protein function prediction tasks. Additionally, several studies have explored hybrid networks that combine CNNs and LSTMs to simultaneously capture local conserved motifs and global dependencies [32]. DeepFormer integrates CNNs with a Flow-Attention mechanism to model cross-region information flow, while BiLSTM-CRF frameworks demonstrate the potential for precise boundary annotation [33, 34]. Despite the progress achieved by these computational approaches in various biological sequence prediction tasks, still lack the capacity to capture boundary in gene structures. Some studies take a different route by incorporating Hidden Markov Models (HMMs) to represent latent state transitions along sequences, as exemplified by [35–37]. Nonetheless, these methods often lack tight integration with biologically meaningful functional cues, making it difficult to constrain redundant state paths or correct false-positive predictions effectively. In this study, we present a dual-channel disease-resistance gene identification framework that integrates biological constraint information—termed CLAP-HMM (CNN-LSTM-Attention enhanced Predictor guided by HMM) designed to predict structurally complex novel resistance genes in long-sequence species such as trees. The model employs a deep convolutional neural network (CNN) to extract local sequence features, a bidirectional LSTM to capture long-range dependencies, and an attention mechanism to enhance the interpretability of key feature regions. Simultaneously, ProHint functional cues are introduced as biological constraints on structural states, guiding an HMM-based framework that integrates deep learning with state transition modeling to achieve precise delineation of gene structural boundaries. Systematic evaluations on R gene datasets from multiple tree species reveal that CLAP-HMM surpasses current mainstream methods in both structural localization accuracy and functional prediction consistency, exhibiting robust generalization. This tool provides a novel, biologically interpretable approach for the accurate identification of resistance genes in long genomic sequences of higher plants. Methods Construction of datasets In this study, resistance gene (R gene) sequences from seven tree species, Populus nigra, Populus euphratica, Populus trichocarpa, Populus alba, Eucalyptus grandis, Salix purpurea, and Salix viminalis were selected as the research objects. These species were selected because they represent diverse evolutionary backgrounds and span multiple genera with distinct repertoires of resistance genes. They also have high quality reference genomes and well annotated resistance gene datasets, which provide a reliable foundation for training. Moreover, the tree species included in this study contain long and repetitive resistance gene regions, making them well suited for evaluating the ability of the model to capture complex patterns across full length genomic sequences. Detailed information of the reference genome is presented in Table 1.Table 1Reference genomic informationSpeciesGenome sizeAnnotation VersionNumber of genesAccession NumberP. nigra413.2 MbWELLCOME SANGER INSTITUTE(May 2023)38563GCF_951802175.1P. euphratica494.9 MbLanzhou University(Aug 2014)36334GCF_000495115.2P. trichocarpa392.2 MbUS DOE JGI(Oct 2022)34621GCF_000002775.5P. alba416 MbChinese Academy of Forestry (May 2019)36339GCF_005239225.1E. grandis615.9 MbAustralian National University(Jan 2021)42619GCF_016545825.1S. purpurea332.4 MbCornell University(Mar 2023)31352GCA_029228495.1S. viminalis282.6 MbCornell University(Mar 2023)30435GCA_029228465.1 Table 1Reference genomic informationSpeciesGenome sizeAnnotation VersionNumber of genesAccession NumberP. nigra413.2 MbWELLCOME SANGER INSTITUTE(May 2023)38563GCF_951802175.1P. euphratica494.9 MbLanzhou University(Aug 2014)36334GCF_000495115.2P. trichocarpa392.2 MbUS DOE JGI(Oct 2022)34621GCF_000002775.5P. alba416 MbChinese Academy of Forestry (May 2019)36339GCF_005239225.1E. grandis615.9 MbAustralian National University(Jan 2021)42619GCF_016545825.1S. purpurea332.4 MbCornell University(Mar 2023)31352GCA_029228495.1S. viminalis282.6 MbCornell University(Mar 2023)30435GCA_029228465.1 Reference genomic information WELLCOME SANGER INSTITUTE (May 2023) Lanzhou University (Aug 2014) US DOE JGI (Oct 2022) Cornell University (Mar 2023) Cornell University (Mar 2023) The genomes of these species are characterized by ultra-long sequences, redundant introns, and a high proportion of repetitive elements, representing typical examples of “long genomic sequences.” These features make them suitable model systems for studying complex gene structure modeling and resistance gene prediction. The corresponding gene sequences were obtained from the NCBI GenBank database (https://www.ncbi.nlm.nih.gov/) and subsequently converted into FASTA format and standardized for further analysis. To ensure the quality of gene sequence data and maintain consistency for model training, we first applied length-based filtering to all gene sequences collected from the raw datasets. After extracting the target DNA sequences of 7 species, we calculated the length of each sequence. The sequences with lengths between 1,000 and 6,000 bp were retained, while the remaining sequences were eliminated. We found that resistance-related genes are predominantly distributed within this length range, including well-characterized families such as NBS-LRR [38]. Additionally, this range increases the likelihood of retaining complete gene models and reduces the inclusion of truncated fragments or tandem duplications, which could introduce noise into model training. In the dataset, positive samples correspond to genes that have been experimentally verified to possess disease resistance functions, while negative samples were randomly selected from genes not annotated as resistance-related, ensuring a roughly balanced number of positive and negative instances. All gene sequences were numerically encoded using one-hot encoding and standardized to eliminate potential biases in base frequency distributions, thereby enhancing the consistency of feature representation. The final cross-species disease resistance gene prediction dataset comprised a total of 12,630 gene sequences across the seven woody species, including 6,293 positive and 6,337 negative samples. The average sequence length was 2,083 base pairs. The dataset was split into training and test sets using an 8:2 ratio. The overall framework of CLAP-HMM CLAP-HMM is a deep learning framework featuring dual-channel feature extraction, consisting of four main components: sequence feature extraction, protein function hinting, feature fusion, and state classification modules, as shown in Fig. 1. First, in the sequence feature extraction channel, a hybrid CNN-LSTM-Attention framework is employed to model the input DNA sequences at multiple levels, effectively capturing both local and global features within the sequence. This results in high-dimensional sequence feature vectors. Simultaneously, ProtHint v2.3.0 performs protein-level functional annotation on the genomic sequences, generating structured functional hint vectors. These vectors serve as biological priors to guide the model alongside sequence-based features. In the feature fusion module, feature vectors from the sequence-based channel and the ProtHint derived functional channel are first subjected to Z-score normalization. A Gated Concatenation mechanism is then applied to integrate the heterogeneous features into a unified joint feature space, enabling comprehensive representation learning. Finally, a Hidden Markov Model (HMM) is adopted as the classifier to perform hidden state discrimination. The joint feature vectors are used for binary classification (0: non-resistant, 1: resistant), thereby enabling accurate identification of potential disease resistance genes.Fig. 1The overall framework of CLAP-HMM. (The sequence module extracts multi level features from DNA using a CNN-LSTM-Attention architecture, Prothint v2.3.0 generates protein functional hints as complementary features. The fusion and classification module integrates both feature sources and applies an HMM to identify resistant and non resistant sequences.) The overall framework of CLAP-HMM. (The sequence module extracts multi level features from DNA using a CNN-LSTM-Attention architecture, Prothint v2.3.0 generates protein functional hints as complementary features. The fusion and classification module integrates both feature sources and applies an HMM to identify resistant and non resistant sequences.) Sequence feature extraction channel To effectively extract structural feature information embedded in genomic sequences, we adopt a hybrid CNN-LSTM-Attention model that integrates local pattern recognition, contextual dependency modeling, and critical region awareness. This design enhances the model’s capacity to represent potential functional sites and regulatory signals. The convolutional module consists of three 1D convolutional layers with kernel sizes of [5, 3, 3] and filter numbers of [32, 64, 128], respectively, designed to capture local patterns across the input sequences. Following convolution, a Long Short-Term Memory (LSTM) layer with 128 hidden units is applied to model the long-range dependencies and sequential semantics, yielding a feature representation matrix \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$H \in {R^n}^{ \times d}$$\end{document}, where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$n$$\end{document} is the sequence length after CNN compression, and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$d$$\end{document} is the LSTM hidden dimension. The LSTM computations are governed by the following equations: 1\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${i_t} = \sigma ({W_{xi}}{x_t} + {W_{hi}}{h_t}_{ - 1} + {b_i})$$\end{document}2\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${f_t} = \sigma ({W_{xf}}{x_t} + {W_{hf}}{h_t}_{ - 1} + {b_f})$$\end{document}3\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${o_t} = \sigma ({W_{xo}}{x_t} + {W_{ho}}{h_t}{ - _1} + {b_o})$$\end{document}4\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\bar c_t} = tanh({W_{xc}}{x_t} + {W_{hc}}{h_t}{ - _1} + {b_c})$$\end{document}5\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${c_t} = {f_t} \odot {c_t}_{ - 1} + {i_t} \odot {\bar c_t}$$\end{document}6\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${h_t} = {o_t} \odot tanh({c_t})$$\end{document} Where, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${x_t}$$\end{document} is the input at time step \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$t$$\end{document}, which represents the feature vector of the current sequence element. \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${h_t}_{ - 1}$$\end{document} and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${c_t}_{ - 1}$$\end{document} are the hidden and cell states from the previous time step, respectively. \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${i_t}$$\end{document} is the input gate, which controls how much of the current input \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${x_t}$$\end{document} influences the memory. \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${f_t}$$\end{document} is the forget gate, which decides how much of the previous memory \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${c_t}_{ - 1}$$\end{document} is retained. \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${o_t}$$\end{document} is the output gate, which governs how much of the memory \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${c_t}$$\end{document} is output as the hidden state \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${h_t}$$\end{document}. \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\bar c_t}$$\end{document} is the candidate cell state, a temporary memory that is used to update the current memory \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${c_t}$$\end{document}. \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${c_t}$$\end{document} is the updated cell state, which is the long-term memory of the network. \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${h_t}$$\end{document} is the hidden state at the current time step, which will be used for future predictions and calculations. \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${W_ * }$$\end{document} and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${b_ * }$$\end{document} represent the weight matrices and bias terms for each gate (input, forget, output, and cell state), which are learned during training. The input gate \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${i_t}$$\end{document} and forget gate \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${f_t}$$\end{document} regulate the importance of different sequence features (such as motifs or protein annotations), enabling the model to focus on the most relevant information. The output gate \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${o_t}$$\end{document} ensures that only the most relevant information from the memory is passed to the next time step, maintaining a balance between remembering and forgetting. The candidate cell state \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\bar c_t}$$\end{document} allows the model to introduce new memory that can be added to the cell state, influencing the final memory update. The cell state update \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${c_t}$$\end{document} integrates both the retained memory from the previous step and the new memory, enabling the model to learn from both past and present information. The final hidden state \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${h_t}$$\end{document} serves as the model’s output for the current time step and is used for classification or prediction in the next step of the model. These gates and states enable the LSTM layer to dynamically adjust and maintain important sequence information throughout the training process, leading to more robust and accurate predictions for disease resistance genes. To enhance the focus of model on crucial functional regions within complex sequences, we incorporate a dot-product self-attention mechanism on top of the CNN-LSTM output H. This mechanism learns position-wise weights across the sequence for resistance prediction, emphasizing key features and suppressing irrelevant signals. The self-attention mechanism first projects input features into three distinct matrices: queries (\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$Q$$\end{document}), keys (\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$K$$\end{document}), and values (\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$V$$\end{document}). The attention weights are computed as follows: 7\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$Attention(Q,K,V) = softmax({{Q{K^T}} \over {\sqrt {{d_k}} }})V$$\end{document} Where, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$Q \in {\mathbb{R}^n}^{ \times {d_k}}$$\end{document}, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$K \in {\mathbb{R}^n}^{ \times {d_k}}$$\end{document}, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$V \in {\mathbb{R}^n}^{ \times {d_k}}$$\end{document} are the query, key, and value matrices, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${d_k}$$\end{document}is the dimensionality of the key vectors, which ensures that the attention scores are scaled appropriately, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$T$$\end{document} denotes the transpose of the matrix, and the softmax function is applied to normalize the attention scores, ensuring that they sum to 1 and can be interpreted as probabilities. The attention mechanism computes a weighted sum of the value vectors (\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$V$$\end{document}) using the attention scores between the queries and keys. This allows the model to selectively focus on different parts of the sequence, adjusting the importance of each sequence element based on its relationship to others. The output is a set of weighted value vectors, which are then used to represent the sequence features in a globally contextualized way. This process enables the model to dynamically reallocate representational focus and strengthen the structural expression of sequence features. By doing so, it can capture dependencies across the entire input sequence, even for long-range interactions, which is crucial for tasks such as sequence classification and gene prediction. Generation and scoring of protein functional cues ProtHint [39] is an integral module in our model that provides functional constraints by integrating homologous protein information. By leveraging protein-protein interactions and functional annotations, it helps guide the model to better predict functional regions within genomic sequences. The ProtHint module generates gene structure hints in two key stages: hint generation and functional scoring. In the hint generation stage, homologous proteins are identified through homology searches and aligned to the reference genome to predict gene structures, such as exons, introns, and translation start/stop codons. 8\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${P_{h{\mathop{\rm int}} }} = \sum\limits_{i = 1}^n {{W_i} \cdot {F_i}} $$\end{document} Where,\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${P_{h{\mathop{\rm int}} }}$$\end{document} is the predicted functional hint score, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${W_i}$$\end{document} is the weight of the \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$i$$\end{document}-th functional feature, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${F_i}$$\end{document} is the \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$i$$\end{document}-th functional feature derived from the protein sequence or interaction data, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$n$$\end{document} is the number of functional features considered. This equation represents the weighted sum of all functional features, where each feature \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${F_i}$$\end{document} is given a weight \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${W_i}$$\end{document} that reflects its importance in the model. These weights are learned during the training process. 9\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${I_{{\mathop{\rm int}} eraction}} = \sum\limits_{j = 1}^m {{P_j} \cdot {A_j}} $$\end{document} Where, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${I_{{\mathop{\rm int}} eraction}}$$\end{document} is the interaction score between two proteins, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${P_j}$$\end{document} is the feature vector of the \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$j$$\end{document}-th protein, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${A_j}$$\end{document} is the interaction weight between the \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$j$$\end{document}-th protein and the target protein, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$m$$\end{document} is the number of proteins considered in the interaction. This equation represents how protein-protein interactions are integrated into the model. Each protein pair is associated with a weight \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${A_j}$$\end{document}, which reflects the strength of the interaction, and the feature vector \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${P_j}$$\end{document} represents the functional features of the proteins involved. The second stage, functional scoring, evaluates the quality of the generated hints using metrics that measure the evolutionary conservation of genomic fragments, such as Alignment of Entire Exon (AEE), Intron Border Alignment (IBA), and Intron Mapping Coverage (IMC). These metrics help ensure that only high-confidence, biologically relevant hints are retained for use in the model. For further technical details, including the formulas and the specific scoring functions, please refer to Supplementary Material S1. Feature fusion module To eliminate scale differences between heterogeneous feature sources, we first applied zero-mean standardization to the feature vectors output by the two channels and concatenated them into a unified 130-dimensional joint feature space. To further improve the quality of feature fusion, we incorporated a gating mechanism, which adaptively regulates the contribution of features from different sources (gene sequence features and protein function hint features) in the final decision by learning weights. The computation is defined as follows: 10\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$F = \sigma ({W_g}{f_{seq}} + {U_g}{f_h}_{int} + {b_g})$$\end{document}11\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${f_{fused}} = F \odot {f_{seq}} + \left( {1 - F} \right) \odot {f_h}_{int}$$\end{document} Where, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${f_{seq}}$$\end{document} and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${f_{hint}}$$\end{document} represent the sequence-derived features and protein hint features, respectively, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${W_g}$$\end{document} and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${U_g}$$\end{document} are trainable weight matrices that control the contributions of each modality, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${b_g}$$\end{document} is a bias vector, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\sigma $$\end{document} denotes the activation function. This gating mechanism allows the model to adaptively prioritize the more relevant features during training. When the gating weight \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$F$$\end{document} is high (close to 1), the contribution from the sequence features \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${f_{seq}}$$\end{document} dominates, and when \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$F$$\end{document} is low (close to 0), the model relies more on the protein function hints \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${f_{h{\mathop{\rm int}} }}$$\end{document}. Functional prior regularization with protein hint scores Beyond using protein hints as input features, we further exploit their structural relevance by incorporating them into the model output layer as prior constraints. Specifically, the model’s predicted probability of each functional site \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\frown}$}}{y} _i}$$\end{document} is calibrated against the normalized protein hint score \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\tilde p_i}$$\end{document}, derived from AEE, IBA, IMC, BAQ, and SMC values at position \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$i$$\end{document}. This yields a functional prior consistency loss: 12\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\mathcal{L}_{h{\mathop{\rm int}} }} = {1 \over N}\sum\limits_{i = 1}^N {{\omega _i}} \cdot {\left( {{{\mathord{\buildrel{\lower3pt\hbox{$\scriptscriptstyle\frown$}}\over y} }_i} - {{\tilde p}_i}} \right)^2}$$\end{document} where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\omega _i}$$\end{document} reflects the reliability of hints. The final objective function is formulated as: 13\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\mathcal{L}_{total}} = {\mathcal{L}_{task}} + \lambda \cdot{\mathcal{L}_{h{\mathop{\rm int}} }}$$\end{document} This approach enables the model to reconcile sequence-based predictions with evolutionarily conserved protein-level signals, improving both predictive accuracy and biological interpretability. HMM-based prediction output module After the construction of the joint feature space, HMM classifier is employed to perform binary classification of disease resistance genes. As a probabilistic generative model well suited for sequential data, HMM is capable of capturing implicit state transition structures between observed variables and latent functional states. This makes it particularly effective for modeling the contextual dependencies and underlying functional state transitions inherent in biological sequences. Let the fused feature vector sequence be denoted as: 14\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$O = \left\{ {{o_1},{o_2},...,{o_T}} \right\},{o_t} \in \mathbb{R}$$\end{document} where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$T$$\end{document} is the sequence length, and each \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${o_t}$$\end{document} represents the joint feature vector at position \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$t$$\end{document}. The HMM defines the following. A hidden state sequence \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$S = {\rm{ }}\left\{ {{s_1},{s_2},...,{s_T}} \right\}$$\end{document}, with each \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\bf{\it{Empty}}} {\bf{\it{Equation}}}$$\end{document} indicating the non-resistant (0) or resistant (1) state. An initial state distribution \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\pi = \left\{ {{\pi _i}} \right\}$$\end{document}, where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\pi _i} = P({s_1} = i)$$\end{document}. A state transition matrix \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$A = \left\{ {{a_{ij}}} \right\}$$\end{document}, where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${a_{ij}} = P({s_t}_{ + 1} = j|{s_t} = i)$$\end{document}. An observation probability distribution \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$B = \left\{ {{b_j}\left( {{o_t}} \right)} \right\}$$\end{document}, typically modeled as Gaussian: 15\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${b_j}\left( {{o_t}} \right) = \mathcal{N}({o_t};{\mu _j},{\Sigma _j})$$\end{document} where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\mu _j}$$\end{document} and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\Sigma _j}$$\end{document} are the mean and covariance of state \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$j$$\end{document} emission distribution. The goal is to find the most probable state sequence \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${S^ * }$$\end{document} given the observed features\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$O$$\end{document}, which can be efficiently solved via the Viterbi algorithm: 16\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${S^ * } = arg\mathop {max}\limits_S P\left( {S|O} \right) = arg\mathop {max}\limits_S P(O,S)$$\end{document} The final classification output for each position \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$t$$\end{document} is the predicted state \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$s_t^* \in \left\{ {0,1} \right\}$$\end{document} indicating whether the position is associated with a disease-resistant gene function. This HMM-based classification layer complements the deep learning modules by embedding temporal smoothness and transition consistency, enabling the model to capture both local sequence features and global structural dependencies, thus improving robustness and biological interpretability in the identification of resistant loci. Model training and hyperparameter setting All experiments in this study were conducted using the TensorFlow 2.8 framework and trained on NVIDIA GeForce RTX 4090 GPU’s. During model training, DNA sequences were encoded in 6-mer format. A 5-fold cross-validation strategy was employed. The Adam optimizer was used, with a batch size of 64 and an initial learning rate of 1 × 10−3, and the learning rate attenuated to half of the original value after every 10 rounds of training to prevent the model from jumping out of the optimal solution. Evaluation metrics In the experiments, the model was evaluated using eight metrics: the area under the precision-recall curve (AUPRC), the area under the receiver operating characteristic curve (AUROC), accuracy (ACC), precision, recall, specificity, F1-score, and Matthews correlation coefficient (MCC). The formulas for calculating these metrics are as follows: 17\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$Precision = {{TP} \over {TP + FP}}$$\end{document}18\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\mathop{\rm Re}\nolimits} call = {{TP} \over {TP + FN}}$$\end{document}19\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$Accuracy = {{TP + TN} \over {TP + FN + FP + TN}}$$\end{document}20\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$Specificity = {{TN} \over {TN + FP}}$$\end{document}21\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$F1 = {{2 * \Pr ecision * {\mathop{\rm Re}\nolimits} call} \over {\Pr ecision + {\mathop{\rm Re}\nolimits} call}}$$\end{document} Where, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$TP$$\end{document}, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$TN$$\end{document}, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$FP$$\end{document}, and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$FN$$\end{document} denote the numbers of true positives, true negatives, false positives, and false negatives, respectively. Results Interpretability analysis of sequence feature recognition To interpret the model’s focus on genomic sequences, we applied the DeepLIFT (Deep Learning Important FeaTures) algorithm [40], which assigns nucleotide resolution contribution scores by backpropagating the influence of model predictions to the input. This highlights regions most relevant to the prediction. Unlike gradient-based methods, DeepLIFT avoids vanishing gradients by comparing activations between the actual and reference inputs. It attributes activation changes layer-by-layer, ultimately mapping scores to individual nucleotides. Positive, negative, or near-zero scores indicate whether a nucleotide promotes, suppresses, or negligibly affects the prediction for the positive class (e.g., high expression or resistance). The contribution maps are visualized in Fig. 2, showing nucleotide-level contributions around the transcription start site (TSS) and transcription termination site (TTS).Fig. 2Nucleotide resolution significance scores near transcription start site (TSS) and transcription termination site (TTS) Nucleotide resolution significance scores near transcription start site (TSS) and transcription termination site (TTS) The results demonstrate that the model consistently exhibits strong attention to specific sequence fragments across different species. These attention regions are predominantly located upstream and downstream of the TSS and TTS. In the TSS analysis, a markedly enhanced response is observed in the downstream region (+1 to + 500 bp), suggesting that the model has captured regulatory features around promoters and adjacent cis-elements. For TTS, the model shows high-contribution regions upstream (−1000 to 0 bp), reflecting its ability to recognize termination signal-related sequence motifs. Meanwhile, we calculated the overlap between the top 5% most important loci identified by DeepLIFT and known motifs such as promoter regions and transcription factor binding sites. The results (Supplementary Material S2) show a 60% overlap with statistically significant enrichment (p = 0.0059, Odds Ratio = 2.33), indicating that the model captures biologically relevant sequence features. These findings indicate that the model can accurately focus on functionally significant regulatory regions. The learned sequence features possess clear biological relevance, thereby validating the effectiveness and reliability of the proposed model. Ablation experiment The core framework of the proposed CLAP-HMM model consists of four key components: CNN, LSTM, the attention mechanism, and the ProtHint module. To investigate the individual contribution of each component, we conducted an ablation study using 5-fold cross-validation. The evaluation was based on six metrics, with the maximum value from each ablation run recorded and summarized in Table 2.Table 2Performance comparison of different modulesMethodsAccuracyPrecisionRecallSpecificityF1-scoreMCCAttention0.87780.88870.87860.88270.88160.8400LSTM0.87510.88870.87560.87700.88020.8431ProtHint0.87780.88880.87830.88080.88570.8556CNN0.87230.88360.87410.86550.87880.8368ALL0.88120.88980.87920.88480.88770.8558 Table 2Performance comparison of different modulesMethodsAccuracyPrecisionRecallSpecificityF1-scoreMCCAttention0.87780.88870.87860.88270.88160.8400LSTM0.87510.88870.87560.87700.88020.8431ProtHint0.87780.88880.87830.88080.88570.8556CNN0.87230.88360.87410.86550.87880.8368ALL0.88120.88980.87920.88480.88770.8558 Performance comparison of different modules The results indicate that removing the CNN module led to the most significant performance degradation, particularly in Specificity and MCC, which dropped by 1.93% and 1.90%, respectively. The ablation of the ProtHint module also caused a noticeable decline in performance (MCC decreased by approximately 0.22%). To statistically test whether these differences were significant, we performed paired t-tests, and the results are provided in Supplementary Material S3. To comprehensively evaluate the contribution of each framework component, we visualized the results of each fold in the ablation study using box plots, as shown in Fig. 3. The full model (ALL) consistently outperformed all variants with minimal variance. Notably, removing both CNN and HMM led to the lowest scores in Accuracy, Specificity, and MCC. Combined with Table 1, these results highlight the essential roles of each module in feature extraction, sequence modeling, and functional integration, confirming the overall effectiveness of CLAP-HMM.Fig. 35-fold cross-validation of the performance results. (Box plots summarize the fold level distributions of accuracy, sensitivity, specificity, and MCC for each model variant.) 5-fold cross-validation of the performance results. (Box plots summarize the fold level distributions of accuracy, sensitivity, specificity, and MCC for each model variant.) To investigate the impact of different attention mechanisms on model performance, we replaced the original dot-product attention with additive attention, convolution-based attention, and multi-head attention, while keeping all other parameters unchanged. For each fold in the 5-fold cross-validation, we computed and plotted radar charts for six evaluation metrics, as shown in Fig. 4. The results indicate that additive attention achieved the smallest enclosed area across all six metrics, suggesting relatively poorer performance. In contrast, dot-product attention exhibited the largest enclosed area, significantly enhancing the precision of model and specificity. Overall, the dot-product attention mechanism demonstrated the strongest discriminative capability and generalization performance in this task.Fig. 45-fold cross-validation radar chart. (Each radar chart visualizes the performance of the attention mechanisms across the five cross-validation folds. Dot-product attention consistently shows superior performance in most metrics, particularly in accuracy, precision, and specificity) 5-fold cross-validation radar chart. (Each radar chart visualizes the performance of the attention mechanisms across the five cross-validation folds. Dot-product attention consistently shows superior performance in most metrics, particularly in accuracy, precision, and specificity) To evaluate the impact of different feature fusion strategies on model performance, we further compared three fusion approaches: Concatenation, Additive Summation (Add), and Gated Fusion (Supplementary Material S4). The results showed that the Gated Fusion strategy achieved an accuracy of 0.88, significantly outperforming the other two methods, indicating that the introduction of a learnable gating mechanism helps enhance the representational power of multi-source feature fusion. Comparison with other competitive methods To comprehensively evaluate the performance of CLAP-HMM, we conducted benchmarking against five representative methods on the same dataset: DeepARG [20], GeneMark-ET [41], Resfams [9], DeepGO [21], and DeepGOPlus [22]. The performance metrics of each model are summarized in Table 3.Table 3Performance comparison of different methodsMethodsAccuracyPrecisionRecallSpecificityF1-scoreMCCDeepARG0.84350.85030.85270.87020.87140.8436GeneMark-ET0.86080.86010.86170.86130.86800.8316Resfams0.87860.88300.87250.85430.87720.8725DeepGO0.84370.82850.83380.85110.81660.8582DeepGOPlus0.87810.87100.87260.88100.87100.8525CLAP-HMM0.88260.88340.88160.87150.88250.8743 Table 3Performance comparison of different methodsMethodsAccuracyPrecisionRecallSpecificityF1-scoreMCCDeepARG0.84350.85030.85270.87020.87140.8436GeneMark-ET0.86080.86010.86170.86130.86800.8316Resfams0.87860.88300.87250.85430.87720.8725DeepGO0.84370.82850.83380.85110.81660.8582DeepGOPlus0.87810.87100.87260.88100.87100.8525CLAP-HMM0.88260.88340.88160.87150.88250.8743 Performance comparison of different methods The results show that CLAP-HMM achieved the best overall performance across all metrics, with a Matthews Correlation Coefficient (MCC) of 87.43%, indicating robust discriminative power and stability. Resfams demonstrated performance close to CLAP-HMM, particularly in Precision and F1-score, but showed a relatively lower Specificity, suggesting a higher false positive rate. GeneMark-ET performed slightly below CLAP- HMM and Resfams but still achieved reasonable results. In contrast, DeepGOPlus, DeepARG, and GeneMark-ET showed consistent and stable performance across all metrics, suggesting good generalizability and potential for early-stage screening applications. DeepGO, however, exhibited lower Precision and F1-score, indicating a risk loss of information in complex resistance gene identification tasks. To compare the three models with similar performance, we trained them under identical hardware and time constraints. CLAP-HMM achieved slightly higher accuracy while requiring less computational time, as detailed in Supplementary Material S5. To further assess model robustness and generalizability, we plotted the AUROC and P-R curves for all six models, as shown in Fig. 5.Fig. 5AUROC and AUPRC results. (The AUROC results compared with the baseline model are shown in (a), and the P-R results are shown in (b) AUROC and AUPRC results. (The AUROC results compared with the baseline model are shown in (a), and the P-R results are shown in (b) Based on the comprehensive metrics presented in Table 3, the top three models in terms of overall performance on the constructed resistance gene dataset are CLAP-HMM, Resfams, and GeneMark-ET, demonstrating strong generalizability and practical utility. Performance on biologically verified R gene case To further evaluate the model ability to recover biologically validated resistance genes, we applied CLAP-HMM to 200 curated R-gene sequences. The model identified 175 sequences as resistant, among which 154 have existing annotations confirming their involvement in resistance pathways (Supplementary Material S5). Importantly, all 22 sequences belonging to the well-documented RPM1 family, an NLR-type gene with extensive experimental evidence. This demonstrates that CLAP-HMM can reliably capture conserved resistance-associated patterns and accurately recognize specific, functionally validated R genes. Cross-species verification To evaluate the generalization capability of the CLAP-HMM model across different species, Fig. 6 presents heatmaps of prediction accuracy under both intra-genus and inter-genus scenarios.Fig. 6Validation results of populus L. dataset and cross-genus dataset. (The results of the intra-species generalization test are shown in (a), while the cross-genus transfer test is shown in (b) Validation results of populus L. dataset and cross-genus dataset. (The results of the intra-species generalization test are shown in (a), while the cross-genus transfer test is shown in (b) In the intra-genus generalization test (Fig. 6a), we performed a cross-validation matrix using P. nigra, P. euphratica, P. trichocarpa, and P. alba. The results showed that all pairwise combinations achieved prediction accuracies exceeding 80%, demonstrating strong transferability within the Populus genus. Notably, the model trained on P. trichocarpa achieved the highest average accuracy (85.58%) when tested on the other three species, suggesting its superior capacity to capture generalizable structural features associated with disease resistance. In the cross-genus transfer test (Fig. 6b), the CLAP-HMM model exhibited stable generalization performance across different genera. The model trained on Populus species achieved high prediction accuracies when transferred to Eucalyptus (80.01%) and Salix (77.67%). Among all tested models, the one trained on Eucalyptus demonstrated the most consistent and robust recognition capability. Overall, the research results show that CLAP-HMM performs exceptionally well in intra-species migration tasks, and also maintains strong generalization capabilities in cross-species environments. These findings highlight its potential for uncovering conserved resistance gene patterns across species and provide a solid foundation for future multi-species integrative resistance analysis. Discussion In this study, our results demonstrate that integrating deep representation learning with biologically informed structural constraints can substantially improve the detection of full length resistance (R) genes from long and complex genomic regions. As a supervised approach, a comprehensive evaluation of CLAP-HMM confirms its superior performance across all metrics, with this improvement stemming from how its architecture aligns with the known properties of R genes. The CNN-LSTM-Attention module captures multilayered sequence signals, allowing the model to integrate motif level features with broader structural patterns that often extend beyond local sequence windows. The addition of functional hints from protein level annotation introduces priors that reflect evolutionary and biochemical constraints, improving the model ability to distinguish genuine R gene signatures from background variation. The HMM component further contributes by shaping predictions according to plausible state transitions along gene structures, which is particularly important for long sequences containing interspersed domains, partial motifs, or irregular spacing. These enhancements help the model approximate the hierarchical organization of real R genes, providing interpretability and biological coherence that purely data driven architectures often lack. The effectiveness of CLAP-HMM is further supported by its ability to generalize across species. The architecture captures structural regularities and functional features that are conserved in R genes, allowing the model to maintain predictive capability even in species with divergent evolutionary backgrounds. Attention distributions correspond closely with known functional regions, including promoters, conserved domains, and terminator regions, highlighting that the model not only encodes predictive sequence patterns but also aligns with biologically interpretable features. This combination of generalization and interpretability underscores the capacity of model to approximate real gene organization across diverse genomic contexts. In summary, the strong performance of CLAP-HMM in long-sequence R gene prediction stems from its innovations in feature extraction, biological information integration, and attention mechanism design. These advantages deepen our understanding of the complex relationship between gene structure and function and offer a useful reference for resistance gene identification, functional gene annotation, and molecular breeding in plants. Nonetheless, CLAP HMM has several limitations that require further examination. First, the combination of multiple deep learning modules with probabilistic state modeling increases computational demands, especially when the model is applied to genome wide prediction in large and repetitive forest genomes. Specifically, using our minimum computational resources, completing a full training analysis requires approximately 3–4 days. Second, although the model performs well across genera within woody species, its scalability to non tree species remains insufficiently assessed. This is mainly because our study focuses on long R genes in complex woody genomes, whereas herbaceous plants, crops, or microorganisms often have more compact genomes or markedly different R gene architectures. Therefore, developing models with improved transferability that can accurately predict resistance genes across diverse gene architectures will be a key focus of future work. Third, the HMM component depends on predefined structural boundaries (e.g., resistant vs. non-resistant regions), which may limit its effectiveness in handling atypical domains or irregular splicing patterns. Future studies will focus on reducing computational costs and improving cross species adaptability by incorporating graph based priors, semi supervised structure recognition, and extending the framework to other gene families with different structural or regulatory characteristics [42]. Electronic supplementary material Below is the link to the electronic supplementary material. Supplementary Material 1 Supplementary Material 1 Supplementary Material 2 Supplementary Material 2 Supplementary Material 3 Supplementary Material 3 Supplementary Material 4 Supplementary Material 4 Supplementary Material 5 Supplementary Material 5 Supplementary Material 6 Supplementary Material 6