Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions R/fsusie_wrapper.R
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,13 @@ fsusie_get_cs <- function(fSuSiE.obj, X, requested_coverage = 0.95) {
#' @param cov_lev Coverage level for the credible sets.
#' @param max_scale numeric, define the maximum of wavelet coefficients used in the analysis (2^max_scale).
#' Set 10 true by default.
#' @param min.purity Minimum purity threshold for credible sets to be retained.
#' @param min_purity Minimum purity threshold for credible sets to be retained.
#' @param ... Additional arguments passed to the fsusie function.
#' @return A modified fsusie object with the susie sets list, correlations for cs, alpha as df like susie,
#' and without the dummy cs that do not meet the minimum purity requirement.
#' @export

fsusie_wrapper <- function(X, Y, pos, L, prior, max_SNP_EM, cov_lev, min.purity, max_scale, ...) {
fsusie_wrapper <- function(X, Y, pos, L, prior, max_SNP_EM, cov_lev, min_purity, max_scale, ...) {
# Make sure fsusieR installed
if (!requireNamespace("fsusieR", quietly = TRUE)) {
stop("To use this function, please install fsusieR: https://github.com/stephenslab/fsusieR")
Expand All @@ -127,11 +127,11 @@ fsusie_wrapper <- function(X, Y, pos, L, prior, max_SNP_EM, cov_lev, min.purity,
fSuSiE.obj <- fsusieR::susiF(
X = X, Y = Y, pos = pos, L = L, prior = prior,
max_SNP_EM = max_SNP_EM, cov_lev = cov_lev,
min.purity = min.purity, max_scale = max_scale, ...
min_purity = min_purity, max_scale = max_scale, ...
)

# Remove dummy cs based on purity threshold
if (all(abs(as.numeric(fSuSiE.obj$purity)) < min.purity)) {
if (all(abs(as.numeric(fSuSiE.obj$purity)) < min_purity)) {
fSuSiE.obj$cs <- list(NULL)
fSuSiE.obj$sets <- list(cs = list(NULL), requested_coverage = cov_lev)
fSuSiE.obj$cs_corr <- NULL # Set cs correlations to NULL if no credible sets meet purity criteria
Expand Down
4 changes: 2 additions & 2 deletions man/fsusie_wrapper.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading