stephenslab / mashr

An R package for multivariate adaptive shrinkage.
https://stephenslab.github.io/mashr
Other
87 stars 19 forks source link

Potential issue of computing posterior summaries for a single test #118

Open ez-xyz opened 1 year ago

ez-xyz commented 1 year ago

I tried to follow the code in this vignette to compute the posterior summaries for a single test, but I got the following error message:

Error: each_row(): incompatible size; expected 1x1, got 1x12

Specifically, I modified the code in "Compute posterior summaries" section while keeping everything else the same:

single.test = mash_set_data(simdata$Bhat[1000,,drop=F],simdata$Shat[1000,,drop=F], V=Vhat) m2 = mash(single.test, g=get_fitted_g(m), fixg=TRUE)

pcarbo commented 1 year ago

@ez-xyz Did you mean to do this?

rows <- 1:1000
single.test <- mash_set_data(simdata$Bhat[rows,,drop = FALSE],simdata$Shat[rows,,drop = FALSE],V = Vhat)

The code you provided only selects one data point.

ez-xyz commented 1 year ago

@pcarbo In my application, I only want to compute the posterior summaries for one test (one eQTL). The example code I provided above mimics that situation by selecting the 1000th test.

pcarbo commented 1 year ago

@ez-xyz I don't have R right in front of me, but would setting rows <- c(1000, 1000) work, or setting rows <- c(1000, i), where i is a random row? There may be a bug in handling the special case of 1 row.

ez-xyz commented 1 year ago

@pcarbo Yes, subsetting more than one rows and then running mashr would work.