Skip to contents

Build a GwasSumStats from a manifest with one row per study. No QC is run (the result carries qcInfo = list()). 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

loadGwasSumStatsFromManifest(
  manifest,
  genome = NULL,
  ldSketch = NULL,
  region = NULL,
  minLdOverlapWarn = 0.5,
  columnMapping = NULL,
  sampleSelect = NULL,
  formatMapping = NULL,
  ldBlocks = NULL
)

Arguments

manifest

A data.frame or path. Columns (snake_case aliases accepted): study (required, unique), sumStatsPath (required), columnMapping (optional), nCase / nControl (optional), nSample (optional study-level total N), varY (optional), and the single-valued genome / ldSketchPath. When a row supplies a study-level scalar (nCase + nControl, or nSample), its sumstats file need not carry a per-variant N column; summaryStatsQc fills N from the scalar.

genome

Genome build; reconciled with a genome column.

ldSketch

A genotype panel (see readGenotypes) or a spec (path/prefix/genoMeta); reconciled with an ldSketchPath column.

region

Optional chr:start-end string, GRanges, or one-row data.frame restricting the variants read (honoured only for tabix-indexed text and bgzipped+tabixed VCF; ignored with a warning otherwise).

minLdOverlapWarn

Warn when the fraction of sumstats variants present in the LD sketch falls below this (default 0.5).

columnMapping

Optional default column mapping (a named list/vector, or a path to a YAML file of standardName: sourceName entries) applied when a row has no columnMapping.

sampleSelect

Optional GWAS-VCF FORMAT sample (study) column to read.

formatMapping

Optional GWAS-VCF FORMAT tag mapping (canonical stat -> FORMAT field), overriding ES/SE/LP/SS/EAF defaults.

ldBlocks

Optional LD-block specification (an LdBlocks, a GRanges, a data.frame with chrom/start/end, or a path to such a table). Without it a genome-wide file splits into one element per chromosome; with it, into one element per LD block, which is the granularity assembleCtwasInputs needs.

Value

A GwasSumStats object.

Examples

gwasTsv <- 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 = "g1", sumStatsPath = gwasTsv)
loadGwasSumStatsFromManifest(manifest = manifest, genome = "hg38",
  ldSketch = ldStem, region = "chr22:10000000-19000000")
#> Warning: GwasSumStats[study=g1]: 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.
#> GwasSumStats: 1 studies, genome build hg38
#>   LD sketch: plink2 @ /tmp/RtmppU8QTb/temp_libpath984aa04109/pecotmr/extdata/ld_reference/chr22/protocol_example.LD.chr22