# load data
data(hapmap_geno)
# create a gds file
with(hapmap_geno, snpgdsCreateGeno("test.gds", genmat=genotype,
sample.id=sample.id, snp.id=snp.id, snp.chromosome=snp.chromosome,
snp.position=snp.position, snp.allele=snp.allele, snpfirstdim=TRUE))
# open the gds file
genofile <- snpgdsOpen("test.gds")
RV <- snpgdsPCA(genofile)
plot(RV$eigenvect[,2], RV$eigenvect[,1], xlab="PC 2", ylab="PC 1")
# close the file
snpgdsClose(genofile)
Run the code above in your browser using DataLab