stephenslab / mashr

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

warning message in cov_ed #81

Closed Young-Sook closed 4 years ago

Young-Sook commented 4 years ago

Hi, I am having another issue with running mashr. I am using common control. When I use 'cov_ed' function (U.ed = cov_ed(data.strong, U.pca)), I have a warning message below.

1: In data$V * data$Shat[i, ] :
  longer object length is not a multiple of shorter object length
.
.
.
50: In data$Shat[i, ] * t(data$V * data$Shat[i, ]) :
  longer object length is not a multiple of shorter object length

I think the warning message occurs because data$V is a 5 by 5 matrix while data$Shat[i, ] has 4 columns. I am assuming this is a bug that happens due to not controlling for the common control case? This is my script.

data = mash_set_data(data_mean, data_std)
data = mash_update_data(data, ref = 1, V=data_V)

m.1by1 = mash_1by1(data)
strong.subset = get_significant_results(m.1by1)
data.strong = mash_set_data(data_mean[strong.subset,], data_std[strong.subset,])
data.strong = mash_update_data(data.strong, ref = 1, V=data_V)

U.pca = cov_pca(data.strong, cellNum)
U.ed = cov_ed(data.strong, U.pca)
U.c = cov_canonical(data)

final_m =  mash(data, Ulist = c(U.ed,U.c))

This error message doesn't stop running mashr but I am wondering if this can affect results. Thanks a lot!

zouyuxin commented 4 years ago

Thanks for catching the bug. We ignored a case in cov_ed. Please update the package.

Young-Sook commented 4 years ago

Thanks for the quick response. I just reinstalled mashr with the following command, but I still have the same error.

devtools::install_github("stephenslab/mashr")

The fixed script was not updated in the package somehow?

zouyuxin commented 4 years ago

sorry, please try again.

Young-Sook commented 4 years ago

It now works! Thanks a lot!