R/ancestryAnalysis.R
prepPedSyntheticRef.RdThe function extracts the information for the profiles associated to a specific study in the GDS Sample file. The information is extracted from the 'study.annot' node as a 'data.frame'.
Then, the function used the 1KG GDS file to extract specific information about each sample and add it, as an extra column, to the 'data.frame'.
As example, this function can extract the synthetic profiles for a GDS Sample and the super-population of the 1KG samples used to generate each synthetic profile would be added as an extra column to the final 'data.frame'.
prepPedSyntheticRef(pRAIDS)data.frame containing the columns extracted from the
GDS Sample 'study.annot' node with a extra column named as the 'popName'
parameter that has been extracted from the 1KG GDS 'sample.annot' node.
Only the rows corresponding to the specified study ('studyID' parameter)
are returned.
As example, this function can extract the synthetic profiles for a Profile GDS and the super-population of the 1KG samples used to generate each synthetic profile would be added as an extra column to the final 'data.frame'. In that situation, the 'popName' parameter would correspond to the super-population column and the 'studyID' parameter would be the name given to the synthetic dataset.
## Load the known ancestry for the demo 1KG reference profiles
data(demoKnownSuperPop1KG)
## The Reference GDS file
path1KG <- system.file("extdata/tests", package="RAIDS")
## Path to the demo Profile GDS file is located in this package
dataDir <- system.file("extdata/demoAncestryCall", package="RAIDS")
# The name of the synthetic study
studyID <- "MYDATA"
studyDF <- data.frame(study.id=studyID,
study.desc=studyID,
study.platform="NotDef",
stringsAsFactors=FALSE)
pathProfileGDS <- file.path(dataDir) # , "ex1.gds"
fileReferenceGDS <- system.file("extdata/tests/ex1_good_small_1KG.gds", package="RAIDS")
pedStudy <- data.frame(Name.ID=c("ex1"),
Case.ID=c("ex1"),
Sample.Type=c("type"),
Diagnosis="NotDef",
Source=c("NotDef"),
stringsAsFactors=FALSE)
row.names(pedStudy) <- pedStudy$Name.ID
pRAIDS <- RAIDSparam(studyDF=studyDF,
pedStudy=pedStudy,
pathProfileGDS=pathProfileGDS,
fileReferenceGDS=fileReferenceGDS,
fieldPopInfAnc="SuperPop")
pedSyn <- RAIDS:::prepPedSyntheticRef(pRAIDS)
head(pedSyn)
#> data.id case.id sample.type diagnosis source
#> 1.ex1.HG00246.1 1.ex1.HG00246.1 HG00246 Synthetic Cancer Synthetic
#> 1.ex1.HG00138.1 1.ex1.HG00138.1 HG00138 Synthetic Cancer Synthetic
#> 1.ex1.HG00325.1 1.ex1.HG00325.1 HG00325 Synthetic Cancer Synthetic
#> 1.ex1.HG00330.1 1.ex1.HG00330.1 HG00330 Synthetic Cancer Synthetic
#> 1.ex1.HG00611.1 1.ex1.HG00611.1 HG00611 Synthetic Cancer Synthetic
#> 1.ex1.HG00406.1 1.ex1.HG00406.1 HG00406 Synthetic Cancer Synthetic
#> study.id superPop
#> 1.ex1.HG00246.1 MYDATA.Synthetic EUR
#> 1.ex1.HG00138.1 MYDATA.Synthetic EUR
#> 1.ex1.HG00325.1 MYDATA.Synthetic EUR
#> 1.ex1.HG00330.1 MYDATA.Synthetic EUR
#> 1.ex1.HG00611.1 MYDATA.Synthetic EAS
#> 1.ex1.HG00406.1 MYDATA.Synthetic EAS