BIOL-380 · Lesson 9 of 12 · 30 min

Immunity to infection and vaccines

The previous lessons described the parts of the immune system one at a time. This lesson puts them together against real enemies. It first examines how immunity is tailored to different kinds of pathogen, bacteria, viruses, parasites and fungi, and how each in turn evades it. It then turns to vaccines, the most successful application of immunology: how they work, the main types, how they are developed and monitored for safety, the population-level effect called herd immunity, and how vaccine policy is made. The lesson ends with the resurgence of measles, a disease that tests every one of these ideas.

Immunity to extracellular bacteria

Bacteria that live outside cells, such as Staphylococcus aureus, Streptococcus pyogenes and Escherichia coli, cause disease by multiplying in tissues and by producing toxins. The main defences are complement, phagocytosis by neutrophils and antibodies that opsonize the bacteria and neutralize their toxins. Th17 responses recruit neutrophils, and Th1 and Tfh cells drive class switching to opsonizing IgG. Many bacteria cause disease mainly through toxins, and protective immunity against them, as with the diphtheria and tetanus toxoid vaccines, is entirely a matter of neutralizing antibodies. Some toxins, called superantigens, such as toxic shock syndrome toxin of S. aureus, bind MHC class II and the TCR outside the peptide groove and activate up to 20 per cent of all T cells at once, causing a cytokine storm.

Bacteria have evolved many evasion strategies. Polysaccharide capsules, as in Streptococcus pneumoniae, Haemophilus influenzae type b and Neisseria meningitidis, resist complement deposition and phagocytosis, which is why antibodies against capsules, induced by conjugate vaccines, are protective. Staphylococcus aureus produces protein A, which binds the Fc region of IgG upside down so it cannot engage Fc receptors, and leukocidins that kill neutrophils. Neisseria gonorrhoeae varies its surface pili by gene conversion, and Streptococcus pyogenes cleaves complement fragment C5a.

Immunity to intracellular bacteria

Some bacteria survive inside cells, especially macrophages. Mycobacterium tuberculosis blocks the fusion of phagosomes with lysosomes; Listeria monocytogenes escapes the phagosome into the cytosol and spreads directly from cell to cell; Salmonella builds a specialized vacuole. Antibodies have limited access, and immunity depends mainly on Th1 cells, whose interferon-γ activates infected macrophages, and on CD8 T cells, which kill infected cells. Tuberculosis illustrates the balance between protection and damage: most people infected contain the bacteria in granulomas for life, but if T cell immunity weakens, through HIV infection, anti-TNF therapy (lesson 10) or old age, the infection can reactivate. People starting anti-TNF drugs are therefore screened for latent tuberculosis.

Immunity to viruses

Viruses replicate inside cells, so immunity has two phases. Before cells are infected, and when new virus particles are released, neutralizing antibodies can block entry, the basis of most antiviral vaccines. Once cells are infected, type I interferons, NK cells and CD8 T cells are needed to limit spread by inhibiting replication and killing infected cells. Interferons dominate the first days, CD8 T cells appear after about a week, and antibodies prevent reinfection. Viruses evade at every step: they mutate surface proteins to escape antibodies (antigenic drift), reassort genome segments to generate new subtypes (antigenic shift, in influenza), block interferon induction and signalling, interfere with MHC class I presentation, as herpes simplex virus and cytomegalovirus do (lesson 4), encode decoy cytokine receptors and complement regulators, and establish latency, a dormant state in which few viral proteins are made, as all herpesviruses do. HIV, examined in lesson 11, combines rapid mutation, latency and infection of the CD4 T cells that coordinate the response.

Immunity to parasites and fungi

Protozoa such as Plasmodium, which causes malaria, and Leishmania live inside cells for parts of their life cycles and are controlled mainly by Th1 responses and antibodies against the stages that circulate. Plasmodium falciparum evades antibodies by switching among about 60 var genes encoding the surface protein PfEMP1, so that each wave of parasitaemia displays a different variant; trypanosomes that cause sleeping sickness switch among more than a thousand variant surface glycoprotein genes. Helminths, parasitic worms, are too large to be engulfed and are attacked by type 2 responses: IgE, eosinophils, mast cells, mucus and smooth muscle contraction (lesson 7). Many helminths survive for years by secreting molecules that induce regulatory T cells and suppress inflammation, and the absence of helminth infection in high-income countries has been suggested as one contributor to rising allergy and autoimmunity, a version of the hygiene hypothesis examined in lesson 10. Fungi such as Candida and Aspergillus are controlled by neutrophils, Dectin-1 recognition and Th17 responses; serious fungal infections mostly occur in people with weakened immunity, after chemotherapy or transplantation or in advanced HIV infection.

Immunity and evasion across pathogen types
Pathogen typeExampleMain protective mechanismsExample of evasion
Extracellular bacteriaStreptococcus pneumoniaeOpsonizing antibodies, complement, neutrophils, Th17Polysaccharide capsule
Toxin-producing bacteriaClostridium tetaniNeutralizing antibodies against toxinToxin acts at doses too small to immunize
Intracellular bacteriaMycobacterium tuberculosisTh1 cells, activated macrophages, CD8 T cellsBlocks phagosome–lysosome fusion
VirusesInfluenza virusInterferons, NK cells, CD8 T cells, neutralizing antibodiesAntigenic drift and shift
ProtozoaPlasmodium falciparumAntibodies to blood stages, Th1 responsesAntigenic variation of PfEMP1
HelminthsHookwormType 2 responses: IgE, eosinophils, mast cells, mucusInduction of regulatory T cells
FungiCandida albicansNeutrophils, Dectin-1, Th17 responsesSwitching between yeast and hyphal forms

How vaccines work

A vaccine presents the immune system with antigens from a pathogen, or instructions to make them, in a form that cannot cause the disease, together with signals that trigger an adaptive response. The aim is to generate memory B cells, long-lived plasma cells and memory T cells, so that a later encounter with the real pathogen meets a faster, stronger secondary response. Most licensed vaccines protect mainly through antibodies; for many, a specific antibody level, called a correlate of protection, predicts protection and is used to license new vaccines without large efficacy trials. Examples include antitoxin levels of 0.01 to 0.1 international units per millilitre for tetanus and diphtheria and a hepatitis B surface antibody level of 10 milli-international units per millilitre. For other diseases, such as tuberculosis, no simple correlate is known, which is one reason vaccine development against them has been difficult.

Types of vaccine
Vaccine typeWhat it containsExamplesStrengthsLimitations
Live attenuatedWeakened pathogen that replicatesMMR, varicella, oral polio (OPV), yellow fever, BCG, rotavirusStrong, long-lasting antibody and T cell responses, often after one or two dosesNot for people with severe immunodeficiency or in pregnancy; rare reversion (OPV)
Inactivated (killed)Whole pathogen inactivated by heat or chemicalsInactivated polio (IPV), hepatitis A, rabies, most influenza vaccinesCannot replicate; safe for immunocompromised peopleWeaker responses; boosters often needed
Subunit and recombinant proteinPurified or recombinant proteinsHepatitis B, HPV (virus-like particles), acellular pertussis, recombinant zoster, RSV prefusion FWell-defined, very safeNeed adjuvants; some responses wane (acellular pertussis)
ToxoidInactivated toxinTetanus, diphtheriaHighly effective against toxin-mediated diseaseBoosters needed
ConjugatePolysaccharide linked to a carrier proteinHib, pneumococcal, meningococcal ACWYT cell help gives memory and works in infantsProtects only against included serotypes
Viral vectorHarmless virus carrying a gene for an antigenErvebo (Ebola), adenovirus-vectored COVID-19 vaccinesStrong T cell and antibody responsesPre-existing immunity to vector; rare clotting syndrome with some adenovirus vectors
mRNAMessenger RNA in lipid nanoparticles encoding an antigenCOVID-19 vaccines; an RSV vaccine for older adultsFast to design and update; strong responsesCold chain; reactogenicity; rare myocarditis, mostly in young males

Adjuvants are substances that enhance and shape the response to vaccine antigens, largely by triggering the innate signals that purified proteins lack. Aluminium salts, used since the 1930s, form depots and activate the NLRP3 inflammasome and other pathways. Newer adjuvants include oil-in-water emulsions such as MF59, used in some influenza vaccines for older adults; AS01, which combines a TLR4 agonist with the saponin QS-21 and makes the recombinant shingles vaccine more than 90 per cent effective in older adults; and CpG oligonucleotides that act on TLR9, used in one hepatitis B vaccine. The lipid nanoparticles of mRNA vaccines themselves have adjuvant activity.

The mRNA platform drew on decades of basic research. A key obstacle was that injected RNA triggered strong innate responses through TLRs and was quickly destroyed. In 2005 Katalin Karikó and Drew Weissman at the University of Pennsylvania showed that replacing uridine with modified nucleosides such as pseudouridine greatly reduced these responses and increased protein production. Combined with lipid nanoparticle delivery, developed partly by Pieter Cullis and colleagues at the University of British Columbia, and with structure-based design of a stabilized prefusion spike protein by Barney Graham, Jason McLellan and colleagues, this allowed COVID-19 mRNA vaccines to be designed within days of the virus's sequence being published in January 2020 and authorized in December 2020. Karikó and Weissman received the 2023 Nobel Prize in Physiology or Medicine.

Vaccine development and safety monitoring

A new vaccine passes through preclinical studies in cells and animals and then three phases of clinical trials: phase 1, in tens of healthy volunteers, to assess safety and immune responses; phase 2, in hundreds, to refine dose and schedule; and phase 3, typically tens of thousands of people randomized to vaccine or control, to measure efficacy and detect less common side effects. Because vaccines are given to healthy people, often children, the standards of safety are high. Phase 3 trials cannot detect very rare events, occurring in perhaps one in 100,000 or one in a million doses, so monitoring continues after licensing through passive reporting systems, in which clinicians and the public report adverse events, and active surveillance of large linked health databases, which can compare rates of events in vaccinated and unvaccinated people. Such monitoring detected the rare intussusception risk of the first rotavirus vaccine in 1999, leading to its withdrawal; the rare clotting syndrome after adenovirus-vectored COVID-19 vaccines in 2021; and myocarditis after mRNA vaccines, mostly in young men after the second dose.

Passive reports alone cannot establish that a vaccine caused an event, because events occur by chance after vaccination as at any other time. Investigators therefore compare observed numbers with those expected from background rates and conduct controlled studies. The claim that the measles, mumps and rubella (MMR) vaccine causes autism, which began with a 1998 paper by Andrew Wakefield, illustrates the process: the paper was found to be fraudulent and retracted in 2010, and Wakefield lost his medical licence, while large studies, including a Danish cohort of more than 650,000 children published in 2019, found no association between MMR vaccination and autism.

In Canada, vaccines are authorized by Health Canada. The National Advisory Committee on Immunization (NACI), an external body of experts, advises the Public Health Agency of Canada, and its recommendations are published in the Canadian Immunization Guide; each province and territory then decides which vaccines to fund and sets its own schedule, so schedules differ somewhat across the country. Adverse events following immunization are reported by health providers to provincial public health authorities and compiled nationally in the Canadian Adverse Events Following Immunization Surveillance System (CAEFISS), supplemented by active surveillance of children's hospitals through the IMPACT program and by the Canadian National Vaccine Safety network. Since 2021, the federal Vaccine Injury Support Program has provided financial support to people seriously and permanently injured by an authorized vaccine given in Canada outside Quebec; Quebec has had its own program since 1985.

Herd immunity

Vaccination protects not only the vaccinated person but also others, because immune people do not transmit infection. The basic reproduction number, \(R_0\), is the average number of people one infected person infects in a fully susceptible population. If a fraction \(p\) of the population is immune, each case causes on average \(R_0(1-p)\) new cases, and transmission declines once this falls below one. The herd immunity threshold is therefore:

\[p_c = 1 - \frac{1}{R_0}\]

For measles, with \(R_0\) of roughly 12 to 18, the threshold is about 92 to 95 per cent, which is why measles is the first disease to return when vaccine coverage slips. For polio, with \(R_0\) of about 5 to 7, it is about 80 to 86 per cent. Because no vaccine is perfectly effective, the vaccination coverage needed is higher: if a vaccine prevents infection in a fraction \(E\) of recipients, the required coverage is \(p_c / E\). Averages also hide clustering: if unvaccinated people are concentrated in particular communities or schools, outbreaks can spread there even when national coverage exceeds the threshold.

Herd immunity in a simple SIR model of a measles-like infection (illustrative parameters)
import math
# SIR model with a fraction of the population immune by vaccination (deterministic, daily steps).
def sir(R0, coverage, efficacy=0.97, infectious_days=8, N=100_000, days=365):
    gamma = 1 / infectious_days
    beta = R0 * gamma
    immune = coverage * efficacy * N
    S, I, R = N - immune - 10, 10.0, immune
    total = 0.0
    dt = 0.1
    for _ in range(int(days / dt)):
        new_inf = beta * S * I / N * dt
        rec = gamma * I * dt
        S -= new_inf; I += new_inf - rec; R += rec
        total += new_inf
    return total
R0 = 15
print(f"measles-like R0 = {R0}: herd immunity threshold = {1 - 1 / R0:.1%}; coverage needed with 97% efficacy = {(1 - 1 / R0) / 0.97:.1%}")
for cov in (0.0, 0.80, 0.90, 0.95, 0.97):
    print(f"   coverage {cov:4.0%}: about {sir(R0, cov):9,.0f} infections in a town of 100,000 over a year")
Output
measles-like R0 = 15: herd immunity threshold = 93.3%; coverage needed with 97% efficacy = 96.2%
   coverage   0%: about    99,990 infections in a town of 100,000 over a year
   coverage  80%: about    21,517 infections in a town of 100,000 over a year
   coverage  90%: about     9,767 infections in a town of 100,000 over a year
   coverage  95%: about     2,248 infections in a town of 100,000 over a year
   coverage  97%: about        73 infections in a town of 100,000 over a year

The model shows a sharp threshold. With no vaccination nearly everyone is infected; even at 90 per cent coverage a large outbreak still occurs, because the effective reproduction number remains above one; at 95 per cent a smaller, slower outbreak still occurs because effective immunity (coverage times efficacy) is just below the threshold; and once coverage passes the roughly 96 per cent needed with this vaccine's efficacy, introductions fizzle out. Real outbreaks differ from this simple model, with births adding susceptibles, contacts clustering in households and schools, and public health measures such as isolation and post-exposure vaccination, but the threshold behaviour is the same.

A graph of the share of a population infected over a year against vaccination coverage from 0 to 100 per cent for a measles-like infection with R0 of 15 and a vaccine 97 per cent effective. The curve starts near 100 per cent infected at zero coverage, falls gradually, and drops to almost zero at about 96 per cent coverage, marked by a vertical dashed line labelled coverage needed. A second dashed line at 93 per cent marks the herd immunity threshold for immune people.
Final outbreak size against vaccination coverage for a measles-like infection (simple SIR model)
Calculating vaccine efficacy and its confidence interval from trial counts (invented data)
import math
# Vaccine efficacy from a randomized trial, with an approximate 95% confidence interval.
# Invented trial counts.
cases_v, n_v = 12, 15_000      # cases and participants in the vaccine group
cases_p, n_p = 150, 15_000     # cases and participants in the placebo group
rr = (cases_v / n_v) / (cases_p / n_p)
se = math.sqrt(1 / cases_v - 1 / n_v + 1 / cases_p - 1 / n_p)   # SE of log relative risk
lo, hi = math.exp(math.log(rr) - 1.96 * se), math.exp(math.log(rr) + 1.96 * se)
print(f"relative risk = {rr:.3f}")
print(f"vaccine efficacy = 1 - RR = {1 - rr:.1%}  (95% CI {1 - hi:.1%} to {1 - lo:.1%})")
nnv = 1 / (cases_p / n_p - cases_v / n_v)
print(f"number needed to vaccinate to prevent one case over the trial period: about {nnv:.0f}")
Output
relative risk = 0.080
vaccine efficacy = 1 - RR = 92.0%  (95% CI 85.6% to 95.6%)
number needed to vaccinate to prevent one case over the trial period: about 109

Efficacy is a relative measure: it is the proportional reduction in disease among vaccinated people compared with unvaccinated people under trial conditions. The number needed to vaccinate depends also on how common the disease is, so a highly effective vaccine against a rare disease may require many doses to prevent one case, while effectiveness in routine use, measured in observational studies, may differ from trial efficacy because of differences in populations, circulating strains and time since vaccination.

Vaccine policy and the return of measles

Measles virus spreads through the air and can linger in a room for up to two hours after an infected person leaves. Before vaccines, nearly every child caught it, and it killed more than two million people a year worldwide; it still causes over 100,000 deaths a year, mostly of young children in low-income countries. About one in five unvaccinated people with measles in the United States is hospitalized, and roughly one to three in a thousand infected children die of pneumonia or encephalitis. Measles also causes immune amnesia: by infecting and destroying memory B and T cells, it erases a large part of existing immunity to other pathogens, as shown by studies published in 2019 that found loss of 11 to 73 per cent of children's preexisting antibody repertoires. A rare late complication, subacute sclerosing panencephalitis, is always fatal. Two doses of MMR vaccine are about 97 per cent effective. A country is considered to have eliminated measles when endemic transmission has been absent for at least 12 months.

Canada eliminated measles in 1998. In October 2024 an outbreak began in New Brunswick and spread to Quebec, Ontario, Alberta and other provinces, mainly among undervaccinated communities, with more than 5,000 confirmed cases in 2025, the largest number in decades, and deaths of infants infected in the womb or soon after birth. Because the same chain of transmission had continued for more than 12 months, the Pan American Health Organization announced on 10 November 2025 that Canada had lost its measles elimination status. Public health agencies responded with catch-up vaccination campaigns and outreach to affected communities. Regaining elimination status requires at least 12 months without endemic transmission, verified by surveillance (situation as reported in late 2025; check current Public Health Agency of Canada updates).

Vaccine policy in Canada has remained stable in structure: NACI continues to issue evidence-based recommendations, and provinces set schedules and decide on school entry requirements. Ontario and New Brunswick require proof of vaccination or a formal exemption for school attendance, while most provinces do not. In response to the measles outbreaks, several provinces expanded eligibility for early or extra MMR doses for infants travelling or living in outbreak areas. Debates continue about exemptions, communication with hesitant communities and the best way to reach people who distrust public health authorities.

Worked problem

Calculating the coverage needed

A respiratory virus has R0 = 6. A vaccine prevents infection in 85 per cent of recipients. What coverage is needed to reach the herd immunity threshold, and what does the answer imply?

Show solution
  1. The herd immunity threshold is \(p_c = 1 - 1/6 \approx 0.833\), or 83.3 per cent of the population immune.
  2. With 85 per cent efficacy, required coverage is \(0.833 / 0.85 \approx 0.98\), or 98 per cent.
  3. Such high coverage is hard to reach and maintain, so herd immunity is fragile; small declines or clustering of unvaccinated people would allow outbreaks.
  4. If the vaccine mainly prevents severe disease rather than infection, it may protect individuals well but contribute little to herd immunity, as was seen with COVID-19 vaccines against later variants.

Answer: About 98 per cent coverage would be needed, which illustrates why vaccines that block infection and have high efficacy are crucial for interrupting transmission.

Common mistakes

  • MistakeAssuming the same immune mechanisms protect against all pathogens.

    InsteadEach pathogen type calls for a different combination of antibodies, Th1, Th2, Th17 and CD8 responses.

  • MistakeTreating passive adverse event reports as proof of causation.

    InsteadReports must be compared with background rates and tested in controlled studies.

  • MistakeCalculating the coverage needed as 1 − 1/R0 without considering efficacy.

    InsteadRequired coverage is the threshold divided by vaccine efficacy, and clustering raises it further.

  • MistakeThinking measles is a mild childhood illness.

    InsteadIt causes pneumonia, encephalitis, death and immune amnesia, and is the most contagious human virus.

  • MistakeAssuming live vaccines are suitable for everyone.

    InsteadThey are avoided in severe immunodeficiency and in pregnancy.

Summary and key terms

  • Extracellular bacteria are controlled by antibodies, complement and neutrophils; intracellular bacteria by Th1 cells and activated macrophages.
  • Antiviral immunity combines interferons, NK cells, CD8 T cells and neutralizing antibodies; viruses evade by mutation, latency and interference with presentation.
  • Protozoa vary their surface antigens; helminths are attacked by type 2 responses and induce regulation; fungi are controlled by neutrophils and Th17 cells.
  • Vaccines generate memory using live, inactivated, subunit, toxoid, conjugate, vector or mRNA platforms, often with adjuvants.
  • Safety is monitored before and after licensing; rare events are detected by surveillance and evaluated against background rates.
  • Herd immunity requires immune fractions of 1 − 1/R0, about 95 per cent for measles.
  • Measles has resurged in North America; Canada lost elimination status in November 2025, and US vaccine policy changed substantially in 2025–2026.
superantigen
A toxin that activates many T cells by binding MHC class II and the TCR outside the groove.
antigenic variation
Changes in surface antigens that let pathogens evade existing antibodies.
latency
A dormant viral state with few proteins made, evading immunity.
correlate of protection
A measurable immune response that predicts protection from disease.
adjuvant
A vaccine component that enhances and shapes the immune response.
conjugate vaccine
A vaccine linking a polysaccharide to a carrier protein to recruit T cell help.
vaccine efficacy
The proportional reduction in disease among vaccinated compared with unvaccinated people in a trial.
basic reproduction number
The average number of secondary cases caused by one case in a fully susceptible population.
herd immunity threshold
The immune fraction, 1 − 1/R0, above which transmission declines.
immune amnesia
Loss of preexisting immune memory caused by measles infection.

Practice problems

Work each problem on paper first, then reveal the answer to check.

  1. Why are antibodies against capsules protective against pneumococcus?

    Show answer

    They opsonize the capsule, overcoming its resistance to complement and phagocytosis.

  2. Why are people screened for latent tuberculosis before anti-TNF therapy?

    Show answer

    TNF helps maintain granulomas; blocking it can reactivate latent infection.

  3. Name three ways viruses evade immunity.

    Show answer

    Antigenic drift, latency and blocking MHC class I presentation (also interferon antagonism).

  4. What did Karikó and Weissman discover?

    Show answer

    That modified nucleosides such as pseudouridine reduce innate recognition of mRNA and increase protein production.

  5. What is the herd immunity threshold for R0 = 15?

    Show answer

    1 − 1/15 ≈ 93 per cent.

  6. If 12 of 15,000 vaccinated and 150 of 15,000 unvaccinated participants become ill, what is the efficacy?

    Show answer

    About 92 per cent.

  7. What is immune amnesia?

    Show answer

    Destruction of memory lymphocytes by measles, erasing part of prior immunity.

  8. Why can measles outbreaks occur where national coverage exceeds 95 per cent?

    Show answer

    Unvaccinated people cluster in communities where local coverage is far lower.

Lesson quiz · 5 questions

Score 60% or more to complete this lesson.

Take the quiz