Skip to contents

Extract molecular-trait data from an object that carries it. For a QtlDataset, the user can optionally select specific contexts, traits, or a region (see method documentation for the per-class selection arguments).

Usage

molecularTraits(x, ...)

# S4 method for class 'QtlDataset'
molecularTraits(
  x,
  contexts,
  traitId = NULL,
  region = NULL,
  naAction = c("keep", "drop", "impute"),
  outlierAction = c("keep", "drop"),
  outlierPvalThreshold = 0.001,
  outlierArgs = CovMcdOptions()
)

Arguments

x

The object to extract from.

...

Class-specific selection arguments (e.g., contexts, traitId, region).

contexts

Character vector. Context(s) whose data to extract.

traitId

Character or NULL. Molecular trait / feature identifier to select; NULL matches all traits in the dataset.

region

Character (length 1, "chr:start-end") or NULL. Restrict variants to this region; NULL uses the full cis window / all regions.

naAction

Character. How to handle missing phenotype values: one of "keep", "drop", or "impute".

outlierAction

Character. How to handle phenotype outliers: one of "keep" or "drop".

outlierPvalThreshold

Numeric. Two-sided p-value threshold for flagging phenotype outliers. Default 1e-3.

outlierArgs

Extra arguments for robustbase::covMcd(), the robust covariance estimator the outlier rule is built on, supplied with CovMcdOptions – alpha in particular. Only consulted when outlierAction = "drop".

Value

A SummarizedExperiment when one context is selected, or a named list of them for several. A QtlDataset is a MultiAssayExperiment, so these are its experiments; take the measurement matrix itself with SummarizedExperiment::assay() rather than asking this accessor for one.

Examples

data(qtlDatasetExample)
molecularTraits(qtlDatasetExample, contexts = "brain")
#> class: RangedSummarizedExperiment 
#> dim: 1 165 
#> metadata(0):
#> assays(1): expression
#> rownames(1): ENSG_example
#> rowData names(0):
#> colnames(165): NA06989 NA11891 ... NA10854 NA12865
#> colData names(2): sex age