Coerce Summary Statistics to a Data Frame
Source:R/qtlSumStats.R, R/gwasSumStats.R
sumStatsDataFrame.RdCoerce one tuple of a GwasSumStats or
QtlSumStats collection to a per-variant data.frame in the
standardized layout variant_id, chrom, pos, A1, A2, z, beta, se, N,
maf (optional columns omitted when absent on the entry). This is the
table view of sumStats, which returns the same selection as
a GRanges; coercion rather than a return-type argument is the
Bioconductor idiom for choosing a representation.
Usage
# S4 method for class 'QtlSumStats'
as.data.frame(
x,
row.names = NULL,
optional = FALSE,
studyName = NULL,
context = NULL,
trait = NULL,
require = character(0),
derive = c("none", "zFromBetaSe"),
keepChrPrefix = TRUE,
...
)
# S4 method for class 'GwasSumStats'
as.data.frame(
x,
row.names = NULL,
optional = FALSE,
studyName = NULL,
require = character(0),
derive = c("none", "zFromBetaSe"),
keepChrPrefix = TRUE,
...
)Arguments
- x
A
GwasSumStatsorQtlSumStatsobject.- row.names, optional
Accepted for compatibility with
as.data.frameand ignored.- studyName
Character (length 1) or
NULL. Restrict the selection to this study;NULLmatches all studies.- context
Character (length 1) or
NULL. Restrict the selection to this context;NULLmatches all contexts (QtlSumStatsonly).- trait
Character (length 1) or
NULL. Restrict the selection to this trait;NULLmatches all traits (QtlSumStatsonly).- require
Character vector. Columns that must be present (derived if necessary) in the returned summary-statistics data frame.
- derive
Whether to derive missing standard columns from the available ones;
"zFromBetaSe"recoverszfrombeta/se.- keepChrPrefix
Logical. If
TRUE, keep thechrprefix on chromosome names; otherwise strip it.- ...
Unused.
Examples
data(qtlSumStatsExample)
head(as.data.frame(qtlSumStatsExample))
#> # A tibble: 6 × 10
#> variant_id chrom pos A1 A2 z beta se N maf
#> <chr> <chr> <int> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 chr22:14560203:A:G chr22 1.46e7 G A -1.02 -0.237 0.232 165 0.0758
#> 2 chr22:14564328:T:C chr22 1.46e7 C T 0.109 0.0190 0.175 165 0.176
#> 3 chr22:14850625:T:G chr22 1.49e7 G T -0.225 -0.0431 0.192 165 0.127
#> 4 chr22:14870204:T:C chr22 1.49e7 C T -0.989 -0.119 0.121 165 0.352
#> 5 chr22:14878387:G:A chr22 1.49e7 A G -0.884 -0.149 0.169 165 0.166
#> 6 chr22:14880040:A:G chr22 1.49e7 G A -1.36 -0.191 0.140 165 0.179