Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

quantile_twas_weight.R and add functions in misc.R #258

Merged
merged 6 commits into from
Sep 27, 2024
Merged

Conversation

al4225
Copy link
Contributor

@al4225 al4225 commented Sep 26, 2024

No description provided.

NAMESPACE Outdated
@@ -15,10 +15,12 @@ export(bayes_n_rss_weights)
export(bayes_n_weights)
export(bayes_r_rss_weights)
export(bayes_r_weights)
export(calculate_qr_and_pseudo_R2)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets make this internal functions not to be exported.

NAMESPACE Outdated
export(clean_context_names)
export(coloc_post_processor)
export(coloc_wrapper)
export(compute_qtl_enrichment)
export(corr_filter)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also make this internal

#' @param top_percent Percentage of top SNPs to select
#' @return A list containing various results from the QR screen
#' @export
qr_screen <- function(X, Y, Z = NULL, tau.list, threshold = 0.05, method = 'qvalue', top_count = 10, top_percent = 15) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's give tau.list a default of 0.05, 0.1, etc

}

ranks_list = lapply(tau.list, function(tau) {
suppressWarnings(rq.fit.br(zz, y, tau = tau)$dual - (1 - tau))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you know why they suppressWarning? i worry by doing so we high something funky ..

}

if (!is.null(Z)) {
xstar = lm(x ~ zz - 1)$residual
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you check if .lm.fit(zz,x)$residual works and give same results? This is a faster implementation than lm

#' @param final_clump_r2 R-squared threshold for final LD clumping based on MAF
#' @return A list containing final SNPs and clumped SNPs
#' @export
perform_clumping_and_pruning <- function(X, qr_results, maf_list = NULL, ld_clump_r2 = 0.2, final_clump_r2 = 0.8) {
Copy link
Contributor

@gaow gaow Sep 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you change the function name to multi_quantile_ld_clumping to better reflect what it does?

@gaow gaow merged commit ddacbe5 into cumc:main Sep 27, 2024
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants