Genetic marker similarity analysis method, electronic device, and storage medium
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-04-24
- Publication Date
- 2026-08-11
AI Technical Summary
这种串行处理方式没有调用上现代中央处理器内置的并行计算资源,导致处理大规模基因组数据集时耗时过长
[0016] The genetic marker similarity analysis method, electronic device, and storage medium proposed in this application acquire single nucleotide polymorphism (SNP) data to be analyzed; perform category mapping processing on the SNP data to obtain numerical vectors; perform hardware architecture detection processing on the execution environment to obtain a vector processing instruction set; and perform parallel alignment processing on the numerical vectors based on the vector processing instruction set to obtain genetic similarity comparison results. Therefore, this application converts single-precision floating-point data, which occupies 4 bytes of memory in traditional solutions, into data with lower memory consumption by performing category mapping processing on the SNP data to obtain numerical vectors, thus avoiding excessive memory consumption and resource occupation problems. Simultaneously, by performing hardware architecture detection processing on the execution environment to obtain the vector processing instruction set and performing parallel alignment processing on the numerical vectors based on this instruction set, batch processing of multiple sites with a single instruction is achieved, thereby improving the processing efficiency of genetic similarity calculation.
Smart Images

Figure CN122551886A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of bioinformatics processing technology, and in particular to a method for similarity analysis of genetic markers, an electronic device, and a storage medium. Background Technology
[0002] Single nucleotide polymorphisms (SNPs) refer to variations occurring at a single nucleotide position in a genome. As core genetic markers in fields such as plant variety identification, genetic diversity analysis, and marker-assisted breeding, the processing efficiency of SNP data directly impacts research and production progress. A single genome sample can contain hundreds of thousands or even millions of SNP sites. When performing genetic similarity analysis between samples, pairwise comparisons are typically required. Since the computational workload increases quadratically with the number of samples, the expansion of data scale brings enormous computational pressure.
[0003] Currently, similarity calculations primarily employ a scalar computation model, where the processor processes SNP loci one by one. This serial processing method fails to utilize the built-in parallel computing resources of modern central processing units, resulting in excessively long processing times when handling large-scale genomic datasets. Furthermore, existing solutions often use 32-bit single-precision floating-point data to store SNP genotype data. For medium-sized datasets containing 1000 samples and 1 million SNP loci, this consumes significant memory and computer resources, leading to processing efficiency issues when performing genetic similarity analysis between samples.
[0004] Therefore, developing a genetic similarity calculation scheme that can significantly reduce memory usage and improve processing efficiency has become an urgent technical problem to be solved. Summary of the Invention
[0005] The main objective of this application is to propose a method, electronic device, and storage medium for genetic marker similarity analysis, aiming to reduce memory usage and improve processing efficiency during genetic similarity calculation.
[0006] To achieve the above objectives, a first aspect of this application proposes a method for analyzing the similarity of genetic markers, the method comprising: Obtain the single nucleotide polymorphism data to be analyzed; The single nucleotide polymorphism data is subjected to category mapping to obtain a numerical vector; The hardware architecture of the execution environment is detected and processed to obtain the vector processing instruction set; Parallel alignment processing is performed on the numerical vectors based on the vector processing instruction set to obtain genetic similarity alignment results.
[0007] In some embodiments, the step of performing category mapping processing on the single nucleotide polymorphism data to obtain a numerical vector includes: Obtain the preset encoding rules; The single nucleotide polymorphism data is subjected to category mapping based on the encoding rules to obtain the numerical vector of type 8 unsigned integer; wherein the numerical vector includes a first value corresponding to the homozygous genotype, a second value corresponding to the heterozygous genotype, and a third value corresponding to the missing value.
[0008] In some embodiments, the parallel alignment processing of the numerical vectors based on the vector processing instruction set to obtain genetic similarity alignment results includes: The absolute difference vector is obtained by performing an absolute difference calculation on the numerical vector. Based on the absolute difference vector, an equality comparison process is performed to obtain multiple comparison mask vectors representing different matching degrees; Bit statistics are performed on the multiple alignment mask vectors to obtain the site count values corresponding to each matching degree, and the site count values are determined as the genetic similarity alignment results.
[0009] In some embodiments, performing bit-statistical processing on the plurality of alignment mask vectors to obtain locus counts corresponding to each matching degree, and determining the locus counts as the genetic similarity alignment results, includes: Obtain the preset similarity calculation pattern; Based on the aforementioned similarity calculation model, the site counts for each matching degree are weighted and accumulated to obtain a total score. The genetic similarity comparison result is determined by summing the scores.
[0010] In some embodiments, the similarity calculation mode includes a strict matching mode, a soft matching mode, a mode that ignores heterozygous sites, and a weighted scoring mode; The weighted summation of the site counts for each matching degree based on the similarity calculation model to obtain a total score includes: In response to the similarity calculation mode being a strict matching mode, based on the equality comparison results of the numerical vectors, the site count value representing the number of perfectly matched sites is obtained, and a weighted summation process is performed to obtain the total score; In response to the similarity calculation mode being a soft matching mode, the target genotype is determined, and either of the two corresponding numerical vectors represents the target genotype. The corresponding locus count value is obtained, and a weighted summation is performed to obtain the total score. In response to the similarity calculation mode being the mode of ignoring heterozygous sites, a target genotype is determined, and the results of the equality comparison are subjected to site filtering based on the target genotype to obtain the site count value representing the number of matching sites after excluding the target genotype. The result is then weighted and accumulated to obtain the total score. In response to the similarity calculation mode being a weighted scoring mode, the sum of the scores is obtained by accumulating the product of the site count value representing the number of fully matched sites and a preset first weight score, and the product of the site count value representing the number of partially matched sites and a preset second weight score.
[0011] In some embodiments, the step of performing hardware architecture detection on the execution environment to obtain a vector processing instruction set includes: Obtain the hardware condition information of the execution environment and the parallel computing instructions supported by the execution environment; Based on the hardware condition information, obtain the preset result buffer threshold and block step size parameters; The vector processing instruction set for parallel processing is obtained based on the parallel computing instructions, the result buffer threshold, and the block step size parameter.
[0012] In some embodiments, obtaining single nucleotide polymorphism data includes: Get the file size information of the raw data file; In response to the file size information meeting a preset threshold, the original data file is read using memory mapping technology with zero copy processing to obtain the single nucleotide polymorphism data.
[0013] In some embodiments, after obtaining the genetic similarity comparison results, the method further includes: Obtain the set of sample identifiers to be analyzed; A matrix index mapping table is established based on the sample identifier set; The genetic similarity comparison results are filled with matrix based on the matrix index mapping table to obtain a similarity matrix file.
[0014] To achieve the above objectives, a second aspect of this application provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the genetic marker similarity analysis method described in the first aspect.
[0015] To achieve the above objectives, a third aspect of the present application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the genetic marker similarity analysis method described in the first aspect.
[0016] The genetic marker similarity analysis method, electronic device, and storage medium proposed in this application acquire single nucleotide polymorphism (SNP) data to be analyzed; perform category mapping processing on the SNP data to obtain numerical vectors; perform hardware architecture detection processing on the execution environment to obtain a vector processing instruction set; and perform parallel alignment processing on the numerical vectors based on the vector processing instruction set to obtain genetic similarity comparison results. Therefore, this application converts single-precision floating-point data, which occupies 4 bytes of memory in traditional solutions, into data with lower memory consumption by performing category mapping processing on the SNP data to obtain numerical vectors, thus avoiding excessive memory consumption and resource occupation problems. Simultaneously, by performing hardware architecture detection processing on the execution environment to obtain the vector processing instruction set and performing parallel alignment processing on the numerical vectors based on this instruction set, batch processing of multiple sites with a single instruction is achieved, thereby improving the processing efficiency of genetic similarity calculation. Attached Figure Description
[0017] The above and / or additional aspects and advantages of this application will become apparent and readily understood from the description of the embodiments taken in conjunction with the following drawings, in which: Figure 1 This is a schematic flowchart of a genetic marker similarity analysis method according to an embodiment of this application; Figure 2 This is another flowchart illustrating the genetic marker similarity analysis method according to an embodiment of this application; Figure 3 This is another flowchart illustrating the genetic marker similarity analysis method according to an embodiment of this application; Figure 4 This is another flowchart illustrating the genetic marker similarity analysis method according to an embodiment of this application; Figure 5 This is another flowchart illustrating the genetic marker similarity analysis method according to an embodiment of this application; Figure 6 This is another flowchart illustrating the genetic marker similarity analysis method according to an embodiment of this application; Figure 7 This is another flowchart illustrating the genetic marker similarity analysis method according to an embodiment of this application; Figure 8 This is another flowchart illustrating the genetic marker similarity analysis method according to an embodiment of this application; Figure 9 This is a schematic diagram of the hardware structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0018] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0019] It should be noted that although functional modules are divided in the device schematic diagram and a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first," "second," etc., in the specification, claims, and the aforementioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.
[0020] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0021] Single nucleotide polymorphisms (SNPs) refer to variations occurring at a single nucleotide position in a genome. As core genetic markers in fields such as plant variety identification, genetic diversity analysis, and marker-assisted breeding, the processing efficiency of SNP data directly impacts research and production progress. A single genome sample can contain hundreds of thousands or even millions of SNP sites. When performing genetic similarity analysis between samples, pairwise comparisons are typically required. Since the computational workload increases quadratically with the number of samples, the expansion of data scale brings enormous computational pressure.
[0022] Currently, similarity calculations primarily employ a scalar computation model, where the processor processes SNP loci one by one. This serial processing method fails to utilize the built-in parallel computing resources of modern central processing units, resulting in excessively long processing times when handling large-scale genomic datasets. Furthermore, existing solutions often use 32-bit single-precision floating-point data to store SNP genotype data. For medium-sized datasets containing 1000 samples and 1 million SNP loci, this consumes significant memory and computer resources, leading to processing efficiency issues when performing genetic similarity analysis between samples.
[0023] Therefore, developing a genetic similarity calculation scheme that can significantly reduce memory usage and improve processing efficiency has become an urgent technical problem to be solved.
[0024] Based on this, embodiments of this application provide a method, electronic device, and storage medium for genetic marker similarity analysis, aiming to reduce memory usage and improve processing efficiency during genetic similarity calculation.
[0025] The genetic marker similarity analysis method, electronic device, and storage medium provided in this application are specifically described through the following embodiments. First, the genetic marker similarity analysis method in this application is described.
[0026] The genetic marker similarity analysis method provided in this application relates to the field of bioinformatics. This method can be applied to a terminal, a server, or software running on either a terminal or a server. In some embodiments, the terminal can be a smartphone, tablet, laptop, desktop computer, etc.; the server can be configured as an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms; the software can be an application implementing the genetic marker similarity analysis method, but is not limited to the above forms.
[0027] This application can be used in a wide variety of general-purpose or special-purpose computer system environments or configurations. Examples include: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, and distributed computing environments including any of the above systems or devices. This application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform specific tasks or implement specific abstract data types. This application can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.
[0028] Figure 1 This is an optional flowchart illustrating the genetic marker similarity analysis method provided in the embodiments of this application. Figure 1 The method may include, but is not limited to, steps S101 to S104.
[0029] Step S101: Obtain the single nucleotide polymorphism data to be analyzed; Step S102: Perform class mapping on the single nucleotide polymorphism data to obtain a numerical vector; Step S103: Perform hardware architecture detection processing on the execution environment to obtain the vector processing instruction set; Step S104: Perform parallel comparison processing on the numerical vectors based on the vector processing instruction set to obtain the genetic similarity comparison results.
[0030] In step S101 of some embodiments, a data retrieval program is initiated and executed to read the single nucleotide polymorphism (SNP) data to be analyzed from an external storage medium or a local database. In a specific example, during the data acquisition process, the raw format file generated by the PLINK software is parsed, and the original sequence containing sample information and a large number of SNP sites is extracted. For large-scale files exceeding a preset threshold, memory mapping technology is invoked to achieve zero-copy reading, thereby improving the throughput of the file parsing stage and reducing the instantaneous pressure on system memory. If a specific sample screening instruction is received, the read data can also be filtered according to a preset sample list, thereby reducing subsequent invalid computational overhead.
[0031] Please see Figure 2 In some embodiments, step S101 may include, but is not limited to, steps S201 to S202: Step S201: Obtain the file size information of the original data file; In step S202, in response to the file size information meeting a preset threshold, the original data file is read using memory mapping technology to obtain single nucleotide polymorphism data. In step S201 of some embodiments, when accessing the original data file in the storage medium, a probe operation is first performed on the physical attributes of the file to extract the file size information of the original data file. The amount of disk space occupied by the file in bytes is obtained by calling the underlying file system interface, providing quantitative data support for subsequent data read path decisions. The extracted file size information can serve as a feature criterion for triggering different read modes, thereby allowing for different processing procedures for files of different sizes.
[0032] In step S202 of some embodiments, the logic judgment program compares the received file size information with a preset threshold pre-configured within the system, for example, determining whether the received file size is greater than 100MB. In response to the file size information meeting the preset threshold, memory mapping technology is activated to perform zero-copy read processing on the original data file. The original data file is directly mapped to the process's virtual memory space, eliminating the overhead of multiple data copying between kernel space and user space, ultimately obtaining the single nucleotide polymorphism data.
[0033] Through steps S201 and S202, by dynamically identifying file attributes and adapting loading strategies, the input / output performance bottleneck in the loading process of large-scale genomic data is effectively solved. Using file size information as the decision-making logic, the optimal reading path is automatically selected for datasets of different sizes. Especially for large files, memory mapping technology can bypass traditional reading limitations, achieving zero-copy-level access performance. This processing method significantly reduces the CPU overhead in large-scale data scenarios and significantly improves the loading speed of single nucleotide polymorphism data, laying an efficient data supply foundation for subsequent large-scale parallel alignment operations.
[0034] In step S102 of some embodiments, encoding conversion logic is performed on the extracted single nucleotide polymorphism data to map the genotype information originally stored in string or floating-point format into a numerical vector of 8-bit unsigned integer type.
[0035] Please see Figure 3 In some embodiments, step S102 may include, but is not limited to, steps S301 to S302: Step S301: Obtain the preset encoding rules; Step S302: Based on the encoding rules, the single nucleotide polymorphism data is subjected to category mapping processing to obtain an 8-bit unsigned integer type numerical vector; wherein, the numerical vector includes a first value corresponding to the homozygous genotype, a second value corresponding to the heterozygous genotype, and a third value corresponding to the missing value.
[0036] In step S301 of some embodiments, pre-defined encoding rules are retrieved from the system configuration module or a preset storage area. These pre-defined encoding rules establish a logical mapping relationship between biological genetic information and computer-stored numerical values, aiming to provide a standardized digital representation scheme for a large number of genotype loci. The retrieved encoding rules will be used in subsequent data conversion steps, providing a basis for judgment when performing category mapping processing.
[0037] In step S302 of some embodiments, the acquired single nucleotide polymorphism (SNP) data is received, and class mapping processing is performed on this data based on encoding rules to generate an 8-bit unsigned integer numerical vector composed of multiple data units. In the numerical vector, each component is assigned a different value according to the actual attribute of the site. Sites corresponding to homozygous genotypes are mapped to a preset first value, sites corresponding to heterozygous genotypes are mapped to a preset second value, and missing values that cannot be identified in the data sequence are mapped to a preset third value. The generated numerical vector is cached in system memory and provided as a core data carrier to the subsequent parallel alignment module for participation in large-scale single-instruction-multiple-data (SMD) operations in the vector register.
[0038] In some specific mapping processes, homozygous genotypes, heterozygous genotypes, and missing values are converted into preset unsigned integers. For example, the values 0, 1, and 2 correspond to different genotype states, and the value 255 is defined as the identifier of a missing site. Through this category mapping process, single-precision floating-point data that originally occupied 4 bytes of space is compressed into a numerical vector that occupies only 1 byte, significantly reducing memory usage while maintaining computational precision.
[0039] Through steps S301 to S302, the data storage format is reconstructed, transforming the original genotype information, which originally occupied a large amount of space, into a highly compressed numerical vector, significantly reducing the space overhead in the data processing process from the ground up. Using 8-bit unsigned integers as storage units greatly reduces memory usage, effectively solving the problem of excessive computer memory resource consumption by large-scale genomic datasets in the background technology. On the other hand, this standardized category mapping process provides a uniform data structure for parallel computing in heterogeneous hardware environments, ensuring extremely high memory access alignment efficiency when performing alignment operations using hardware vector instruction sets.
[0040] In step S103 of some embodiments, architecture sensing and feature scanning are performed on the current hardware execution environment to determine the optimal computing path supported by the processor. This process identifies the architecture type of the current central processing unit (CPU) as either x86_64 or ARM64 by calling the underlying hardware feature interface of the operating system, and further probes whether the processor has vectorized instruction extension capabilities. Based on the detection results, the corresponding vector processing instruction set is automatically matched and loaded, such as matching the AVX2 instruction set on the x86 platform or the NEON instruction set on the ARM platform, thereby preparing the corresponding underlying operators for subsequent parallel comparison operations.
[0041] Please see Figure 4In some embodiments, step S103 may include, but is not limited to, steps S401 to S403: Step S401: Obtain the hardware condition information of the execution environment and the parallel computing instructions supported by the execution environment; Step S402: Based on hardware condition information, obtain the preset result buffer threshold and block step size parameters; Step S403: Obtain a vector processing instruction set for parallel processing based on parallel computing instructions, result buffer threshold, and block step size parameters; In step S401 of some embodiments, an environment sensing algorithm is executed to call the hardware abstraction layer interface of the underlying operating system to obtain hardware condition information of the execution environment and the parallel computing instructions supported by the execution environment. The characteristic bits of the central processing unit's registers are scanned to identify whether the current hardware architecture belongs to the x86_64 architecture containing 256-bit vector registers or the ARM64 architecture containing 128-bit vector registers. This detection method can determine whether the current hardware platform has the basic logic to perform advanced vectorized operations, and the identified parallel computing instruction set type and hardware cache capacity, among other hardware condition information, are passed to the subsequent task configuration module.
[0042] In step S402 of some embodiments, a preset result buffer threshold and block step size parameter are obtained from a preset parameter library based on hardware condition information and the current bit width characteristics and memory throughput capacity of the central processing unit. For hardware environments with high parallelism capabilities, a larger block step size parameter can be matched to fully utilize the processing performance of wide bit-width registers. On the other hand, by setting the result buffer threshold in conjunction with the available memory capacity, it is ensured that when generating large-scale sample pair comparison results, a streaming write mechanism can prevent system memory overflow.
[0043] In step S403 of some embodiments, an internal logic mapping is performed based on the parallel computing instructions, the result buffer threshold, and the block step size parameters to obtain a vector processing instruction set for parallel processing. The vector processing instruction set contains core operators for performing batch comparisons and encapsulates block step size information that controls the task iteration frequency and buffer control logic that manages memory usage. The vector processing instruction set is provided to the core computing engine as the final execution specification to guide the loading, comparison, and result dumping processes of data blocks in subsequent parallel comparison stages.
[0044] Through steps S401 to S403, in-depth detection and parameter adaptation of the hardware execution environment are performed, achieving the matching and correspondence between computing tasks and underlying hardware.
[0045] First, by automatically acquiring hardware condition information and parallel computing instructions, the compatibility and performance migration issues of the software across different processor architectures were resolved, ensuring that the optimal acceleration operators could be invoked for specific chip architectures. Second, by dynamically matching block step size parameters and result buffer thresholds, an effective memory protection mechanism was established to avoid memory exhaustion due to excessive data size while pursuing maximum computational throughput. Through an environment-aware instruction set construction scheme, the automation level of genetic similarity analysis was improved, and the parallel computing potential of modern processors was maximized while ensuring system stability, significantly enhancing the engineering practicality of large-scale genomic data processing.
[0046] In step S104 of some embodiments, numerical vectors are loaded in batches into the corresponding vector registers to perform parallel comparison processing according to the selected vector processing instruction set.
[0047] Based on the user-specified similarity calculation method, such as strict matching mode or scoring rule mode, vector comparison instructions, bitwise operation instructions, and level accumulation instructions are used to perform synchronous operations on multiple sites. Through this parallel processing scheme, the alignment logic of 16 or 32 single nucleotide polymorphism sites can be processed simultaneously in a single instruction cycle. Finally, the alignment count values of each sample pair are summarized to calculate the genetic similarity comparison results that accurately reflect the kinship between samples.
[0048] Please see Figure 5 In some embodiments, step S104 may include, but is not limited to, steps S501 to S503: Step S501: Perform absolute difference calculation on the numerical vector to obtain the absolute difference vector; Step S502: Perform equality comparison processing based on the absolute difference vector to obtain multiple comparison mask vectors representing different matching degrees; Step S503: Perform bit statistics processing on multiple alignment mask vectors to obtain the site count values corresponding to each matching degree, and determine the site count values as the genetic similarity alignment results; In step S501 of some embodiments, the absolute difference operator in the vector processing instruction set is invoked to perform absolute difference calculation processing on the numerical vectors of the two samples to be compared loaded into the vector register.
[0049] By performing batch subtraction operations on the genotype components at corresponding positions in two numerical vectors and extracting the absolute value of the numerical difference, an absolute difference vector that can intuitively reflect the genetic distance between loci is generated. The resulting absolute difference vector serves as intermediate feature data and is provided to the subsequent comparison and judgment stage to distinguish the matching attributes between different genotype combinations.
[0050] In step S502 of some embodiments, the absolute difference vector is compared with a preset distance reference vector for equality. By calling the vector equality comparison instruction, it is possible to simultaneously determine whether the difference between multiple loci is zero or one, thereby generating multiple alignment mask vectors representing different degrees of matching. Alignment mask vectors with a difference of zero are used to identify locus intervals with completely identical genotypes, while alignment mask vectors with a difference of one are used to identify locus intervals that meet partial matching conditions.
[0051] In step S503 of some embodiments, bit statistics processing is performed on the comparison mask vector to extract the site count values that meet specific matching conditions within the current parallel processing window. The site count values corresponding to each matching degree obtained from each block are summarized and determined as the final genetic similarity comparison result according to a preset weight logic.
[0052] Through steps S501 to S503, the complex genetic similarity comparison logic is transformed into low-level vectorized bitwise operations, thereby improving computational efficiency. First, absolute difference calculation transforms qualitative genotype comparison into quantitative numerical distance determination. Second, by generating multiple comparison mask vectors and combining them with hardware-level bitwise statistical processing, the frequent conditional branch jumps in traditional scalar calculations are eliminated, enabling the processor to complete the similarity quantification of tens of thousands of loci within extremely short instruction cycles. This enhances the computational throughput of a single-core processor and ensures stable, high-performance similarity comparison results in large-scale population genetic analysis tasks, effectively solving the processing efficiency problem caused by computational resource bottlenecks.
[0053] Please see Figure 6 In some embodiments, step S503 may include, but is not limited to, steps S601 to S603: Step S601: Obtain the preset similarity calculation mode; Step S602: Based on the similarity calculation mode, the site count values of each matching degree are weighted and accumulated to obtain the total score; Step S603: Determine the genetic similarity comparison result based on the sum of the scores.
[0054] In step S601 of some embodiments, a pre-set similarity calculation mode is retrieved according to user interaction instructions or system default configuration parameters. The similarity calculation mode defines the logical judgment criteria for the consistency of different genotype combinations. The obtained similarity calculation mode is passed as a core control variable to the subsequent logical integration module to guide how to assign different scores to the raw count values produced by parallel processing.
[0055] In step S602 of some embodiments, a weighted summation process is performed based on the site count values for each matching degree and a selected similarity calculation mode to obtain a total score reflecting the overall consistency of the samples. By corresponding to different similarity calculation modes and weighted summation processes, matching features of different dimensions are transformed into a unified quantitative score index.
[0056] In step S603 of some embodiments, the result generation module performs normalization processing on the sum of scores generated during the alignment process, thereby determining a genetic similarity alignment result that can accurately quantify the kinship between samples. In this process, a transformation calculation is performed based on the functional relationship between the sum of scores and the total number of valid loci involved in the alignment; for example, the quotient of the sum of scores and twice the number of valid loci is determined as the similarity coefficient. The finally determined genetic similarity alignment result is written to the result buffer for subsequent statistical analysis modules to use in generating a similarity matrix or outputting an analysis report in a standard format.
[0057] Through steps S601 to S603, by introducing a multi-dimensional similarity calculation mode and a flexible weighted accumulation mechanism, the applicability and computational accuracy of the genetic marker analysis scheme are significantly improved. Using a preset similarity calculation mode as the logic engine, the optimal alignment criteria can be automatically adapted to different biological research needs. By performing weighted accumulation processing on the locus counts of each matching degree, multi-dimensional genotypic differences are transformed into a quantifiable score sum, ensuring the rigor of the final genetic similarity alignment results in reflecting the true genetic distance of the samples.
[0058] Please see Figure 7 In some embodiments, the similarity calculation mode includes a strict matching mode, a soft matching mode, a mode that ignores heterozygous sites, and a weighted scoring mode. Step S602 may include, but is not limited to, steps S701 to S704: Step S701: In response to the similarity calculation mode being a strict matching mode, based on the comparison results of numerical vectors, a site count value representing the number of perfectly matched sites is obtained, and a weighted summation is performed to obtain the total score. Step S702: In response to the similarity calculation mode being soft matching mode, the target genotype is determined, and either of the two corresponding numerical vectors represents the target genotype. The corresponding site count value is obtained and then weighted and accumulated to obtain the total score. Step S703: In response to the similarity calculation mode being the mode of ignoring heterozygous sites, the target genotype is determined, and the results of the equal comparison are filtered based on the target genotype to obtain the site count value representing the number of matching sites after excluding the target genotype. The result is then weighted and accumulated to obtain the total score. Step S704: In response to the similarity calculation mode being a weighted score mode, the total score is obtained by accumulating the product of the site count value representing the number of completely matched sites and the preset first weight score, and the product of the site count value representing the number of partially matched sites and the preset second weight score.
[0059] In step S701 of some embodiments, in strict matching mode, a vectorized alignment operator is invoked to perform equality comparison processing on corresponding components in the numerical vector. By performing a site-by-site numerical consistency determination on the numerical vector, a site count value representing the number of perfectly matched sites is obtained, reflecting the scale of sites that are completely identical in genotype between the two samples. The obtained site count value is then passed to the accumulation module for weighted accumulation processing, and is calculated with a preset unit weight to obtain a total score reflecting the degree of strict consistency between the samples.
[0060] In step S702 of some embodiments, in soft-matching mode, a target genotype is determined within the execution environment. This target genotype is typically defined as a heterozygous genotype with wildcard attributes. During the comparison process, the logic determination module examines the two corresponding numerical vectors. If any component of either numerical vector represents the target genotype, or if the component values of the two numerical vectors are equal, the locus is determined to meet the matching condition, and the corresponding locus count is calculated accordingly. Subsequently, a weighted summation process is used to convert this into a total score, which is then used to evaluate genetic similarity under a heterozygous fault-tolerance mechanism.
[0061] In step S703 of some embodiments, in the mode of ignoring heterozygous sites, the target genotype is determined in the alignment process, and bit filtering is performed on the alignment mask vector using the positional features of the target genotype. During this process, sites containing the target genotype in the numerical vector are identified and removed from the valid alignment interval. Only the remaining homozygous sites are subjected to equality comparison processing, thereby obtaining a site count value representing the number of matching sites after excluding heterozygous sites. This is then converted into a score sum through weighted accumulation, ultimately generating a score sum without considering heterozygous variation interference.
[0062] In step S704 of some embodiments, in the weighted scoring mode, multi-level alignment logic is executed to achieve more detailed quantification of genetic differences. This involves extracting a first locus count representing the number of perfectly matched loci and a second locus count representing the number of partially matched loci. The first locus count is then multiplied by a preset first weighted score, and the second locus count is multiplied by a preset second weighted score. By summing these two product terms, a total score reflecting progressive genetic differences is obtained. This total score provides crucial numerical support for calculating a refined genetic similarity coefficient.
[0063] Through steps S701 to S704, by providing multiple differentiated similarity calculation modes and adapting specific vectorized processing logic for each mode, the functional dimensions and application scenarios of genetic similarity analysis are greatly enriched. By performing bit filtering and weighted accumulation processing on numerical vectors using different strategies, the embodiments of this application can dynamically adjust the alignment accuracy according to different biological research objectives. By directly linking pattern recognition with hardware-level alignment count values, it ensures that regardless of the matching mode, an accurate total score can be quickly obtained through weighted accumulation processing, thereby achieving in-depth mining and standardized quantification of genetic marker differences while ensuring processing efficiency.
[0064] Steps S101 to S104 of this embodiment involve: acquiring single nucleotide polymorphism (SNP) data to be analyzed; performing category mapping processing on the SNP data to obtain numerical vectors; performing hardware architecture detection processing on the execution environment to obtain a vector processing instruction set; and performing parallel alignment processing on the numerical vectors based on the vector processing instruction set to obtain genetic similarity alignment results. Therefore, this application converts single-precision floating-point data, which occupies 4 bytes of memory in traditional solutions, into data with lower memory usage by performing category mapping processing on the SNP data to obtain numerical vectors, thus avoiding excessive memory consumption and resource occupation. Simultaneously, by performing hardware architecture detection processing on the execution environment to obtain a vector processing instruction set and performing parallel alignment processing on the numerical vectors based on this instruction set, batch processing of multiple sites with a single instruction is achieved, thereby improving the processing efficiency of genetic similarity calculation.
[0065] Please see Figure 8 In some embodiments, step S104 may be followed by steps S801 to S803, including but not limited to: Step S801: Obtain the set of sample identifiers to be analyzed; Step S802: Establish a matrix index mapping table based on the sample identifier set; Step S803: Perform matrix filling processing on the genetic similarity comparison results based on the matrix index mapping table to obtain a similarity matrix file.
[0066] In step S801 of some embodiments, by parsing the task configuration information or the instructions input by the user, a set of all sample identifiers to be analyzed in this analysis task is obtained, so as to establish the dimensional benchmark and logical coordinates for the subsequent construction of the similarity matrix. The set of sample identifiers constitutes the basic dimension of genetic similarity analysis.
[0067] The sample identifier set here does not refer to all text information in the original file, but specifically to a unique identifier sequence that has a one-to-one correspondence with the numerical vectors used for comparison after pre-processing parsing and filtering. The process of obtaining the sample identifier set is essentially extracting the identity tags of the samples from structured single nucleotide polymorphism data and arranging them according to a preset logical order.
[0068] In step S802 of some embodiments, a matrix index mapping table is established based on the obtained sample identifier set. By constructing a hash mapping, each abstract sample identifier is bound one-to-one with the integer row index or column index in the numerical matrix. The main purpose of establishing this mapping table is to provide a positioning basis for subsequent automatic filling, so that when processing massive sample comparison results, the specific coordinate position that should correspond to the sample identifier in the similarity matrix can be retrieved and determined in real time according to the sample identifier.
[0069] In step S803 of some embodiments, matrix filling is performed on the genetic similarity alignment results based on a matrix index mapping table to obtain the final similarity matrix file. In one specific embodiment, when performing matrix filling, the diagonal values of the matrix are first preset to 100.00, and then all sample alignment results generated through parallel computing are traversed. By looking up the row and column indices corresponding to each pair of sample IDs in the matrix index mapping table, the calculated similarity coefficient values are synchronously filled into the target coordinates and the symmetric coordinates of the target coordinates. After completing the data filling of all sample pairs, the matrix data in memory is dumped into a comma-separated value format or a dedicated binary matrix format to generate a similarity matrix file that can intuitively reflect the kinship between samples within the population.
[0070] Through steps S801 to S803, a dynamic mapping mechanism between sample identifiers and matrix coordinates is introduced, achieving an efficient conversion from discrete sample alignment results to structured genetic relationship maps. The rapid retrieval and symmetric filling processing performed using a matrix index mapping table overcomes the technical bottleneck of low efficiency in matching result data with matrix space coordinates in large-scale sample set computation tasks. This automated matrix filling process transforms tens of thousands of similarity coefficients into standardized similarity matrix files that are easy for secondary analysis, thereby improving the integration of result presentation and subsequent system analysis, and ensuring that high-accuracy kinship matrix construction can be completed with low resource overhead when processing ultra-large-scale genomic datasets.
[0071] This application also provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the above-described genetic marker similarity analysis method. This electronic device can be any smart terminal, including tablet computers, in-vehicle computers, etc.
[0072] Please see Figure 9 , Figure 9 The hardware structure of an electronic device according to another embodiment is illustrated. The electronic device includes: The processor 901 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this application. The memory 902 can be implemented as a read-only memory (ROM), static storage device, dynamic storage device, or random access memory (RAM). The memory 902 can store the operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 902 and called by the processor 901 to execute the genetic marker similarity analysis method of the embodiments of this application. The input / output interface 903 is used to implement information input and output; The communication interface 904 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, Ethernet cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.). Bus 905 transmits information between various components of the device (e.g., processor 901, memory 902, input / output interface 903, and communication interface 904); The processor 901, memory 902, input / output interface 903, and communication interface 904 are connected to each other within the device via bus 905.
[0073] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described genetic marker similarity analysis method.
[0074] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0075] The genetic marker similarity analysis method, electronic device, and storage medium provided in this application acquire single nucleotide polymorphism (SNP) data to be analyzed; perform category mapping processing on the SNP data to obtain numerical vectors; perform hardware architecture detection processing on the execution environment to obtain a vector processing instruction set; and perform parallel alignment processing on the numerical vectors based on the vector processing instruction set to obtain genetic similarity comparison results. Therefore, this application converts single-precision floating-point data, which occupies 4 bytes of memory in traditional solutions, into data with lower memory consumption by performing category mapping processing on the SNP data to obtain numerical vectors, thus avoiding excessive memory consumption and resource occupation problems. Simultaneously, by performing hardware architecture detection processing on the execution environment to obtain a vector processing instruction set and performing parallel alignment processing on the numerical vectors based on this instruction set, batch processing of multiple sites with a single instruction is achieved, thereby improving the processing efficiency of genetic similarity calculation.
[0076] The embodiments described in this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided by the embodiments of this application. As those skilled in the art will know, with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of this application are also applicable to similar technical problems.
[0077] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of this application, and may include more or fewer steps than shown, or combine certain steps, or different steps.
[0078] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0079] Those skilled in the art will understand that all or some of the steps in the methods disclosed above, as well as the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, or suitable combinations thereof.
[0080] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0081] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0082] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of the units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. The coupling or direct coupling or communication connection between the shown or discussed units may be through some interfaces, or indirect coupling or communication connection between the apparatus or units, and may be electrical, mechanical, or other forms.
[0083] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0084] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0085] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes multiple instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing programs, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0086] The preferred embodiments of the present application have been described above with reference to the accompanying drawings, but this does not limit the scope of the claims of the present application. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and substance of the embodiments of the present application shall be within the scope of the claims of the present application.
Claims
1. A method of similarity analysis of genetic markers, characterized by, The method includes: Obtain the single nucleotide polymorphism data to be analyzed; The single nucleotide polymorphism data is subjected to category mapping to obtain a numerical vector; The hardware architecture of the execution environment is detected and processed to obtain the vector processing instruction set; Parallel alignment processing is performed on the numerical vectors based on the vector processing instruction set to obtain genetic similarity alignment results.
2. The method of claim 1, wherein, The process of class mapping the single nucleotide polymorphism data to obtain a numerical vector includes: Obtain the preset encoding rules; The single nucleotide polymorphism data is subjected to category mapping based on the encoding rules to obtain the numerical vector of type 8 unsigned integer; wherein the numerical vector includes a first value corresponding to the homozygous genotype, a second value corresponding to the heterozygous genotype, and a third value corresponding to the missing value.
3. The method of claim 1, wherein, The parallel comparison processing of the numerical vectors based on the vector processing instruction set to obtain the genetic similarity comparison results includes: The absolute difference vector is obtained by performing an absolute difference calculation on the numerical vector. Based on the absolute difference vector, an equality comparison process is performed to obtain multiple comparison mask vectors representing different matching degrees; Bit statistics are performed on the multiple alignment mask vectors to obtain the site count values corresponding to each matching degree, and the site count values are determined as the genetic similarity alignment results.
4. The method according to claim 3, characterized in that, The step of performing bit-statistical processing on the multiple alignment mask vectors to obtain the locus count values corresponding to each matching degree, and determining the locus count values as the genetic similarity comparison results, includes: Obtain the preset similarity calculation pattern; Based on the aforementioned similarity calculation model, the site counts for each matching degree are weighted and accumulated to obtain a total score. The genetic similarity comparison result is determined by summing the scores.
5. The method of claim 4, wherein, in, The similarity calculation modes include strict matching mode, soft matching mode, mode that ignores heterozygous sites, and weighted scoring mode; The weighted summation of the site counts for each matching degree based on the similarity calculation model to obtain a total score includes: In response to the similarity calculation mode being a strict matching mode, based on the equality comparison results of the numerical vectors, the site count value representing the number of perfectly matched sites is obtained, and a weighted summation process is performed to obtain the total score; In response to the similarity calculation mode being a soft matching mode, the target genotype is determined, and either of the two corresponding numerical vectors represents the target genotype. The corresponding locus count value is obtained, and a weighted summation is performed to obtain the total score. In response to the similarity calculation mode being the mode of ignoring heterozygous sites, a target genotype is determined, and the results of the equality comparison are subjected to site filtering based on the target genotype to obtain the site count value representing the number of matching sites after excluding the target genotype. The result is then weighted and accumulated to obtain the total score. In response to the similarity calculation mode being a weighted scoring mode, the sum of the scores is obtained by accumulating the product of the site count value representing the number of fully matched sites and a preset first weight score, and the product of the site count value representing the number of partially matched sites and a preset second weight score.
6. The method of claim 1, wherein, The hardware architecture detection process of the execution environment to obtain the vector processing instruction set includes: Obtain the hardware condition information of the execution environment and the parallel computing instructions supported by the execution environment; Based on the hardware condition information, obtain the preset result buffer threshold and block step size parameters; The vector processing instruction set for parallel processing is obtained based on the parallel computing instructions, the result buffer threshold, and the block step size parameter.
7. The method of claim 1, wherein, The acquisition of the single nucleotide polymorphism data to be analyzed includes: Get the file size information of the raw data file; In response to the file size information meeting a preset threshold, the original data file is read using memory mapping technology with zero copy processing to obtain the single nucleotide polymorphism data.
8. The method of claim 1, wherein, After performing parallel alignment processing on the numerical vector based on the vector processing instruction set to obtain the genetic similarity alignment result, the method further includes: Obtain the set of sample identifiers to be analyzed; A matrix index mapping table is established based on the sample identifier set; The genetic similarity comparison results are filled with matrix based on the matrix index mapping table to obtain a similarity matrix file.
9. An electronic device, comprising: The electronic device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the genetic marker similarity analysis method according to any one of claims 1 to 8.
10. A computer-readable storage medium storing a computer program, the computer program comprising instructions that, when executed by a computer, cause the computer to perform the method of any one of claims 1 to 9. When the computer program is executed by a processor, it implements the similarity analysis method for genetic markers according to any one of claims 1 to 8.