Skip to contents

S4 container for a single QTL study's regional data, extending MultiAssayExperiment. Every QTL context is one RangedSummarizedExperiment: rows are molecular traits positioned by rowRanges, columns are samples, and per-context phenotype covariates sit in that experiment's colData. Alongside them a genotype experiment carries variants in its rowRanges, dosages in a lazily-read DelayedArray assay, and genotype-derived covariates (e.g., ancestry PCs) in its own colData. The sampleMap records which samples each experiment observes, so contexts need not share a sample set.

Extending MultiAssayExperiment means the multi-assay surface applies directly: experiments(), colData(), sampleMap(), and two-dimensional subsetting (x[, samples, contexts]), all of which preserve the class and its own slots. The genotype assay stays unread until an operation touches it.

One caveat comes with that laziness: longForm() and wideFormat() fail on a delayed assay, with MultiAssayExperiment reshaping it to zero rows and reporting "replacement has 0 rows". Subsetting does not sidestep it, because selecting contexts keeps the genotype experiment. Reshape a context experiment on its own, or drop the genotype one by coercing first: longForm(as(x, "MultiAssayExperiment")[, , "brain"]). Reshaping genotypes is variants x samples and enormous on real data, so it is rarely what you want regardless; anything that materialises a tidy view of that experiment reads its dosages.

Usage

# S4 method for class 'QtlDataset,ANY,ANY,ANY'
x[i, j, k, ..., drop = FALSE]

# S4 method for class 'QtlDataset'
longForm(object, ..., genotype = FALSE)

Arguments

x

A QtlDataset.

i, j, k

Feature, sample and experiment subscripts, as for MultiAssayExperiment.

...

Passed on to row subsetting.

drop

Passed through to MultiAssayExperiment: when TRUE, experiments the subset leaves empty are removed.

object

A QtlDataset.

genotype

Logical (length 1), default FALSE. Include the genotype experiment, reading its dosages into memory to do so.

Value

A QtlDataset narrowed to the requested features, samples and contexts.

A long-format DataFrame, one row per (assay, primary, rowname) observation.

Functions

  • x = QtlDataset[i = ANY, j = ANY, drop = ANY]: Subset by feature, sample and experiment. Selecting experiments selects among contexts: the genotype experiment is the substrate every context is interpreted against rather than one of the things being chosen between, so it is always retained.

  • longForm(QtlDataset): Reshape the measurements into one long DataFrame. Only the QTL contexts are reshaped: the genotype experiment is the substrate they are interpreted against rather than a measurement, and being variants x samples it would dwarf them. Pass genotype = TRUE to include it, which reads the dosages into memory – MultiAssayExperiment cannot reshape a delayed assay, and fails with "replacement has 0 rows" if asked to.

    wideFormat() has no such method: it is a plain function rather than a generic, and it reshapes the ExperimentList directly, so there is nothing to dispatch on. Coerce first – wideFormat(as(x, "MultiAssayExperiment")[, , contexts]).

Slots

study

Character (length 1). Study identifier; used in collection classes to tag downstream FineMappingResult / TwasWeights entries. The genotype experiment's assay reads through this handle; the extraction accessors read it directly, so that QC can be applied per block.

scaleResiduals

Logical (length 1). Whether residualization accessors scale residuals to unit variance.

mafCutoff

Numeric (length 1). Minor allele frequency threshold; variants with MAF < mafCutoff are dropped at extraction time inside getGenotypes() / getResidualizedGenotypes(). Default 0 (no filter).

macCutoff

Numeric (length 1). Minor allele count threshold; converted to a MAF threshold using max(mafCutoff, macCutoff / (2 * n)) where n is the post-narrowing sample count of the extracted block. Default 0 (no filter).

xvarCutoff

Numeric (length 1). Per-variant genotype variance threshold; variants with column variance below this are dropped at extraction time. Default 0 (no filter).

imissCutoff

Numeric (length 1). Per-sample genotype-missingness threshold; samples with a missing-genotype rate above this are dropped at extraction time. Default 0 (no filter).

keepVariants

Character vector of variant identifiers to retain prior to per-block QC. Length 0 means no restriction.

keepIndel

Logical (length 1). When FALSE, indel variants (alleles that are not single nucleotides) are dropped at extraction time. Default TRUE.