Last data update: 2014.03.03

R: Class GdsIntensityReader
GdsIntensityReaderR Documentation

Class GdsIntensityReader

Description

The GdsIntensityReader class is an extension of the GdsReader class specific to reading intensity data stored in GDS files.

Extends

GdsReader

Constructor

GdsIntensityReader(filename):

filename must be the path to a GDS file. The GDS file must contain the following variables:

  • 'snp': a coordinate variable with a unique integer vector of snp ids

  • 'chromosome': integer chromosome values of dimension 'snp'

  • 'position': integer position values of dimension 'snp'

  • 'sampleID': a unique integer vector of scan ids with dimension 'sample'

Default values for chromosome codes are 1-22=autosome, 23=X, 24=XY, 25=Y, 26=M. The defaults may be changed with the arguments autosomeCode, XchromCode, XYchromCode, YchromCode, and MchromCode.

The GDS file should also contain at least one of the following variables with dimensions ('snp','sample'):

  • 'quality': quality score

  • 'X': X intensity

  • 'Y': Y intensity

  • 'BAlleleFreq': B allele frequency

  • 'LogRRatio': Log R Ratio

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

Accessors

In the code snippets below, object is a GdsIntensityReader object. snp and scan indicate which elements to return along the snp and scan dimensions. They must be integer vectors of the form (start, count), where start is the index of the first data element to read and count is the number of elements to read. A value of '-1' for count indicates that the entire dimension should be read. If snp and/or is scan omitted, the entire variable is read.

See GdsReader for additional methods.

nsnp(object): The number of SNPs in the GDS file.

nscan(object): The number of scans in the GDS file.

getSnpID(object, index): A unique integer vector of snp IDs. The optional index is a logical or integer vector specifying elements to extract.

getChromosome(object, index, char=FALSE): A vector of chromosomes. The optional index is a logical or integer vector specifying elements to extract. If char=FALSE (default), returns an integer vector. If char=TRUE, returns a character vector with elements in (1:22,X,XY,Y,M,U). "U" stands for "Unknown" and is the value given to any chromosome code not falling in the other categories.

getPosition(object, index): An integer vector of base pair positions. The optional index is a logical or integer vector specifying elements to extract.

getScanID(object, index): A unique integer vector of scan IDs. The optional index is a logical or integer vector specifying elements to extract.

getQuality(object, snp, scan, drop=TRUE): Extracts quality scores. The result is a vector or matrix, depending on the number of dimensions in the returned values and the value of drop. Missing values are represented as NA.

hasQuality(object): Returns TRUE if the GDS file contains a variable 'quality'.

getX(object, snp, scan, drop=TRUE): Extracts X intensity. The result is a vector or matrix, depending on the number of dimensions in the returned values and the value of drop. Missing values are represented as NA.

hasX(object): Returns TRUE if the GDS file contains a variable 'X'.

getY(object, snp, scan, drop=TRUE): Extracts Y intensity. The result is a vector or matrix, depending on the number of dimensions in the returned values and the value of drop. Missing values are represented as NA.

hasY(object): Returns TRUE if the GDS file contains a variable 'Y'.

getBAlleleFreq(object, snp, scan, drop=TRUE): Extracts B allele frequency. The result is a vector or matrix, depending on the number of dimensions in the returned values and the value of drop. Missing values are represented as NA.

hasBAlleleFreq(object): Returns TRUE if the GDS file contains a variable 'BAlleleFreq'.

getLogRRatio(object, snp, scan, drop=TRUE): Extracts Log R Ratio. The result is a vector or matrix, depending on the number of dimensions in the returned values and the value of drop. Missing values are represented as NA.

hasLogRRatio(object): Returns TRUE if the GDS file contains a variable 'LogRRatio'.

getVariable(object, varname, snp, scan, drop=TRUE): Returns the contents of the variable varname. The result is a vector or matrix, depending on the number of dimensions in the returned values and the value of drop. Missing values are represented as NA. If the variable is not found in the GDS file, returns NULL.

autosomeCode(object): Returns the integer codes for the autosomes.

XchromCode(object): Returns the integer code for the X chromosome.

XYchromCode(object): Returns the integer code for the pseudoautosomal region.

YchromCode(object): Returns the integer code for the Y chromosome.

MchromCode(object): Returns the integer code for mitochondrial SNPs.

Author(s)

Stephanie Gogarten

See Also

GdsReader, GdsGenotypeReader, GenotypeData, IntensityData

Examples

file <- system.file("extdata", "illumina_qxy.gds", package="GWASdata")
gds <- GdsIntensityReader(file)

# dimensions
nsnp(gds)
nscan(gds)

# get snpID and chromosome
snpID <- getSnpID(gds)
chrom <- getChromosome(gds)

# get positions only for chromosome 22
pos22 <- getPosition(gds, index=(chrom == 22))

# get all snps for first scan
x <- getX(gds, snp=c(1,-1), scan=c(1,1))

# starting at snp 100, get 10 snps for the first 5 scans
x <- getX(gds, snp=c(100,10), scan=c(1,5))

close(gds)

Results


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/GdsIntensityReader-class.Rd_%03d_medium.png", width=480, height=480)
> ### Name: GdsIntensityReader
> ### Title: Class GdsIntensityReader
> ### Aliases: GdsIntensityReader-class GdsIntensityReader
> ###   getVariable,GdsIntensityReader-method
> ###   getSnpID,GdsIntensityReader-method
> ###   getChromosome,GdsIntensityReader-method
> ###   getPosition,GdsIntensityReader-method
> ###   getScanID,GdsIntensityReader-method
> ###   getQuality,GdsIntensityReader-method getX,GdsIntensityReader-method
> ###   getY,GdsIntensityReader-method
> ###   getBAlleleFreq,GdsIntensityReader-method
> ###   getLogRRatio,GdsIntensityReader-method
> ###   hasQuality,GdsIntensityReader-method hasX,GdsIntensityReader-method
> ###   hasY,GdsIntensityReader-method
> ###   hasBAlleleFreq,GdsIntensityReader-method
> ###   hasLogRRatio,GdsIntensityReader-method nsnp,GdsIntensityReader-method
> ###   nscan,GdsIntensityReader-method
> ###   autosomeCode,GdsIntensityReader-method
> ###   XchromCode,GdsIntensityReader-method
> ###   XYchromCode,GdsIntensityReader-method
> ###   YchromCode,GdsIntensityReader-method
> ###   MchromCode,GdsIntensityReader-method
> ### Keywords: methods classes
> 
> ### ** Examples
> 
> file <- system.file("extdata", "illumina_qxy.gds", package="GWASdata")
> gds <- GdsIntensityReader(file)
> 
> # dimensions
> nsnp(gds)
[1] 3300
> nscan(gds)
[1] 77
> 
> # get snpID and chromosome
> snpID <- getSnpID(gds)
> chrom <- getChromosome(gds)
> 
> # get positions only for chromosome 22
> pos22 <- getPosition(gds, index=(chrom == 22))
> 
> # get all snps for first scan
> x <- getX(gds, snp=c(1,-1), scan=c(1,1))
> 
> # starting at snp 100, get 10 snps for the first 5 scans
> x <- getX(gds, snp=c(100,10), scan=c(1,5))
> 
> close(gds)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>