Skip to contents

This function simulates genotype data (SNPs) for a specified number of individuals, partitioned into control and case groups. It randomly selects a set of associated SNPs that affect the phenotype and applies a random genetic model.

Usage

simulate_synthetic_genotype(
  n_snps,
  n_individuals,
  n_causal_snps,
  maf_min = 0.01,
  maf_max = 0.5
)

Arguments

n_snps

Integer. Total number of SNPs to simulate.

n_individuals

Integer. Total number of individuals (must be even; half will be controls, half cases).

n_causal_snps

Integer. Number of SNPs associated with the phenotype.

maf_min

Numeric. Minimum minor allele frequency (default is 0.01).

maf_max

Numeric. Maximum minor allele frequency (default is 0.5).

Value

A list with three elements:

G

Genotype matrix (SNPs x individuals).

BIM

Data frame with SNP metadata.

FAM

Data frame with individual metadata including phenotype status.

Examples

if (FALSE) { # \dontrun{
  sim <- simulate_synthetic_genotype(n_snps = 100, n_individuals = 20, n_causal_snps = 5)
} # }