Skip to contents

AlphaSimR was written with plants and animals in mind, but nothing in it requires an organism to be diploid for its whole life. This article shows how to simulate the breeding of a fungus whose life cycle alternates between haploid and diploid stages. It begins by matching each stage of that life cycle to the functions that model it, then uses them to simulate a published breeding program: the introgression of a sporeless mutation into a commercial strain of oyster mushroom (Pleurotus ostreatus). It ends with a list of what AlphaSimR can and cannot represent, which should be read before modeling any other species.

Fungal life cycles in AlphaSimR

The edible mushrooms are basidiomycetes, and most of them share the same basic life cycle. A spore germinates into a haploid mycelium called a monokaryon, whose cells each carry one nucleus. When two compatible monokaryons meet, their hyphae fuse but their nuclei do not: the result is a dikaryon, a mycelium whose cells each carry one nucleus from each parent. The dikaryon is the stage that is cultivated. It grows vegetatively, it is what spawn producers propagate and sell, and it is what forms mushrooms. Inside the gills of a mushroom, the two nuclei of a cell finally fuse and the resulting diploid nucleus immediately undergoes meiosis, producing four haploid spores that start the cycle again.

Each of these steps has a counterpart in AlphaSimR.

Stage Biology AlphaSimR
Monokaryon One haploid nucleus A Pop with ploidy = 1
Mating Two monokaryons fuse mergeGenome()
Dikaryon Two nuclei, unfused A Pop with ploidy = 2
Fruiting and sporulation Karyogamy, then meiosis reduceGenome()
Spawn Vegetative propagation Reuse the same individuals

mergeGenome() treats its two inputs as gametes and builds individuals whose ploidy is the sum of theirs, so two monokaryons give a dikaryon. It keeps the haplotypes in order, the first parent’s before the second’s, which means the two nuclei of a dikaryon remain identifiable. reduceGenome() halves the ploidy through a full meiosis with recombination, so a dikaryon gives haploid spores. The crossing functions makeCross(), randCross() and self() are not used, because they refuse populations with an odd ploidy.

AlphaSimR treats a dikaryon as a diploid individual. The two nuclei of a real dikaryon stay separate until fruiting, but for genetic values and meiosis this makes no difference: both nuclei are present in every cell, and karyogamy takes place immediately before meiosis.

Genetic values remain on one scale across the two stages. Additive effects are coded so that a haploid carrying an allele receives the same value as a diploid that is homozygous for it, so a monokaryon’s genetic value equals that of the dikaryon formed by doubling its nucleus. This allows monokaryons to be given genetic values and phenotypes, although in practice only dikaryons are evaluated because only they fruit.

doubleGenome(), which copies each haplotype in place, models the special case of a single nucleus duplicating itself. That corresponds to primary homothallism, in which one nucleus is self-fertile. It is not the right function for mating between two monokaryons, because the result is homozygous at every locus and its meiosis produces spores identical to their parent.

Mating types

A monokaryon can mate only with a partner of a different mating type. P. ostreatus, like many basidiomycetes, has a tetrapolar mating system: mating type is determined by two unlinked loci, A and B, each with many alleles, and two monokaryons form a fertile dikaryon only when they carry different alleles at both.

AlphaSimR has no concept of mating type. Its sexes, set with SimParam$setSexes(), are a two-class system that cannot describe compatibility at two multiallelic loci. Instead, the mating-type loci are added to the founder genome as named segregating sites with addSegSite(), and a monokaryon’s mating type is read from its genotype at those sites with pullMarkerGeno(). A segregating site in AlphaSimR has only two alleles, so each mating-type locus is built from two sites at the same map position. Together they give four alleles, and because no crossover can fall between two sites at the same position, the alleles are inherited intact. More sites at the same position would give more alleles. Compatibility then has to be checked before every mating, because mergeGenome() will combine any two individuals given to it.

The breeding program

Oyster mushrooms release enormous numbers of spores, and workers in oyster mushroom cultivation develop lung problems from breathing them. A sporeless strain would remove the problem. A naturally sporeless strain, ATCC 58937, existed, but it was not commercially attractive, so Wageningen researchers set out to introduce its sporelessness into the commercial strain HK35 (Baars et al. 2005). The resulting variety, SPOPPO, was released in 2006 (Lavrijssen et al. 2020).

The published description of the program gives its structure (Baars et al. 2005; Baars 2007):

  1. The two nuclei of each parent strain were recovered as monokaryons by protoplasting.
  2. Crosses between the HK35 and ATCC nuclei all produced sporulating strains, so sporelessness is recessive: a dikaryon is sporeless only when both of its nuclei carry the mutation. Each HK35 nucleus was mated with a different ATCC nucleus.
  3. Among the spores of those crosses, the sporeless mutation segregated one to one, and genetic markers linked to it were developed.
  4. The mutation was introgressed into each HK35 nucleus separately by repeated backcrossing to that nucleus.
  5. The two recombinant nuclei were mated, giving a sporeless strain whose genome came mostly from HK35.
  6. Prototype strains were tested on commercial farms.

The later mapping of the trait added one important detail: the sporeless locus lies on the same linkage group as the A mating-type locus (Lavrijssen et al. 2020).

That linkage shapes the program. Each backcross mates a selected spore with the recurrent HK35 nucleus, so the spore must carry mating-type alleles that differ from that nucleus’s at A and at B, which means carrying the donor’s alleles at both. At the end of the program, however, the two recombinant nuclei must be compatible with each other. The simplest way to ensure this, and the way that makes the final strain most like HK35, is for each to carry the mating type of the HK35 nucleus it replaces. The last spore selected in each line therefore needs the donor allele at the sporeless locus and the recurrent nucleus’s allele at the A locus on the same chromosome, which requires a crossover between them.

The published sources do not give the numbers needed for a simulation. The values below are assumptions, and any of them can be changed.

Quantity Value used here
Chromosomes 11, 1 Morgan each
Sporeless locus Chromosome 3, 30 cM
A mating-type locus Chromosome 3, 55 cM
B mating-type locus Chromosome 7, 50 cM
Spores genotyped per generation 200
Backcross generations 4
Spores kept per generation 1, then 3 at the end
Yield trial 4 replicates per strain

P. ostreatus has 11 chromosomes, and its genetic map is a little over 1000 cM long (Lavrijssen et al. 2020), so a Morgan per chromosome is a reasonable approximation. The distance between the sporeless and A loci is not published and is the assumption that matters most here.

Setting up the simulation

The founders are simulated with runMacs() as haploid genomes. Eighty are simulated, in twenty sets of four. Each set supplies the nuclei of a pair of parent strains, two for HK35 and two for ATCC 58937, and the first set is used for the program below. Together they form the reference population in which the trait’s variance is set.

set.seed(2005)

founderPop = runMacs(nInd = 80, nChr = 11, segSites = 1000, ploidy = 1L)
nSet = founderPop@nInd/4

The sporeless and mating-type loci are then added at their assumed positions. Within each set, the two donor nuclei carry the sporeless allele and the two recipient nuclei do not, and the four nuclei carry four different alleles at each mating-type locus, written as the pair of genotypes at its two sites. That makes every HK35 nucleus compatible with both ATCC nuclei and with the other HK35 nucleus, as the program requires.

founderPop = addSegSite(founderPop, siteName = "sporeless", chr = 3,
                        mapPos = 0.30, haplo = rep(c(0, 0, 1, 1), nSet))
founderPop = addSegSite(founderPop, siteName = "matA_1", chr = 3,
                        mapPos = 0.55, haplo = rep(c(0, 0, 1, 1), nSet))
founderPop = addSegSite(founderPop, siteName = "matA_2", chr = 3,
                        mapPos = 0.55, haplo = rep(c(0, 1, 0, 1), nSet))
founderPop = addSegSite(founderPop, siteName = "matB_1", chr = 7,
                        mapPos = 0.50, haplo = rep(c(0, 0, 1, 1), nSet))
founderPop = addSegSite(founderPop, siteName = "matB_2", chr = 7,
                        mapPos = 0.50, haplo = rep(c(0, 1, 0, 1), nSet))

Yield is modeled as an additive trait. A dominance trait would be more realistic for dikaryons, but its parameters are defined in the founder population, and haploid founders have no heterozygotes. The added loci are excluded from the sites that can be sampled as QTL, so that they affect nothing but sporulation and mating, which requires calling SP$restrSegSites() before the trait is added. Recombination tracking, turned on with SP$setTrackRec(TRUE), records which founder each segment of every genome descends from and is used below to measure how much of the HK35 genome has been recovered.

namedLoci = c("sporeless", "matA_1", "matA_2", "matB_1", "matB_2")

SP = SimParam$new(founderPop)
SP$restrSegSites(excludeQtl = namedLoci)
SP$addTraitA(nQtlPerChr = 100, mean = 100, var = 100)
SP$setVarE(varE = 50)
SP$setTrackRec(TRUE)

monokaryons = newPop(founderPop)
pullMarkerGeno(monokaryons[1:4], markers = namedLoci)
#>   sporeless matA_1 matA_2 matB_1 matB_2
#> 1         0      0      0      0      0
#> 2         0      0      1      0      1
#> 3         1      1      0      1      0
#> 4         1      1      1      1      1

A mating type is the pair of genotypes at a locus’s two sites.

matingType = function(pop, locus){
  geno = pullMarkerGeno(pop, markers = paste0(locus, c("_1", "_2")))
  paste0(geno[, 1], geno[, 2])
}

The parent strains are built by mating their two nuclei. The ATCC nuclei, founders 3 and 4, are the ones carrying the sporeless mutation.

H = monokaryons[1:2] # HK35 nuclei
S = monokaryons[3:4] # ATCC 58937 nuclei

HK35 = mergeGenome(H, H, crossPlan = cbind(1, 2))
ATCC = mergeGenome(S, S, crossPlan = cbind(1, 2))

c(HK35 = gv(HK35), ATCC = gv(ATCC))
#>      HK35      ATCC 
#> 101.28091  98.40713

Mating and fruiting

The first step of the program mates an HK35 nucleus with an ATCC nucleus. The dikaryon fruits and its spores are collected with reduceGenome(). Every spore records the two nuclei it descends from as its mother and father, which keeps the pedigree correct across the haploid stage.

F1 = mergeGenome(H[1], S[1], crossPlan = cbind(1, 1))
spores = reduceGenome(F1, nProgeny = 200)

head(data.frame(id = spores@id, mother = spores@mother, father = spores@father))
#>   id mother father
#> 1 84      1      3
#> 2 85      1      3
#> 3 86      1      3
#> 4 87      1      3
#> 5 88      1      3
#> 6 89      1      3

About half the spores carry the sporeless allele, as in the one-to-one segregation that was observed.

table(sporeless = pullMarkerGeno(spores, markers = "sporeless"))
#> sporeless
#>   0   1 
#>  92 108

The cross-tabulation of the sporeless locus with the A mating-type locus shows their linkage: spores mostly carry the sporeless allele together with the ATCC nucleus’s A allele, 10, and the normal allele together with the HK35 nucleus’s, 00.

table(sporeless = pullMarkerGeno(spores, markers = "sporeless"),
      matingTypeA = matingType(spores, "matA"))
#>          matingTypeA
#> sporeless 00 10
#>         0 67 25
#>         1 31 77

Backcrossing into one nucleus

The function below runs the introgression into a single HK35 nucleus. In each generation it mates the recurrent nucleus with the current recombinant, collects spores, and keeps the spores that carry the sporeless allele and a suitable mating type: compatible with the recurrent nucleus while backcrossing continues, and identical to it in the last generation. From these it keeps those with the greatest share of the recurrent nucleus’s genome, which is marker-assisted background selection, or keeps a random set when useBackground is FALSE.

The sporeless and mating-type genotypes are read directly, as though the causal sites themselves were genotyped. A real program genotypes markers linked to them, and the SPOPPO program used markers linked to the sporeless locus. The share of the recurrent genome is measured with pullIbdHaplo(), which reports for each site the founder a haplotype descends from. Because the founders are haploid, each contributes exactly one haplotype, which pullIbdHaplo() identifies by the founder’s position in founderPop.

introgress = function(recurrent, donor, nBackcross = 4, nSpores = 200,
                      nFinal = 3, useBackground = TRUE){
  rec = as.integer(recurrent@iid)
  recA = matingType(recurrent, "matA")
  recB = matingType(recurrent, "matB")
  current = donor
  for(gen in 0:nBackcross){
    strain = mergeGenome(recurrent, current, crossPlan = cbind(1, 1))
    spores = reduceGenome(strain, nProgeny = nSpores)

    sporeless = pullMarkerGeno(spores, markers = "sporeless")[, 1]==1
    sporeA = matingType(spores, "matA")
    sporeB = matingType(spores, "matB")
    if(gen<nBackcross){
      # The spore must still be able to mate with the recurrent nucleus
      mating = sporeA!=recA & sporeB!=recB
      n = 1
    }else{
      # The spore must replace the recurrent nucleus in the final strain
      mating = sporeA==recA & sporeB==recB
      n = nFinal
    }
    keep = which(sporeless & mating)
    if(length(keep)==0){
      stop("no usable spore in generation ", gen)
    }
    n = min(n, length(keep))

    if(useBackground){
      ibd = pullIbdHaplo(spores[keep])
      recovery = rowMeans(ibd==rec)
      take = keep[order(recovery, decreasing = TRUE)[1:n]]
    }else{
      take = keep[sample.int(length(keep), n)]
    }
    current = spores[take]
  }
  current
}

Each HK35 nucleus is paired with a different ATCC nucleus, as in the program.

line1 = introgress(recurrent = H[1], donor = S[1])
line2 = introgress(recurrent = H[2], donor = S[2])

The plot shows where the final recombinant nuclei of the first line still carry donor sequence on chromosome 3, with dashed lines at the sporeless locus and the A mating-type locus. Little donor sequence is left, and most of what remains is a segment around the sporeless locus, which selection kept from the donor in every generation. The A locus is free of it, as the last round of selection required.

genMap = getGenMap()
chr3 = genMap$id[genMap$chr=="3"]
pos3 = genMap$pos[genMap$chr=="3"]
fromDonor = pullIbdHaplo(line1)[, chr3]!=as.integer(H[1]@iid)

plot(range(pos3), c(0.5, nInd(line1)+0.5), type = "n",
     xlab = "Position on chromosome 3 (Morgans)", ylab = "Nucleus",
     yaxt = "n")
axis(2, at = 1:nInd(line1))
for(i in 1:nInd(line1)){
  points(pos3[fromDonor[i, ]], rep(i, sum(fromDonor[i, ])),
         pch = 15, cex = 0.5)
}
abline(v = genMap$pos[genMap$id%in%c("sporeless", "matA_1")], lty = 2)

Building and testing prototypes

Every recombinant from the first line carries the mating type of the first HK35 nucleus and every one from the second carries that of the second, so any pairing of the two is compatible. Mating them all gives nine prototype strains, and a strain is sporeless when both of its nuclei carry the sporeless allele, which is a genotype of 2.

crossPlan = expand.grid(1:nInd(line1), 1:nInd(line2))
prototypes = mergeGenome(line1, line2, crossPlan = as.matrix(crossPlan))

table(sporeless = pullMarkerGeno(prototypes, markers = "sporeless"))
#> sporeless
#> 2 
#> 9

The prototypes are then tested alongside HK35 in a yield trial with four replicates.

trial = c(prototypes, HK35)
trial = setPheno(trial, reps = 4)

data.frame(strain = c(paste0("prototype", 1:nInd(prototypes)), "HK35"),
           gv = round(gv(trial)[, 1], 2), pheno = round(pheno(trial)[, 1], 2))
#>        strain     gv  pheno
#> 1  prototype1 100.88  96.07
#> 2  prototype2 100.88  99.44
#> 3  prototype3 100.88 100.55
#> 4  prototype4 100.88 103.68
#> 5  prototype5 100.88 100.82
#> 6  prototype6 100.88 106.91
#> 7  prototype7 101.18 104.09
#> 8  prototype8 101.18 106.20
#> 9  prototype9 101.18 100.07
#> 10       HK35 101.28 101.02

Because the aim of the program is to reproduce HK35, the prototypes’ genetic values should be close to HK35’s. Several prototypes have identical genetic values because their nuclei differ only where no QTL lie, and the differences among them all are much smaller than the error in a trial of this size. This matches what was found for SPOPPO, whose prototypes performed satisfactorily on farms (Baars et al. 2005).

The value of background selection

The simulation can be used to ask how much the marker-assisted background selection contributes. The loop below repeats the whole program with each of the twenty sets of parent strains, with and without background selection, and records the share of the final strain’s genome that comes from the recipient strain and its genetic value relative to that strain.

result = NULL
for(set in 1:nSet){
  parents = 4*(set-1) + 1:4
  H = monokaryons[parents[1:2]]
  S = monokaryons[parents[3:4]]
  HK35 = mergeGenome(H, H, crossPlan = cbind(1, 2))
  for(useBackground in c(FALSE, TRUE)){
    line1 = introgress(H[1], S[1], nFinal = 1, useBackground = useBackground)
    line2 = introgress(H[2], S[2], nFinal = 1, useBackground = useBackground)
    strain = mergeGenome(line1, line2, crossPlan = cbind(1, 1))
    result = rbind(result, data.frame(
      useBackground = useBackground,
      recovery = mean(pullIbdHaplo(strain)%in%H@iid),
      gvDiff = gv(strain)[, 1]-gv(HK35)[, 1]
    ))
  }
}

aggregate(cbind(recovery, gvDiff) ~ useBackground, data = result,
          FUN = function(x) round(c(mean = mean(x), sd = sd(x)), 3))
#>   useBackground recovery.mean recovery.sd gvDiff.mean gvDiff.sd
#> 1         FALSE         0.943       0.021      -0.097     1.849
#> 2          TRUE         0.994       0.003      -0.172     0.606

Without background selection, about 94% of the final strain’s genome comes from HK35 after four backcrosses, and its genetic value differs from HK35’s by an amount that varies widely from one run to the next. Selecting among the usable spores for the HK35 background raises the share to about 99% and makes the final strain far more reliably like HK35. The mean difference is small in both cases because the donor nuclei were drawn at random, so donor sequence is as likely to help as to hurt; with a donor known to be poor, the foreground-only program would also be worse on average.

What can and cannot be modeled

The program above used only a few features of AlphaSimR, but they cover the sexual cycle of most cultivated basidiomycetes and many ascomycetes. The list below is a guide to what else can be represented.

Can be modeled directly

  • Haploid and diploid stages, using mergeGenome() for mating and reduceGenome() for meiosis. Ploidies other than one and two are also supported, as long as meiosis is applied to an even ploidy.
  • Clonal propagation, which needs no function: the same individuals are used again.
  • Primary homothallism, with doubleGenome() or with mergeGenome() given the same individual twice.
  • Phenotypes and genetic values in either stage, with a single scale for additive effects.
  • Pedigrees through the haploid stage, since spores record their parental nuclei.
  • Marker-assisted and genomic selection, using pullMarkerGeno(), pullSnpGeno() or pullIbdHaplo() on monokaryons or dikaryons.
  • Uneven recombination along chromosomes, with a custom genetic map. This is how the button mushroom (Agaricus bisporus var. bisporus), whose crossovers are confined almost entirely to the ends of its chromosomes (Sonnenberg et al. 2016), would be represented.

Must be handled by the user

  • Mating types. AlphaSimR will mate any two individuals, so compatibility must be checked before each mating, as it was here. Mating-type loci with many alleles can be built from several named sites at the same map position, as above.
  • Recovering the nuclei of a dikaryon, as protoplasting does. There is no function for it. Keeping the monokaryons that formed a dikaryon is the simplest solution. reduceGenome() with simRecomb = FALSE does not do this, because chromosomes still assort independently and its output mixes the two nuclei.

Cannot be modeled

  • Tetrads. Each spore from reduceGenome() comes from an independent meiosis, so the four products of one meiosis, and the mitotic copies of them that some ascomycetes package into an ascus, are not produced together.
  • Pseudohomothallism, in which a spore receives two compatible nuclei, as in most strains of A. bisporus var. bisporus (Sonnenberg et al. 2017). A two-nucleus spore can be imitated by mating two spores of the same strain, but reduceGenome() does not reproduce the way the nuclei are partitioned.
  • Matings between a dikaryon and a monokaryon (the Buller phenomenon), in which a nucleus of the dikaryon migrates into the monokaryon. The SPOPPO program used this route for some of its crosses (Baars et al. 2005). Its outcome can be simulated by choosing one of the dikaryon’s nuclei and mating it with mergeGenome().
  • Heterokaryons with more than two nuclear types, the parasexual cycle and mitotic recombination.
  • Aneuploidy and chromosome loss.
  • Mitochondrial and other cytoplasmic inheritance.

References

Baars, J. J. P. 2007. Mushroom Variety Named “Spoppo”. US Plant Patent PP18,037. https://patents.google.com/patent/USPP18037P3/en.
Baars, J. J., A. Sonnenberg, and P. Hendrickx. 2005. “Development of a Sporeless Strain of Oyster Mushroom (Pleurotus ostreatus).” In Genetics and Cellular Biology of Basidiomycetes-VI, edited by A. G. Pisabarro and L. Ramírez. Universidad Pública de Navarra. https://academica-e.unavarra.es/server/api/core/bitstreams/39816bed-a8ea-4f52-a03c-fb39365150e4/content.
Lavrijssen, B., J. P. Baars, L. G. Lugones, et al. 2020. “Interruption of an MSH4 Homolog Blocks Meiosis in Metaphase I and Eliminates Spore Formation in Pleurotus ostreatus.” PLOS ONE 15 (11): e0241749. https://doi.org/10.1371/journal.pone.0241749.
Sonnenberg, A. S. M., J. J. P. Baars, W. Gao, and R. G. F. Visser. 2017. “Developments in Breeding of Agaricus bisporus Var. Bisporus: Progress Made and Technical and Legal Hurdles to Take.” Applied Microbiology and Biotechnology 101 (5): 1819–29. https://doi.org/10.1007/s00253-017-8102-2.
Sonnenberg, A. S. M., W. Gao, B. Lavrijssen, et al. 2016. “A Detailed Analysis of the Recombination Landscape of the Button Mushroom Agaricus bisporus Var. Bisporus.” Fungal Genetics and Biology 93: 35–45. https://doi.org/10.1016/j.fgb.2016.06.001.