View source: R/pop_functions.R
| create_pop | R Documentation | 
Assembles genotype data and into a pop object.
create_pop(genome, geno, ignore.gen.model = FALSE)
genome | 
 An object of class   | 
geno | 
 Genotype data on a population to phenotype. If the genome type is 
  | 
ignore.gen.model | 
 Logical - should any gene model be ignored when creating the population? Use this to force a population without a gene model.  | 
A pop is similar to a cross object in qtl-package 
(see read.cross). The pop object stores information on the
genome, the genotypes at genetic markers, and phenotypes. The pop object is
meant to be a bit more flexible, without the pedigree or family structure required in
a cross object.
An object of class pop with genotype information for the individuals in
that population and the genotypic value of those individuals.
The genotypic value of individuals is calculcated as the sum of the QTL effects
carried by each individual. The genetic variance is calculated as the variance
of these genotypic values (V_G = var(g)).
## Not run: 
# Use data from the PopVar package
library(PopVar)
data("think_barley")
# Format the map correctly and simulate a genome
map_in <- map.in_ex[,-1]
row.names(map_in) <- map.in_ex$mkr
genome <- sim_genome(map = table_to_map(map_in))
genos <- apply(X = G.in_ex[-1,-1], MARGIN = 2, FUN = as.numeric)
dimnames(genos) <- list(as.character(G.in_ex$V1[-1]), as.character(unlist(G.in_ex[1,-1])))
# Impute with the rounded mean
genos1 <- apply(X = genos, MARGIN = 2, FUN = function(snp) {
  mean <- ifelse(mean(snp, na.rm = T) < 0, -1, 1)
  snp[is.na(snp)] <- mean
  return(snp) })
## Create a population without a genetic model
pop <- create_pop(genome = genome, geno = genos1 + 1, ignore.gen.model = T)
## Create a genetic model with 15 QTL
qtl.model <- matrix(NA, ncol = 4, nrow = 15)
genome <- sim_gen_model(genome = genome, qtl.model = qtl.model, add.dist = "geometric")
pop <- create_pop(genome = genome, geno = genos1 + 1)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.