Skip to contents

Build 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-valued genome / ldReferencePath. When a row supplies nSample, its sumstats file need not carry a per-variant N column; summaryStatsQc fills N from the scalar. (Unlike the GWAS loader, there are no nCase/nControl columns: molecular QTL traits are quantitative.)

genome

Genome build; reconciled with a genome column.

ldReference

A genotype panel (see readGenotypes) or spec; reconciled with an ldReferencePath column.

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 whose traitColumn equals that row's trait. Without it a multi-trait file loads whole, since region restriction needs a tabix index and neighbouring cis windows overlap regardless.

variantIdAlleles

Where to find the alleles when the file has no A1/A2 columns – 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 .pvar writes REF:ALT, i.e. pecotmr's canonical A2:A1; a PLINK .bim writes A1:A2), so declare it: "none" (default, require real columns), "A2A1", or "A1A2". An explicit allele column always wins. Declaring the wrong order fails silently – summaryStatsQc will sign- and strand-flip every variant to "correct" the apparent mismatch against the panel.

Value

A QtlSumStats object.

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