Skip to content

Commit

Permalink
Fix a bug of susie_weights_intermediate logic
Browse files Browse the repository at this point in the history
  • Loading branch information
gaow committed Sep 15, 2024
1 parent 904249b commit 1d2bb9d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions R/twas_weights.R
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,10 @@ twas_weights_pipeline <- function(X,
# TWAS weights and predictions
if (!is.null(susie_fit) && !is.null(weight_methods$susie_weights)) {
weight_methods$susie_weights <- list(susie_fit = susie_fit)
res$susie_weights_intermediate <- susie_fit[c("mu", "lbf_variable", "X_column_scale_factors")]
if (!is.null(susie_fit$sets$cs)) {
res$susie_weights_intermediate$cs_variants <- lapply(susie_fit$sets$cs, function(L) colnames(X)[L])
}
}
res$twas_weights <- twas_weights(X, y, weight_methods = weight_methods)
res$twas_predictions <- twas_predict(X, res$twas_weights)
Expand Down Expand Up @@ -481,10 +485,6 @@ twas_weights_pipeline <- function(X,
num_threads = cv_threads,
variants_to_keep = if (length(variants_for_cv) > 0) variants_for_cv else NULL
)
res$susie_weights_intermediate <- susie_fit[c("mu", "lbf_variable", "X_column_scale_factors")]
if (!is.null(susie_fit$sets$cs)) {
res$susie_weights_intermediate$cs_variants <- lapply(susie_fit$sets$cs, function(L) colnames(X)[L])
}
}
res$total_time_elapsed <- proc.time() - st

Expand Down

0 comments on commit 1d2bb9d

Please sign in to comment.