Lesson 4 of 10
Module 1 · Understanding omics
Nearly every layer in this course is measured by sequencing. Knowing what happens between a tissue sample and a file of reads explains most of the strengths, and most of the errors, you will meet later.
From sample to library
Before a machine can read anything, the molecules in a sample have to be turned into a form the machine can handle. That prepared material is called a library: a large collection of short DNA pieces, each with known sequences attached to its ends. Making a library takes four steps.
In The central dogma, as data you saw that almost every omics dataset ends up as counts of reads. This lesson explains where those reads come from, and why each step on the way leaves its mark on the data.
- Extract DNA or RNA from the sample. RNA is first copied into DNA.
- Fragment it into pieces of a few hundred bases.
- Add adapters: short known sequences at each end, which let the machine hold and read every fragment. Adapters can carry a barcode so many samples share one run.
- Amplify the fragments by PCR. The result is a library.
Why each step is there
- Extract. Cells are broken open and the DNA or RNA is separated from proteins, fats and everything else. RNA is copied into DNA by an enzyme called reverse transcriptase; the copy is called complementary DNA, or cDNA. This is done because DNA is far more stable than RNA and because most sequencing machines read DNA.
- Fragment. A human chromosome is tens of millions of bases long, but a short-read machine reads only a few hundred bases at a time. Breaking the DNA into short pieces, with sound waves or with enzymes, gives fragments of a size the machine can read.
- Add adapters. An adapter is a short piece of DNA whose sequence the machine already knows. It acts as a handle: the machine grips every fragment by its adapters and starts reading from them. A barcode (also called an index) is a short sequence inside the adapter that is different for each sample. If 24 samples are each given their own barcode, they can be mixed and sequenced together, and the computer sorts the reads back into 24 samples afterwards by reading the barcodes. This sorting is called demultiplexing.
- Amplify. PCR (the polymerase chain reaction) copies DNA in repeated cycles of heating and cooling, and each cycle roughly doubles the amount. Ten cycles give about 210, or roughly 1,000 copies of each fragment. This makes enough material to sequence, but it also creates PCR duplicates: several reads that are copies of one original fragment, and so count as one piece of evidence, not several.
Library preparation is also where many problems begin. If the extracted DNA or RNA is degraded, the fragments are already short and uneven before the machine sees them. If too little material goes in, more PCR cycles are needed, and the share of duplicates rises. Neither problem can be fully fixed by software later, which is why laboratories check the amount and quality of the starting material before making a library.
Barcodes bring one more check. A small share of reads can end up assigned to the wrong sample, for instance when a barcode is misread or swapped during sequencing. For most experiments the effect is tiny, but when looking for a rare variant it matters, so laboratories choose barcodes that differ at several letters and often put a different one on each end of the fragment.
Short reads and long reads
Two families of machine dominate. They differ mainly in how long a piece of DNA they can read in one go, and that one difference decides what each is good at.
- Illumina instruments, the most widely used
- Reads typically 100 to 300 bases, often from both ends of a fragment (paired-end)
- Very accurate and cheap per base
- Struggles with repeats and large rearrangements
- PacBio and Oxford Nanopore instruments
- Reads of tens of thousands of bases, sometimes far longer
- Spans repeats and structural variants in one read
- Higher cost per base; accuracy has improved greatly
How each kind of machine reads
- Short reads (Illumina). The library is washed over a glass slide called a flow cell, where each fragment sticks by its adapters and is copied into a small cluster of identical copies. The machine then builds a new strand on every cluster one base at a time, using bases that each carry a coloured fluorescent tag. A camera records the colour of every cluster after each step, and the colour says which base was added. This approach is called sequencing by synthesis.
- Paired-end reads. The machine reads a fragment from one end, then from the other. With a fragment of 400 bases and reads of 150 bases from each end, you get two reads whose distance apart is roughly known. That extra information helps the computer place reads correctly.
- Long reads (PacBio). A single DNA molecule is read by one polymerase enzyme sitting in a tiny well, and the machine watches light flash as each base is added. In its high-accuracy mode the molecule is a closed loop, so the same sequence is read several times and the passes are combined.
- Long reads (Oxford Nanopore). A DNA or RNA strand is pulled through a tiny protein pore in a membrane. Each stretch of bases disturbs the electrical current through the pore in its own way, and the computer translates the current back into bases.
Why do repeats matter? A repeat is a sequence that occurs many times in the genome, in nearly identical copies. About half of the human genome is made of repeated sequence. If a repeat is longer than a read, a read from inside it matches every copy equally well, so the computer cannot tell where it came from. A long read can start in unique sequence on one side, cross the whole repeat and finish in unique sequence on the other, which pins it down. The same logic applies to a structural variant, such as a large piece of a chromosome that has been flipped or moved: one long read can cover both sides of the break.
In practice, most cancer and clinical sequencing today uses short reads, because it is accurate and cheap enough for many samples. Long reads are chosen when the question is about repeats, large rearrangements or assembling a genome from scratch.
The two are often combined. A project might use long reads to build a high-quality reference genome for a new species, then short reads to sequence many individuals cheaply against it. Long-read machines also offer something short reads usually cannot: because they read the original DNA molecule rather than PCR copies, they can detect some chemical marks on the bases, such as methylation, directly from the signal.
When you look at a pileup like this, read it from top to bottom at one position. Count the reads that cross that position: that number is the coverage there. Coverage is never perfectly even. Some regions are harder to copy by PCR or to map, so they collect fewer reads, and a region that is missing from your reads cannot show you a variant.
A useful second check is the share of reads that support each letter at a position. If the reference has an A and about half the reads show a G, that is the pattern expected for a variant carried on one of a person's two copies of the chromosome. If only one read in fifty shows a G, it is more likely a sequencing error, unless the sample is a tumour, where a variant may be present in only some of the cells. The next lesson, Genomics, turns this share into the variant allele fraction.
Go deeper: why short reads get worse towards their end
Each Illumina cluster holds roughly a thousand copies of one fragment, and the camera reads them together. In every cycle, a few copies fail to add a base, and a few add one too many. Those copies fall out of step with the rest. This drift is called phasing (falling behind) and prephasing (running ahead).
After a few cycles the effect is tiny. After 150 or 250 cycles, a growing share of each cluster is shining the colour of the base before or after, so the signal blurs. The machine becomes less sure which base it saw, and quality scores fall towards the end of the read. This is one of the main reasons short-read machines stop at a few hundred bases, and why trimming poor-quality ends (later in this lesson) is a routine step.
Quality scores
Every base in a read comes with a quality score, the machine's estimate of how likely that base is wrong. Scores use the Phred scale, where each step of 10 means ten times fewer errors. Reads and their scores are stored in FASTQ files.
A FASTQ file is plain text. Each read takes exactly four lines: a name line starting with @, the bases, a separator line starting with +, and a line of quality scores with one character per base. Each score is stored as a single keyboard character so that the quality line has the same length as the read. In the encoding used by modern machines, a character stands for its computer code minus 33: the letter I means 40, ? means 30 and 5 means 20. You do not need to decode these by hand; tools do it for you. But it explains why a quality line looks like a row of random punctuation.
A small example. The record below ends in the characters 55. Each 5 stands for Q20, so each of those last two bases has about a 1 in 100 chance of being wrong. That is still usable, but a run of bases far below Q20 at the end of a read is usually trimmed off before alignment, because it adds more errors than information.
Worked example · reading a Phred score
Q20 → 1 error in 100 bases (99% accurate)
Q30 → 1 error in 1,000 bases (99.9% accurate)
at Q30, a 150-base read has on average 150 ÷ 1,000 = 0.15 errors
Q30 is a common benchmark. A real variant appears in many independent reads; a sequencing error usually appears in one. That is why depth matters.
Step by step. Run the formula backwards to get the error probability from a score: divide the score by 10, make it negative, and raise 10 to that power. For Q30: 30 ÷ 10 = 3, so the error probability is 10−3 = 1 ÷ 1,000 = 0.001, a 99.9% chance the base is right. For Q20: 20 ÷ 10 = 2, so it is 10−2 = 0.01, or 1 in 100. Each extra 10 points adds one more zero. For a whole read, multiply the number of bases by the error probability: 150 × 0.001 = 0.15 expected errors.
What the answer means. An average of 0.15 errors per read means that most reads of this quality have no errors at all, and roughly one read in seven has one. Across 900 million reads that still adds up to many millions of wrong bases, scattered at random. A true variant, by contrast, sits at the same position in many reads from different fragments. That is how analysis software separates the two.
The Phred scale is named after phred, a program for reading the traces of older Sanger sequencing machines. Its error model is described in Ewing and Green (1998, Genome Research). The FASTQ format, and the offset of 33 used today, are set out in Cock and colleagues (2010, Nucleic Acids Research).
Two cautions when you use scores. Some older Illumina files used an offset of 64 instead of 33, so the same character means a different score; tools can usually detect which applies. And many modern instruments group scores into a few bins rather than reporting every value, so a Q30 base means roughly 1 error in 1,000, not exactly.
From reads to data
- Quality control: check scores, trim adapters and poor-quality ends.
- Alignment: place each read on the reference genome, producing a BAM file.
- Quantification: count reads per gene (RNA-seq), call variants (DNA) or measure methylation, depending on the assay.
What happens at each step
- Quality control. A report summarises the quality scores at each position along the reads, the share of each base, and how often the same sequence appears. Trimming cuts off the ends that should not be analysed. Adapter sequence ends up inside a read when the fragment was shorter than the read length: the machine reads through the fragment and on into the adapter. Those adapter bases do not belong to the genome and would stop the read from mapping.
- Alignment. Each read is matched to its most likely position on the reference. The result is stored in a BAM file, a compressed binary version of the plain-text SAM format (Sequence Alignment/Map). For every read it records where it mapped and how confident the aligner is that the position is right; that confidence is called the mapping quality, and it is low for reads that fit several places equally well.
- Quantification. This is where assays part ways. RNA-seq counts how many reads fall in each gene (Bulk transcriptomics). DNA sequencing compares the reads with the reference at every position and lists the differences, which is called variant calling (Genomics). Methylation sequencing measures, at each site, the share of reads that were methylated (Epigenomics).
You will run quality control, trimming, alignment and counting yourself in Module 5. For now, the point is that a result reaches you only after several pieces of software have each made decisions about the data.
It helps to know what each step needs from the one before. Alignment needs clean reads and the right reference genome; quantification needs reads placed with good mapping quality. Using two different versions of the reference, for example one human genome build for alignment and another for the gene positions, is a classic error: the positions no longer line up, and the counts are quietly wrong. Recording the reference version used is therefore part of every analysis.
Key point
Every step adds possible bias: degraded samples, PCR duplicates, reads that map to more than one place. When results look surprising, check the sample and the pipeline before the biology.
A second example: a variant is reported with 10 supporting reads, which sounds convincing. If all 10 reads start and end at exactly the same positions, they are probably PCR copies of one original fragment, and the evidence is really one read, not ten. Analysis pipelines mark such duplicates for this reason. Tissue stored as formalin-fixed, paraffin-embedded (FFPE) blocks, the usual way hospital biopsies are kept, is another common source of trouble: the fixing damages DNA and RNA, which gives shorter fragments and some characteristic false base changes.
Further reading · Module 1Goodwin, McPherson & McCombie 2016: how short- and long-read sequencing work, and what each is good for. · All reading for this course
Check your understanding
1. What does a Phred score of 30 mean?
2. Why might you choose long-read sequencing?
3. What do barcodes in adapters allow?
Up next
Lesson 5
Genomics