Supplementary Materials: Materials and Methods. Figures S1-S3.

Supplementary Materials: Materials and Methods: The source code for the C++ implementation of the model is provided at https://github.com/ArunasRadzvilavicius/GermlineEvolution

Organism life cycle Each generation starts with N containing M mitochondria derived from two of opposite type (Figure 1). is determined by the diploid nuclear genome (ZW or ZZ). The undergoes LT mitotic divisions producing undifferentiated stem cells, before these give rise to 2LT tissue precursor cells. Each tissue therefore originates from a single precursor cell. Differentiation is followed by an additional LS divisions within somatic tissues. Each somatic cell contains M mitochondria and these can be in one of two states, wild type or mutant. Mitochondrial in stem cells are subject to mutation throughout the life cycle and undergo random segregation at cell division. precursor cells are cloned from a randomly chosen stem cell (germline sequestration after Lg divisions) or terminal somatic cells (somatic after LS divisions). They undergo similar random segregation in their production and are subject to mutation throughout the life cycle. The total lifespan of an organism L (in units of cell divisions) could exceed LT+LS, meaning that an organism can accumulate background mutations even after development is complete. Selection takes place at the end of an organism’s lifespan, and affects the number of gametes released.

Mutation accumulation Every cell cycle consists of mutation and division. The accumulation of mitochondrial mutations is governed by two mutation rates: µS represents replication errors (per cell division), while µB represents background mutations (per unit time, which for the sake of convenience is also calibrated to the time of a single cell generation). Mutations are modeled as discrete events following a binomial probability distribution. A cell with m mutants and M-m wild type mitochondria will contain q mutants after the mutation event with probability æ M - m ö ç ÷ q-m M-q pmut (q;m, M ) = ç ÷m (1- m) , (1) è q - m ø where µ is the total mutation rate. In actively dividing cells μ = μS + μB, while μ = μB in non- dividing cells such as early segregated gametes or aging adult cells. Back-mutations are not considered in our model.

Cell division, organelle multiplication and segregation Cell division is modeled by first duplicating the cell’s mitochondrial population and then partitioning it randomly between the two daughter cells. Random mitochondrial segregation is modeled by sampling without replacement, which follows the hypergeometric probability distribution. The parent cell containing m mutant mitochondria gives rise to a daughter cell with k mutants with probability 2

 m  mM  2222 M  seg Mmkp ),;(       . (2)  k   kM   M  The complementary daughter cell contains 2m – k mutants. Similar probability distributions are used to generate gametes from the germ precursor cells via two reduction divisions following doubling. This reduces the total number of mitochondria per gamete to M/2.

In the case of isogamy, the two gametes of opposite mating type join together to produce a zygote with M mitochondria. We model the germline of oogamous organisms by allowing Q rounds of mitochondrial replication before . Each of these rounds occurs with mutation rate μS. We set the number of mitochondria in the zygote to be a multiple of M, as every pair of daughter cells following stem cell must contain the same amount of mitochondria, eventually resulting in M per somatic cell. This is achieved by allowing a partial extra round of mitochondrial replication in the oocyte to a total number equal to 2QM – M/2. The zygote thus contains 2QM mitochondria; M/2 come from the male gamete and 2QM – M/2 from the female gamete. The subsequent first Q cell divisions in the embryo do not involve mitochondrial replication, and so do not accumulate any mutations due to replication errors (μS). The partitioning of mitochondria in these larger zygotes still follows the pattern of random segregation as described above. This allows the number of mitochondria per cell to return back to M. Note, for Q = 0 (equal size female and male gametes) there are no extra rounds of replication in female gamete production.

In the case of uniparental inheritance, the number of mitochondria inherited from the male gamete is reduced to (1 – VU) M/2 (see Figure 3 legend). So the partial extra round of Q mitochondrial replication in the oocyte continues to a number equal to 2 M – (1 – VU) M/2. If there is full uniparental inheritance there is a complete extra round of replication (i.e. Q + 1 rounds in the oocyte). This adjustment allows the zygote to always contain a multiple of M mitochondria.

Selection Selection takes place at the end of an organism’s lifespan. Cell fitness values are determined by the number of mitochondrial mutants m, 2  m 1)(  m  M (3) and tissue fitness is defined as the arithmetic mean of the constituent cells. Adult organism fitness corresponds to the fitness of the worst tissue.

Selection is implemented as a random sampling with replacement, weighted according to adult organism fitness values. To maintain population size at constant N individuals, each selected individual only releases two randomly chosen gametes. Gametes are produced after selection so that if a specific individual is selected to reproduce several times, it releases distinct gametes every time.

Evolution of nuclear alleles Mating type, time of differentiation, degree of and size of sperm are all traits of an organism controlled by a set of loci in the nuclear genome, which is assumed to be diploid. The mating type locus is heterogametic ZW in the female-to-be (i.e. subject to oogamy), while 3

the other is homogametic ZZ (simulations with the reverse pattern of heterogamety yield similar results). The time of germ cell differentiation is specified by an allele at an autosomal locus, with the ancestral G allele coding for somatic gametogenesis (i.e. gametes generated from somatic tissues after L cell divisions), and a derived allele (g) coding for the developmental state with a dedicated germ cell lineage (i.e. gametes generated from embryonic stem cells after Lg cell divisions). Two further loci determine the degree of oogamy (A/a) and level of uniparental inheritance through rejection of mitochondria in sperm (U/u). These loci are only expressed in the female (oogamy is clearly a female property, and we assume that the female gamete destroys the incoming male mitochondria), and for convenience are assumed to be in complete linkage with the W allele responsible for female sex determination.

We determine the selective advantage of an invading allele by numerically calculating its fixation probability within a finite population. With the population at equilibrium, the invading allele is introduced at a low frequency f0, and its fate is tracked until either fixation or extinction. This required 105–106 repetitions of the calculation depending on the mutation rates and the associated levels of noise. This pattern is assessed relative to the fixation probability of a neutral allele with a similar initial frequency f0, as after a large number of generations the whole population must consist solely of the descendants of a single individual in the founding population. An allele is deemed to be evolutionarily advantageous if its fixation probability exceeds the chance of fixation of the neutral allele. The same general procedure is applied to determine the fate of the modifiers coding for the time of germ cell differentiation (g), gamete size (A) or mitochondrial exclusion (U). The germ cell differentiation locus is expressed in both , and is assumed to be autosomal, with the invading allele assumed to be dominant. We examined other dominance states, but did not find that any changes to the main conclusions of this work. The other two loci are W linked and unaffected by dominance considerations. To maintain reasonable computation time we limited the population size to N = 500, but trial simulations with population sizes up to N = 1000 individuals led to the same conclusions.

Probability distribution function for the number of mitochondrial mutants

Starting with a zygote containing m0 mutant mitochondria, the mutant number distribution across the cells after n mitotic divisions in the single multicellular organism (Fig. 2A-B) can be expressed as p()n = ()KJ n p()0 . (4) (l) (l) Here p is a column vector with the i-th element pi corresponding to the probability that a randomly picked cell will contain i mutants after l cell divisions, i Î [0, M ] . The initial state of (0) the organism (zygote) is pi = d(i, m0 ) (Kronecker delta). K is the (M+1)×(M+1) matrix with the element Kk,m corresponding to the probability of transition from the cell state with m mutant mitochondria (column index) to the state with k mutants (row index) during a single round of random partitioning given M mitochondria in total, Kk,m = pseg (k;m, M) (Eq. 2). Similarly, the square matrix J acts as a mutation operator with the element Jk,m = pmut (k;m, M) (Eq. 1). The model is similar to the Wright—Fisher process, but sampling is without replacement and so it is directly applicable to small populations, such as the mitochondrial population within a somatic cell. 4

Variance in the number of mutants after n cell divisions In the simplest case without somatic mutation accumulation, let Xn be a random variable denoting the number of mutant mitochondria within a somatic cell after n divisions, every time sampling without replacement M mitochondria from the doubled population of 2M. For a single round of sampling from the hypergeometric probability distribution, the mean is

xn-1 (M - xn-1) E(X | x ) = x and variance is Var(X | x ) = , where xn-1 is the number of n n-1 n-1 n n-1 2M -1 mutant mitochondria before doubling. Note that by induction EX( n ) = EX( n-1) =…= x0 . Variance in the number of mutant mitochondria in the infinite population of organism replicas after n cell division cycles can be expressed as é ù é ù Var( Xn ) = Eë Var( Xn | Xn-1)û+Varë E( Xn | Xn-1)û æ ö Xn-1 ()M - Xn-1 = Eç ÷+Var() Xn-1 è 2M -1 ø

M 1 2 = EX()n-1 - EX n-1 +Var() Xn-1 2M -1 2M -1 ()

x0 M 1 é 2 ù = - ëVar() Xn-1 + x0 û+Var() Xn-1 , 2M -1 2M -1

x0 ()M - x0 æ 1 ö Var() Xn = +ç1- ÷Var() Xn-1 . 2M -1 è 2M -1ø Here x0 is the initial number of mutant mitochondria, the first line applies the law of total variance. The above recurrence relation can be transformed into the form hn = Hhn-1by choosing 1 hn = Var( Xn ) - x0 (M - x0 ) and H =1- . With a boundary condition Var( X0 ) = 0 the 2M -1 solution is é æ 1 ön ù Var() Xn = x0 ()M - x0 ê1-ç1- ÷ ú, (5) ëê è 2M -1ø ûú x or in terms of mutant frequency p = n , n M é æ 1 ön ù Var(Pn ) = p0 (1- p0 )ê 1-ç1- ÷ ú. (6) ëê è 2M -1ø ûú

The increase of variance with n is evident, eventually saturating at p0(1-p0). The increase is slower with larger mitochondrial population size M. Changes in variance follow a similar trend starting with a zygote of size 2Q M and undergoing a number of reductive divisions without mitochondrial replication. This time the recurrence relation is

p0 (1- p0 ) æ 1 ö Var() Pn = 1+Q-n + Var() Pn-1 ç1- 1+Q-n ÷, 1£ n £ Q. 2 M -1 è 2 M -1ø (7) 5

The derivation is analogous to the previous case of constant M. For large initial number of mitochondria 1( 2Q M ) ® 0 , and the approximate solution is p (1- p ) Var P = 0 0 2n -1 , 1£ n £ Q. ()n Q () 2 M (8) So the variance between cells within a single organism decreases with increasing Q. 6

Supplementary Figure S1:

Fig. S1. Effect of tissues, mitochondrial number, oogamy, and uniparental inheritance on the probability of germline evolution. Fixation of an allele (g) encoding early germline sequestration (Lg = 3) is favored at high µS and relatively low µB (blue region). At low µS and high µB (red region) late gamete differentiation (LG = 10) is stable, because mitochondrial segregation increases variance and the number of high-fitness gametes (see Fig. 2A), opposing selection for the invading g allele. The black line depicts fixation probability of a neutral g allele introduced at a frequency 0.05. (A) The g allele is less likely to fix in organisms with more mitochondria (M = 200) and multiple (8) tissues (solid line) than in ancestral organisms with fewer mitochondria (M = 50) lacking tissues (dotted line, as in Fig. 3A). (B) The g allele is less likely to fix in organisms with mild oogamy (Q = 1, solid line) than in the ancestral state (Q = 0, dotted line). Other parameter values: M = 50, zero tissues. (C) The g allele is less likely to fix in organisms with strong oogamy (Q = 3, solid line) than in the ancestral state (Q = 0, dotted line). M = 50, no tissues. (D) The g allele fixes more readily in organisms with isogamy and uniparental inheritance (VU = 1) than in ancestral organisms with isogamy and biparental inheritance (VU = 0). 7

Supplementary Figure S2

Fig. S2. Evolution of oogamy with more mitochondria per cell. Oogamy is more advantageous with multiple tissues (red line) than in organisms lacking tissue-level organization (black line). The A allele increases gamete size in one mating type, giving rise to oogamy. Q is the number of rounds of mitochondrial replication without cell division, forming a large zygote with 2QM mitochondria. Increasing the number of mitochondria per cell (M = 200) lowers the variance between gametes, slightly depressing the advantage of oogamy (compare with Fig. 4B). The ancestral population is isogamous (Q = 0) and has biparental inheritance (VU = 0). Other parameter values: µS=0.001, µB=0.005. Neutral alleles fix with probability of 0.1 (dotted line). 8

Supplementary Figure S3

Fig. S3. Oogamy under uniparental inheritance. Oogamy is unlikely to evolve if the ancestral population is isogamous with complete uniparental inheritance (VU = 1) and no tissue-level differentiation. The A allele increases gamete size in one mating type, giving rise to oogamy. Q is the number of rounds of mitochondrial replication without cell division, forming a large zygote with 2QM mitochondria. Selection can favor the spread of A in multicellular organisms with tissue-level differentiation and fewer mitochondria, as higher Q reduces the variance between tissues, increasing adult fitness. However, higher Q also decreases variance between gametes, compared with UPI (VU = 1) and isogamy (Q = 0), and that lowers the strength of selection over generations, decreasing fitness. With lower M, variation between gametes can be maintained, giving Q an advantage. (A) 50 mitochondria per cell; (B) 20 mitochondria. Somatic mutation rate is set to µS=0.001, background mutation rate is µB = 0.0005. LG=10, L=40. Neutral alleles fix with probability of 0.1 (dotted lines).