View source: R/replicate_data.R
replicate_real_snps | R Documentation |
This function simulates SNPs from real SNP data based on their sample minor allele frequencies and correlation structure.
replicate_real_snps(
n,
real_snps,
bl_lgth,
p = NULL,
maf_thres = NULL,
n_cpus = 1,
user_seed = NULL
)
n |
Number of observations. |
real_snps |
Matrix of real SNPs (rows observations, columns SNP variables), without missing values. The entries must be 0, 1 or 2. |
bl_lgth |
Number of variables per block for reproducing the dependence structure of real SNPs. Must be between 2 and p. Must be small enough (e.g. 1000) for tractability reasons. |
p |
Number of SNPs. If |
maf_thres |
Lower bound for sample minor allele frequencies. Simulated
SNPs with lower sample minor allele frequencies are excluded (as a result
the number of simulated SNPs can be smaller than p). Default is |
n_cpus |
Number of CPUs used when simulating SNP by blocks. Set to 1 for serial execution. |
user_seed |
Seed set for reproducibility. Default is |
An object of class "sim_snps
".
snps |
Matrix containing the generated SNP data. |
vec_maf |
Vector containing the SNP sample minor allele frequencies. |
convert_snps
, generate_snps
,
convert_phenos
, generate_phenos
,
replicate_real_phenos
, generate_dependence
user_seed <- 123; set.seed(user_seed)
n <- 500; p <- 7500
cor_type <- "autocorrelated"; vec_rho <- runif(100, min = 0.25, max = 0.95)
list_fake_real_snps <- generate_snps(n, p, cor_type, vec_rho, n_cpus = 1,
user_seed = user_seed)
list_snps <- replicate_real_snps(n, list_fake_real_snps$snps, bl_lgth = 100,
n_cpus = 1, user_seed = user_seed)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.