NcdfIntensityReader-class: Class NcdfIntensityReader

NcdfIntensityReaderR Documentation

Class NcdfIntensityReader

Description

The NcdfIntensityReader class is an extension of the NcdfReader class specific to reading intensity data stored in NetCDF files.

Extends

NcdfReader

Constructor

  • NcdfIntensityReader(filename):

    filename must be the path to a NetCDF file. The NetCDF 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 NetCDF 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 NcdfIntensityReader constructor creates and returns a NcdfIntensityReader instance pointing to this file.

Accessors

In the code snippets below, object is a NcdfIntensityReader 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. If drop=TRUE the result is coerced to the lowest possible dimension.

See NcdfReader for additional methods.

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

  • nscan(object): The number of scans in the NetCDF 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 NetCDF 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

NcdfReader, NcdfGenotypeReader, GenotypeData, IntensityData

Examples

file <- system.file("extdata", "illumina_qxy.nc", package="GWASdata")
nc <- NcdfIntensityReader(file)

# dimensions
nsnp(nc)
nscan(nc)

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

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

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

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

close(nc)

smgogarten/GWASTools documentation built on Nov. 10, 2024, 9:54 p.m.