stephenslab / susieR

R package for "sum of single effects" regression.
https://stephenslab.github.io/susieR
Other
174 stars 44 forks source link

fix bug in susie_rss when passing a named z vector #113

Closed chr1swallace closed 3 years ago

chr1swallace commented 3 years ago

To see bug, try

data(N3finemapping)
attach(N3finemapping)
sumstats <- univariate_regression(X, Y[,1])
z_scores <- sumstats$betahat / sumstats$sebetahat
R <- cor(X)
## this runs fine
fitted_rss <- susie_rss(z_scores, R, L = 10,
                          estimate_residual_variance = TRUE,
                        estimate_prior_variance = TRUE)
## add names to z
names(z_scores)=paste0("nm",1:length(z_scores))
## this errors
fitted_rss <- susie_rss(z_scores, R, L = 10,
                          estimate_residual_variance = TRUE,
                        estimate_prior_variance = TRUE)
#Error in susie_rss(z_scores, R, L = 10, estimate_residual_variance = TRUE,  :
#  object 'x' not found```
The fix simply upcases x in the lines
```   if (!is.null(names(z)))
    colnames(x) = names(z)
gaow commented 3 years ago

Thanks @chr1swallace for catching and fixing it!

chr1swallace commented 3 years ago

np - thanks for the great work and quick response!

On Fri, 2020-12-04 at 04:20 -0800, gaow wrote:

Thanks @chr1swallace for catching and fixing it!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.