## Minimal example with small simulated data (alleles encoded as A/C/G/T)
set.seed(1)
## Number of individuals and markers
n_ind <- 200
n_mark <- 50
## Construct a simple GEN matrix:
## first two columns: chromosome and position
## each individual is represented by two allele columns (A1/A2)
chr <- rep(1, n_mark)
pos <- seq_len(n_mark) * 100
alleles <- c("A", "C", "G", "T")
geno <- matrix(NA_character_, nrow = n_mark, ncol = 2 * n_ind)
for (m in seq_len(n_mark)) {
a <- sample(alleles, 2, replace = FALSE) # biallelic per marker
geno[m, ] <- sample(a, 2 * n_ind, replace = TRUE)
}
colnames(geno) <- as.vector(rbind(
paste0("id", seq_len(n_ind), "_A1"),
paste0("id", seq_len(n_ind), "_A2")
))
GEN <- cbind(chr, pos, geno)
## Phenotype + intercept as fixed effect
y <- rnorm(n_ind)
X <- cbind(1, rnorm(n_ind)) # intercept + one covariate
YFIX <- cbind(y, X)
## Simple kinship: identity matrix
KIN <- list(diag(n_ind))
## Run SEL.HAP with a small initial window and mild threshold
res <- SEL.HAP(GEN, YFIX, KIN,
nHap = 2,
p.threshold = 0.05,
PAR = NULL)
## Inspect the structure of the result (three matrices)
str(res)
Run the code above in your browser using DataLab