Description Details Constructor Accessors Author(s) See Also Examples
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.
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.
IntensityData(data, snpAnnot=NULL, scanAnnot=NULL)
:
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.
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.
Stephanie Gogarten
SnpAnnotationDataFrame
,
SnpAnnotationSQLite
,
ScanAnnotationDataFrame
,
ScanAnnotationSQLite
,
ScanAnnotationDataFrame
,
GdsIntensityReader
,
NcdfIntensityReader
,
GenotypeData
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.