The sspredr can generate ETA objects as input for the BGLR::BGLR() function in two different ways:

  1. There is only one predictor (no imputation required.).
  2. There are two predictors, once spanning more genotypes than the other.

One predictor

library("sspredr")
library("dplyr")
library("purrr")

First, let's load some artificial SNP data that were generated by sampling homozygous recessive gametes (0) with frequency 0.3, heterozygous gametes (1) with frequency 0.05 and homozygous dominant gametes (2) with frequency 0.65 at random. The resulting SNP matrix contains values for maternal and paternal genotypes of 532 hybrids.

data("imp_snps")
dim(imp_snps)

Next, we'll load the vector with names of the hybrid progeny.

data("hybrid_nms")
head(hybrid_nms)
length(hybrid_nms)

Finally, we'll generate two ETA objects; one for the maternal genotypes and one for the paternal genotypes.

# paternal genotypes
mother_nms <- vapply(
  strsplit(hybrid_nms, split = "_"), FUN = "[[", 1, FUN.VALUE = character(1)
  )
mother_snps <- imp_snps[rownames(imp_snps) %in% mother_nms, ]

mother_eta <- complete_eta(
  x = mother_snps,
  geno = mother_nms,
  as_kernel = TRUE,
  is_pedigree = FALSE,
  bglr_model = "BRR"
  )
father_nms <- vapply(
  strsplit(hybrid_nms, split = "_"), FUN = "[[", 2, FUN.VALUE = character(1)
  )
father_snps <- imp_snps[rownames(imp_snps) %in% father_nms, ]

father_eta <- complete_eta(
  x = father_snps,
  geno = father_nms,
  as_kernel = TRUE,
  is_pedigree = FALSE,
  bglr_model = "BRR"
  )


mwesthues/sspredr documentation built on May 23, 2019, 10:56 a.m.