snpID <- 1:100
chrom <- rep(1:20, each=5)
pos <- 1001:1100
scanID <- 1:20
geno <- matrix(sample(c(0,1,2,NA), 2000, replace=TRUE), nrow=100, ncol=20)
mgr <- MatrixGenotypeReader(genotype=geno, snpID=snpID,
chromosome=chrom, position=pos, scanID=scanID)
# dimensions
nsnp(mgr)
nscan(mgr)
# get snpID and chromosome
snpID <- getSnpID(mgr)
chrom <- getChromosome(mgr)
# get positions only for chromosome 10
pos10 <- getPosition(mgr, index=(chrom == 10))
# get all snps for first scan
geno <- getGenotype(mgr, snp=c(1,-1), scan=c(1,1))
# starting at snp 50, get 10 snps for the first 5 scans
geno <- getGenotype(mgr, snp=c(50,10), scan=c(1,5))
Run the code above in your browser using DataLab