Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Dose response in two genotypes

Does a knockout change which genes respond to a dose, or how strongly? This guide tests a dose series run in wild-type (+/+) and knockout (-/-) mice, each genotype’s response and the difference between the two, with one model per cell type: dose_response(..., by="genotype"). The data are simulated, so the answers are known (the simulated_genotype_dose_series dataset of the Datasets page): the vehicle and six doses from 0.03 to 10 ug/kg, 3 mice per dose and genotype, hepatocytes and Kupffer cells, 1,500 genes. A fifth of the genes respond in the wild types; in the knockouts, 30% of those lose their response, 20% keep half of it and the rest keep all of it.

Dose crossed with time, genotype or drug explains the model and its tests, and Validation gives their agreement with limma, R’s lm and variancePartition.

CytePool 0.1.1.dev31+g7516769f3.d20261202
Cube with 42 samples x 2 groups x 1,500 features
  layers: counts (int32, lazy)
  filled: 84 of 84 sample x group entries have cells (100.0%)
  samples: sample_id, genotype, dose
  groups: group_id
  features: feature_id

Two genotypes, one dose series each

How is the study laid out? Each genotype is a dose series of its own, with its own vehicle mice: genotype holds +/+ or -/-, and dose the dose in ug/kg. The truth sorts each gene of a cell type into four kinds: flat in both genotypes, or responsive in the wild types and kept, halved or lost in the knockouts.

+/+: 0 ug/kg 3, 0.03 ug/kg 3, 0.1 ug/kg 3, 0.3 ug/kg 3, 1 ug/kg 3, 3 ug/kg 3, 10 ug/kg 3
-/-: 0 ug/kg 3, 0.03 ug/kg 3, 0.1 ug/kg 3, 0.3 ug/kg 3, 1 ug/kg 3, 3 ug/kg 3, 10 ug/kg 3
Hepatocyte: 141 kept, 61 halved, 98 lost, 1200 flat
Kupffer cell: 153 kept, 61 halved, 86 lost, 1200 flat

Check what each genotype supports

Can each genotype’s series support tests in each cell type? check_dose_design with by reads one model of all of a cell type’s samples, with an indicator of each genotype and of each dose within a genotype, and gives each genotype its own status. The design lists the genotypes in order: the first, the wild types, is the reference that the interaction tests compare the knockouts with. Text sorts by Unicode code point, where +/+ comes first anyway, since the plus sign precedes the hyphen; giving the levels says so in the code:

DoseDesignReport: 2 cell types, 7 doses from 0 to 10 ug/kg, 2 series of genotype
                  (+/+ and -/-)
  Hepatocyte, genotype +/+: inferential; 7 of 7 dose groups keep a sample, 3
                            each; 28 residual df
  Hepatocyte, genotype -/-: inferential; 7 of 7 dose groups keep a sample, 3
                            each; 28 residual df
  Kupffer cell, genotype +/+: inferential; 7 of 7 dose groups keep a sample, 3
                              each; 28 residual df
  Kupffer cell, genotype -/-: inferential; 7 of 7 dose groups keep a sample, 3
                              each; 28 residual df

Each line is a cell type and genotype: its status, the dose groups that keep a sample with their replicates, and the residual degrees of freedom of the cell type’s one model, which the two genotypes share. A genotype that lost its vehicle mice in a cell type would be refused there while the other is tested.

Which genes respond in each genotype

Which genes respond to the dose in the wild types, and which in the knockouts? dose_response fits each cell type once, so that both genotypes share one moderated variance per gene, and runs each genotype’s tests, gate and each dose against its own vehicle, as it does for one series:

DoseResponseResult (limma_voom): 2 cell types, 2 tested; 2 series of genotype,
    +/+ and -/-; tests: spline, nonlinearity, linear_trend, dose_groups
  dose: ug/kg (administered) on a log10 axis, the vehicle in a group of its own;
        spline of 2 columns, knots at 0.548 ug/kg, boundary knots at 0.03 and 10
        ug/kg; linear_trend slopes per log10 unit of dose
  gate: spline test, Benjamini-Hochberg within each cell type, at 5% FDR
  Hepatocyte, genotype +/+: 7 dose groups, 21 samples, 1,325 genes; 148 pass the
                            gate; calls at 5% FDR: spline 148, nonlinearity 45,
                            linear_trend 150, dose_groups 136
  Hepatocyte, genotype -/-: 7 dose groups, 21 samples, 1,325 genes; 87 pass the
                            gate; calls at 5% FDR: spline 87, nonlinearity 22,
                            linear_trend 73, dose_groups 70
  Hepatocyte, interactions with genotype +/+: calls at 5% FDR:
      spline_interaction 36, nonlinearity_interaction 5,
      linear_trend_interaction 34, dose_groups_interaction 32
  Kupffer cell, genotype +/+: 7 dose groups, 21 samples, 859 genes; 78 pass the
                              gate; calls at 5% FDR: spline 78, nonlinearity 16,
                              linear_trend 69, dose_groups 68
  Kupffer cell, genotype -/-: 7 dose groups, 21 samples, 859 genes; 45 pass the
                              gate; calls at 5% FDR: spline 45, nonlinearity 14,
                              linear_trend 41, dose_groups 41
  Kupffer cell, interactions with genotype +/+: calls at 5% FDR:
      spline_interaction 16, nonlinearity_interaction 1,
      linear_trend_interaction 15, dose_groups_interaction 12

Each genotype has its line of calls, and interactions with genotype +/+ gives the calls of the interaction tests, which compare the knockouts with the wild types and which the next section reads. A genotype’s tables are read with series: result.table("Hepatocyte", "spline", series="-/-"). The genes each genotype’s gate passes, by their kind in the truth:

Hepatocyte, +/+: 60 kept, 33 halved, 50 lost, 5 flat
Hepatocyte, -/-: 63 kept, 21 halved, 0 lost, 3 flat
Kupffer cell, +/+: 40 kept, 15 halved, 20 lost, 3 flat
Kupffer cell, -/-: 39 kept, 5 halved, 0 lost, 1 flat

The knockouts’ gate passes none of the genes whose response they lost, and fewer of those they halved: halving a change of 0.5 to 2 log2 units leaves many below what 3 mice per dose detect.

Which genes respond differently in the knockouts

Which genes respond differently in the two genotypes? The interaction tests compare the knockouts’ response with the wild types’ over the same doses: spline_interaction whether the two fitted splines differ anywhere, linear_trend_interaction whether their slopes differ and dose_groups_interaction whether any dose’s change from the vehicle differs. Each is a moderated test of the cell type’s one fit, adjusted by Benjamini-Hochberg within the cell type:

Hepatocyte: 36 genes at 5% FDR: 0 kept, 5 halved, 30 lost, 1 flat
Kupffer cell: 16 genes at 5% FDR: 0 kept, 1 halved, 12 lost, 3 flat

Most genes called lost their response in the knockouts, a few kept half of it, and none kept all of it: the test compares the genotypes’ responses with each other, not each genotype with the vehicle. Losing a response is the largest difference a knockout can make here, so it is the easiest to detect; halving one is harder, as the gates showed. Of the 52 genes called in the two cell types, 4 are flat genes, false discoveries: 1 of 36 in hepatocytes and 3 of 16 in Kupffer cells. A 5% FDR bounds the share of false discoveries on average over studies, not in each one, so one cell type’s share can exceed 5%, as the Kupffer cells’ does. The kept genes, which respond alike in both genotypes, are null for these tests too, and none of them was called.

linear_trend_interaction gives the size and sign of a difference: its log2_fold_change is the knockouts’ slope minus the wild types’, in log2 units per log10 unit of dose. Both slopes weigh each dose by its mice pooled over the genotypes, which here keep 3 mice per dose each, so the difference is that of the genotypes’ own slopes. A gene that loses a rising response has a negative difference:

gene        slope +/+  difference  adjusted p  truth
gene_1326       -0.80        0.87     8.7e-11  lost
gene_1283        0.91       -0.87     3.2e-08  lost
gene_1092       -0.87        0.81     1.1e-07  lost
gene_1026       -0.81        0.82     8.1e-06  lost
gene_1332       -0.95        0.96     1.7e-05  lost
gene_1042        0.77       -0.79     2.9e-05  lost

See a gene in both genotypes

What does a lost response look like? plot_dose_response draws one genotype’s estimates at each dose and fitted spline with its band; drawn into the same Axes, the second genotype takes the next colour:

Two panels of one hepatocyte gene, gene_1026, whose response the knockouts lost: its log2 fold change from the vehicle at each dose against dose on a log10 axis, the vehicle left of an axis break, with its fitted spline and 95% band. In the wild types (+/+, left) it falls from about 0.1 at 0.03 ug/kg to about -1.7 at 10 ug/kg; in the knockouts (-/-, right) it stays between about -0.1 and 0.4 at every dose.

In the wild types the gene falls with dose, as its Hill curve does, to about 1.7 log2 units below the vehicle at 10 ug/kg; in the knockouts it stays within half a log2 unit of the vehicle at every dose.

What to read where

QuestionWhere
Can each genotype be tested in each cell type?report.status(group, series=...), report.summary
Which genes respond in one genotype?result.table(group, "spline", series=...) and the other tests, "gate"
From which dose does a gene respond in one genotype?result.lowest_effective_doses(group, series=...)
Do the genotypes’ responses differ?result.table(group, "spline_interaction"), "dose_groups_interaction"
By how much does the slope differ?result.table(group, "linear_trend_interaction")

Curves of named models, benchmark doses and EC50s run on one genotype at a time: dose_response on that genotype’s samples, with a design of them.