GenotypeIterator-class: Class GenotypeIterator

Description Details Constructor Accessors Author(s) See Also Examples

Description

Extends GenotypeData to provide iterators over SNPs.

Details

Iterator classes allow for iterating over blocks of SNPs.

For GenotypeBlockIterator, each call to iterateFilter will select the next unit of snpBlock SNPs.

Constructor

GenotypeBlockIterator(genoData, snpBlock=10000, snpInclude=NULL: Returns a GenotypeBlockIterator object with the filter set to the first block.

genoData is a GenotypeData object.

snpBlock is an integer specifying the number of SNPs in an iteration block.

snpInclude is a vector of snpIDs to include in the filter. If NULL (default), all SNPs are included.

Accessors

iterateFilter(x): Advance the filter to the next block, range, or set of ranges. Returns TRUE while there are still variants left to be read, FALSE if the end of iteration is reached.

lastFilter(x), lastFilter(x)<- value: Get or set the last filter index from the previous call to iterateFilter.

snpFilter(x): Get the list of SNP indices.

currentFilter(x): Get the indices of SNPs selected in the current iteration.

resetIterator(x): Set the filter to the first block (the same SNPs that are selected when the iterator object is created).

getSnpID(object, ...): A unique integer vector of snp IDs.

getChromosome(object, ...): A vector of chromosomes.

getPosition(object, ...): An integer vector of base pair positions.

getAlleleA(object, ...): A character vector of A alleles.

getAlleleB(object, ...): A character vector of B alleles.

getGenotypeSelection(object, ...): Extracts genotype values (number of A alleles).

getSnpVariable(object, varname, ...): Returns the snp annotation variable varname.

Additional arguments for these accessors are passed to the corresponding methods for GenotypeData objects.

Other methods are inherited from GenotypeData.

Author(s)

Stephanie Gogarten

See Also

GenotypeData

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
library(GWASdata)
file <- system.file("extdata", "illumina_geno.gds", package="GWASdata")
gds <- GdsGenotypeReader(file)
genoData <- GenotypeData(gds)

iterator <- GenotypeBlockIterator(genoData, snpBlock=100)
id <- getSnpID(iterator)
length(id)
head(id)
geno <- getGenotypeSelection(iterator)
dim(geno)
geno <- getGenotypeSelection(iterator, scan=1:10)
dim(geno)
head(geno)

iterateFilter(iterator)
id <- getSnpID(iterator)
length(id)
head(id)
geno <- getGenotypeSelection(iterator, scan=1:10)
dim(geno)
head(geno)

close(iterator)

GWASTools documentation built on Nov. 8, 2020, 7:49 p.m.