Fundamentals 5 min read

How to Model Chromosome Inheritance with Matrices and Python

This article explains the fundamentals of autosomal inheritance, derives probability tables for genotype combinations, formulates a matrix recurrence, and demonstrates how to compute long‑term genotype distributions using Python code.

Model Perspective
Model Perspective
Model Perspective
How to Model Chromosome Inheritance with Matrices and Python

Chromosome Inheritance Model

In autosomal inheritance each offspring receives one allele from each parent, forming a genotype (gene pair). When a trait is controlled by two genes, three possible genotypes arise, denoted AA, Aa, and aa. For example, the flower color of snapdragons or human eye color follows this pattern.

If a parent has genotype AA and the other aa, the offspring can receive either A or a from each parent, resulting in genotypes AA, Aa, or aa with equal probability. The article presents a table summarising all possible parental genotype combinations and the resulting offspring genotype probabilities.

Case Study

Problem

A farm has a plant population with two genotypes, AA and aa. The farm plans to cross plants of genotype Aa with each existing genotype each generation. After many generations, what will be the distribution of the three genotypes?

Assumptions

Let a_n, b_n, c_n denote the percentages of genotypes AA, Aa, and aa in generation n. The initial distribution is given.

The transition from generation n to n+1 follows the probability table described above.

Modeling

Using the transition probabilities, the genotype vector \(x_n = [a_n, b_n, c_n]^T\) satisfies a linear recurrence \(x_{n+1}=A x_n\) where

<code>[[1, 1/2, 0],
[0, 1/2, 1],
[0, 0, 0]]</code>

By diagonalising the matrix A, the closed‑form expression for \(x_n\) is obtained, showing how the genotype distribution evolves over generations.

Solution

Implementing the recurrence in Python with SymPy yields the limit distribution. When the initial proportion of genotype Aa is non‑zero, the system converges to a state where all plants become genotype Aa.

<code>import sympy as sp
a0,b0,c0=sp.symbols('a0 b0 c0')
n=sp.symbols('n',positive=True)
A=sp.Matrix([[1,1/2,0],[0,1/2,1],[0,0,0]])
if A.is_diagonalizable():
    print("A的对角化矩阵为:\n",A.diagonalize())
else:
    print("A不能对角化")
P=A.diagonalize()[0]; D=A.diagonalize()[1]
x=P*D**n*(P.inv())*sp.Matrix([a0,b0,c0])
x=sp.simplify(x)
print(x)
</code>

Extension

If instead plants of the same genotype are crossed with each other, a different probability table applies. The resulting long‑term distribution contains only the AA and aa genotypes, with the Aa genotype disappearing.

Reference

Python数学实验与建模 / 司守奎, 孙玺菁, 科学出版社

PythonprobabilityInheritancepopulation dynamicsgeneticsmatrix model
Model Perspective
Written by

Model Perspective

Insights, knowledge, and enjoyment from a mathematical modeling researcher and educator. Hosted by Haihua Wang, a modeling instructor and author of "Clever Use of Chat for Mathematical Modeling", "Modeling: The Mathematics of Thinking", "Mathematical Modeling Practice: A Hands‑On Guide to Competitions", and co‑author of "Mathematical Modeling: Teaching Design and Cases".

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.