A method and system for predicting sgRNA targeting activity based on cross-branch interaction and selective state space modeling

By employing cross-branch interaction and selective state-space modeling, local and contextual features of nucleotide sequences are extracted, position-level interactions are established, and a global fusion representation is formed. This solves the consistency problem in the prediction of sgRNA targeting activity in existing technologies, and improves the prediction accuracy and applicability.

CN123161663APending Publication Date: 2026-11-24EAST CHINA NORMAL UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611380149.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-07
Publication Date
2026-11-24

AI Technical Summary

Technical Problem

Existing methods struggle to effectively extract the positional correspondence between local features and contextual features of nucleotide sequences, and they are prone to losing positional-level details when predicting sgRNA targeting activity, resulting in poor prediction consistency.

Method used

A method based on cross-branch interaction and selective state space modeling is adopted. Features are extracted through local receptive fields and bidirectional sequence encoding, position-level interactions are established and a global fusion representation is formed. Combined with selective state space updates, continuous target activity prediction values ​​are generated.

Benefits of technology

It improves the accuracy and consistency of sgRNA targeting activity prediction, enhances the model's sensitivity to different locations, is applicable to various Cas proteins and PAM types, and reduces label information leakage during training and prediction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123161663A_ABST
    Figure CN123161663A_ABST
Patent Text Reader

Abstract

This invention discloses a method and system for predicting sgRNA targeting activity based on cross-branch interaction and selective state-space modeling. First and second sequence representations are formed from the same nucleotide sequence to be predicted, and multi-scale local positional features and bidirectional contextual positional features are extracted in parallel. Before global fusion, cross-branch positional information interaction is performed based on the positional correlation between local and contextual positional features, generating positional-level cross-branch interaction features that correspond one-to-one with sequence positions and converging them into a global interaction representation. These three representations are then fused into a global fusion representation, broadcast to all positions, and combined with projections from the two branch positions to form a position-by-position input. Selective state updates are performed using input-related state-space parameters, and the predicted targeting activity value is output and a candidate ranking is formed after positional convergence and regression mapping. This invention enhances the utilization of the positional correspondence between local patterns and contextual information, and its average ranking consistency on 12 publicly available datasets is superior to representative methods.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of computational biology, gene editing data analysis, and sequence machine learning, specifically to a method and system for predicting sgRNA (single-guide RNA) targeting activity based on cross-branch interaction and selective state space modeling. Background Technology

[0002] In CRISPR / Cas9, candidate sgRNAs recognize target DNA via a guide region, and Cas9 cleaves the DNA near the target site that meets the recognition criteria of the protospacer adjacent motif (PAM). Even if candidate sequences target the same gene or adjacent regions, their experimental activities may vary significantly. Wet experiments typically involve construction, delivery, culture, and sequencing, making it difficult to directly handle the entire screening of large-scale candidate sequences. Therefore, predicting and sorting activities based on sequences before experimentation can narrow down the range of candidates that need to be validated.

[0003] Both short-range base combinations and longer sequence environments within nucleotide sequences can be related to targeting activity. When extracting local features using a single receptive field, it's difficult to simultaneously cover adjacent base combinations of different lengths; when only unidirectional sequence encoding is performed, the representation of a single position cannot simultaneously include its forward and reverse environments. Existing methods include scoring methods based on statistical regularities such as positional base preferences and GC content, traditional machine learning methods relying on artificial features, and deep learning methods that automatically learn sequence representations using convolutional networks, recurrent networks, and attention structures; some hybrid methods concatenate or parallel these structures to simultaneously utilize multiple types of sequence information.

[0004] Existing hybrid methods typically concatenate compressed global vectors from different branches directly or perform a one-time fusion at a higher network level. While this process preserves the overall information of each branch, it often fails to adequately utilize the positional correspondence between local and contextual features. Even when some methods introduce interactions between different branches, the interaction results are usually pooled or compressed into a global vector, making it difficult to maintain positional correspondences in subsequent modeling. Furthermore, even after completing local features, contextual features, and cross-branch interactions, it is still necessary to organize the multi-level information at each position into a unified sequence representation: using fixed linear state updates makes it difficult to adjust information writing, retention, and output according to the current position's content; directly relying on high-level concatenation easily leads to the loss of positional details. Furthermore, if the label statistics of the validation set or test set are used for scaling during model training, label information outside the training set will be introduced into the processing chain. If different character processing, position alignment or label inverse transformation methods are used in the training phase and the actual prediction phase, it will also affect the consistency of the obtained prediction values. Summary of the Invention

[0005] This invention aims to solve the following technical problems: extracting base combinations from different local receptive fields while maintaining the correspondence between nucleotide categories and sequence positions, so that the context position representation simultaneously includes both forward and reverse sequence environments; before forming a global fusion representation, enabling local position features and context position features to complete cross-branch information interaction based on positional correlation while maintaining positional correspondence; then organizing local position features, context position features, and cross-branch interaction results into a continuously updated unified sequence representation, so that the information writing, retention, or output method in the state space can be adjusted according to the current position content; and finally outputting the continuous targeting activity prediction value and candidate ranking of candidate sgRNAs. To address the aforementioned problems, the first aspect of this invention provides a method for predicting sgRNA targeting activity based on cross-branch interaction and selective state-space modeling, comprising the following steps: S1: Obtain and verify the nucleotide sequence to be predicted corresponding to the candidate sgRNA. Form a first sequence representation and a second sequence representation from the same nucleotide sequence to be predicted. The first sequence representation is used for local pattern extraction and the second sequence representation is used for context modeling. S2: At least two local receptive fields are used to extract local features in parallel for the first sequence representation to obtain local position features and local global representations that correspond one-to-one with the positions of the nucleotide sequence to be predicted; bidirectional sequence encoding is performed on the second sequence representation to obtain context position features containing forward sequence environment information and reverse sequence environment information. The context position features correspond to each position of the nucleotide sequence to be predicted and are integrated to obtain the context global representation. S3: Based on the positional correlation between local positional features and contextual positional features, cross-branch positional information interaction is performed to generate positional cross-branch interaction features that maintain a one-to-one correspondence with the position of the nucleotide sequence to be predicted, and positional convergence is performed on the positional cross-branch interaction features to obtain a global interaction representation; S4: Fuse the local global representation, context global representation, and global interaction representation to obtain the global fused representation; project the local position features and the context position features aligned with the position of the nucleotide sequence to be predicted, respectively, and broadcast the global fused representation to each sequence position; combine the local position projection, context position projection, and the broadcast global fused representation at each position into a position-by-position input; S5: Generate or adjust state space parameters based on the position-by-position input of each position, update the hidden state in position order and generate position output, wherein at least a part of the state writing parameters, state retention parameters, state output parameters and discrete step size change with the position-by-position input of the current position, and obtain a unified sequence representation that maintains the position correspondence. S6: Aggregate the position outputs of each position, generate sgRNA targeting activity prediction values ​​through regression mapping, and sort candidate sgRNAs according to the prediction values ​​when there are multiple candidate sgRNAs.

[0006] The above steps constitute an interlocking chain, with the positional input as the hub. S1, derived from the same sequence, adapts two representations to the two branches respectively. S2 generates local positional features that maintain their respective positional correspondences with contextual positional features. Before either branch is compressed into a global vector, S3 establishes positional interactions based on the positional correlation between local and contextual positional features, maintaining a one-to-one correspondence with the sequence positions. The convergence result constitutes the global interactive representation. In S4, the global fusion representation simultaneously consumes the convergence result of the interaction between the two branches' global representations and S3, then broadcasts it back to each position, adding it to the positional projections of the two branches to obtain the positional input. The state space parameters of S5 originate from this positional input; that is, the output of each preceding step is consumed positionally by the next step. Removing S3 renders the global interactive representation passive, and the fusion degenerates into a direct splicing of the two branches' high-level components, resulting in the loss of positional correspondences. Removing the broadcasting and positional combination of S4 prevents multi-level information from entering the same state update chain. Removing the input correlation of S5 causes each position to revert to a unified and fixed linear time-invariant update. Ablation experiments show that the absence of any of these steps leads to a decrease in prediction consistency.

[0007] As a further aspect of the present invention, the first sequence representation uses one-hot encoding of four types of nucleotides: A, C, G, and T; the second sequence representation uses discrete indexing and trainable embedding, and a sequence start marker is added before the sequence; when the context position features are aligned with the original sequence position, the output corresponding to the start marker is removed, while the position corresponding to the start marker is retained when used for cross-branch position-level information interaction. This processing ensures that the number of query positions is equal to the original sequence length L, the number of key value positions is L+1, and the interaction output maintains a one-to-one correspondence with the query positions.

[0008] As a further aspect of the present invention, local location features are used as the source of queries, and contextual location features are used as the source of keys and values. The location-level cross-branch interaction features are generated through scaled dot product cross attention: Q = H_loc W_Q, K = H_ctx W_K, V = H_ctx W_V, H_int = softmax(QK^T / √d)V; the global fusion representation satisfies g_global = W_g[g_loc; g_ctx; g_int] + b_g.

[0009] As a further aspect of the present invention, the position-by-position input is constructed as x_t = P_loc,t + P_ctx,t + g_global; the state update is performed as h_t = Ā_t h_(t-1) + B̄_t x_t, z_t = C_t h_t + D x_t, wherein at least a portion of B̄_t, C_t, or the discrete step length is related to x_t; the predicted value is output as ŷ = W_o·Mean(z_1, ..., z_L) + b_o; the variable-length input uses a sequence mask to prevent the filling position from participating in the interaction, state update, and position convergence.

[0010] As a further aspect of the present invention, a specific embodiment employs the following recalculated parameters: the input is a 20 nt original interval region plus a 3 nt PAM region, totaling 23. The core scheme consists of two multi-scale one-dimensional convolutions, each with kernels of 3, 5, and 7. The first layer outputs 64 channels, concatenated to form a 192-dimensional representation, and the second layer outputs 128 channels, concatenated to form a 384-dimensional representation. After averaging and pooling, the representation is mapped to a 320-dimensional local-to-global representation. The contextual features are two-layer bidirectional long short-term memory networks with a unidirectional hidden dimension of 80, concatenated to form a 160-dimensional representation, and flattened to form a 320-dimensional contextual-to-global representation. The interactions consist of 23 query positions, 24 key-value positions, a common feature dimension of 128, and an interaction weight inactivation rate of 0.1. The global fusion is 320 + 320 + 128 concatenated to form a 768-dimensional representation and mapped to a 192-dimensional representation. The selective state space module has a feature dimension of 192, a state dimension of 12, an internal convolution width of 4, and a scaling factor of 2. The core scheme does not limit the specific values ​​mentioned above, nor does it limit the Cas protein type, PAM type, or input length.

[0011] A second aspect of this invention provides a training method for an sgRNA targeting activity prediction model: training samples, experimental activity labels, and validation samples are acquired; missing or non-numerical labels are identified before forming the model input; a model executing the above prediction method is constructed; label scaling statistics are determined only based on the training sample labels, and the training and validation sample labels are processed; parameters are updated based on the loss, parameters are selected using the validation samples, and the model parameters and label scaling statistics are jointly stored for loading during the prediction phase. This ensures that training, validation, testing, and actual prediction use a consistent preprocessing chain, avoiding label information leakage.

[0012] The third and fourth aspects of this invention provide an sgRNA targeting activity prediction system and an sgRNA targeting activity prediction model training system, respectively. Their module division and execution operations correspond to the methods described above, and will not be repeated here.

[0013] Compared with the prior art, the beneficial effects of the present invention are as follows: 1) Pre-fusion positional interaction: Before compression into a global vector, positional relationships are established with local branches as queries and context branches as keys, so that local base patterns can select information from the corresponding positions of the context branches, avoiding direct splicing based solely on high-level data.

[0014] 2) Multi-scale local representation and bidirectional contextual complementarity: Multiple receptive fields extract adjacent base combinations in parallel, reducing the limitation of a single convolution scale on the coverage of local patterns; bidirectional encoding enables each position to simultaneously obtain information on the preceding and following nucleotide arrangements.

[0015] 3) Unified State Integration: Local position projection, context position projection, and global fusion representation formed by interaction results are jointly entered into the input-related state update. The preceding multi-level information forms a unified sequence representation, and different information writing, retention, and output ratios can be adopted at different positions.

[0016] 4) Improved overall prediction performance: On 12 public datasets (a total of 353,457 samples), the average SCC of the method of this invention is 0.7390 and the average PCC is 0.7483, which are 0.0061 and 0.0085 higher than the second most representative method, respectively. The ablation experiment shows that removing any step reduces the SCC, proving that all steps of the complete technology chain work together to produce the prediction effect.

[0017] 5) Clear applicability boundaries: The core method does not rely on a fixed 23 nt input, a specific Cas9 type, or a unique activity measurement index. By changing the input region definition and using a mask, it can be adapted to other Cas proteins and PAM types. Attached Figure Description

[0018] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. The drawings described below are merely some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0019] Figure 1 This is a schematic diagram of the steps in the sgRNA targeting activity prediction method of the present invention; Figure 2 This is a detailed flowchart of step S3 (location-level cross-branch interaction); Figure 3 This is a detailed flowchart of step S4 (global fusion and position-by-position input construction); Figure 4 This is a detailed flowchart of step S5 (selective state update); Figure 5 This is a system module diagram of the sgRNA targeting activity prediction system of the present invention. Detailed Implementation

[0020] The present invention will be further described below with reference to the accompanying drawings and embodiments. Unless otherwise specified, the following embodiments and features can be combined with each other. It should be noted that the following description is exemplary and intended to enable those skilled in the art to understand and implement the present invention.

[0021] Please see Figure 1 The present invention includes a model training phase and an activity prediction phase, both of which share the same feature processing link: the training phase uses samples with experimental activity labels to determine the parameters for feature extraction, interaction, state update and regression; the prediction phase loads the parameters obtained in the training phase and performs the same representation and feature processing link on new nucleotide sequences to be predicted. The method is executed in steps S1 to S6: S1 acquires and verifies the nucleotide sequences to be predicted corresponding to candidate sgRNAs. During the training phase, corresponding experimental activity tags are also acquired, and sequence length, base character composition, PAM conditions, and tag integrity are checked. Model input is formed according to applicable Cas protein rules. S2 extracts local position features and local-global representations in parallel from the first sequence representation, and extracts context position features and context-global representations from the second sequence representation. S3 performs cross-branch position-level information interaction based on the positional correlation between local and context position features, generating position-level cross-branch interaction features that maintain a one-to-one correspondence with sequence positions, and converges them along positions to obtain a global interaction representation. S4 fuses the three global representations and maps the two branch position features to a unified dimension, constructing position-by-position input. S5 performs selective state updates using input-related state space parameters to obtain a unified sequence representation that maintains positional correspondence. S6 converges the unified sequence representations and outputs the target activity prediction value through regression mapping, and sorts multiple candidate sequences according to the prediction value. During the training phase, loss is calculated and parameters are updated based on the predicted value and the true tag after S6. The optimal parameters are selected using the validation set. No parameter updates are performed during the prediction phase.

[0022] The nucleotide sequence to be predicted is the target DNA sequence corresponding to the candidate sgRNA, which may contain the protospacer region and its adjacent protospacer motif (PAM). For the commonly used SpCas9, a 23-nt input consisting of a 20-nt protospacer region and a 3-nt PAM can be used. This specific length is only for example and does not constitute a limitation on other Cas proteins, PAM types, or input lengths. The targeting activity tag can be the indel frequency or other continuous measurements that can characterize the expected target site cleavage or editing efficiency.

[0023] Input validation: The sequence is checked for the following: whether it consists of A, C, G, and T; whether its length meets the input definition; and whether the label is missing or non-numerical. Sequences containing uncertain bases are processed using the same character strategy as during training, without using silent replacement or default values ​​to mask anomalies. For fixed-length implementations, all samples must be of consistent length. For variable-length inputs, masks can be used to prevent padding positions from participating in aggregation and state updates. Single sequences and batch sequences use the same feature processing chain; the batch dimension does not change the correspondence between positions.

[0024] The training samples are first divided into training, validation, and test sets according to a ratio of 76.5%:8.5%:15%. Then, the labels are normalized using only the training set statistics.

[0025] y_i^norm=(y_i-y_min) / (y_max-y_min)

[0026] Where y_i is the original activity label of the i-th sample, and y_min and y_max are the minimum and maximum values ​​of the training set labels, respectively. Before implementation, it should be confirmed that y_max > y_min. The training set statistics are reused in the validation set, test set, and subsequent prediction stage to avoid leakage of test information. When the data distributions of different experimental sources are inconsistent, training can be conducted independently within each data source or after unified calibration; in the specific implementation, each dataset is trained independently. The model comparison and ablation experiments use the exact same data partitioning.

[0027] Two complementary representations are generated for the same target nucleotide sequence of length L: The first representation uses one-hot encoding of nucleotide categories, mapping A, C, G, and T to mutually independent four-dimensional vectors without introducing artificial numerical order, making it suitable for one-dimensional convolution along the sequence position direction; the second representation converts nucleotides into discrete indices and maps them to dense continuous vectors via a trainable embedding matrix. In a specific implementation, a start marker is added before the sequence to make the index sequence length L+1. The start marker provides uniform sequence boundary information without changing the original L target sequence positions. The core scheme only requires two representations adapted to the two branches from the same sequence, without limiting the order of the one-hot vectors, the discrete index numbers, or the unique values ​​of the embedding dimensions.

[0028] The first sequence represents a one-dimensional feature extraction branch that enters at least two different receptive fields along the positional direction. Each branch extracts adjacent base combinations of different lengths while maintaining the sequence positional order. After normalization, nonlinear activation, and random deactivation, these combinations are concatenated along the channel dimension. The concatenated result continues into the next layer of multi-scale branches, gradually combining patterns from different local ranges. This branch outputs local positional features, with each row corresponding to a position in the sequence to be predicted. Simultaneously, the local positional features are adaptively averaged and converged along the position, and then linearly mapped, nonlinearly activated, and randomly deactivated to obtain a local-global representation. A specific implementation uses two layers of multi-scale temporal convolution: each layer has three parallel one-dimensional convolutional branches with kernel sizes of 3, 5, and 7. The first layer outputs 64 channels per branch, concatenated to 192 channels; the second layer outputs 128 channels per branch, concatenated to 384 channels. The convolution maintains 23 positions through appropriate padding. The 384-dimensional averaged converged result is mapped to a 320-dimensional local-global representation through a fully connected layer.

[0029] The second sequence represents the bidirectional sequence coding structure, where nucleotide arrangements are processed along both the forward and reverse directions, and the hidden representations in both directions are combined to ensure that each position simultaneously contains information about the preceding and following sequence environments, outputting contextual position features. All position features are then converged or integrated and linearly mapped to obtain a global contextual representation. In a specific embodiment, a two-layer bidirectional long short-term memory network is used, with an embedding dimension of 60 and a hidden dimension of 80 in each direction. After concatenating the forward and reverse outputs, each position forms a 160-dimensional contextual feature. The 24 position features, including the start marker, are flattened and mapped to a 320-dimensional global contextual representation through a fully connected layer. When used for addition to the original sequence position, the output corresponding to the start marker is removed to align it with the 23 target sequence positions. When used for cross-branch positional information interaction, the 24 contextual positions, including the start marker, are retained.

[0030] Please see Figure 2To avoid simply concatenating the global vectors of the two branches, this invention establishes a direct connection between local position features and context position features before global fusion. Step S3 specifically includes: S301, obtaining the query by trainingable linear mapping of the local position feature H_loc, and obtaining the key and value by trainingable linear mapping of the context position feature H_ctx, i.e., Q = H_loc W_Q, K = H_ctx W_K, V = H_ctx W_V. After mapping, the query and the key have the same feature dimension d; S302, calculating the correlation between each local position and each context position, and aggregating the key-value information according to the normalized correlation weight, i.e., H_int = softmax(QK^T / √d)V, to obtain the position-level cross-branch interaction feature H_int that corresponds one-to-one with the local position; since the query comes from H_loc, the output length of H_int is consistent with the L local positions of the sequence to be predicted; S303, averaging and aggregating H_int along the L query positions to obtain the global interaction representation g_int. In a specific embodiment, L is 23, the query contains 23 positions, the key and value contain 24 positions including the start marker, the interaction hiding dimension is 128, and the attention weights are randomly deactivated with a deactivation rate of 0.1 during the training phase. In addition to scaled dot product cross attention, position-level interactions can also use multi-head cross attention, bilinear correlation mapping, or gated correlation aggregation, as long as the output still corresponds to the sequence positions of the query branch.

[0031] Please see Figure 3 Step S4 specifically includes: S401, concatenating the local global representation, the context global representation, and the global interaction representation, and obtaining the global fusion representation through linear mapping: g_global = W_g[g_loc; g_ctx; g_int] + b_g; S402, mapping the local position features and the context position features aligned with the original sequence after removing the start marker to a unified dimension, obtaining the local position projection P_loc and the context position projection P_ctx; S403, broadcasting the global fusion representation to L positions and adding it position-by-position to the two branch position projections to form the position-by-position input x_t = P_loc,t + P_ctx,t + g_global. Therefore, the input at each position simultaneously contains multi-scale local information of the current position, the preceding and following context information, and the overall information formed by the two branch global information and the position-level interaction results; since g_int originates from the position convergence of H_int, the position-level interaction results participate in the subsequent state update of each position through the global fusion representation. In a specific embodiment, the dimensions of the three global representations are 320, 320 and 128 respectively. After concatenation, they form a 768-dimensional vector and are linearly mapped to a 192-dimensional global fusion representation. The positional features of the two branches are linearly mapped from 384-dimensional and 160-dimensional to a 192-dimensional positional projection.

[0032] Please see Figure 4 The input is entered position by position into the selective state space module. Step S5 specifically includes: S501, generating or adjusting state space parameters based on the position-by-position input of the current position. At least a part of the state writing parameters, state retention parameters, state output parameters, and discrete step size changes with the current position input. Unlike linear time-invariant state updates that share a fixed input matrix, output matrix, and discrete step size for all positions, this allows different sequence positions to use different information writing, retention, and output ratios. S502, updating the hidden state and generating position outputs in sequence from the first position: h_t = Ā_t h_(t-1) + B̄_t x_t, z_t = C_t h_t + D x_t; where h_t is the hidden state at the t-th position, z_t is the position output, Ā_t and B̄_t are obtained from discrete state transition relations, at least a part of B̄_t, C_t, or discrete step size is related to x_t, and D is the direct pass parameter; the position outputs maintain a one-to-one correspondence with the sequence positions, forming a unified sequence representation. Through continuous updates, the module can select the information to be retained and transmitted based on the input content. In a specific embodiment, the state space feature dimension is 192, the state dimension is 12, the local convolution width within the module is 4, and the feature expansion factor is 2; the above parameters are used to illustrate possible implementations and do not limit the scope of protection. Other input-related state space structures can be used as long as at least a portion of their state writing, retention, or output parameters changes with the current input position and is continuously updated to the position of the fused sequence.

[0033] The L positional features output by the module are averaged and aggregated, and then a normalized activity prediction value is output through a fully connected regression layer: ŷ = W_o·Mean(z_1, z_2, ..., z_L) + b_o; when the original dimensions are needed, the scaling statistics saved during the training phase are used to perform an inverse transformation. For multiple candidate sequences, candidate sgRNAs are directly sorted from high to low according to the predicted values. The prediction results are used to narrow down the scope of subsequent experimental validation and do not replace experimental measurements. Positional average aggregation can be replaced by weighted aggregation or taking a predefined aggregation position; the regression layer can be a single layer or a small number of fully connected layers.

[0034] During the training phase, mean squared error (MSE) is used to measure the deviation between the normalized label and the predicted value: L_MSE = (1 / N)Σ(y_i^norm-ŷ_i)^2, where N is the number of training samples involved in the loss calculation, and ŷ_i is the corresponding predicted value. In a specific implementation, the Adamax optimizer is used to update parameters, with a maximum training epoch of 200, a batch size of 16, and an initial learning rate of 1×10^-4. The Spearman rank correlation coefficient on the validation set is used as the primary selection criterion, with the Pearson correlation coefficient as a secondary reference. Training is stopped early if there is no improvement after 10 consecutive epochs, and the parameters that perform best on the validation set are saved. The test set is not involved in parameter updates or model selection. After training, the model parameters and label scaling statistics are saved together, and the parameters are loaded and kept unchanged during the prediction phase.

[0035] Example 1 Taking the 23 nt input corresponding to SpCas9 as an example, the nucleotide sequence to be predicted consists of a 20 nt original spacer region and a 3 nt PAM. The first sequence representation uses four-dimensional one-hot encoding with a size of 23×4; the second sequence representation adds a start marker before the sequence to form 24 discrete indices, each index is mapped to a 60-dimensional vector, resulting in a 24×60 second sequence representation.

[0036] Local feature extraction employs a two-layer multi-scale one-dimensional convolution: the first layer has three branches with kernels of 3, 5, and 7, each outputting 64 channels, which are concatenated along the channel dimension to form 192 channels; the second layer also has three branches with kernels of 3, 5, and 7, each outputting 128 channels, which are concatenated to form a local location feature of size 23×384; each branch maintains 23 locations unchanged through boundary padding. The 384-dimensional local location features are averaged and converged along the 23 locations, mapping to a 320-dimensional local-global representation.

[0037] Context feature extraction employs a two-layer bidirectional long short-term memory network with 80 hidden dimensions in each direction. The forward and reverse outputs at the same location are concatenated to obtain a 24×160 context location feature, which is then flattened and mapped to a 320-dimensional global context representation.

[0038] The location-level cross-branch interaction uses 23 local locations as queries and 24 context locations, including the start marker, as keys and values. Queries, keys, and values ​​are all mapped to a 128-dimensional common feature space. During training, the normalized interaction weights are deactivated at a rate of 0.1. The interaction result has 23 query locations, and the average convergence yields a 128-dimensional global interaction representation.

[0039] The 320-dimensional local-global representation, the 320-dimensional context-global representation, and the 128-dimensional global interaction representation are concatenated into a 768-dimensional representation, which is then mapped to a 192-dimensional global fusion representation. The 23×384 local position features are mapped to a 23×192 local position projection, and the 23×160 context features after removing the initial marker are mapped to a 23×192 context position projection. The 192-dimensional global fusion representation is broadcast to 23 positions and added position-by-position to the two projections to form a 23×192 position-by-position input.

[0040] The selective state space structure uses 192-dimensional feature input, 12-dimensional state, 4-dimensional internal convolution width, and 2-dimensional feature expansion factor to process the input at 23 locations sequentially. The output at the 23 locations is averaged and converged, and then regressed to obtain the activity prediction value.

[0041] During training, samples with valid continuous labels are divided into training, validation, and test sets according to a 76.5%:8.5%:15% ratio. The partitioning is completed first, then the minimum and maximum values ​​are calculated separately from the training set labels. Min-Max normalization is performed only when the maximum value exceeds the minimum value. The validation, test, and subsequent predictions reuse the statistics from the training set. Model parameters are updated using the Adamax optimizer with an initial learning rate of 1×10^-4, a batch size of 16, and a maximum of 200 epochs. Training stops and the optimal parameters are saved when the validation metric fails to improve for 10 consecutive epochs. The test set is used only after the parameters are determined.

[0042] Example 2 This embodiment verifies the method described in Example 1 on 12 publicly available sgRNA targeting activity datasets. Each dataset was trained and tested independently, without merging different experimental sources. Evaluation used the Spearman rank correlation coefficient (SCC) to measure the consistency between predicted and actual ordination, and the Pearson correlation coefficient (PCC) to measure the linear correlation between predicted and actual activity values; the closer both are to 1, the higher the consistency. The 12 datasets contain a total of 353,457 samples, covering wild-type, high-fidelity, or extended PAM-compatible Cas9 variants, as well as cell backgrounds such as HEK293T, HELA, HCT116, and HL60, as detailed below. Under the same data partitioning, the method of this invention is compared with five representative methods, and the average results of 12 datasets are as follows. The method of this invention improves the average SCC by 0.0061 and the average PCC by 0.0085 compared to the second-highest method, indicating that the proposed technology chain has relatively stable overall prediction performance under different Cas9 variants and cellular backgrounds. Results on some representative datasets are as follows: WT dataset: SCC 0.8666, PCC 0.8930; ESP dataset: SCC 0.8583, PCC 0.8528; HF dataset: SCC 0.8549, PCC 0.8707; Sniper dataset: SCC 0.9374, PCC 0.9609; SpCas9-NG dataset: SCC 0.8534, PCC 0.8763; HypaCas9 dataset: SCC 0.8942, PCC 0.9477.

[0043] Example 3 (Ablation Experiment)

[0044] To examine whether each processing step can be directly omitted, multi-scale local branches, bidirectional context branches, positional interaction modules, or selective state-space modules were removed from four representative datasets: WT, ESP, xCas, and HELA, while other training parameters, data partitioning, and evaluation procedures remained unchanged. The resulting SCCs are as follows. The complete method achieved the highest SCC on all four datasets. The most significant decrease occurred after removing multi-scale local branches, indicating that local base combinations in different receptive fields are important sources of information. A significant decrease also occurred after removing the selective state space module, suggesting that input-related state updates can further integrate preceding multi-level information. Removing bidirectional contextual branches or position-level interaction modules also reduced performance, proving that these are not redundant steps that can be directly replaced by higher-level splicing. These data collectively support the fact that the complete technology chain can improve the overall representational ability of sgRNA targeting activity prediction.

[0045] When using single-base substitution perturbations for auxiliary analysis at different positions, the average absolute importance of positions 12 to 23 is approximately twice that of positions 1 to 11, indicating that the model exhibits higher sensitivity to the PAM neighborhood. Position 20 shows the highest positive importance score for G across the WT, ESP, and HELA datasets. These results are only intended to illustrate the model's ability to learn stable position-base preferences and are not considered essential protective features of this invention.

[0046] Example 4 (System Example)

[0047] This embodiment illustrates the functional modules and their data transmission relationships corresponding to the method in Embodiment 1. Please refer to [link / reference]. Figure 5The sgRNA targeting activity prediction system includes a sequence acquisition and verification module, a dual-path sequence representation module, a multi-scale local feature extraction module, a bidirectional contextual feature extraction module, a cross-branch positional interaction module, a global fusion and state space input construction module, a selective state update module, and an activity regression and ranking module. Each functional module represents a functional unit established to implement the corresponding program flow, and can be executed by the same computing resource or by multiple computing resources capable of passing intermediate results.

[0048] The sequence acquisition and verification module receives the nucleotide sequences to be predicted corresponding to candidate sgRNAs, checks the characters, length, and PAM conditions, and generates sequence samples. For variable-length batches, it simultaneously generates sequence masks; samples that do not conform to the character rules are stopped from processing, and character anomaly information is returned. The dual-path sequence representation module generates two representations for the same sequence and records the boundary between the start marker and the original sequence position for subsequent modules to perform retention or removal operations. The multi-scale local feature extraction module and the bidirectional context feature extraction module are independent and can run in parallel; their outputs are jointly passed to the cross-branch position-level interaction module. The global fusion and state space input construction module removes the start marker output from the context position features, aligns the two-branch positions, maps the projections of the two-branch positions, and broadcasts the global fused representation to each position, forming a position-by-position input. The selective state update module processes the position-by-position input in the order of the original sequence positions and ensures that at least some state space parameters are adjusted by the current position input. The activity regression and ranking module only aggregates the position outputs not excluded by the sequence mask, generates continuous activity prediction values, and ranks multiple candidate sequences according to the prediction values.

[0049] The sgRNA targeting activity prediction model training system includes a training data acquisition and validation module, a model building module, a label scaling module, a parameter update module, and a validation selection and saving module. The training data acquisition and validation module records the assignment of training, validation, and test samples to prevent recalculation of scaling statistics based on validation or test labels. The label scaling module obtains scaling statistics from the training set labels and uses the same statistics for label processing across different datasets. The validation selection and saving module saves the current model parameters when validation metrics improve and stops training if no improvement is observed after a predetermined number of rounds. The model file also saves the label scaling statistics, enabling the prediction system to interpret the regression output according to the dimensional rules used during training.

[0050] While maintaining the core information flow of complementary bi-branch representation, pre-fusion positional interaction, and selective state space integration, the specific implementations can be replaced as follows: the first representation can adopt an equivalent category matrix, nucleotide attribute encoding, or k-mer local representation; the second representation can adopt other discrete indices, trainable embeddings, or pre-trained nucleotide embeddings; multi-scale local extraction can be adjusted to at least two other scales, or equivalent multi-receptive field operators such as dilated convolution and hierarchical convolution can be used, while the output still needs to retain positional features; bidirectional long short-term memory networks can be replaced with bidirectional gated recurrent units or other bidirectional encoding structures; scaled dot product cross attention can adopt multi-head cross attention, bilinear correlation mapping, or gated correlation aggregation; average convergence can be replaced with weighted convergence, maximum convergence, or masked convergence; global fusion can adopt post-concatenation mapping, gated fusion, or weighted combination after dimension consistency; selective state update can adopt other input-related state space structures; under other Cas proteins or PAM types, the input region can be redefined, and variable-length input combined with a mask can prevent the filling position from participating in interaction, state update, and convergence.

[0051] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit the scope of protection of the present invention. Equivalent substitutions, combinations, or modifications made by those skilled in the art to the described features without departing from the essence of the present invention should all fall within the scope of protection of the present invention.

Claims

1. A method for predicting sgRNA targeting activity based on cross-branch interaction and selective state-space modeling, characterized in that, Includes the following steps: S1: Obtain and verify the nucleotide sequence to be predicted corresponding to the candidate sgRNA. Form a first sequence representation and a second sequence representation from the same nucleotide sequence to be predicted. The first sequence representation is used for local pattern extraction, and the second sequence representation is used for context modeling. S2: Extract local features from the first sequence representation using at least two local receptive fields in parallel to obtain local position features and a local global representation that correspond one-to-one with the position of the nucleotide sequence to be predicted. Perform bidirectional sequence encoding on the second sequence representation to obtain context position features containing forward sequence environment information and reverse sequence environment information. The context position features correspond to each position of the nucleotide sequence to be predicted and are integrated to obtain a context global representation. S3: Based on the positional correlation between the local positional features and the contextual positional features, perform cross-branch positional information interaction to generate positional cross-branch interaction features that maintain a one-to-one correspondence with the position of the nucleotide sequence to be predicted, and perform positional aggregation on the positional cross-branch interaction features to obtain a global interaction representation; S4: Fuse the local global representation, the context global representation, and the global interaction representation to obtain a global fused representation; project the local position features and the context position features aligned with the position of the nucleotide sequence to be predicted, respectively, and broadcast the global fused representation to each sequence position; combine the local position projection, context position projection, and the broadcast global fused representation at each position into a position-by-position input; S5: Generate or adjust state space parameters according to the position-by-position input at each position, update the hidden state according to the position order of the nucleotide sequence to be predicted, and generate position outputs, wherein at least a portion of the state writing parameters, state retention parameters, state output parameters, and discrete step size changes with the position-by-position input at the current position to obtain a unified sequence representation that maintains the position correspondence; S6: Aggregate the position outputs at each position, generate sgRNA targeting activity prediction values ​​through regression mapping, and form a candidate sgRNA sort according to the sgRNA targeting activity prediction values ​​when there are multiple candidate sgRNAs.

2. The sgRNA targeting activity prediction method according to claim 1, characterized in that, The first sequence representation uses one-hot encoding to represent four classes of nucleotides: A, C, G, and T; the second sequence representation uses discrete indexing and trainable embedding, with a sequence start marker added before the discrete index sequence; the local features are extracted in parallel using one-dimensional local operators with at least two different receptive fields; the bidirectional sequence encoding uses a bidirectional long short-term memory network or a bidirectional gated recurrent unit; when aligning the context position features with the position of the nucleotide sequence to be predicted, the context position features corresponding to the sequence start marker are removed; When using the contextual location features for cross-branch location-level information interaction, the position corresponding to the sequence start marker is retained.

3. The sgRNA targeting activity prediction method according to claim 1, characterized in that, The query source is the local location feature, and the key and value source is the context location feature. The location-level cross-branch interaction feature is generated through scaled dot product cross attention: Q = H_loc W_Q, K = H_ctx W_K, V = H_ctx W_V; H_int = softmax(QK^T / √d)V; where H_loc is the local location feature, H_ctx is the context location feature, W_Q, W_K, and W_V are trainable linear mapping parameters, Q, K, and V are the query matrix, key matrix, and value matrix, respectively, d is the common feature dimension of the query and key, and H_int is the location-level cross-branch interaction feature. The global fusion representation satisfies: g_global = W_g[g_loc; g_ctx; g_int] + b_g, where g_loc, g_ctx, and g_int are the local global representation, the context global representation, and the global interaction representation, respectively, and W_g and b_g are the linear mapping parameter and the bias parameter, respectively.

4. The sgRNA targeting activity prediction method according to claim 2, characterized in that, The nucleotide sequence to be predicted includes a 20-nucleotide protospacer region and a 3-nucleotide adjacent protospacer motif, for a total of 23 positions; the trainable embedding has a dimension of 60; the local features are extracted through two layers of multi-scale one-dimensional convolution, each layer including three branches with kernel sizes of 3, 5, and 7 respectively. The first layer outputs 64 channels from each branch and concatenates them into 192 channels, and the second layer outputs 128 channels from each branch and concatenates them into 384-dimensional local position features, which are then mapped to a 320-dimensional local-global representation after position averaging and convergence; the bidirectional sequence encoding uses a two-layer bidirectional long short-term memory network, with a hidden dimension of 80 in each direction, concatenating them in both directions to form a 160-dimensional contextual position feature, which is then flattened and mapped to a 320-dimensional contextual-global representation.

5. The sgRNA targeting activity prediction method according to claim 3, characterized in that, The query matrix has 23 query positions, the key matrix and the value matrix each have 24 positions, and the common feature dimension is 128. During the training phase, the interaction weights are subjected to an inactivation rate of 0.

1. The 128-dimensional global interaction representation is obtained by concatenation, and the 320-dimensional local global representation, the 320-dimensional context global representation and the 128-dimensional global interaction representation are concatenated to form a 768-dimensional representation and mapped to a 192-dimensional global fusion representation.

6. The sgRNA targeting activity prediction method according to claim 1, characterized in that, The position-by-position input is constructed according to the following formula: x_t = P_loc,t + P_ctx,t + g_global, t = 1, ..., L; where L is the number of positions of the nucleotide sequence to be predicted, P_loc,t and P_ctx,t are the local position projection and context position projection of the t-th position, respectively, and g_global is the global fusion representation broadcast to L positions; the state update and position output are generated according to the following formula: h_t = Ā_t h_(t-1) + B̄_t x_t, z_t = C_t h_t + D x_t; where h_t is the hidden state at position t, z_t is the position output at position t, Ā_t and B̄_t are obtained from discrete state transition relations, and at least a part of B̄_t, C_t or discrete step size is related to x_t, and D is the direct transfer parameter; the predicted value of the sgRNA targeting activity satisfies: ŷ=W_o·Mean(z_1,z_2,…,z_L)+b_o; when the lengths of different nucleotide sequences to be predicted are different, a sequence mask is used to prevent the filling position from participating in the position-level cross-branch interaction, state update and position convergence.

7. A method for training an sgRNA targeting activity prediction model, characterized in that, include: The method involves acquiring multiple training samples, experimental activity tags corresponding to each training sample, and multiple validation samples. The training samples and validation samples each include nucleotide sequences corresponding to candidate sgRNAs. Missing or non-numerical experimental activity tags are identified before model input. An sgRNA targeting activity prediction model is constructed, configured to execute the sgRNA targeting activity prediction method according to any one of claims 1 to 6. Tag scaling statistics are determined solely based on the experimental activity tags of the training samples, and the tag scaling statistics are used to process the experimental activity tags of the training samples and the validation samples. The training samples are input into the sgRNA targeting activity prediction model, and the model parameters are updated based on the loss between the obtained sgRNA targeting activity prediction value and the processed experimental activity tag. The updated parameters are evaluated using the validation samples, and model parameters are selected based on the validation results. The selected model parameters and the tag scaling statistics are saved for loading and use in the prediction stage.

8. The training method for the sgRNA targeting activity prediction model according to claim 7, characterized in that, The label scaling statistics include the minimum and maximum values ​​of the experimental activity labels of the training samples, y_min and y_max, where y_max > y_min. The normalized experimental activity label of the i-th sample satisfies: y_i^norm = (y_i - y_min) / (y_max - y_min). The training method also includes test samples, which do not participate in model parameter updates and model parameter selection. Validation samples, test samples, and the prediction phase reuse y_min and y_max determined by the training samples. The loss... Mean squared error loss was used: L_MSE=(1 / N)Σ(y_i^norm-ŷ_i)^2, where N is the number of training samples involved in the loss calculation, y_i^norm is the normalized experimental activity label, and ŷ_i is the corresponding predicted sgRNA targeting activity value. The Adamax optimizer was used to update the model parameters, with an initial learning rate of 1×10^-4, a training batch size of 16, and a maximum number of training epochs of 200. Training was stopped and the model parameters with the best performance on the validation samples were saved when the validation metrics did not improve for 10 consecutive epochs.

9. An sgRNA targeting activity prediction system, characterized in that, include: The sequence acquisition and verification module is configured to acquire and verify the predicted nucleotide sequence corresponding to the candidate sgRNA. The dual-path sequence representation module is configured to form a first sequence representation and a second sequence representation from the same nucleotide sequence to be predicted; the multi-scale local feature extraction module is configured to extract local features from the first sequence representation in parallel using at least two local receptive fields to generate local position features and a local global representation; the bidirectional context feature extraction module is configured to perform bidirectional sequence encoding on the second sequence representation to generate context position features and a context global representation. The cross-branch positional interaction module is configured to perform cross-branch positional information interaction based on the positional correlation between the local positional features and the contextual positional features, generate positional cross-branch interaction features that maintain a one-to-one correspondence with the position of the nucleotide sequence to be predicted, and aggregate them into a global interaction representation. The global fusion and state space input construction module is configured to fuse the local global representation, the context global representation, and the global interaction representation to obtain a global fused representation, broadcast it to each sequence position, and combine it with the two branch position projections to form a position-by-position input; The selective state update module is configured to generate or adjust state space parameters based on position-by-position input, update hidden states in position order and generate position outputs, wherein at least a portion of the state write, retention, output parameters and discrete step size changes with the current position input. The activity regression and ranking module is configured to output the convergent position, and generates sgRNA targeting activity prediction values ​​and forms a candidate sgRNA ranking through regression mapping.

10. A training system for an sgRNA targeting activity prediction model, characterized in that, include: The training data acquisition and verification module is configured to acquire training samples, experimental activity labels and verification samples, and identify missing or non-numerical experimental activity labels. The model building module is configured to build an sgRNA targeting activity prediction model configured to perform the method of any one of claims 1 to 6; the label scaling module is configured to determine the label scaling statistics based solely on the experimental activity labels of the training samples and to process the labels of the training and validation samples. The parameter update module is configured to update the model parameters based on the loss between the predicted value and the processed experimental activity label; the validation selection and saving module is configured to evaluate the updated parameters using validation samples, select model parameters based on the validation results, and jointly save the selected model parameters and the label scaling statistics.