Skip to contents

Extracts coefficients from an existing mr.mash fit or fits mr.mash from `X` and `Y`.

Usage

mrmashWeights(
  mrmashFit = NULL,
  X = NULL,
  Y = NULL,
  retainFit = FALSE,
  fitDetail = c("slim", "full"),
  ...
)

Arguments

mrmashFit

Optional fitted mr.mash object.

X

Genotype matrix. Required when `mrmashFit` is NULL.

Y

Phenotype matrix. Required when `mrmashFit` is NULL.

retainFit

If TRUE, attach (as the `"fit"` attribute of the returned weights) the parts of the mr.mash fit that `fineMappingPipeline` needs to rebuild the mvSuSiE reweighted mixture prior + residual variance: the original data-driven prior matrices (`dataDrivenPriorMatrices`), the fitted mixture weights (`w0`) and the residual covariance (`V`). Default FALSE.

fitDetail

How much of the fit to retain when `retainFit = TRUE`. `"slim"` (default) keeps only the three reconstruction inputs above; the heavy coefficient matrix (`mu1`) is already returned as the weights, so it is not duplicated. `"full"` additionally retains the complete mr.mash fit under `$fit` (consistent with how susie fits are kept), at the cost of a larger payload.

...

Additional arguments passed to `mrmashWrapper()` when fitting.

Value

Matrix of variant weights.

Examples

data(multiTraitData)
X <- multiTraitData$X[, 1:60]
Y <- multiTraitData$Y
ddpm <- multiTraitData$priorMatrices
fit <- mrmashWrapper(X = X, Y = Y, dataDrivenPriorMatrices = ddpm,
  canonicalPriorMatrices = TRUE)
mrmashWeights(mrmashFit = fit, X = X, Y = Y)
#>                                              cond_1        cond_2        cond_3
#> chr8:27119632_TA_T                     3.926032e-06 -3.789403e-06  6.732549e-06
#> chr8:27119646_A_AG                     4.501269e-06  9.469725e-05 -2.019392e-05
#> chr8:27119646_A_G                      2.037815e-07  2.102573e-05 -4.187794e-05
#> chr8:27119788_C_T                      1.476780e-05  3.129175e-05 -2.298430e-05
#> chr8:27119867_G_T                      1.477062e-05  3.130056e-05 -2.298594e-05
#> chr8:27119961_G_T                      1.746138e-05  6.407067e-05  1.138481e-04
#> chr8:27120636_C_T                      5.507297e-06 -3.990886e-05 -5.759441e-05
#> chr8:27120932_A_G                      2.393792e-05  1.770706e-05 -5.485177e-05
#> chr8:27121290_T_C                      4.393440e-06  1.149005e-04 -4.692015e-05
#> chr8:27121498_C_A                      4.393508e-06  1.149355e-04 -4.692441e-05
#> chr8:27121702_G_A                      3.013045e-06  7.445252e-05  4.231840e-05
#> chr8:27121936_A_G                      2.024298e-07  2.103260e-05 -4.188839e-05
#> chr8:27122117_CAA_C                   -4.506896e-06  1.433392e-04  1.827733e-05
#> chr8:27122117_CAAA_C                   1.837630e-05  1.162918e-05 -5.733535e-05
#> chr8:27122139_A_C                      1.027007e-05  3.975640e-05  9.609508e-05
#> chr8:27122351_G_A                      5.743508e-06  1.250097e-04 -5.162139e-05
#> chr8:27123070_G_C                      1.118135e-05  6.613984e-05 -1.063559e-04
#> chr8:27123164_C_T                      6.595962e-06  4.048133e-05 -4.393814e-05
#> chr8:27123274_T_TG                     1.995417e-05  5.537742e-05  1.149785e-04
#> chr8:27123283_T_TTTTTGTTTTGTTTTG      -1.988219e-06 -2.395888e-05 -1.293925e-04
#> chr8:27123283_T_TTTTTGTTTTG            1.233131e-05  7.143412e-05 -1.254910e-05
#> chr8:27123283_T_TTTTTGTTTTGTTTTGTTTTG -6.241613e-06  1.359054e-04  3.278866e-05
#> chr8:27123383_C_T                      1.134852e-05  7.282744e-05 -9.509144e-05
#> chr8:27123630_G_C                      9.186038e-06  6.172957e-05 -1.047591e-04
#> chr8:27123806_T_C                      1.134992e-05  7.285371e-05 -9.513343e-05
#> chr8:27124049_A_G                      1.135077e-05  7.286788e-05 -9.515339e-05
#> chr8:27124126_T_C                      5.504495e-06 -3.992311e-05 -5.763455e-05
#> chr8:27124147_C_A                      1.135186e-05  7.287863e-05 -9.517928e-05
#> chr8:27124381_A_G                     -1.105243e-05 -1.277453e-04  3.668531e-05
#> chr8:27124644_G_A                      2.012164e-07  2.105836e-05 -4.193787e-05
#> chr8:27124683_C_T                      5.504797e-06 -3.992566e-05 -5.764992e-05
#> chr8:27125591_C_G                     -1.105435e-05 -1.277852e-04  3.668971e-05
#> chr8:27125730_A_G                     -3.844123e-06  9.070105e-05  8.250115e-05
#> chr8:27125829_T_A                     -1.091464e-05 -1.261672e-04  3.765076e-05
#> chr8:27126386_A_G                      4.270056e-06  1.884573e-05 -1.998164e-04
#> chr8:27126486_C_T                      2.012162e-07  2.106481e-05 -4.195111e-05
#> chr8:27127215_T_A                      6.128784e-06  1.144039e-04 -1.892095e-05
#> chr8:27127370_T_C                     -1.038832e-05 -8.529731e-05  1.463971e-05
#> chr8:27127374_T_C                     -1.038980e-05 -8.531470e-05  1.464038e-05
#> chr8:27127405_T_C                      2.012140e-07  2.106768e-05 -4.195578e-05
#> chr8:27128069_G_A                      1.135591e-05  7.294687e-05 -9.527118e-05
#> chr8:27128102_T_TAAAG                  9.836301e-06  6.540146e-05 -1.164351e-04
#> chr8:27128473_C_G                      1.941561e-05  4.928636e-05  1.304373e-04
#> chr8:27128733_G_T                      5.504210e-06 -3.992834e-05 -5.768604e-05
#> chr8:27129375_G_GA                     1.135563e-05  7.296122e-05 -9.534647e-05
#> chr8:27129602_T_C                      1.034004e-05  7.940491e-05 -1.130948e-04
#> chr8:27129674_A_G                      1.135713e-05  7.299100e-05 -9.539102e-05
#> chr8:27129849_TAAA_T                   2.171043e-05  5.079266e-05  1.327577e-04
#> chr8:27129864_G_A                      9.455626e-06  2.730042e-05  1.020104e-04
#> chr8:27129921_C_T                      8.363731e-06  1.199784e-04  3.455025e-05
#> chr8:27130038_G_A                      1.947286e-05  4.935485e-05  1.306678e-04
#> chr8:27130250_G_C                     -1.310930e-05 -1.017498e-04  2.779905e-05
#> chr8:27130586_G_C                      1.135305e-05  7.298117e-05 -9.548307e-05
#> chr8:27130820_A_T                      6.128443e-06  1.145036e-04 -1.898171e-05
#> chr8:27131153_G_T                      2.003445e-07  2.107745e-05 -4.200082e-05
#> chr8:27131169_T_A                     -1.311184e-05 -1.017903e-04  2.780527e-05
#> chr8:27131173_C_T                      1.036966e-05  2.387391e-05  1.032979e-04
#> chr8:27131449_G_A                      1.524926e-05  3.458600e-05 -3.448722e-05
#> chr8:27131584_G_A                      1.135478e-05  7.302427e-05 -9.553086e-05
#> chr8:27132152_T_C                      6.130267e-06  1.145748e-04 -1.899502e-05
#>                                              cond_4        cond_5        cond_6
#> chr8:27119632_TA_T                     4.474084e-05  3.963985e-05  4.624895e-04
#> chr8:27119646_A_AG                    -4.519086e-05 -1.184122e-05 -1.118240e-04
#> chr8:27119646_A_G                     -1.809428e-05  1.712106e-05 -2.146168e-04
#> chr8:27119788_C_T                     -1.946295e-04 -3.190328e-06  1.143092e-04
#> chr8:27119867_G_T                     -1.947446e-04 -3.189691e-06  1.142836e-04
#> chr8:27119961_G_T                      3.011803e-05  5.266104e-05  4.650028e-04
#> chr8:27120636_C_T                      3.438394e-06 -1.355681e-06 -1.684697e-04
#> chr8:27120932_A_G                     -6.586693e-05  1.792296e-05  1.364359e-04
#> chr8:27121290_T_C                     -6.280868e-05 -5.849190e-07 -2.696518e-04
#> chr8:27121498_C_A                     -6.282743e-05 -5.853494e-07 -2.695948e-04
#> chr8:27121702_G_A                     -3.827472e-05  1.901074e-05  1.662444e-04
#> chr8:27121936_A_G                     -1.809892e-05  1.711941e-05 -2.145002e-04
#> chr8:27122117_CAA_C                    1.601421e-05  1.872184e-05 -2.114395e-04
#> chr8:27122117_CAAA_C                  -1.739562e-04 -8.873810e-06  6.010234e-05
#> chr8:27122139_A_C                      2.268297e-05  9.032693e-05  4.230287e-04
#> chr8:27122351_G_A                     -5.713883e-05 -9.080467e-06 -2.425204e-04
#> chr8:27123070_G_C                     -4.385788e-05 -7.983783e-06 -4.559716e-04
#> chr8:27123164_C_T                     -3.127722e-05 -2.333419e-06 -8.979119e-04
#> chr8:27123274_T_TG                     3.961885e-05  8.059178e-05  4.333781e-04
#> chr8:27123283_T_TTTTTGTTTTGTTTTG      -1.121504e-05 -1.864605e-05 -6.000345e-04
#> chr8:27123283_T_TTTTTGTTTTG           -1.915478e-04  2.001657e-06  1.377428e-04
#> chr8:27123283_T_TTTTTGTTTTGTTTTGTTTTG  2.724355e-05 -4.795905e-05 -3.984454e-03
#> chr8:27123383_C_T                     -4.999063e-05 -1.105883e-05 -4.783490e-04
#> chr8:27123630_G_C                     -5.549163e-05 -1.029656e-05 -4.383279e-04
#> chr8:27123806_T_C                     -5.001217e-05 -1.106203e-05 -4.780825e-04
#> chr8:27124049_A_G                     -5.002280e-05 -1.106367e-05 -4.779469e-04
#> chr8:27124126_T_C                      3.434664e-06 -1.366595e-06 -1.683342e-04
#> chr8:27124147_C_A                     -5.003302e-05 -1.106550e-05 -4.777845e-04
#> chr8:27124381_A_G                      2.332101e-05 -5.630896e-05 -5.307949e-05
#> chr8:27124644_G_A                     -1.811968e-05  1.711097e-05 -2.141393e-04
#> chr8:27124683_C_T                      3.432187e-06 -1.367878e-06 -1.682929e-04
#> chr8:27125591_C_G                      2.332582e-05 -5.632620e-05 -5.307333e-05
#> chr8:27125730_A_G                      1.269078e-05  1.144451e-05 -1.027015e-04
#> chr8:27125829_T_A                      3.162547e-05 -6.068210e-05 -3.931949e-05
#> chr8:27126386_A_G                     -4.096147e-05 -1.647614e-05 -3.094604e-04
#> chr8:27126486_C_T                     -1.812571e-05  1.711413e-05 -2.140928e-04
#> chr8:27127215_T_A                     -4.730551e-05 -2.839074e-05 -1.033368e-04
#> chr8:27127370_T_C                      1.783885e-05 -5.933137e-05  2.632153e-05
#> chr8:27127374_T_C                      1.784168e-05 -5.934923e-05  2.632186e-05
#> chr8:27127405_T_C                     -1.812874e-05  1.711868e-05 -2.140546e-04
#> chr8:27128069_G_A                     -5.007579e-05 -1.105821e-05 -4.774639e-04
#> chr8:27128102_T_TAAAG                 -5.042906e-05 -8.456500e-06 -5.258567e-04
#> chr8:27128473_C_G                      3.677770e-05  9.421398e-05  3.004505e-04
#> chr8:27128733_G_T                      3.424790e-06 -1.370991e-06 -1.682268e-04
#> chr8:27129375_G_GA                    -5.010121e-05 -1.106872e-05 -4.770997e-04
#> chr8:27129602_T_C                     -4.971394e-05 -1.401339e-05 -5.081541e-04
#> chr8:27129674_A_G                     -5.012312e-05 -1.107236e-05 -4.768218e-04
#> chr8:27129849_TAAA_T                   3.725135e-05  9.335356e-05  3.692875e-04
#> chr8:27129864_G_A                      2.651907e-05  1.238771e-04  2.532362e-04
#> chr8:27129921_C_T                     -1.304000e-05  6.144133e-06  1.603080e-04
#> chr8:27130038_G_A                      3.685294e-05  9.440650e-05  3.001467e-04
#> chr8:27130250_G_C                      1.949830e-05 -6.740531e-05  1.701339e-05
#> chr8:27130586_G_C                     -5.014681e-05 -1.109498e-05 -4.764754e-04
#> chr8:27130820_A_T                     -4.736912e-05 -2.842929e-05 -1.031011e-04
#> chr8:27131153_G_T                     -1.814690e-05  1.710762e-05 -2.138379e-04
#> chr8:27131169_T_A                      1.950616e-05 -6.742521e-05  1.699440e-05
#> chr8:27131173_C_T                      2.299248e-05  1.381724e-04  2.631766e-04
#> chr8:27131449_G_A                     -1.996126e-04 -6.858017e-06  8.812148e-05
#> chr8:27131584_G_A                     -5.018635e-05 -1.110532e-05 -4.762285e-04
#> chr8:27132152_T_C                     -4.741076e-05 -2.844323e-05 -1.030598e-04
#>                                              cond_7
#> chr8:27119632_TA_T                    -1.280277e-04
#> chr8:27119646_A_AG                     1.130574e-04
#> chr8:27119646_A_G                      2.716412e-04
#> chr8:27119788_C_T                      1.020058e-04
#> chr8:27119867_G_T                      1.020199e-04
#> chr8:27119961_G_T                     -6.866625e-05
#> chr8:27120636_C_T                     -3.758018e-04
#> chr8:27120932_A_G                     -1.814751e-05
#> chr8:27121290_T_C                      4.171621e-04
#> chr8:27121498_C_A                      4.172862e-04
#> chr8:27121702_G_A                     -1.374228e-04
#> chr8:27121936_A_G                      2.717355e-04
#> chr8:27122117_CAA_C                    1.225954e-04
#> chr8:27122117_CAAA_C                   5.649308e-05
#> chr8:27122139_A_C                     -4.022395e-05
#> chr8:27122351_G_A                      3.551255e-04
#> chr8:27123070_G_C                      6.351743e-05
#> chr8:27123164_C_T                      1.316205e-05
#> chr8:27123274_T_TG                    -5.297950e-05
#> chr8:27123283_T_TTTTTGTTTTGTTTTG       2.190373e-04
#> chr8:27123283_T_TTTTTGTTTTG            1.125716e-04
#> chr8:27123283_T_TTTTTGTTTTGTTTTGTTTTG  7.761714e-07
#> chr8:27123383_C_T                      7.004714e-05
#> chr8:27123630_G_C                      7.661292e-05
#> chr8:27123806_T_C                      7.004346e-05
#> chr8:27124049_A_G                      7.004134e-05
#> chr8:27124126_T_C                     -3.760510e-04
#> chr8:27124147_C_A                      7.002987e-05
#> chr8:27124381_A_G                      5.146643e-05
#> chr8:27124644_G_A                      2.717775e-04
#> chr8:27124683_C_T                     -3.761831e-04
#> chr8:27125591_C_G                      5.146930e-05
#> chr8:27125730_A_G                     -6.167579e-06
#> chr8:27125829_T_A                      4.986000e-05
#> chr8:27126386_A_G                      2.791427e-05
#> chr8:27126486_C_T                      2.718133e-04
#> chr8:27127215_T_A                      1.059942e-04
#> chr8:27127370_T_C                      8.205052e-05
#> chr8:27127374_T_C                      8.205567e-05
#> chr8:27127405_T_C                      2.718411e-04
#> chr8:27128069_G_A                      7.002150e-05
#> chr8:27128102_T_TAAAG                  8.695919e-05
#> chr8:27128473_C_G                     -7.911528e-05
#> chr8:27128733_G_T                     -3.763454e-04
#> chr8:27129375_G_GA                     7.000494e-05
#> chr8:27129602_T_C                      7.116033e-05
#> chr8:27129674_A_G                      7.000042e-05
#> chr8:27129849_TAAA_T                  -7.809356e-05
#> chr8:27129864_G_A                     -5.631478e-05
#> chr8:27129921_C_T                     -7.651094e-06
#> chr8:27130038_G_A                     -7.903485e-05
#> chr8:27130250_G_C                      6.616195e-05
#> chr8:27130586_G_C                      6.998662e-05
#> chr8:27130820_A_T                      1.059767e-04
#> chr8:27131153_G_T                      2.718556e-04
#> chr8:27131169_T_A                      6.616401e-05
#> chr8:27131173_C_T                     -4.732485e-05
#> chr8:27131449_G_A                      8.867366e-05
#> chr8:27131584_G_A                      6.999286e-05
#> chr8:27132152_T_C                      1.059847e-04