Skip to contents

Extract weights from a TwasWeightsRow or from one entry of a TwasWeights collection.

Usage

# S4 method for class 'TwasWeights'
weights(
  object,
  studyName = NULL,
  context = NULL,
  trait = NULL,
  method = NULL,
  ...
)

# S4 method for class 'TwasWeightsRow'
weights(object, ...)

Arguments

object

A TwasWeightsRow or TwasWeights.

studyName

Character (length 1) or NULL. Restrict the selection to this study; NULL matches all studies.

context

Character (length 1) or NULL. Restrict the selection to this context; NULL matches all contexts.

trait

Character (length 1) or NULL. Restrict the selection to this trait; NULL matches all traits.

method

Character (length 1) or NULL. Restrict the selection to this fine-mapping / weight method; NULL matches all methods.

...

Class-specific selection arguments.

Value

A numeric vector or matrix of weights.

Examples

twe <- twasWeightsRow(variantIds = sprintf("chr1:%d:A:G", 100L * (1:4)),
  weights = rep(0.1, 4), cvResult = list(rsq = 0.5),
  weightStandardized = FALSE)
weights(twe)
#> [1] 0.1 0.1 0.1 0.1