I am very interested in privacy preserving technolgies, such as Microsoft PINQ and would like to see if this is applicable to DNA comparison.

Given that I don't have a background in biology, I would appreciate it if someone could tell me how DNA is represented in a computer (in computer science terms), and how DNA is compared in a binary format (or logical equivalent).

The privacy preserving technology I'm using allows the patient to have granular control over what DNA data they share, and how it's used. The receiving agency (medical research, FBI, fertility clinics) will receive cryptographic proof of a DNA result, without exposing all DNA values.

I suspect that each of the following use-cases focus on a certain subset of data, and if the same information was presented to all of them, it would be a breach of privacy:

  • Combined DNA Index System, or CODIS
  • State DNA index system (SDIS)
  • National DNA Index System (NDIS)
  • FBI's 13-Loci
  • Other government's DNA matching requirements for inclusion/exclusion
  • Disease susceptibility via single nucleotide polymorphism (SNP), and related heredity
  • Paternity tests
  • Evolutionary patterns

Furthermore, based on my independent research, I understand that there are many ways to determine the DNA of a given sample. What I don't understand is if every test has the same output? (e.g. are all chromosomes are returned, vs only 23? (or less))

The value-add I am trying to provide the patient privacy, while fulfilling all legal, moral, and ethical disclosures of data requested of them. The recipient will have assurance the data is authentic, despite the inherent double blinding of the field data.

The cryptography allows for

  • Redacting (or black out) certain values
  • Anonymously compare a numerical value, (greater than, less than, equal to) without disclosing that value.
  • Prove, or verifiably disprove, that a value is not in a certain list of arbitrary values.
  • The agency to know which DNA testing firm generated the results
  • The DNA testing firm to not know who the patient is, especially in cases of partial disclosure of DNA data.

Your response will help me contribute what I believe to be the moral, ethical, and socially responsible way to handling PII and DNA data. (yes it will be open source)

  • 1
    $\begingroup$ DNA sequences are typically stored in FASTA format. There are indeed many methods to sequence DNA, on which depends the data that is returned (ie the output) and the analysis required. You're not going to sequence all 46 chromosomes in a single experiment. Analysis of CODIS markers, for example, only requires amplification of specific short tandem repeats (STRs) and does not even require sequencing. $\endgroup$
    – canadianer
    Jun 2, 2015 at 22:10
  • $\begingroup$ DNA sequences are usually compared using BLAST (en.wikipedia.org/wiki/BLAST), which breaks sequences into short words which can be searched efficiently. However, that does require having entire sequences around somewhere, which might be a privacy violation. $\endgroup$
    – Gaurav
    Jun 2, 2015 at 22:37

1 Answer 1


From a computer science perspective, there's nothing at all special about DNA. It's stored as a simple ASCII text file consisting of repetitions of 4-15 different letters.

DNA, the molecule, is a long chain of nearly identical smaller molecules (nucleotides) joined together. The nucleotides differ only in which of four possible bases (A,C,T/U or G) they have attached. Therefore, when representing a DNA sequence, we only need to represent the bases. There are also the so-called "ambiguity codes" which represent different possibilities:

IUPAC Code   Meaning             
  A            A                   
  C            C                   
  G            G                   
  T/U          T                   
  M            A or C              
  R            A or G              
  W            A or T              
  S            C or G              
  Y            C or T              
  K            G or T              
  V            A or C or G         
  H            A or C or T         
  D            A or G or T         
  B            C or G or T         
  N            G or A or T or C    

The vast majority of sequences, however, won't use the ambiguity codes and will only have A,C,T,G and the occasional N.

The most common DNA sequence format is FASTA, which consists of one or more sequences each of which has a header (lines beginning with a >) and 60-character long sequences. This, for example, is an excerpt of human chromosome 17:


So, in conclusion, there's nothing special about DNA. If you're writing software that compares DNA sequences, you are writing software that compares ASCII text. You can hash it, salt it and anything else you might want to do.

The only thing you should be aware of is that minor variations are very rarely meaningful. The level of identity you will need will depend on the precise biological question being asked but as a general rule, a single nucleotide difference is as likely to be a sequencing error as a real difference. You will need to collaborate with biologists in order to set up the right threshold for whatever your project is looking at.

  • $\begingroup$ Thanks this is a great primer! Do you know why some letters are lowercase? Also do you know where I can find sample data for any of the above listed purposes (paternity, disease testing, other examples...)? $\endgroup$ Jun 3, 2015 at 18:47
  • $\begingroup$ @LamonteCristo lower case can mean various things depending on the source of the sequence. It is often used to indicate i) low quality data, cases where sequencing errors are likely or ii) masked sequences, repetitive elements and the like. You probably don't need to worry about it. As for sample data, no, sorry. I've never worked with that sort of thing. Sample sequences in general are trivial to fins (have a look at the NCBI nucleotide database. $\endgroup$
    – terdon
    Jun 3, 2015 at 18:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .