The IntensityData class is a container for storing intensity data from a
genome-wide association study together with the metadata associated
with the subjects and SNPs involved in the study.
Details
The IntensityData class consists of three slots: data, snp annotation,
and scan annotation. There may be
multiple scans associated with a subject (e.g. duplicate scans for
quality control), hence the use of "scan" as one dimension of the
data.
Snp and scan annotation are optional, but if included in the
IntensityData object, their unique integer ids (snpID and scanID) are
checked against the ids stored in the data file to ensure consistency.
data must be a GdsIntensityReader or NcdfIntensityReader object.
snpAnnot, if not NULL, must be a
SnpAnnotationDataFrame or SnpAnnotationSQLite object.
scanAnnot, if not NULL, must be a
ScanAnnotationDataFrame or ScanAnnotationSQLite object.
The IntensityData constructor creates and returns a
IntensityData instance, ensuring that data, snpAnnot, and scanAnnot
are internally consistent.
Accessors
In the code snippets below, object is an IntensityData 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.
nsnp(object): The number of SNPs in the data.
nscan(object): The number of scans in the data.
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).
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.
getSex(object, index): A character vector of sex, with values 'M'
or 'F'. The optional index is a logical or
integer vector specifying elements to extract.
hasSex(object): Returns TRUE if the column 'sex' is present in
object.
getQuality(object, snp, scan): Extracts quality scores.
The result is a vector or matrix, depending on the number
of dimensions in the returned values. Missing values are
represented as NA.
getX(object, snp, scan): Extracts X intensity values.
The result is a vector or matrix, depending on the number
of dimensions in the returned values. Missing values are
represented as NA.
getY(object, snp, scan): Extracts Y intensity values.
The result is a vector or matrix, depending on the number
of dimensions in the returned values. Missing values are
represented as NA.
getBAlleleFreq(object, snp, scan): Extracts B allele
frequency values.
The result is a vector or matrix, depending on the number
of dimensions in the returned values. Missing values are
represented as NA.
getLogRRatio(object, snp, scan): Extracts Log R Ratio values.
The result is a vector or matrix, depending on the number
of dimensions in the returned values. Missing values are
represented as NA.
getSnpVariable(object, varname, index): Returns the snp
annotation variable varname.
The optional index is a logical or
integer vector specifying elements to extract.
getSnpVariableNames(object): Returns a character vector
with the names of the columns in the snp annotation.
hasSnpVariable(object, varname): Returns TRUE if the
variable varname is present in the snp annotation.
getScanVariable(object, varname, index): Returns the scan
annotation variable varname.
The optional index is a logical or
integer vector specifying elements to extract.
getScanVariableNames(object): Returns a character vector
with the names of the columns in the scan annotation.
hasScanVariable(object, varname): Returns TRUE if the
variable varname is present in the scan annotation.
getVariable(object, varname, snp, scan): Extracts the
contents of the variable varname from the data.
The result is a vector or matrix, depending on the number
of dimensions in the returned values. Missing values are
represented as NA. If the variable is not found, returns NULL.
hasVariable(object, varname): Returns TRUE if
the data contains contains varname, FALSE if not.
hasSnpAnnotation(object): Returns TRUE if the snp
annotation slot is not NULL.
hasScanAnnotation(object): Returns TRUE if the scan
annotation slot is not NULL.
open(object): Opens a connection to the data.
close(object): Closes the data connection.
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.
library(GWASdata)
file <- system.file("extdata", "illumina_qxy.gds", package="GWASdata")
gds <- GdsIntensityReader(file)
# object without annotation
intenData <- IntensityData(gds)
# object with annotation
data(illuminaSnpADF, illuminaScanADF)
intenData <- IntensityData(gds, snpAnnot=illuminaSnpADF, scanAnnot=illuminaScanADF)
# dimensions
nsnp(intenData)
nscan(intenData)
# get snpID and chromosome
snpID <- getSnpID(intenData)
chrom <- getChromosome(intenData)
# get positions only for chromosome 22
pos22 <- getPosition(intenData, index=(chrom == 22))
# get other annotations
if (hasSex(intenData)) sex <- getSex(intenData)
plate <- getScanVariable(intenData, "plate")
rsID <- getSnpVariable(intenData, "rsID")
# get all snps for first scan
x <- getX(intenData, snp=c(1,-1), scan=c(1,1))
# starting at snp 100, get 10 snps for the first 5 scans
x <- getX(intenData, snp=c(100,10), scan=c(1,5))
close(intenData)
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/IntensityData-class.Rd_%03d_medium.png", width=480, height=480)
> ### Name: IntensityData-class
> ### Title: Class IntensityData
> ### Aliases: IntensityData-class IntensityData show,IntensityData-method
> ### open,IntensityData-method close,IntensityData-method
> ### nsnp,IntensityData-method nscan,IntensityData-method
> ### hasSnpAnnotation,IntensityData-method
> ### hasScanAnnotation,IntensityData-method getSnpID,IntensityData-method
> ### getChromosome,IntensityData-method getPosition,IntensityData-method
> ### getScanID,IntensityData-method hasSex,IntensityData-method
> ### getSex,IntensityData-method hasSnpVariable,IntensityData-method
> ### getSnpVariable,IntensityData-method
> ### getSnpVariableNames,IntensityData-method
> ### hasScanVariable,IntensityData-method
> ### getScanVariable,IntensityData-method
> ### getScanVariableNames,IntensityData-method
> ### hasVariable,IntensityData-method getVariable,IntensityData-method
> ### getQuality,IntensityData-method getX,IntensityData-method
> ### getY,IntensityData-method getBAlleleFreq,IntensityData-method
> ### getLogRRatio,IntensityData-method hasQuality,IntensityData-method
> ### hasX,IntensityData-method hasY,IntensityData-method
> ### hasBAlleleFreq,IntensityData-method hasLogRRatio,IntensityData-method
> ### autosomeCode,IntensityData-method XchromCode,IntensityData-method
> ### XYchromCode,IntensityData-method YchromCode,IntensityData-method
> ### MchromCode,IntensityData-method
> ### Keywords: methods classes
>
> ### ** Examples
>
> library(GWASdata)
> file <- system.file("extdata", "illumina_qxy.gds", package="GWASdata")
> gds <- GdsIntensityReader(file)
>
> # object without annotation
> intenData <- IntensityData(gds)
>
> # object with annotation
> data(illuminaSnpADF, illuminaScanADF)
> intenData <- IntensityData(gds, snpAnnot=illuminaSnpADF, scanAnnot=illuminaScanADF)
>
> # dimensions
> nsnp(intenData)
[1] 3300
> nscan(intenData)
[1] 77
>
> # get snpID and chromosome
> snpID <- getSnpID(intenData)
> chrom <- getChromosome(intenData)
>
> # get positions only for chromosome 22
> pos22 <- getPosition(intenData, index=(chrom == 22))
>
> # get other annotations
> if (hasSex(intenData)) sex <- getSex(intenData)
> plate <- getScanVariable(intenData, "plate")
> rsID <- getSnpVariable(intenData, "rsID")
>
> # get all snps for first scan
> x <- getX(intenData, snp=c(1,-1), scan=c(1,1))
>
> # starting at snp 100, get 10 snps for the first 5 scans
> x <- getX(intenData, snp=c(100,10), scan=c(1,5))
>
> close(intenData)
>
>
>
>
>
> dev.off()
null device
1
>