Load a QtlSumStats collection from a manifest
Source:R/manifestLoaders.R
loadQtlSumStatsFromManifest.RdBuild a QtlSumStats from a manifest with one row
per (study, context, trait) tuple. No QC is run. Each sumstats file
needs a z column, or beta+se from which the Wald z
(z = beta/se) is derived when z is absent (a supplied
z takes precedence).
Usage
loadQtlSumStatsFromManifest(
manifest,
genome = NULL,
ldReference = NULL,
region = NULL,
minLdOverlapWarn = 0.5,
columnMapping = NULL,
sampleSelect = NULL,
formatMapping = NULL,
traitColumn = NULL,
variantIdAlleles = c("none", "A2A1", "A1A2")
)Arguments
- manifest
A data.frame or path. Columns (snake_case aliases accepted):
study,context,trait(required),sumStatsPath(required),columnMapping(optional),nSample(optional tuple-level total N),varY(optional), and the single-valuedgenome/ldReferencePath. When a row suppliesnSample, its sumstats file need not carry a per-variantNcolumn;summaryStatsQcfillsNfrom the scalar. (Unlike the GWAS loader, there are nonCase/nControlcolumns: molecular QTL traits are quantitative.)- genome
Genome build; reconciled with a
genomecolumn.- ldReference
A genotype panel (see
readGenotypes) or spec; reconciled with anldReferencePathcolumn.- region, minLdOverlapWarn, columnMapping, sampleSelect, formatMapping
As for
loadGwasSumStatsFromManifest.- traitColumn
Optional column of the sumstats file naming the trait of each row (e.g.
"molecular_trait_id"in a cis-QTL scan, which writes every gene into one table). When set, each manifest row keeps only the rows whosetraitColumnequals that row'strait. Without it a multi-trait file loads whole, sinceregionrestriction needs a tabix index and neighbouring cis windows overlap regardless.- variantIdAlleles
Where to find the alleles when the file has no
A1/A2columns – a cis-QTL scan reports effect + se against the counted allele and leaves the alleles inside the variant id. The order within an id cannot be recovered from the string (a.pvarwritesREF:ALT, i.e. pecotmr's canonicalA2:A1; a PLINK.bimwritesA1:A2), so declare it:"none"(default, require real columns),"A2A1", or"A1A2". An explicit allele column always wins. Declaring the wrong order fails silently –summaryStatsQcwill sign- and strand-flip every variant to "correct" the apparent mismatch against the panel.
Examples
tsv <- system.file("extdata", "manifests",
"protocol_example.twas.gwas_sumstats.chr22.tsv.gz", package = "pecotmr")
ldStem <- file.path(system.file("extdata", "ld_reference", "chr22",
package = "pecotmr"), "protocol_example.LD.chr22")
manifest <- data.frame(study = "s1", context = "brain",
trait = "ENSG1", sumStatsPath = tsv)
loadQtlSumStatsFromManifest(manifest = manifest, genome = "hg38",
ldReference = ldStem, region = "chr22:10000000-19000000")
#> Warning: QtlSumStats[s1/brain/ENSG1]: no effect-allele frequency declared (map `af: <col>` to export a directional af); top_loci$af will be NA. A directionless `maf`/`FRQ` is used for QC only, never as af.
#> QtlSumStats: 1 entries, genome build hg38
#> 1 studies, 1 contexts, 1 traits
#> LD reference: plink2 @ /tmp/RtmpmBLZhq/temp_libpathaae388f3498/pecotmr/extdata/ld_reference/chr22/protocol_example.LD.chr22