A privacy gene sequence distance matrix calculation method based on homomorphic encryption
By using the semi-homomorphic encryption algorithm Paillier, the problem of homomorphic encryption technology being inefficient in gene sequence distance matrix calculation is solved, safe and efficient gene sequence distance matrix calculation and evolution tree analysis are realized, and multiple base encodings are met need.
Patent Information
- Application Number
- CN202210558985.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-22
- Publication Date
- 2024-11-22
- Estimated Expiration
- 2042-05-22
AI Technical Summary
The existing homomorphic encryption technology, especially the total homomorphic encryption, is inefficient in the calculation of gene sequence distance matrix, and cannot effectively support evolutionary tree analysis. The existing research cannot use homomorphic encryption technology to calculate the distance matrix, and binary encoding cannot Meet the coding needs of multiple common bases.
The efficient semi-homomorphic encryption algorithm Paillier is used to generate homomorphic encryption public and private keys by encoding bases as integers, perform ciphertext operations and decryption, calculate the distance matrix between gene sequences, and generate an evolution tree.
It realizes the safe and efficient calculation of the distance matrix between gene sequences, supports evolutionary tree analysis, improves calculation efficiency, meets multiple base coding needs, and avoids the leakage of sensitive data.
Smart Images

Figure CN114978468B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of privacy gene sequence distance matrix calculation methods based on homomorphic encryption. Background Art
[0002] Evolutionary tree: A tree-like branching diagram that represents the relationship between species or genes.
[0003] Evolutionary tree analysis: It is a method used to study species or sequence evolution and systematic classification. The general research object is base sequence or amino acid sequence, and the evolutionary relationship between organisms is calculated through mathematical statistics algorithms.
[0004] Constructing an evolutionary tree is usually divided into the following stages:
[0005] (1) Gene alignment: Common algorithms include the Needleman–Wunsch algorithm.
[0006] (2) Distance matrix calculation: used to analyze the evolutionary distance between a pair of gene sequences. Common algorithms include p-distance, Jukes-Cantor distance, etc.
[0007] (3) Construct an evolutionary tree based on the distance matrix. Common algorithms include NJ.
[0008] In addition to academic research, evolutionary tree analysis also has important guiding significance for our daily lives, such as the genome evolution analysis of the new coronavirus: Due to the high toxicity, secrecy, strong variability, and rapid spread of the new coronavirus, any slackness can lead to major disasters. In the post-epidemic era, the evolutionary analysis of the new coronavirus genome provides comprehensive and effective data support for comprehensively assessing epidemic risks, initiating public health response measures, and formulating medical countermeasures.
[0009] Privacy computing refers to a type of technology that analyzes, processes, and verifies data without disclosing the original data. The scope of privacy computing also includes the entire process of information processing, including data production, storage, calculation, and application.
[0010] The significance of privacy computing lies in that it can fully connect the data silos between various data sources, break through the threshold of data analysis, improve data utilization, and promote multi-center collaborative sharing and results transformation.
[0011] Common types of privacy computing technologies include but are not limited to Federated Learning (FL), Trusted Execution Environment (TEE), Secure Multiparty Computation (MPC), Homomorphic Encryption (HE), and other technologies.
[0012] Homomorphic encryption is an encryption algorithm that can directly perform calculations on ciphertext, and the decryption result is the same as the result of the same calculation on the plaintext.
[0013] Homomorphic encryption is mainly divided into fully homomorphic encryption, semi-homomorphic encryption and finite-level fully homomorphic encryption.
[0014] (1) Fully Homomorphic Encryption
[0015] Fully homomorphic encryption is a homomorphic encryption algorithm that can perform arbitrary calculations on ciphertext (divided into arithmetic addition, multiplication, or logical bit-wise XOR and AND).
[0016] (2) Semi-homomorphic encryption, fully homomorphic encryption of finite order
[0017] At present, due to the efficiency and storage limitations of fully homomorphic encryption in application, semi-homomorphic encryption or finite-level fully homomorphic encryption is more widely used. Semi-homomorphic encryption algorithms only support homomorphic operations of ciphertext addition or multiplication, while finite-level fully homomorphic encryption supports homomorphic operations of addition and multiplication with a finite number of layers.
[0018] Gene sequence analysis has great commercial application value in healthcare, biomedicine, biometric authentication, etc. On the other hand, in recent years, with the rapid development of gene sequencing and analysis technology, more and more personal gene data are used for gene research, disease-targeted treatment, etc., such as Genome-Wide Association Studies (GWAS), Personal Genome Project (PGP), HapMap and other genetic projects.
[0019] Genetic engineering is often very large, and genetic data also takes up a lot of storage. It is difficult for general companies and medical institutions to do genetic analysis independently. It often requires cooperation among multiple companies and institutions to share data and outsource storage and computing.
[0020] Therefore, although these projects have promoted the advancement of gene analysis technology, they have also led to the distribution, sharing and leakage of a large amount of personal gene data. Genetic data is extremely sensitive personal information, and once leaked, it may cause serious consequences such as life safety.
[0021] In recent years, countries have gradually attached importance to personal information privacy, especially with the release of laws and regulations such as GDPR, CCPA, and the "Personal Information Protection Law of the People's Republic of China". While collecting and using data, companies and individuals also have the obligation to protect data. This means that sensitive personal genetic data can no longer be shared casually as before and needs to be strictly controlled.
[0022] On the other hand, privacy computing has also been developing rapidly in recent years, and various technologies have gradually expanded from academic research to practical applications, such as trusted execution environment TEE, homomorphic encryption HE, multi-party computing MPC, federated learning, and so on.
[0023] Among them, homomorphic encryption can directly perform computational analysis on ciphertext without leaking plaintext data, and is an important branch of privacy computing technology. Although early homomorphic encryption algorithms, especially fully homomorphic encryption, were inefficient and took up a lot of storage. However, in recent years, with the deepening of academic research, the computational efficiency of fully homomorphic encryption has been continuously improved, and its commercial application scenarios have also been expanded. Many cloud vendors have begun to provide fully homomorphic encryption services. It also has application scenarios in finance, medical care, big data and other fields.
[0024] Therefore, in order to protect users' sensitive genetic data while continuing to analyze genetic data, homomorphic encryption has gradually become a feasible solution. For example, in reference [1], private genetic sequence search is implemented using fully homomorphic encryption technology. Reference [2] uses homomorphic encryption to calculate the Hamming distance to achieve genetic sequence alignment.
[0025] At present, references [1] and [2] use fully homomorphic encryption to perform gene analysis such as gene sequence alignment and gene search. These methods cannot use homomorphic encryption technology to calculate the distance matrix for phylogenetic tree analysis, and this type of research uses a fully homomorphic encryption algorithm, which is not as efficient as the semi-homomorphic Paillier algorithm. In addition, reference [3] uses fully homomorphic encryption to calculate the Hamming distance between gene vectors for biometric authentication. This type of research using homomorphic encryption to calculate the Hamming distance is somewhat similar to the analysis and calculation work we are going to do, but its encoding method is binary, which does not meet the encoding of multiple common bases (ACGT) and other abnormal bases, and cannot be directly used to calculate the distance matrix. It also uses fully homomorphic encryption, which is inefficient. Summary of the invention
[0026] The purpose of the present invention is to provide a privacy gene sequence distance matrix calculation method based on homomorphic encryption. The method uses the efficient semi-homomorphic encryption algorithm Paillier to securely solve the distance matrix between two gene sequences and perform evolutionary tree analysis based on it.
[0027] The technical solution adopted by the present invention to achieve the above technical requirements is: a method for calculating the distance matrix of a privacy gene sequence based on homomorphic encryption, comprising the following steps:
[0028] Step 1, encoding: Encode the bases that need to be compared between A and B into integers;
[0029] Step 2: Key generation and base encryption: Party A generates homomorphic encryption public and private keys, and homomorphically encrypts the integer after encoding the local gene sequence, and sends the ciphertext and public key to Party B at the same time;
[0030] Step 3: Ciphertext calculation: Party B uses homomorphic encryption to perform ciphertext calculation in the privacy equality protocol on the base ciphertext at the same position, generates the calculated ciphertext, and sends it to Party A.
[0031] Step 4: Ciphertext decryption: Party A decrypts the ciphertext sent back by Party B;
[0032] Step 5, statistical distance: when counting, if the bases of party A and party B at the same position are the same, the decryption result is a fixed constant; if the bases of party A and party B at the same position are different, then the decryption result is not equal to this fixed constant, and the size is within a certain range;
[0033] Step 6: Repeat the above steps until the distance scores of all gene sequences between the participants are calculated; further calculate the distance matrix of the gene sequence group and finally generate an evolutionary tree.
[0034] Furthermore, in the above-mentioned privacy gene sequence distance matrix calculation method based on homomorphic encryption: in step 1, the bases are encoded into integers, and the encoding rules are as follows:
[0035] Step 1-1, 4 large bases, coded as follows:
[0036] A:1
[0037] C:2
[0038] G:3
[0039] T:4;
[0040] Step 1-2, base default value encoding, default value N,n,-:1000;
[0041] Step 1-3, other outliers: distance from letter A + 4;
[0042] A local gene sequence X is encoded as (x1, x2, ..., xn), and a local gene sequence Y is encoded as (y1, y2, ..., yn).
[0043] Furthermore, in the above-mentioned privacy gene sequence distance matrix calculation method based on homomorphic encryption: in step 2, Party A selects the homomorphic encryption algorithm Paillier and security parameters, and generates public and private keys pk, sk.
[0044] Furthermore, in the above-mentioned privacy gene sequence distance matrix calculation method based on homomorphic encryption:
[0045] In the step 2, when Party A encodes the local gene sequence and performs homomorphic encryption on the integer, Party A uses the public key pk to encrypt the local gene sequence X = (x1, ..., xn) to generate (Enc (x1), Enc (x2), ..., Enc (xn)), and sends these ciphertexts and pk to Party B;
[0046] In step 3, the ciphertext operation includes:
[0047] Party B receives the public key pk sent by Party A, and uses the public key pk to encrypt the local gene sequence Y = (y1, ..., yn) to generate the ciphertext (Enc (y1), Enc (y2), ..., Enc (yn));
[0048] Party B calculates {ki=(Enc(xi)-Enc(yi))*v1+v0} and sends {ki} to Party A; where i=1,…,n, v0 is a fixed value of 5, and v1 is a random value between 100-500.
[0049] Furthermore, in the above-mentioned privacy gene sequence distance matrix calculation method based on homomorphic encryption: before party B sends {ki} to party A, its order must be randomly scattered.
[0050] Furthermore, in the above-mentioned privacy gene sequence distance matrix calculation method based on homomorphic encryption: in the step 4, party A decrypts the ciphertext sent back by party B, including: party A uses the private key sk to decrypt ki, v=Dec(ki), and counts the number of v count that is not equal to 5 and less than 60000, and determines that the distance score between the two gene sequences is equal to score=count / n.
[0051] The present invention uses the efficient semi-homomorphic encryption algorithm Paillier to achieve the safe solution of the distance matrix between the gene sequences of two parties, and uses it to perform evolutionary tree analysis.
[0052] In the present invention, the distance matrix between gene sequence groups is safely solved and further decomposed. The calculation decomposition of the distance matrix is as follows: the Hamming distance between two gene sequences is calculated multiple times in a private manner.
[0053] The solution to the Hamming distance is actually to solve the number of equal bases at the same position in the gene sequence in a private way. This problem can be solved by using Paillier homomorphic encryption to construct a private equality protocol.
[0054] The present invention will be further described below in conjunction with the accompanying drawings and specific embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] Attached Figure 1 This is a flow chart of Example 1 of the present invention. DETAILED DESCRIPTION
[0056] Example 1: This example is a method for calculating the distance matrix of a privacy gene sequence based on homomorphic encryption. Figure 1 As shown, the idea of this embodiment is as follows:
[0057] The distance matrix between gene sequence groups is solved securely and further decomposed. The calculation of the distance matrix is decomposed into: repeatedly performing the private Hamming distance calculation between two gene sequences.
[0058] The solution to the Hamming distance is actually to solve the number of equal bases at the same position in the gene sequence in a private way. This problem can be solved by using Paillier homomorphic encryption to construct a private equality protocol.
[0059] The specific steps include:
[0060] S1 first selects a computing communication framework for implementation. Here we choose the open source federated learning framework FATE.
[0061] S2 assumes that the two parties involved in the calculation are Party A and Party B.
[0062] In order to perform homomorphic encryption, S3 first needs to encode the bases of both A and B into integers. The specific encoding rules are as follows:
[0063] First, there are 4 major bases, coded as follows:
[0064] A:1
[0065] C:2
[0066] G:3
[0067] T:4
[0068] ·Base default value encoding, default value N,n,-: 1000 (in order to count the number of equal bases and distinguish between default and normal mismatches, a larger value of 1000 is set)
[0069] Other outliers (test samples found to contain an outlier base such as Y): the distance of letter A + 4, such as B is encoded as (BA) + 4 = 5, and D is encoded as (DA) + 4 = 7.
[0070] A local gene sequence X is encoded as (x1, x2, ..., xn), and a local gene sequence Y is encoded as (y1, y2, ..., yn).
[0071] Party A selects the homomorphic encryption algorithm Paillier and security parameters (2048-bit key length) and generates public and private keys pk and sk.
[0072] S4. Party A uses the public key pk to encrypt the gene sequence X = (x1,…,xn) to generate (Enc(x1), Enc(x2),…,Enc(xn)), and sends these ciphertexts and pk to Party B.
[0073] S5. Party B receives the public key pk, uses the public key pk to encrypt the local gene sequence Y = (y1, ..., yn) to generate (Enc (y1), Enc (y2), ..., Enc (yn)), and calculates {ki = (Enc (xi) - Enc (yi)) * v1 + v0} and sends {ki} to A, where i = 1, ..., n, v0 is a fixed value of 5, and v1 is a random value between 100 and 500. Before {ki} is sent to A, its order must be randomly scattered to prevent A from recovering the specific matching bases through the obtained v = v0 order.
[0074] S6. Party A uses the private key sk to decrypt ki, v = Dec(ki), and counts the number of v count that is not equal to 5 and less than 60000. Then the distance score between the two gene sequences is equal to score = count / n.
[0075] S7. Repeat the process (4)-(6) until the distance scores of all gene sequences between the participants are calculated and the score matrix score_matrix is output. Party A further calculates the evolutionary tree through score_matrix. The output result example is as follows:
[0076]
[0077] References:
[0078] [1] Yamada, Yuki, Kurt Rohloff, and Masato Oguchi. "Homomorphic encryption for privacy-preserving genome sequences search." 2019 IEEE International Conference on Smart Computing (SMARTCOMP). IEEE, 2019.
[0079] [2] Kim, Miran, and Kristin Lauter. "Private genome analysis through homomorphic encryption." BMC medical informatics and decision making. Vol. 15. No. 5. BioMed Central, 2015.
[0080] [3] Yasuda, Masaya. "Secure Hamming distance computation for biometrics using ideal-lattice and ring-LWE homomorphic encryption." Information Security Journal: A Global Perspective 26.2 (2017): 85-103.
Claims
1. A method for calculating the distance matrix of a private gene sequence based on homomorphic encryption, characterized in that: The following steps are involved: Step 1, encoding: Encode the bases that need to be compared between A and B into integers; Step 2: Key generation and base encryption: Party A generates homomorphic encryption public and private keys, and homomorphically encrypts the integer after encoding the local gene sequence, and sends the ciphertext and public key to Party B at the same time; Step 3: Ciphertext calculation: Party B uses homomorphic encryption to perform ciphertext calculation in the privacy equality protocol on the base ciphertext at the same position, generates the calculated ciphertext, and sends it to Party A. Step 4: Ciphertext decryption: Party A decrypts the ciphertext sent back by Party B; Step 5, statistical distance: when counting, if the bases of party A and party B at the same position are the same, the decryption result is a fixed constant; if the bases of party A and party B at the same position are different, then the decryption result is not equal to this fixed constant, and the size is within a certain range; Step 6: Repeat the above steps until the distance scores of all gene sequences between the participants are calculated; further calculate the distance matrix of the gene sequence group and finally generate an evolutionary tree. In step 1, the bases are encoded into integers, and the encoding rules are as follows: Step 1-1, 4 large bases, coded as follows: A:1 C:2 G:3 T:4; Step 1-2, base default value encoding, default value N,n,-: 1000; Step 1-3, other outliers: distance from letter A + 4; A local gene sequence X is encoded as (x1, x2, ..., xn), and B local gene sequence Y is encoded as (y1, y2, ..., yn). In step 2, Party A selects the homomorphic encryption algorithm Paillier and security parameters, and generates public and private keys pk, sk. When Party A encodes the local gene sequence and performs homomorphic encryption on the integer, Party A uses the public key pk to encrypt the local gene sequence X=(x1,…,xn) to generate (Enc(x1), Enc(x2),…,Enc(xn)), and sends these ciphertexts and pk to Party B; In step 3, the ciphertext operation includes: Party B receives the public key pk sent by Party A, and uses the public key pk to encrypt the local gene sequence Y=(y1,…,yn)to generate the ciphertext (Enc(y1),Enc(y2),…,Enc(yn)); Party B calculates {ki=(Enc(xi)-Enc(yi))*v1+v0} and sends {ki} to Party A; Where i=1,…,n, v0 is a fixed value of 5, and v1 is a random value between 100-500.
2. The method for calculating the privacy gene sequence distance matrix based on homomorphic encryption according to claim 1, characterized in that: Before Party B sends {ki} to Party A, its order must be randomly scattered.
3. The method for calculating the privacy gene sequence distance matrix based on homomorphic encryption according to claim 2 is characterized in that: In the step 4, Party A decrypts the ciphertext sent back by Party B, including: Party A uses the private key sk to decrypt ki, v=Dec(ki), counts the number of v count that is not equal to 5 and less than 60000, and determines that the distance score between the two gene sequences is equal to score=count / n.
