Skip to contents

Unified, S4-native replacement for the legacy load_multitrait_*_sumstat + mash_ran_null_sample assembly. Consumes a list of already-constructed objects (one per region) and returns the flat variants x conditions matrix list consumed by the MASH mixture-prior / fit / posterior steps.

Usage

mashInput(
  objects,
  nRandom = 10L,
  nNull = 10L,
  excludeCondition = character(0),
  coverage = 0.95,
  zOnly = FALSE,
  sigPCutoff = 1e-06,
  inputScale = c("auto", "beta", "z"),
  independentVariants = NULL,
  seed = 999L
)

Arguments

objects

A named list of QtlSumStats and/or FineMappingResult objects, one per region. Names disambiguate rownames across regions (defaults to region1, region2, ...). For QtlSumStats inputs summaryStatsQc must have been run (the matrix builder rejects un-QC'd SumStats).

nRandom, nNull

Per-object random / null sample sizes (default 10 each).

excludeCondition

Character vector of condition (column) names to drop.

coverage

Credible-set coverage for FineMappingResult strong selection (default 0.95).

zOnly

When TRUE the returned partitions carry only .z (the .b/.s matrices are dropped after z is derived).

sigPCutoff

Significance cutoff applied to the strong partition (default 1e-6).

inputScale

Matrix scale for QtlSumStats inputs ("auto"/"beta"/"z"); ignored for FineMappingResult (always effect-size scale).

independentVariants

Optional character vector of variant ids (e.g. an LD-pruned independent SNP list). When supplied, the random and null background of every object is restricted to variants that match this set, so the background carries no LD-correlated SNPs (which would bias the residual correlation and the mixture weights). Matching is delegated to matchVariants() (chrom/pos/allele aware, ref/alt flips tolerated), not a raw string compare, so a chr-prefix / separator / allele-order difference still matches. The strong partition is never filtered.

seed

RNG seed for the random / null sampling (default 999).

Value

A flat list: strong.b, strong.s, strong.z, random.*, null.* (each a variants x conditions matrix) and XtX (a conditions x conditions matrix). The .b / .s matrices are omitted when zOnly = TRUE.

Details

For EACH object three partitions are extracted:

strong

The high-signal variants (deterministic, class-specific). QtlSumStats: the single most significant variant (\(\max|z|\)) per condition, unioned. FineMappingResult: the lead variant (\(\max\) PIP) of each credible set in each condition, unioned (conditions with no credible set contribute nothing).

random

nRandom variants sampled uniformly at random – represents the genome-wide mixture of effects and drives the mixture weights.

null

nNull variants sampled from those with \(\max|z|<2\) – the noise floor used to estimate the residual correlation (Vhat).

Random and null are selected identically for both classes (mashRandNullSample over the object's Bhat/Shat). Partitions are merged across objects (rownames disambiguated by region name), cleaned + z-derived by filterInvalidSummaryStat (btoz), and the strong XtX cross-product appended.

Examples

data(qtlSumStatsMulticontextExample)
ss <- qtlSumStatsMulticontextExample
mashInput(objects = list(strong = ss, random = ss))
#> $strong.b
#>                                                     brain     blood    muscle
#> study1::ENSG_example::chr22:15648016:C:T_strong 0.4861969 0.8562195 0.4909077
#> study1::ENSG_example::chr22:15648016:C:T_random 0.4861969 0.8562195 0.4909077
#> 
#> $strong.s
#>                                                     brain     blood    muscle
#> study1::ENSG_example::chr22:15648016:C:T_strong 0.1655655 0.1646774 0.1709619
#> study1::ENSG_example::chr22:15648016:C:T_random 0.1655655 0.1646774 0.1709619
#> 
#> $random.b
#>                                                        brain       blood
#> study1::ENSG_example::chr22:15778812:A:G_strong -0.219189971 -0.22909570
#> study1::ENSG_example::chr22:15626329:C:T_strong -0.043367015 -0.26939774
#> study1::ENSG_example::chr22:15607461:C:T_strong  0.281614788  0.57826671
#> study1::ENSG_example::chr22:15637198:C:T_strong -0.171650598 -0.22456857
#> study1::ENSG_example::chr22:15683596:T:G_strong  0.161964443  0.40883991
#> study1::ENSG_example::chr22:15720906:C:T_strong -0.008501828 -0.03723058
#> study1::ENSG_example::chr22:15618335:C:A_strong -0.273652041 -0.21289662
#> study1::ENSG_example::chr22:15814521:T:C_strong -0.050944384 -0.15434319
#> study1::ENSG_example::chr22:15266873:A:G_strong -0.065505276 -0.14722067
#> study1::ENSG_example::chr22:15776459:C:T_strong -0.154715761 -0.04130935
#> study1::ENSG_example::chr22:15778812:A:G_random -0.219189971 -0.22909570
#> study1::ENSG_example::chr22:15626329:C:T_random -0.043367015 -0.26939774
#> study1::ENSG_example::chr22:15607461:C:T_random  0.281614788  0.57826671
#> study1::ENSG_example::chr22:15637198:C:T_random -0.171650598 -0.22456857
#> study1::ENSG_example::chr22:15683596:T:G_random  0.161964443  0.40883991
#> study1::ENSG_example::chr22:15720906:C:T_random -0.008501828 -0.03723058
#> study1::ENSG_example::chr22:15618335:C:A_random -0.273652041 -0.21289662
#> study1::ENSG_example::chr22:15814521:T:C_random -0.050944384 -0.15434319
#> study1::ENSG_example::chr22:15266873:A:G_random -0.065505276 -0.14722067
#> study1::ENSG_example::chr22:15776459:C:T_random -0.154715761 -0.04130935
#>                                                      muscle
#> study1::ENSG_example::chr22:15778812:A:G_strong -0.08725191
#> study1::ENSG_example::chr22:15626329:C:T_strong -0.12616485
#> study1::ENSG_example::chr22:15607461:C:T_strong  0.46698965
#> study1::ENSG_example::chr22:15637198:C:T_strong -0.07223445
#> study1::ENSG_example::chr22:15683596:T:G_strong  0.20485890
#> study1::ENSG_example::chr22:15720906:C:T_strong -0.18476296
#> study1::ENSG_example::chr22:15618335:C:A_strong -0.17863552
#> study1::ENSG_example::chr22:15814521:T:C_strong  0.14922904
#> study1::ENSG_example::chr22:15266873:A:G_strong -0.13573866
#> study1::ENSG_example::chr22:15776459:C:T_strong  0.18402502
#> study1::ENSG_example::chr22:15778812:A:G_random -0.08725191
#> study1::ENSG_example::chr22:15626329:C:T_random -0.12616485
#> study1::ENSG_example::chr22:15607461:C:T_random  0.46698965
#> study1::ENSG_example::chr22:15637198:C:T_random -0.07223445
#> study1::ENSG_example::chr22:15683596:T:G_random  0.20485890
#> study1::ENSG_example::chr22:15720906:C:T_random -0.18476296
#> study1::ENSG_example::chr22:15618335:C:A_random -0.17863552
#> study1::ENSG_example::chr22:15814521:T:C_random  0.14922904
#> study1::ENSG_example::chr22:15266873:A:G_random -0.13573866
#> study1::ENSG_example::chr22:15776459:C:T_random  0.18402502
#> 
#> $random.s
#>                                                     brain     blood    muscle
#> study1::ENSG_example::chr22:15778812:A:G_strong 0.1437918 0.1504989 0.1492118
#> study1::ENSG_example::chr22:15626329:C:T_strong 0.1235157 0.1275904 0.1270654
#> study1::ENSG_example::chr22:15607461:C:T_strong 0.1406741 0.1419825 0.1422443
#> study1::ENSG_example::chr22:15637198:C:T_strong 0.1096038 0.1142275 0.1137582
#> study1::ENSG_example::chr22:15683596:T:G_strong 0.1668900 0.1722233 0.1718888
#> study1::ENSG_example::chr22:15720906:C:T_strong 0.1253776 0.1311928 0.1285110
#> study1::ENSG_example::chr22:15618335:C:A_strong 0.1055359 0.1114712 0.1101932
#> study1::ENSG_example::chr22:15814521:T:C_strong 0.1791332 0.1871417 0.1844437
#> study1::ENSG_example::chr22:15266873:A:G_strong 0.1244108 0.1298110 0.1279925
#> study1::ENSG_example::chr22:15776459:C:T_strong 0.2439269 0.2555943 0.2514972
#> study1::ENSG_example::chr22:15778812:A:G_random 0.1437918 0.1504989 0.1492118
#> study1::ENSG_example::chr22:15626329:C:T_random 0.1235157 0.1275904 0.1270654
#> study1::ENSG_example::chr22:15607461:C:T_random 0.1406741 0.1419825 0.1422443
#> study1::ENSG_example::chr22:15637198:C:T_random 0.1096038 0.1142275 0.1137582
#> study1::ENSG_example::chr22:15683596:T:G_random 0.1668900 0.1722233 0.1718888
#> study1::ENSG_example::chr22:15720906:C:T_random 0.1253776 0.1311928 0.1285110
#> study1::ENSG_example::chr22:15618335:C:A_random 0.1055359 0.1114712 0.1101932
#> study1::ENSG_example::chr22:15814521:T:C_random 0.1791332 0.1871417 0.1844437
#> study1::ENSG_example::chr22:15266873:A:G_random 0.1244108 0.1298110 0.1279925
#> study1::ENSG_example::chr22:15776459:C:T_random 0.2439269 0.2555943 0.2514972
#> 
#> $null.b
#>                                                         brain       blood
#> study1::ENSG_example::chr22:15563103:C:T_strong  0.0853659926  0.38918056
#> study1::ENSG_example::chr22:15476864:T:C_strong  0.1109768939 -0.22787279
#> study1::ENSG_example::chr22:15692596:C:T_strong  0.1057045095  0.21524173
#> study1::ENSG_example::chr22:15821524:A:G_strong -0.0741484621  0.09910541
#> study1::ENSG_example::chr22:15684887:G:A_strong -0.0859127568 -0.14301995
#> study1::ENSG_example::chr22:15707595:T:C_strong  0.0005543876 -0.04264022
#> study1::ENSG_example::chr22:15689362:T:G_strong  0.0321831446  0.05079411
#> study1::ENSG_example::chr22:15806401:T:C_strong  0.0362324259 -0.09031216
#> study1::ENSG_example::chr22:15822206:A:C_strong -0.0180251326 -0.18109544
#> study1::ENSG_example::chr22:15795572:T:C_strong  0.0249376849 -0.03991983
#> study1::ENSG_example::chr22:15563103:C:T_random  0.0853659926  0.38918056
#> study1::ENSG_example::chr22:15476864:T:C_random  0.1109768939 -0.22787279
#> study1::ENSG_example::chr22:15692596:C:T_random  0.1057045095  0.21524173
#> study1::ENSG_example::chr22:15821524:A:G_random -0.0741484621  0.09910541
#> study1::ENSG_example::chr22:15684887:G:A_random -0.0859127568 -0.14301995
#> study1::ENSG_example::chr22:15707595:T:C_random  0.0005543876 -0.04264022
#> study1::ENSG_example::chr22:15689362:T:G_random  0.0321831446  0.05079411
#> study1::ENSG_example::chr22:15806401:T:C_random  0.0362324259 -0.09031216
#> study1::ENSG_example::chr22:15822206:A:C_random -0.0180251326 -0.18109544
#> study1::ENSG_example::chr22:15795572:T:C_random  0.0249376849 -0.03991983
#>                                                       muscle
#> study1::ENSG_example::chr22:15563103:C:T_strong  0.167978837
#> study1::ENSG_example::chr22:15476864:T:C_strong  0.059138479
#> study1::ENSG_example::chr22:15692596:C:T_strong  0.052666790
#> study1::ENSG_example::chr22:15821524:A:G_strong -0.153406058
#> study1::ENSG_example::chr22:15684887:G:A_strong  0.004350751
#> study1::ENSG_example::chr22:15707595:T:C_strong -0.155241967
#> study1::ENSG_example::chr22:15689362:T:G_strong -0.045687427
#> study1::ENSG_example::chr22:15806401:T:C_strong -0.058306577
#> study1::ENSG_example::chr22:15822206:A:C_strong  0.080739418
#> study1::ENSG_example::chr22:15795572:T:C_strong -0.083310052
#> study1::ENSG_example::chr22:15563103:C:T_random  0.167978837
#> study1::ENSG_example::chr22:15476864:T:C_random  0.059138479
#> study1::ENSG_example::chr22:15692596:C:T_random  0.052666790
#> study1::ENSG_example::chr22:15821524:A:G_random -0.153406058
#> study1::ENSG_example::chr22:15684887:G:A_random  0.004350751
#> study1::ENSG_example::chr22:15707595:T:C_random -0.155241967
#> study1::ENSG_example::chr22:15689362:T:G_random -0.045687427
#> study1::ENSG_example::chr22:15806401:T:C_random -0.058306577
#> study1::ENSG_example::chr22:15822206:A:C_random  0.080739418
#> study1::ENSG_example::chr22:15795572:T:C_random -0.083310052
#> 
#> $null.s
#>                                                     brain     blood    muscle
#> study1::ENSG_example::chr22:15563103:C:T_strong 0.2168213 0.2249827 0.2233606
#> study1::ENSG_example::chr22:15476864:T:C_strong 0.1208778 0.1255783 0.1249161
#> study1::ENSG_example::chr22:15692596:C:T_strong 0.1051968 0.1091477 0.1087632
#> study1::ENSG_example::chr22:15821524:A:G_strong 0.1473683 0.1541638 0.1516465
#> study1::ENSG_example::chr22:15684887:G:A_strong 0.1089566 0.1137035 0.1125975
#> study1::ENSG_example::chr22:15707595:T:C_strong 0.1252289 0.1310251 0.1285944
#> study1::ENSG_example::chr22:15689362:T:G_strong 0.1102145 0.1153147 0.1136547
#> study1::ENSG_example::chr22:15806401:T:C_strong 0.1187627 0.1241341 0.1224483
#> study1::ENSG_example::chr22:15822206:A:C_strong 0.1639663 0.1710304 0.1690119
#> study1::ENSG_example::chr22:15795572:T:C_strong 0.2089665 0.2186968 0.2154503
#> study1::ENSG_example::chr22:15563103:C:T_random 0.2168213 0.2249827 0.2233606
#> study1::ENSG_example::chr22:15476864:T:C_random 0.1208778 0.1255783 0.1249161
#> study1::ENSG_example::chr22:15692596:C:T_random 0.1051968 0.1091477 0.1087632
#> study1::ENSG_example::chr22:15821524:A:G_random 0.1473683 0.1541638 0.1516465
#> study1::ENSG_example::chr22:15684887:G:A_random 0.1089566 0.1137035 0.1125975
#> study1::ENSG_example::chr22:15707595:T:C_random 0.1252289 0.1310251 0.1285944
#> study1::ENSG_example::chr22:15689362:T:G_random 0.1102145 0.1153147 0.1136547
#> study1::ENSG_example::chr22:15806401:T:C_random 0.1187627 0.1241341 0.1224483
#> study1::ENSG_example::chr22:15822206:A:C_random 0.1639663 0.1710304 0.1690119
#> study1::ENSG_example::chr22:15795572:T:C_random 0.2089665 0.2186968 0.2154503
#> 
#> $random.z
#>                                                       brain      blood
#> study1::ENSG_example::chr22:15778812:A:G_strong -1.52435699 -1.5222413
#> study1::ENSG_example::chr22:15626329:C:T_strong -0.35110536 -2.1114268
#> study1::ENSG_example::chr22:15607461:C:T_strong  2.00189527  4.0728022
#> study1::ENSG_example::chr22:15637198:C:T_strong -1.56610093 -1.9659760
#> study1::ENSG_example::chr22:15683596:T:G_strong  0.97048627  2.3738947
#> study1::ENSG_example::chr22:15720906:C:T_strong -0.06780976 -0.2837852
#> study1::ENSG_example::chr22:15618335:C:A_strong -2.59297615 -1.9098804
#> study1::ENSG_example::chr22:15814521:T:C_strong -0.28439382 -0.8247397
#> study1::ENSG_example::chr22:15266873:A:G_strong -0.52652383 -1.1341155
#> study1::ENSG_example::chr22:15776459:C:T_strong -0.63427114 -0.1616208
#> study1::ENSG_example::chr22:15778812:A:G_random -1.52435699 -1.5222413
#> study1::ENSG_example::chr22:15626329:C:T_random -0.35110536 -2.1114268
#> study1::ENSG_example::chr22:15607461:C:T_random  2.00189527  4.0728022
#> study1::ENSG_example::chr22:15637198:C:T_random -1.56610093 -1.9659760
#> study1::ENSG_example::chr22:15683596:T:G_random  0.97048627  2.3738947
#> study1::ENSG_example::chr22:15720906:C:T_random -0.06780976 -0.2837852
#> study1::ENSG_example::chr22:15618335:C:A_random -2.59297615 -1.9098804
#> study1::ENSG_example::chr22:15814521:T:C_random -0.28439382 -0.8247397
#> study1::ENSG_example::chr22:15266873:A:G_random -0.52652383 -1.1341155
#> study1::ENSG_example::chr22:15776459:C:T_random -0.63427114 -0.1616208
#>                                                     muscle
#> study1::ENSG_example::chr22:15778812:A:G_strong -0.5847523
#> study1::ENSG_example::chr22:15626329:C:T_strong -0.9929130
#> study1::ENSG_example::chr22:15607461:C:T_strong  3.2830105
#> study1::ENSG_example::chr22:15637198:C:T_strong -0.6349825
#> study1::ENSG_example::chr22:15683596:T:G_strong  1.1918103
#> study1::ENSG_example::chr22:15720906:C:T_strong -1.4377211
#> study1::ENSG_example::chr22:15618335:C:A_strong -1.6211124
#> study1::ENSG_example::chr22:15814521:T:C_strong  0.8090761
#> study1::ENSG_example::chr22:15266873:A:G_strong -1.0605206
#> study1::ENSG_example::chr22:15776459:C:T_strong  0.7317179
#> study1::ENSG_example::chr22:15778812:A:G_random -0.5847523
#> study1::ENSG_example::chr22:15626329:C:T_random -0.9929130
#> study1::ENSG_example::chr22:15607461:C:T_random  3.2830105
#> study1::ENSG_example::chr22:15637198:C:T_random -0.6349825
#> study1::ENSG_example::chr22:15683596:T:G_random  1.1918103
#> study1::ENSG_example::chr22:15720906:C:T_random -1.4377211
#> study1::ENSG_example::chr22:15618335:C:A_random -1.6211124
#> study1::ENSG_example::chr22:15814521:T:C_random  0.8090761
#> study1::ENSG_example::chr22:15266873:A:G_random -1.0605206
#> study1::ENSG_example::chr22:15776459:C:T_random  0.7317179
#> 
#> $null.z
#>                                                        brain      blood
#> study1::ENSG_example::chr22:15563103:C:T_strong  0.393715961  1.7298245
#> study1::ENSG_example::chr22:15476864:T:C_strong  0.918091940 -1.8145875
#> study1::ENSG_example::chr22:15692596:C:T_strong  1.004825971  1.9720221
#> study1::ENSG_example::chr22:15821524:A:G_strong -0.503150573  0.6428580
#> study1::ENSG_example::chr22:15684887:G:A_strong -0.788504417 -1.2578329
#> study1::ENSG_example::chr22:15707595:T:C_strong  0.004426995 -0.3254355
#> study1::ENSG_example::chr22:15689362:T:G_strong  0.292004758  0.4404824
#> study1::ENSG_example::chr22:15806401:T:C_strong  0.305082429 -0.7275370
#> study1::ENSG_example::chr22:15822206:A:C_strong -0.109931918 -1.0588495
#> study1::ENSG_example::chr22:15795572:T:C_strong  0.119338168 -0.1825351
#> study1::ENSG_example::chr22:15563103:C:T_random  0.393715961  1.7298245
#> study1::ENSG_example::chr22:15476864:T:C_random  0.918091940 -1.8145875
#> study1::ENSG_example::chr22:15692596:C:T_random  1.004825971  1.9720221
#> study1::ENSG_example::chr22:15821524:A:G_random -0.503150573  0.6428580
#> study1::ENSG_example::chr22:15684887:G:A_random -0.788504417 -1.2578329
#> study1::ENSG_example::chr22:15707595:T:C_random  0.004426995 -0.3254355
#> study1::ENSG_example::chr22:15689362:T:G_random  0.292004758  0.4404824
#> study1::ENSG_example::chr22:15806401:T:C_random  0.305082429 -0.7275370
#> study1::ENSG_example::chr22:15822206:A:C_random -0.109931918 -1.0588495
#> study1::ENSG_example::chr22:15795572:T:C_random  0.119338168 -0.1825351
#>                                                      muscle
#> study1::ENSG_example::chr22:15563103:C:T_strong  0.75205235
#> study1::ENSG_example::chr22:15476864:T:C_strong  0.47342563
#> study1::ENSG_example::chr22:15692596:C:T_strong  0.48423372
#> study1::ENSG_example::chr22:15821524:A:G_strong -1.01160271
#> study1::ENSG_example::chr22:15684887:G:A_strong  0.03863987
#> study1::ENSG_example::chr22:15707595:T:C_strong -1.20722203
#> study1::ENSG_example::chr22:15689362:T:G_strong -0.40198457
#> study1::ENSG_example::chr22:15806401:T:C_strong -0.47617309
#> study1::ENSG_example::chr22:15822206:A:C_strong  0.47771435
#> study1::ENSG_example::chr22:15795572:T:C_strong -0.38667883
#> study1::ENSG_example::chr22:15563103:C:T_random  0.75205235
#> study1::ENSG_example::chr22:15476864:T:C_random  0.47342563
#> study1::ENSG_example::chr22:15692596:C:T_random  0.48423372
#> study1::ENSG_example::chr22:15821524:A:G_random -1.01160271
#> study1::ENSG_example::chr22:15684887:G:A_random  0.03863987
#> study1::ENSG_example::chr22:15707595:T:C_random -1.20722203
#> study1::ENSG_example::chr22:15689362:T:G_random -0.40198457
#> study1::ENSG_example::chr22:15806401:T:C_random -0.47617309
#> study1::ENSG_example::chr22:15822206:A:C_random  0.47771435
#> study1::ENSG_example::chr22:15795572:T:C_random -0.38667883
#> 
#> $strong.z
#>                                                    brain    blood   muscle
#> study1::ENSG_example::chr22:15648016:C:T_strong 2.936584 5.199374 2.871445
#> study1::ENSG_example::chr22:15648016:C:T_random 2.936584 5.199374 2.871445
#> 
#> $XtX
#>            brain    blood    muscle
#> brain   8.623526 15.26840  8.432240
#> blood  15.268399 27.03349 14.929717
#> muscle  8.432240 14.92972  8.245197
#>