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.
Arguments
- study
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.- mafCutoff
Numeric (length 1). Minor allele frequency threshold; variants with
MAF < mafCutoffare dropped at extraction time insidegetGenotypes()/getResidualizedGenotypes(). Default 0 (no filter).- macCutoff
Numeric (length 1). Minor allele count threshold; converted to a MAF threshold using
max(mafCutoff, macCutoff / (2 * n))wherenis 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. The dataset is subset to them, narrowing
colDataandsampleMaptogether, so the sample set has one home rather than two. Length 0 means no restriction.- keepVariants
Character vector of variant identifiers to retain prior to per-block QC. Length 0 means no restriction.
- keepIndel
Logical (length 1). When
FALSE, variants whose alleles are not single nucleotides (indels) are dropped at extraction. DefaultTRUE(keep all variants).
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(study = "s1", genotypes = panel, phenotypes = list(brain = se))
#> QtlDataset for study 's1'
#> 1 context(s): brain
#> 1 unique traits across contexts
#> Genotypes: plink1 @ /tmp/RtmppU8QTb/temp_libpath984aa04109/pecotmr/extdata/toy_ref
#> Genotype covariates: 0 cols
#> Samples: 165
#> Scale residuals: TRUE