You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#' Generate Cis-QTL Data with Multiple Genetic Architecture Components
170
-
#'
171
-
#' This function generates simulated cis-eQTL data with a partitioned
172
-
#' genetic architecture that enforces strict effect size hierarchies:
173
-
#' |sparse| > |oligogenic| >> |infinitesimal|
174
+
#' Generate eQTL Data with Multiple Genetic Architecture Components
174
175
#'
175
-
#' Originally developed for the "susieR 2.0" manuscript, McCreight et al (2025).
176
+
#' This function generates simulated gene expression data
176
177
#'
177
-
#' @param G Genotype matrix.
178
+
#' @param G Standardized genotype matrix (samples x SNPs).
178
179
#' @param h2g Total SNP heritability (proportion of variance explained by genotyped SNPs).
179
180
#' @param prop_h2_sparse Proportion of h2g explained by sparse effects.
180
181
#' @param prop_h2_oligogenic Proportion of h2g explained by oligogenic effects.
181
182
#' @param prop_h2_infinitesimal Proportion of h2g explained by infinitesimal effects.
182
183
#' @param n_sparse Number of sparse SNPs.
183
184
#' @param n_oligogenic Number of oligogenic SNPs to simulate.
185
+
#' @param n_inf Number of infinitesimal SNPs to simulate. If NULL (default), all remaining SNPs after sparse and oligogenic selection receive infinitesimal effects.
184
186
#' @param mixture_props Mixture proportions for oligogenic effects (must sum to 1). Default c(0.75, 0.25) means 75% smaller effects, 25% larger effects.
185
187
#' @param sparse_sd Standard deviation for drawing sparse effects (default 0.5).
186
188
#' @param oligo_sds Standard deviations for oligogenic mixture components (default c(0.05, 0.15)).
187
189
#' @param inf_sd Standard deviation for drawing infinitesimal effects (default 0.01).
188
190
#' @param standardize Logical; if TRUE, the genotype matrix will be standardized.
189
-
#' @param independent Logical; if TRUE, ensures all sparse and oligogenic SNPs have |r| < 0.15 with each other (default FALSE).
190
-
#' @param verbose Logical; if TRUE, prints progress messages including LD constraint attempts (default FALSE).
191
+
#' @param independent Logical; if TRUE, ensures all sparse and oligogenic SNPs have |r| < ld_threshold with each other (default TRUE).
192
+
#' @param ld_threshold Numeric; maximum allowed absolute correlation between causal variants when independent = TRUE (default 0.15).
193
+
#' @param max_attempts Integer; maximum number of attempts to find SNPs satisfying LD constraints (default 200).
191
194
#' @param seed Optional seed for reproducibility.
192
195
#' @return A list containing the standardized genotype matrix, simulated phenotype,
193
196
#' combined beta values, indices for each effect component, realized heritability estimates,
194
197
#' effect size ranges, hierarchy validation results, and causal indices.
195
198
#' @export
196
199
generate_cis_qtl_data<-function(G,
197
-
h2g=0.30,
200
+
h2g=0.25,
198
201
prop_h2_sparse=0.50,
199
-
prop_h2_oligogenic=0.15,
200
-
prop_h2_infinitesimal=0.35,
202
+
prop_h2_oligogenic=0.35,
203
+
prop_h2_infinitesimal=0.15,
201
204
n_sparse=2,
202
-
n_oligogenic=10,
205
+
n_oligogenic=5,
206
+
n_inf=15,
203
207
mixture_props= c(0.75, 0.25),
204
208
sparse_sd=0.5,
205
209
oligo_sds= c(0.05, 0.15),
206
210
inf_sd=0.01,
207
211
standardize=TRUE,
208
212
independent=TRUE,
209
-
verbose=FALSE,
213
+
ld_threshold=0.15,
214
+
max_attempts=200,
210
215
seed=NULL) {
211
216
# Input validation
212
217
if (abs(prop_h2_sparse+prop_h2_oligogenic+prop_h2_infinitesimal-1) >1e-6) {
0 commit comments