R/RAIDS.R
demoKnownSuperPop1KG.Rd
The object is a vector
.
data(demoKnownSuperPop1KG)
The vector
containing the know super population ancestry
for the demo 1KG reference profiles.
The vector
containing the know super population ancestry
for the demo 1KG reference profiles.
This object can be
used to test the computeKNNRefSynthetic
and
computePoolSyntheticAncestryGr
functions.
computeKNNRefSynthetic
for running a k-nearest neighbors analysis on a subset of the synthetic data set.
computePoolSyntheticAncestryGr
for running a PCA analysis using 1 synthetic profile from each sub-continental population.
## Required library
library(gdsfmt)
## Load the demo PCA on the synthetic profiles projected on the
## demo 1KG reference PCA
data(demoPCASyntheticProfiles)
## Load the known ancestry for the demo 1KG reference profiles
data(demoKnownSuperPop1KG)
## Path to the demo Profile GDS file is located in this package
dataDir <- system.file("extdata/demoKNNSynthetic", package="RAIDS")
## Open the Profile GDS file
gdsProfile <- snpgdsOpen(file.path(dataDir, "ex1.gds"))
# The name of the synthetic study
studyID <- "MYDATA.Synthetic"
## Projects synthetic profiles on 1KG PCA
results <- computeKNNRefSynthetic(gdsProfile=gdsProfile,
listEigenvector=demoPCASyntheticProfiles,
listCatPop=c("EAS", "EUR", "AFR", "AMR", "SAS"), studyIDSyn=studyID,
spRef=demoKnownSuperPop1KG)
## The inferred ancestry for the synthetic profiles for different values
## of D and K
head(results$matKNN)
#> sample.id D K SuperPop
#> 1 1.ex1.HG00246.1 2 2 SAS
#> 2 1.ex1.HG00246.1 2 3 SAS
#> 3 1.ex1.HG00246.1 2 4 EUR
#> 4 1.ex1.HG00246.1 2 5 EUR
#> 5 1.ex1.HG00246.1 2 6 EUR
#> 6 1.ex1.HG00246.1 2 7 EAS
## Close Profile GDS file (important)
closefn.gds(gdsProfile)