Learn R Programming

MoBPS (version 1.13.1)

creating.diploid: Generation of the starting population

Description

Generation of the starting population

Usage

creating.diploid(
  population = NULL,
  nsnp = 0,
  nindi = 0,
  nqtl = 0,
  name.cohort = NULL,
  generation = 1,
  founder.pool = 1,
  one.sex.mode = FALSE,
  database.sex.mode = FALSE,
  sex.s = "fixed",
  sex.quota = 0.5,
  class = 0L,
  verbose = TRUE,
  map = NULL,
  chr.nr = NULL,
  chromosome.length = NULL,
  bp = NULL,
  snps.equidistant = NULL,
  template.chip = NULL,
  snp.position = NULL,
  change.order = TRUE,
  add.chromosome = FALSE,
  bpcm.conversion = 0,
  snp.name = NULL,
  hom0 = NULL,
  hom1 = NULL,
  dataset = NULL,
  freq = "beta",
  beta.shape1 = 1,
  beta.shape2 = 1,
  share.genotyped = 0,
  genotyped.s = NULL,
  vcf = NULL,
  vcf.maxsnp = Inf,
  vcf.maxindi = Inf,
  vcf.chromosomes = NULL,
  vcf.VA = TRUE,
  trait.name = NULL,
  mean.target = NULL,
  var.target = NULL,
  qtl.position.shared = FALSE,
  trait.cor = NULL,
  trait.cor.include = NULL,
  n.additive = 0,
  n.equal.additive = 0,
  n.dominant = 0,
  n.equal.dominant = 0,
  n.overdominant = 0,
  n.equal.overdominant = 0,
  n.qualitative = 0,
  n.quantitative = 0,
  effect.distribution = "gauss",
  gamma.shape1 = 1,
  gamma.shape2 = 1,
  real.bv.add = NULL,
  real.bv.mult = NULL,
  real.bv.dice = NULL,
  new.residual.correlation = NULL,
  new.breeding.correlation = NULL,
  litter.effect.covariance = NULL,
  pen.effect.covariance = NULL,
  is.maternal = NULL,
  is.paternal = NULL,
  fixed.effects = NULL,
  trait.pool = 0,
  gxe.correlation = NULL,
  n.locations = NULL,
  gxe.max = 0.85,
  gxe.min = 0.7,
  location.name = NULL,
  gxe.combine = TRUE,
  n.traits = 0,
  base.bv = NULL,
  dominant.only.positive = FALSE,
  exclude.snps = NULL,
  var.additive.l = NULL,
  var.dominant.l = NULL,
  var.overdominant.l = NULL,
  var.qualitative.l = NULL,
  var.quantitative.l = NULL,
  effect.size.equal.add = 1,
  effect.size.equal.dom = 1,
  effect.size.equal.over = 1,
  polygenic.variance = 100,
  bve.mult.factor = NULL,
  bve.poly.factor = NULL,
  set.zero = FALSE,
  bv.standard = FALSE,
  replace.real.bv = FALSE,
  bv.ignore.traits = NULL,
  remove.invalid.qtl = TRUE,
  randomSeed = NULL,
  add.architecture = NULL,
  time.point = 0,
  creating.type = 0,
  size.scaling = 1,
  progress.bar = TRUE,
  miraculix = TRUE,
  miraculix.dataset = TRUE,
  add.chromosome.ends = TRUE,
  use.recalculate.manual = FALSE,
  store.comp.times = TRUE,
  skip.rest = FALSE,
  enter.bv = TRUE,
  internal = FALSE,
  internal.geno = TRUE,
  internal.dataset = NULL,
  nbits = 30,
  bit.storing = FALSE,
  new.phenotype.correlation = NULL,
  length.before = 5,
  length.behind = 5,
  position.scaling = FALSE,
  shuffle.cor = NULL,
  shuffle.traits = NULL,
  bv.total = 0
)

Value

Population-list

Arguments

population

Population list

nsnp

Number of markers to generate (Split equally across chromosomes (chr.nr) unless vector is used)

nindi

Number of individuals to generate (you can also provide number males / females in a vector)

nqtl

Number of QTLs to generate (this will be a subset of the generated SNPs; default: NULL; all SNPs are potential QTLs)

name.cohort

Name of the newly added cohort

generation

Generation to which newly individuals are added (default: 1)

founder.pool

Founder pool an individual is assign to (default: 1)

one.sex.mode

Activating this will ignore all sex specific parameters and handle each individual as part of the first sex (default: FALSE)

database.sex.mode

Set TRUE to automatically remove females in selection.m and remove males in selection.f

sex.s

Specify which newly added individuals are male (1) or female (2)

sex.quota

Share of newly added female individuals (deterministic if sex.s="fixed", alt: sex.s="random")

class

Migration level of the newly added individuals (default: 0)

verbose

Set to FALSE to not display any prints

map

map-file that contains up to 5 colums (chromosome, SNP-id, M-position, Bp-position, allele freq - Everything not provides it set to NA). A map can be imported via MoBPSmaps::ensembl.map()

chr.nr

Number of chromosomes (SNPs are equally split) or vector containing the associated chromosome for each marker

chromosome.length

Length of the newly added chromosome in Morgan; can be a vector when generating multiple chromosomes (default: 5)

bp

Vector containing the physical position (bp) for each marker (default: 1,2,3...)

snps.equidistant

Use equidistant markers (computationally faster! ; default: TRUE)

template.chip

Import genetic map and chip from a species ("cattle", "chicken", "pig")

snp.position

Location of each marker on the genetic map

change.order

Markers are automatically sorted according to their snp.position unless this is set to FALSE (default: TRUE)

add.chromosome

If TRUE add an additional chromosome to the population

bpcm.conversion

Convert physical position (bp) into a cM position (default: 0 - not done)

snp.name

Vector containing the name of each marker (default ChrXSNPY - XY chosen accordingly)

hom0

Vector containing the first allelic variant in each marker (default: 0)

hom1

Vector containing the second allelic variant in each marker (default: 1)

dataset

SNP dataset, use "random", "allhetero" "all0" when generating a dataset via nsnp,nindi

freq

frequency of allele 1 when randomly generating a dataset (default: "beta" with parameters beta.shape1, beta.shape2; Use "same" when generating additional individuals and using the same allele frequencies)

beta.shape1

First parameter of the beta distribution for simulating allele frequencies

beta.shape2

Second parameter of the beta distribution for simulating allele frequencies

share.genotyped

Share of individuals genotyped in the founders

genotyped.s

Specify with newly added individuals are genotyped (1) or not (0)

vcf

Path to a vcf-file used as input genotypes (correct haplotype phase is assumed!)

vcf.maxsnp

Maximum number of SNPs to include in the genotype file (default: Inf)

vcf.maxindi

Maximum number of individuals to include in the genotype file (default: Inf)

vcf.chromosomes

Vector of chromosomes to import from vcf. Use on bgziped and tabixed vcf only. (default: NULL - all chromosomes)

vcf.VA

Use the VariantAnnotation package to load in a vcf file when available (default: TRUE)

trait.name

Name of the traits generated

mean.target

Target mean for each trait

var.target

Target variance for each trait

qtl.position.shared

Set to TRUE to put QTL effects on the same markers for different traits

trait.cor

Target correlation between QTL-based traits (underlying true genomic values)

trait.cor.include

Vector of traits to be included in the modelling of correlated traits (default: all - needs to match with trait.cor)

n.additive

Number of additive QTL with effect size drawn from a gaussian distribution

n.equal.additive

Number of additive QTL with equal effect size (effect.size)

n.dominant

Number of dominant QTL with effect size drawn from a gaussian distribution

n.equal.dominant

Number of dominant QTL with equal effect size

n.overdominant

Number of overdominant QTL with effect size drawn from absolute value of a gaussian distribution

n.equal.overdominant

Number of overdominant QTL with equal effect size

n.qualitative

Number of qualitative epistatic QTL

n.quantitative

Number of quantitative epistatic QTL

effect.distribution

Set to "gamma" for gamma distribution effects with gamma.shape1, gamma.shape2 instead of gaussian (default: "gauss")

gamma.shape1

Default: 1

gamma.shape2

Default: 1

real.bv.add

Single Marker effects (list for each trait with columns for: SNP Nr, Chr Nr, Effect 00, Effect 01, Effect 11, Position (optional), Founder pool genotype (optional), Founder pool origin (optional))

real.bv.mult

Two Marker effects

real.bv.dice

Multi-marker effects

new.residual.correlation

Correlation of the simulated enviromental variance

new.breeding.correlation

Correlation of the simulated genetic variance (child share! heritage is not influenced!

litter.effect.covariance

Covariance matrix of the litter effect (default: no effects)

pen.effect.covariance

Covariance matrix of the pen effect (default: no effects)

is.maternal

Vector coding if a trait is caused by a maternal effect (Default: FALSE)

is.paternal

Vector coding if a trait is caused by a paternal effect (Default: FALSE)

fixed.effects

Matrix containing fixed effects (p x k -matrix with p being the number of traits and k being number of fixed effects; default: not fixed effects (NULL))

trait.pool

Vector providing information for which pools QTLs of which trait are activ (default: 0 - all pools)

gxe.correlation

Correlation matrix between locations / environments (default: only one location, sampled from gxe.max / gxe.min)

n.locations

Number of locations / environments to consider for the GxE model

gxe.max

Maximum correlation between locations / environments when generating correlation matrix via sampling (default: 0.85)

gxe.min

Minimum correlation between locations / environments when generating correlation matrix via sampling (default: 0.70)

location.name

Same of the different locations / environments used

gxe.combine

Set to FALSE to not view the same trait from different locations / environments as the sample trait in the prediction model (default: TRUE)

n.traits

Number of traits (If more than traits via real.bv.X use traits with no directly underlying QTL)

base.bv

Intercept of underlying true genomic values (excluding all QTL effects, default: 100)

dominant.only.positive

Set to TRUE to always assign the heterozygous variant with the higher of the two homozygous effects (e.g. hybrid breeding); default: FALSE

exclude.snps

Vector contain markers on which no QTL effects are placed

var.additive.l

Variance of additive QTL

var.dominant.l

Variance of dominante QTL

var.overdominant.l

Variance of overdominante QTL

var.qualitative.l

Variance of qualitative epistatic QTL

var.quantitative.l

Variance of quantitative epistatic QTL

effect.size.equal.add

Effect size of the QTLs in n.equal.additive

effect.size.equal.dom

Effect size of the QTLs in n.equal.dominant

effect.size.equal.over

Effect size of the QTLs in n.equal.overdominant

polygenic.variance

Genetic variance of traits with no underlying QTL

bve.mult.factor

Multiplicate trait value times this

bve.poly.factor

Potency trait value over this

set.zero

Set to TRUE to have no effect on the 0 genotype (or 00 for QTLs with 2 underlying SNPs)

bv.standard

Set TRUE to standardize trait mean and variance via bv.standardization() - automatically set to TRUE when mean/var.target are used

replace.real.bv

If TRUE delete the simulated traits added before

bv.ignore.traits

Vector of traits to ignore in the calculation of the genomic value (default: NULL; Only recommended for high number of traits and experienced users!)

remove.invalid.qtl

Set to FALSE to deactive the automatic removal of QTLs on markers that do not exist

randomSeed

Set random seed of the process

add.architecture

Add genetic architecture (marker positions)

time.point

Time point at which the new individuals are generated

creating.type

Technique to generate new individuals (usage in web-based application)

size.scaling

Set to value to scale all input for breeding.size / selection.size (This will not work for all breeding programs / less general than json.simulation)

progress.bar

Set to FALSE to not use progress bars in any application of breeding.diploid() downstream (Keep log-files lean!)

miraculix

If TRUE use miraculix package for data storage, computations and dataset generation

miraculix.dataset

Set FALSE to deactivate miraculix package for dataset generation

add.chromosome.ends

Add chromosome ends as recombination points

use.recalculate.manual

Set to TRUE to use recalculate.manual to calculate genomic values (all individuals and traits jointly, default: FALSE)

store.comp.times

Set to FALSE to not store computing times needed to execute creating.diploid in $info$comp.times.creating

skip.rest

Internal variable needed when adding multiple chromosomes jointly

enter.bv

Internal parameter

internal

Do not touch!

internal.geno

Do not touch!

internal.dataset

Do not touch!

nbits

Bits available in MoBPS-bit-storing

bit.storing

Set to TRUE if the MoBPS (not-miraculix! bit-storing is used)

new.phenotype.correlation

(OLD! - use new.residual.correlation) Correlation of the simulated enviromental variance

length.before

Length before the first SNP of the dataset (default: 5)

length.behind

Length after the last SNP of the dataset (default: 5)

position.scaling

Manual scaling of snp.position

shuffle.cor

OLD! Use trait.cor - Target Correlation between traits

shuffle.traits

OLD! Use trait.cor.include - Vector of traits to be included for modelling of correlated traits (default: all - needs to match with shuffle.cor)

bv.total

OLD! Use n.traits instead. Number of traits (If more than traits via real.bv.X use traits with no directly underlying QTL)

Examples

Run this code
population <- creating.diploid(nsnp=1000, nindi=100)

Run the code above in your browser using DataLab