file <- system.file("extdata", "illumina_geno.nc", package="GWASdata")
nc <- NcdfGenotypeReader(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
geno <- getGenotype(nc, snp=c(1,-1), scan=c(1,1))
# starting at snp 100, get 10 snps for the first 5 scans
geno <- getGenotype(nc, snp=c(100,10), scan=c(1,5))
close(nc)
Run the code above in your browser using DataLab