GdsReader {GWASTools} | R Documentation

## Class GdsReader

### Description

The GdsReader class provides an interface for reading GDS files.

### Constructor

  `GdsReader(filename, ...)`:

  `filename` must be the path to a GDS file or an already opened gds object.

  The `GdsReader` constructor creates and returns a GdsReader instance pointing to this file.

### Accessors

In the code snippets below, `object` is a GdsReader object.

  `getVariable(object, varname, start, count, sel=NULL, drop=TRUE)`: Returns the contents of the variable `varname`.

  - `start` is a vector of integers indicating where to start reading values. The length of this vector must equal the number of dimensions the variable has. If not specified, reading starts at the beginning of the file (1,1,...).

  - `count` is a vector of integers indicating the count of values to read along each dimension. The length of this vector must equal the number of dimensions the variable has. If not specified and the variable does NOT have an unlimited dimension, the entire variable is read. As a special case, the value "-1" indicates that all entries along that dimension should be read.

  - `sel` may be specified instead of `start` and `count`. It is a list of m logical vectors, where m is the number of dimensions of `varname` and each logical vector should have the same size as the corresponding dimension in `varname`.

  - `drop` is a logical for whether the result will be coerced to the lowest possible dimension.

  The result is a vector, matrix, or array, depending on the number of dimensions in the returned values and the value of `drop`. Missing values (specified by a "missing.value" attribute, see `put.attr.gdsn`) are represented as `NA`. If the variable is not found in the GDS file, returns `NULL`.

  `getVariableNames(object)`: Returns names of variables in the GDS file.

  `getDimension(object, varname)`: Returns dimension for GDS variable `varname`.

  `getNodeDescription(object, varname)`: Returns description for GDS variable `varname`.

  `getAttribute(object, attname, varname)`: Returns the attribute `attname` associated with the variable `varname`.

  `hasVariable(object, varname)`: Returns `TRUE` if `varname` is a variable in the GDS file.

### Standard Generic Methods

In the code snippets below, `object` is a GdsReader object.

  `open(object)`: Opens a connection to a GDS file.

  `close(object)`: Closes the connection to a GDS file.

  `show(object)`: Summarizes the contents of a GDS file.

### Author(s)

Stephanie Gogarten

### See Also

gdsfmt

### Examples

    library(SNPRelate)
    gds <- GdsReader(snpgdsExampleFileName())

    getVariableNames(gds)

    hasVariable(gds, "genotype")
    geno <- getVariable(gds, "genotype", start=c(1,1), count=c(10,10))

    close(gds)

[Package GWASTools version 1.30.1 Index]