Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
119 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ Suggests: | |
rmarkdown, | ||
shiny, | ||
shinydashboard, | ||
shinyBS, | ||
rhandsontable, | ||
DT | ||
VignetteBuilder: knitr | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# dput object to character string | ||
# cput is used inside the reports | ||
cput <- function(x) { | ||
f <- tempfile() | ||
dput(x, file = f) | ||
return(readLines(f)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#' @importFrom utils write.csv2 | ||
run_full_report <- function(...) { | ||
|
||
# Simulate some data and put it into a CSV file | ||
sim_data <- SimulateGMCMData(n = 1000, par = c(pie1 = 0.3, mu = 2, | ||
sigma = 1.1, rho = 0.2))$z | ||
colnames(sim_data) <- c("u133", "exon") | ||
data_file <- tempfile() | ||
utils::write.csv2(sim_data, file = data_file) | ||
|
||
|
||
# SPECIAL GMCM ---- | ||
report_path_meta <- system.file("shiny", "www", "report_meta.Rmd", | ||
package = "GMCM", lib.loc = .libPaths()[1], | ||
mustWork = TRUE) | ||
|
||
# Parameters to expand | ||
params <- list(data_file = data_file, | ||
header = TRUE, | ||
sep = ";", | ||
quote = '\"', | ||
model_cols = c("u133", "exon"), | ||
meta_large_vals = FALSE, | ||
init_par = c(pie1 = 0.5, mu = 1, sigma = 1, rho = 0.5), | ||
meta_method = "NM", | ||
meta_max_ite = 50, | ||
meta_positive_rho = TRUE, | ||
meta_IDR_thres_type = "IDR", | ||
meta_IDR_thres = 0.01) | ||
|
||
expand_args <- c(list(file = report_path_meta), params) | ||
report_expanded <- do.call(knitr::knit_expand, expand_args) | ||
|
||
# Write to file | ||
report_expanded_path <- tempfile() | ||
cat(report_expanded, file = report_expanded_path) | ||
|
||
# We can also purl | ||
res1 <- knitr::purl(report_expanded_path, | ||
output = gsub(".Rmd$", ".R", report_expanded_path), | ||
documentation = 0) | ||
|
||
# Render the expanded document | ||
res2 <- rmarkdown::render( | ||
input = report_expanded_path, | ||
output_options = list(self_contained = TRUE), | ||
envir = new.env(parent = globalenv()) | ||
) | ||
|
||
return(invisible(list(report_expanded_path, res1, res2))) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#' @importFrom utils write.csv2 | ||
run_meta_report <- function(...) { | ||
|
||
# Simulate some data and put it into a CSV file | ||
sim_data <- SimulateGMCMData(n = 1000, par = c(pie1 = 0.3, mu = 2, | ||
sigma = 1.1, rho = 0.2))$z | ||
colnames(sim_data) <- c("u133", "exon") | ||
data_file <- tempfile() | ||
utils::write.csv2(sim_data, file = data_file) | ||
|
||
|
||
# GENERAL GMCM ---- | ||
report_path_full <- system.file("shiny", "www", "report_full.Rmd", | ||
package = "GMCM", lib.loc = .libPaths()[1], | ||
mustWork = TRUE) | ||
|
||
# Parameters to expand | ||
params <- list(data_file = data_file, | ||
header = TRUE, | ||
sep = ";", | ||
quote = '\"', | ||
model_cols = c("u133", "exon"), | ||
theta = GMCM::rtheta(m = 2, d = 2), | ||
fit_method = "NM", | ||
max_ite = 50, | ||
full_class_type = "thres_prob", | ||
full_thres_prob = 0.9) | ||
|
||
expand_args <- c(list(file = report_path_full), params) | ||
report_expanded <- do.call(knitr::knit_expand, expand_args) | ||
|
||
# Write to temp file | ||
report_expanded_path <- tempfile() | ||
cat(report_expanded, file = report_expanded_path) | ||
|
||
# We can purl | ||
res3 <- knitr::purl(report_expanded_path, | ||
output = paste0(report_expanded_path, ".R"), | ||
documentation = 0) | ||
|
||
# Render the expanded document | ||
res4 <- rmarkdown::render( | ||
input = report_expanded_path, | ||
output_options = list(self_contained = TRUE), | ||
envir = new.env(parent = globalenv()) | ||
) | ||
|
||
return(invisible(list(report_expanded_path, res3, res4))) | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters