Tutorials › Physiologically-Based Pharmacokinetics (PBPK) › Sampling Discrete Genotypes for Virtual Subjects

Genetic Polymorphisms and Virtual Populations · Tutorial 651 of 799

Sampling Discrete Genotypes for Virtual Subjects

Use genotype frequencies to sample virtual subjects reproducibly, calculate expected counts and variability, and choose between random sampling and fixed category quotas.

Advanced 10 min read

What You'll Learn

  • Convert allele frequencies to genotype probabilities when the stated assumptions justify it.
  • Sample one genotype category for each virtual subject using categorical probabilities.
  • Calculate expected genotype counts, their variances, and the chance of missing a rare category.
  • Distinguish a random cohort from a cohort constructed to match target proportions exactly.
  • Diagnose invalid frequency inputs and explain how sampling choices affect a PBPK cohort.

Why Sample Genotypes?

A virtual population needs a genotype for each simulated subject, not only a table of population frequencies. Those frequencies describe the intended population distribution; sampling turns them into individual assignments that can be connected to genotype-dependent PBPK parameters. Because a finite cohort is a realization of a population distribution, its observed category counts will usually differ from their expected counts.

The central design choice is whether to let those counts vary naturally under random sampling or to impose a specified number of subjects in each genotype category. These approaches answer different questions. Random sampling represents variation in cohort composition under a frequency model. Fixed-proportion construction ensures a chosen composition, but removes that source of variation from the constructed cohort.

Definition: Let \(G_i\) denote the genotype category assigned to virtual subject \(i\), for \(i=1,\ldots,n\). If there are \(K\) mutually exclusive and exhaustive categories with frequencies \(f_1,\ldots,f_K\), then categorical sampling assigns each subject to category \(k\) with probability \(f_k\), where \(f_k\geq 0\) and \(\sum_{k=1}^K f_k=1\). The count \(N_k\) is the number of the \(n\) subjects assigned to category \(k\).

The frequencies may be supplied directly as diplotype or genotype frequencies. Alternatively, allele frequencies can be used to construct genotype probabilities if the required assumptions are appropriate. For a biallelic locus, let \(f_A\) and \(f_a\) be the frequencies of alleles \(A\) and \(a\). If the two alleles forming each subject’s genotype are sampled independently from the same allele-frequency distribution, the genotype probabilities are \(f_A^2\), \(2f_Af_a\), and \(f_a^2\). This is the random-union-of-alleles assumption underlying Hardy-Weinberg genotype frequencies; it should not be applied automatically when the source frequencies or population structure do not support it. The earlier material on deriving genotype frequencies under Hardy-Weinberg equilibrium establishes this frequency calculation.

From Frequencies to Individual Assignments

When genotype or diplotype frequencies are already available, sample directly from those categories. For each subject, draw one category using its frequency as the probability. A computational implementation can form cumulative probabilities and draw a uniform random number \(U\) between 0 and 1: assign category 1 if \(U\leq f_1\), category 2 if \(f_1<U\leq f_1+f_2\), and continue through the final category. The categories must be ordered consistently with the cumulative intervals, and the final cumulative probability must equal 1.

For a biallelic genotype constructed from allele frequencies, the corresponding procedure is to draw two alleles per subject, independently, with probabilities \(f_A\) and \(f_a\), then record the resulting genotype. Sampling genotypes directly from the three probabilities is equivalent for the unordered genotype categories under the random-union assumption. Direct genotype sampling is often simpler; allele-level sampling can be useful when the subject-level alleles themselves are needed.

Assumptions for ordinary categorical sampling: The category list is exhaustive and mutually exclusive; the frequencies are valid probabilities that sum to 1; and each subject’s category is drawn independently from the same specified distribution. If frequencies differ by a defined population stratum, the sampling distribution must match the stratum being represented. Independence here is a sampling assumption, not a claim that every real population is free of relatedness or structure.

Worked Example: Sampling Diplotypes From Supplied Frequencies

Suppose a hypothetical PBPK cohort has \(n=400\) subjects and three diplotype categories with frequencies 0.70, 0.25, and 0.05. Assume these frequencies are the target probabilities for every independently sampled subject. Find the expected count and standard deviation for each category, and describe one possible random realization.

For category \(k\), the count \(N_k\) has expected value \(E(N_k)=nf_k\). Its standard deviation is \(\sqrt{nf_k(1-f_k)}\). Thus the expected counts are \(400(0.70)=280\), \(400(0.25)=100\), and \(400(0.05)=20\) subjects.

The corresponding standard deviations are \(\sqrt{400(0.70)(0.30)}=\sqrt{84}=9.165\), \(\sqrt{400(0.25)(0.75)}=\sqrt{75}=8.660\), and \(\sqrt{400(0.05)(0.95)}=\sqrt{19}=4.359\) subjects. These quantify the marginal sampling variability of each count; they do not imply that the three counts vary independently, since they must sum to 400.

One possible random realization is 276, 103, and 21 subjects. The counts sum to \(276+103+21=400\), and the realized proportions are 0.690, 0.2575, and 0.0525. These are close to, but not required to equal, the target frequencies. The expected counts are averages over repeated cohorts generated by the model, not quotas that every cohort must match.

Expected Counts and Their Sampling Variability

The count results follow from indicator variables. Define \(I_{ik}=1\) if subject \(i\) is assigned to category \(k\), and \(I_{ik}=0\) otherwise. Then \(N_k=\sum_{i=1}^n I_{ik}\). Each indicator has probability \(f_k\) of equaling 1, so its expectation is \(f_k\). By linearity of expectation, \(E(N_k)=nf_k\).

For an indicator with success probability \(f_k\), the variance is \(f_k(1-f_k)\). Under independent subject sampling, the indicators for different subjects have zero covariance. Therefore the variance of the sum is the sum of their variances:

$$ E(N_k)=nf_k,\qquad \operatorname{Var}(N_k)=nf_k(1-f_k),\qquad SD(N_k)=\sqrt{nf_k(1-f_k)}. $$

Counts in different categories are not independent. For \(j\ne k\), a single subject cannot belong to both categories, so \(I_{ij}I_{ik}=0\). Their covariance for that subject is \(0-f_jf_k=-f_jf_k\). Summing across independent subjects gives \(\operatorname{Cov}(N_j,N_k)=-nf_jf_k\). This negative covariance reflects the fixed total cohort size: an assignment to one category leaves one fewer assignment available for the others.

The vector of counts has a multinomial distribution with sample size \(n\) and category probabilities \(f_1,\ldots,f_K\). The probability of any count vector \(N_1,\ldots,N_K\), where the counts are nonnegative integers summing to \(n\), is

$$ P(N_1,\ldots,N_K)= \frac{n!}{N_1!\cdots N_K!}\prod_{k=1}^K f_k^{N_k}. $$

This result makes an important distinction: expected counts can be fractional, while realized counts are integers. A non-integer expectation is not an instruction to round each category independently. Independent rounding can change the total and does not reproduce the multinomial sampling distribution.

Worked Example: Deriving Genotype Probabilities From Allele Frequency

In a hypothetical population, the frequency of a variant allele \(a\) is 0.20, so the frequency of the reference allele \(A\) is \(1-0.20=0.80\). Assume random union of alleles and sample \(n=1{,}000\) subjects independently. Calculate the genotype probabilities and expected counts.

Under the stated assumption, \(P(AA)=0.80^2=0.64\), \(P(Aa)=2(0.80)(0.20)=0.32\), and \(P(aa)=0.20^2=0.04\). The probabilities sum to \(0.64+0.32+0.04=1.00\), as required.

The expected counts are \(1{,}000(0.64)=640\) \(AA\) subjects, \(1{,}000(0.32)=320\) \(Aa\) subjects, and \(1{,}000(0.04)=40\) \(aa\) subjects. For example, the standard deviation of the \(aa\) count is \(\sqrt{1{,}000(0.04)(0.96)}=\sqrt{38.4}=6.197\) subjects. The expected value of 40 does not guarantee that exactly 40 subjects will be \(aa\).

If the source information instead supplied valid diplotype frequencies that did not arise from this assumption, those supplied frequencies should be sampled directly rather than replaced by these Hardy-Weinberg calculations. The calculation is conditional on the stated allele-sampling model.

Random Sampling Versus Fixed-Proportion Construction

A fixed-proportion cohort assigns prespecified integer counts to categories, rather than drawing each subject independently. For example, a researcher might choose the nearest feasible allocation to target frequencies, or deliberately choose a cohort with an exact number in each genotype category. This can be useful when the aim is to ensure representation of a rare category or to compare genotype groups with chosen sizes. It is not equivalent to an independent random sample from the frequencies.

FeatureIndependent categorical samplingFixed-proportion construction
Category countsRandom; fluctuate around \(nf_k\)Set in advance as integer quotas
Rare categoriesMay be represented by few or no subjectsCan be assigned a guaranteed quota
InterpretationRepresents cohort-composition variability under the frequency modelRepresents a designed composition, not a random cohort draw
Expected counts\(nf_k\) under the stated sampling modelEqual to the fixed counts for the constructed cohort

Worked Example: Chance of Missing a Rare Genotype

Suppose a hypothetical genotype category has frequency 0.02, and \(n=100\) subjects are sampled independently. Find its expected count and the probability that the cohort contains no subjects in this category. Compare this with a fixed allocation of two subjects to the category.

The expected count under random sampling is \(100(0.02)=2\). Each subject has probability \(1-0.02=0.98\) of not belonging to the category. By independence, the probability that all 100 subjects miss it is \(0.98^{100}=0.1326\), approximately 13.3%.

Thus a random cohort can contain zero rare-category subjects even though the expected count is two. A fixed allocation of two guarantees that the category is represented, but it does not have the same distribution of counts as independent sampling. In particular, the fixed cohort has no chance of zero subjects in that category, whereas the random design has a 13.3% chance under the assumed frequency model.

Implementation Checks and Common Pitfalls

Before using sampled genotypes in a PBPK simulation, verify that the frequency inputs and the sampling procedure match the intended population model. Sampling errors can create biologically implausible category assignments or make the resulting cohort represent a different design than intended.

  • Check the probability vector. Every frequency must be between 0 and 1, and the frequencies must sum to 1 within an explicitly chosen numerical tolerance. Do not silently normalize a badly specified vector; first determine whether categories are missing, duplicated, or drawn from inconsistent sources.
  • Check category definitions. Categories must be mutually exclusive and collectively exhaustive. If a genotype category is counted twice under different labels, or a possible category is omitted, the sampling probabilities no longer describe the intended set of outcomes.
  • Check the frequency assumptions. Do not infer genotype frequencies from allele frequencies without the required random-union assumption. If using supplied genotype or diplotype frequencies, preserve the frequencies relevant to the target population.
  • Check the realized cohort without demanding exact agreement. Compare observed counts with \(nf_k\) and their sampling variability. A moderate deviation is expected under random sampling; a substantial discrepancy may indicate a coding or input problem, but a single difference from the expectation is not by itself proof of an error.

A common mistake is to say, “The expected count for the rare genotype is two, so I must assign exactly two subjects.” That reasoning confuses a mean with a quota. Under random sampling, the count is a random integer with mean two; under fixed construction, two is imposed by design. The correction is to choose the procedure according to the scientific purpose and describe it accurately.

Another limitation is that ordinary categorical sampling represents only the specified category distribution and independence assumptions. It does not automatically reproduce unmodeled population structure or relationships among subjects. Fixed quotas also affect interpretation: they may be useful for balanced genotype comparisons, but their cohort proportions should not be presented as a random realization of population prevalence.

1
Define the target categories.
Specify the genotype or diplotype categories and confirm that they are exhaustive and nonoverlapping.
2
Choose the frequency source.
Use supplied category frequencies directly, or derive genotype probabilities from allele frequencies only under an appropriate allele-sampling assumption.
3
Choose the cohort design.
Use independent categorical draws when cohort composition should vary; use fixed integer quotas when a designed composition is required.
4
Validate and report.
Check probabilities, realized counts, and the interpretation of the cohort before mapping genotypes to PBPK parameters.
Key takeaway: Categorical genotype sampling produces random category counts with expectation \(nf_k\) and variance \(nf_k(1-f_k)\). Fixed-proportion construction instead sets the counts by design. Both can be useful, but they represent different cohort-generation choices.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions below.

  1. A category has frequency 0.10 in a cohort sampled independently with \(n=200\). What is its expected count and standard deviation?
  2. For a variant allele frequency of 0.30, what are the three genotype probabilities under random union of alleles?
  3. Why can a category with expected count three be absent from a randomly sampled cohort?
  4. What is the main interpretive difference between sampling 50 subjects independently and assigning fixed quotas of 35, 12, and 3 to three categories?

Solutions. (1) The expected count is \(200(0.10)=20\). The standard deviation is \(\sqrt{200(0.10)(0.90)}=\sqrt{18}=4.243\) subjects. (2) The reference allele frequency is 0.70, so the probabilities are \(0.70^2=0.49\), \(2(0.70)(0.30)=0.42\), and \(0.30^2=0.09\); these sum to 1. (3) Expected count is a mean, not a guaranteed minimum. Under independent sampling, the probability of no members in a category of frequency \(f\) is \((1-f)^n\), which is positive when \(f<1\). (4) Independent sampling allows category counts to vary around their expectations; fixed quotas force the counts to be exactly 35, 12, and 3 and therefore describe a designed composition.