Skip to contents

Return an aligned (variantIds, weights) pair from a single weight-source entry, so cTWAS and causalInferencePipeline extract weights identically whether the source is a TwasWeights collection (its learned weight vector) or a fine-mapping one (its topLoci posterior effect). The selectors pin the single row the weights come from.

Usage

resolveWeights(x, ...)

# S4 method for class 'FineMappingResultBase'
resolveWeights(
  x,
  studyName = NULL,
  context = NULL,
  trait = NULL,
  method = NULL,
  region = NULL
)

# S4 method for class 'TwasWeights'
resolveWeights(
  x,
  studyName = NULL,
  context = NULL,
  trait = NULL,
  method = NULL
)

Arguments

x

A TwasWeights, QtlFineMappingResult or GwasFineMappingResult.

...

Reserved for future use.

studyName, context, trait, method

Optional length-1 selectors pinning one row of a collection, as elsewhere; each NULL (default) leaves that part of the tuple unconstrained. Ignored when x is already a row.

region

Character (length 1, "chr:start-end") or NULL. A further selector for a fine-mapping result, whose rows also carry a region; NULL (default) leaves it unconstrained.

Value

A list with variantIds (character) and weights (numeric) of equal length; both empty when no usable weights are present.

Examples

data(twasWeightsExample)
w <- resolveWeights(twasWeightsExample, studyName = "protocol_example",
  context = "bulk_rnaseq", trait = "ENSG00000130538", method = "susie")
length(w$variantIds)
#> [1] 168