Description Usage Arguments Value Author(s) See Also Examples
View source: R/SNPRelate_Main.r
To get a genotype matrix from a specified GDS file
1  | snpgdsGetGeno(gdsobj, sample.id=NULL, snp.id=NULL, snpfirstdim=NULL, verbose=TRUE)
 | 
gdsobj | 
 a GDS file object (  | 
sample.id | 
 a vector of sample id specifying selected samples; if NULL, all samples are used  | 
snp.id | 
 a vector of snp id specifying selected SNPs; if NULL, all SNPs are used  | 
snpfirstdim | 
 if TRUE, genotypes are stored in the individual-major mode, (i.e, list all SNPs for the first individual, and then list all SNPs for the second individual, etc); if NULL, determine automatically  | 
verbose | 
 if TRUE, show information  | 
Return an integer matrix.
Xiuwen Zheng
snpgdsCreateGeno, snpgdsCreateGenoSet,
snpgdsCombineGeno
1 2 3 4 5 6 7 8 9 10  | # open an example dataset (HapMap)
genofile <- openfn.gds(snpgdsExampleFileName())
snpset <- sample(read.gdsn(index.gdsn(genofile, "snp.id")), 1000)
mat <- snpgdsGetGeno(genofile, snp.id=snpset)
mat[!is.element(mat, c(0,1,2))] <- NA
dim(mat)
# close the file
closefn.gds(genofile)
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.