Learn R Programming

GWASTools (version 1.12.2)

GdsReader: Class GdsReader

Description

The GdsReader class provides an interface for reading GDS files.

Arguments

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): 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.
The result is a vector, matrix, or array, depending on the number of dimensions in the returned values. 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.

See Also

gdsfmt

Examples

Run this code
library(SNPRelate)
gds <- GdsReader(snpgdsExampleFileName())

getVariableNames(gds)

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

close(gds)

Run the code above in your browser using DataLab