Construct a QtlSumStats S4 DFrame-subclass collection
from per-tuple vectors and a list of GRanges entries (one per
tuple), plus a single LD sketch handle and a single genome build that apply
to the whole collection. Each GRanges entry must carry per-variant
statistics in its mcols (SNP, A1, A2, Z,
N; plus optional MAF, INFO, BETA, SE,
P).
Usage
QtlSumStats(
study,
context,
trait,
entry,
genome,
ldSketch = NULL,
varY = NA_real_,
nSample = NULL,
qcInfo = list(),
traitPos = NULL,
...
)Arguments
- study
Character vector of study identifiers (per tuple).
- context
Character vector of context labels (per tuple).
- trait
Character vector of trait identifiers (per tuple).
- entry
A list /
SimpleListofGRanges, one per tuple. Same length asstudy,context, andtrait.- genome
Single character string giving the genome build (e.g.,
"hg19","hg38"). Uniform across the collection because all entries share the same LD sketch.- ldSketch
A genotype panel (see
readGenotypes) carrying the LD reference.- varY
Optional numeric vector of per-tuple phenotype variances (
NA_real_entries allowed).- nSample
Optional per-tuple total sample size (numeric; default
NULL). Attached only when supplied (length 1 or length(study)). Used as the study-level fallback for the per-variantNwhen a tuple has no per-variantNcolumn. NamednSampleto avoid clashing withgetNSamples()(the LD-panel sample size). Unlike GWAS, QTL collections carry no case/control counts (molecular traits are quantitative), so only this total-N fallback is exposed.- qcInfo
A
listrecording which QC steps ran. Emptylist()on construction; populated bysummaryStatsQc()with a per-step audit record. Fine-mapping / TWAS pipelines reject inputs wherelength(getQcInfo(x)) == 0.- traitPos
Optional per-row trait genomic anchor (a
GRangesorNULL), carried forward as provenance; not part of the identity key.NULL(default) omits the column.- ...
Additional per-tuple columns to attach to the collection.
Examples
panel <- readGenotypes(
system.file("extdata", "toy_ref.bed", package = "pecotmr"))
gr <- GenomicRanges::GRanges("chr1", IRanges::IRanges(100 * 1:3, width = 1))
S4Vectors::mcols(gr) <- S4Vectors::DataFrame(SNP = paste0("rs", 1:3),
A1 = "A", A2 = "G", Z = rnorm(3), N = 100L)
QtlSumStats(study = "s1", context = "brain", trait = "g1", entry = list(gr),
genome = "hg38", ldSketch = panel)
#> QtlSumStats: 1 entries, genome build hg38
#> 1 studies, 1 contexts, 1 traits
#> LD sketch: plink1 @ /tmp/RtmppU8QTb/temp_libpath984aa04109/pecotmr/extdata/toy_ref