Skip to contents

S4 container for a single QTL study's regional data. Holds a genotype handle plus per-context SummarizedExperiment objects carrying molecular-trait measurements. Each context's SE has rowRanges describing per-trait genomic positions and colData carrying per-context phenotype covariates. A single matrix of genotype-derived covariates (e.g., ancestry PCs) applies across contexts.

Construct a TwasWeights DFrame-subclass collection from per-tuple vectors and a list of TwasWeightsEntry payloads (one per tuple).

Usage

TwasWeights(
  study,
  context,
  trait,
  method,
  entry,
  jointStudies = NULL,
  jointContexts = NULL,
  jointTraits = NULL,
  region = NULL,
  traitPos = NULL,
  ldSketch = NULL
)

Arguments

study

Character vector of study identifiers. Use the sentinel "joint" for rows produced by a cross-study joint fit.

context

Character vector of context labels. Use "joint" for rows produced by a cross-context joint fit.

trait

Character vector of trait identifiers. Use "joint" for rows produced by a cross-trait joint fit.

method

Character vector of TWAS weight method names.

entry

List / SimpleList of TwasWeightsEntry objects.

jointStudies

Optional character vector (length length(study)) listing the semicolon-joined studies participating in each row's cross-study joint fit, or NA_character_ for non-joint rows. When NULL (default) the column is omitted.

jointContexts

Optional character vector for cross-context joints. Same shape as jointStudies.

jointTraits

Optional character vector for cross-trait joints. Same shape as jointStudies.

region

Optional GRanges (length length(study)) giving the genomic anchor of each row's trait – the trait's own coordinates when built from a QtlDataset, or the summary-stat variant-span window when built from a QtlSumStats. Carried forward as provenance (e.g. for cTWAS LD-block placement); not part of the identity key. NULL (default) omits the column.

ldSketch

An optional GenotypeHandle, or NULL for individual-level fits.

Value

A TwasWeights object.

Slots

study

Character (length 1). Study identifier; used in collection classes to tag downstream FineMappingResult / TwasWeights entries.

genotypes

A GenotypeHandle for lazy access to genotype dosages.

phenotypes

Named list of SummarizedExperiment objects, one per QTL context. Each SE has rows = molecular traits with positions in rowRanges(se), columns = samples, and per-context covariates in colData(se). Different contexts may carry different subsets of traits (rows); traits shared across contexts must have identical rowRanges entries (enforced by validity).

genotypeCovariates

Numeric matrix (samples x covariates) of genotype-derived covariates applied uniformly across all contexts (e.g., ancestry PCs).

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).

keepSamples

Character vector of sample identifiers to retain prior to per-block QC; intersected with the genotype handle's sampleIds and the samples argument of getGenotypes(). Length 0 means no restriction.

keepVariants

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