S4-dispatched per-region fine-mapping entry point that
replaces the deprecated univariateAnalysisPipeline,
multivariateAnalysisPipeline, rssAnalysisPipeline,
and susieRssPipeline pipelines. Accepts:
a
QtlDatasetfor individual-level cohort fits (per-context / per-trait univariate SuSiE; joint multi-trait or multi-context mvSuSiE; joint multi-trait fSuSiE per context);a
MultiStudyQtlDatasetwhich recurses through each embeddedQtlDatasetper study and processes the optional embeddedQtlSumStatsvia the sumstat method;a
QtlSumStatsfor per-trait SuSiE-RSS fits and per-(study, trait) multi-context mvSuSiE-RSS fits;a
GwasSumStatsfor per-(study, LD-block) SuSiE-RSS fine-mapping (used byqtlEnrichmentPipelinedownstream).
Method tokens are unified across input classes; auto-dispatch picks the individual-level vs RSS implementation based on the input class. The supported tokens are:
susiesusieR::susiewithunmappable_effects = "none"on individual-level input;susieR::susie_rss(same) on RSS.susieInfunmappable_effects = "inf"variant of the same.susieAshunmappable_effects = "ash"variant of the same.serSingle-effect regression via
susieR::susie_seron summary statistics (z,n); LD-free (noR, noL), so distinct fromsusiewithL = 1. Sumstat input only (QtlSumStats/GwasSumStats, or the sumstat side of aMultiStudyQtlDataset); rejected on individual-levelQtlDataset.mvsusiemvsusieR::mvsusieon individual- level input (requires multi-trait OR multi-context Y),mvsusieR::mvsusie_rsson sumstat input (requires multi-context within a single (study, trait) group). Errors onGwasSumStatsinput.fsusiefsusieR::susiFjoint multi-trait fit per context. Individual-level only; errors on any SumStats input.mrmashAlways rejected here.
mr.mashis a TWAS weight-oriented method and lives intwasWeightsPipeline.
Usage
fineMappingPipeline(data, ...)
# S4 method for class 'QtlDataset'
fineMappingPipeline(
data,
methods,
contexts = NULL,
traitId = NULL,
region = NULL,
cisWindow = NULL,
mafCutoff = NULL,
macCutoff = NULL,
xvarCutoff = NULL,
imissCutoff = NULL,
keepIndel = NULL,
keepSamples = NULL,
keepVariants = NULL,
jointRegions = FALSE,
jointSpecification = NULL,
addSusieInf = TRUE,
L = 20L,
Lgreedy = 5L,
coverage = 0.95,
secondaryCoverage = c(0.7, 0.5),
signalCutoff = 0.025,
minAbsCorr = 0.8,
medianAbsCorr = NULL,
fineMappingResult = NULL,
cvFolds = 0,
cvThreads = 1,
samplePartition = NULL,
pipCutoffToSkip = 0,
usePCA = FALSE,
nPCs = 10L,
seed = NULL,
twasWeights = NULL,
dataDrivenPriorWeightsCutoff = 1e-10,
naAction = c("drop", "impute"),
verbose = 1,
trim = TRUE,
fullFit = FALSE,
fullFitAlphaOnly = TRUE,
includeAllCs = FALSE,
phenotypeCovariatesToResidualize = NULL,
genotypeCovariatesToResidualize = NULL,
residualizePhenotypeCovariates = TRUE,
residualizeGenotypeCovariates = TRUE,
...
)
# S4 method for class 'MultiStudyQtlDataset'
fineMappingPipeline(
data,
methods,
contexts = NULL,
traitId = NULL,
region = NULL,
cisWindow = NULL,
jointRegions = FALSE,
jointSpecification = NULL,
addSusieInf = TRUE,
coverage = 0.95,
secondaryCoverage = c(0.7, 0.5),
signalCutoff = 0.025,
minAbsCorr = 0.8,
medianAbsCorr = NULL,
fineMappingResult = NULL,
twasWeights = NULL,
dataDrivenPriorWeightsCutoff = 1e-10,
cvFolds = 0,
cvThreads = 1,
samplePartition = NULL,
pipCutoffToSkip = 0,
seed = NULL,
naAction = c("drop", "impute"),
verbose = 1,
trim = TRUE,
fullFit = FALSE,
fullFitAlphaOnly = TRUE,
includeAllCs = FALSE,
phenotypeCovariatesToResidualize = NULL,
genotypeCovariatesToResidualize = NULL,
residualizePhenotypeCovariates = TRUE,
residualizeGenotypeCovariates = TRUE,
...
)
# S4 method for class 'QtlSumStats'
fineMappingPipeline(
data,
methods,
contexts = NULL,
traitId = NULL,
jointSpecification = NULL,
addSusieInf = TRUE,
coverage = 0.95,
secondaryCoverage = c(0.7, 0.5),
signalCutoff = 0.025,
minAbsCorr = 0.8,
medianAbsCorr = NULL,
fineMappingResult = NULL,
twasWeights = NULL,
dataDrivenPriorWeightsCutoff = 1e-10,
verbose = 1,
trim = TRUE,
fullFit = FALSE,
fullFitAlphaOnly = TRUE,
includeAllCs = FALSE,
serFallback = FALSE,
rFinite = NULL,
rMismatch = "none",
rMismatchMethod = NULL,
checkPrior = NULL,
keepFullFit = "fallback",
...
)
# S4 method for class 'GwasSumStats'
fineMappingPipeline(
data,
methods,
addSusieInf = TRUE,
L = 20L,
Lgreedy = 5L,
coverage = 0.95,
secondaryCoverage = c(0.7, 0.5),
signalCutoff = 0.025,
minAbsCorr = 0.8,
medianAbsCorr = NULL,
fineMappingResult = NULL,
verbose = 1,
trim = TRUE,
fullFit = FALSE,
fullFitAlphaOnly = TRUE,
includeAllCs = FALSE,
serFallback = FALSE,
rFinite = NULL,
rMismatch = "none",
rMismatchMethod = NULL,
checkPrior = NULL,
keepFullFit = "fallback",
...
)
# S4 method for class 'ANY'
fineMappingPipeline(data, ...)Arguments
- data
A
QtlDataset,MultiStudyQtlDataset,QtlSumStats, orGwasSumStats.- ...
Reserved for future per-method arguments.
- methods
Method specification. Accepts either:
A character vector of method tokens, e.g.
c("susie", "susieInf", "mvsusie")(any subset ofc("susie", "susieInf", "susieAsh", "mvsusie", "fsusie"), subject to per-class compatibility).A named list keyed by method token, where each value is a list of per-method kwargs to splice into the underlying fitter, e.g.
list(susie = list(L = 1, refine = FALSE), mvsusie = list(max_iter = 500)). Mirrors the convention oftwasWeightsPipeline'smethodsargument. User-supplied kwargs override the capability-table defaults and any base / chained args set by the pipeline (e.g. you can overridemodel_initeven when fitting from a susieInf chain).
- contexts
Optional character vector of context names. Default
NULL(all contexts).- traitId
Optional character vector of trait names to restrict processing to.
- region
Optional variant window for QtlDataset trait selection: a
GRanges, a"chr:start-end"string, or a one-row data.frame withchrom/start/end. Mutually exclusive withtraitId.- cisWindow
For QtlDataset: cis-window (bp) around each trait's genomic position when extracting variants. Required when
traitIdis supplied. Mutually exclusive withregion.- jointRegions
For QtlDataset with a multi-range
region:FALSE(default) fits each range independently and merges the per-range results into one entry per (study, context, trait, method) — the mergedsusieFitis a named list of per-region fits and credible-set labels are renumbered to stay unique.TRUEconcatenates the ranges' genotypes into one joint fit. Ignored for a single-range / cis (traitId+cisWindow) request.- jointSpecification
Optional joint-fit specification (NULL by default). When NULL, the pipeline runs the implicit multi-context / multi-trait mvSuSiE / fSuSiE branches as before. When non-NULL, the argument is parsed and validated via the joint-spec grammar documented under
parseJointSpecification(a character vector of axes, or a list oflist(axes, scope)specs); the per-spec axis dispatcher implementation is in progress and a non-NULL value currently errors with an informative message. See the design notes inR/jointSpecification.Rfor the accepted grammar.- addSusieInf
Logical. When
susieInfis inmethodsalongsidesusieand/orsusieAsh, controls whether the SuSiE-inf fit initialises the chained downstream method(s). DefaultTRUE.- coverage
Primary credible-set coverage (numeric, length 1). Default
0.95.- secondaryCoverage
Secondary coverages forwarded to
postprocessFinemappingFits. Defaultc(0.7, 0.5).- signalCutoff
PIP cutoff for top-loci selection. Default
0.025.- minAbsCorr
Minimum absolute correlation for credible-set purity. Default
0.8.- medianAbsCorr
Optional median absolute correlation for credible-set purity, routed to
susieR::susie_get_cs. A set is kept if it passes eitherminAbsCorrormedianAbsCorr(OR-logic). DefaultNULL(off).- fineMappingResult
Optional existing
FineMappingResultto use as a resume cache; tuples already present are not refit.- cvFolds
Integer. Number of cross-validation folds. Default
0(no CV). When> 1, each method is refit on the training samples of every fold and used to predict the held-out samples; the fold partition plus per-fold out-of-fold predictions and metrics are stored on eachFineMappingEntry'scvResultslot (seegetCvResult).twasWeightsPipelinereuses this partition and feeds these predictions into the SR-TWAS ensemble. Individual-level (QtlDataset/MultiStudyQtlDataset) input only; ignored for sumstat inputs.- cvThreads
Integer. Number of parallel workers for the cross-validation fold refits (passed to the shared CV engine's
numThreads). Default1(serial);-1uses all cores. Only consulted whencvFolds > 1.- samplePartition
Optional pre-defined CV partition
data.framewith columnsSampleandFold. When supplied (andcvFolds > 1), every method reuses this exact partition; otherwise a fresh partition is generated per(study, context, trait).- pipCutoffToSkip
Numeric (length 1). Individual-level single-effect (SER) pre-screen applied to each residualized
(X, y)block before a full fit: a susie model withL = 1is fit and the block is skipped when no PIP exceeds the cutoff (no potentially significant variant). The summary-statistics analog lives insummaryStatsQc().0(default) disables the screen; a negative value uses the adaptive3 / nVariantsthreshold.- usePCA
Logical (length 1).
QtlDatasetonly. WhenTRUE(defaultFALSE), each multi-trait context's PCA-reduced phenotype is fine-mapped with univariate SuSiE on its top principal components (ports the legacyfsusie.Rsusie_on_top_pc). Each PC becomes a pseudo-trait row keyedtrait = "topPC\{i\}",method = "susie". Single-trait contexts have no PCA and are skipped.- nPCs
Integer (length 1).
QtlDatasetonly. Caps the number of top principal components fine-mapped per context whenusePCA = TRUE(default10). The effective count ismin(nPCs, usable traits).- seed
Optional integer. When non-NULL,
set.seed(seed)is called once at the start of the call for reproducible fits. DefaultNULL(no seeding).- verbose
Verbosity (0 silent, 1 default). Default
1.- trim
Logical (length 1). When
TRUE(default) thesusieFitslot on each outputFineMappingEntrycarries a trimmed view of the SuSiE fit (the minimal subset needed by downstream pipelines). WhenFALSEthe full untrimmedsusie()return is retained so accessors likegetSusieFit()and non-default-coverage queries throughgetCs()can read the full posterior matrices (lbf_variable,mu,mu2,V). The per-varianttopLocitable is always fully populated regardless oftrim.- fullFit
Logical (length 1, default
FALSE). Master switch for per-credible-set variant-level export intopLoci. WhenFALSE, only the always-onwithin_cs_pipscalar column is added (each variant'salphain its assigned primary-coverage credible set; NA when not in a set). WhenTRUE, wide per-CS columns are added, one set of columns per credible set (labelledcs<k>).- fullFitAlphaOnly
Logical (length 1, default
TRUE). No-op whenfullFit=FALSE. WhenTRUE, onlyalphais widened (within_cs_pip_cs<k>). WhenFALSE, all four per-effect matrices are widened:within_cs_pip_cs<k>(alpha),cs_logbf_cs<k>(lbf_variable),cs_effect_cs<k>(mu, unscaled) andcs_effect_var_cs<k>(posterior variance, unscaled).- includeAllCs
Logical (length 1, default
FALSE). No-op whenfullFit=FALSE. WhenFALSE, only effects that produced a passing (purity/coverage-filtered) credible set are widened. WhenTRUE, every effectLis widened (including filtered-out ones, labelledL<k>instead ofcs<k>).- phenotypeCovariatesToResidualize
Character vector (or
NULL) of phenotype-covariate names to residualize against.NULL(default) uses every available phenotype covariate. Only meaningful when the input is aQtlDataset/MultiStudyQtlDataset(ignored for sumstat inputs).- genotypeCovariatesToResidualize
Character vector (or
NULL) of genotype-covariate column names to residualize against.NULLuses every available genotype covariate.- residualizePhenotypeCovariates
Logical (length 1). When
TRUE(default) residualize against the phenotype-side covariates listed inphenotypeCovariatesToResidualize. SetFALSEto disable phenotype-covariate residualization entirely. The marginal univariate effects stored on eachFineMappingEntryobey the same residualization choice as the SuSiE fit itself — they are computed against the same residualizedX/Y.- residualizeGenotypeCovariates
Logical (length 1). When
TRUE(default) residualize against the genotype-side covariates listed ingenotypeCovariatesToResidualize. SetFALSEto disable.- serFallback
Logical (length 1, default
FALSE).QtlSumStats/GwasSumStats(summary-statistics SuSiE-RSS paths) only. WhenTRUE, after each standard multi-effect SuSiE-RSS fit (susie/susieAsh) the pipeline reads susieR's finite-sample R diagnostics and, iffit$R_finite_diagnostics$R_reliability_flagisTRUE, reports the single-effect (ser_model) result for that region instead of the multi-effect fit. DefaultsFALSEso existing callers are unchanged. SeekeepFullFitfor retaining the multi-effect fit.- rFinite
QtlSumStats/GwasSumStatsonly. Finite-sample size for susieR'sR_finitecorrection, forwarded tosusieR::susie_rss().NULL(default) uses susieR's default, except when a finite/EB mode is active (serFallback=TRUEorrMismatch != "none") andrFiniteisNULL, in which case it defaults to the LD-panel sample sizegetNSamples(ldSketch).- rMismatch
QtlSumStats/GwasSumStatsonly. LD-mismatch mode forwarded tosusieR::susie_rss()asR_mismatch(e.g."eb"for empirical Bayes). Default"none"(susieR's default).- rMismatchMethod
QtlSumStats/GwasSumStatsonly. OptionalR_mismatch_methodforwarded tosusieR::susie_rss()when non-NULL.- checkPrior
QtlSumStats/GwasSumStatsonly. Optionalcheck_priorforwarded tosusieR::susie_rss()when non-NULL.- keepFullFit
QtlSumStats/GwasSumStatsonly. Controls retention of the pre-fallback multi-effect SuSiE-RSS fit whenserFallback=TRUE:"fallback"(default) keeps it only for regions that fell back to SER;"all"keeps it for every region;"none"keeps none. The retained fit and the decision are stored on the entry's SuSiE fit and read viagetSusieFit(res)$multiEffectFit,getSusieFit(res)$R_reliability_flag, andgetSusieFit(res)$serFallbackUsed.- ldBlocks
For
GwasSumStatsinput only: anLdBlocksobject describing the LD-block partition. The pipeline performs SuSiE-RSS fine-mapping per (study, ldBlock). Required for the GwasSumStats method.
Value
A FineMappingResult collection keyed by
(study, context, trait, method). The ldSketch slot
is set automatically: NULL for individual-level
(QtlDataset / all-individual-level MultiStudyQtlDataset) fits, the
input's ldSketch for RSS-derived fits.
Chained initialisation
When susieInf is requested alongside susie and/or
susieAsh and addSusieInf = TRUE (default), the
SuSiE-inf fit is computed first and used as initialisation for
the SuSiE / SuSiE-ash fits, mirroring the legacy
univariateAnalysisPipeline / susieRssPipeline chained
init behaviour. SuSiE-inf is dropped from the final result when
the caller did not explicitly request it (only used as init).
QC contract
All QtlSumStats and GwasSumStats inputs must have
been QC'd via summaryStatsQc; the pipeline errors on
inputs where length(getQcInfo(x)) == 0L.
summaryStatsQc also drops variants absent from the
ldSketch, so by the time per-entry processing runs every
variant is guaranteed to be present in the LD panel and a local LD
matrix can be built with extractBlockGenotypes +
computeLd("sample").
Optional resume cache
Supplying fineMappingResult of an existing
FineMappingResult skips re-fitting any
(study, context, trait, method) tuple that already has a
matching row; cached entries are merged with the newly-fit entries
in the returned collection.
Intentional behaviours dropped from the pre-stub pipelines
The four pre-stub pipelines (univariateAnalysisPipeline /
multivariateAnalysisPipeline / rssAnalysisPipeline /
susieRssPipeline) carried several behaviours that are
deliberately not ported here:
TWAS weights computation (
twasWeights = TRUEpath): lives intwasWeightsPipelinenow.Filtering knobs (
mafCutoff,imissCutoff,xvarCutoff,ldReferenceMetaFile): individual- level QC lives on theQtlDatasetconstructor; sumstat QC lives insummaryStatsQc(). No filtering happens inside this pipeline.Diagnostic re-analysis paths (
singleEffect/bayesianConditionalRegressionreanalysis on the RSS path): these are not exposed as dedicated method tokens. Callers who want a single-effect fit can request it via per-method kwargs, e.g.methods = list(susie = list(L = 1))(see themethodsparameter).loadRssDataand explicitldReferenceMetaFilearguments: the newQtlSumStats/GwasSumStatscarry the (already-QC'd) sumstats andldSketchdirectly.Verbose
methodNamesuffixing (e.g."susie_rss_NO_QC","susie_rss_SLALOM_RAISS_imputed"): the method column on the returnedFineMappingResultcarries the bare token ("susie","susieInf","mvsusie", ...) only. QC provenance is recorded on the sumstats'qcInfo.