Construct a QtlDataset: one study's individual-level
QTL data as a MultiAssayExperiment. The genotype handle becomes a
genotype experiment whose dosage assay reads lazily through it,
and each named phenotype SummarizedExperiment becomes one
context experiment. The sampleMap is derived from the column
names actually present in each, so contexts observing different sample
subsets are recorded rather than assumed away.
Usage
QtlDataset(
studyName,
genotypes,
phenotypes,
genotypeCovariates = matrix(numeric(0), nrow = 0, ncol = 0),
scaleResiduals = TRUE,
genotypeFilterParam = GenotypeFilterParam()
)Arguments
- studyName
Character (length 1). Study identifier.
- genotypes
A genotype panel (see
readGenotypes).- phenotypes
Named list of
SummarizedExperimentobjects, keyed by context. Each SE must haverowRangescarrying trait positions andcolDatacarrying per-context phenotype covariates. The name"genotype"is reserved.- genotypeCovariates
Numeric matrix of genotype-derived covariates (e.g., ancestry PCs); rows are samples. Becomes the
colDataof the genotype experiment.- scaleResiduals
Logical (length 1). Default
TRUE.- genotypeFilterParam
Which variants and samples to keep, built with
GenotypeFilterParam. A bare list is refused, since it cannot be checked. Each field is recorded on the object and applied lazily, at extraction time insidegenotypes()/residualizedGenotypes():mafCutoff— drop variants withMAF < mafCutoff. Unset means 0 (no filter).macCutoff— a minor-allele-count threshold, converted to a MAF threshold asmax(mafCutoff, macCutoff / (2 * n))withnthe post-narrowing sample count of the extracted block. Unset means 0.xvarCutoff— drop variants whose column variance is below this. Unset means 0.imissCutoff— drop samples whose missing-genotype rate exceeds this. Unset means 0.keepSamples— subset the dataset to these samples, narrowingcolDataandsampleMaptogether so the sample set has one home rather than two. Unset, orcharacter(0), means no restriction.keepVariants— retain only these variants, before per-block QC. Unset, orcharacter(0), means no restriction.keepIndel— whenFALSE, drop variants whose alleles are not single nucleotides. Unset meansTRUE.
Examples
panel <- readGenotypes(
system.file("extdata", "toy_ref.bed", package = "pecotmr")
)
rng <- GenomicRanges::GRanges(
"chr22", IRanges::IRanges(14600000L, width = 1000L)
)
names(rng) <- "ENSG1"
se <- SummarizedExperiment::SummarizedExperiment(
assays = list(expression = matrix(
rnorm(ncol(panel)), 1,
dimnames = list("ENSG1", colnames(panel))
)),
rowRanges = rng
)
QtlDataset(
studyName = "s1", genotypes = panel, phenotypes = list(brain = se)
)
#> QtlDataset for study 's1'
#> 1 context(s): brain
#> 1 unique traits across contexts
#> Genotypes: plink1 @ /tmp/RtmpmBLZhq/temp_libpathaae388f3498/pecotmr/extdata/toy_ref
#> Genotype covariates: 0 cols
#> Samples: 165
#> Scale residuals: TRUE