Description Arguments Value Author(s) References Examples
View source: R/SIMULATE_DAT_GEN.R
Simulate trio dataset for the analysis of VT-SEM
CV.INFO |
Information of causal variants, must be 2 columned data frame. Column 1: Minor allele frequencies (MAF) of causal variants, Column 2: Effect sizes of causal variants |
H2.TO |
Initial heritability |
NUM.GENERATIONS |
Number of generations |
POP.SIZE |
Population sizes |
MATE.COR |
Assortative mating correlation : If there is no AM, MATE.COR=0 |
AVOID.INB |
Bullean which indicates whether avoiding inbreeding or not (default if FALSE) |
SAVE.EACH.GEN |
Bullean which indicates whether saving whole dataset from initial generation to current generation or only current generation. |
SAVE.COVS |
Bulean which indicates saving covariances of random variables or not. |
SEED |
Set seed value. |
VF.T0,PROP.H2.LATENT |
Initial variance induced by vertical transmission |
Unequal_AM |
Bulean which indicates using disequilibrium AM assumption or not. |
SUMMARY.RES |
Summary the simulation results from first generation to last. |
XO |
Generated genotype dataset of observed polygenic genetic scores (Additive coding) |
XL |
Generated genotype dataset of latent polygenic genetic scores (Additive coding) |
PHEN |
Generated phenotype dataset |
HISTORY |
Generated dataset which includes whole generation |
COVARIANCES |
Covariance matrices of phenotype dataset for each generation |
Yongkang Kim yongkangkim87@gmail.com, Jared Balbona, and Matthew C Keller
Tahmasbi, Rasool, and Matthew C. Keller. "GeneEvolve: a fast and memory efficient forward-time simulator of realistic whole-genome sequence and SNP data." Bioinformatics 33.2 (2017): 294-296.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | num.cvs <- 100 #The number of causal variants
am <- 0.25 # assortative mating parameter, mu
herit0 <- 0.5 #Inital heritability
vf0 <- 0.15 #Initial variance of vertical transmitted environment factor
######ve0=1-vf0-herit0, so herit0+vf0 must be less than 1
Unequal_AM=TRUE # TRUE: Generating disequilibrium AM dataset, FALSE: Generating equilibrium AM dataset
prop.h2.latent <- 0.5 #Proportion of heritability
seed <- 1234567
max.cores <- 1 ##Number of used cores for OpenMx
num.gen <- 20 #Number of generating generation
pop.size <- 1000 #The number of independent trio dataset
num.its <- 1000
RUN.MARKERS <- FALSE #whether to only consider GRMs built from CVs (FALSE) or both CVs and SNPs (TRUE)
avoid.inb <- FALSE
save.covariances <- TRUE
save.history <- TRUE
#AM Simulation wildcards
MIN.MAF <- .1
MAX.MAF <- .50
#CVs and their effect sizes
MAF.VECTOR <- runif(num.cvs,MIN.MAF,MAX.MAF) #Can change the distribution of MAFs here
GENTP.VAR <- MAF.VECTOR*(1-MAF.VECTOR)*2
#ALPHA.VECTOR <- rnorm(CVS,0,sqrt(1/(CVS*GENTP.VAR))) #Can change the distribution of effect sizes here - random effects
ALPHA.VECTOR <- sample(c(-1,1),num.cvs,replace=TRUE)*sqrt(1/(num.cvs*GENTP.VAR)) #Can change the distribution of effect sizes here - fixed f'n of MAF
CV.INFO <- data.frame(MAF=MAF.VECTOR,alpha=ALPHA.VECTOR) #we'll use this for both the observed and latent
AM.DATA <- AM.SIMULATE(CV.INFO=CV.INFO, H2.T0=herit0, NUM.GENERATIONS=num.gen, POP.SIZE=pop.size*3, MATE.COR=am, AVOID.INB=avoid.inb, SAVE.EACH.GEN=save.history, SAVE.COVS=save.covariances, SEED=seed, VF.T0=vf0,PROP.H2.LATENT=prop.h2.latent,Unequal_AM=Unequal_AM) #Dataset generation
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.