... | ... |
@@ -48,7 +48,9 @@ |
48 | 48 |
#' @param exposure.risk.levels An integer vector of the hypothesized risk levels corresponding to the elements of \code{case.genetic.data.list}. |
49 | 49 |
#' See argument \code{categorical.exposures.risk.ranks} of \code{preprocess.genetic.data} for more information. |
50 | 50 |
#' @param exposure An integer vector corresponding to environmental exposures of the cases. |
51 |
-#' @return For each island in the cluster, an rds object containing a list with the following elements will be written to \code{results.dir}: |
|
51 |
+#' @return For each island in the cluster, an rds object containing a list with the following elements will be written to \code{results.dir}. |
|
52 |
+#' @param use.parents A logical indicating whether parent data should be used in computing the fitness score. Defaults to false. This should only be set to true |
|
53 |
+#' if the population is homogenous with no exposure related population structure. |
|
52 | 54 |
#' \describe{ |
53 | 55 |
#' \item{top.chromosome.results}{A data.table of the final generation chromosomes, their fitness scores, their difference vectors, |
54 | 56 |
#' and the number of risk alleles required for each chromosome SNP for a case or complement to be classified as having the provisional risk set. |
... | ... |
@@ -87,14 +89,14 @@ GADGETS <- function(cluster.number, results.dir, case.genetic.data, complement.g |
87 | 89 |
chromosome.size, snp.chisq, weight.lookup, island.cluster.size = 4, n.migrations = 20, n.different.snps.weight = 2, |
88 | 90 |
n.both.one.weight = 1, migration.interval = 50, gen.same.fitness = 50, max.generations = 500, |
89 | 91 |
initial.sample.duplicates = FALSE, crossover.prop = 0.8, recessive.ref.prop = 0.75, |
90 |
- recode.test.stat = 1.64, exposure.levels = NULL, exposure.risk.levels = NULL, exposure = NULL) { |
|
92 |
+ recode.test.stat = 1.64, exposure.levels = NULL, exposure.risk.levels = NULL, exposure = NULL, use.parents = FALSE) { |
|
91 | 93 |
|
92 | 94 |
### run rcpp version of GADGETS ## |
93 | 95 |
rcpp.res <- run_GADGETS(island.cluster.size, n.migrations, ld.block.vec, n.chromosomes, chromosome.size, |
94 | 96 |
weight.lookup, snp.chisq, case.genetic.data, complement.genetic.data, |
95 | 97 |
exposure.levels, exposure.risk.levels, exposure, n.different.snps.weight, n.both.one.weight, |
96 | 98 |
migration.interval, gen.same.fitness, max.generations, initial.sample.duplicates, |
97 |
- crossover.prop, recessive.ref.prop, recode.test.stat) |
|
99 |
+ crossover.prop, recessive.ref.prop, recode.test.stat, use.parents) |
|
98 | 100 |
|
99 | 101 |
### clean up and output results |
100 | 102 |
lapply(seq_along(rcpp.res), function(island.number){ |
... | ... |
@@ -113,28 +113,28 @@ chrom_fitness_score <- function(case_genetic_data_in, complement_genetic_data_in |
113 | 113 |
.Call('_epistasisGAGE_chrom_fitness_score', PACKAGE = 'epistasisGAGE', case_genetic_data_in, complement_genetic_data_in, target_snps_in, ld_block_vec, weight_lookup, n_different_snps_weight, n_both_one_weight, recessive_ref_prop, recode_test_stat, epi_test, GxE, both_one_snps_in) |
114 | 114 |
} |
115 | 115 |
|
116 |
-GxE_fitness_score <- function(case_genetic_data_list, complement_genetic_data_list, target_snps, ld_block_vec, weight_lookup, exposure_levels, exposure_risk_levels, n_different_snps_weight = 2L, n_both_one_weight = 1L, recessive_ref_prop = 0.75, recode_test_stat = 1.64, epi_test = FALSE, check_risk = TRUE) { |
|
117 |
- .Call('_epistasisGAGE_GxE_fitness_score', PACKAGE = 'epistasisGAGE', case_genetic_data_list, complement_genetic_data_list, target_snps, ld_block_vec, weight_lookup, exposure_levels, exposure_risk_levels, n_different_snps_weight, n_both_one_weight, recessive_ref_prop, recode_test_stat, epi_test, check_risk) |
|
116 |
+GxE_fitness_score <- function(case_genetic_data_list, complement_genetic_data_list, target_snps, ld_block_vec, weight_lookup, exposure_levels, exposure_risk_levels, n_different_snps_weight = 2L, n_both_one_weight = 1L, recessive_ref_prop = 0.75, recode_test_stat = 1.64, epi_test = FALSE, check_risk = TRUE, use_parents = FALSE) { |
|
117 |
+ .Call('_epistasisGAGE_GxE_fitness_score', PACKAGE = 'epistasisGAGE', case_genetic_data_list, complement_genetic_data_list, target_snps, ld_block_vec, weight_lookup, exposure_levels, exposure_risk_levels, n_different_snps_weight, n_both_one_weight, recessive_ref_prop, recode_test_stat, epi_test, check_risk, use_parents) |
|
118 | 118 |
} |
119 | 119 |
|
120 | 120 |
chrom_fitness_list <- function(case_genetic_data, complement_genetic_data, chromosome_list, ld_block_vec, weight_lookup, n_different_snps_weight = 2L, n_both_one_weight = 1L, recessive_ref_prop = 0.75, recode_test_stat = 1.64, epi_test = FALSE) { |
121 | 121 |
.Call('_epistasisGAGE_chrom_fitness_list', PACKAGE = 'epistasisGAGE', case_genetic_data, complement_genetic_data, chromosome_list, ld_block_vec, weight_lookup, n_different_snps_weight, n_both_one_weight, recessive_ref_prop, recode_test_stat, epi_test) |
122 | 122 |
} |
123 | 123 |
|
124 |
-GxE_fitness_list <- function(case_genetic_data_list, complement_genetic_data_list, chromosome_list, ld_block_vec, weight_lookup, exposure_levels, exposure_risk_levels, n_different_snps_weight = 2L, n_both_one_weight = 1L, recessive_ref_prop = 0.75, recode_test_stat = 1.64, epi_test = FALSE, check_risk = TRUE) { |
|
125 |
- .Call('_epistasisGAGE_GxE_fitness_list', PACKAGE = 'epistasisGAGE', case_genetic_data_list, complement_genetic_data_list, chromosome_list, ld_block_vec, weight_lookup, exposure_levels, exposure_risk_levels, n_different_snps_weight, n_both_one_weight, recessive_ref_prop, recode_test_stat, epi_test, check_risk) |
|
124 |
+GxE_fitness_list <- function(case_genetic_data_list, complement_genetic_data_list, chromosome_list, ld_block_vec, weight_lookup, exposure_levels, exposure_risk_levels, n_different_snps_weight = 2L, n_both_one_weight = 1L, recessive_ref_prop = 0.75, recode_test_stat = 1.64, epi_test = FALSE, check_risk = TRUE, use_parents = FALSE) { |
|
125 |
+ .Call('_epistasisGAGE_GxE_fitness_list', PACKAGE = 'epistasisGAGE', case_genetic_data_list, complement_genetic_data_list, chromosome_list, ld_block_vec, weight_lookup, exposure_levels, exposure_risk_levels, n_different_snps_weight, n_both_one_weight, recessive_ref_prop, recode_test_stat, epi_test, check_risk, use_parents) |
|
126 | 126 |
} |
127 | 127 |
|
128 |
-compute_population_fitness <- function(case_genetic_data, complement_genetic_data, ld_block_vec, chromosome_list, weight_lookup, case_genetic_data_list, complement_genetic_data_list, exposure_levels, exposure_risk_levels, n_different_snps_weight = 2L, n_both_one_weight = 1L, recessive_ref_prop = 0.75, recode_test_stat = 1.64, GxE = FALSE, check_risk = TRUE) { |
|
129 |
- .Call('_epistasisGAGE_compute_population_fitness', PACKAGE = 'epistasisGAGE', case_genetic_data, complement_genetic_data, ld_block_vec, chromosome_list, weight_lookup, case_genetic_data_list, complement_genetic_data_list, exposure_levels, exposure_risk_levels, n_different_snps_weight, n_both_one_weight, recessive_ref_prop, recode_test_stat, GxE, check_risk) |
|
128 |
+compute_population_fitness <- function(case_genetic_data, complement_genetic_data, ld_block_vec, chromosome_list, weight_lookup, case_genetic_data_list, complement_genetic_data_list, exposure_levels, exposure_risk_levels, n_different_snps_weight = 2L, n_both_one_weight = 1L, recessive_ref_prop = 0.75, recode_test_stat = 1.64, GxE = FALSE, check_risk = TRUE, use_parents = FALSE) { |
|
129 |
+ .Call('_epistasisGAGE_compute_population_fitness', PACKAGE = 'epistasisGAGE', case_genetic_data, complement_genetic_data, ld_block_vec, chromosome_list, weight_lookup, case_genetic_data_list, complement_genetic_data_list, exposure_levels, exposure_risk_levels, n_different_snps_weight, n_both_one_weight, recessive_ref_prop, recode_test_stat, GxE, check_risk, use_parents) |
|
130 | 130 |
} |
131 | 131 |
|
132 | 132 |
find_top_chrom <- function(fitness_scores, chromosome_list, chromosome_size) { |
133 | 133 |
.Call('_epistasisGAGE_find_top_chrom', PACKAGE = 'epistasisGAGE', fitness_scores, chromosome_list, chromosome_size) |
134 | 134 |
} |
135 | 135 |
|
136 |
-initiate_population <- function(n_candidate_snps, case_genetic_data, complement_genetic_data, ld_block_vec, n_chromosomes, chromosome_size, weight_lookup, case_genetic_data_list, complement_genetic_data_list, exposure_levels, exposure_risk_levels, n_different_snps_weight = 2L, n_both_one_weight = 1L, recessive_ref_prop = 0.75, recode_test_stat = 1.64, max_generations = 500L, initial_sample_duplicates = FALSE, GxE = FALSE, check_risk = TRUE) { |
|
137 |
- .Call('_epistasisGAGE_initiate_population', PACKAGE = 'epistasisGAGE', n_candidate_snps, case_genetic_data, complement_genetic_data, ld_block_vec, n_chromosomes, chromosome_size, weight_lookup, case_genetic_data_list, complement_genetic_data_list, exposure_levels, exposure_risk_levels, n_different_snps_weight, n_both_one_weight, recessive_ref_prop, recode_test_stat, max_generations, initial_sample_duplicates, GxE, check_risk) |
|
136 |
+initiate_population <- function(n_candidate_snps, case_genetic_data, complement_genetic_data, ld_block_vec, n_chromosomes, chromosome_size, weight_lookup, case_genetic_data_list, complement_genetic_data_list, exposure_levels, exposure_risk_levels, n_different_snps_weight = 2L, n_both_one_weight = 1L, recessive_ref_prop = 0.75, recode_test_stat = 1.64, max_generations = 500L, initial_sample_duplicates = FALSE, GxE = FALSE, check_risk = TRUE, use_parents = FALSE) { |
|
137 |
+ .Call('_epistasisGAGE_initiate_population', PACKAGE = 'epistasisGAGE', n_candidate_snps, case_genetic_data, complement_genetic_data, ld_block_vec, n_chromosomes, chromosome_size, weight_lookup, case_genetic_data_list, complement_genetic_data_list, exposure_levels, exposure_risk_levels, n_different_snps_weight, n_both_one_weight, recessive_ref_prop, recode_test_stat, max_generations, initial_sample_duplicates, GxE, check_risk, use_parents) |
|
138 | 138 |
} |
139 | 139 |
|
140 | 140 |
check_convergence <- function(island_cluster_size, island_populations) { |
... | ... |
@@ -145,8 +145,8 @@ check_max_gens <- function(island_populations, max_generations) { |
145 | 145 |
.Call('_epistasisGAGE_check_max_gens', PACKAGE = 'epistasisGAGE', island_populations, max_generations) |
146 | 146 |
} |
147 | 147 |
|
148 |
-run_GADGETS <- function(island_cluster_size, n_migrations, ld_block_vec, n_chromosomes, chromosome_size, weight_lookup, snp_chisq, case_genetic_data_in, complement_genetic_data_in, exposure_levels_in = NULL, exposure_risk_levels_in = NULL, exposure_in = NULL, n_different_snps_weight = 2L, n_both_one_weight = 1L, migration_interval = 50L, gen_same_fitness = 50L, max_generations = 500L, initial_sample_duplicates = FALSE, crossover_prop = 0.8, recessive_ref_prop = 0.75, recode_test_stat = 1.64) { |
|
149 |
- .Call('_epistasisGAGE_run_GADGETS', PACKAGE = 'epistasisGAGE', island_cluster_size, n_migrations, ld_block_vec, n_chromosomes, chromosome_size, weight_lookup, snp_chisq, case_genetic_data_in, complement_genetic_data_in, exposure_levels_in, exposure_risk_levels_in, exposure_in, n_different_snps_weight, n_both_one_weight, migration_interval, gen_same_fitness, max_generations, initial_sample_duplicates, crossover_prop, recessive_ref_prop, recode_test_stat) |
|
148 |
+run_GADGETS <- function(island_cluster_size, n_migrations, ld_block_vec, n_chromosomes, chromosome_size, weight_lookup, snp_chisq, case_genetic_data_in, complement_genetic_data_in, exposure_levels_in = NULL, exposure_risk_levels_in = NULL, exposure_in = NULL, n_different_snps_weight = 2L, n_both_one_weight = 1L, migration_interval = 50L, gen_same_fitness = 50L, max_generations = 500L, initial_sample_duplicates = FALSE, crossover_prop = 0.8, recessive_ref_prop = 0.75, recode_test_stat = 1.64, use_parents = FALSE) { |
|
149 |
+ .Call('_epistasisGAGE_run_GADGETS', PACKAGE = 'epistasisGAGE', island_cluster_size, n_migrations, ld_block_vec, n_chromosomes, chromosome_size, weight_lookup, snp_chisq, case_genetic_data_in, complement_genetic_data_in, exposure_levels_in, exposure_risk_levels_in, exposure_in, n_different_snps_weight, n_both_one_weight, migration_interval, gen_same_fitness, max_generations, initial_sample_duplicates, crossover_prop, recessive_ref_prop, recode_test_stat, use_parents) |
|
150 | 150 |
} |
151 | 151 |
|
152 | 152 |
epistasis_test_permute <- function(case_inf, comp_inf, target_snps_ld_blocks, uni_ld_blocks, n_families, weight_lookup, n_different_snps_weight = 2L, n_both_one_weight = 1L, recessive_ref_prop = 0.75, recode_test_stat = 1.64) { |
... | ... |
@@ -161,11 +161,11 @@ epistasis_test <- function(snp_cols, preprocessed_list, n_permutes = 10000L, n_d |
161 | 161 |
.Call('_epistasisGAGE_epistasis_test', PACKAGE = 'epistasisGAGE', snp_cols, preprocessed_list, n_permutes, n_different_snps_weight, n_both_one_weight, weight_function_int, recessive_ref_prop, recode_test_stat, warn) |
162 | 162 |
} |
163 | 163 |
|
164 |
-GxE_test <- function(snp_cols, preprocessed_list, n_permutes = 10000L, n_different_snps_weight = 2L, n_both_one_weight = 1L, weight_function_int = 2L, recessive_ref_prop = 0.75, recode_test_stat = 1.64) { |
|
165 |
- .Call('_epistasisGAGE_GxE_test', PACKAGE = 'epistasisGAGE', snp_cols, preprocessed_list, n_permutes, n_different_snps_weight, n_both_one_weight, weight_function_int, recessive_ref_prop, recode_test_stat) |
|
164 |
+GxE_test <- function(snp_cols, preprocessed_list, n_permutes = 10000L, n_different_snps_weight = 2L, n_both_one_weight = 1L, weight_function_int = 2L, recessive_ref_prop = 0.75, recode_test_stat = 1.64, use_parents = FALSE) { |
|
165 |
+ .Call('_epistasisGAGE_GxE_test', PACKAGE = 'epistasisGAGE', snp_cols, preprocessed_list, n_permutes, n_different_snps_weight, n_both_one_weight, weight_function_int, recessive_ref_prop, recode_test_stat, use_parents) |
|
166 | 166 |
} |
167 | 167 |
|
168 |
-n2log_epistasis_pvals <- function(chromosome_list, in_data_list, n_permutes = 10000L, n_different_snps_weight = 2L, n_both_one_weight = 1L, weight_function_int = 2L, recessive_ref_prop = 0.75, recode_test_stat = 1.64, GxE = FALSE) { |
|
169 |
- .Call('_epistasisGAGE_n2log_epistasis_pvals', PACKAGE = 'epistasisGAGE', chromosome_list, in_data_list, n_permutes, n_different_snps_weight, n_both_one_weight, weight_function_int, recessive_ref_prop, recode_test_stat, GxE) |
|
168 |
+n2log_epistasis_pvals <- function(chromosome_list, in_data_list, n_permutes = 10000L, n_different_snps_weight = 2L, n_both_one_weight = 1L, weight_function_int = 2L, recessive_ref_prop = 0.75, recode_test_stat = 1.64, GxE = FALSE, use_parents = FALSE) { |
|
169 |
+ .Call('_epistasisGAGE_n2log_epistasis_pvals', PACKAGE = 'epistasisGAGE', chromosome_list, in_data_list, n_permutes, n_different_snps_weight, n_both_one_weight, weight_function_int, recessive_ref_prop, recode_test_stat, GxE, use_parents) |
|
170 | 170 |
} |
171 | 171 |
|
... | ... |
@@ -50,6 +50,8 @@ |
50 | 50 |
#' to determine whether to recode the SNP as recessive. Defaults to 0.75. |
51 | 51 |
#' @param recode.test.stat For a given SNP, the minimum test statistic required to recode and recompute the fitness score using recessive coding. Defaults to 1.64. |
52 | 52 |
#' See the GADGETS paper for specific details. |
53 |
+#' @param use.parents A logical indicating whether parent data should be used in computing the fitness score. Defaults to false. This should only be set to true |
|
54 |
+#' if the population is homogenous with no exposure related population structure. |
|
53 | 55 |
#' @return For each island, a list of two elements will be written to \code{results.dir}: |
54 | 56 |
#' \describe{ |
55 | 57 |
#' \item{top.chromosome.results}{A data.table of the final generation chromosomes, their fitness scores, their difference vectors, |
... | ... |
@@ -89,7 +91,7 @@ run.gadgets <- function(data.list, n.chromosomes, chromosome.size, results.dir, |
89 | 91 |
n.chunks = NULL, n.different.snps.weight = 2, n.both.one.weight = 1, weight.function.int = 2, |
90 | 92 |
generations = 500, gen.same.fitness = 50, initial.sample.duplicates = FALSE, |
91 | 93 |
snp.sampling.type = "chisq", crossover.prop = 0.8, n.islands = 1000, island.cluster.size = 4, migration.generations = 50, |
92 |
- n.migrations = 20, recessive.ref.prop = 0.75, recode.test.stat = 1.64) { |
|
94 |
+ n.migrations = 20, recessive.ref.prop = 0.75, recode.test.stat = 1.64, use.parents = FALSE) { |
|
93 | 95 |
|
94 | 96 |
### make sure if island clusters exist, the migration interval is set properly ### |
95 | 97 |
if (island.cluster.size > 1 & migration.generations >= generations & island.cluster.size != 1) { |
... | ... |
@@ -249,7 +251,7 @@ run.gadgets <- function(data.list, n.chromosomes, chromosome.size, results.dir, |
249 | 251 |
n.both.one.weight = n.both.one.weight, migration.interval = migration.generations, gen.same.fitness = gen.same.fitness, |
250 | 252 |
max.generations = generations, initial.sample.duplicates = initial.sample.duplicates, crossover.prop = crossover.prop, |
251 | 253 |
recessive.ref.prop = recessive.ref.prop, recode.test.stat = recode.test.stat, exposure.levels = data.list$exposure.levels, |
252 |
- exposure.risk.levels = data.list$exposure.risk.levels, exposure = data.list$exposure), |
|
254 |
+ exposure.risk.levels = data.list$exposure.risk.levels, exposure = data.list$exposure, use.parents = use.parents), |
|
253 | 255 |
reg = registry) |
254 | 256 |
|
255 | 257 |
# chunk the jobs |
... | ... |
@@ -27,7 +27,8 @@ GADGETS( |
27 | 27 |
recode.test.stat = 1.64, |
28 | 28 |
exposure.levels = NULL, |
29 | 29 |
exposure.risk.levels = NULL, |
30 |
- exposure = NULL |
|
30 |
+ exposure = NULL, |
|
31 |
+ use.parents = FALSE |
|
31 | 32 |
) |
32 | 33 |
} |
33 | 34 |
\arguments{ |
... | ... |
@@ -98,15 +99,18 @@ from \code{exposure}.} |
98 | 99 |
See argument \code{categorical.exposures.risk.ranks} of \code{preprocess.genetic.data} for more information.} |
99 | 100 |
|
100 | 101 |
\item{exposure}{An integer vector corresponding to environmental exposures of the cases.} |
101 |
-} |
|
102 |
-\value{ |
|
103 |
-For each island in the cluster, an rds object containing a list with the following elements will be written to \code{results.dir}: |
|
102 |
+ |
|
103 |
+\item{use.parents}{A logical indicating whether parent data should be used in computing the fitness score. Defaults to false. This should only be set to true |
|
104 |
+if the population is homogenous with no exposure related population structure. |
|
104 | 105 |
\describe{ |
105 | 106 |
\item{top.chromosome.results}{A data.table of the final generation chromosomes, their fitness scores, their difference vectors, |
106 | 107 |
and the number of risk alleles required for each chromosome SNP for a case or complement to be classified as having the provisional risk set. |
107 | 108 |
See the package vignette for an example and the documentation for \code{chrom.fitness.score} for additional details.} |
108 | 109 |
\item{n.generations}{The total number of generations run.} |
110 |
+}} |
|
109 | 111 |
} |
112 |
+\value{ |
|
113 |
+For each island in the cluster, an rds object containing a list with the following elements will be written to \code{results.dir}. |
|
110 | 114 |
} |
111 | 115 |
\description{ |
112 | 116 |
This function runs the GADGETS method on a given cluster of islands. It is a wrapper for |
... | ... |
@@ -28,7 +28,8 @@ run.gadgets( |
28 | 28 |
migration.generations = 50, |
29 | 29 |
n.migrations = 20, |
30 | 30 |
recessive.ref.prop = 0.75, |
31 |
- recode.test.stat = 1.64 |
|
31 |
+ recode.test.stat = 1.64, |
|
32 |
+ use.parents = FALSE |
|
32 | 33 |
) |
33 | 34 |
} |
34 | 35 |
\arguments{ |
... | ... |
@@ -103,6 +104,9 @@ to determine whether to recode the SNP as recessive. Defaults to 0.75.} |
103 | 104 |
|
104 | 105 |
\item{recode.test.stat}{For a given SNP, the minimum test statistic required to recode and recompute the fitness score using recessive coding. Defaults to 1.64. |
105 | 106 |
See the GADGETS paper for specific details.} |
107 |
+ |
|
108 |
+\item{use.parents}{A logical indicating whether parent data should be used in computing the fitness score. Defaults to false. This should only be set to true |
|
109 |
+if the population is homogenous with no exposure related population structure.} |
|
106 | 110 |
} |
107 | 111 |
\value{ |
108 | 112 |
For each island, a list of two elements will be written to \code{results.dir}: |
... | ... |
@@ -384,8 +384,8 @@ BEGIN_RCPP |
384 | 384 |
END_RCPP |
385 | 385 |
} |
386 | 386 |
// GxE_fitness_score |
387 |
-List GxE_fitness_score(ListOf<IntegerMatrix> case_genetic_data_list, ListOf<IntegerMatrix> complement_genetic_data_list, IntegerVector target_snps, IntegerVector ld_block_vec, IntegerVector weight_lookup, IntegerVector exposure_levels, IntegerVector exposure_risk_levels, int n_different_snps_weight, int n_both_one_weight, double recessive_ref_prop, double recode_test_stat, bool epi_test, bool check_risk); |
|
388 |
-RcppExport SEXP _epistasisGAGE_GxE_fitness_score(SEXP case_genetic_data_listSEXP, SEXP complement_genetic_data_listSEXP, SEXP target_snpsSEXP, SEXP ld_block_vecSEXP, SEXP weight_lookupSEXP, SEXP exposure_levelsSEXP, SEXP exposure_risk_levelsSEXP, SEXP n_different_snps_weightSEXP, SEXP n_both_one_weightSEXP, SEXP recessive_ref_propSEXP, SEXP recode_test_statSEXP, SEXP epi_testSEXP, SEXP check_riskSEXP) { |
|
387 |
+List GxE_fitness_score(ListOf<IntegerMatrix> case_genetic_data_list, ListOf<IntegerMatrix> complement_genetic_data_list, IntegerVector target_snps, IntegerVector ld_block_vec, IntegerVector weight_lookup, IntegerVector exposure_levels, IntegerVector exposure_risk_levels, int n_different_snps_weight, int n_both_one_weight, double recessive_ref_prop, double recode_test_stat, bool epi_test, bool check_risk, bool use_parents); |
|
388 |
+RcppExport SEXP _epistasisGAGE_GxE_fitness_score(SEXP case_genetic_data_listSEXP, SEXP complement_genetic_data_listSEXP, SEXP target_snpsSEXP, SEXP ld_block_vecSEXP, SEXP weight_lookupSEXP, SEXP exposure_levelsSEXP, SEXP exposure_risk_levelsSEXP, SEXP n_different_snps_weightSEXP, SEXP n_both_one_weightSEXP, SEXP recessive_ref_propSEXP, SEXP recode_test_statSEXP, SEXP epi_testSEXP, SEXP check_riskSEXP, SEXP use_parentsSEXP) { |
|
389 | 389 |
BEGIN_RCPP |
390 | 390 |
Rcpp::RObject rcpp_result_gen; |
391 | 391 |
Rcpp::RNGScope rcpp_rngScope_gen; |
... | ... |
@@ -402,7 +402,8 @@ BEGIN_RCPP |
402 | 402 |
Rcpp::traits::input_parameter< double >::type recode_test_stat(recode_test_statSEXP); |
403 | 403 |
Rcpp::traits::input_parameter< bool >::type epi_test(epi_testSEXP); |
404 | 404 |
Rcpp::traits::input_parameter< bool >::type check_risk(check_riskSEXP); |
405 |
- rcpp_result_gen = Rcpp::wrap(GxE_fitness_score(case_genetic_data_list, complement_genetic_data_list, target_snps, ld_block_vec, weight_lookup, exposure_levels, exposure_risk_levels, n_different_snps_weight, n_both_one_weight, recessive_ref_prop, recode_test_stat, epi_test, check_risk)); |
|
405 |
+ Rcpp::traits::input_parameter< bool >::type use_parents(use_parentsSEXP); |
|
406 |
+ rcpp_result_gen = Rcpp::wrap(GxE_fitness_score(case_genetic_data_list, complement_genetic_data_list, target_snps, ld_block_vec, weight_lookup, exposure_levels, exposure_risk_levels, n_different_snps_weight, n_both_one_weight, recessive_ref_prop, recode_test_stat, epi_test, check_risk, use_parents)); |
|
406 | 407 |
return rcpp_result_gen; |
407 | 408 |
END_RCPP |
408 | 409 |
} |
... | ... |
@@ -427,8 +428,8 @@ BEGIN_RCPP |
427 | 428 |
END_RCPP |
428 | 429 |
} |
429 | 430 |
// GxE_fitness_list |
430 |
-List GxE_fitness_list(List case_genetic_data_list, List complement_genetic_data_list, List chromosome_list, IntegerVector ld_block_vec, IntegerVector weight_lookup, IntegerVector exposure_levels, IntegerVector exposure_risk_levels, int n_different_snps_weight, int n_both_one_weight, double recessive_ref_prop, double recode_test_stat, bool epi_test, bool check_risk); |
|
431 |
-RcppExport SEXP _epistasisGAGE_GxE_fitness_list(SEXP case_genetic_data_listSEXP, SEXP complement_genetic_data_listSEXP, SEXP chromosome_listSEXP, SEXP ld_block_vecSEXP, SEXP weight_lookupSEXP, SEXP exposure_levelsSEXP, SEXP exposure_risk_levelsSEXP, SEXP n_different_snps_weightSEXP, SEXP n_both_one_weightSEXP, SEXP recessive_ref_propSEXP, SEXP recode_test_statSEXP, SEXP epi_testSEXP, SEXP check_riskSEXP) { |
|
431 |
+List GxE_fitness_list(List case_genetic_data_list, List complement_genetic_data_list, List chromosome_list, IntegerVector ld_block_vec, IntegerVector weight_lookup, IntegerVector exposure_levels, IntegerVector exposure_risk_levels, int n_different_snps_weight, int n_both_one_weight, double recessive_ref_prop, double recode_test_stat, bool epi_test, bool check_risk, bool use_parents); |
|
432 |
+RcppExport SEXP _epistasisGAGE_GxE_fitness_list(SEXP case_genetic_data_listSEXP, SEXP complement_genetic_data_listSEXP, SEXP chromosome_listSEXP, SEXP ld_block_vecSEXP, SEXP weight_lookupSEXP, SEXP exposure_levelsSEXP, SEXP exposure_risk_levelsSEXP, SEXP n_different_snps_weightSEXP, SEXP n_both_one_weightSEXP, SEXP recessive_ref_propSEXP, SEXP recode_test_statSEXP, SEXP epi_testSEXP, SEXP check_riskSEXP, SEXP use_parentsSEXP) { |
|
432 | 433 |
BEGIN_RCPP |
433 | 434 |
Rcpp::RObject rcpp_result_gen; |
434 | 435 |
Rcpp::RNGScope rcpp_rngScope_gen; |
... | ... |
@@ -445,13 +446,14 @@ BEGIN_RCPP |
445 | 446 |
Rcpp::traits::input_parameter< double >::type recode_test_stat(recode_test_statSEXP); |
446 | 447 |
Rcpp::traits::input_parameter< bool >::type epi_test(epi_testSEXP); |
447 | 448 |
Rcpp::traits::input_parameter< bool >::type check_risk(check_riskSEXP); |
448 |
- rcpp_result_gen = Rcpp::wrap(GxE_fitness_list(case_genetic_data_list, complement_genetic_data_list, chromosome_list, ld_block_vec, weight_lookup, exposure_levels, exposure_risk_levels, n_different_snps_weight, n_both_one_weight, recessive_ref_prop, recode_test_stat, epi_test, check_risk)); |
|
449 |
+ Rcpp::traits::input_parameter< bool >::type use_parents(use_parentsSEXP); |
|
450 |
+ rcpp_result_gen = Rcpp::wrap(GxE_fitness_list(case_genetic_data_list, complement_genetic_data_list, chromosome_list, ld_block_vec, weight_lookup, exposure_levels, exposure_risk_levels, n_different_snps_weight, n_both_one_weight, recessive_ref_prop, recode_test_stat, epi_test, check_risk, use_parents)); |
|
449 | 451 |
return rcpp_result_gen; |
450 | 452 |
END_RCPP |
451 | 453 |
} |
452 | 454 |
// compute_population_fitness |
453 |
-List compute_population_fitness(IntegerMatrix case_genetic_data, IntegerMatrix complement_genetic_data, IntegerVector ld_block_vec, List chromosome_list, IntegerVector weight_lookup, ListOf<IntegerMatrix> case_genetic_data_list, ListOf<IntegerMatrix> complement_genetic_data_list, IntegerVector exposure_levels, IntegerVector exposure_risk_levels, int n_different_snps_weight, int n_both_one_weight, double recessive_ref_prop, double recode_test_stat, bool GxE, bool check_risk); |
|
454 |
-RcppExport SEXP _epistasisGAGE_compute_population_fitness(SEXP case_genetic_dataSEXP, SEXP complement_genetic_dataSEXP, SEXP ld_block_vecSEXP, SEXP chromosome_listSEXP, SEXP weight_lookupSEXP, SEXP case_genetic_data_listSEXP, SEXP complement_genetic_data_listSEXP, SEXP exposure_levelsSEXP, SEXP exposure_risk_levelsSEXP, SEXP n_different_snps_weightSEXP, SEXP n_both_one_weightSEXP, SEXP recessive_ref_propSEXP, SEXP recode_test_statSEXP, SEXP GxESEXP, SEXP check_riskSEXP) { |
|
455 |
+List compute_population_fitness(IntegerMatrix case_genetic_data, IntegerMatrix complement_genetic_data, IntegerVector ld_block_vec, List chromosome_list, IntegerVector weight_lookup, ListOf<IntegerMatrix> case_genetic_data_list, ListOf<IntegerMatrix> complement_genetic_data_list, IntegerVector exposure_levels, IntegerVector exposure_risk_levels, int n_different_snps_weight, int n_both_one_weight, double recessive_ref_prop, double recode_test_stat, bool GxE, bool check_risk, bool use_parents); |
|
456 |
+RcppExport SEXP _epistasisGAGE_compute_population_fitness(SEXP case_genetic_dataSEXP, SEXP complement_genetic_dataSEXP, SEXP ld_block_vecSEXP, SEXP chromosome_listSEXP, SEXP weight_lookupSEXP, SEXP case_genetic_data_listSEXP, SEXP complement_genetic_data_listSEXP, SEXP exposure_levelsSEXP, SEXP exposure_risk_levelsSEXP, SEXP n_different_snps_weightSEXP, SEXP n_both_one_weightSEXP, SEXP recessive_ref_propSEXP, SEXP recode_test_statSEXP, SEXP GxESEXP, SEXP check_riskSEXP, SEXP use_parentsSEXP) { |
|
455 | 457 |
BEGIN_RCPP |
456 | 458 |
Rcpp::RObject rcpp_result_gen; |
457 | 459 |
Rcpp::RNGScope rcpp_rngScope_gen; |
... | ... |
@@ -470,7 +472,8 @@ BEGIN_RCPP |
470 | 472 |
Rcpp::traits::input_parameter< double >::type recode_test_stat(recode_test_statSEXP); |
471 | 473 |
Rcpp::traits::input_parameter< bool >::type GxE(GxESEXP); |
472 | 474 |
Rcpp::traits::input_parameter< bool >::type check_risk(check_riskSEXP); |
473 |
- rcpp_result_gen = Rcpp::wrap(compute_population_fitness(case_genetic_data, complement_genetic_data, ld_block_vec, chromosome_list, weight_lookup, case_genetic_data_list, complement_genetic_data_list, exposure_levels, exposure_risk_levels, n_different_snps_weight, n_both_one_weight, recessive_ref_prop, recode_test_stat, GxE, check_risk)); |
|
475 |
+ Rcpp::traits::input_parameter< bool >::type use_parents(use_parentsSEXP); |
|
476 |
+ rcpp_result_gen = Rcpp::wrap(compute_population_fitness(case_genetic_data, complement_genetic_data, ld_block_vec, chromosome_list, weight_lookup, case_genetic_data_list, complement_genetic_data_list, exposure_levels, exposure_risk_levels, n_different_snps_weight, n_both_one_weight, recessive_ref_prop, recode_test_stat, GxE, check_risk, use_parents)); |
|
474 | 477 |
return rcpp_result_gen; |
475 | 478 |
END_RCPP |
476 | 479 |
} |
... | ... |
@@ -488,8 +491,8 @@ BEGIN_RCPP |
488 | 491 |
END_RCPP |
489 | 492 |
} |
490 | 493 |
// initiate_population |
491 |
-List initiate_population(int n_candidate_snps, IntegerMatrix case_genetic_data, IntegerMatrix complement_genetic_data, IntegerVector ld_block_vec, int n_chromosomes, int chromosome_size, IntegerVector weight_lookup, ListOf<IntegerMatrix> case_genetic_data_list, ListOf<IntegerMatrix> complement_genetic_data_list, IntegerVector exposure_levels, IntegerVector exposure_risk_levels, int n_different_snps_weight, int n_both_one_weight, double recessive_ref_prop, double recode_test_stat, int max_generations, bool initial_sample_duplicates, bool GxE, bool check_risk); |
|
492 |
-RcppExport SEXP _epistasisGAGE_initiate_population(SEXP n_candidate_snpsSEXP, SEXP case_genetic_dataSEXP, SEXP complement_genetic_dataSEXP, SEXP ld_block_vecSEXP, SEXP n_chromosomesSEXP, SEXP chromosome_sizeSEXP, SEXP weight_lookupSEXP, SEXP case_genetic_data_listSEXP, SEXP complement_genetic_data_listSEXP, SEXP exposure_levelsSEXP, SEXP exposure_risk_levelsSEXP, SEXP n_different_snps_weightSEXP, SEXP n_both_one_weightSEXP, SEXP recessive_ref_propSEXP, SEXP recode_test_statSEXP, SEXP max_generationsSEXP, SEXP initial_sample_duplicatesSEXP, SEXP GxESEXP, SEXP check_riskSEXP) { |
|
494 |
+List initiate_population(int n_candidate_snps, IntegerMatrix case_genetic_data, IntegerMatrix complement_genetic_data, IntegerVector ld_block_vec, int n_chromosomes, int chromosome_size, IntegerVector weight_lookup, ListOf<IntegerMatrix> case_genetic_data_list, ListOf<IntegerMatrix> complement_genetic_data_list, IntegerVector exposure_levels, IntegerVector exposure_risk_levels, int n_different_snps_weight, int n_both_one_weight, double recessive_ref_prop, double recode_test_stat, int max_generations, bool initial_sample_duplicates, bool GxE, bool check_risk, bool use_parents); |
|
495 |
+RcppExport SEXP _epistasisGAGE_initiate_population(SEXP n_candidate_snpsSEXP, SEXP case_genetic_dataSEXP, SEXP complement_genetic_dataSEXP, SEXP ld_block_vecSEXP, SEXP n_chromosomesSEXP, SEXP chromosome_sizeSEXP, SEXP weight_lookupSEXP, SEXP case_genetic_data_listSEXP, SEXP complement_genetic_data_listSEXP, SEXP exposure_levelsSEXP, SEXP exposure_risk_levelsSEXP, SEXP n_different_snps_weightSEXP, SEXP n_both_one_weightSEXP, SEXP recessive_ref_propSEXP, SEXP recode_test_statSEXP, SEXP max_generationsSEXP, SEXP initial_sample_duplicatesSEXP, SEXP GxESEXP, SEXP check_riskSEXP, SEXP use_parentsSEXP) { |
|
493 | 496 |
BEGIN_RCPP |
494 | 497 |
Rcpp::RObject rcpp_result_gen; |
495 | 498 |
Rcpp::RNGScope rcpp_rngScope_gen; |
... | ... |
@@ -512,7 +515,8 @@ BEGIN_RCPP |
512 | 515 |
Rcpp::traits::input_parameter< bool >::type initial_sample_duplicates(initial_sample_duplicatesSEXP); |
513 | 516 |
Rcpp::traits::input_parameter< bool >::type GxE(GxESEXP); |
514 | 517 |
Rcpp::traits::input_parameter< bool >::type check_risk(check_riskSEXP); |
515 |
- rcpp_result_gen = Rcpp::wrap(initiate_population(n_candidate_snps, case_genetic_data, complement_genetic_data, ld_block_vec, n_chromosomes, chromosome_size, weight_lookup, case_genetic_data_list, complement_genetic_data_list, exposure_levels, exposure_risk_levels, n_different_snps_weight, n_both_one_weight, recessive_ref_prop, recode_test_stat, max_generations, initial_sample_duplicates, GxE, check_risk)); |
|
518 |
+ Rcpp::traits::input_parameter< bool >::type use_parents(use_parentsSEXP); |
|
519 |
+ rcpp_result_gen = Rcpp::wrap(initiate_population(n_candidate_snps, case_genetic_data, complement_genetic_data, ld_block_vec, n_chromosomes, chromosome_size, weight_lookup, case_genetic_data_list, complement_genetic_data_list, exposure_levels, exposure_risk_levels, n_different_snps_weight, n_both_one_weight, recessive_ref_prop, recode_test_stat, max_generations, initial_sample_duplicates, GxE, check_risk, use_parents)); |
|
516 | 520 |
return rcpp_result_gen; |
517 | 521 |
END_RCPP |
518 | 522 |
} |
... | ... |
@@ -541,8 +545,8 @@ BEGIN_RCPP |
541 | 545 |
END_RCPP |
542 | 546 |
} |
543 | 547 |
// run_GADGETS |
544 |
-List run_GADGETS(int island_cluster_size, int n_migrations, IntegerVector ld_block_vec, int n_chromosomes, int chromosome_size, IntegerVector weight_lookup, NumericVector snp_chisq, IntegerMatrix case_genetic_data_in, IntegerMatrix complement_genetic_data_in, Nullable<IntegerVector> exposure_levels_in, Nullable<IntegerVector> exposure_risk_levels_in, Nullable<IntegerVector> exposure_in, int n_different_snps_weight, int n_both_one_weight, int migration_interval, int gen_same_fitness, int max_generations, bool initial_sample_duplicates, double crossover_prop, double recessive_ref_prop, double recode_test_stat); |
|
545 |
-RcppExport SEXP _epistasisGAGE_run_GADGETS(SEXP island_cluster_sizeSEXP, SEXP n_migrationsSEXP, SEXP ld_block_vecSEXP, SEXP n_chromosomesSEXP, SEXP chromosome_sizeSEXP, SEXP weight_lookupSEXP, SEXP snp_chisqSEXP, SEXP case_genetic_data_inSEXP, SEXP complement_genetic_data_inSEXP, SEXP exposure_levels_inSEXP, SEXP exposure_risk_levels_inSEXP, SEXP exposure_inSEXP, SEXP n_different_snps_weightSEXP, SEXP n_both_one_weightSEXP, SEXP migration_intervalSEXP, SEXP gen_same_fitnessSEXP, SEXP max_generationsSEXP, SEXP initial_sample_duplicatesSEXP, SEXP crossover_propSEXP, SEXP recessive_ref_propSEXP, SEXP recode_test_statSEXP) { |
|
548 |
+List run_GADGETS(int island_cluster_size, int n_migrations, IntegerVector ld_block_vec, int n_chromosomes, int chromosome_size, IntegerVector weight_lookup, NumericVector snp_chisq, IntegerMatrix case_genetic_data_in, IntegerMatrix complement_genetic_data_in, Nullable<IntegerVector> exposure_levels_in, Nullable<IntegerVector> exposure_risk_levels_in, Nullable<IntegerVector> exposure_in, int n_different_snps_weight, int n_both_one_weight, int migration_interval, int gen_same_fitness, int max_generations, bool initial_sample_duplicates, double crossover_prop, double recessive_ref_prop, double recode_test_stat, bool use_parents); |
|
549 |
+RcppExport SEXP _epistasisGAGE_run_GADGETS(SEXP island_cluster_sizeSEXP, SEXP n_migrationsSEXP, SEXP ld_block_vecSEXP, SEXP n_chromosomesSEXP, SEXP chromosome_sizeSEXP, SEXP weight_lookupSEXP, SEXP snp_chisqSEXP, SEXP case_genetic_data_inSEXP, SEXP complement_genetic_data_inSEXP, SEXP exposure_levels_inSEXP, SEXP exposure_risk_levels_inSEXP, SEXP exposure_inSEXP, SEXP n_different_snps_weightSEXP, SEXP n_both_one_weightSEXP, SEXP migration_intervalSEXP, SEXP gen_same_fitnessSEXP, SEXP max_generationsSEXP, SEXP initial_sample_duplicatesSEXP, SEXP crossover_propSEXP, SEXP recessive_ref_propSEXP, SEXP recode_test_statSEXP, SEXP use_parentsSEXP) { |
|
546 | 550 |
BEGIN_RCPP |
547 | 551 |
Rcpp::RObject rcpp_result_gen; |
548 | 552 |
Rcpp::RNGScope rcpp_rngScope_gen; |
... | ... |
@@ -567,7 +571,8 @@ BEGIN_RCPP |
567 | 571 |
Rcpp::traits::input_parameter< double >::type crossover_prop(crossover_propSEXP); |
568 | 572 |
Rcpp::traits::input_parameter< double >::type recessive_ref_prop(recessive_ref_propSEXP); |
569 | 573 |
Rcpp::traits::input_parameter< double >::type recode_test_stat(recode_test_statSEXP); |
570 |
- rcpp_result_gen = Rcpp::wrap(run_GADGETS(island_cluster_size, n_migrations, ld_block_vec, n_chromosomes, chromosome_size, weight_lookup, snp_chisq, case_genetic_data_in, complement_genetic_data_in, exposure_levels_in, exposure_risk_levels_in, exposure_in, n_different_snps_weight, n_both_one_weight, migration_interval, gen_same_fitness, max_generations, initial_sample_duplicates, crossover_prop, recessive_ref_prop, recode_test_stat)); |
|
574 |
+ Rcpp::traits::input_parameter< bool >::type use_parents(use_parentsSEXP); |
|
575 |
+ rcpp_result_gen = Rcpp::wrap(run_GADGETS(island_cluster_size, n_migrations, ld_block_vec, n_chromosomes, chromosome_size, weight_lookup, snp_chisq, case_genetic_data_in, complement_genetic_data_in, exposure_levels_in, exposure_risk_levels_in, exposure_in, n_different_snps_weight, n_both_one_weight, migration_interval, gen_same_fitness, max_generations, initial_sample_duplicates, crossover_prop, recessive_ref_prop, recode_test_stat, use_parents)); |
|
571 | 576 |
return rcpp_result_gen; |
572 | 577 |
END_RCPP |
573 | 578 |
} |
... | ... |
@@ -632,8 +637,8 @@ BEGIN_RCPP |
632 | 637 |
END_RCPP |
633 | 638 |
} |
634 | 639 |
// GxE_test |
635 |
-List GxE_test(IntegerVector snp_cols, List preprocessed_list, int n_permutes, int n_different_snps_weight, int n_both_one_weight, int weight_function_int, double recessive_ref_prop, double recode_test_stat); |
|
636 |
-RcppExport SEXP _epistasisGAGE_GxE_test(SEXP snp_colsSEXP, SEXP preprocessed_listSEXP, SEXP n_permutesSEXP, SEXP n_different_snps_weightSEXP, SEXP n_both_one_weightSEXP, SEXP weight_function_intSEXP, SEXP recessive_ref_propSEXP, SEXP recode_test_statSEXP) { |
|
640 |
+List GxE_test(IntegerVector snp_cols, List preprocessed_list, int n_permutes, int n_different_snps_weight, int n_both_one_weight, int weight_function_int, double recessive_ref_prop, double recode_test_stat, bool use_parents); |
|
641 |
+RcppExport SEXP _epistasisGAGE_GxE_test(SEXP snp_colsSEXP, SEXP preprocessed_listSEXP, SEXP n_permutesSEXP, SEXP n_different_snps_weightSEXP, SEXP n_both_one_weightSEXP, SEXP weight_function_intSEXP, SEXP recessive_ref_propSEXP, SEXP recode_test_statSEXP, SEXP use_parentsSEXP) { |
|
637 | 642 |
BEGIN_RCPP |
638 | 643 |
Rcpp::RObject rcpp_result_gen; |
639 | 644 |
Rcpp::RNGScope rcpp_rngScope_gen; |
... | ... |
@@ -645,13 +650,14 @@ BEGIN_RCPP |
645 | 650 |
Rcpp::traits::input_parameter< int >::type weight_function_int(weight_function_intSEXP); |
646 | 651 |
Rcpp::traits::input_parameter< double >::type recessive_ref_prop(recessive_ref_propSEXP); |
647 | 652 |
Rcpp::traits::input_parameter< double >::type recode_test_stat(recode_test_statSEXP); |
648 |
- rcpp_result_gen = Rcpp::wrap(GxE_test(snp_cols, preprocessed_list, n_permutes, n_different_snps_weight, n_both_one_weight, weight_function_int, recessive_ref_prop, recode_test_stat)); |
|
653 |
+ Rcpp::traits::input_parameter< bool >::type use_parents(use_parentsSEXP); |
|
654 |
+ rcpp_result_gen = Rcpp::wrap(GxE_test(snp_cols, preprocessed_list, n_permutes, n_different_snps_weight, n_both_one_weight, weight_function_int, recessive_ref_prop, recode_test_stat, use_parents)); |
|
649 | 655 |
return rcpp_result_gen; |
650 | 656 |
END_RCPP |
651 | 657 |
} |
652 | 658 |
// n2log_epistasis_pvals |
653 |
-NumericVector n2log_epistasis_pvals(ListOf<IntegerVector> chromosome_list, List in_data_list, int n_permutes, int n_different_snps_weight, int n_both_one_weight, int weight_function_int, double recessive_ref_prop, double recode_test_stat, bool GxE); |
|
654 |
-RcppExport SEXP _epistasisGAGE_n2log_epistasis_pvals(SEXP chromosome_listSEXP, SEXP in_data_listSEXP, SEXP n_permutesSEXP, SEXP n_different_snps_weightSEXP, SEXP n_both_one_weightSEXP, SEXP weight_function_intSEXP, SEXP recessive_ref_propSEXP, SEXP recode_test_statSEXP, SEXP GxESEXP) { |
|
659 |
+NumericVector n2log_epistasis_pvals(ListOf<IntegerVector> chromosome_list, List in_data_list, int n_permutes, int n_different_snps_weight, int n_both_one_weight, int weight_function_int, double recessive_ref_prop, double recode_test_stat, bool GxE, bool use_parents); |
|
660 |
+RcppExport SEXP _epistasisGAGE_n2log_epistasis_pvals(SEXP chromosome_listSEXP, SEXP in_data_listSEXP, SEXP n_permutesSEXP, SEXP n_different_snps_weightSEXP, SEXP n_both_one_weightSEXP, SEXP weight_function_intSEXP, SEXP recessive_ref_propSEXP, SEXP recode_test_statSEXP, SEXP GxESEXP, SEXP use_parentsSEXP) { |
|
655 | 661 |
BEGIN_RCPP |
656 | 662 |
Rcpp::RObject rcpp_result_gen; |
657 | 663 |
Rcpp::RNGScope rcpp_rngScope_gen; |
... | ... |
@@ -664,7 +670,8 @@ BEGIN_RCPP |
664 | 670 |
Rcpp::traits::input_parameter< double >::type recessive_ref_prop(recessive_ref_propSEXP); |
665 | 671 |
Rcpp::traits::input_parameter< double >::type recode_test_stat(recode_test_statSEXP); |
666 | 672 |
Rcpp::traits::input_parameter< bool >::type GxE(GxESEXP); |
667 |
- rcpp_result_gen = Rcpp::wrap(n2log_epistasis_pvals(chromosome_list, in_data_list, n_permutes, n_different_snps_weight, n_both_one_weight, weight_function_int, recessive_ref_prop, recode_test_stat, GxE)); |
|
673 |
+ Rcpp::traits::input_parameter< bool >::type use_parents(use_parentsSEXP); |
|
674 |
+ rcpp_result_gen = Rcpp::wrap(n2log_epistasis_pvals(chromosome_list, in_data_list, n_permutes, n_different_snps_weight, n_both_one_weight, weight_function_int, recessive_ref_prop, recode_test_stat, GxE, use_parents)); |
|
668 | 675 |
return rcpp_result_gen; |
669 | 676 |
END_RCPP |
670 | 677 |
} |
... | ... |
@@ -698,20 +705,20 @@ static const R_CallMethodDef CallEntries[] = { |
698 | 705 |
{"_epistasisGAGE_find_high_risk", (DL_FUNC) &_epistasisGAGE_find_high_risk, 9}, |
699 | 706 |
{"_epistasisGAGE_compute_dif_vecs", (DL_FUNC) &_epistasisGAGE_compute_dif_vecs, 7}, |
700 | 707 |
{"_epistasisGAGE_chrom_fitness_score", (DL_FUNC) &_epistasisGAGE_chrom_fitness_score, 12}, |
701 |
- {"_epistasisGAGE_GxE_fitness_score", (DL_FUNC) &_epistasisGAGE_GxE_fitness_score, 13}, |
|
708 |
+ {"_epistasisGAGE_GxE_fitness_score", (DL_FUNC) &_epistasisGAGE_GxE_fitness_score, 14}, |
|
702 | 709 |
{"_epistasisGAGE_chrom_fitness_list", (DL_FUNC) &_epistasisGAGE_chrom_fitness_list, 10}, |
703 |
- {"_epistasisGAGE_GxE_fitness_list", (DL_FUNC) &_epistasisGAGE_GxE_fitness_list, 13}, |
|
704 |
- {"_epistasisGAGE_compute_population_fitness", (DL_FUNC) &_epistasisGAGE_compute_population_fitness, 15}, |
|
710 |
+ {"_epistasisGAGE_GxE_fitness_list", (DL_FUNC) &_epistasisGAGE_GxE_fitness_list, 14}, |
|
711 |
+ {"_epistasisGAGE_compute_population_fitness", (DL_FUNC) &_epistasisGAGE_compute_population_fitness, 16}, |
|
705 | 712 |
{"_epistasisGAGE_find_top_chrom", (DL_FUNC) &_epistasisGAGE_find_top_chrom, 3}, |
706 |
- {"_epistasisGAGE_initiate_population", (DL_FUNC) &_epistasisGAGE_initiate_population, 19}, |
|
713 |
+ {"_epistasisGAGE_initiate_population", (DL_FUNC) &_epistasisGAGE_initiate_population, 20}, |
|
707 | 714 |
{"_epistasisGAGE_check_convergence", (DL_FUNC) &_epistasisGAGE_check_convergence, 2}, |
708 | 715 |
{"_epistasisGAGE_check_max_gens", (DL_FUNC) &_epistasisGAGE_check_max_gens, 2}, |
709 |
- {"_epistasisGAGE_run_GADGETS", (DL_FUNC) &_epistasisGAGE_run_GADGETS, 21}, |
|
716 |
+ {"_epistasisGAGE_run_GADGETS", (DL_FUNC) &_epistasisGAGE_run_GADGETS, 22}, |
|
710 | 717 |
{"_epistasisGAGE_epistasis_test_permute", (DL_FUNC) &_epistasisGAGE_epistasis_test_permute, 10}, |
711 | 718 |
{"_epistasisGAGE_epistasis_test_null_scores", (DL_FUNC) &_epistasisGAGE_epistasis_test_null_scores, 11}, |
712 | 719 |
{"_epistasisGAGE_epistasis_test", (DL_FUNC) &_epistasisGAGE_epistasis_test, 9}, |
713 |
- {"_epistasisGAGE_GxE_test", (DL_FUNC) &_epistasisGAGE_GxE_test, 8}, |
|
714 |
- {"_epistasisGAGE_n2log_epistasis_pvals", (DL_FUNC) &_epistasisGAGE_n2log_epistasis_pvals, 9}, |
|
720 |
+ {"_epistasisGAGE_GxE_test", (DL_FUNC) &_epistasisGAGE_GxE_test, 9}, |
|
721 |
+ {"_epistasisGAGE_n2log_epistasis_pvals", (DL_FUNC) &_epistasisGAGE_n2log_epistasis_pvals, 10}, |
|
715 | 722 |
{NULL, NULL, 0} |
716 | 723 |
}; |
717 | 724 |
|
... | ... |
@@ -1043,6 +1043,7 @@ List chrom_fitness_score(IntegerMatrix case_genetic_data_in, IntegerMatrix compl |
1043 | 1043 |
Named("sum_dif_vecs") = sum_dif_vecs, |
1044 | 1044 |
Named("sigma") = cov_mat, |
1045 | 1045 |
Named("w") = 1/invsum_family_weights, |
1046 |
+ Named("family_weights") = family_weights, |
|
1046 | 1047 |
Named("risk_set_alleles") = risk_set_alleles, |
1047 | 1048 |
Named("n_case_risk_geno") = n_case_high_risk, |
1048 | 1049 |
Named("n_comp_risk_geno") = n_comp_high_risk); |
... | ... |
@@ -1054,6 +1055,7 @@ List chrom_fitness_score(IntegerMatrix case_genetic_data_in, IntegerMatrix compl |
1054 | 1055 |
Named("sum_dif_vecs") = sum_dif_vecs, |
1055 | 1056 |
Named("sigma") = cov_mat, |
1056 | 1057 |
Named("w") = 1/invsum_family_weights, |
1058 |
+ Named("family_weights") = family_weights, |
|
1057 | 1059 |
Named("risk_set_alleles") = risk_set_alleles, |
1058 | 1060 |
Named("n_case_risk_geno") = n_case_high_risk, |
1059 | 1061 |
Named("n_comp_risk_geno") = n_comp_high_risk, |
... | ... |
@@ -1085,7 +1087,7 @@ List GxE_fitness_score(ListOf<IntegerMatrix> case_genetic_data_list, ListOf<Inte |
1085 | 1087 |
IntegerVector target_snps, IntegerVector ld_block_vec, IntegerVector weight_lookup, |
1086 | 1088 |
IntegerVector exposure_levels, IntegerVector exposure_risk_levels, int n_different_snps_weight = 2, |
1087 | 1089 |
int n_both_one_weight = 1, double recessive_ref_prop = 0.75, double recode_test_stat = 1.64, |
1088 |
- bool epi_test = false, bool check_risk = true){ |
|
1090 |
+ bool epi_test = false, bool check_risk = true, bool use_parents = false){ |
|
1089 | 1091 |
|
1090 | 1092 |
// divide the input data based on exposure and get components for fitness score // |
1091 | 1093 |
List score_by_exposure(exposure_levels.length()); |
... | ... |
@@ -1220,8 +1222,10 @@ List GxE_fitness_score(ListOf<IntegerMatrix> case_genetic_data_list, ListOf<Inte |
1220 | 1222 |
|
1221 | 1223 |
// cov mat // |
1222 | 1224 |
double w1 = exp1_list["w"]; |
1225 |
+ arma::vec family_weights1 = exp1_list["family_weights"]; |
|
1223 | 1226 |
arma::mat sigma1 = exp1_list["sigma"]; |
1224 | 1227 |
double w2 = exp2_list["w"]; |
1228 |
+ arma::vec family_weights2 = exp2_list["family_weights"]; |
|
1225 | 1229 |
arma::mat sigma2 = exp2_list["sigma"]; |
1226 | 1230 |
arma::mat sigma_hat = (1/w1)*sigma1 + (1/w2)*sigma2; |
1227 | 1231 |
//arma::mat sigma_hat = (w1*sigma1 + w2*sigma2)/(w1 + w2); |
... | ... |
@@ -1233,6 +1237,29 @@ List GxE_fitness_score(ListOf<IntegerMatrix> case_genetic_data_list, ListOf<Inte |
1233 | 1237 |
s = as_scalar(xbar_diff * sigma_hat_inv * xbar_diff.t()); |
1234 | 1238 |
s = s / 1000; |
1235 | 1239 |
|
1240 |
+ // if parents are to be used, compute the t-stat and multiply |
|
1241 |
+ if (use_parents){ |
|
1242 |
+ |
|
1243 |
+ arma::colvec family_weights_vec = arma::join_cols(family_weights1, family_weights2); |
|
1244 |
+ int n_exp1 = family_weights1.size(); |
|
1245 |
+ int n_exp2 = family_weights2.size(); |
|
1246 |
+ int n = n_exp1 + n_exp2; |
|
1247 |
+ arma::colvec exp1_vals = arma::colvec(n_exp1, fill::zeros); |
|
1248 |
+ arma::colvec exp2_vals = arma::colvec(n_exp2, fill::ones); |
|
1249 |
+ arma::colvec y = join_cols(exp1_vals, exp2_vals); |
|
1250 |
+ arma::colvec intercept = arma::colvec(n, fill::ones); |
|
1251 |
+ arma::mat X = arma::join_horiz(intercept, family_weights_vec); |
|
1252 |
+ arma::vec coef = solve(X, y, solve_opts::fast); |
|
1253 |
+ double beta_hat = arma::as_scalar(coef[1]); |
|
1254 |
+ arma::vec resid = y - X*coef; |
|
1255 |
+ double sig2 = arma::as_scalar(arma::trans(resid)*resid/(n - 2)); |
|
1256 |
+ arma::vec se = arma::sqrt(sig2 * arma::diagvec(arma::inv(arma::trans(X)*X))); |
|
1257 |
+ double se_hat = arma::as_scalar(se[1]); |
|
1258 |
+ double abs_t = std::abs(beta_hat / se_hat); |
|
1259 |
+ s = abs_t * s; |
|
1260 |
+ |
|
1261 |
+ } |
|
1262 |
+ |
|
1236 | 1263 |
// if the fitness score is zero or undefined (either due to zero variance or mean), reset to small number |
1237 | 1264 |
if ( (s <= 0) | R_isnancpp(s) | !arma::is_finite(s) ){ |
1238 | 1265 |
s = pow(10, -10); |
... | ... |
@@ -1312,7 +1339,7 @@ List GxE_fitness_list(List case_genetic_data_list, List complement_genetic_data_ |
1312 | 1339 |
IntegerVector ld_block_vec, IntegerVector weight_lookup, IntegerVector exposure_levels, |
1313 | 1340 |
IntegerVector exposure_risk_levels, int n_different_snps_weight = 2, int n_both_one_weight = 1, |
1314 | 1341 |
double recessive_ref_prop = 0.75, double recode_test_stat = 1.64, bool epi_test = false, |
1315 |
- bool check_risk = true){ |
|
1342 |
+ bool check_risk = true, bool use_parents = false){ |
|
1316 | 1343 |
|
1317 | 1344 |
List scores = chromosome_list.length(); |
1318 | 1345 |
for (int i = 0; i < chromosome_list.length(); i++){ |
... | ... |
@@ -1320,7 +1347,7 @@ List GxE_fitness_list(List case_genetic_data_list, List complement_genetic_data_ |
1320 | 1347 |
IntegerVector target_snps = chromosome_list[i]; |
1321 | 1348 |
scores[i] = GxE_fitness_score(case_genetic_data_list, complement_genetic_data_list, target_snps, |
1322 | 1349 |
ld_block_vec, weight_lookup, exposure_levels, exposure_risk_levels, n_different_snps_weight, |
1323 |
- n_both_one_weight, recessive_ref_prop, recode_test_stat, epi_test, check_risk); |
|
1350 |
+ n_both_one_weight, recessive_ref_prop, recode_test_stat, epi_test, check_risk, use_parents); |
|
1324 | 1351 |
|
1325 | 1352 |
} |
1326 | 1353 |
return(scores); |
... | ... |
@@ -1342,7 +1369,7 @@ List compute_population_fitness(IntegerMatrix case_genetic_data, IntegerMatrix c |
1342 | 1369 |
IntegerVector exposure_risk_levels, |
1343 | 1370 |
int n_different_snps_weight = 2, |
1344 | 1371 |
int n_both_one_weight = 1, double recessive_ref_prop = 0.75, double recode_test_stat = 1.64, |
1345 |
- bool GxE = false, bool check_risk = true){ |
|
1372 |
+ bool GxE = false, bool check_risk = true, bool use_parents = false){ |
|
1346 | 1373 |
|
1347 | 1374 |
// initiate storage object for fitness scores |
1348 | 1375 |
List chrom_fitness_score_list; |
... | ... |
@@ -1353,7 +1380,7 @@ List compute_population_fitness(IntegerMatrix case_genetic_data, IntegerMatrix c |
1353 | 1380 |
chrom_fitness_score_list = GxE_fitness_list(case_genetic_data_list, complement_genetic_data_list, chromosome_list, |
1354 | 1381 |
ld_block_vec, weight_lookup, exposure_levels, exposure_risk_levels, |
1355 | 1382 |
n_different_snps_weight, n_both_one_weight, recessive_ref_prop, recode_test_stat, |
1356 |
- false, check_risk); |
|
1383 |
+ false, check_risk, use_parents); |
|
1357 | 1384 |
|
1358 | 1385 |
// for storing generation information |
1359 | 1386 |
|
... | ... |
@@ -1506,7 +1533,7 @@ List initiate_population(int n_candidate_snps, IntegerMatrix case_genetic_data, |
1506 | 1533 |
int n_different_snps_weight = 2, int n_both_one_weight = 1, |
1507 | 1534 |
double recessive_ref_prop = 0.75, double recode_test_stat = 1.64, |
1508 | 1535 |
int max_generations = 500, bool initial_sample_duplicates = false, |
1509 |
- bool GxE = false, bool check_risk = true){ |
|
1536 |
+ bool GxE = false, bool check_risk = true, bool use_parents = false){ |
|
1510 | 1537 |
|
1511 | 1538 |
int n_possible_unique_combn = n_chromosomes * chromosome_size; |
1512 | 1539 |
if ((n_candidate_snps < n_possible_unique_combn) & !initial_sample_duplicates) { |
... | ... |
@@ -1545,7 +1572,7 @@ List initiate_population(int n_candidate_snps, IntegerMatrix case_genetic_data, |
1545 | 1572 |
weight_lookup, case_genetic_data_list, complement_genetic_data_list, |
1546 | 1573 |
exposure_levels, exposure_risk_levels, n_different_snps_weight, |
1547 | 1574 |
n_both_one_weight, recessive_ref_prop, recode_test_stat, GxE, |
1548 |
- check_risk); |
|
1575 |
+ check_risk, use_parents); |
|
1549 | 1576 |
|
1550 | 1577 |
// pick out the top and bottom scores |
1551 | 1578 |
chromosome_list = current_fitness_list["chromosome_list"]; |
... | ... |
@@ -1584,7 +1611,7 @@ List evolve_island(int n_migrations, IntegerMatrix case_genetic_data, IntegerMat |
1584 | 1611 |
int max_generations = 500, |
1585 | 1612 |
bool initial_sample_duplicates = false, |
1586 | 1613 |
double crossover_prop = 0.8, double recessive_ref_prop = 0.75, double recode_test_stat = 1.64, |
1587 |
- bool GxE = false, bool check_risk = true){ |
|
1614 |
+ bool GxE = false, bool check_risk = true, bool use_parents = false){ |
|
1588 | 1615 |
|
1589 | 1616 |
// initialize groups of candidate solutions if generation 1 |
1590 | 1617 |
int generation = population["generation"]; |
... | ... |
@@ -1831,7 +1858,7 @@ List evolve_island(int n_migrations, IntegerMatrix case_genetic_data, IntegerMat |
1831 | 1858 |
weight_lookup, case_genetic_data_list, complement_genetic_data_list, |
1832 | 1859 |
exposure_levels, exposure_risk_levels, n_different_snps_weight, |
1833 | 1860 |
n_both_one_weight, recessive_ref_prop, recode_test_stat, GxE, |
1834 |
- check_risk); |
|
1861 |
+ check_risk, use_parents); |
|
1835 | 1862 |
|
1836 | 1863 |
//7. Increment iterators |
1837 | 1864 |
generation += 1; |
... | ... |
@@ -2072,7 +2099,7 @@ List run_GADGETS(int island_cluster_size, int n_migrations, |
2072 | 2099 |
int n_different_snps_weight = 2, int n_both_one_weight = 1, int migration_interval = 50, |
2073 | 2100 |
int gen_same_fitness = 50, int max_generations = 500, |
2074 | 2101 |
bool initial_sample_duplicates = false, double crossover_prop = 0.8, |
2075 |
- double recessive_ref_prop = 0.75, double recode_test_stat = 1.64){ |
|
2102 |
+ double recessive_ref_prop = 0.75, double recode_test_stat = 1.64, bool use_parents = false){ |
|
2076 | 2103 |
|
2077 | 2104 |
// instantiate input objects |
2078 | 2105 |
IntegerMatrix case_genetic_data; |
... | ... |
@@ -2129,7 +2156,7 @@ List run_GADGETS(int island_cluster_size, int n_migrations, |
2129 | 2156 |
n_different_snps_weight, n_both_one_weight, |
2130 | 2157 |
recessive_ref_prop, recode_test_stat, |
2131 | 2158 |
max_generations, initial_sample_duplicates, GxE, |
2132 |
- check_risk); |
|
2159 |
+ check_risk, use_parents); |
|
2133 | 2160 |
|
2134 | 2161 |
island_populations[i] = evolve_island(n_migrations, case_genetic_data, complement_genetic_data, |
2135 | 2162 |
ld_block_vec, n_chromosomes, chromosome_size, weight_lookup, |
... | ... |
@@ -2138,7 +2165,7 @@ List run_GADGETS(int island_cluster_size, int n_migrations, |
2138 | 2165 |
island_population_i, n_different_snps_weight, n_both_one_weight, |
2139 | 2166 |
migration_interval, gen_same_fitness, max_generations, |
2140 | 2167 |
initial_sample_duplicates, crossover_prop, recessive_ref_prop, recode_test_stat, |
2141 |
- GxE, check_risk); |
|
2168 |
+ GxE, check_risk, use_parents); |
|
2142 | 2169 |
|
2143 | 2170 |
} |
2144 | 2171 |
|
... | ... |
@@ -2258,7 +2285,7 @@ List run_GADGETS(int island_cluster_size, int n_migrations, |
2258 | 2285 |
island_population_i, n_different_snps_weight, n_both_one_weight, |
2259 | 2286 |
migration_interval, gen_same_fitness, max_generations, |
2260 | 2287 |
initial_sample_duplicates, crossover_prop, recessive_ref_prop, recode_test_stat, |
2261 |
- GxE, check_risk); |
|
2288 |
+ GxE, check_risk, use_parents); |
|
2262 | 2289 |
|
2263 | 2290 |
} |
2264 | 2291 |
|
... | ... |
@@ -2461,7 +2488,7 @@ List epistasis_test(IntegerVector snp_cols, List preprocessed_list, int n_permut |
2461 | 2488 |
// [[Rcpp::export]] |
2462 | 2489 |
List GxE_test(IntegerVector snp_cols, List preprocessed_list, int n_permutes = 10000, |
2463 | 2490 |
int n_different_snps_weight = 2, int n_both_one_weight = 1, int weight_function_int = 2, |
2464 |
- double recessive_ref_prop = 0.75, double recode_test_stat = 1.64){ |
|
2491 |
+ double recessive_ref_prop = 0.75, double recode_test_stat = 1.64, bool use_parents = false){ |
|
2465 | 2492 |
|
2466 | 2493 |
// pick out target columns in the preprocessed data |
2467 | 2494 |
IntegerVector target_snps = snp_cols; |
... | ... |
@@ -2518,7 +2545,7 @@ List GxE_test(IntegerVector snp_cols, List preprocessed_list, int n_permutes = 1 |
2518 | 2545 |
List obs_fitness_list = GxE_fitness_score(case_genetic_data_list, complement_genetic_data_list, |
2519 | 2546 |
chrom_snps, target_snps_ld_blocks, weight_lookup, exposure_levels, |
2520 | 2547 |
exposure_risk_levels, n_different_snps_weight, n_both_one_weight, |
2521 |
- recessive_ref_prop, recode_test_stat, true, check_risk); |
|
2548 |
+ recessive_ref_prop, recode_test_stat, true, check_risk, use_parents); |
|
2522 | 2549 |
|
2523 | 2550 |
double obs_fitness_score = obs_fitness_list["fitness_score"]; |
2524 | 2551 |
|
... | ... |
@@ -2547,7 +2574,7 @@ List GxE_test(IntegerVector snp_cols, List preprocessed_list, int n_permutes = 1 |
2547 | 2574 |
List perm_fitness_list = GxE_fitness_score(case_genetic_data_list_perm, complement_genetic_data_list_perm, |
2548 | 2575 |
chrom_snps, target_snps_ld_blocks, weight_lookup, exposure_levels_perm, |
2549 | 2576 |
exposure_risk_levels_perm, n_different_snps_weight, n_both_one_weight, |
2550 |
- recessive_ref_prop, recode_test_stat, true, check_risk); |
|
2577 |
+ recessive_ref_prop, recode_test_stat, true, check_risk, use_parents); |
|
2551 | 2578 |
double perm_fitness = perm_fitness_list["fitness_score"]; |
2552 | 2579 |
perm_fitness_scores[i] = perm_fitness; |
2553 | 2580 |
|
... | ... |
@@ -2576,7 +2603,8 @@ List GxE_test(IntegerVector snp_cols, List preprocessed_list, int n_permutes = 1 |
2576 | 2603 |
// [[Rcpp::export]] |
2577 | 2604 |
NumericVector n2log_epistasis_pvals(ListOf<IntegerVector> chromosome_list, List in_data_list, int n_permutes = 10000, |
2578 | 2605 |
int n_different_snps_weight = 2, int n_both_one_weight = 1, int weight_function_int = 2, |
2579 |
- double recessive_ref_prop = 0.75, double recode_test_stat = 1.64, bool GxE = false){ |
|
2606 |
+ double recessive_ref_prop = 0.75, double recode_test_stat = 1.64, bool GxE = false, |
|
2607 |
+ bool use_parents = false){ |
|
2580 | 2608 |
|
2581 | 2609 |
NumericVector n2log_epi_pvals(chromosome_list.size()); |
2582 | 2610 |
double N = n_permutes + 1; |
... | ... |
@@ -2588,7 +2616,7 @@ NumericVector n2log_epistasis_pvals(ListOf<IntegerVector> chromosome_list, List |
2588 | 2616 |
if (GxE){ |
2589 | 2617 |
|
2590 | 2618 |
perm_res = GxE_test(chromosome, in_data_list, n_permutes, n_different_snps_weight, n_both_one_weight, |
2591 |
- weight_function_int, recessive_ref_prop, recode_test_stat); |
|
2619 |
+ weight_function_int, recessive_ref_prop, recode_test_stat, use_parents); |
|
2592 | 2620 |
|
2593 | 2621 |
} else { |
2594 | 2622 |
|