pop.predict2: Predict genetic variance and genetic correlations using a...

View source: R/pop_predict2.R

pop.predict2R Documentation

Predict genetic variance and genetic correlations using a deterministic model

Description

Predict genetic variance and genetic correlations using a deterministic model

Predict genetic variance and genetic correlations using a deterministic model

Usage

pop.predict2(
  G.in,
  y.in,
  map.in,
  crossing.table,
  parents,
  tail.p = 0.1,
  self.gen = Inf,
  DH = FALSE,
  model = c("rrBLUP", "BayesC")
)

pop_predict2(
  M,
  y.in,
  marker.effects,
  map.in,
  crossing.table,
  tail.p = 0.1,
  self.gen = Inf,
  DH = FALSE,
  model = c("rrBLUP", "BayesC"),
  n.core = 1
)

Arguments

G.in

See G.in in pop.predict.

y.in

A data frame of phenotypic means. The first column should include the entry name and subsequent columns should include phenotypic values. Ignored if marker.effects is passed.

map.in

See map.in in pop.predict.

crossing.table

See crossing.table in pop.predict.

parents

See parents in pop.predict.

tail.p

See tail.p in pop.predict.

self.gen

The number of selfing generations in the potential cross. Can be an integer or Inf for recombinant inbreds. Note: self.gen = 1 corresponds to an F2 population.

DH

Indicator if doubled-haploids are to be induced after the number of selfing generations indicated by self.gen. For example, if self.gen = 0 and DH = TRUE, then doubled-haploids are asssumed to be induced using gametes from F1 plants.

model

See models in pop.predict. Only 1 model is allowed.

M

A Matrix of marker genotypes of dimensions nLine x nMarker, coded as -1, 0, and 1.

marker.effects

A data frame of marker effects. The first column should include the marker name and subsequent columns should include the marker effects.

n.core

Number of cores for parallelization; only works on a Linux or Mac OS operating system.

Functions

  • pop_predict2():

Examples


# Load data
data("phenos")
data("genos")
data("map")

# Create 10, 2-way parent combinations
crosses <- as.data.frame(
   matrix(data = sample(row.names(genos), 20), nrow = 10, byrow = TRUE,
          dimnames = list(NULL, paste0("parent", 1:2))),
   stringsAsFactors = FALSE)

# Format the genotype data
G_in <- as.data.frame(cbind( c("", row.names(genos)), rbind(colnames(genos), genos)) )

# Run predictions
pred_out <- pop.predict2(G.in = G_in, y.in = phenos, map.in = map,
                         crossing.table = crosses)



# Load data
data("phenos")
data("genos")
data("map")

# Create 10, 2-way parent combinations
crosses <- as.data.frame(
   matrix(data = sample(row.names(genos), 20), nrow = 10, byrow = TRUE,
          dimnames = list(NULL, paste0("parent", 1:2))),
   stringsAsFactors = FALSE)

# Run predictions
pred_out <- pop_predict2(M = genos, y.in = phenos, map.in = map,
                         crossing.table = crosses)


## Pass marker effects instead of phenotypes
# First calculate marker effects
phenos2 <- as.matrix(phenos[,-1]); row.names(phenos2) <- phenos[,1]
phenos2 <- phenos2[row.names(genos),]

mar_eff <- apply(X = phenos2, MARGIN = 2, FUN = function(y) mixed.solve(y = y, Z = genos)$u)
marker_effects <- data.frame(marker = row.names(mar_eff), mar_eff, stringsAsFactors = FALSE)

pred_out <- pop_predict2(M = genos, marker.effects = marker_effects, map.in = map,
                         crossing.table = crosses, self.gen = 6)




neyhartj/gws documentation built on Feb. 5, 2024, 12:42 a.m.