# NOT RUN {
##---- Do genome scan and get the ancestry proportation for individuals ----
# Scan genomes (HapMap)
HapmapScan=GenomeAdapt.gds(genfile = SNPRelate::snpgdsExampleFileName(),
method="EIGMIX",num.thread = 1L, autosome.only=TRUE,
remove.monosnp=TRUE, maf=0.01, missing.rate=0.1)
# get population information
genofile <- SNPRelate::snpgdsOpen(SNPRelate::snpgdsExampleFileName())
pop_code <- gdsfmt::read.gdsn(gdsfmt::index.gdsn(genofile, "sample.annot/pop.group"))
# get sample id
samp.id <- gdsfmt::read.gdsn(gdsfmt::index.gdsn(genofile, "sample.id"))
SNPRelate::snpgdsClose(genofile)
# define groups
groups <- list(CEU = samp.id[pop_code == "CEU"],
YRI = samp.id[pop_code == "YRI"],
CHB = samp.id[is.element(pop_code, c("HCB", "JPT"))])
### estimate the ancestry proportion
Admixpro=AdmixProp(HapmapScan,groups=groups,bound=TRUE)
PlotAdmix(Admixpro,group=as.factor(pop_code),multiplot = FALSE)
# }
Run the code above in your browser using DataLab