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.
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(GWASTools)
Loading required package: Biobase
Loading required package: BiocGenerics
Loading required package: parallel
Attaching package: 'BiocGenerics'
The following objects are masked from 'package:parallel':
clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
clusterExport, clusterMap, parApply, parCapply, parLapply,
parLapplyLB, parRapply, parSapply, parSapplyLB
The following objects are masked from 'package:stats':
IQR, mad, xtabs
The following objects are masked from 'package:base':
Filter, Find, Map, Position, Reduce, anyDuplicated, append,
as.data.frame, cbind, colnames, do.call, duplicated, eval, evalq,
get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply,
match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank,
rbind, rownames, sapply, setdiff, sort, table, tapply, union,
unique, unsplit
Welcome to Bioconductor
Vignettes contain introductory material; view with
'browseVignettes()'. To cite Bioconductor, see
'citation("Biobase")', and for packages 'citation("pkgname")'.
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/GWASTools/GdsReader-class.Rd_%03d_medium.png", width=480, height=480)
> ### Name: GdsReader
> ### Title: Class GdsReader
> ### Aliases: GdsReader-class GdsReader open,GdsReader-method
> ### close,GdsReader-method show,GdsReader-method
> ### getDimension,GdsReader-method getNodeDescription,GdsReader-method
> ### getVariableNames,GdsReader-method hasVariable,GdsReader-method
> ### getVariable,GdsReader-method getAttribute,GdsReader-method
> ### Keywords: methods classes
>
> ### ** Examples
>
> library(SNPRelate)
Loading required package: gdsfmt
SNPRelate -- supported by Streaming SIMD Extensions 2 (SSE2)
> gds <- GdsReader(snpgdsExampleFileName())
>
> getVariableNames(gds)
[1] "sample.id" "snp.id" "snp.rs.id"
[4] "snp.position" "snp.chromosome" "snp.allele"
[7] "genotype" "sample.annot/family.id" "sample.annot/father.id"
[10] "sample.annot/mother.id" "sample.annot/sex" "sample.annot/pop.group"
>
> hasVariable(gds, "genotype")
[1] TRUE
> geno <- getVariable(gds, "genotype", start=c(1,1), count=c(10,10))
>
> close(gds)
>
>
>
>
>
> dev.off()
null device
1
>