Construct a QtlSumStats S4 DFrame-subclass collection
from per-tuple vectors and a list of GRanges entries (one per
tuple), plus a single LD reference 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).
Arguments
- studyName
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 reference.- ldReference
The LD reference: a genotype panel (see
readGenotypes), aGenotypeMixtureor anLdMatrix.- 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 withnSamples()(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(qcInfo(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.- extraCols
Optional named list of additional per-tuple columns to attach to the collection's
mcols. Named rather than variadic because the base class's own constructor,GRangesList(...), uses...for its elements: a bare...here would read as adding an entry rather than a metadata column.
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(studyName = "s1", context = "brain", trait = "g1", entry =
list(gr), genome = "hg38", ldReference = panel)
#> QtlSumStats: 1 entries, genome build hg38
#> 1 studies, 1 contexts, 1 traits
#> LD reference: plink1 @ /tmp/RtmpmBLZhq/temp_libpathaae388f3498/pecotmr/extdata/toy_ref