Introduction

To start a set of simulations in the AlphaSimR package (Gaynor, Gorjanc, and Hickey 2021), four steps must be implemented, as follows:

  1. Simulate founder genomes/haplotypes.
  2. Set global simulation parameters for a target trait/traits.
  3. Model the breeding program.
  4. Examine results by looking into population individuals’ metrics.

In this vignette, we will implement and further explore the first two.

Genetic basis of base population: Founder genomes

First, we clean our working environment and download/load the AlphaSimR package.

#install.packages('AlphaSimR')
require(AlphaSimR)
## Carregando pacotes exigidos: AlphaSimR
## Warning: package 'AlphaSimR' was built under R version 4.3.3
## Carregando pacotes exigidos: R6

To create the founder genome we may use the function runMacs(). It uses the method from Chen et al. (Chen, Marjoram, and Wall 2009) to simulate a set of haplotypes and, from that, a species-specific demography. This allows us to simulate a base genome with characteristics of the target crop that we are working with.

# Founder genome
founderGenomes = runMacs(nInd = 10, # Number of individuals that compose the base genome
                         nChr = 10, # Number of chromosome pairs of the target species
                         segSites = 100, # number of segregation sites 
                         species = "MAIZE", # We can use the base parameters and we have available in the package MAIZE, WHEAT, CATTLE, and GENERIC.
                         ploidy = 2) # Setting the ploidy


# Object created
founderGenomes
## An object of class "MapPop" 
## Ploidy: 2 
## Individuals: 10 
## Chromosomes: 10 
## Loci: 1000
# Genetic map of the segregation sites
founderGenomes@genMap
## $`1`
##        1_1        1_2        1_3        1_4        1_5        1_6        1_7 
## 0.00000000 0.02350037 0.02432626 0.02974982 0.05290448 0.05314096 0.06560542 
##        1_8        1_9       1_10       1_11       1_12       1_13       1_14 
## 0.08164341 0.09503599 0.10937703 0.13951821 0.16434691 0.18286539 0.18543564 
##       1_15       1_16       1_17       1_18       1_19       1_20       1_21 
## 0.20395913 0.21627787 0.22525728 0.23458121 0.25300633 0.25645332 0.27869274 
##       1_22       1_23       1_24       1_25       1_26       1_27       1_28 
## 0.32536066 0.33301649 0.35411599 0.35757147 0.36195627 0.38981097 0.39692079 
##       1_29       1_30       1_31       1_32       1_33       1_34       1_35 
## 0.40931790 0.41801899 0.47387501 0.48572567 0.49593467 0.52930085 0.53737307 
##       1_36       1_37       1_38       1_39       1_40       1_41       1_42 
## 0.54870037 0.56826287 0.58620339 0.60410942 0.60545486 0.61919531 0.62927092 
##       1_43       1_44       1_45       1_46       1_47       1_48       1_49 
## 0.63039711 0.63145269 0.65801687 0.66893620 0.72733947 0.73574150 0.75588080 
##       1_50       1_51       1_52       1_53       1_54       1_55       1_56 
## 0.75998999 0.76076984 0.78947345 0.78960570 0.79190792 0.80530303 0.86323745 
##       1_57       1_58       1_59       1_60       1_61       1_62       1_63 
## 0.87597670 0.88284951 0.90883472 0.92426720 0.92680268 0.95547958 0.99089066 
##       1_64       1_65       1_66       1_67       1_68       1_69       1_70 
## 1.01446958 1.02430886 1.05077819 1.05797307 1.06205847 1.07136424 1.08092190 
##       1_71       1_72       1_73       1_74       1_75       1_76       1_77 
## 1.08752477 1.11680535 1.16307338 1.17631320 1.24503437 1.25326893 1.32710127 
##       1_78       1_79       1_80       1_81       1_82       1_83       1_84 
## 1.35471201 1.39119560 1.44171403 1.51419693 1.53110830 1.53887337 1.56165316 
##       1_85       1_86       1_87       1_88       1_89       1_90       1_91 
## 1.59818465 1.61192359 1.64331044 1.66137502 1.68632325 1.73494136 1.74538286 
##       1_92       1_93       1_94       1_95       1_96       1_97       1_98 
## 1.75326656 1.75812563 1.78346880 1.80945606 1.87307046 1.93680117 1.93690816 
##       1_99      1_100 
## 1.94915784 1.96574402 
## 
## $`2`
##         2_1         2_2         2_3         2_4         2_5         2_6 
## 0.000000000 0.002250523 0.053150929 0.054760691 0.062595078 0.088302999 
##         2_7         2_8         2_9        2_10        2_11        2_12 
## 0.094055148 0.110004339 0.141437583 0.152219672 0.203927346 0.267739467 
##        2_13        2_14        2_15        2_16        2_17        2_18 
## 0.277806329 0.279649935 0.282055419 0.282317510 0.286408301 0.289003199 
##        2_19        2_20        2_21        2_22        2_23        2_24 
## 0.289627805 0.294817605 0.301427484 0.303128553 0.319944424 0.329861225 
##        2_25        2_26        2_27        2_28        2_29        2_30 
## 0.332010660 0.334382495 0.355834430 0.356450870 0.359853433 0.385147213 
##        2_31        2_32        2_33        2_34        2_35        2_36 
## 0.472817376 0.486589037 0.499740794 0.507808351 0.549371387 0.560197334 
##        2_37        2_38        2_39        2_40        2_41        2_42 
## 0.589453133 0.592389537 0.598621797 0.631338145 0.649533005 0.649554010 
##        2_43        2_44        2_45        2_46        2_47        2_48 
## 0.657399408 0.683593272 0.695070222 0.713840342 0.723856174 0.827309705 
##        2_49        2_50        2_51        2_52        2_53        2_54 
## 0.828091772 0.832391110 0.846549847 0.858922702 0.901083937 0.901311086 
##        2_55        2_56        2_57        2_58        2_59        2_60 
## 0.922554444 0.936183124 1.016431115 1.018335024 1.039154966 1.082428072 
##        2_61        2_62        2_63        2_64        2_65        2_66 
## 1.124293599 1.126252403 1.134599758 1.175175022 1.198566065 1.219100878 
##        2_67        2_68        2_69        2_70        2_71        2_72 
## 1.219342179 1.228408851 1.242360306 1.273167117 1.289519877 1.293850442 
##        2_73        2_74        2_75        2_76        2_77        2_78 
## 1.311252918 1.327745550 1.335217663 1.371477313 1.389142910 1.394287320 
##        2_79        2_80        2_81        2_82        2_83        2_84 
## 1.440571871 1.448929017 1.464193347 1.464734614 1.464835304 1.488507218 
##        2_85        2_86        2_87        2_88        2_89        2_90 
## 1.523823164 1.546671949 1.603153558 1.622093927 1.637887883 1.690208204 
##        2_91        2_92        2_93        2_94        2_95        2_96 
## 1.726889221 1.733664261 1.776310822 1.792025689 1.799904078 1.813999016 
##        2_97        2_98        2_99       2_100 
## 1.859518465 1.903309423 1.932305456 1.943339523 
## 
## $`3`
##         3_1         3_2         3_3         3_4         3_5         3_6 
## 0.000000000 0.007974915 0.045277425 0.048546594 0.063413839 0.064830657 
##         3_7         3_8         3_9        3_10        3_11        3_12 
## 0.103522710 0.114612748 0.121063306 0.126562730 0.147646284 0.158633534 
##        3_13        3_14        3_15        3_16        3_17        3_18 
## 0.192232897 0.217687662 0.241473259 0.275912876 0.285136467 0.290808109 
##        3_19        3_20        3_21        3_22        3_23        3_24 
## 0.292259651 0.384248187 0.469656552 0.478931390 0.481262495 0.488742821 
##        3_25        3_26        3_27        3_28        3_29        3_30 
## 0.489733189 0.514670969 0.518555670 0.539821499 0.553863418 0.554038063 
##        3_31        3_32        3_33        3_34        3_35        3_36 
## 0.620830525 0.622454567 0.669028120 0.669603799 0.712523583 0.750320635 
##        3_37        3_38        3_39        3_40        3_41        3_42 
## 0.754322299 0.754588608 0.757028909 0.782382365 0.798810158 0.842372948 
##        3_43        3_44        3_45        3_46        3_47        3_48 
## 0.858872763 0.878230712 0.891605100 0.892455264 0.947340878 0.978577866 
##        3_49        3_50        3_51        3_52        3_53        3_54 
## 1.004458444 1.014860310 1.042086836 1.072344300 1.085111496 1.102441924 
##        3_55        3_56        3_57        3_58        3_59        3_60 
## 1.146215002 1.158887078 1.165131610 1.188633148 1.205305443 1.218313339 
##        3_61        3_62        3_63        3_64        3_65        3_66 
## 1.222233233 1.223694126 1.229057861 1.264616904 1.277201998 1.288045062 
##        3_67        3_68        3_69        3_70        3_71        3_72 
## 1.308365924 1.309689245 1.323991269 1.361833869 1.364756674 1.367415911 
##        3_73        3_74        3_75        3_76        3_77        3_78 
## 1.395561604 1.396525687 1.422187102 1.433948511 1.476385830 1.524399075 
##        3_79        3_80        3_81        3_82        3_83        3_84 
## 1.524887086 1.569361294 1.578922514 1.598008868 1.612193454 1.653870155 
##        3_85        3_86        3_87        3_88        3_89        3_90 
## 1.665764102 1.667753969 1.679850094 1.734450700 1.740433905 1.749262978 
##        3_91        3_92        3_93        3_94        3_95        3_96 
## 1.781226864 1.795777922 1.799526651 1.804985012 1.856640908 1.884201567 
##        3_97        3_98        3_99       3_100 
## 1.904966486 1.907313225 1.964314136 1.976493787 
## 
## $`4`
##        4_1        4_2        4_3        4_4        4_5        4_6        4_7 
## 0.00000000 0.05412759 0.06153840 0.09838543 0.14230049 0.18569049 0.20695635 
##        4_8        4_9       4_10       4_11       4_12       4_13       4_14 
## 0.20779775 0.21947706 0.22507507 0.29338988 0.29506997 0.30389125 0.31543851 
##       4_15       4_16       4_17       4_18       4_19       4_20       4_21 
## 0.31812888 0.32709739 0.33626562 0.35142876 0.37146924 0.37290498 0.38516038 
##       4_22       4_23       4_24       4_25       4_26       4_27       4_28 
## 0.42782839 0.42846934 0.43362016 0.43661365 0.46796000 0.46918496 0.47344316 
##       4_29       4_30       4_31       4_32       4_33       4_34       4_35 
## 0.48709499 0.52217476 0.53729965 0.58286625 0.58569161 0.58848683 0.63685709 
##       4_36       4_37       4_38       4_39       4_40       4_41       4_42 
## 0.64441792 0.66179484 0.69077233 0.70224876 0.70795244 0.71114618 0.72302381 
##       4_43       4_44       4_45       4_46       4_47       4_48       4_49 
## 0.76323938 0.78222927 0.78305851 0.78891306 0.80696983 0.83668500 0.85304534 
##       4_50       4_51       4_52       4_53       4_54       4_55       4_56 
## 0.90837697 0.94822161 0.95010659 0.96541893 1.06316215 1.08139210 1.08630863 
##       4_57       4_58       4_59       4_60       4_61       4_62       4_63 
## 1.11888244 1.12317595 1.13654083 1.15948588 1.20601736 1.23693686 1.25713746 
##       4_64       4_65       4_66       4_67       4_68       4_69       4_70 
## 1.31194608 1.33434647 1.34004227 1.36854534 1.43038983 1.44029141 1.44718617 
##       4_71       4_72       4_73       4_74       4_75       4_76       4_77 
## 1.46391821 1.52774555 1.52836067 1.54277468 1.55072157 1.57132709 1.57932670 
##       4_78       4_79       4_80       4_81       4_82       4_83       4_84 
## 1.58084650 1.58602081 1.60317358 1.64915548 1.69433193 1.70369010 1.70683667 
##       4_85       4_86       4_87       4_88       4_89       4_90       4_91 
## 1.72299077 1.73243432 1.77128492 1.82161645 1.82668487 1.85842011 1.86556649 
##       4_92       4_93       4_94       4_95       4_96       4_97       4_98 
## 1.87015267 1.89456411 1.89738891 1.89807438 1.93034654 1.94805350 1.95161927 
##       4_99      4_100 
## 1.95661692 1.96946965 
## 
## $`5`
##        5_1        5_2        5_3        5_4        5_5        5_6        5_7 
## 0.00000000 0.02902465 0.03670029 0.03816574 0.04198224 0.09998596 0.11004944 
##        5_8        5_9       5_10       5_11       5_12       5_13       5_14 
## 0.11038918 0.11061621 0.14924601 0.16468003 0.17718124 0.18046471 0.18495743 
##       5_15       5_16       5_17       5_18       5_19       5_20       5_21 
## 0.18676059 0.19750495 0.20917094 0.21207529 0.27016234 0.27616604 0.28158850 
##       5_22       5_23       5_24       5_25       5_26       5_27       5_28 
## 0.35325999 0.38164036 0.41150860 0.41729645 0.54102812 0.58017653 0.58308801 
##       5_29       5_30       5_31       5_32       5_33       5_34       5_35 
## 0.59739526 0.60780440 0.62167175 0.62182672 0.62798175 0.62824671 0.69480107 
##       5_36       5_37       5_38       5_39       5_40       5_41       5_42 
## 0.74206096 0.75601383 0.75996848 0.76607984 0.76960274 0.82746360 0.84885305 
##       5_43       5_44       5_45       5_46       5_47       5_48       5_49 
## 0.88276691 0.89601527 0.91283267 0.92587399 0.95287460 0.97014950 1.01716540 
##       5_50       5_51       5_52       5_53       5_54       5_55       5_56 
## 1.02394088 1.02537750 1.03046215 1.04266540 1.07583884 1.14121328 1.16844918 
##       5_57       5_58       5_59       5_60       5_61       5_62       5_63 
## 1.17288194 1.18131865 1.18521567 1.21710112 1.24698729 1.26517529 1.28652036 
##       5_64       5_65       5_66       5_67       5_68       5_69       5_70 
## 1.30044443 1.30485704 1.33990487 1.38028981 1.38796303 1.38882751 1.40326800 
##       5_71       5_72       5_73       5_74       5_75       5_76       5_77 
## 1.44345930 1.49969266 1.55666286 1.58227077 1.60284105 1.60800314 1.61359664 
##       5_78       5_79       5_80       5_81       5_82       5_83       5_84 
## 1.61799647 1.64740524 1.68479309 1.69751990 1.71831425 1.73926763 1.75554321 
##       5_85       5_86       5_87       5_88       5_89       5_90       5_91 
## 1.77187639 1.83136168 1.83180972 1.83732575 1.84776018 1.85554853 1.86185787 
##       5_92       5_93       5_94       5_95       5_96       5_97       5_98 
## 1.87058875 1.89840941 1.92586878 1.93014941 1.95460636 1.95510654 1.97212274 
##       5_99      5_100 
## 1.98389470 1.99265521 
## 
## $`6`
##         6_1         6_2         6_3         6_4         6_5         6_6 
## 0.000000000 0.002760388 0.016044042 0.048704947 0.086859190 0.102655746 
##         6_7         6_8         6_9        6_10        6_11        6_12 
## 0.117654296 0.125029189 0.127040345 0.150783484 0.250869915 0.273480156 
##        6_13        6_14        6_15        6_16        6_17        6_18 
## 0.275521974 0.284430464 0.309385930 0.315502071 0.335874104 0.344389651 
##        6_19        6_20        6_21        6_22        6_23        6_24 
## 0.365446413 0.387316735 0.388990144 0.394086502 0.404365308 0.414369455 
##        6_25        6_26        6_27        6_28        6_29        6_30 
## 0.414671264 0.440428041 0.509461256 0.530329868 0.589532078 0.626812260 
##        6_31        6_32        6_33        6_34        6_35        6_36 
## 0.627867256 0.640664238 0.690035933 0.714678866 0.725714146 0.812717476 
##        6_37        6_38        6_39        6_40        6_41        6_42 
## 0.857000791 0.879005064 0.914389160 0.931679623 0.939835852 0.943531660 
##        6_43        6_44        6_45        6_46        6_47        6_48 
## 0.945553855 0.951229856 0.952338841 0.956231626 0.961524772 0.967481009 
##        6_49        6_50        6_51        6_52        6_53        6_54 
## 0.978837890 0.993377001 0.993667030 0.996663909 1.011407756 1.026570387 
##        6_55        6_56        6_57        6_58        6_59        6_60 
## 1.047007605 1.073459429 1.080595527 1.119324710 1.125568805 1.131683967 
##        6_61        6_62        6_63        6_64        6_65        6_66 
## 1.159047951 1.168366324 1.172272536 1.209004401 1.232151096 1.243293519 
##        6_67        6_68        6_69        6_70        6_71        6_72 
## 1.281484337 1.291793399 1.296319915 1.317898806 1.358992495 1.385614768 
##        6_73        6_74        6_75        6_76        6_77        6_78 
## 1.465175584 1.471478053 1.480967720 1.482444455 1.484813789 1.511853543 
##        6_79        6_80        6_81        6_82        6_83        6_84 
## 1.565174750 1.586995750 1.618487361 1.622761058 1.624464268 1.634322014 
##        6_85        6_86        6_87        6_88        6_89        6_90 
## 1.664253569 1.671066758 1.707913714 1.733309097 1.740317535 1.773979274 
##        6_91        6_92        6_93        6_94        6_95        6_96 
## 1.784512509 1.805802267 1.831139623 1.853990687 1.868673880 1.883045835 
##        6_97        6_98        6_99       6_100 
## 1.917127983 1.923337618 1.943550390 1.950290081 
## 
## $`7`
##          7_1          7_2          7_3          7_4          7_5          7_6 
## 0.0000000000 0.0005422876 0.0117822111 0.0133531147 0.0164341515 0.0265387544 
##          7_7          7_8          7_9         7_10         7_11         7_12 
## 0.1341687364 0.1651588336 0.1816793216 0.1887061132 0.2035638932 0.2485284329 
##         7_13         7_14         7_15         7_16         7_17         7_18 
## 0.2641050765 0.2755917734 0.2949744615 0.3531681782 0.3572436245 0.3942317671 
##         7_19         7_20         7_21         7_22         7_23         7_24 
## 0.3962966048 0.4073923156 0.4573715866 0.5104274337 0.5295903487 0.5427403536 
##         7_25         7_26         7_27         7_28         7_29         7_30 
## 0.5652577312 0.6346802423 0.6500344896 0.6525062573 0.6563917645 0.7249827388 
##         7_31         7_32         7_33         7_34         7_35         7_36 
## 0.7614955721 0.7917109510 0.7979813695 0.8461831184 0.8481017067 0.8505767062 
##         7_37         7_38         7_39         7_40         7_41         7_42 
## 0.8711392206 0.8932173171 0.8968489877 0.9000682767 0.9423437028 0.9464327017 
##         7_43         7_44         7_45         7_46         7_47         7_48 
## 0.9546537188 0.9750633544 0.9800968739 0.9937155560 0.9965640340 1.0078631789 
##         7_49         7_50         7_51         7_52         7_53         7_54 
## 1.0414284859 1.0670726739 1.1023044944 1.1254266165 1.1364547470 1.1689978513 
##         7_55         7_56         7_57         7_58         7_59         7_60 
## 1.1968225853 1.2089359158 1.2152802296 1.2369859280 1.2456063551 1.3206972594 
##         7_61         7_62         7_63         7_64         7_65         7_66 
## 1.3320049404 1.3351019833 1.3556346558 1.3900861468 1.4046912257 1.4087675441 
##         7_67         7_68         7_69         7_70         7_71         7_72 
## 1.4244232889 1.4476603878 1.4754127442 1.4763411783 1.4975718855 1.5426197459 
##         7_73         7_74         7_75         7_76         7_77         7_78 
## 1.5435789294 1.5489565350 1.5986713769 1.6294509078 1.6459788962 1.6491884252 
##         7_79         7_80         7_81         7_82         7_83         7_84 
## 1.6616037851 1.6671236360 1.6747943231 1.6797204006 1.6800555505 1.6839434059 
##         7_85         7_86         7_87         7_88         7_89         7_90 
## 1.6882218123 1.7444391054 1.7473757771 1.7481635210 1.7617682957 1.7678913533 
##         7_91         7_92         7_93         7_94         7_95         7_96 
## 1.7785406707 1.8135507210 1.8817499108 1.9000510386 1.9001997663 1.9073124136 
##         7_97         7_98         7_99        7_100 
## 1.9212633100 1.9253642397 1.9381823012 1.9652826890 
## 
## $`8`
##          8_1          8_2          8_3          8_4          8_5          8_6 
## 0.0000000000 0.0009105238 0.0086836680 0.0132159332 0.0223699763 0.0639591469 
##          8_7          8_8          8_9         8_10         8_11         8_12 
## 0.0786201658 0.1779539469 0.2805343394 0.2951564169 0.2993682821 0.3101526360 
##         8_13         8_14         8_15         8_16         8_17         8_18 
## 0.3632449283 0.3701478863 0.3892659095 0.4340518733 0.4397641736 0.4689725897 
##         8_19         8_20         8_21         8_22         8_23         8_24 
## 0.5111552106 0.5112979222 0.5443681476 0.5778889557 0.5829499974 0.6038367951 
##         8_25         8_26         8_27         8_28         8_29         8_30 
## 0.6103232835 0.6127955605 0.6168336219 0.6268650760 0.6724292115 0.7106021175 
##         8_31         8_32         8_33         8_34         8_35         8_36 
## 0.7307338380 0.7425289938 0.7721897112 0.7914249630 0.8290322324 0.8439722066 
##         8_37         8_38         8_39         8_40         8_41         8_42 
## 0.8481378703 0.8534128532 0.8790847404 0.8826264190 0.9507693438 0.9556690443 
##         8_43         8_44         8_45         8_46         8_47         8_48 
## 0.9645002671 0.9859159654 0.9862069192 1.0089490559 1.0510233895 1.0599552449 
##         8_49         8_50         8_51         8_52         8_53         8_54 
## 1.0857821586 1.1471842469 1.1873109275 1.1985990544 1.2034666353 1.2779473874 
##         8_55         8_56         8_57         8_58         8_59         8_60 
## 1.2783760608 1.2885837458 1.2895453576 1.2921350194 1.2999015455 1.3067864158 
##         8_61         8_62         8_63         8_64         8_65         8_66 
## 1.3091653030 1.3290934108 1.3441552812 1.3443500820 1.3531886466 1.3928797515 
##         8_67         8_68         8_69         8_70         8_71         8_72 
## 1.4066595930 1.4234660423 1.4270281707 1.4582153348 1.4645786681 1.4646261111 
##         8_73         8_74         8_75         8_76         8_77         8_78 
## 1.4772435967 1.4826301980 1.4872746648 1.5085300838 1.5285275034 1.5497637571 
##         8_79         8_80         8_81         8_82         8_83         8_84 
## 1.5700424353 1.6168305730 1.6289798583 1.6477839026 1.6794950518 1.7030224079 
##         8_85         8_86         8_87         8_88         8_89         8_90 
## 1.7234327842 1.7494494851 1.7590021143 1.7658868948 1.7688398033 1.7767332780 
##         8_91         8_92         8_93         8_94         8_95         8_96 
## 1.7888143450 1.7937355780 1.8097990983 1.8149202127 1.8273897849 1.8753803392 
##         8_97         8_98         8_99        8_100 
## 1.8998974787 1.9365915025 1.9707966605 1.9882375176 
## 
## $`9`
##         9_1         9_2         9_3         9_4         9_5         9_6 
## 0.000000000 0.008641172 0.011780800 0.027316989 0.041224334 0.047080456 
##         9_7         9_8         9_9        9_10        9_11        9_12 
## 0.064111663 0.088436142 0.106835640 0.112063086 0.124270289 0.136752766 
##        9_13        9_14        9_15        9_16        9_17        9_18 
## 0.163848670 0.244677310 0.263521727 0.266294096 0.277572470 0.314312636 
##        9_19        9_20        9_21        9_22        9_23        9_24 
## 0.319021494 0.343017264 0.343984858 0.353434839 0.366866684 0.399141640 
##        9_25        9_26        9_27        9_28        9_29        9_30 
## 0.401677532 0.426044809 0.426317020 0.454949434 0.458466331 0.459039310 
##        9_31        9_32        9_33        9_34        9_35        9_36 
## 0.463643572 0.522033895 0.539906949 0.569607160 0.622095816 0.631271435 
##        9_37        9_38        9_39        9_40        9_41        9_42 
## 0.633695590 0.635907139 0.660205754 0.672102603 0.679002665 0.692507331 
##        9_43        9_44        9_45        9_46        9_47        9_48 
## 0.717289704 0.717353911 0.757576987 0.758465397 0.762776176 0.766654967 
##        9_49        9_50        9_51        9_52        9_53        9_54 
## 0.794401438 0.795882248 0.796908107 0.806266850 0.847261772 0.902421155 
##        9_55        9_56        9_57        9_58        9_59        9_60 
## 0.923341409 0.932382873 0.959998126 0.974736050 1.044368408 1.101017392 
##        9_61        9_62        9_63        9_64        9_65        9_66 
## 1.102665077 1.107309902 1.127958082 1.159372757 1.181008238 1.188297305 
##        9_67        9_68        9_69        9_70        9_71        9_72 
## 1.249469987 1.258378306 1.258620303 1.268507814 1.279390670 1.279470800 
##        9_73        9_74        9_75        9_76        9_77        9_78 
## 1.307444887 1.345041389 1.355097370 1.424554032 1.436146516 1.447932508 
##        9_79        9_80        9_81        9_82        9_83        9_84 
## 1.476899759 1.566798691 1.574997801 1.581078611 1.581965309 1.606131007 
##        9_85        9_86        9_87        9_88        9_89        9_90 
## 1.611094736 1.619654063 1.647182227 1.650609081 1.679877141 1.695844389 
##        9_91        9_92        9_93        9_94        9_95        9_96 
## 1.716349022 1.722723036 1.725001246 1.794967914 1.825615623 1.827172248 
##        9_97        9_98        9_99       9_100 
## 1.845783931 1.902507457 1.924233999 1.928909419 
## 
## $`10`
##       10_1       10_2       10_3       10_4       10_5       10_6       10_7 
## 0.00000000 0.04051040 0.05305527 0.07036126 0.08005613 0.09978904 0.14848792 
##       10_8       10_9      10_10      10_11      10_12      10_13      10_14 
## 0.15909171 0.17379883 0.18235065 0.18835338 0.18889364 0.19459487 0.19996552 
##      10_15      10_16      10_17      10_18      10_19      10_20      10_21 
## 0.25234204 0.26588560 0.27956593 0.28099513 0.28842629 0.32121105 0.38087387 
##      10_22      10_23      10_24      10_25      10_26      10_27      10_28 
## 0.39128348 0.42313911 0.46864897 0.47719503 0.48119718 0.52540550 0.52721867 
##      10_29      10_30      10_31      10_32      10_33      10_34      10_35 
## 0.53614268 0.54901132 0.57887730 0.59259779 0.63841347 0.64008952 0.64251569 
##      10_36      10_37      10_38      10_39      10_40      10_41      10_42 
## 0.66478562 0.67829932 0.68562064 0.70224621 0.70300815 0.76762815 0.82066785 
##      10_43      10_44      10_45      10_46      10_47      10_48      10_49 
## 0.82909924 0.83676158 0.84383646 0.87726047 0.88110908 0.88169313 0.90302308 
##      10_50      10_51      10_52      10_53      10_54      10_55      10_56 
## 0.91662696 0.94752270 0.95040725 0.97699586 0.99366649 1.00709229 1.01751598 
##      10_57      10_58      10_59      10_60      10_61      10_62      10_63 
## 1.02537125 1.06040119 1.06718095 1.08611978 1.08968990 1.12482703 1.12564088 
##      10_64      10_65      10_66      10_67      10_68      10_69      10_70 
## 1.20033294 1.20081933 1.23809331 1.26253214 1.27532539 1.29708509 1.32884297 
##      10_71      10_72      10_73      10_74      10_75      10_76      10_77 
## 1.33063019 1.39714529 1.42155808 1.44873163 1.46438888 1.49695210 1.50192341 
##      10_78      10_79      10_80      10_81      10_82      10_83      10_84 
## 1.50856972 1.57415481 1.57661416 1.57928693 1.61680897 1.62094804 1.63119732 
##      10_85      10_86      10_87      10_88      10_89      10_90      10_91 
## 1.64872988 1.69857714 1.72806667 1.72933450 1.73085496 1.74780146 1.75238789 
##      10_92      10_93      10_94      10_95      10_96      10_97      10_98 
## 1.76861927 1.77029394 1.80639399 1.81811218 1.82888668 1.85476772 1.90823417 
##      10_99     10_100 
## 1.92924885 1.93949142

When we choose the species in the argument species, four parameters are automatically adjusted:

# Genome length (i.e. Soybean)
genLen = 1.15 #Gb

# Effective population size (Ne)
Ne = 50

# Demographic bottlenecks
speciesParams = "8E8 -t 4E-7 -r 3.6E-7"

# Species history
speciesHist = "-eN 0.03 1 -eN 0.05 2 -eN 0.10 4 -eN 0.15 6"

Obs: runMacs() functions offers four target species with their demography already implemented in the package. Other than that, we can use runMacs2() function to set our own species characteristics (further discussed).

Trait characteristics

With the founder genomes in perspective, we can proceed to add the characteristics of the target trait or traits to the simulation. AlphaSimR has a vignette that we recommend you take a look at link. It gives, thoroughly, an explanation on the traits of interest and how to interpret its effects.

Single trait

Additive trait

We will start with a trait with only additive effects. For such, we have the following parameters:

# Global simulation parameters from founder genomes.
SP = SimParam$new(founderGenomes)

# Additive trait
SP$addTraitA(nQtlPerChr = 15, # Number of QTL per chromosome
             mean = 10, # Trait mean
             var = 10) # Trait variance


# QTL effects (for the traits)
SP$traits[[1]]@addEff
##   [1]  0.085565946 -0.437593711  0.203398614 -0.765935624 -0.032465806
##   [6]  0.044232110 -0.473991442  0.544934027  0.119530112 -0.529582836
##  [11] -0.022884257 -0.032665433  0.463425601  0.306441965 -0.597857746
##  [16]  0.089172636 -0.594680464 -0.289057561 -1.132172291  0.726862440
##  [21] -0.443075949 -0.461144414  0.552168175 -0.020827062  0.522046842
##  [26] -0.271751303 -0.488491217  0.614012446  0.190092664  0.613821052
##  [31] -0.251684523 -0.038784679  0.064384267 -0.348377377 -0.066404222
##  [36] -0.106181607  0.802525974  0.098876784 -0.550690863  0.368050133
##  [41]  0.392263954  0.194181205  0.000997263  0.765697273 -0.697251928
##  [46] -0.075129410 -0.476404145  0.279559984  0.014631521  0.444036629
##  [51] -0.198736165  0.282284217  0.059593793  0.345534932  0.410675627
##  [56]  0.113421759 -0.019799552  0.319209614  0.652818662 -0.173292126
##  [61] -0.305048432  0.268166932 -0.375904821  0.205511432 -0.393798529
##  [66] -0.719018698 -0.175972131 -0.611367498  0.295211059 -0.132458523
##  [71]  0.319610939  0.189503240 -0.418237422  0.031265120  0.478585516
##  [76]  0.542797551  0.128094071  0.675666650 -0.266860179 -0.360142214
##  [81]  0.171089204  0.411911604 -0.246958759 -0.249808741 -0.655187464
##  [86]  0.259031995 -0.275548182  0.985861993 -0.167418803  0.552554404
##  [91] -0.906867876 -0.729210088  0.834265758  0.250512213  0.285237244
##  [96] -0.494364824 -0.252733968 -0.138225223 -0.545484389 -0.763655225
## [101]  0.699225516  0.172230658  0.200142575 -0.720550657 -0.184802557
## [106] -0.128681837 -0.225803808 -0.248233156  0.443527370 -0.047819353
## [111]  0.505110753 -0.048570193  0.204505499  0.077362334  0.249524296
## [116]  0.627307116  0.257669585  0.296161206 -0.951309833  0.233852492
## [121]  0.511375231 -0.102660772 -0.112685449 -0.340946958  0.253392632
## [126] -0.280668491  0.842505754 -0.445981692 -0.230430235  0.642092669
## [131]  0.266243512  0.064713263 -0.009228176  0.136110239  0.316591631
## [136] -0.078515824 -0.305115080  0.874491147  0.336274870  0.177426467
## [141]  0.054279665 -0.738748878  0.324329287  0.434409559  0.067569063
## [146]  0.421375021  0.693381404  0.341151051  0.040458101  0.031176381
SP$traits[[1]]@lociLoc
##   [1]   5   7   9  12  31  38  41  51  53  60  68  69  80  82  94   3  17  21
##  [19]  25  32  42  43  44  46  51  53  61  71  79  81   1   7  18  22  23  30
##  [37]  46  47  49  53  54  67  85  89 100   4   5  17  26  30  31  32  48  51
##  [55]  64  81  83  84  86  89  12  15  19  26  32  34  47  53  55  59  60  70
##  [73]  85  88  90   8  13  25  39  46  49  54  55  59  70  83  93  96  97 100
##  [91]   2   6  11  18  24  54  59  64  73  74  85  89  95  96  99   1   7   8
## [109]  13  18  26  30  32  42  60  75  78  80  84  92   4   7  19  28  34  43
## [127]  48  50  59  65  68  70  75  79  98  12  14  18  29  37  41  43  48  54
## [145]  59  62  64  80  97  99

After simulating the base genome and to set the trait characteristics, we can create individuals from that base genome for the trait of interest. We will use the function newPop(), as follows:

# Creating individuals/population
basePop = newPop(founderGenomes)

# Gen param
genParam(basePop)
## $varA
##        Trait1
## Trait1     10
## 
## $varD
##        Trait1
## Trait1      0
## 
## $varAA
##        Trait1
## Trait1      0
## 
## $varG
##        Trait1
## Trait1     10
## 
## $genicVarA
##   Trait1 
## 9.321657 
## 
## $genicVarD
## Trait1 
##      0 
## 
## $genicVarAA
## Trait1 
##      0 
## 
## $genicVarG
##   Trait1 
## 9.321657 
## 
## $covA_HW
##    Trait1 
## -1.069452 
## 
## $covD_HW
## Trait1 
##      0 
## 
## $covAA_HW
## Trait1 
##      0 
## 
## $covG_HW
##    Trait1 
## -1.069452 
## 
## $covA_L
##   Trait1 
## 1.747795 
## 
## $covD_L
## Trait1 
##      0 
## 
## $covAA_L
## Trait1 
##      0 
## 
## $covAD_L
## Trait1 
##      0 
## 
## $covAAA_L
## Trait1 
##      0 
## 
## $covDAA_L
## Trait1 
##      0 
## 
## $covG_L
##   Trait1 
## 1.747795 
## 
## $mu
## Trait1 
##     10 
## 
## $mu_HW
## Trait1 
##     10 
## 
## $gv
##          Trait1
##  [1,] 11.191696
##  [2,]  6.479824
##  [3,] 10.939248
##  [4,]  4.902894
##  [5,] 11.704637
##  [6,]  5.649299
##  [7,]  8.950004
##  [8,] 13.425854
##  [9,] 14.333984
## [10,] 12.422558
## 
## $bv
##          Trait1
##  [1,]  1.191696
##  [2,] -3.520176
##  [3,]  0.939248
##  [4,] -5.097106
##  [5,]  1.704637
##  [6,] -4.350701
##  [7,] -1.049996
##  [8,]  3.425854
##  [9,]  4.333984
## [10,]  2.422558
## 
## $dd
##       Trait1
##  [1,]      0
##  [2,]      0
##  [3,]      0
##  [4,]      0
##  [5,]      0
##  [6,]      0
##  [7,]      0
##  [8,]      0
##  [9,]      0
## [10,]      0
## 
## $aa
##       Trait1
##  [1,]      0
##  [2,]      0
##  [3,]      0
##  [4,]      0
##  [5,]      0
##  [6,]      0
##  [7,]      0
##  [8,]      0
##  [9,]      0
## [10,]      0
## 
## $gv_mu
##   Trait1 
## 7.762035 
## 
## $gv_a
##          Trait1
##  [1,]  3.429661
##  [2,] -1.282211
##  [3,]  3.177213
##  [4,] -2.859141
##  [5,]  3.942602
##  [6,] -2.112736
##  [7,]  1.187969
##  [8,]  5.663819
##  [9,]  6.571949
## [10,]  4.660523
## 
## $gv_d
##       Trait1
##  [1,]      0
##  [2,]      0
##  [3,]      0
##  [4,]      0
##  [5,]      0
##  [6,]      0
##  [7,]      0
##  [8,]      0
##  [9,]      0
## [10,]      0
## 
## $gv_aa
##       Trait1
##  [1,]      0
##  [2,]      0
##  [3,]      0
##  [4,]      0
##  [5,]      0
##  [6,]      0
##  [7,]      0
##  [8,]      0
##  [9,]      0
## [10,]      0
# Looking at the population
# haplotypes
popHaplo = pullSegSiteHaplo(basePop)
popHaplo[, 1:10]
##      1_1 1_2 1_3 1_4 1_5 1_6 1_7 1_8 1_9 1_10
## 1_1    1   0   1   0   0   1   1   0   0    0
## 1_2    0   1   0   0   0   0   0   1   0    1
## 2_1    0   0   1   0   0   1   1   0   0    0
## 2_2    1   1   0   1   0   0   1   0   0    0
## 3_1    0   1   0   0   0   1   0   0   0    0
## 3_2    0   0   1   0   0   1   1   0   1    0
## 4_1    0   1   0   1   0   1   0   0   0    0
## 4_2    0   1   0   0   0   1   1   0   1    0
## 5_1    0   1   0   1   0   0   1   0   1    0
## 5_2    0   0   1   0   0   1   1   0   1    0
## 6_1    1   0   1   0   0   0   1   0   0    1
## 6_2    0   1   0   1   0   0   1   0   0    0
## 7_1    1   1   0   1   0   0   1   0   0    1
## 7_2    0   1   0   1   0   1   0   0   1    0
## 8_1    1   0   1   0   0   1   0   0   0    0
## 8_2    1   0   1   0   0   1   1   0   0    1
## 9_1    0   1   0   1   0   1   1   0   1    0
## 9_2    0   1   0   0   0   0   1   0   0    0
## 10_1   1   0   1   0   0   1   1   0   0    0
## 10_2   0   1   0   0   1   0   1   0   1    0
# Check the genotypes
popGeno = pullSegSiteGeno(basePop)
popGeno[, 1:10]
##    1_1 1_2 1_3 1_4 1_5 1_6 1_7 1_8 1_9 1_10
## 1    1   1   1   0   0   1   1   1   0    1
## 2    1   1   1   1   0   1   2   0   0    0
## 3    0   1   1   0   0   2   1   0   1    0
## 4    0   2   0   1   0   2   1   0   1    0
## 5    0   1   1   1   0   1   2   0   2    0
## 6    1   1   1   1   0   0   2   0   0    1
## 7    1   2   0   2   0   1   1   0   1    1
## 8    2   0   2   0   0   2   1   0   0    1
## 9    0   2   0   1   0   1   2   0   1    0
## 10   1   1   1   0   1   1   2   0   1    0

Allele frequency

Allele frequency describes the proportion of mutations at a locus and can be estimated from the haplotypes (popHaplo object).

# Allele frequency
alleleFreq = colMeans(popHaplo)

plot(alleleFreq)

Non-additive effects: Trait with additive and dominance effects

# Global simulation parameters from founder genomes.
SP = SimParam$new(founderGenomes)

# Additive trait
SP$addTraitAD(nQtlPerChr = 15, # Number of QTLs controlling the trait per chromosome
              # nQtlPerChr = c(15, 5), # Alternative: QTL effect by chromosome
              mean = 10,
              var = 10,
              meanDD = 0.1, # dominance degree - it varies from 0-1 (meaning no-dominance and codominance)
              varDD = 0.2) # Variance for the degree of dominance

# QTL effects for additive effects
SP$traits[[1]]@addEff
##   [1]  0.780247707 -0.487353940 -1.269906012 -1.247051299 -0.091761574
##   [6]  0.016169526  0.173178212  0.101523270  0.397094053  0.100332951
##  [11]  0.384119011  0.638624110 -0.019663702  0.301857468  0.137373422
##  [16] -0.466677625 -0.092614135  0.592090521  0.017921355 -0.398389099
##  [21] -0.586636164  1.000756946  0.616929715 -0.305046386  1.096198731
##  [26]  1.350829459  0.104904596  1.000304763 -1.163159220 -0.281195582
##  [31] -0.804928657  0.022754169 -0.087130664 -1.037365222  0.896845586
##  [36] -0.520856804 -0.739784095 -0.248129122  0.072579396 -0.025582275
##  [41] -1.211977842  0.007393246  0.298610274 -0.886251259 -0.551403603
##  [46]  0.072123697  0.238040265  1.380606701  0.273832163 -1.102504053
##  [51] -0.576032632  0.152240353 -0.453234155  0.234427949  0.534416476
##  [56]  0.036658791 -1.493351563 -0.421085550 -0.662326823 -0.086441506
##  [61] -1.170767932 -1.576099996 -0.737600911 -1.253461589  0.158816988
##  [66]  0.032846948  0.422011837  0.217867587 -0.816754632  0.800623540
##  [71] -0.789661210  0.358829573  0.738363608 -0.222951733  0.057174988
##  [76] -0.390316767 -1.667055002 -0.380218481 -0.947630240 -0.891229503
##  [81]  0.422954621 -0.015042713 -0.710260401  0.609043438  0.377300540
##  [86] -0.018065644 -0.575593845 -0.266469383  0.052644821  0.466636177
##  [91]  0.566396558  0.547807710 -0.459149470 -1.286182699 -0.723823170
##  [96]  0.661168962  0.192130177 -0.465964987  0.190600821  0.426614256
## [101]  0.190210466  0.156338546 -0.872564890  0.017843902 -0.184812679
## [106]  0.271078204 -0.345839164 -0.017273015 -0.371467191  0.313561358
## [111]  0.169723095 -0.844400040 -1.109410339  0.478950223  0.403918351
## [116] -0.303570271 -0.891425680 -0.105031953 -0.551836634  1.272935118
## [121] -0.572124950 -1.791143010 -0.489568804  2.093681189 -0.786161152
## [126]  0.603276356 -2.093276363 -0.450421559 -0.144041305 -0.840477612
## [131] -0.420219277 -0.270175012 -0.901040642  1.129621204 -0.178913038
## [136]  0.112990912 -0.024300719  0.045314340 -0.142011046  0.700562633
## [141] -0.620216026  0.422033774 -0.722370969 -0.572991831 -0.343346060
## [146]  1.741171667  0.171582304 -0.284523491 -0.148360424 -0.679703969
# QTL effects for dominance effects
SP$traits[[1]]@domEff
##   [1]  0.047639035  0.016254900  1.181561166 -0.416166407 -0.031928687
##   [6] -0.013858072  0.035124053 -0.040796749  0.057186296  0.003448641
##  [11]  0.004035300 -0.443363169 -0.008013378 -0.090494433  0.045421450
##  [16]  0.243038148 -0.095987437  0.081275749 -0.008572046 -0.111449185
##  [21] -0.129754765 -0.090282567 -0.376269648  0.255386957 -0.453239651
##  [26]  0.321909357  0.035592163 -0.401475139  0.560430954  0.051147076
##  [31]  0.343639605  0.007781657  0.073663669 -0.294975764 -0.180983596
##  [36] -0.269489323 -0.284546148 -0.134149895 -0.004476229  0.020436090
##  [41]  0.123039736  0.003239567 -0.036258436  0.767782278 -0.169264244
##  [46] -0.059277814  0.004967971  0.188372672 -0.091958476  0.598651435
##  [51]  0.439159827  0.146019088  0.232309211  0.040446095  0.165686816
##  [56]  0.003406726 -0.154512427 -0.058619047  0.160020183 -0.013991377
##  [61]  0.849471492  0.795918738 -0.080137216  0.085989027  0.046445714
##  [66]  0.007794452  0.338758666 -0.068364527 -0.251119620  0.028846377
##  [71] -0.106491268  0.083481233 -0.133946972  0.051516088  0.004881393
##  [76]  0.166808487 -0.081045175  0.204332069  0.778376863 -0.110171342
##  [81]  0.057751770 -0.003616832 -0.485160409  0.498333035 -0.195638242
##  [86]  0.017027778 -0.024922204 -0.064339284 -0.023448470  0.120825884
##  [91] -0.397564542 -0.499314669 -0.328624365  0.997063605  0.168369215
##  [96]  0.118323698  0.132396649 -0.047506411 -0.019464603 -0.286125284
## [101] -0.120118391 -0.105562807  0.573272405 -0.002324469 -0.035613788
## [106]  0.139463299  0.233265139  0.011146124 -0.229300715  0.030543535
## [111]  0.086583862  0.186401233  0.074273123  0.427488403  0.041393429
## [116] -0.135358676  0.610959799  0.009200015 -0.129708213  0.116261562
## [121] -0.005277494 -0.198139051  0.163003026  1.208433509  0.198359495
## [126] -0.256344955  0.986646393 -0.048936909  0.108401325  0.232356772
## [131]  0.328828032 -0.212588911 -0.018137022  0.006078439  0.027008828
## [136]  0.035478605  0.005172285  0.009565332  0.046914505 -0.010446415
## [141] -0.043787964 -0.110442409 -0.167216554  0.485567690  0.104465161
## [146]  0.148811163  0.081916413  0.104149284 -0.037432931  0.021733648

The implementation of traits in AlphaSimR follows a biological model, which is responsible for converting into a genetic value each individual genotype before created. In a straightforward way, the genetic value is used to create the individuals’ phenotypes. The biological effects presented in AlphaSimR are:

A: additive effect
D: dominance effect
G: genotype by environment interaction effect
E: environmental effect

So, we can create traits with the combinations of those effects (assuming that all of them as, at least, additive) using the ADGE framework, as it follows:

# Traits that can be created in AlphaSimR:
SP$addTraitA()
SP$addTraitAD()
SP$addTraitADG()
SP$addTraitADEG()
SP$addTraitAG()
SP$addTraitAE()
SP$addTraitAEG()

It is important to have in mind that for dominance effects (D) we set the mean of the dominance degree (0-1) and variance, whereas for genotype by environment effect (G) and environmental effect (E) we have just to adjust the variance.

Multi-trait framework

The AlphaSimR package allows to simulate a set of traits for the individuals. For such, two strategies may be used.

The first strategy is to set all traits at once (using $addTrait). In this option, a correlation matrix between each pair of traits, for each effect, should be added, as follows:

rm(list=ls())
# Founder genome
founderGenomes = AlphaSimR::quickHaplo(nInd = 3, # LD, p=q=0.5, haplotypes from 0,1.
                         nChr = 3, 
                         segSites = 100) 

# From the base population
SP = SimParam$new(founderGenomes)

# Alternative one - Setting the correlation between traits (Additive trait)
SP$addTraitA(nQtlPerChr = 20,
             mean = c(0, 10),
             var = c(0.5, 2),
             corA = matrix(c(1.0, 0.5,
                             0.5, 1.0), nrow = 2))


# QTL effects for trait one
SP$traits[[1]]@addEff
##  [1]  0.2290251069  0.2441651222  0.3029507664  0.3077077461 -0.2972007612
##  [6]  0.5173174254  0.2508114831 -0.2007550496  0.0457774633  0.1905144136
## [11]  0.1466971199  0.1916791879  0.1188953808 -0.0955399642  0.0939311457
## [16]  0.1444396536 -0.2117420477 -0.2145416350 -0.4601159079  0.1549942832
## [21]  0.5817058591 -0.1107348664  0.0638352879 -0.0872512301 -0.0904934525
## [26] -0.3789265715 -0.3715813493 -0.2668805669  0.1418988183 -0.2702105328
## [31]  0.1271771921 -0.2237840918  0.0085073276 -0.2088390327 -0.1883229842
## [36]  0.1348169503 -0.2781722211  0.0470201019  0.0577347300 -0.1468260158
## [41]  0.0967544412 -0.0008380173  0.0270439441  0.1765114366 -0.2010104777
## [46]  0.0868925834  0.1816365692 -0.1884773228 -0.0941057927 -0.2356188465
## [51] -0.0332832184  0.1004036229  0.0742151686 -0.2044750533  0.1501508308
## [56]  0.1089308092 -0.1387989256  0.4798144083  0.2881120628  0.2872272680
# QTL effects for trait two
SP$traits[[2]]@addEff
##  [1] -0.034815372 -0.031756648  0.033999906  0.785947336 -0.146362306
##  [6] -0.133358572  0.285649151 -0.153070063 -0.110048907 -0.417160812
## [11]  0.348114170  0.010502804  0.326338202 -0.479021971 -0.074231811
## [16]  0.403896146 -0.277967623 -0.398587988 -0.825472352  0.836460164
## [21]  0.342178719 -0.346725813 -0.003337369  0.035384180  0.073644914
## [26] -1.011656060  0.186072877 -0.411544304  0.115894375 -0.041581654
## [31]  0.065793762  0.107345411  0.157368712 -0.319349576  0.047018515
## [36] -0.008459182 -0.470528513  0.289086746 -0.105934830 -0.022827164
## [41]  0.392217921 -0.137367713 -0.150171033 -0.300671270 -0.228526801
## [46]  0.194717214  0.339439314 -0.312254829  0.165703012 -0.193181400
## [51]  0.185216263  0.004676330 -0.025210059 -0.850662717  0.643995431
## [56]  0.459467610 -0.717636845  0.113203349  0.493948156  0.850083171

A second strategy in a multi-trait framework is to add each trait individually. In this case, we do not need to add the information of correlation between them. Another positive aspect of this second strategy is the possibility of setting a different number of QTLs controlling each trait simulated.

# From the base population
SP = SimParam$new(founderGenomes)

# Alternative two - One trait at a time

# Trait one
SP$addTraitA(nQtlPerChr = 20,
             mean = 0,
             var = 0.5)

# Trait two
SP$addTraitA(nQtlPerChr = 5,
             mean = 100,
             var = 20)

# QTL effects for trait one
SP$traits[[1]]@addEff
##  [1] -0.32770099 -0.07223123 -0.42208626 -0.05465270 -0.01272842  0.73556171
##  [7]  0.09970047 -0.73730769 -0.22961957 -0.08753253  0.15112800 -0.15160323
## [13] -0.07291887  0.59192188 -0.20349971  0.67519737  0.09815017 -0.18705538
## [19]  0.10506299 -0.17366900 -0.02899719  0.15228530 -0.57771983 -0.09313978
## [25]  0.09134781  0.31440722  0.34588836  0.57655633  0.28074450  0.05297949
## [31]  0.23159002  0.04240052  0.02602039  0.30204222  0.21752080 -0.37891815
## [37]  0.29685021 -0.52981112 -0.28456329  0.02856641  0.95158188  0.03593571
## [43] -0.04098482 -0.44223218 -0.12280024  0.41138331 -0.32340035  0.79130579
## [49]  0.57229674  0.20561058  0.12645046  0.36799576  0.10128746 -0.12259787
## [55]  0.91029927 -0.03982485 -0.29831049 -0.42644228  0.20993957 -0.52476795
# QTL effects for trait two
SP$traits[[2]]@addEff
##  [1] -1.09411493 -0.43592529 -0.07113493  0.59293637  1.47692874 -0.50789459
##  [7] -0.73739642 -1.64366392 -2.35271610  1.04388016  0.35536704  0.89803573
## [13]  0.05229721 -0.73050826  1.66183979

Split argument

In breeding programs, such as maize, heterosis is harnessed by exploiting the crosses between heterotic groups. Usually, two distinct groups are used (i.e., maize dent and flint germplasm pools). The genetic divergence of these two pools is explained by their historic geographical separation and adaptation to different environments. It has undergone changes in the population structure and history of the base population.

For simulations that involve population separation in terms of generations, the AlphaSimR package offers the split argument in the runMacs() function. It represents an optional historic population split in terms of generations ago.

Below, we will simulate three different base genomes. The first one will use the default value (NULL) for the split argument. The second and third genomes will be split 10 and 50 generations ago, respectively. We will examine the base genome genotypes and explore them through a principal component analysis (PCA).

rm(list=ls())
#------------------- Founder genome with no split
founderGenomes = runMacs(nInd = 200,
                         nChr = 5, 
                         segSites = 100, 
                         species = "MAIZE",
                         ploidy = 2,
                         split = NULL) 

# From the base population
SP = SimParam$new(founderGenomes)

# Creating individuals/population
basePop = newPop(founderGenomes)

# Check the genotypes
popGeno = pullSegSiteGeno(basePop)

# PCA
pca_noSplit = prcomp(popGeno)

#------------------- Founder genome with split equals to 10
founderGenomes = runMacs(nInd = 200,
                         nChr = 5, 
                         segSites = 100, 
                         species = "MAIZE",
                         ploidy = 2,
                         split = 10) 

# From the base population
SP = SimParam$new(founderGenomes)

# Creating individuals/population
basePop = newPop(founderGenomes)

# Check the genotypes
popGeno_10 = pullSegSiteGeno(basePop)

# PCA
pca_Split10 = prcomp(popGeno_10)


#------------------- Founder genome with split equals to 50
founderGenomes = runMacs(nInd = 200,
                         nChr = 5, 
                         segSites = 100, 
                         species = "MAIZE",
                         ploidy = 2,
                         split = 50) 

# From the base population
SP = SimParam$new(founderGenomes)

# Creating individuals/population
basePop = newPop(founderGenomes)

# Check the genotypes
popGeno_50 = pullSegSiteGeno(basePop)

# PCA
pca_Split50 = prcomp(popGeno_50)

Plotting the PCA from each base population created.

# Plotting the PCA
library(ggfortify) 
## Warning: package 'ggfortify' was built under R version 4.3.3
## Carregando pacotes exigidos: ggplot2
## Warning: package 'ggplot2' was built under R version 4.3.3
# Plot
par(mar = c(1, 3, .1, .1))
autoplot(pca_noSplit, data = popGeno)
autoplot(pca_Split10, data = popGeno_10)
autoplot(pca_Split50, data = popGeno_50)

References

Chen, Gary K, Paul Marjoram, and Jeffrey D Wall. 2009. “Fast and Flexible Simulation of DNA Sequence Data.” Genome Research 19 (1): 136–42.
Gaynor, R Chris, Gregor Gorjanc, and John M Hickey. 2021. “AlphaSimR: An r Package for Breeding Program Simulations.” G3 11 (2): jkaa017.

  1. Post doc, University of Florida, ↩︎