Gene variation detection method, device, equipment, medium and program product
By encoding and extracting the alignment features and contour features in the gene sequencing data, the problem of poor gene variant detection performance in the prior art is solved, and more accurate and efficient gene variant detection is achieved.
Patent Information
- Application Number
- CN202411490884.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-23
- Publication Date
- 2025-02-07
AI Technical Summary
The prior art cannot fully utilize the multi-sequence alignment data of gene sequencing in gene variant detection, resulting in poor detection performance.
By obtaining individual multi-sequence alignment data, encoding the alignment features and contour features, extracting the multi-sequence alignment features corresponding to these features, and mapping them to obtain the gene variant detection results.
Make full use of different information dimensions of multi-sequence comparison data to improve the accuracy of gene variant detection results, reduce the amount of redundant information and invalid regions, and improve data processing efficiency.
Smart Images

Figure CN119400243A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence, and in particular to a gene variation detection method, device, equipment, medium and program product. Background Art
[0002] Gene mutation detection plays an important role in early disease detection, such as early cancer diagnosis and screening. Gene sequencing refers to the use of sequencing equipment to determine the order of bases in deoxyribonucleic acid (DNA) or ribonucleic acid (RNA) extracted from individual samples. The bases include five types: adenine (A), guanine (G), cytosine (C), thymine (T), and uracil (U).
[0003] In the related art, the multiple sequence alignment (MSA) data of gene sequencing is converted into an image, and the image is input into an image recognition model, such as a residual network (ResNet) and a convolutional network (InceptionNet), to realize gene variation detection.
[0004] However, this type of image recognition model cannot fully utilize the MSA data of gene sequencing, resulting in poor performance in gene variation detection. Summary of the invention
[0005] The present application provides a method, device, equipment, medium and program product for detecting gene mutation. The technical solution is as follows:
[0006] In one aspect, a method for detecting gene variation is provided, the method comprising:
[0007] Acquire MSA data of an individual, wherein the MSA data includes base information and sequencing information of a candidate site in a gene site;
[0008] Encoding comparison features of the MSA data, and encoding profile features of the MSA data, wherein the comparison features are used to characterize the base information and the sequencing information, and the profile features are used to characterize statistical information corresponding to the base information and the sequencing information;
[0009] Extracting MSA features corresponding to the comparison features and the contour features;
[0010] The MSA features are mapped to obtain gene variation detection results of the MSA data relative to a reference gene sequence.
[0011] In some embodiments, extracting the first sample MSA feature corresponding to the sample comparison feature and the sample profile feature based on the base model layer includes:
[0012] Splicing the sample comparison feature and the sample contour feature to obtain a sample splicing feature;
[0013] Based on the basic model layer, self-attention calculation is performed on the sample splicing feature to obtain the first sample MSA feature.
[0014] In some embodiments, performing self-attention calculation on the sample splicing feature based on the basic model layer to obtain the first sample MSA feature includes:
[0015] Based on the basic model layer, performing column attention calculation on the sample splicing features to obtain sample column attention features;
[0016] Performing pooling on the sample column attention features in the column direction to obtain sample column pooling features;
[0017] Perform row attention calculation on the sample column pooling features to obtain the first sample MSA features.
[0018] In some embodiments, obtaining the first sample MSA data of the first sample individual includes:
[0019] Sampling is performed on sequencing data of the first sample individual with the sample variation site and sequencing data without the sample variation site to obtain the first sample sequencing data;
[0020] Aligning the first sample sequencing data with the reference gene sequence to obtain first sample alignment data;
[0021] Based on the first sample alignment data and the sample variation sites, the first sample MSA data is obtained.
[0022] In some embodiments, the first sample MSA data includes: first sample sequence MSA data and first sample insertion MSA data of the sample variation site, the first sample sequence MSA data is used to characterize the base change of the sample variation site, and the first sample insertion MSA data is used to characterize the base insertion at the sample variation site;
[0023] The obtaining the first sample MSA data based on the first sample alignment data and the sample variation site includes:
[0024] Taking each sample variation site of the sample variation sites as the center of a window, extracting a sample gene sequence in the window in the first sample alignment data, wherein each sample sequencing fragment in the sample gene sequence corresponds to at least one of base insertion information, base deletion information and base change information;
[0025] Determine the first sample sequence MSA data of each sample variation site based on the base deletion information and the base change information corresponding to each sample sequencing fragment in the sample gene sequence; determine the first sample insertion MSA data of each sample variation site based on the base insertion information corresponding to each sample sequencing fragment in the sample gene sequence;
[0026] The first sample sequence MSA data corresponding to each sample variation site of the sample variation site and the first sample insertion MSA data are combined to obtain the first sample MSA data.
[0027] In some embodiments, the method further comprises:
[0028] Acquire second sample MSA data of a second sample individual, wherein the second sample MSA data includes sample base information and sample sequencing information of the sample candidate site;
[0029] Based on the third coding layer, encode the sample coding feature of the second sample MSA data;
[0030] Based on the feature extraction unit, perform self-attention calculation on the sample coding feature to obtain a second sample MSA feature corresponding to the sample coding feature;
[0031] Based on the second conversion layer, convert the second sample MSA feature to obtain second predicted MSA data, where the second predicted MSA data includes predicted base information of the sample candidate site;
[0032] The model parameters of the basic model are adjusted with the training goal of reducing the difference between the predicted base information in the second predicted MSA data and the sample base information in the second sample MSA data.
[0033] In some embodiments, performing self-attention calculation on the sample coding feature based on the feature extraction unit to obtain a second sample MSA feature corresponding to the sample coding feature includes:
[0034] Based on the feature extraction unit, performing column attention calculation on the sample encoding feature to obtain a sample column attention feature;
[0035] Performing pooling on the sample column attention features in the column direction to obtain sample column pooling features;
[0036] Perform row attention calculation on the sample column pooling features to obtain the second sample MSA features.
[0037] In some embodiments, converting the second sample MSA feature based on the second conversion layer to obtain second predicted MSA data includes:
[0038] Performing random masking on at least a portion of the mask area in the second sample MSA feature to obtain a sample MSA mask feature, wherein the at least a portion of the mask area includes at least a portion of the columns and at least a portion of the single characters in the second sample MSA feature;
[0039] Based on the second conversion layer, the predicted base type in the at least a portion of the mask region of the sample MSA mask feature is predicted to obtain the second predicted MSA data.
[0040] In some embodiments, obtaining the second sample MSA data of the second sample individuals includes:
[0041] Acquire the second sample sequencing data of the second sample individual;
[0042] Aligning the second sample sequencing data with the reference gene sequence to obtain second sample alignment data;
[0043] Determining the sample candidate sites that meet the screening condition in the second sample alignment data;
[0044] Based on the second sample alignment data and the sample candidate sites, the second sample MSA data is determined.
[0045] In some embodiments, the sample candidate sites that meet the screening conditions include at least one of the following:
[0046] A sample gene locus that is not identical to the reference gene sequence;
[0047] Compare sample gene loci whose quality values are greater than or equal to the first threshold;
[0048] Sample gene loci with coverage greater than or equal to the second threshold;
[0049] The sample gene loci whose minor allele frequency is greater than or equal to the third threshold.
[0050] In some embodiments, the second sample MSA data includes: second sample sequence MSA data and second sample insertion MSA data of the sample candidate site, the second sample sequence MSA data is used to characterize the base change of the sample candidate site, and the second sample insertion MSA data is used to characterize the base insertion of the sample candidate site;
[0051] The determining the second sample MSA data based on the second sample alignment data and the sample candidate sites includes:
[0052] Taking each sample candidate site of the sample candidate sites as the center of a window, extracting a sample gene sequence in the window in the second sample alignment data, wherein each sample sequencing fragment in the sample gene sequence corresponds to at least one of base insertion information, base deletion information and base change information;
[0053] Determine the second sample sequence MSA data of each sample candidate site based on the base deletion information and the base change information corresponding to each sample sequencing fragment in the sample gene sequence, and determine the second sample insertion MSA data of each sample candidate site based on the base insertion information corresponding to each sample sequencing fragment in the sample gene sequence;
[0054] The second sample sequence MSA data and the second sample insertion MSA data corresponding to each sample candidate site of the sample candidate site are combined to obtain the second sample MSA data.
[0055] In some embodiments, the third coding layer of the base model includes: a first sub-coding layer and a second sub-coding layer connected in parallel;
[0056] Among them, the model parameters of the first coding layer of the gene variation detection model are the same as the model parameters of the first sub-coding layer in the third coding layer of the pre-trained basic model.
[0057] In some embodiments, the sample coding feature of the second sample MSA data includes: a first sub-sample coding feature and a second sub-sample coding feature;
[0058] The encoding of the sample encoding feature of the second sample MSA data based on the third encoding layer includes:
[0059] encoding the first sub-sample coding feature of the second sample MSA data based on the first sub-coding layer in the third coding layer;
[0060] Obtaining sample position data corresponding to the sample candidate site in the second sample MSA data;
[0061] encoding a second sub-sample coding feature of the sample position data based on the second sub-coding layer in the third coding layer;
[0062] The first sub-sample coding feature and the second sub-sample coding feature are concatenated to obtain the sample coding feature.
[0063] In another aspect, a gene variation detection device is provided, the device comprising:
[0064] An acquisition module, used to acquire MSA data of an individual, wherein the MSA data includes base information and sequencing information of candidate sites in a gene site;
[0065] An encoding module, used to encode comparison features of the MSA data and to encode profile features of the MSA data, wherein the comparison features are used to characterize the base information and the sequencing information, and the profile features are used to characterize statistical information corresponding to the base information and the sequencing information;
[0066] An extraction module, used for extracting MSA features corresponding to the comparison features and the contour features;
[0067] A mapping module is used to map the MSA features to obtain a gene variation detection result of the MSA data relative to a reference gene sequence.
[0068] On the other hand, a computer device is provided, comprising: a processor and a memory, wherein the memory stores a computer program, and the computer program is loaded and executed by the processor to implement the gene variation detection method as described above.
[0069] On the other hand, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and the computer program is loaded and executed by a processor to implement the gene variation detection method as described above.
[0070] On the other hand, a computer program product is provided, which includes computer instructions, the computer instructions are stored in a computer-readable storage medium, and a processor obtains the computer instructions from the computer-readable storage medium, so that the processor loads and executes to implement the gene variation detection method as described above.
[0071] The beneficial effects brought by the technical solution provided by the embodiment of the present application include at least:
[0072] The MSA feature is obtained based on the alignment feature and the profile feature. The alignment feature is used to characterize the base information and sequencing information, that is, the feature of the MSA shape. The profile feature is used to characterize the statistical information corresponding to the base information and sequencing information, that is, the feature of the sequence shape. Therefore, the MSA feature can characterize the MSA data of an individual from different information dimensions of base information, sequencing information, and statistical information. By mapping the MSA feature, the gene variation detection result of the MSA data relative to the reference gene sequence can be obtained, which can make full use of the information of different information dimensions of the MSA data and improve the accuracy of the gene variation detection result. In addition, the MSA data contains the relevant information of the candidate sites in the gene loci, which can reduce redundant information, reduce the amount of calculation of invalid areas, and improve data processing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0073] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0074] Figure 1 is a schematic diagram of sequencing MSA data provided by an exemplary embodiment of the present application;
[0075] Figure 2 is a schematic diagram of the structure of a computer system provided by an exemplary embodiment of the present application;
[0076] Figure 3 is a schematic diagram of a gene variation detection method provided by an exemplary embodiment of the present application;
[0077] Figure 4 is a schematic diagram of the structure of a gene variation detection model provided by an exemplary embodiment of the present application;
[0078] Figure 5 is a structural schematic diagram of a basic model provided by an exemplary embodiment of the present application;
[0079] Figure 6 is a flow chart of a gene variation detection method provided by an exemplary embodiment of the present application;
[0080] Figure 7 is a schematic diagram of sequence MSA data provided by an exemplary embodiment of the present application;
[0081] Figure 8 is a schematic diagram of inserting MSA data provided by an exemplary embodiment of the present application;
[0082] Fig. 9 is an application schematic diagram of a gene variation detection model provided by an exemplary embodiment of the present application;
[0083] Fig.10 is a flow chart of gene variation detection provided by an exemplary embodiment of the present application;
[0084] Fig.11 is a flow chart of early cancer screening provided by an exemplary embodiment of the present application;
[0085] Fig.12 is a comparative schematic diagram of model performance provided by an exemplary embodiment of the present application;
[0086] Fig.13is a block diagram of a gene variation detection device provided by an exemplary embodiment of the present application;
[0087] Fig.14 It is a structural block diagram of a computer device provided by an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0088] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0089] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0090] The terms used in this application are for the purpose of describing specific embodiments only and are not intended to limit this application. The singular forms of "a", "said" and "the" used in this application and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.
[0091] It should be understood that, although the terms first, second, etc. may be used in the present application to describe various information, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present application, the first parameter may also be referred to as the second parameter, and similarly, the second parameter may also be referred to as the first parameter. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0092] It should be noted that, before collecting relevant data of the user (for example, data related to the individual's genes) and during the process of collecting relevant data of the user, the present application can display a prompt interface, a pop-up window or output a voice prompt information, and the prompt interface, pop-up window or voice prompt information is used to prompt the user that the relevant data is currently being collected, so that the present application only starts to execute the relevant steps of obtaining the relevant data of the user after obtaining the confirmation operation issued by the user to the prompt interface or pop-up window, otherwise (that is, when the confirmation operation issued by the user to the prompt interface or pop-up window is not obtained), the relevant steps of obtaining the relevant data of the user are terminated, that is, the relevant data of the user is not obtained. In other words, all user data collected by the present application are collected with the consent and authorization of the user, and the collection, use and processing of relevant user data need to comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0093] First, the terms involved in the embodiments of the present application are briefly introduced.
[0094] Gene: A fragment of deoxyribonucleic acid (DNA) or ribonucleic acid (RNA) that carries genetic information. It is the basic unit of inheritance of organisms and the basis of their growth, development, reproduction and other life activities. The functions of genes include storing and transmitting genetic information and replicating cells. Genes are located on the chromosomes of cells and are arranged in a linear pattern.
[0095] Base: It is the basic unit for synthesizing nucleosides, nucleotides and nucleic acids. There are 5 types of bases: Adenine (A), Guanine (G), Cytosine (C), Thymine (T) and Uracil (U). Bases are composed of carbon, oxygen, hydrogen, nitrogen and other elements. A gene locus usually involves two bases. A gene locus is a specific position occupied by a gene on a chromosome. The mutation / variation of a gene locus usually involves the change of two bases.
[0096] Gene sequence: It is the order of the bases that make up the gene, which can also be called a base sequence. A gene sequence is represented by a string of characters, which include letters and symbols. The letters are A, G, C, T, and U corresponding to different types of bases, and the symbols include "-" and / or ".".
[0097] Reference gene sequence: It is a standard version of an individual's gene sequence, which is integrated based on gene sequencing and analysis of multiple individuals. Optionally, by comparing the gene sequence of an individual with the reference gene sequence, it is possible to identify whether there is a genetic variation in the gene sequence of the individual. Generally, an individual refers to a human individual. The reference gene sequence is obtained from a public data set, and the human genome HG38 reference sequence can be used, and it is truncated to a preset length, which can be 1024BP. BP stands for base pair, which is a commonly used unit of length in biology and is used to indicate the length of a gene sequence.
[0098] Gene sequencing: also referred to as sequencing, is a new type of gene detection technology that can determine the gene sequence of an individual from an individual's sample (blood or saliva), that is, determine the order of the bases of deoxyribonucleic acid (DNA) or ribonucleic acid (RNA) on the chromosome extracted from the individual's sample. Chromosomes include 23 pairs, 22 pairs of autosomes and 1 pair of sex chromosomes. Gene sequencing is achieved using sequencing equipment, which can be: sequencer. Sequencing methods can be: chain termination sequencing, high-throughput sequencing.
[0099] Multiple Sequence Alignment (MSA) data: MSA data for short, also known as sequencing MSA data, is obtained by aligning the original sequencing data of an individual with the reference gene sequence. MSA data is obtained based on alignment software. It can make the sequencing data involved in the alignment have as many columns with the reference gene sequence as possible with the same characters, so as to find the similar parts between different gene sequences, and thus infer the similarity between the two.
[0100] In some embodiments, sequencing MSA data is represented by a two-dimensional array. Rows represent gene sequences, each row corresponds to a gene sequence, columns represent gene loci, and each column contains nucleotide information of all gene sequences at the same gene locus. Sequencing MSA data can also capture small insertions, deletions, and point mutations, and deletions are generally represented by the symbol "-".
[0101] For example, refer to Figure 1, each row of sequencing MSA data corresponds to a gene sequence. Taking the first row as an example, the corresponding gene sequence is "GGAAAAGGTG...". During gene sequencing, due to the limitation of sequencing level, the genome needs to be broken into small fragments for sequencing. Sequencing fragments (reads) are shorter gene sequence fragments read by a sequencing device in a single sequencing. A gene sequence includes multiple sequencing fragments. Each column represents the nucleotide information of all gene sequences at the same gene locus. Taking the first column as an example, the base corresponding to all gene sequences at this gene locus is "G". The symbol "-" in the sequencing MSA data indicates that the base at the gene locus is missing, or is understood to be deleted. The symbol "." indicates an interval, or is understood to mean that a long gene sequence is interrupted, or the base at the gene locus is not copied.
[0102] In some embodiments, the steps for generating individual MSA data include: base calling, sequence quality control, sequence alignment, and post-processing. Base calling is used to convert the sequencing signal generated by the sequencing device into an analyzable gene sequence, that is, to obtain sequencing data. Among them, the accuracy of base calling is affected by many factors, such as signal noise, similarity of base chemical structure, sequencing depth, etc. Sequence quality control is used to filter, prune and evaluate the original sequencing data generated by sequencing. For example, remove low-quality sequences, discard sequences that do not meet the requirements, etc., to ensure the quality of sequencing data. The sequencing data obtained by base calling and sequence quality control can be a Fastq file. Sequence alignment is used to align the sequencing data obtained by sequencing with the reference gene sequence, or to understand it as aligning the sequencing data with the reference gene sequence. Optionally, alignment software is used to align the sequencing data with the reference gene sequence to obtain an alignment result, that is, to obtain alignment data, and the alignment data can be a BAM file. Post-processing is an optional step for de-duplication, phasing, mining and visual display of alignment data. After obtaining the alignment data, MSA data can be further obtained based on the candidate sites screened from each gene site.
[0103] Minor Allele Frequency (MAF): It is the frequency of the second highest allele at a gene locus. For example, there are three types of bases at a gene locus of an individual: A, C, and G. Among them, the frequency of base A is 0.6, the frequency of base C is 0.3, and the frequency of base G is 0.1. Then the minor allele frequency refers to the frequency of base C, which is 0.3.
[0104] Coverage: refers to the proportion of gene sequences obtained by sequencing to the entire genome, which is determined based on the number of sequencing fragments (reads) obtained by sequencing the current gene loci. Due to the complex structure of the genome, the gene sequences obtained by the final assembly of sequencing often cannot cover all areas. This part of the uncovered (unmeasured) area is called a GAP. For example, if the coverage of an individual's gene sequencing is 98%, there are still 2% of the areas that have not been obtained through sequencing.
[0105] Mapping Quality: It is used to indicate the reliability of each base obtained by sequencing. The larger the mapping quality value, the better the sequencing quality. The mapping quality value is provided by the mapping software.
[0106] Base Quality: It is used to indicate the quality score of base calling and characterizes the sequencing error rate of bases. The base quality is provided by the sequencing equipment, which can be a sequencer.
[0107] Sense Strand, Antisense Strand: used to characterize the directionality of genes on chromosomes, that is, the positive or negative arrangement of gene sequences on DNA chains. Taking DNA as an example, the positive and negative strands of genes are two complementary strands of DNA. The base sequence of the positive strand is the template directly involved in protein synthesis, and the base sequence of the negative strand is complementary to the positive strand and serves as an antisense template in the process of protein synthesis. The positive and negative strand information is provided by the alignment software.
[0108] Candidate sites: are some gene sites in the individual's gene sites that meet the screening conditions, which can also be understood as suspicious sites, which are gene sites that may have mutations. When detecting gene mutations, the individual's MSA data input into the gene mutation detection model only contains the base information and sequencing information of the candidate sites in the gene sites, which can reduce the amount of calculation of invalid areas.
[0109] After aligning the original sequencing data of an individual with the reference gene sequence, alignment data is obtained, and the alignment data contains the base information and sequencing information corresponding to each gene locus. These alignment data can be simply divided into: unmutated region, noise region, and mutated region. For the unmutated region, this part of the gene sequence is exactly the same as the reference gene sequence, and its base information and sequencing information are redundant. For the noise region, there is a small amount of base change in this part of the gene sequence, which is caused by the sequencing system error and the comparison error, and its comparison quality value is usually relatively low. In the embodiment of the present application, the candidate site includes at least one of the following: a gene site that is different from the reference gene sequence; a gene site whose comparison quality value is greater than or equal to the first threshold; a gene site whose coverage is greater than or equal to the second threshold; a gene site whose minor allele frequency is greater than or equal to the third threshold.
[0110] Gene variant detection model: also known as MSA variant caller or germline MSA variant caller, is a model for performing a gene variant detection method provided in an embodiment of the present application. In the process of gene variant identification, the gene sequence of an individual sequence is compared with the reference gene sequence, which is called germline variant calling.
[0111] In some embodiments, in the application stage of the gene variation detection model, the input data of the gene variation detection model is the MSA data obtained after sequencing and comparison of the individual, and the output result is the genotype (Genotype), base change (Base Change), and insertion base type (Insertion) of the candidate site. Optionally, the genotype includes: 0 / 0 no mutation, 0 / 1 heterozygous mutation, 1 / 1 homozygous mutation, and 1 / 2 compound mutation. The 1 / 2 compound mutation is a single base substitution mutation (Single Nucleotide Polymorphism, SNP) and a base insertion or deletion mutation (Insertion and Deletion Variant, INDEL) occurring simultaneously. The base change refers to when the candidate site is: 0 / 0 no mutation, then the base of the reference gene sequence corresponding to the candidate site is output, and when the candidate site is: 0 / 1 heterozygous mutation, 1 / 1 homozygous mutation, 1 / 2 compound mutation, then the base after the change of the candidate site is output. The insertion base type refers to the base type of the base inserted in the candidate site when there is an insertion variation in the candidate site.
[0112] Basic model: also known as the MSA basic model, is a pre-trained model provided in an embodiment of the present application, which is used to extract MSA features. A part of the model structure and model parameters of the pre-trained basic model can also be used as a part of the model structure in the gene variation detection model, and its model parameters are retained. In some embodiments, the basic model is determined based on a unified sequence model (Unified Sequence Model, USM). The USM model is a language model that is both a conventional single sequence model and an MSA model. In other embodiments, the basic model can also be an MSA Transformer model implemented based on a Transformer structure, or other models for extracting MSA features, or other large language models, universal language models.
[0113] Figure 2 1 is a schematic diagram of a computer system provided by an exemplary embodiment of the present application. The computer system 100 can be implemented as a system architecture of a gene variation detection method. The computer system 100 includes: a terminal 120 and a server 140.
[0114] The terminal 120 can be an electronic device such as a mobile phone, a tablet computer, a vehicle terminal (vehicle computer), a wearable device, a PC (Personal Computer), an unmanned reservation terminal, etc. A client that runs the target application can be installed in the terminal 120. Optionally, the target application is a program dedicated to gene sequencing and / or gene analysis, or a program that provides gene sequencing and / or gene analysis functions, or a program that provides gene mutation detection functions, or a program that provides training functions in the training phase of a gene mutation detection model, or a program that provides application functions in the application phase of a gene mutation detection model. This application is not limited to this. The embodiment of the present application does not limit the form of the target application, including but not limited to App (Application, application), applets, etc. installed in the terminal 120, and can also be in the form of a web page. Optionally, the terminal 120 stores a gene mutation detection model for identifying gene mutations.
[0115] Server 140 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud computing services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), and cloud servers for basic cloud computing services such as big data and artificial intelligence platforms. Server 140 can be the background server of the above-mentioned target application, used to provide background services for the client of the target application. In some optional embodiments, server 140 can also be implemented as a node in a blockchain system. Optionally, server 140 stores a gene mutation detection model for identifying gene mutations.
[0116] The terminal 120 and the server 140 may communicate with each other via a network, such as a wired or wireless network.
[0117] In the gene variation detection method provided in the embodiment of the present application, the execution subject of each step may be a computer device, which refers to an electronic device with data calculation, processing and storage capabilities. Figure 1 Taking the implementation environment of the scheme shown as an example, the genetic variation detection method can be executed by the terminal 120, for example, the client of the target application installed and running in the terminal 120 executes the genetic variation detection method, or the genetic variation detection method can be executed by the server 140, or the terminal 120 and the server 140 can cooperate with each other to execute, for example, the client of the target application installed and running in the terminal 120 executes the application stage of the genetic variation detection model in the genetic variation detection method, and the server 140 executes the training stage of the genetic variation detection model in the genetic variation detection method. This application is not limited to this.
[0118] Those skilled in the art will appreciate that the number of the above-mentioned terminals 120 may be more or less. For example, the above-mentioned terminal 120 may be only one, or may be dozens or hundreds, or more. The embodiment of the present application does not limit the number and device type of the terminal 120.
[0119] In the process of individual gene sequencing, multiple gene sequences obtained by sequencing are compared with reference gene sequences to obtain multiple sequence alignment (MSA) data, such as Figure 1As shown. MSA data reveals the difference between an individual's gene sequence and the reference gene sequence, which is called structural variation (Structure Variant), which can be further divided into complex structural variation and simple structural variation. Simple structural variation includes: single nucleotide mutation (Single Nucleotide Polymorphism, SNP), also known as single base substitution mutation, insertion or deletion mutation (Insertion and Deletion Variant, INDEL), also known as base insertion or deletion mutation. In the process of gene variation identification, if the individual sequencing sequence and the reference gene sequence are compared, it is called germline variant calling. Gene variation identification is an important part of the diagnosis of gene-related diseases, and its identification accuracy plays an important role in early disease detection, such as early cancer diagnosis and cancer screening. With the popularization of sequencing technology, identifying gene variations at the gene sequence level and exploring the correlation between variations and diseases will greatly improve the level of precision medicine.
[0120] The gene variation detection methods in the related art are divided into two parts: 1. Machine learning methods, such as the variation detection methods in the software (Genome Analysis Toolkit, GATK) for processing high-throughput sequencing data, and the use of hidden Markov chains to identify variations. 2. Deep learning methods, such as the variation identification model (DeepVariant) and variation detection model (Clair3) based on deep learning, convert the sequenced MSA data into images or one-dimensional counting sequences, and use image recognition models, such as residual networks (ResNet), convolutional networks (InceptionNet), recurrent neural networks (RNN), and Transformer classification models to identify gene variations.
[0121] The characteristics of MSA data are: large data volume and high redundancy, which leads to the following shortcomings in related technologies: 1. The machine learning method has low operating efficiency and is difficult to configure. The performance of this method varies greatly for different sequencing platforms and different sequencing technologies. 2. The deep learning method cannot fully utilize the massive MSA data and has poor performance. If the MSA data is converted into an image or a one-dimensional counting sequence, the original sequencing information is lost. This method is also unable to perform unsupervised pre-training of the model on massive MSA data. As a result, the performance of gene variation detection is poor.
[0122] This embodiment provides a gene variation detection model, which can be applied to gene variation detection, not limited to variation detection of DNA and RNA sequencing, and has the following technical key points: 1. Sequencing data is converted into MSA data, and MSA data includes insertion MSA data and sequence MSA data. Based on pre-training of the basic model and fine-tuning training of the gene variation detection model, the gene variation detection performance is improved; 2. Comparison features and profile features are encoded simultaneously to improve the gene variation detection performance; 3. The gene variation detection model is a multi-task model that can identify genotypes, base changes, and insertion base types, and has powerful functions.
[0123] Figure 3 is a schematic diagram of a gene variation detection method provided by an exemplary embodiment of the present application. The method is executed by a computer device, which may be Figure 2 The terminal 120 and / or server 140 shown. Exemplarily, the computer device stores a gene variation detection model, which is used to execute to implement the gene variation detection method. In the application stage, the steps of the method are briefly described as follows:
[0124] refer to Figure 3 , the computer device obtains the MSA data 10 of the individual, the MSA data 10 includes the base information and sequencing information of the candidate sites in the gene site; next, the MSA data 10 is input into the gene variation detection model to perform the subsequent encoding, extraction and mapping steps. Specifically, the alignment feature 21 of the MSA data 10 is encoded, and the profile feature 22 of the MSA data 10 is encoded, the alignment feature 21 is used to characterize the base information and sequencing information, and the profile feature 22 is used to characterize the statistical information corresponding to the base information and sequencing information; the MSA feature 30 corresponding to the alignment feature 21 and the profile feature 22 is extracted; the MSA feature 30 is mapped to obtain the gene variation detection result 40 of the MSA data 10 relative to the reference gene sequence.
[0125] See below for detailed examples.
[0126] Part 1: Model Structure
[0127] (1) Model structure of gene mutation detection model
[0128] Figure 4 1 is a schematic diagram of a gene variation detection model provided by an exemplary embodiment of the present application. The gene variation detection model is used to perform the encoding, extraction and mapping steps in the gene variation detection method.
[0129] In some embodiments, a gene variation detection model for performing a gene variation detection method includes: a first encoding layer (MSA Embedding), a second encoding layer (Sequence Embedding), a base model layer (USM Core), and a prediction layer; the first encoding layer is connected in parallel with the second encoding layer, the first encoding layer and the second encoder are cascaded with the base model layer respectively, and the base model layer is cascaded with the prediction layer;
[0130] Among them, the first encoding layer is used to encode the alignment feature (Alignment Feature) of MSA data; the second encoding layer is used to encode the profile feature (Profile Feature) of MSA data; the basic model layer is used to extract the MSA features corresponding to the alignment feature and the profile feature; the prediction layer is used to convert the MSA features to obtain the gene variation detection results of the MSA data relative to the reference gene sequence.
[0131] In some embodiments, the prediction layer includes: a first conversion layer (Variant Layer), a classifier (Classifier), and the first conversion layer is cascaded with the classifier;
[0132] Among them, the first conversion layer is used to convert MSA features to obtain MSA conversion features; the classifier is used to perform prediction based on the MSA conversion features to obtain the gene variation detection results of the MSA data relative to the reference gene sequence.
[0133] In some embodiments, the classifier includes: a first classifier (Genotype Classifier), a second classifier (Insertion Classifier), and a third classifier (Base Change Classifier) connected in parallel, and a first transformation layer (Variant Layer) is cascaded with the first classifier, the second classifier, and the third classifier respectively;
[0134] Among them, the first classifier is used to predict the genotype (Genotype) of the candidate site, the second classifier is used to predict the insertion base type (Insertion) of the candidate site, and the third classifier is used to predict the base change (BaseChange) of the candidate site.
[0135] In some embodiments, reference Fig. 9The prediction layer of the gene variation detection model further includes: a second conversion layer (LMHead), the second conversion layer is connected in parallel with the first conversion layer, and the second conversion layer is used to predict the base type in at least a part of the mask region of the MSA feature of the first sample to obtain the predicted base type. It should be noted that the second conversion layer is used to maintain the self-supervised learning capability of the gene variation detection model. In the training stage and / or application stage, the pre-trained second conversion layer is retained for mask learning.
[0136] In some embodiments, the basic model layer in the gene variation detection model includes: a feature extraction unit (USM Block) stacked in the pre-trained basic model. The basic model is a unified sequence model (USM) for extracting MSA features.
[0137] In a possible implementation, in the gene variation detection model, the first coding layer (MSA Embedding) and the second coding layer (Sequence Embedding) are each implemented based on at least one linear transformation (Linear) layer. In a specific example, each is a Linear layer. The base model layer (USM Core) is implemented based on N stacked feature extraction units (USMBlock), where N is greater than or equal to 1. The structure and calculation method of each feature extraction unit remain consistent, which will be described below. The first conversion layer (Variant Layer) is implemented based on at least one Linear layer. In a specific example, it can be a Linear layer. The first classifier (Genotype Classifier), the second classifier (Insertion Classifier) and the third classifier (Base Change Classifier) are each implemented based on at least one multilayer perceptron (MultilayerPerceptron, MLP) layer. In a specific example, each is an MLP layer, and an MLP layer consists of two Linear layers and an activation function ReLU.
[0138] In this embodiment, the gene variation detection model can encode the comparison features and the profile features at the same time, so that the information of the MSA data in different information dimensions can be learned in the training phase, and the gene variation detection performance can be improved in the application phase, thereby improving the accuracy of the gene variation detection results.
[0139] (2) Model structure of the basic model
[0140] Figure 51 is a schematic diagram of a basic model provided by an exemplary embodiment of the present application. The basic model is a unified sequence model (USM) for extracting MSA features.
[0141] In some embodiments, the basic model includes: a third coding layer (Embedding), a stacked feature extraction unit (USM Block), and a second conversion layer (LM Head), the third coding layer is cascaded with the feature extraction unit, and the feature extraction unit is cascaded with the second conversion layer. The number of stacked feature extraction units is N, N is greater than or equal to 1, and the structure and calculation operation of each feature extraction unit in the N feature extraction units are consistent.
[0142] In some embodiments, when the input data of the base model is the second sample MSA data and the sample position data (Gene Position) corresponding to the sample candidate site in the second sample MSA data, the third encoding layer of the base model includes: a first sub-encoding layer (MSA Embedding) and a second sub-encoding layer (Geno Position Embedding) connected in parallel;
[0143] Among them, the model parameters of the first encoding layer (MSA Embedding) of the gene variation detection model are the same as the model parameters of the first sub-encoding layer (MSA Embedding) in the third encoding layer of the pre-trained basic model. The third encoding layer is used to encode the sample encoding features of the second sample MSA data; the sample encoding features are obtained by concatenating the first sub-sample encoding features and the second sub-sample encoding features, and the first sub-encoding layer is used to encode the first sub-sample encoding features of the second sample MSA data; the second sub-encoding layer is used to encode the second sub-sample encoding features of the sample position data corresponding to the sample candidate site in the second sample MSA data.
[0144] In some embodiments, the calculation operations in each feature extraction unit (USM Block) include: root mean square error normalization (RMSNorm), column attention, addition, column pooling, multi-head self-attention, and activation operations performed using an activation function (SwiGLU). The calculation operations in column attention include: transposition operations performed using a transposition function (Transpose), multi-head self-attention (Multi-Head Attention). The calculation operations in multi-head self-attention (Multi-Head Attention) include: linear transformation (Linear), query (Query, Q) matrix, key (Key, K) matrix, value (Value, V) matrix, rotation position encoding (RoPE), multiplication, and normalized exponential operations performed using an activation function (Softmax). The calculation operations in the activation operation performed using an activation function (SwiGLU) include: linear transformation (Linear), activation operations performed using an activation function (SiLU), and dot products.
[0145] For example, in a feature extraction unit (USM Block), for a coding feature, root mean square error normalization and column attention calculation are performed in sequence, and the coding feature and the result after the column attention calculation are added to obtain a first processing feature; the first processing feature is sequentially subjected to column pooling, root mean square error normalization and multi-head self-attention calculation, and the first processing feature and the result after the multi-head self-attention calculation are added to obtain a second processing feature; the second processing feature is sequentially subjected to root mean square error normalization and activation operation, and the second processing feature and the result after the activation operation are added to obtain the MSA feature corresponding to the coding feature.
[0146] For example, in a column attention calculation, the normalized root mean square error result is used to perform the first transposition operation using the transpose function, the result after the first transposition operation is used to perform multi-head self-attention calculation, and the result after the multi-head self-attention calculation is used to perform the second transposition operation using the transpose function to obtain the result after the column attention calculation.
[0147] For example, in a multi-head self-attention calculation, the normalized root mean square error result is linearly transformed and mapped to the Q / K / V matrix, the Q / K / V matrix is divided into multiple heads, and self-attention calculation is performed for each head. Rotational position encoding is performed on the Q matrix, rotational position encoding is performed on the K matrix, the encoding results of the two are multiplied, the result of the multiplication is normalized exponentially, the V matrix is multiplied with the result of the normalized exponential operation, the result of the multiplication is linearly transformed, and the result of the multiplication is obtained after the multi-head self-attention calculation.
[0148] For example, in an activation operation performed using the activation function (SwiGLU), the result of the normalized root mean square error is linearly transformed using two parallel Linear layers respectively, the result of the linear transformation of one Linear layer is activated using the activation function (SiLU), the result of the activation operation (SiLU) is dot-producted with the result of the linear transformation of another Linear layer, the result of the dot product is linearly transformed using a Linear layer to obtain the result after the activation operation (SiGLU).
[0149] In a possible implementation, in the basic model, the first sub-coding layer (MSA Embedding) is implemented based on at least one standard coding layer (Embedding), and in a specific example, it is an Embedding layer. The second sub-coding layer (Sequence Embedding) is implemented based on at least one standard coding layer (Embedding) and / or at least one linear transformation (Linear) layer. In a specific example, when the sample position data is a chromosome position, the second sub-coding layer is an Embedding layer, when the sample position data is a chromosome position, the second sub-coding layer is a Linear layer, and when the sample position data includes both the chromosome position and the chromosome position, the second sub-coding layer is a parallel Embedding layer and a Linear layer. Each feature extraction unit (USM Block) is implemented based on at least two Linear layers. The second conversion layer (LM Head) is implemented based on at least one Linear layer, and in a specific example, it is a Linear layer.
[0150] In this embodiment, the basic model adopts the attention mechanism, so the training phase can capture and learn the important parts of the MSA data, thereby improving the accuracy of the MSA features.
[0151] Part II: Application Phase
[0152] Figure 6is a flow chart of a gene variation detection method provided by an exemplary embodiment of the present application. The method is executed by a computer device, which may be Figure 2 The terminal 120 and / or server 140 shown. The method includes at least some of steps 220, 240, 260, and 280:
[0153] Step 220, obtaining MSA data of the individual, the MSA data including base information and sequencing information of the candidate sites in the gene loci.
[0154] An individual is an organism. Generally, an individual refers to a human individual. Multiple sequence alignment (MSA) data is obtained by aligning the sequencing data obtained by sequencing the gene of an individual with the reference gene sequence. The reference gene sequence is a standard version of the gene sequence of an individual, which is based on the integration of gene sequencing and analysis of multiple individuals.
[0155] Candidate sites are some gene sites in the individual's gene sites that meet the screening conditions. They can also be understood as suspicious sites, which are gene sites that may have mutations. When detecting gene mutations, the individual's MSA data only contains the base information and sequencing information of the candidate sites in the gene sites, which can reduce the amount of calculation of invalid areas.
[0156] Exemplarily, a computer device obtains MSA data of an individual, and the MSA data includes base information and sequencing information of candidate sites in a gene site. In some embodiments, a sequencing device is used to perform gene sequencing on an individual to obtain a sequencing signal. The sequencing signal is an electrical signal or an optical signal, and the sequencing signal needs to be converted into an analyzable gene sequence, i.e., sequencing data, and then the MSA data of the individual is generated based on the sequencing data.
[0157] The MSA data of an individual may be generated by: performing base calling on the original sequencing signal, the base calling is used to convert the sequencing signal generated by the sequencing device into the original sequencing data, and obtain the original sequencing data; performing sequence quality control on the original sequencing data, the sequence quality control is used to filter, prune and evaluate the original sequencing data, and obtain processed sequencing data, wherein the sequence quality control may also be used as an optional step; next, performing sequence alignment on the processed sequencing data, the sequence alignment is used to align the processed sequencing data with the reference gene sequence, and obtain alignment data; based on the candidate sites screened out from each gene site and the alignment data, the MSA data of the individual is obtained.
[0158] In some embodiments, after aligning the original sequencing data of an individual with the reference gene sequence, alignment data is obtained, and the alignment data contains the base information and sequencing information corresponding to each gene locus. These alignment data can be simply divided into: unmutated regions, noise regions, and mutated regions. For unmutated regions, this part of the gene sequence is exactly the same as the reference gene sequence, and its base information and sequencing information are redundant. For noise regions, this part of the gene sequence has a small amount of base changes, which is caused by sequencing system errors and comparison errors, and its comparison quality value is usually relatively low.
[0159] In the embodiment of the present application, the candidate sites include at least one of the following: gene sites that are different from the reference gene sequence; gene sites with a comparison quality value greater than or equal to the first threshold; gene sites with a coverage greater than or equal to the second threshold; gene sites with a minor allele frequency greater than or equal to the third threshold. Or, the candidate sites can also be understood as the gene sites remaining after filtering each gene site, and the filtered gene sites include: filtering gene sites that are exactly the same as the reference gene sequence; filtering gene sites with a comparison quality value less than the first threshold; filtering gene sites with a coverage less than the second threshold; filtering gene sites with a minor allele frequency less than the third threshold, most of which are noise sites. The first threshold, the second threshold, and the third threshold can be set according to actual technical needs. In one example, the first threshold is 20, the second threshold is 10, and the third threshold is 0.1.
[0160] In some embodiments, the MSA data of an individual includes: the sequence MSA data (Base MSA) and the insertion MSA data (Insertion MSA) of the candidate site. The sequence MSA data is used to characterize the base changes of the candidate site, that is, the sequence MSA data indicates the specific base type, whether there is a deletion, and whether it is not detected at the candidate site. Figure 7 , the sequence MSA data includes: letters A, G, C, T, U, symbols "." or "-". The letters A, G, C, T, U represent the specific base types of the candidate sites, the symbol "-" indicates that the candidate site has a deletion, and the symbol "." indicates that the candidate site has not been detected and is a GAP. Insertion MSA data is used to characterize the base insertion situation at the candidate site, that is, if there is no insertion at the candidate site, or, if there is an insertion variation at the candidate site, the insertion base type of the base inserted at the candidate site. Reference Figure 8 , the insertion in MSA data includes: letters A, G, C, T, U or symbol ".". Letters A, G, C, T, U represent the insertion base type of the candidate site, and the symbol "." indicates that there is no insertion in the candidate site.
[0161] It should also be noted that the MSA data of the individual in this embodiment also includes a reference gene sequence, which is located in the first line of the MSA data as the first line gene sequence of the MSA data. The reference gene sequence can use HG38 and be truncated to a preset length, which can be 1024 BP.
[0162] Step 240, encoding the alignment features of the MSA data, and encoding the profile features of the MSA data, wherein the alignment features are used to characterize the base information and the sequencing information, and the profile features are used to characterize the statistical information corresponding to the base information and the sequencing information.
[0163] Exemplarily, the computer device encodes the alignment feature of the MSA data, and the profile feature of the MSA data. The alignment feature is used to extract the features of the MSA shape, and specifically, the alignment feature is used to characterize the base information and sequencing information. The profile feature is used to extract the features of the sequence shape, and specifically, the profile feature is used to characterize the statistical information corresponding to the base information and sequencing information.
[0164] In some embodiments, the MSA data includes base information and sequencing information of candidate sites in the gene locus. The base information includes: at least one of the base changes in the sequence MSA data (Base MSA), the base insertions in the insertion MSA data (Insertion MSA), and the mapping quality value (Mapping Quality) of each base. The sequencing information includes: at least one of the base quality value (Base Quality) during base calling, and the positive and negative strand information (Strand Info) of each sequencing fragment (reads) of the gene sequence during gene sequencing. The positive and negative strand information includes: the sequencing fragment is located in the positive strand (Sense Strand) or the negative strand (Antisense Strand). The statistical information corresponding to the base information and the sequencing information includes: at least one of the reference gene sequence (Reference Sequence), the base ratio (MSA Profile), and the average insertion length (Insertion Length Mean). The value range of the average insertion length is [0,1]. You can use: 2 / πarctan d / 3 transformation to transform any real number d to the value range of [0,1], where d is the average insertion length. In one implementation, sequence MSA data, insertion MSA data, alignment quality value of each base, and positive and negative strand information can be obtained by alignment software after aligning the reference gene sequence with the individual's sequencing data, and provided by the alignment software. The base quality value during base calling is provided by the sequencing device.
[0165] In some optional implementations, the encoding method includes one-hot encoding. Among them, the sequence MSA data and the inserted MSA data are encoded by one-hot encoding, and then spliced with the comparison quality value of each base, the base quality value during base calling, and the positive and negative chain information of each sequencing fragment of the gene sequence during gene sequencing to obtain a complete comparison feature. The reference gene sequence is encoded by one-hot encoding, and then spliced with the base ratio and the average insertion length to obtain a complete profile feature. In this embodiment, the comparison feature and the profile feature can also be further encoded.
[0166] In some embodiments, the computer device stores a gene variation detection model, and the encoding step is implemented based on the gene variation detection model. The individual's MSA data is input into the gene variation detection model, and based on the first coding layer, the comparison features of the MSA data are encoded, and based on the second coding layer, the profile features of the MSA data are encoded. Specifically, the sequence MSA data and the inserted MSA data are encoded by one-hot encoding, and then spliced with the comparison quality value of each base, the base quality value during base calling, and the positive and negative chain information of each sequencing fragment of the gene sequence during gene sequencing to obtain a complete comparison feature, and then encoded based on the first coding layer. The reference gene sequence is encoded by one-hot encoding, and then spliced with the base ratio and the average insertion length to obtain a complete profile feature, and then encoded based on the second coding layer.
[0167] Step 260: extracting MSA features corresponding to the comparison features and the contour features.
[0168] Exemplarily, the computer device extracts the MSA feature corresponding to the comparison feature and the profile feature. The MSA feature integrates the base information, sequencing information and statistical information corresponding to the MSA data of the individual, and can characterize the MSA data of the individual from different information dimensions.
[0169] In some embodiments, the computer device stores a gene variation detection model, and the extraction step is implemented based on the gene variation detection model. The alignment feature is spliced with the profile feature to obtain a spliced feature, and feature extraction is performed on the spliced feature based on the base model layer to obtain the MSA feature.
[0170] Step 280 , mapping the MSA features to obtain the gene variation detection results of the MSA data relative to the reference gene sequence.
[0171] In this embodiment, since the reference gene sequence is a standard version of an individual's gene sequence, it is based on the integration of gene sequencing and analysis performed on multiple individuals. By comparing the gene sequence of the individual with the reference gene sequence, it is possible to identify whether there is a gene variation in the gene sequence of the individual. The computer device maps the MSA features to obtain the gene variation detection results of the MSA data relative to the reference gene sequence.
[0172] In some embodiments, the computer device stores a gene variation detection model, and the mapping step is implemented based on the gene variation detection model. Based on the prediction layer, the MSA features are mapped to obtain the gene variation detection results of the MSA data relative to the reference gene sequence.
[0173] In summary, the gene variation detection method provided in the embodiment of the present application is that the computer device obtains the MSA data of the individual, and the MSA data includes the base information and sequencing information of the candidate sites in the gene site; encodes the comparison feature of the MSA data, and encodes the profile feature of the MSA data, the comparison feature is used to characterize the base information and sequencing information, and the profile feature is used to characterize the statistical information corresponding to the base information and sequencing information; extracts the MSA features corresponding to the comparison feature and the profile feature; maps the MSA features to obtain the gene variation detection results of the MSA data relative to the reference gene sequence. Accordingly, the MSA feature is obtained based on the comparison feature and the profile feature, the comparison feature is used to characterize the base information and sequencing information, that is, the feature of the MSA shape, and the profile feature is used to characterize the statistical information corresponding to the base information and sequencing information, that is, the feature of the sequence shape, so that the MSA feature can characterize the MSA data of the individual from different information dimensions of base information, sequencing information, and statistical information, and the gene variation detection results of the MSA data relative to the reference gene sequence are obtained by mapping the MSA feature, which can make full use of the information of different information dimensions of the MSA data and improve the accuracy of the gene variation detection results. In addition, MSA data contains relevant information about candidate loci in gene loci, which can reduce redundant information, reduce the amount of calculation in invalid areas, and improve data processing efficiency.
[0174] In some embodiments, step 260 is implemented as step 262 and step 264:
[0175] Step 262, stitching the comparison feature and the contour feature to obtain a stitching feature;
[0176] Step 264, perform self-attention calculation on the concatenated features to obtain MSA features.
[0177] Self-attention calculation is used to capture and learn the key parts of the rows and columns of the gene sequence. The feature splicing method includes at least one of the following: column splicing, row splicing, element splicing, addition, multiplication, and dot product, which can be selected according to actual technical needs. In this embodiment, the feature splicing method includes addition.
[0178] Exemplarily, the computer device splices the alignment feature and the contour feature to obtain a splicing feature; and performs self-attention calculation on the splicing feature to obtain an MSA feature. In some embodiments, the computer device stores a gene variation detection model, and the steps of splicing and self-attention calculation are implemented based on the gene variation detection model. The alignment feature is added to the contour feature to splice the alignment feature and the contour feature to obtain a splicing feature, and a self-attention calculation is performed on the splicing feature based on the basic model layer to obtain an MSA feature.
[0179] The method of this embodiment simultaneously encodes comparison features and contour features, and obtains MSA features based on the attention mechanism, which can improve the accuracy of MSA features and is beneficial to improving the accuracy of gene variation detection results.
[0180] Specifically, step 264 is implemented as step 2641, step 2642 and step 2643:
[0181] Step 2641, performing column attention calculation on the concatenated features to obtain column attention features;
[0182] Step 2642, performing pooling on the column attention features in the column direction to obtain column pooling features;
[0183] Step 2643, perform row attention calculation on the column pooling features to obtain MSA features.
[0184] Self-attention calculation includes: column attention calculation and row attention calculation. Since the rows of MSA data represent gene sequences, a gene sequence includes one or more sequencing fragments (reads), and the columns represent gene loci, the gene loci in the same column have the same corresponding position on the chromosome. Column attention calculation is used to learn the relevant information of bases aligned at the same position, and row attention calculation is used to learn the relevant information of the relationship between one or more sequencing fragments of each gene sequence. The amount of information in the column direction of MSA data is low, and the amount of information in the row direction is high.
[0185] Exemplarily, the computer device performs column attention calculation on the spliced features to obtain column attention features; performs pooling on the column attention features in the column direction, and the pooling method includes at least one of average pooling, maximum pooling, and random pooling. This embodiment adopts average pooling, also known as column pooling, to obtain column pooling features; performs row attention calculation on the column pooling features to obtain MSA features. In this way, the MSA feature can fully characterize the individual MSA data from two dimensions, row and column.
[0186] The method of this embodiment fully extracts the information in the comparison features and contour features from the dimensions of rows and columns, and fully represents the MSA data based on the attention mechanism, which can improve the accuracy of the MSA features and is conducive to improving the accuracy of the gene variation detection results.
[0187] In some embodiments, step 280 is implemented as step 282 and step 284:
[0188] Step 282, converting the MSA feature to obtain the MSA conversion feature;
[0189] Step 284, performing prediction based on the MSA conversion feature to obtain a gene variation detection result of the MSA data relative to the reference gene sequence; wherein the gene variation detection result includes: at least one of: the genotype of the candidate site, the type of inserted base, and the base change.
[0190] Conversion can also be called mapping. Exemplarily, the computer device converts the MSA feature to obtain the MSA conversion feature; performs prediction based on the MSA conversion feature to obtain the gene variation detection result of the MSA data relative to the reference gene sequence. The gene variation detection result includes: at least one of the genotype (Genotype), base change (Base Change), and insertion base type (Insertion) of the candidate site.
[0191] Genotype is the variation type of the candidate site, and the genotypes include: 0 / 0 no mutation, 0 / 1 heterozygous mutation, 1 / 1 homozygous mutation, and 1 / 2 compound mutation. 1 / 2 compound mutation is a single base substitution mutation (Single NucleotidePolymorphism, SNP) and base insertion or deletion mutation (Insertion and Deletion Variant, INDEL) occurring simultaneously. Base change means that when the candidate site is: 0 / 0 no mutation, the base of the reference gene sequence corresponding to the candidate site is output, and when the candidate site is: 0 / 1 heterozygous mutation, 1 / 1 homozygous mutation, 1 / 2 compound mutation, the changed base of the candidate site is output. Insertion base type refers to the base type of the base inserted in the candidate site when there is an insertion variation in the candidate site.
[0192] In some embodiments, the computer device stores a gene variation detection model, and the conversion and prediction steps are implemented based on the gene variation detection model. Based on the first conversion layer, the MSA feature is converted to obtain the MSA conversion feature; based on the classifier, the MSA conversion feature is predicted to obtain the gene variation detection result of the MSA data relative to the reference gene sequence. Among them, the first classifier is used to predict the genotype of the candidate site, the second classifier is used to predict the insertion base type of the candidate site, and the third classifier is used to predict the base change of the candidate site.
[0193] In the method of this embodiment, the gene variation detection results may include three types, which can fully represent the gene variation corresponding to the candidate site. The gene variation detection results are more comprehensive and accurate, and are also beneficial for subsequent disease detection, cancer screening, etc.
[0194] In some embodiments, the MSA data is obtained by comparing the sequencing data of the individual with the reference gene sequence, and the first line of gene sequence in the MSA data includes the reference gene sequence. After the MSA features are extracted from the MSA data of the individual, the first line of features in the MSA features enriches the global information of each candidate site. Specifically, step 284 is implemented as steps 2841 and 2842:
[0195] Step 2841, extracting the first row of MSA conversion features from the MSA conversion features, where the first row of MSA conversion features is used to characterize the global features corresponding to the candidate sites;
[0196] Step 2842, perform prediction on the first row of MSA conversion features to obtain the gene variation detection results of the MSA data relative to the reference gene sequence.
[0197] Exemplarily, a computer device converts MSA features to obtain MSA conversion features; extracts the first row of MSA conversion features from the MSA conversion features, and the first row of MSA conversion features is used to characterize the global features corresponding to the candidate sites; performs prediction on the first row of MSA conversion features to obtain a gene variation detection result of the MSA data relative to a reference gene sequence.
[0198] In this embodiment, the feature corresponding to the first gene sequence in the MSA data is selected to perform prediction. This feature can represent global information, which is beneficial to improving the accuracy of gene variation detection results.
[0199] In some embodiments, for obtaining MSA data of an individual, step 220 is implemented as steps 222, 224, 226, and 228:
[0200] Step 222, obtaining sequencing data of the individual;
[0201] Step 224, aligning the sequencing data with the reference gene sequence to obtain aligned data;
[0202] Step 226, determining candidate sites in the aligned data that meet the screening criteria;
[0203] Step 228, obtaining MSA data based on the alignment data and the candidate sites.
[0204] Exemplarily, a computer device obtains an original sequencing signal of an individual, where the sequencing signal is obtained by a sequencing device performing gene sequencing on the individual, performs base calling on the original sequencing signal, and obtains sequencing data of the individual. A reference gene sequence is obtained; the sequencing data is aligned with the reference gene sequence to obtain alignment data; candidate sites that meet the screening conditions in the alignment data are determined; based on the alignment data and the candidate sites, the alignment data is converted into MSA data to obtain MSA data.
[0205] Candidate sites that meet the screening conditions can also be understood as suspicious sites, which are gene sites where mutations may exist. When detecting gene mutations, the MSA data of an individual only contains the base information and sequencing information of the candidate sites in the gene sites, which can reduce the amount of calculation of invalid areas. Optionally, candidate sites that meet the screening conditions include at least one of the following: gene sites that are different from the reference gene sequence; gene sites with a comparison quality value greater than or equal to a first threshold; gene sites with a coverage greater than or equal to a second threshold; gene sites with a minor allele frequency greater than or equal to a third threshold. The first threshold, the second threshold, and the third threshold can be set according to actual technical needs. In one example, the first threshold is 20, the second threshold is 10, and the third threshold is 0.1.
[0206] In the method of this embodiment, the sequencing data of an individual is converted into MSA data, in which only the base information and sequencing information of the candidate sites can be retained, which can reduce the amount of calculation of invalid areas, improve the processing efficiency of MSA data, and increase the speed of gene variation detection.
[0207] In some embodiments, the MSA data of an individual includes: the sequence MSA data (Base MSA) and the insertion MSA data (Insertion MSA) of the candidate site. The sequence MSA data is used to characterize the base changes of the candidate site, that is, the sequence MSA data indicates the specific base type, whether there is a deletion, and whether it is not detected at the candidate site. Figure 7 , the sequence MSA data includes: letters A, G, C, T, U, symbols "." or "-". Among them, the letters A, G, C, T, U represent the specific base types of the candidate sites, the symbol "-" indicates that the candidate site has a deletion, and the symbol "." indicates that the candidate site has not been detected. Insertion MSA data is used to characterize the base insertion situation at the candidate site, that is, if there is no insertion at the candidate site, or, if there is an insertion variation at the candidate site, the insertion base type of the base inserted at the candidate site. Reference Figure 8 , the insertion in MSA data includes: letters A, G, C, T, U or symbol ".". Among them, letters A, G, C, T, U represent the insertion base type of the candidate site, and the symbol "." indicates that there is no insertion in the candidate site.
[0208] Specifically, step 228 is implemented as step 2281, step 2282 and step 2283:
[0209] Step 2281, taking each candidate site of the candidate sites as the center of the window, extracting the gene sequence in the window in the alignment data, each sequencing fragment in the gene sequence corresponds to at least one of base insertion information, base deletion information and base change information;
[0210] Step 2282, based on the base deletion information and base change information corresponding to each sequencing fragment in the gene sequence, determine the sequence MSA data of each candidate site, based on the base insertion information corresponding to each sequencing fragment in the gene sequence, determine the insertion MSA data of each candidate site;
[0211] Step 2283, combine the sequence MSA data and the insertion MSA data corresponding to each candidate site of the candidate site to obtain MSA data.
[0212] The window size is preset, and the window size is the same for different candidate sites. The window depth is preset, and the window depth is the same for different candidate sites. The window is expressed as [start, end], and the window size is expressed as window = end-start. The candidate site is the center of the window, and the candidate site is expressed as center = (start + end) / 2. The alignment data can be a BAM file, and the alignment data includes gene sequences. Each gene sequence includes one or more sequencing fragments (reads). Each sequencing fragment is stored in the BAM file in Cigar String format. Cigar String includes a series of operation codes, and each operation code is used to describe the detailed information of base insertion, base deletion, and base change when the sequencing fragment is aligned to the reference feature sequence.
[0213] Specifically, the computer device takes each candidate site of the candidate sites as the center of the window, extracts the gene sequence in the window in the alignment data, and the gene sequence outside the window will be truncated, and each sequencing fragment in the gene sequence corresponds to at least one of base insertion information, base deletion information, and base change information. Based on the base deletion information and base change information corresponding to each sequencing fragment in the gene sequence, the sequence MSA data of each candidate site is determined, and based on the base insertion information corresponding to each sequencing fragment in the gene sequence, the insertion MSA data of each candidate site is determined; the sequence MSA data and the insertion MSA data corresponding to each candidate site of the candidate site are combined to obtain the MSA data.
[0214] As an example, the sequence MSA data of a candidate site can be a matrix, represented as: base ∈N k×l , k represents the number of sequencing fragments (reads) located in the window, l represents the window size, M base The MSA data of a candidate site can be a matrix, represented by M. ins ∈N k×l , k represents the number of sequencing fragments (reads) located in the window, l represents the window size, M ins The letters A, G, C, T, U or the symbol "." are included. The letters A, G, C, T, and U represent the insertion base type of the candidate site, and the symbol "." indicates that there is no insertion at the candidate site. In the specific example, the window size is 129 and the maximum depth is 64.
[0215] In some embodiments, after obtaining the sequence MSA data and insertion MSA data corresponding to each candidate site, the sequencing fragments (reads) in the sequence MSA data and insertion MSA data are converted row by row into corresponding base encoding values (IDs) according to the sorting in the alignment data. The IDs may be in digital form. Next, the sequence MSA data and insertion MSA data corresponding to each candidate site of the candidate site are combined to obtain the MSA data.
[0216] This embodiment provides a method for determining MSA data. MSA data includes sequence MSA data and insertion MSA data, so that the insertion, deletion, and change of bases at each candidate site can be retained to improve the accuracy of gene variation detection results, and the MSA data can be streamlined to avoid excessive memory usage during data processing and improve data processing efficiency.
[0217] Part III: Training Phase
[0218] (1) Training phase of gene mutation detection model
[0219] In some embodiments, a gene variation detection model for executing a gene variation detection method includes: a first encoding layer (MSA Embedding), a second encoding layer (Sequence Embedding), a basic model layer (USM Core), and a prediction layer; the first encoding layer is connected in parallel with the second encoding layer, the first encoding layer and the second encoder are cascaded with the basic model layer respectively, and the basic model layer is cascaded with the prediction layer; wherein the first encoding layer is used to encode the alignment feature (AlignmentFeature) of the MSA data; the second encoding layer is used to encode the profile feature (ProfileFeature) of the MSA data; the basic model layer is used to extract MSA features corresponding to the alignment features and the profile features; the prediction layer is used to convert the MSA features to obtain the gene variation detection results of the MSA data relative to the reference gene sequence.
[0220] In some embodiments, the prediction layer includes: a first conversion layer (Variant Layer) and a classifier (Classifier), and the first conversion layer is cascaded with the classifier; wherein the first conversion layer is used to convert MSA features to obtain MSA conversion features; the classifier is used to perform prediction based on the MSA conversion features to obtain gene variation detection results of the MSA data relative to the reference gene sequence.
[0221] In some embodiments, the classifier includes: a first classifier (Genotype Classifier), a second classifier (Insertion Classifier) and a third classifier (Base Change Classifier) in parallel, and a first conversion layer (Variant Layer) is cascaded with the first classifier, the second classifier and the third classifier respectively; wherein the first classifier is used to predict the genotype (Genotype) of the candidate site, the second classifier is used to predict the insertion base type (Insertion) of the candidate site, and the third classifier is used to predict the base change (Base Change) of the candidate site.
[0222] In some embodiments, the prediction layer of the gene variation detection model further includes: a second conversion layer (LM Head), the second conversion layer is used to predict the base type in at least a portion of the mask region of the MSA feature of the first sample to obtain the predicted base type. It can be understood that the second conversion layer is used to maintain the self-supervised learning capability of the gene variation detection model, and in the training stage and / or application stage, the pre-trained second conversion layer is retained for mask learning.
[0223] In some embodiments, the basic model layer in the gene variation detection model includes: a feature extraction unit (USM Block) stacked in the pre-trained basic model. The basic model is a unified sequence model (USM) for extracting MSA features.
[0224] It should also be noted that, since the basic model is a pre-trained model, the basic model has been trained before the gene variation detection model is trained, and the N feature extraction units stacked in the pre-trained basic model can be directly applied to the gene variation detection model, where N is greater than or equal to 1. Optionally, the training stage of the gene variation detection model can also be called fine-tuning training, and the training stage of the basic model can also be called pre-training.
[0225] In some embodiments, the training phase of the gene variation detection model is performed by a computer device, which may be Figure 2 The terminal 120 and / or the server 140 shown, before step 220, further includes at least some of steps 300, 320, 340, 360, and 380:
[0226] Step 300, obtaining first sample MSA data of a first sample individual, the first sample MSA data including sample base information and sample sequencing information of sample variation sites, the sample variation sites including gene sites in the human genome with a confidence level higher than a threshold.
[0227] The first sample individual in the training phase of the gene variation detection model is consistent with the type of individual in the application phase. Generally, the first sample individual is also a human individual. The sample variation site is a gene site in the human genome with a confidence level higher than a threshold. The threshold can be set according to actual technical needs.
[0228] The first sample MSA data is obtained by comparing the sample sequencing data obtained by gene sequencing of the first sample individual with the reference gene sequence. The reference gene sequence is a standard version of the gene sequence of an individual, which is integrated based on gene sequencing and analysis of multiple individuals.
[0229] Exemplarily, the computer device obtains the first sample MSA data of the first sample individual, and the first sample MSA data includes the sample base information and sample sequencing information of the sample variation site. In some embodiments, a sequencing device is used to perform gene sequencing on the first sample individual to obtain a sample sequencing signal. The sample sequencing signal is an electrical signal or an optical signal, and the sample sequencing signal needs to be converted into an analyzable gene sequence, that is, sample sequencing data, and then the first sample MSA data of the first sample individual is generated based on the sample sequencing data.
[0230] The first sample MSA data of the first sample individual may be generated by: performing base calling on the original sample sequencing signal, the base calling is used to convert the sample sequencing signal generated by the sequencing device into the original sample sequencing data, so as to obtain the original sample sequencing data; performing sequence quality control on the original sample sequencing data, the sequence quality control is used to filter, prune and evaluate the original sample sequencing data, so as to obtain the processed sample sequencing data, wherein the sequence quality control may also be used as an optional step; next, performing sequence alignment on the processed sample sequencing data, the sequence alignment is used to align the processed sample sequencing data with the reference gene sequence, so as to obtain the alignment data; based on the sample variation sites and the sample alignment data, the first sample MSA data of the first sample individual is obtained.
[0231] Step 320, based on the first coding layer, encode the sample comparison features of the first sample MSA data, and, based on the second coding layer, encode the sample profile features of the first sample MSA data, the sample comparison features are used to characterize the sample base information and the sample sequencing information, and the sample profile features are used to characterize the sample statistical information corresponding to the sample base information and the sample sequencing information.
[0232] Exemplarily, the computer device encodes the sample alignment feature (Alignment Feature) of the first sample MSA data based on the first coding layer (MSA Embedding), and encodes the sample profile feature (Profile Feature) of the first sample MSA data based on the second coding layer (Sequence Embedding). The sample alignment feature is used to extract the features of the MSA shape, specifically, the sample alignment feature is used to characterize the sample base information and the sample sequencing information, and the sample profile feature is used to extract the features of the sequence (Sequence) shape, specifically, the sample profile feature is used to characterize the sample statistical information corresponding to the sample base information and the sample sequencing information.
[0233] In some embodiments, the first sample MSA data includes sample base information and sample sequencing information of the sample variant site. The sample base information includes: at least one of the base changes in the first sample sequence MSA data (Base MSA), the base insertions in the first sample insertion MSA data (Insertion MSA), and the mapping quality value (MappingQuality) of each base. The sample sequencing information includes: at least one of the base quality value (Base Quality) during base calling, and the positive and negative strand information (Strand Info) of each sequencing fragment (reads) of the gene sequence during gene sequencing. The sample statistical information corresponding to the sample base information and the sample sequencing information includes: at least one of the reference gene sequence (ReferenceSequence), the base ratio (MSA Profile), and the average insertion length (Insertion Length Mean). The value range of the average insertion length is [0,1]. The 2 / πarctan d / 3 transformation can be used to transform any real number d to the value range of [0,1], where d is the average insertion length. In one implementation, the first sample sequence MSA data, the first sample insertion MSA data, the alignment quality value of each base, and the positive and negative chain information can be obtained by the alignment software after aligning the reference gene sequence with the sample sequencing data of the first sample individual, and provided by the alignment software. The base quality value during base calling is provided by the sequencing device.
[0234] Step 340: extracting the first sample MSA feature corresponding to the sample comparison feature and the sample profile feature based on the basic model layer.
[0235] Exemplarily, the computer device extracts the first sample MSA feature corresponding to the sample comparison feature and the sample profile feature based on the basic model layer. The first sample MSA feature integrates the sample base information, sample sequencing information and sample statistical information corresponding to the first sample MSA data of the first sample individual, and can characterize the first sample MSA data of the first sample individual from different information dimensions.
[0236] Step 360, based on the prediction layer, mapping the first sample MSA feature to obtain first predicted MSA data, the first predicted MSA data including predicted base information of the sample variation site.
[0237] Exemplarily, the computer device maps the first sample MSA feature based on the prediction layer to obtain first predicted MSA data, wherein the first predicted MSA data includes predicted base information of the sample variant site. For the specific content of the predicted base information, see the embodiment related to the training loss below.
[0238] Step 380 , adjusting the model parameters of the gene variation detection model with the training goal of reducing the difference between the predicted base information in the first predicted MSA data and the sample base information in the first sample MSA data.
[0239] Exemplarily, the computer device adjusts the model parameters of the gene variation detection model with the training goal of reducing the difference between the predicted base information in the first predicted MSA data and the sample base information in the first sample MSA data. In one implementation, the model parameters of the first encoding layer, the second encoding layer, the first conversion layer, the first classifier, the second classifier, and the third classifier are fine-tuned without adjusting the model parameters of the base model layer in the gene variation detection model.
[0240] This embodiment provides a training step for a gene variation detection model to provide support for the training of the gene variation detection model. The gene variation detection model uses the stacked feature extraction layer of the pre-trained basic model as the basic model layer to extract the first sample MSA feature. In this way, the gene variation detection model only needs to be fine-tuned for training, which can improve both the training speed and the model accuracy.
[0241] In some embodiments, step 342 and step 344:
[0242] Step 342, stitching the sample comparison feature and the sample contour feature to obtain a sample stitching feature;
[0243] Step 344: Based on the basic model layer, perform self-attention calculation on the sample splicing features to obtain the first sample MSA feature.
[0244] Self-attention calculation is used to capture and learn the key parts of the rows and columns of the sample gene sequence. The feature splicing method includes at least one of the following: column splicing, row splicing, element splicing, addition, multiplication, and dot product, which can be selected according to actual technical needs. In this embodiment, the feature splicing method includes addition.
[0245] Exemplarily, the computer device splices the sample comparison feature and the sample profile feature to obtain the sample splicing feature; based on the basic model layer, performs self-attention calculation on the sample splicing feature to obtain the first sample MSA feature. Specifically, the sample comparison feature is added to the sample profile feature to splice the sample comparison feature and the sample profile feature to obtain the sample splicing feature.
[0246] In one possible implementation, since the base model layer is N stacked feature extraction units in the base model, the structure and calculation operations of each of the N feature extraction units are consistent. It can be based on each of the N feature extraction units, continue to perform self-attention calculation on the output result of the previous feature extraction unit, and use the output result of the Nth feature extraction unit as the first sample MSA feature.
[0247] Specifically, for the first feature extraction unit among the N feature extraction units, based on the first feature extraction unit, perform self-attention calculation on the sample splicing feature to obtain the first output result, for the i-th feature extraction unit among the N feature extraction units, based on the i-th feature extraction unit, perform self-attention calculation on the i-1-th output result to obtain the i-th output result, update i to i+1 and repeat the above steps until i equals N, and use the N-th output result as the first sample MSA feature corresponding to the sample splicing feature. Wherein, N is greater than or equal to 1, i is greater than or equal to 1, and i is less than or equal to N.
[0248] The method of this embodiment simultaneously encodes sample comparison features and sample profile features, and obtains the first sample MSA features based on the attention mechanism, which can improve the accuracy of the first sample MSA features, so that the gene variation detection model can fully learn the first sample MSA data, which is conducive to improving the model accuracy.
[0249] Specifically, step 344 is implemented as step 3441, step 3442 and step 3443:
[0250] Step 3441, based on the basic model layer, perform column attention calculation on the sample splicing features to obtain sample column attention features;
[0251] Step 3442, performing pooling on the sample column attention features in the column direction to obtain sample column pooling features;
[0252] Step 3443, perform row attention calculation on the sample column pooling features to obtain the first sample MSA feature.
[0253] Self-attention calculation includes: column attention calculation and row attention calculation. Since the row of the first sample MSA data represents the sample gene sequence, a sample gene sequence includes one or more sample sequencing fragments (reads), and the column represents the sample variation site, the sample variation sites in the same column have the same corresponding position on the chromosome. Column attention calculation is used to learn the relevant information of the bases aligned at the same position, and row attention calculation is used to learn the relevant information of the relationship between one or more sample sequencing fragments of each sample gene sequence. The first sample MSA data has a low amount of information in the column direction and a high amount of information in the row direction.
[0254] Exemplarily, based on the basic model layer, the computer device performs column attention calculation on the sample splicing features to obtain sample column attention features; performs pooling on the sample column attention features in the column direction, and the pooling method includes at least one of average pooling, maximum pooling, and random pooling. This embodiment adopts average pooling, also known as column pooling, to obtain sample column pooling features; performs row attention calculation on the sample column pooling features to obtain the first sample MSA features. In this way, the first sample MSA features can fully characterize the first sample MSA data of the first sample individual from the two dimensions of row and column.
[0255] The method of this embodiment fully learns the information in the sample comparison features and sample profile features from the dimensions of rows and columns, and fully characterizes the first sample MSA data based on the attention mechanism, which can improve the accuracy of the first sample MSA features.
[0256] In some embodiments, step 380 is implemented as step 382 and step 384:
[0257] Step 382, determining a training loss based on the predicted base information in the first predicted MSA data and the sample base information in the first sample MSA data;
[0258] Step 384, adjusting the model parameters of the gene variation detection model with the goal of reducing the training loss.
[0259] The training loss refers to the loss between the predicted base information of the sample variant site in the first predicted MSA data and the sample base information of the sample variant site in the first sample MSA data. Exemplarily, the computer device determines the training loss based on the predicted base information in the first predicted MSA data and the sample base information in the first sample MSA data; and adjusts the model parameters of the gene variation detection model with reducing the training loss as the training goal.
[0260] This embodiment provides a method for determining the training loss of a gene variation detection model. When the training loss is reduced as a goal, the model accuracy of the gene variation detection model can be improved.
[0261] In some embodiments, during the training phase of the base model, the second conversion layer (LM Head) in the base model is used for mask learning. Mask learning refers to randomly replacing a portion of the input sequence with a mask, so that the base model predicts the base type in the masked region to help the base model learn a better contextual representation of the gene sequence.
[0262] During the training phase of the gene mutation detection model, in order to maintain the self-supervised learning capability of the gene mutation detection model, the second conversion layer is still retained in the gene mutation detection model. Fig. 9 , the second conversion layer is connected in parallel with the first conversion layer. Exemplarily, the prediction layer of the gene variation detection model further includes: a second conversion layer, the second conversion layer is used to predict the base type in at least a part of the mask region of the MSA feature of the first sample to obtain the predicted base type.
[0263] Exemplarily, the sample base information includes: the sample genotype (Genotype) of the sample variation site, the sample insertion base type (Insertion), the sample base change (Base Change) and the sample base type in at least a portion of the mask region; the predicted base information includes: the predicted genotype of the sample variation site, the predicted insertion base type, the predicted base change and the predicted base type in at least a portion of the mask region.
[0264] Specifically, step 382 is implemented as step 3821 and step 3822:
[0265] Step 3821, based on the sample genotype and the predicted genotype, obtain the genotype loss; based on the sample insertion base type and the predicted insertion base type, obtain the insertion base type loss; based on the sample base change and the predicted base change, obtain the base change loss; based on the sample base type and the predicted base type, obtain the mask loss.
[0266] Step 3822, perform weighted summation on the genotype loss, the inserted base type loss, the base change loss and the mask loss to obtain the training loss.
[0267] The training loss can be expressed as cross entropy loss:
[0268] loss = λ1*loss geno +λ2*loss base +λ3*loss insert +λ4*loss lm
[0269] Specifically, loss geno is the genotype loss, loss base is the base change loss, loss insert is the insertion base type loss, loss lm is the mask loss, λ1 is the weight of genotype loss, λ2 is the weight of base change loss, λ3 is the weight of insertion base type loss, and λ4 is the weight of mask loss. As an example, in the experiment, λ1=1.0, λ2=0.1, λ3=0.1, and λ4=1.0 are set. Among them:
[0270] loss geno =cross_entropy(genotype_label,genotype_logits)
[0271] loss base =cross_entropy(base_label,base_logits)
[0272] loss insert =cross_entropy(insert_label,insert_logits)
[0273] loss lm =cross_entropy(masked_label,msa_logits)
[0274] Specifically, cross_entropy represents the cross entropy loss, genotype_label represents the sample genotype, genotype_logits represents the predicted genotype, base_label represents the sample base change, base_logits represents the predicted base change, insert_label represents the sample inserted base type, insert_logits represents the predicted inserted base type, masked_label represents the sample base type in the masked area, and msa_logits represents the predicted base type in the masked area.
[0275] In this embodiment, the training loss is obtained by performing a weighted summation based on genotype loss, inserted base type loss, base change loss and mask loss. In this way, the gene variation detection model is a multi-task model, which can fully characterize the gene variation of the sample variation site, making the gene variation detection result more comprehensive and accurate.
[0276] In some embodiments, the first sample MSA data of the first sample individual can be divided into training data and test data. The training data needs to be sampled in the sequencing data of the first sample individual with sample variation sites (positive samples) and the sequencing data without sample variation sites (negative samples) to prevent the difference in the number of positive samples and negative samples from being too large. The sampling is not performed on the test data, and the test data can be screened only according to the proportion of mutant bases, so that the test data is closer to the natural distribution.
[0277] Specifically, step 300 is implemented as step 302, step 304 and step 306:
[0278] Step 302, performing sampling on sequencing data of a first sample individual with a sample variation site and sequencing data of a first sample individual without a sample variation site to obtain first sample sequencing data;
[0279] Step 304, aligning the first sample sequencing data with the reference gene sequence to obtain first sample alignment data;
[0280] Step 306: Obtain first sample MSA data based on the first sample alignment data and the sample variation sites.
[0281] The various sequencing data of the first sample individual may be obtained from a plurality of public sequencing platforms, for example, ONT, Illumina, PacBio sequencing platforms; or, may be obtained from a public nucleic acid sequence database, for example, GenBank, EMBL, RefSeq database.
[0282] Exemplarily, the computer device performs sampling on the sequencing data of the first sample individual with the sample variation site (positive sample) and the sequencing data without the sample variation site (negative sample) to obtain the first sample sequencing data. The first sample sequencing data is aligned with the reference gene sequence to obtain the first sample alignment data; based on the first sample alignment data and the sample variation site, the sample alignment data is converted into sample MSA data to obtain the first sample MSA data.
[0283] In the method of this embodiment, the first sample sequencing data is converted into the first sample MSA data, in which only the base information and sequencing information of the sample variation site can be retained, which can reduce the amount of calculation of invalid areas, improve the processing efficiency of the first sample MSA data, and increase the fine-tuning training speed.
[0284] In some embodiments, the first sample MSA data of the first sample individual includes: the first sample sequence MSA data (Base MSA) of the sample variation site and the first sample insertion MSA data (Insertion MSA). The first sample sequence MSA data is used to characterize the base changes at the sample variation site, that is, the first sample sequence MSA data indicates the specific base type at the sample variation site, whether there is a deletion, and whether it is not detected. The first sample insertion MSA data is used to characterize the base insertion at the sample variation site, that is, if there is no insertion at the sample variation site, or, in the case where there is an insertion variation at the sample variation site, the insertion base type of the base inserted at the sample variation site.
[0285] Specifically, step 308 is implemented as step 3081, step 3082 and step 3083:
[0286] Step 3081, taking each sample variation site of the sample variation site as the center of the window, extracting the sample gene sequence in the window in the first sample alignment data, wherein each sample sequencing fragment in the sample gene sequence corresponds to at least one of base insertion information, base deletion information and base change information;
[0287] Step 3082, based on the base deletion information and base change information corresponding to each sample sequencing fragment in the sample gene sequence, determine the first sample sequence MSA data of each sample variation site; based on the base insertion information corresponding to each sample sequencing fragment in the sample gene sequence, determine the first sample insertion MSA data of each sample variation site;
[0288] Step 3083, combining the first sample sequence MSA data and the first sample insertion MSA data corresponding to each sample variation site of the sample variation site to obtain the first sample MSA data.
[0289] The window size is preset, and the window size is the same for different sample variation sites. The window depth is preset, and the window depth is the same for different sample variation sites. The window is expressed as [start, end], and the window size is expressed as window = end-start. The sample variation site is the center of the window, and the sample variation site is expressed as center = (start + end) / 2. The first sample alignment data can be a BAM file, and the first sample alignment data includes a sample gene sequence, each sample gene sequence includes one or more sample sequencing fragments (reads), and each sample sequencing fragment is stored in the BAM file in Cigar String format. Cigar String includes a series of operation codes, and each operation code is used to describe the detailed information of base insertion, base deletion, and base change when the sample sequencing fragment is aligned to the reference feature sequence.
[0290] Specifically, the computer device takes each sample variation site of the sample variation site as the center of the window, extracts the sample gene sequence in the window in the first sample alignment data, and the sample gene sequence outside the window will be truncated, and each sample sequencing fragment in the sample gene sequence corresponds to at least one of base insertion information, base deletion information, and base change information. Based on the base deletion information and base change information corresponding to each sample sequencing fragment in the sample gene sequence, the first sample sequence MSA data of each sample variation site is determined; based on the base insertion information corresponding to each sample sequencing fragment in the sample gene sequence, the first sample insertion MSA data of each sample variation site is determined; the first sample sequence MSA data and the first sample insertion MSA data corresponding to each sample variation site of the sample variation site are combined to obtain the first sample MSA data.
[0291] As an example, the MSA data of the first sample sequence of a sample variation site can be a matrix, represented as: base ∈N k×l , k represents the number of sample sequencing fragments (reads) located in the window, l represents the window size, M base The MSA data includes: letters A, G, C, T, U, and symbols "." or "-". Letters A, G, C, T, and U represent the specific base types of the sample variant site, the symbol "-" indicates that the sample variant site is deleted, and the symbol "." indicates that the sample variant site is not detected and belongs to a GAP. The first sample insertion MSA data of a sample variant site can be a matrix, represented as M ins ∈N k×l , k represents the number of sample sequencing fragments (reads) located in the window, l represents the window size, M insThe includes: letters A, G, C, T, U or the symbol ".". Letters A, G, C, T, U represent the type of inserted bases at the sample variant site, and the symbol "." indicates that there is no insertion at the sample variant site. In the specific example, the window size is 129 and the maximum depth is 64.
[0292] In some embodiments, after obtaining the first sample sequence MSA data and the first sample insertion MSA data corresponding to each sample variation site, the sample sequencing fragments (reads) in the first sample sequence MSA data and the first sample insertion MSA data are also converted row by row into corresponding base encoding values (IDs) according to the sorting in the first sample alignment data. The IDs may be in digital form. Next, the first sample sequence MSA data and the first sample insertion MSA data corresponding to each sample variation site of the sample variation site are combined to obtain the first sample MSA data.
[0293] This embodiment provides a method for determining the first sample MSA data. The first sample MSA data includes the first sample sequence MSA data and the first sample insertion MSA data, so that the base insertion, deletion, and change of each sample variation site can be retained to improve the model accuracy, and the first sample MSA data can be simplified to avoid excessive memory usage during training and improve the training speed.
[0294] (2) Basic model training phase
[0295] In some embodiments, the basic model layer in the gene variation detection model includes: a feature extraction unit (USM Block) stacked in the pre-trained basic model. The basic model is a unified sequence model (USM) for extracting MSA features.
[0296] In some embodiments, the basic model includes: a third encoding layer (Embedding), a stacked feature extraction unit (USM Block), and a second conversion layer (LM Head), the third encoding layer is cascaded with the feature extraction unit, and the feature extraction unit is cascaded with the second conversion layer. The number of stacked feature extraction units is N, and N is greater than or equal to 1.
[0297] In some embodiments, the third encoding layer of the base model includes: a first sub-encoding layer (MSAEmbedding) and a second sub-encoding layer (Geno Position Embedding) connected in parallel; wherein the model parameters of the first encoding layer of the gene variation detection model are the same as the model parameters of the first sub-encoding layer in the third encoding layer of the pre-trained base model. The third encoding layer is used to encode the sample encoding features of the second sample MSA data; the sample encoding features are obtained by concatenating the first sub-sample encoding features and the second sub-sample encoding features, and the first sub-encoding layer is used to encode the first sub-sample encoding features of the second sample MSA data; the second sub-encoding layer is used to encode the second sub-sample encoding features of the sample position data corresponding to the sample candidate sites in the second sample MSA data.
[0298] In some embodiments, the training phase of the base model is performed by a computer device, which may be Figure 2 The terminal 120 and / or the server 140 shown, before step 220 and / or step 300, further includes at least some of steps 400, 420, 440, 460, and 480:
[0299] Step 400: Acquire second sample MSA data of a second sample individual, where the second sample MSA data includes sample base information and sample sequencing information of sample candidate sites.
[0300] The second sample individual in the training phase of the basic model is consistent with the first sample individual in the training phase of the gene variation detection model and the individual in the application phase. Generally, the second sample individual is also a human individual. The sample candidate site is a sample gene site that meets the screening conditions among the sample gene sites.
[0301] The second sample MSA data is obtained by comparing the sample sequencing data obtained by gene sequencing of the second sample individual with the reference gene sequence. The reference gene sequence is a standard version of the gene sequence of an individual, which is integrated based on gene sequencing and analysis of multiple individuals.
[0302] Exemplarily, the computer device obtains the second sample MSA data of the second sample individual, and the second sample MSA data includes the sample base information and sample sequencing information of the sample candidate site. In some embodiments, a sequencing device is used to perform gene sequencing on the second sample individual to obtain a sample sequencing signal. The sample sequencing signal is an electrical signal or an optical signal, and the sample sequencing signal needs to be converted into an analyzable gene sequence, that is, sample sequencing data, and then the second sample MSA data of the second sample individual is generated based on the sample sequencing data.
[0303] The second sample MSA data of the second sample individual may be generated by: performing base calling on the original sample sequencing signal, the base calling is used to convert the sample sequencing signal generated by the sequencing device into the original sample sequencing data, so as to obtain the original sample sequencing data; performing sequence quality control on the original sample sequencing data, the sequence quality control is used to filter, prune and evaluate the original sample sequencing data, so as to obtain processed sample sequencing data, wherein the sequence quality control may also be used as an optional step; next, performing sequence alignment on the processed sample sequencing data, the sequence alignment is used to align the processed sample sequencing data with the reference gene sequence, so as to obtain alignment data; based on the sample variation sites and the sample alignment data, the second sample MSA data of the second sample individual is obtained.
[0304] Step 420: Encode the sample encoding features of the second sample MSA data based on the third encoding layer.
[0305] Exemplarily, the computer device encodes the sample coding features of the second sample MSA data based on the third coding layer (Embedding).
[0306] Step 440: Based on the feature extraction unit, perform self-attention calculation on the sample coding feature to obtain a second sample MSA feature corresponding to the sample coding feature.
[0307] Exemplarily, the computer device performs self-attention calculation on the sample coding feature based on the feature extraction unit to obtain the second sample MSA feature corresponding to the sample coding feature. Since the self-attention calculation is used to capture and learn the key parts in the rows and columns of the sample gene sequence, the second sample MSA feature can characterize the second sample MSA data of the second sample individual from different dimensions of rows and columns.
[0308] In one possible implementation, the basic model includes N stacked feature extraction units, and the structure and calculation operations of each of the N feature extraction units are consistent. It can be based on each of the N feature extraction units, continuing to perform self-attention calculation on the output result of the previous feature extraction unit, and using the output result of the Nth feature extraction unit as the second sample MSA feature.
[0309] Specifically, for the first feature extraction unit among the N feature extraction units, based on the first feature extraction unit, a self-attention calculation is performed on the sample coding feature to obtain the first output result. For the i-th feature extraction unit among the N feature extraction units, based on the i-th feature extraction unit, a self-attention calculation is performed on the i-1-th output result to obtain the i-th output result. i is updated to i+1 and the above steps are repeated until i equals N, and the N-th output result is used as the second sample MSA feature corresponding to the sample coding feature. Wherein, N is greater than or equal to 1, i is greater than or equal to 1, and i is less than or equal to N.
[0310] Step 460: Based on the second conversion layer, convert the second sample MSA features to obtain second predicted MSA data, where the second predicted MSA data includes predicted base information of the sample candidate sites.
[0311] Exemplarily, the computer device converts the second sample MSA feature based on the second conversion layer to obtain the second predicted MSA data, and the second predicted MSA data includes the predicted base information of the sample candidate site, and the predicted base information is the predicted base type of the sample candidate site. The second conversion layer (LM Head) in the basic model is used for mask learning. Among them, mask learning refers to randomly replacing a part of the region in the input sequence with a mask, so that the basic model predicts the base type in the masked mask region to help the basic model learn a better contextual representation of the sample gene sequence.
[0312] In one implementation, the mask learning method is dynamic masking (Mask Token), which specifically includes: one or a combination of column masking and global random masking. Column masking refers to randomly masking the entire column. Since column masking is difficult to learn, a smaller ratio is used in the training phase. In one example, the column mask ratio is set to 0.05. Global random masking means randomly masking a single character (Token). As the training progresses, the ratio of the global random mask is set from high to low. In one example, the ratio of the global random mask is set from 0.3 to 0.15.
[0313] Step 480, adjusting the model parameters of the basic model with the training goal of reducing the difference between the predicted base information in the second predicted MSA data and the sample base information in the second sample MSA data.
[0314] Exemplarily, the computer device adjusts the model parameters of the base model with the training goal of reducing the difference between the predicted base information in the second predicted MSA data and the sample base information in the second sample MSA data. In one implementation, the model parameters of the third encoding layer, the feature extraction unit, the first conversion layer, the first classifier, the second classifier, and the third classifier are adjusted.
[0315] This embodiment provides a training step for a basic model, provides support for pre-training of the basic model, and provides support for training of a gene variation detection model. The basic model can improve the accuracy of the extracted MSA features through pre-training.
[0316] In some embodiments, step 440 is implemented as step 442, step 444, and step 446:
[0317] Step 442, based on the feature extraction unit, performing column attention calculation on the sample encoding feature to obtain a sample column attention feature;
[0318] Step 444, performing pooling on the sample column attention features in the column direction to obtain sample column pooling features;
[0319] Step 446, perform row attention calculation on the sample column pooling features to obtain the second sample MSA features.
[0320] Self-attention calculation includes: column attention calculation and row attention calculation. Since the row of the second sample MSA data represents the sample gene sequence, a sample gene sequence includes one or more sample sequencing fragments (reads), and the column represents the sample candidate site, the sample candidate sites in the same column have the same corresponding position on the chromosome. Column attention calculation is used to learn the relevant information of the bases aligned at the same position, and row attention calculation is used to learn the relevant information of the relationship between one or more sample sequencing fragments of each sample gene sequence. The second sample MSA data has a lower amount of information in the column direction and a higher amount of information in the row direction.
[0321] Exemplarily, taking a feature extraction unit as an example, the computer device performs column attention calculation on the sample encoding feature based on the feature extraction unit to obtain the sample column attention feature; performs pooling on the sample column attention feature in the column direction, and the pooling method includes at least one of average pooling, maximum pooling, and random pooling. This embodiment adopts average pooling, also known as column pooling, to obtain the sample column pooling feature; performs row attention calculation on the sample column pooling feature to obtain the second sample MSA feature. In this way, the second sample MSA feature can fully characterize the second sample MSA data of the second sample individual from the two dimensions of row and column.
[0322] The method of this embodiment fully learns the information in the sample encoding features from the dimensions of rows and columns, and fully characterizes the second sample MSA data based on the attention mechanism, which can improve the accuracy of the second sample MSA features.
[0323] In some embodiments, step 460 is implemented as step 462 and step 464:
[0324] Step 462, performing random masking on at least a portion of the mask area in the second sample MSA feature to obtain a sample MSA mask feature, wherein the at least a portion of the mask area includes at least a portion of the columns and at least a portion of the single characters in the second sample MSA feature;
[0325] Step 464: Based on the second conversion layer, predict the predicted base type in at least a portion of the mask region of the sample MSA mask feature to obtain second predicted MSA data.
[0326] During the training phase of the basic model, the second conversion layer (LM Head) in the basic model is used for mask learning. The mask learning method is dynamic mask (Mask Token), which specifically includes: one of column mask and global random mask or a combination of the two. This embodiment takes the combination of the two as an example. Column mask refers to randomly masking the entire column. Since the learning difficulty of column mask is relatively large, a smaller ratio is used in the training phase. In one example, the column mask ratio is set to 0.05. Global random masking means randomly masking a single character (Token). As the training progresses, the ratio of the global random mask is set from high to low. In one example, the ratio of the global random mask is set from 0.3 to 0.15.
[0327] Exemplarily, the computer device performs random masking on at least a portion of the mask area in the second sample MSA feature to obtain a sample MSA mask feature, wherein at least a portion of the mask area includes at least a portion of the columns and at least a portion of the single characters (Tokens) in the second sample MSA feature; based on the second conversion layer, the predicted base type in at least a portion of the mask area of the sample MSA mask feature is predicted to obtain second predicted MSA data.
[0328] This embodiment provides a pre-training method for the basic model. This dynamic masking method has the characteristics of self-supervised learning. By randomly masking some mask areas and predicting the base types in these mask areas, it can fully learn the semantic relationship and context dependency between bases, and can improve the model accuracy and generalization performance of the basic model.
[0329] In some embodiments, for obtaining the second sample MSA data of the second sample individual, step 400 is implemented as steps 402, 404, 406, and 408:
[0330] Step 402, obtaining second sample sequencing data of a second sample individual;
[0331] Step 404, aligning the second sample sequencing data with the reference gene sequence to obtain second sample alignment data;
[0332] Step 406, determining the sample candidate sites that meet the screening conditions in the second sample alignment data;
[0333] Step 408: Determine the second sample MSA data based on the second sample alignment data and the sample candidate sites.
[0334] The second sample sequencing data of the second sample individual may be obtained from a plurality of public sequencing platforms, for example, ONT, Illumina, PacBio sequencing platforms; or, may be obtained from a public nucleic acid sequence database, for example, GenBank, EMBL, RefSeq database.
[0335] Exemplarily, a computer device obtains second sample sequencing data of a second sample individual; aligns the second sample sequencing data with a reference gene sequence to obtain second sample alignment data; determines sample candidate sites that meet a screening condition in the second sample alignment data; and based on the second sample alignment data and the sample candidate sites, converts the second sample alignment data into second sample MSA data to obtain second sample MSA data.
[0336] In some embodiments, the sample candidate sites that meet the screening conditions include at least one of the following: sample gene sites that are different from the reference gene sequence; sample gene sites whose alignment quality value is greater than or equal to the first threshold; sample gene sites whose coverage is greater than or equal to the second threshold; sample gene sites whose minor allele frequency is greater than or equal to the third threshold. The first threshold, the second threshold, and the third threshold can be set according to actual technical needs. In one example, the first threshold is 20, the second threshold is 10, and the third threshold is 0.1.
[0337] In the method of this embodiment, the second sample sequencing data is converted into second sample MSA data, and the second sample MSA data can only retain the sample base information and sample sequencing information of the sample candidate site, which can reduce the amount of calculation of invalid areas, improve the processing efficiency of the second sample MSA data, and improve the training speed of the basic model.
[0338] In some embodiments, the second sample MSA data of the second sample individual includes: the second sample sequence MSA data (Base MSA) and the second sample insertion MSA data (Insertion MSA) of the sample candidate site. The second sample sequence MSA data is used to characterize the base variation of the sample candidate site, that is, the second sample sequence MSA data indicates the specific base type, whether there is a deletion, and whether it is not detected at the sample candidate site. The second sample insertion MSA data is used to characterize the base insertion of the sample candidate site, that is, the absence of an insertion at the sample candidate site, or, in the case where there is an insertion variation at the sample candidate site, the insertion base type of the base inserted at the sample candidate site.
[0339] Specifically, step 408 is implemented as step 4081, step 4082, and step 4083:
[0340] Step 4081, taking each sample candidate site of the sample candidate sites as the center of the window, extracting the sample gene sequence in the window in the second sample alignment data, each sample sequencing fragment in the sample gene sequence corresponds to at least one of base insertion information, base deletion information and base change information;
[0341] Step 4082, based on the base deletion information and base change information corresponding to each sample sequencing fragment in the sample gene sequence, determine the second sample sequence MSA data of each sample candidate site, based on the base insertion information corresponding to each sample sequencing fragment in the sample gene sequence, determine the second sample insertion MSA data of each sample candidate site;
[0342] Step 4083, combining the second sample sequence MSA data corresponding to each sample candidate site of the sample candidate site and the second sample insertion MSA data to obtain the second sample MSA data.
[0343] The window size is preset, and the window size is the same for different sample candidate sites. The window is expressed as [start, end], and the window size is expressed as window = end-start. The window depth is preset, and the window depth is the same for different sample candidate sites. The sample candidate site is the center of the window, and the sample candidate site is expressed as center = (start + end) / 2. The second sample alignment data can be a BAM file, and the second sample alignment data includes a sample gene sequence, each sample gene sequence includes one or more sample sequencing fragments (reads), and each sample sequencing fragment is stored in the BAM file in Cigar String format. Cigar String includes a series of operation codes, and each operation code is used to describe the detailed information of base insertion, base deletion, and base change when the sample sequencing fragment is aligned to the reference feature sequence.
[0344] Specifically, the computer device takes each sample candidate site of the sample candidate site as the center of the window, extracts the sample gene sequence in the window in the second sample alignment data, and the sample gene sequence outside the window will be truncated, and each sample sequencing fragment in the sample gene sequence corresponds to at least one of base insertion information, base deletion information, and base change information. Based on the base deletion information and base change information corresponding to each sample sequencing fragment in the sample gene sequence, the second sample sequence MSA data of each sample candidate site is determined, and based on the base insertion information corresponding to each sample sequencing fragment in the sample gene sequence, the second sample insertion MSA data of each sample candidate site is determined; the second sample sequence MSA data corresponding to each sample candidate site of the sample candidate site and the second sample insertion MSA data are combined to obtain the second sample MSA data.
[0345] As an example, the second sample sequence MSA data of a sample candidate site can be a matrix, represented as: base ∈N k×l , k represents the number of sample sequencing fragments (reads) located in the window, l represents the window size, M base The MSA data includes: letters A, G, C, T, U, and symbols "." or "-". Letters A, G, C, T, and U represent specific base types of sample candidate sites, the symbol "-" indicates that the sample candidate site is deleted, and the symbol "." indicates that the sample candidate site is not detected and belongs to a GAP. The second sample insertion MSA data of a sample candidate site can be a matrix, represented as M ins ∈N k×l , k represents the number of sample sequencing fragments (reads) located in the window, l represents the window size, M ins The '.' includes: letters A, G, C, T, U or the symbol ".". Letters A, G, C, T, U represent the type of inserted bases at the sample candidate site, and the symbol "." indicates that there is no insertion at the sample candidate site. In the specific example, the window size is 129 and the maximum depth is 64.
[0346] In some embodiments, after obtaining the second sample sequence MSA data and the second sample insertion MSA data corresponding to each sample candidate site, the second sample sequence MSA data and the sample sequencing fragments (reads) in the second sample insertion MSA data are also converted row by row into corresponding base encoding values (IDs) according to the sorting in the second sample alignment data. The IDs may be in digital form. Next, the second sample sequence MSA data and the second sample insertion MSA data corresponding to each sample candidate site of the sample candidate site are combined to obtain the second sample MSA data.
[0347] This embodiment provides a method for determining the second sample MSA data. The second sample MSA data includes the second sample sequence MSA data and the second sample insertion MSA data, so that the base insertion, deletion, and change of each sample candidate site can be retained to improve the accuracy of feature extraction, and the second sample MSA data can be simplified to avoid excessive memory usage during training and improve the training speed.
[0348] In some embodiments, when the input data of the basic model is the second sample MSA data, and the sample position data (Gene Position) corresponding to the sample candidate site in the second sample MSA data, the third coding layer (Embedding) of the basic model includes: a first sub-coding layer (MSA Embedding) and a second sub-coding layer (Gene Position Embedding) in parallel; wherein, the model parameters of the first coding layer (MSA Embedding) of the gene variation detection model are the same as the model parameters of the first sub-coding layer (MSA Embedding) in the third coding layer of the pre-trained basic model, and the corresponding model parameters can be directly migrated for use.
[0349] The sample coding features of the second sample MSA data include: the first sub-sample coding features and the second sub-sample coding features. Specifically, step 420 is implemented as steps 421, 422, 423 and 424:
[0350] Step 421, encoding a first sub-sample coding feature of the second sample MSA data based on a first sub-coding layer in a third coding layer;
[0351] Step 422, obtaining sample position data corresponding to the sample candidate site in the second sample MSA data;
[0352] Step 423, encoding a second sub-sample encoding feature of the sample position data based on the second sub-encoding layer in the third encoding layer;
[0353] Step 424: concatenate the first sub-sample coding feature and the second sub-sample coding feature to obtain a sample coding feature.
[0354] The sample position data refers to the position corresponding to the sample candidate site. Optionally, the sample position data includes at least one of the chromosome position and the intra-chromosomal position, then the second sub-sample coding feature includes at least one of the chromosome position coding feature and the intra-chromosomal position coding feature. When both the chromosome position coding feature and the intra-chromosomal position coding feature are included, the second sub-sample coding feature is obtained by splicing. The feature splicing method includes at least one of the following: column splicing, row splicing, element splicing, addition, multiplication, dot product, which can be selected according to actual technical needs. In this embodiment, the feature splicing method includes addition.
[0355] Exemplarily, the computer device encodes a first sub-sample coding feature of the second sample MSA data based on the first sub-coding layer in the third coding layer; obtains sample position data corresponding to the sample candidate site in the second sample MSA data; and encodes a second sub-sample coding feature of the sample position data based on the second sub-coding layer in the third coding layer, wherein when the sample position data includes both the chromosome position and the intra-chromosomal position, the chromosome position feature corresponding to the chromosome position is encoded respectively, and the intra-chromosomal position feature corresponding to the intra-chromosomal position is encoded, and the chromosome position feature and the intra-chromosomal position feature are added to obtain the second sub-sample coding feature; the first sub-sample coding feature and the second sub-sample coding feature are added to concatenate the first sub-sample coding feature and the second sub-sample coding feature to obtain the sample coding feature.
[0356] This embodiment provides a coding method for sample coding features, which may optionally include relevant information of sample location data. When the sample coding features are input to the feature extraction layer of the basic model to perform further feature extraction, more comprehensive data support is provided for subsequent feature extraction.
[0357] Next, the gene variation detection method provided in the embodiments of the present application is generally described.
[0358] 1. Training phase
[0359] The training phase mainly includes: 1. Data processing; 2. Basic model training; 3. Gene variant detection model training. Among them, the basic model is also called the MSA basic model, which is determined based on the Unified Sequence Model (USM), and the training of the basic model can also be called pre-training. The gene variant detection model is also called the MSA variant caller or the germline MSA variant caller, and the training of the gene variant detection model can also be called fine-tuning training.
[0360] 1. Data processing
[0361] Data processing includes: 1.1 screening of suspicious sites; 1.2 conversion of aligned data into MSA data; 1.3 construction of pre-training dataset; 1.4 construction of fine-tuning training dataset.
[0362] 1.1 Screening of suspicious sites
[0363] Suspicious sites can also be understood as gene sites that may have mutations. After aligning the original sequencing data of an individual with the reference gene sequence, alignment data is obtained. The alignment data contains the base information and sequencing information corresponding to each gene site. These alignment data can be simply divided into: unmutated areas, noise areas, and mutated areas. Among them, for the unmutated areas, this part of the gene sequence is exactly the same as the reference gene sequence, and its base information and sequencing information are redundant, and the value of training the model in the training phase is not great. For the noise area, there are a small number of base changes in the column where this part of the gene site is located, which is caused by sequencing system errors and alignment errors, and its alignment quality value (Mapping Quality) is usually relatively low. By screening out suspicious sites, the amount of calculation of invalid areas can be reduced during pre-training and testing.
[0364] In this example, the following conditions were used to screen various gene loci to obtain suspicious loci.
[0365] A) Filter out loci that are identical to the reference gene;
[0366] B) Filter loci with alignment quality values less than 20;
[0367] C) Filter loci with coverage less than 10;
[0368] D) Filter out loci with minor allele frequency less than 0.1, most of which are noise loci.
[0369] 1.2 Alignment data converted to MSA data
[0370] The alignment data is a BAM file. With the candidate site as the center of the window, extract all sequencing fragments (reads) in a window [start, end] located in the BAM file. The center of start and end is center = (start + end) / 2, which is the position of the candidate site, and the window size is window = end-start. Each sequencing fragment is stored in the BAM file in Cigar String format. Cigar String includes a series of operation codes, each of which is used to describe the detailed information of base insertion, base deletion, and base change when the sequencing fragment is aligned to the reference feature sequence.
[0371] Create the matrix M base ∈N k×land M ins ∈N k×l Among them, M base Record base changes, M ins Record the insertion changes. k represents the number of sequencing fragments (reads) within the window, l represents the window size, and the gene sequence outside the window will be truncated. base The letters A, G, C, T, U, and the symbol "." or "-" are included. The letters A, G, C, T, and U represent the specific base types of the candidate sites, the symbol "-" indicates that the candidate site is deleted, and the symbol "." indicates that the candidate site is not detected and belongs to a GAP. ins The letters A, G, C, T, U or the symbol "." are included. The letters A, G, C, T, and U represent the insertion base type of the candidate site, and the symbol "." indicates that there is no insertion at the candidate site. The sequencing fragments (reads) are converted into corresponding base encoding values (IDs) line by line according to the order in the BAM file, which can be in digital form. At this point, the M of each candidate site is obtained. base and M ins , combined to obtain MSA data.
[0372] 1.3 Pre-training dataset construction
[0373] The pre-training data is constructed based on two parts: the human reference genome and the human whole genome sequencing data. The human reference genome is also called the reference gene sequence, and the human whole genome sequencing data is referred to as sequencing data. The human reference genome uses the HG38 reference sequence, which is truncated to a length of 1024BP and used as single sequence pre-training data, which can be optionally placed in the first line of the MSA data converted from the sequencing data. The human whole genome sequencing data is obtained from multiple public sequencing platforms, such as ONT, Illumina, and PacBio platforms; or, it is obtained from public nucleic acid sequence databases, such as GenBank, EMBL, and RefSeq databases, and MSA pre-training data is constructed based on this.
[0374] The sequencing data is screened through 1.1 suspicious sites and converted into MSA data through 1.2 to obtain MSA pre-training data. In one example, the window size is 129 and the maximum depth is 64. MSA data exceeding the maximum depth will be truncated to avoid excessive memory usage during training. MSA pre-training data and single sequence pre-training data are alternately iterated during the training process to improve the generalization of the basic model.
[0375] 1.4 Fine-tuning training data set construction
[0376] The fine-tuning data uses high-confidence variant sites in the human genome. At the same time, for the fine-tuning training data, it is necessary to perform sampling on the non-mutated sites (negative samples) based on the candidate sites with mutations (positive samples) to prevent a large difference in the number of positive and negative samples. For the test data, you can only screen based on the proportion of mutant bases, without performing positive and negative sample sampling, so that the test data is close to the natural distribution. It should also be noted that the fine-tuning training data set is constructed in the same way as the pre-training data set. The suspicious sites can be replaced with high-confidence variant sites in the human genome, and the conversion to MSA data is the same.
[0377] 2. Training of basic models
[0378] 2.1 Model Structure
[0379] refer to Figure 5 , the basic model is the Unified Sequence Model (USM). The basic model includes: a third coding layer (Embedding), a stacked feature extraction unit (USM Block), and a second conversion layer (LM Head). The third coding layer is cascaded with the feature extraction unit, and the feature extraction unit is cascaded with the second conversion layer. There are N stacked feature extraction units, N is greater than or equal to 1, and the structure and calculation operation of each feature extraction unit in the N feature extraction units are consistent. When the input data of the basic model also includes sample position data (Gene Position), the third coding layer of the basic model includes: a first sub-coding layer (MSA Embedding) and a second sub-coding layer (Geno Position Embedding) connected in parallel.
[0380] 2.2 Training method
[0381] (1) The first sub-coding layer (MSA Embedding) is used to encode MSA data and is implemented using the standard Embedding layer. The second sub-coding layer (Gene Position Embedding) is optional. When the position data of the gene locus is input, the output of the second sub-coding layer is added to the output of the first sub-coding layer and then input into the stacked N feature extraction units (USM Block). Among them, the position data includes chromosome position and intra-chromosomal position. The chromosome position encoding is implemented using the standard Embedding layer, and the intra-chromosomal position encoding is implemented using the Linear layer.
[0382] (2) The stacked N feature extraction units (USM Block) are used to extract MSA features based on self-attention calculation, which includes column attention calculation and row attention calculation. The input features are calculated through column attention to learn the information of bases aligned at the same position. Since the amount of information in the column direction of MSA data is low, after the column attention calculation is completed, the column attention features are averaged and pooled in the column direction, which is called column pooling. The average pooled features are further extracted through row attention calculation.
[0383] (3) Pre-training method: The pre-training of the basic model adopts the dynamic mask (Mask Token) method, which combines two masking schemes: column masking and global random masking. Column masking refers to randomly masking the entire column. Since column masking is difficult to learn, a smaller ratio is used during training, set to 5%. Global random masking operation refers to dynamically randomly masking a single character (Token). As the training progresses, the ratio is set from high to low, from 0.3 to 0.15.
[0384] 3. Training of gene mutation detection model
[0385] 3.1 Model Structure
[0386] refer to Fig. 9 The gene variation detection model for executing the gene variation detection method includes: a first encoding layer (MSAEmbedding), a second encoding layer (Sequence Embedding), a base model layer (USM Core), a first conversion layer (Variant Layer), a second conversion layer (LM Head), a first classifier (Genotype Classifier), a second classifier (Insertion Classifier) and a third classifier (Base Change Classifier).
[0387] The first encoding layer is connected in parallel with the second encoding layer. The first encoding layer and the second encoder are cascaded with the basic model layer respectively. The basic model layer is cascaded with the first conversion layer and the second conversion layer, and the first conversion layer is connected in parallel with the second conversion layer. The first conversion layer is cascaded with the first classifier, the second classifier and the third classifier respectively, and the first classifier, the second classifier and the third classifier are connected in parallel. The first classifier is used to predict the genotype (Genotype) of the candidate site, the second classifier is used to predict the insertion base type (Insertion) of the candidate site, and the third classifier is used to predict the base change (BaseChange) of the candidate site.
[0388] The model parameters of the first encoding layer (MSA Embedding) of the gene mutation detection model are the same as the model parameters of the first sub-encoding layer (MSA Embedding) of the pre-trained basic model. The model parameters of the basic model layer (USM Core) are the same as the model parameters of the stacked N feature extraction layers (USM Block) of the pre-trained basic model.
[0389] 3.2 Training method
[0390] The gene variation detection model is obtained by further fine-tuning the pre-trained basic model, which adds additional feature encoding. For the gene variation detection model, its feature encoding includes two parts: alignment feature and profile feature. Alignment feature is used to characterize the features of MSA shape, base information and sequencing information. Profile feature is used to characterize the global and statistical features of sequence shape, and the statistical information corresponding to base information and sequencing information.
[0391] refer to Fig. 9, the alignment feature (Alignment Feature) includes: sequence MSA data (Base MSA), insertion MSA data (Insertion MSA), the mapping quality value of each base (Mapping Quality), the base quality value during base calling (Base Quality), and the positive and negative strand information (Strand Info) during gene sequencing. Among them, the sequence MSA data and the insertion MSA data are spliced together with the base quality value, the mapping quality value, and the positive and negative strand information through the one-hot encoding method (One-Hot Encoding) to synthesize a complete alignment feature, which is encoded through the first encoding layer (MSA Embedding). The profile feature (Profile Feature) includes: reference gene sequence (Reference Sequence), base ratio (MSA Profile), and average insertion length (Insertion Length Mean). The reference gene sequence is encoded by one-hot encoding. The base ratio is the ratio of bases such as A, G, C, T, and U. The average insertion length is the average insertion length of the current gene locus. The average insertion length can be transformed using the 2 / πarctan d / 3 transformation to transform any real number d to the value range of [0,1]. After all contour features are concatenated, they are encoded through the second encoding layer (Sequence Embedding). The first encoding layer (MSA Embedding) and the second encoding layer (Sequence Embedding) are both Linear layers. After the output results of the two are added, the features are further extracted through the basic model layer (USM Core). The above-mentioned input information can be obtained based on the alignment data of gene sequencing and the matching of the reference gene sequence. The alignment data is a BAM file.
[0392] The MSA feature representation output by the base model layer (USM Core) is: L represents the window size, N represents the window depth, the maximum depth is 64, and D represents the feature dimension. Take the first line of MSA features corresponding to the first line of gene sequences in the MSA data, pass through the first conversion layer (Variant Layer), and predict the genotype corresponding to the gene locus through the first classifier, that is, the variation type of the gene locus in the center of the window, including: 0 / 0 no mutation, 0 / 1 heterozygous mutation, 1 / 1 homozygous mutation, 1 / 2 compound mutation, 1 / 2 compound mutation refers to the simultaneous occurrence of single base substitution mutation (SNP) and base insertion or deletion mutation (INDEL); predict the insertion base type of the base inserted in the gene locus through the second classifier; predict the base change through the third classifier, if 0 / 0 no mutation, then output the reference base, if 0 / 1 heterozygous mutation, 1 / 1 homozygous mutation, 1 / 2 compound mutation, then output the changed base. The first conversion layer is a linear layer. The first classifier, the second classifier, and the third classifier are all MLP layers composed of two linear layers and the activation function Relu. In order to maintain the ability of self-supervised learning, the retained pre-trained second conversion layer (LM Head) is used for mask learning.
[0393] The training loss of the gene mutation detection model can be expressed as cross entropy loss:
[0394] loss = λ1*loss geno +λ2*loss base +λ3*loss insert +λ4*loss lm
[0395] Specifically, loss geno is the genotype loss, loss base is the base change loss, loss insert is the insertion base type loss, loss lm is the mask loss, λ1 is the weight of genotype loss, λ2 is the weight of base change loss, λ3 is the weight of insertion base type loss, and λ4 is the weight of mask loss. As an example, in the experiment, λ1=1.0, λ2=0.1, λ3=0.1, and λ4=1.0 are set. Among them:
[0396] loss geno =cross_entropy(genotype_label,genotype_logits)
[0397] loss base =cross_entropy(base_label,base_logits)
[0398] lossinsert =cross_entropy(insert_label,insert_logits)
[0399] loss lm =cross_entropy(masked_label,msa_logits)
[0400] Specifically, cross_entropy represents the cross entropy loss, genotype_label represents the sample genotype, genotype_logits represents the predicted genotype, base_label represents the sample base change, base_logits represents the predicted base change, insert_label represents the sample inserted base type, insert_logits represents the predicted inserted base type, masked_label represents the sample base type in the masked area, and msa_logits represents the predicted base type in the masked area.
[0401] (II) Application stage
[0402] The gene variation detection model provided in the embodiments of the present application has at least the following application scenarios:
[0403] 1. Application scenario: gene mutation detection
[0404] refer to Fig.10 , the computer device stores the gene variation detection model. Next, 1. the computer device obtains the sequencing signal of the gene sequencing of the individual; 2. base calling is performed in sequence; 3. sequence quality control, base calling and sequence quality control are performed to obtain Fastq files; 4. sequence alignment, sequence alignment is performed to obtain BAM files; 5. post-processing, to obtain the MSA data of the individual; 6. the MSA data of the individual is input into the gene variation detection model; 7. the gene variation detection result is obtained based on the gene variation detection model, and the gene variation detection result is a VCF file; 8. tertiary analysis is performed, for example, detecting disease information.
[0405] 2. Application scenario: early cancer screening
[0406] refer to Fig.11, the computer device stores the gene variation detection model. Next, 1. perform gene sequencing on the individual to obtain sequencing data; 2. perform data processing on the sequencing data, such as base calling, sequence quality control, sequence alignment, and post-processing to obtain MSA data; 3. the gene variation detection model scans known cancer candidate sites related to cancer; 4. combine the MSA data and cancer candidate sites, use the gene variation detection model to obtain the gene variation detection results, and, combine 5. clinical information, 6. imaging omics information, 7. other omics information, use 8. cancer discrimination model to obtain cancer gene detection results. Among them, the cancer discrimination model is implemented by: a machine learning model based on a gradient boosting tree (CatBoost) and a deep learning model dedicated to processing structured tabular data (TabNet).
[0407] (III) Performance comparison
[0408] Referring to Table 1, the prediction accuracy of the Unified Sequence Model (USM), the deep learning-based variant identification model (DeepVariant), and the variant detection model (Clair3) are compared. These three models were trained on the first 19 chromosomes of the HG001 individual and tested on the 20th chromosome. The input information of these three models is MSA data. It can be seen that the prediction accuracy of the USM model for various data types is higher than that of the DeepVariant and Clair3 models.
[0409] Table 1 Comparison results
[0410]
[0411] The performance of the USM model, the Clair3-FA model of the variation detection model (Clair3) series, and the Clair3-PU model at different sequencing depths can be referenced. Fig.12 , Fig.12 (1) shows the performance of these three models in processing single-base substitution mutation data at different sequencing depths. Fig.12 (2) in Figure 2 shows the performance of these three models in processing base insertion or deletion mutation data at different sequencing depths. Generally speaking, the greater the sequencing depth, the higher the cost. At lower sequencing depths, the USM model performs better.
[0412] Fig.13 800 is a block diagram of a gene variation detection device provided by an exemplary embodiment of the present application. The gene variation detection device 800 includes: an acquisition module 820, an encoding module 840, an extraction model 860, and at least some of the modules in a mapping module 880.
[0413] An acquisition module 820 is used to acquire MSA data of an individual, wherein the MSA data includes base information and sequencing information of a candidate site in a gene site;
[0414] An encoding module 840, configured to encode comparison features of the MSA data and to encode profile features of the MSA data, wherein the comparison features are used to characterize the base information and the sequencing information, and the profile features are used to characterize statistical information corresponding to the base information and the sequencing information;
[0415] An extraction module 860, configured to extract MSA features corresponding to the comparison features and the contour features;
[0416] The mapping module 880 is used to map the MSA features to obtain the gene variation detection results of the MSA data relative to the reference gene sequence.
[0417] In some embodiments, the extraction module 860 is used to:
[0418] Splicing the comparison feature and the contour feature to obtain a splicing feature;
[0419] A self-attention calculation is performed on the concatenated features to obtain the MSA features.
[0420] In some embodiments, the extraction module 860 is used to:
[0421] Perform column attention calculation on the concatenated features to obtain column attention features;
[0422] Perform pooling on the column attention features in the column direction to obtain column pooling features;
[0423] The column pooling features are subjected to row attention calculation to obtain the MSA features.
[0424] In some embodiments, the mapping module 880 is used to:
[0425] Converting the MSA feature to obtain an MSA conversion feature;
[0426] Perform prediction based on the MSA conversion feature to obtain a gene variation detection result of the MSA data relative to the reference gene sequence;
[0427] The gene variation detection result includes at least one of the genotype, the inserted base type and the base change of the candidate site.
[0428] In some embodiments, the MSA data is obtained by aligning the sequencing data of the individual with the reference gene sequence, and the first line of gene sequence in the MSA data includes the reference gene sequence;
[0429] The mapping module 880 is used to:
[0430] Extracting a first row of MSA conversion features from the MSA conversion features, where the first row of MSA conversion features is used to characterize the global features corresponding to the candidate sites;
[0431] Prediction is performed on the first row of MSA conversion features to obtain a gene variation detection result of the MSA data relative to the reference gene sequence.
[0432] In some embodiments, the acquisition module 820:
[0433] Obtaining sequencing data of the individual;
[0434] Aligning the sequencing data with the reference gene sequence to obtain the aligned data;
[0435] Determining the candidate sites in the alignment data that meet the screening conditions;
[0436] Based on the alignment data and the candidate sites, the MSA data is obtained.
[0437] In some embodiments, the candidate sites that meet the screening conditions include at least one of the following:
[0438] Genetic loci that are not identical to the reference gene sequence;
[0439] Gene loci with alignment quality values greater than or equal to the first threshold;
[0440] Gene loci with coverage greater than or equal to the second threshold;
[0441] Gene loci whose minor allele frequency is greater than or equal to the third threshold.
[0442] In some embodiments, the MSA data includes: sequence MSA data and insertion MSA data of the candidate site, the sequence MSA data is used to characterize the base changes of the candidate site, and the insertion MSA data is used to characterize the base insertions at the candidate site;
[0443] The acquisition module 820 is used to:
[0444] Taking each candidate site of the candidate sites as the center of a window, extracting a gene sequence in the window in the alignment data, wherein each sequencing fragment in the gene sequence corresponds to at least one of base insertion information, base deletion information and base change information;
[0445] Determine the sequence MSA data of each candidate site based on the base deletion information and the base change information corresponding to each sequencing fragment in the gene sequence, and determine the insertion MSA data of each candidate site based on the base insertion information corresponding to each sequencing fragment in the gene sequence;
[0446] The sequence MSA data and the insertion MSA data corresponding to each candidate site of the candidate site are combined to obtain the MSA data.
[0447] In some embodiments, the base information includes: at least one of the base changes in the sequence MSA data, the base insertions in the insertion MSA data, and the comparison quality value of each base; the sequencing information includes: at least one of the base quality value during base calling, and the positive and negative strand information of each sequencing fragment of the gene sequence during gene sequencing;
[0448] The statistical information includes: at least one of the reference gene sequence, base ratio, and average insertion length.
[0449] In some embodiments, a gene variation detection model for executing the gene variation detection method includes: a first encoding layer, a second encoding layer, a base model layer, and a prediction layer; the first encoding layer is connected in parallel with the second encoding layer, the first encoding layer and the second encoder are cascaded with the base model layer respectively, and the base model layer is cascaded with the prediction layer;
[0450] Among them, the first encoding layer is used to encode the comparison features of the MSA data; the second encoding layer is used to encode the profile features of the MSA data; the basic model layer is used to extract the MSA features corresponding to the comparison features and the profile features; the prediction layer is used to convert the MSA features to obtain the gene variation detection results of the MSA data relative to the reference gene sequence.
[0451] In some embodiments, the prediction layer includes: a first conversion layer and a classifier, wherein the first conversion layer is cascaded with the classifier;
[0452] Among them, the first conversion layer is used to convert the MSA features to obtain the MSA conversion features; the classifier is used to perform prediction based on the MSA conversion features to obtain the gene variation detection result of the MSA data relative to the reference gene sequence.
[0453] In some embodiments, the classifier includes: a first classifier, a second classifier, and a third classifier connected in parallel, and the first conversion layer is cascaded with the first classifier, the second classifier, and the third classifier respectively;
[0454] Among them, the first classifier is used to predict the genotype of the candidate site, the second classifier is used to predict the inserted base type of the candidate site, and the third classifier is used to predict the base change of the candidate site.
[0455] In some embodiments, the acquisition module 820 is used to:
[0456] Acquire first sample MSA data of a first sample individual, wherein the first sample MSA data includes sample base information and sample sequencing information of a sample variation site, wherein the sample variation site includes a gene site in the human genome whose confidence is higher than a threshold;
[0457] In some embodiments, the encoding module 840 is configured to:
[0458] Based on the first coding layer, a sample comparison feature of the first sample MSA data is encoded; and based on the second coding layer, a sample profile feature of the first sample MSA data is encoded, wherein the sample comparison feature is used to characterize the sample base information and the sample sequencing information, and the sample profile feature is used to characterize sample statistical information corresponding to the sample base information and the sample sequencing information;
[0459] In some embodiments, the extraction module 860 is used to:
[0460] Based on the basic model layer, extracting the first sample MSA feature corresponding to the sample comparison feature and the sample profile feature;
[0461] In some embodiments, the mapping module 880 is used to:
[0462] Based on the prediction layer, mapping the first sample MSA feature to obtain first predicted MSA data, wherein the first predicted MSA data includes predicted base information of the sample variant site;
[0463] In some embodiments, a training module is further included; the training module is used to:
[0464] The model parameters of the gene variation detection model are adjusted with the training goal of reducing the difference between the predicted base information in the first predicted MSA data and the sample base information in the first sample MSA data.
[0465] In some embodiments, the extraction module 860 is used to:
[0466] Splicing the sample comparison feature and the sample contour feature to obtain a sample splicing feature;
[0467] Based on the basic model layer, self-attention calculation is performed on the sample splicing feature to obtain the first sample MSA feature.
[0468] In some embodiments, the extraction module 860 is used to:
[0469] Based on the basic model layer, performing column attention calculation on the sample splicing features to obtain sample column attention features;
[0470] Performing pooling on the sample column attention features in the column direction to obtain sample column pooling features;
[0471] Perform row attention calculation on the sample column pooling features to obtain the first sample MSA features.
[0472] In some embodiments, the training module is used to:
[0473] Determining a training loss based on the predicted base information in the first predicted MSA data and the sample base information in the first sample MSA data;
[0474] Taking reducing the training loss as a training goal, the model parameters of the gene variation detection model are adjusted.
[0475] In some embodiments, the prediction layer of the gene variation detection model further includes: a second conversion layer, the second conversion layer being used to predict the base type in at least a portion of the mask region of the first sample MSA feature to obtain a predicted base type;
[0476] The sample base information includes: the sample genotype of the sample variation site, the sample insertion base type, the sample base change and the sample base type in the at least part of the mask region; the predicted base information includes: the predicted genotype of the sample variation site, the predicted insertion base type, the predicted base change and the predicted base type in the at least part of the mask region;
[0477] Training modules for:
[0478] Based on the sample genotype and the predicted genotype, a genotype loss is obtained; based on the sample inserted base type and the predicted inserted base type, an inserted base type loss is obtained; based on the sample base change and the predicted base change, a base change loss is obtained; based on the sample base type and the predicted base type, a mask loss is obtained;
[0479] The genotype loss, the insertion base type loss, the base change loss and the mask loss are weightedly summed to obtain the training loss.
[0480] In some embodiments, the acquisition module 820 is used to:
[0481] Sampling is performed on sequencing data of the first sample individual with the sample variation site and sequencing data without the sample variation site to obtain the first sample sequencing data;
[0482] Aligning the first sample sequencing data with the reference gene sequence to obtain first sample alignment data;
[0483] Based on the first sample alignment data and the sample variation sites, the first sample MSA data is obtained.
[0484] In some embodiments, the first sample MSA data includes: first sample sequence MSA data and first sample insertion MSA data of the sample variation site, the first sample sequence MSA data is used to characterize the base change of the sample variation site, and the first sample insertion MSA data is used to characterize the base insertion at the sample variation site;
[0485] The acquisition module 820 is used to:
[0486] Taking each sample variation site of the sample variation sites as the center of a window, extracting a sample gene sequence in the window in the first sample alignment data, wherein each sample sequencing fragment in the sample gene sequence corresponds to at least one of base insertion information, base deletion information and base change information;
[0487] Determine the first sample sequence MSA data of each sample variation site based on the base deletion information and the base change information corresponding to each sample sequencing fragment in the sample gene sequence; determine the first sample insertion MSA data of each sample variation site based on the base insertion information corresponding to each sample sequencing fragment in the sample gene sequence;
[0488] The first sample sequence MSA data corresponding to each sample variation site of the sample variation site and the first sample insertion MSA data are combined to obtain the first sample MSA data.
[0489] In some embodiments, the basic model layer in the gene variation detection model includes: a feature extraction unit stacked in a pre-trained basic model; the basic model includes: a third encoding layer, the stacked feature extraction units, and the second conversion layer, the third encoding layer is cascaded with the feature extraction unit, and the feature extraction unit is cascaded with the second conversion layer.
[0490] In some embodiments, the acquisition module 820 is used to:
[0491] Acquire second sample MSA data of a second sample individual, wherein the second sample MSA data includes sample base information and sample sequencing information of the sample candidate site;
[0492] In some embodiments, the encoding module 840 is configured to:
[0493] Based on the third coding layer, encode the sample coding feature of the second sample MSA data;
[0494] In some embodiments, the extraction module 860 is used to:
[0495] Based on the feature extraction unit, perform self-attention calculation on the sample coding feature to obtain a second sample MSA feature corresponding to the sample coding feature;
[0496] In some embodiments, a conversion module is further included; the conversion module is used to:
[0497] Based on the second conversion layer, convert the second sample MSA feature to obtain second predicted MSA data, where the second predicted MSA data includes predicted base information of the sample candidate site;
[0498] In some embodiments, the training module is used to:
[0499] The model parameters of the basic model are adjusted with the training goal of reducing the difference between the predicted base information in the second predicted MSA data and the sample base information in the second sample MSA data.
[0500] In some embodiments, the extraction module 860 is used to:
[0501] Based on the feature extraction unit, performing column attention calculation on the sample encoding feature to obtain a sample column attention feature;
[0502] Performing pooling on the sample column attention features in the column direction to obtain sample column pooling features;
[0503] Perform row attention calculation on the sample column pooling features to obtain the second sample MSA features.
[0504] In some embodiments, the conversion module is used to:
[0505] Performing random masking on at least a portion of the mask area in the second sample MSA feature to obtain a sample MSA mask feature, wherein the at least a portion of the mask area includes at least a portion of the columns and at least a portion of the single characters in the second sample MSA feature;
[0506] Based on the second conversion layer, the predicted base type in the at least a portion of the mask region of the sample MSA mask feature is predicted to obtain the second predicted MSA data.
[0507] In some embodiments, the acquisition module 820 is used to:
[0508] Acquire the second sample sequencing data of the second sample individual;
[0509] Aligning the second sample sequencing data with the reference gene sequence to obtain second sample alignment data;
[0510] Determining the sample candidate sites that meet the screening condition in the second sample alignment data;
[0511] Based on the second sample alignment data and the sample candidate sites, the second sample MSA data is determined.
[0512] In some embodiments, the sample candidate sites that meet the screening conditions include at least one of the following:
[0513] A sample gene locus that is not identical to the reference gene sequence;
[0514] Compare sample gene loci whose quality values are greater than or equal to the first threshold;
[0515] Sample gene loci with coverage greater than or equal to the second threshold;
[0516] The sample gene loci whose minor allele frequency is greater than or equal to the third threshold.
[0517] In some embodiments, the second sample MSA data includes: second sample sequence MSA data and second sample insertion MSA data of the sample candidate site, the second sample sequence MSA data is used to characterize the base change of the sample candidate site, and the second sample insertion MSA data is used to characterize the base insertion of the sample candidate site;
[0518] The acquisition module 820 is used to:
[0519] Taking each sample candidate site of the sample candidate sites as the center of a window, extracting a sample gene sequence in the window in the second sample alignment data, wherein each sample sequencing fragment in the sample gene sequence corresponds to at least one of base insertion information, base deletion information and base change information;
[0520] Determine the second sample sequence MSA data of each sample candidate site based on the base deletion information and the base change information corresponding to each sample sequencing fragment in the sample gene sequence, and determine the second sample insertion MSA data of each sample candidate site based on the base insertion information corresponding to each sample sequencing fragment in the sample gene sequence;
[0521] The second sample sequence MSA data and the second sample insertion MSA data corresponding to each sample candidate site of the sample candidate site are combined to obtain the second sample MSA data.
[0522] In some embodiments, the third coding layer of the base model includes: a first sub-coding layer and a second sub-coding layer connected in parallel;
[0523] Among them, the model parameters of the first coding layer of the gene variation detection model are the same as the model parameters of the first sub-coding layer in the third coding layer of the pre-trained basic model.
[0524] In some embodiments, the sample coding feature of the second sample MSA data includes: a first sub-sample coding feature and a second sub-sample coding feature;
[0525] The encoding module 840 is used to:
[0526] encoding the first sub-sample coding feature of the second sample MSA data based on the first sub-coding layer in the third coding layer;
[0527] Obtaining sample position data corresponding to the sample candidate site in the second sample MSA data;
[0528] encoding a second sub-sample coding feature of the sample position data based on the second sub-coding layer in the third coding layer;
[0529] The first sub-sample coding feature and the second sub-sample coding feature are concatenated to obtain the sample coding feature.
[0530] It should be noted that the specific limitations in the embodiments of the one or more gene variation detection devices 800 provided above can refer to the limitations of the gene variation detection method above, and will not be repeated here. Each module of the above device can be implemented in whole or in part by software, hardware, and a combination thereof. Each module can be embedded in or independent of the processor of the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to each module.
[0531] An embodiment of the present application also provides a computer device, which includes: a processor and a memory, wherein a computer program is stored in the memory; and the processor is used to execute the computer program in the memory to implement the gene variation detection method provided by the above-mentioned method embodiments.
[0532] For example, Fig.14 1 is a structural block diagram of a computer device provided by an exemplary embodiment of the present application. Optionally, the computer device is a server 1000.
[0533] Typically, the server 1000 includes: a processor 1001 and a memory 1002 .
[0534] The processor 1001 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 1001 may be implemented in at least one hardware form of digital signal processing (DSP), field programmable gate array (FPGA), and programmable logic array (PLA). The processor 1001 may also include a main processor and a coprocessor. The main processor is a processor for processing data in an awake state, also known as a central processing unit (CPU); the coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor 1001 may be integrated with a graphics processing unit (GPU), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 1001 may also include an artificial intelligence (AI) processor, which is used to process computing operations related to machine learning.
[0535] The memory 1002 may include one or more computer-readable storage media, which may be non-transitory. The memory 1002 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 1002 is used to store at least one instruction, which is used to be executed by the processor 1001 to implement the gene variation detection method provided in each method embodiment of the present application.
[0536] In some embodiments, the server 1000 may also optionally include: an input interface 1003 and an output interface 1004. The processor 1001, the memory 1002, the input interface 1003, and the output interface 1004 may be connected via a bus or a signal line. Each peripheral device may be connected to the input interface 1003 and the output interface 1004 via a bus, a signal line, or a circuit board. The input interface 1003 and the output interface 1004 may be used to connect at least one peripheral device related to input / output (I / O) to the processor 1001 and the memory 1002. In some embodiments, the processor 1001, the memory 1002, the input interface 1003, and the output interface 1004 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 1001, the memory 1002, the input interface 1003, and the output interface 1004 may be implemented on a separate chip or circuit board, which is not limited in the embodiments of the present application.
[0537] Those skilled in the art will understand that Fig.14 The structure shown in the figure does not constitute a limitation on the computer device, and may include more or less components than shown in the figure, or combine some components, or adopt a different component arrangement.
[0538] An embodiment of the present application also provides a chip, which includes a programmable logic circuit and / or program instructions. When the chip runs on a computer device, it is used to implement the gene variation detection method provided by the above-mentioned method embodiments.
[0539] An embodiment of the present application also provides a computer-readable storage medium, which stores a computer program. The computer program is loaded and executed by a processor to implement the gene variation detection method provided by the above-mentioned method embodiments.
[0540] The present application embodiment also provides a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the processor of the computer device loads and executes to implement the gene variation detection method provided by the above-mentioned method embodiments.
[0541] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0542] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program. The above program may be stored in a computer-readable storage medium. The above-mentioned computer-readable storage medium may be a read-only memory, a disk or an optical disk, etc.
[0543] Those skilled in the art should be aware that in one or more of the above examples, the functions described in the embodiments of the present application can be implemented with hardware, software, firmware, or any combination thereof. When implemented using software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium. Computer-readable media include computer storage media and communication media, wherein the communication media include any media that facilitates the transmission of a computer program from one place to another. The storage medium can be any available medium that a general or special-purpose computer can access.
[0544] The above are only optional embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.
Claims
1. A method for detecting gene variation, characterized in that: The method comprises: Obtaining MSA data of an individual, wherein the MSA data includes base information and sequencing information of a candidate site in a gene site; Encoding comparison features of the MSA data, and encoding profile features of the MSA data, wherein the comparison features are used to characterize the base information and the sequencing information, and the profile features are used to characterize statistical information corresponding to the base information and the sequencing information; Extracting MSA features corresponding to the comparison features and the contour features; The MSA features are mapped to obtain gene variation detection results of the MSA data relative to a reference gene sequence.
2. The method according to claim 1, characterized in that The extracting the MSA feature corresponding to the comparison feature and the contour feature includes: Splicing the comparison feature and the contour feature to obtain a splicing feature; A self-attention calculation is performed on the concatenated features to obtain the MSA features.
3. The method according to claim 2, characterized in that The performing self-attention calculation on the splicing feature to obtain the MSA feature includes: Perform column attention calculation on the concatenated features to obtain column attention features; Perform pooling on the column attention features in the column direction to obtain column pooling features; The column pooling features are subjected to row attention calculation to obtain the MSA features.
4. The method according to any one of claims 1 to 3, characterized in that: Mapping the MSA features to obtain a gene variation detection result of the MSA data relative to a reference gene sequence includes: Converting the MSA feature to obtain an MSA conversion feature; Perform prediction based on the MSA conversion feature to obtain a gene variation detection result of the MSA data relative to the reference gene sequence; The gene variation detection result includes at least one of the genotype, the inserted base type and the base change of the candidate site.
5. The method according to claim 4, characterized in that The MSA data is obtained by comparing the sequencing data of the individual with the reference gene sequence, and the first line of gene sequence in the MSA data includes the reference gene sequence; The performing prediction based on the MSA conversion feature to obtain a gene variation detection result of the MSA data relative to the reference gene sequence includes: Extracting a first row of MSA conversion features from the MSA conversion features, where the first row of MSA conversion features is used to characterize the global features corresponding to the candidate sites; Prediction is performed on the first row of MSA conversion features to obtain a gene variation detection result of the MSA data relative to the reference gene sequence.
6. The method according to any one of claims 1 to 5, characterized in that: The obtaining of individual MSA data comprises: Obtaining sequencing data of the individual; Aligning the sequencing data with the reference gene sequence to obtain the aligned data; Determining the candidate sites in the alignment data that meet the screening conditions; Based on the alignment data and the candidate sites, the MSA data is obtained.
7. The method according to claim 6, characterized in that The candidate sites that meet the screening conditions include at least one of the following: Genetic loci that are not identical to the reference gene sequence; Gene loci with alignment quality values greater than or equal to the first threshold; Gene loci with coverage greater than or equal to the second threshold; Gene loci whose minor allele frequency is greater than or equal to the third threshold.
8. The method according to claim 6, characterized in that The MSA data includes: sequence MSA data and insertion MSA data of the candidate site, the sequence MSA data is used to characterize the base change of the candidate site, and the insertion MSA data is used to characterize the base insertion at the candidate site; The obtaining of the MSA data based on the alignment data and the candidate sites comprises: Taking each candidate site of the candidate sites as the center of a window, extracting a gene sequence in the window in the alignment data, wherein each sequencing fragment in the gene sequence corresponds to at least one of base insertion information, base deletion information and base change information; Determine the sequence MSA data of each candidate site based on the base deletion information and the base change information corresponding to each sequencing fragment in the gene sequence, and determine the insertion MSA data of each candidate site based on the base insertion information corresponding to each sequencing fragment in the gene sequence; The sequence MSA data and the insertion MSA data corresponding to each candidate site of the candidate site are combined to obtain the MSA data.
9. The method according to any one of claims 1 to 8, characterized in that: The base information includes: base changes in the sequence MSA data, base insertions in the MSA data, and at least one of the comparison quality values of each base; the sequencing information includes: base quality values during base calling, and at least one of the positive and negative strand information of each sequencing fragment of the gene sequence during gene sequencing; The statistical information includes: at least one of the reference gene sequence, base ratio, and average insertion length.
10. The method according to any one of claims 1 to 8, characterized in that: The gene variation detection model for executing the gene variation detection method comprises: a first encoding layer, a second encoding layer, a basic model layer, and a prediction layer; the first encoding layer is connected in parallel with the second encoding layer, the first encoding layer and the second encoder are cascaded with the basic model layer respectively, and the basic model layer is cascaded with the prediction layer; Among them, the first encoding layer is used to encode the comparison features of the MSA data; the second encoding layer is used to encode the profile features of the MSA data; the basic model layer is used to extract the MSA features corresponding to the comparison features and the profile features; the prediction layer is used to convert the MSA features to obtain the gene variation detection results of the MSA data relative to the reference gene sequence.
11. The method according to claim 10, characterized in that The prediction layer includes: a first conversion layer and a classifier, wherein the first conversion layer is cascaded with the classifier; Among them, the first conversion layer is used to convert the MSA features to obtain the MSA conversion features; the classifier is used to perform prediction based on the MSA conversion features to obtain the gene variation detection result of the MSA data relative to the reference gene sequence.
12. The method according to claim 11, characterized in that The classifier comprises: a first classifier, a second classifier and a third classifier connected in parallel, and the first conversion layer is cascaded with the first classifier, the second classifier and the third classifier respectively; Among them, the first classifier is used to predict the genotype of the candidate site, the second classifier is used to predict the inserted base type of the candidate site, and the third classifier is used to predict the base change of the candidate site.
13. The method according to any one of claims 10 to 12, characterized in that: The method further comprises: Acquire first sample MSA data of a first sample individual, wherein the first sample MSA data includes sample base information and sample sequencing information of a sample variation site, wherein the sample variation site includes a gene site in the human genome whose confidence is higher than a threshold; Based on the first coding layer, a sample comparison feature of the first sample MSA data is encoded; and based on the second coding layer, a sample profile feature of the first sample MSA data is encoded, wherein the sample comparison feature is used to characterize the sample base information and the sample sequencing information, and the sample profile feature is used to characterize sample statistical information corresponding to the sample base information and the sample sequencing information; Based on the basic model layer, extracting the first sample MSA feature corresponding to the sample comparison feature and the sample profile feature; Based on the prediction layer, mapping the first sample MSA feature to obtain first predicted MSA data, wherein the first predicted MSA data includes predicted base information of the sample variant site; The model parameters of the gene variation detection model are adjusted with the training goal of reducing the difference between the predicted base information in the first predicted MSA data and the sample base information in the first sample MSA data.
14. The method according to claim 13, characterized in that The adjusting the model parameters of the gene variation detection model with the goal of reducing the difference between the predicted base information in the first predicted MSA data and the sample base information in the first sample MSA data comprises: Determining a training loss based on the predicted base information in the first predicted MSA data and the sample base information in the first sample MSA data; Taking reducing the training loss as a training goal, the model parameters of the gene variation detection model are adjusted.
15. The method according to claim 14, characterized in that The prediction layer of the gene variation detection model further includes: a second conversion layer, the second conversion layer being used to predict the base type in at least a portion of the mask region of the first sample MSA feature to obtain a predicted base type; The sample base information includes: the sample genotype of the sample variation site, the sample insertion base type, the sample base change and the sample base type in the at least part of the mask region; the predicted base information includes: the predicted genotype of the sample variation site, the predicted insertion base type, the predicted base change and the predicted base type in the at least part of the mask region; The determining of the training loss based on the predicted base information in the first predicted MSA data and the sample base information in the first sample MSA data includes: Based on the sample genotype and the predicted genotype, a genotype loss is obtained; based on the sample inserted base type and the predicted inserted base type, an inserted base type loss is obtained; based on the sample base change and the predicted base change, a base change loss is obtained; based on the sample base type and the predicted base type, a mask loss is obtained; The genotype loss, the insertion base type loss, the base change loss and the mask loss are weightedly summed to obtain the training loss.
16. The method according to claim 13, characterized in that The basic model layer in the gene variation detection model includes: a feature extraction unit stacked in a pre-trained basic model; the basic model includes: a third encoding layer, the stacked feature extraction units, and the second conversion layer, the third encoding layer is cascaded with the feature extraction unit, and the feature extraction unit is cascaded with the second conversion layer.
17. A gene mutation detection device, characterized in that: The device comprises: An acquisition module, used to acquire MSA data of an individual, wherein the MSA data includes base information and sequencing information of candidate sites in a gene site; An encoding module, used to encode comparison features of the MSA data and to encode profile features of the MSA data, wherein the comparison features are used to characterize the base information and the sequencing information, and the profile features are used to characterize statistical information corresponding to the base information and the sequencing information; An extraction module, used for extracting MSA features corresponding to the comparison features and the contour features; A mapping module is used to map the MSA features to obtain a gene variation detection result of the MSA data relative to a reference gene sequence.
18. A computer device, characterized in that: The computer device comprises: a processor and a memory, wherein the memory stores a computer program, and the computer program is loaded and executed by the processor to implement the gene variation detection method according to any one of claims 1 to 16.
19. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is loaded and executed by a processor to implement the gene variation detection method according to any one of claims 1 to 16.
20. A computer program product, characterized in that The computer program product includes computer instructions, which are stored in a computer-readable storage medium. The processor obtains the computer instructions from the computer-readable storage medium, so that the processor loads and executes them to implement the gene variation detection method as described in any one of claims 1 to 16.
Citation Information
Patent Citations
Third-generation sequencing data self-correction error correction method based on deep learning
CN114664379A
Detection of genetic variants in human leukocyte antigen genes
WO2023009863A1