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,
  fitRetention = c("none", "slim", "full"),
  dataDrivenPriorMatrices = NULL,
  methodArgs = MrmashOptions()
)

Arguments

mrmashFit

Optional fitted mr.mash object.

X

Genotype matrix. Required when `mrmashFit` is NULL.

Y

Phenotype matrix. Required when `mrmashFit` is NULL.

fitRetention

How much of the mr.mash fit is kept as the "fit" attribute of the returned weights. "none" (default) attaches nothing. "slim" keeps what fineMappingPipeline needs to rebuild the mvSuSiE reweighted mixture prior and residual variance — the original dataDrivenPriorMatrices, the fitted w0 and V; the heavy coefficient matrix mu1 is already returned as the weights, so it is not duplicated. "full" additionally retains the complete fit under $fit, at the cost of a larger payload.

dataDrivenPriorMatrices

Optional list of data-driven prior covariance matrices; forwarded to mrmashWrapper when it has to fit, and retained in the payload for mvSuSiE prior reconstruction.

methodArgs

Options forwarded to mr.mashr::mr.mash, built with MrmashOptions. A bare list is refused: it cannot be checked against the engine, so a misspelled option would be silently ignored.

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,
  prior = MrmashPriorParam(canonicalPriorMatrices = TRUE))
mrmashWeights(mrmashFit = fit, X = X, Y = Y)
#>                                              cond_1        cond_2        cond_3
#> chr8:27119632_TA_T                     5.561157e-05  4.353552e-05  5.882309e-05
#> chr8:27119646_A_AG                     3.091589e-05  1.402586e-04 -2.235102e-05
#> chr8:27119646_A_G                      9.560354e-06  4.757901e-05 -5.146408e-05
#> chr8:27119788_C_T                      8.471383e-05  6.740792e-05 -2.154474e-05
#> chr8:27119867_G_T                      8.472866e-05  6.742221e-05 -2.154701e-05
#> chr8:27119961_G_T                      1.259163e-04  2.154958e-04  2.590358e-04
#> chr8:27120636_C_T                     -1.811401e-05 -1.386416e-04 -1.557291e-04
#> chr8:27120932_A_G                      1.151670e-04  4.785297e-05 -6.201110e-05
#> chr8:27121290_T_C                      3.662632e-05  1.738812e-04 -5.609926e-05
#> chr8:27121498_C_A                      3.663368e-05  1.739231e-04 -5.609879e-05
#> chr8:27121702_G_A                      3.724500e-05  1.412913e-04  8.994980e-05
#> chr8:27121936_A_G                      9.556160e-06  4.759476e-05 -5.147337e-05
#> chr8:27122117_CAA_C                    1.723840e-05  2.475239e-04  9.116128e-05
#> chr8:27122117_CAAA_C                   6.841359e-05  1.976078e-06 -1.005971e-04
#> chr8:27122139_A_C                      9.079583e-05  1.689728e-04  2.328842e-04
#> chr8:27122351_G_A                      4.157063e-05  1.794141e-04 -6.555982e-05
#> chr8:27123070_G_C                      3.551801e-05  7.676549e-05 -1.576414e-04
#> chr8:27123164_C_T                      7.587637e-06  3.150173e-05 -1.000834e-04
#> chr8:27123274_T_TG                     1.308465e-04  2.105558e-04  2.719221e-04
#> chr8:27123283_T_TTTTTGTTTTGTTTTG      -5.253190e-05 -1.094583e-04 -2.245266e-04
#> chr8:27123283_T_TTTTTGTTTTG            9.317361e-05  1.465886e-04  1.583357e-05
#> chr8:27123283_T_TTTTTGTTTTGTTTTGTTTTG -5.950334e-05  1.644634e-04  3.194985e-05
#> chr8:27123383_C_T                      3.583511e-05  8.445032e-05 -1.489388e-04
#> chr8:27123630_G_C                      2.284435e-05  6.511778e-05 -1.630939e-04
#> chr8:27123806_T_C                      3.583813e-05  8.447227e-05 -1.489869e-04
#> chr8:27124049_A_G                      3.584106e-05  8.448532e-05 -1.490090e-04
#> chr8:27124126_T_C                     -1.816144e-05 -1.387204e-04 -1.558414e-04
#> chr8:27124147_C_A                      3.584089e-05  8.448830e-05 -1.490432e-04
#> chr8:27124381_A_G                     -9.121265e-05 -2.123641e-04  1.268456e-05
#> chr8:27124644_G_A                      9.544141e-06  4.762289e-05 -5.154593e-05
#> chr8:27124683_C_T                     -1.817219e-05 -1.387474e-04 -1.558845e-04
#> chr8:27125591_C_G                     -9.123199e-05 -2.124090e-04  1.268015e-05
#> chr8:27125730_A_G                      9.432441e-06  1.756418e-04  1.517393e-04
#> chr8:27125829_T_A                     -8.776534e-05 -2.067139e-04  1.851120e-05
#> chr8:27126386_A_G                     -2.021173e-05 -2.999509e-05 -2.688315e-04
#> chr8:27126486_C_T                      9.547449e-06  4.763605e-05 -5.155878e-05
#> chr8:27127215_T_A                      3.647886e-05  1.569378e-04 -2.510399e-05
#> chr8:27127370_T_C                     -8.032067e-05 -1.570609e-04 -1.062575e-05
#> chr8:27127374_T_C                     -8.033725e-05 -1.570895e-04 -1.063530e-05
#> chr8:27127405_T_C                      9.553130e-06  4.764787e-05 -5.155805e-05
#> chr8:27128069_G_A                      3.586610e-05  8.455903e-05 -1.491277e-04
#> chr8:27128102_T_TAAAG                  2.770459e-05  7.261775e-05 -1.722385e-04
#> chr8:27128473_C_G                      1.322068e-04  1.967175e-04  2.814321e-04
#> chr8:27128733_G_T                     -1.819553e-05 -1.387913e-04 -1.559689e-04
#> chr8:27129375_G_GA                     3.584232e-05  8.453960e-05 -1.492360e-04
#> chr8:27129602_T_C                      2.809430e-05  8.742965e-05 -1.721622e-04
#> chr8:27129674_A_G                      3.584601e-05  8.456538e-05 -1.492865e-04
#> chr8:27129849_TAAA_T                   1.407135e-04  2.028497e-04  2.891943e-04
#> chr8:27129864_G_A                      8.801942e-05  1.421412e-04  2.335309e-04
#> chr8:27129921_C_T                      8.937974e-05  2.276729e-04  1.154284e-04
#> chr8:27130038_G_A                      1.324769e-04  1.970244e-04  2.818949e-04
#> chr8:27130250_G_C                     -9.808644e-05 -1.830013e-04  3.437385e-06
#> chr8:27130586_G_C                      3.578302e-05  8.448718e-05 -1.494439e-04
#> chr8:27130820_A_T                      3.644281e-05  1.569637e-04 -2.525233e-05
#> chr8:27131153_G_T                      9.531587e-06  4.763832e-05 -5.164134e-05
#> chr8:27131169_T_A                     -9.811128e-05 -1.830542e-04  3.433311e-06
#> chr8:27131173_C_T                      9.253716e-05  1.367759e-04  2.367578e-04
#> chr8:27131449_G_A                      7.740674e-05  6.239321e-05 -4.925159e-05
#> chr8:27131584_G_A                      3.578542e-05  8.451843e-05 -1.495075e-04
#> chr8:27132152_T_C                      3.644945e-05  1.570140e-04 -2.528394e-05
#>                                              cond_4        cond_5        cond_6
#> chr8:27119632_TA_T                     1.333211e-04  1.348553e-04  4.734385e-04
#> chr8:27119646_A_AG                    -6.910111e-05 -2.101112e-05 -1.104293e-04
#> chr8:27119646_A_G                     -2.529216e-05  5.465448e-05 -1.995286e-04
#> chr8:27119788_C_T                     -2.002414e-04  6.673100e-06  1.314975e-04
#> chr8:27119867_G_T                     -2.003132e-04  6.675583e-06  1.314728e-04
#> chr8:27119961_G_T                      1.590978e-04  2.123016e-04  5.450551e-04
#> chr8:27120636_C_T                     -5.716944e-05 -6.470740e-05 -2.431535e-04
#> chr8:27120932_A_G                     -8.971807e-05  6.455779e-05  1.552973e-04
#> chr8:27121290_T_C                     -8.869541e-05  1.441139e-05 -2.548621e-04
#> chr8:27121498_C_A                     -8.871171e-05  1.441796e-05 -2.547996e-04
#> chr8:27121702_G_A                     -4.984068e-05  7.170860e-05  1.941631e-04
#> chr8:27121936_A_G                     -2.529681e-05  5.465705e-05 -1.994059e-04
#> chr8:27122117_CAA_C                    9.633365e-05  1.053657e-04 -1.532798e-04
#> chr8:27122117_CAAA_C                  -2.200955e-04 -3.853014e-05  4.463472e-05
#> chr8:27122139_A_C                      1.370686e-04  2.574996e-04  5.041369e-04
#> chr8:27122351_G_A                     -8.512209e-05 -1.300445e-05 -2.352769e-04
#> chr8:27123070_G_C                     -1.038997e-04 -4.387650e-05 -4.528299e-04
#> chr8:27123164_C_T                     -9.365608e-05 -3.714829e-05 -8.009951e-04
#> chr8:27123274_T_TG                     1.854900e-04  2.644445e-04  5.342365e-04
#> chr8:27123283_T_TTTTTGTTTTGTTTTG      -8.398393e-05 -1.092985e-04 -5.937819e-04
#> chr8:27123283_T_TTTTTGTTTTG           -1.778457e-04  4.061584e-05  1.767367e-04
#> chr8:27123283_T_TTTTTGTTTTGTTTTGTTTTG  3.951229e-05 -1.422705e-04 -3.014142e-03
#> chr8:27123383_C_T                     -1.138789e-04 -5.314172e-05 -4.721660e-04
#> chr8:27123630_G_C                     -1.264694e-04 -5.577567e-05 -4.449484e-04
#> chr8:27123806_T_C                     -1.139178e-04 -5.315673e-05 -4.719245e-04
#> chr8:27124049_A_G                     -1.139360e-04 -5.316346e-05 -4.717986e-04
#> chr8:27124126_T_C                     -5.722742e-05 -6.478380e-05 -2.430545e-04
#> chr8:27124147_C_A                     -1.139588e-04 -5.317554e-05 -4.716639e-04
#> chr8:27124381_A_G                      1.876981e-06 -1.556162e-04 -9.931371e-05
#> chr8:27124644_G_A                     -2.534452e-05  5.463083e-05 -1.990342e-04
#> chr8:27124683_C_T                     -5.725052e-05 -6.480476e-05 -2.430431e-04
#> chr8:27125591_C_G                      1.875551e-06 -1.556515e-04 -9.932089e-05
#> chr8:27125730_A_G                      6.736144e-05  6.774776e-05 -5.829053e-05
#> chr8:27125829_T_A                      2.049563e-05 -1.574088e-04 -8.071568e-05
#> chr8:27126386_A_G                     -1.378124e-04 -9.942913e-05 -3.702242e-04
#> chr8:27126486_C_T                     -2.535353e-05  5.464137e-05 -1.989828e-04
#> chr8:27127215_T_A                     -7.735518e-05 -6.126329e-05 -1.077756e-04
#> chr8:27127370_T_C                      1.300924e-06 -1.473641e-04 -5.850030e-06
#> chr8:27127374_T_C                      1.296814e-06 -1.473966e-04 -5.861474e-06
#> chr8:27127405_T_C                     -2.535314e-05  5.465817e-05 -1.989349e-04
#> chr8:27128069_G_A                     -1.140204e-04 -5.315913e-05 -4.713806e-04
#> chr8:27128102_T_TAAAG                 -1.184147e-04 -4.909263e-05 -5.141105e-04
#> chr8:27128473_C_G                      1.767733e-04  2.769283e-04  4.191423e-04
#> chr8:27128733_G_T                     -5.729842e-05 -6.484377e-05 -2.430232e-04
#> chr8:27129375_G_GA                    -1.140905e-04 -5.321474e-05 -4.710977e-04
#> chr8:27129602_T_C                     -1.199968e-04 -6.626761e-05 -5.032951e-04
#> chr8:27129674_A_G                     -1.141300e-04 -5.323111e-05 -4.708447e-04
#> chr8:27129849_TAAA_T                   1.804257e-04  2.811869e-04  4.823381e-04
#> chr8:27129864_G_A                      1.424290e-04  2.854854e-04  3.564056e-04
#> chr8:27129921_C_T                      3.099902e-05  7.175046e-05  2.263813e-04
#> chr8:27130038_G_A                      1.770908e-04  2.773634e-04  4.191287e-04
#> chr8:27130250_G_C                     -1.692897e-06 -1.659237e-04 -2.264446e-05
#> chr8:27130586_G_C                     -1.142258e-04 -5.333946e-05 -4.706427e-04
#> chr8:27130820_A_T                     -7.749873e-05 -6.138095e-05 -1.075699e-04
#> chr8:27131153_G_T                     -2.541236e-05  5.461350e-05 -1.987414e-04
#> chr8:27131169_T_A                     -1.690024e-06 -1.659619e-04 -2.268293e-05
#> chr8:27131173_C_T                      1.354655e-04  3.000547e-04  3.670448e-04
#> chr8:27131449_G_A                     -2.147928e-04 -1.319231e-05  9.490031e-05
#> chr8:27131584_G_A                     -1.142940e-04 -5.337398e-05 -4.704558e-04
#> chr8:27132152_T_C                     -7.756371e-05 -6.141394e-05 -1.075415e-04
#>                                              cond_7
#> chr8:27119632_TA_T                    -9.704702e-05
#> chr8:27119646_A_AG                     1.429368e-04
#> chr8:27119646_A_G                      2.879034e-04
#> chr8:27119788_C_T                      1.405872e-04
#> chr8:27119867_G_T                      1.406030e-04
#> chr8:27119961_G_T                      2.503668e-05
#> chr8:27120636_C_T                     -4.317789e-04
#> chr8:27120932_A_G                     -7.098063e-06
#> chr8:27121290_T_C                      4.083336e-04
#> chr8:27121498_C_A                      4.084085e-04
#> chr8:27121702_G_A                     -1.328556e-04
#> chr8:27121936_A_G                      2.879520e-04
#> chr8:27122117_CAA_C                    2.099835e-04
#> chr8:27122117_CAAA_C                   5.638159e-05
#> chr8:27122139_A_C                      5.045142e-05
#> chr8:27122351_G_A                      3.583430e-04
#> chr8:27123070_G_C                      5.623094e-05
#> chr8:27123164_C_T                     -1.913291e-05
#> chr8:27123274_T_TG                     5.248590e-05
#> chr8:27123283_T_TTTTTGTTTTGTTTTG       1.707420e-04
#> chr8:27123283_T_TTTTTGTTTTG            1.742456e-04
#> chr8:27123283_T_TTTTTGTTTTGTTTTGTTTTG -2.955389e-05
#> chr8:27123383_C_T                      6.330575e-05
#> chr8:27123630_G_C                      6.539634e-05
#> chr8:27123806_T_C                      6.329283e-05
#> chr8:27124049_A_G                      6.328707e-05
#> chr8:27124126_T_C                     -4.320143e-04
#> chr8:27124147_C_A                      6.326784e-05
#> chr8:27124381_A_G                      2.139878e-05
#> chr8:27124644_G_A                      2.879343e-04
#> chr8:27124683_C_T                     -4.321161e-04
#> chr8:27125591_C_G                      2.139001e-05
#> chr8:27125730_A_G                      3.473118e-05
#> chr8:27125829_T_A                      2.401481e-05
#> chr8:27126386_A_G                     -2.741196e-05
#> chr8:27126486_C_T                      2.879527e-04
#> chr8:27127215_T_A                      1.320914e-04
#> chr8:27127370_T_C                      6.711706e-05
#> chr8:27127374_T_C                      6.711051e-05
#> chr8:27127405_T_C                      2.879721e-04
#> chr8:27128069_G_A                      6.325768e-05
#> chr8:27128102_T_TAAAG                  7.982487e-05
#> chr8:27128473_C_G                      1.818387e-05
#> chr8:27128733_G_T                     -4.322606e-04
#> chr8:27129375_G_GA                     6.320538e-05
#> chr8:27129602_T_C                      5.942468e-05
#> chr8:27129674_A_G                      6.319180e-05
#> chr8:27129849_TAAA_T                   2.356410e-05
#> chr8:27129864_G_A                      2.581809e-05
#> chr8:27129921_C_T                      5.380233e-05
#> chr8:27130038_G_A                      1.848457e-05
#> chr8:27130250_G_C                      4.262235e-05
#> chr8:27130586_G_C                      6.310877e-05
#> chr8:27130820_A_T                      1.320125e-04
#> chr8:27131153_G_T                      2.879287e-04
#> chr8:27131169_T_A                      4.261182e-05
#> chr8:27131173_C_T                      3.802855e-05
#> chr8:27131449_G_A                      1.154618e-04
#> chr8:27131584_G_A                      6.309798e-05
#> chr8:27132152_T_C                      1.320102e-04