Skip to contents

Extract sample sizes: the per-variant sample-size vector of a GwasSumStats or QtlSumStats entry, selected by its identity tuple, the number of samples carried by a GenotypeHandle, or the panel size an LdMatrix records.

Usage

nSamples(x, ...)

# S4 method for class 'LdMatrix'
nSamples(x, ...)

# S4 method for class 'GenotypeHandle'
nSamples(x)

# S4 method for class 'SumStatsBase'
nSamples(
  x,
  studyName = NULL,
  context = NULL,
  trait = NULL,
  annotateSignificance = NULL,
  ranges = NULL
)

Arguments

x

A GwasSumStats, QtlSumStats, LdMatrix or GenotypeHandle object.

...

Class-specific selection arguments.

studyName

Character (length 1) or NULL. Restrict the selection to this study; NULL matches all studies.

context

Character (length 1) or NULL. Restrict the selection to this context; NULL matches all contexts.

trait

Character (length 1) or NULL. Restrict the selection to this trait; NULL matches all traits.

annotateSignificance

Optional correction-method name passed through to sumStats (QTL only); NULL applies none.

ranges

A GRanges or NULL (default). Return only the variants overlapping these ranges; NULL returns everything.

Value

Numeric vector of sample sizes for a summary-statistic entry; integer of length 1 for a GenotypeHandle or an LdMatrix (NA when the matrix records no size).

Details

The genotype handle is the seed layer behind a panel and is not part of the public interface; obtain a panel from readGenotypes() and ask it directly.

Examples

data(qtlSumStatsExample)
nSamples(qtlSumStatsExample)
#>   [1] 165 165 165 165 165 165 165 165 165 165 165 165 165 165 165 165 165 165
#>  [19] 165 165 165 165 165 165 165 165 165 165 165 165 165 165 165 165 165 165
#>  [37] 165 165 165 165 165 165 165 165 165 165 165 165 165 165 165 165 165 165
#>  [55] 165 165 165 165 165 165 165 165 165 165 165 165 165 165 165 165 165 165
#>  [73] 165 165 165 165 165 165 165 165 165 165 165 165 165 165 165 165 165 165
#>  [91] 165 165 165 165 165 165 165 165 165 165 165 165 165 165 165 165 165 165
#> [109] 165 165 165 165 165 165 165 165 165 165 165 165 165 165 165 165 165 165
#> [127] 165 165 165 165 165 165 165 165 165 165 165 165 165 165 165 165 165 165
#> [145] 165 165 165 165 165 165 165 165 165 165 165 165 165 165 165 165 165 165
#> [163] 165 165 165 165 165 165 165 165 165 165 165 165 165 165 165 165 165 165
#> [181] 165 165 165 165 165 165 165 165 165 165 165 165 165 165 165 165 165 165
#> [199] 165 165