R/RAIDS.R
demoPCASyntheticProfiles.Rd
The object is a list
.
data(demoPCASyntheticProfiles)
The list
containing the PCA result of demo synthetic
profiles projected on the demo subset 1KG reference PCA.
The list
contains 3 entries:
a character
string representing the unique
identifier of the synthetic profiles.
a matrix
of numeric
containing
the eigenvectors for the reference profiles.
a matrix
of numeric
containing the
eigenvectors for the current synthetic profiles projected on the demo
PCA 1KG reference profiles.
The list
containing the PCA result of demo synthetic
profiles projected on the demo subset 1KG reference PCA.
The list
contains 3 entries:
a character
string representing the unique
identifier of the synthetic profiles.
a matrix
of numeric
containing
the eigenvectors for the reference profiles.
a matrix
of numeric
containing the
eigenvectors for the current synthetic profiles projected on the demo
PCA 1KG reference profiles.
This object can be
used to test the computeKNNRefSynthetic
function.
computeKNNRefSynthetic
for running a k-nearest neighbors analysis on a subset of the synthetic data set.
## 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 AMR
#> 3 1.ex1.HG00246.1 2 4 EAS
#> 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)