The function runs a PCA analysis using 1 synthetic profile from each sub-continental population. The reference profiles used to create those synthetic profiles are first removed from the list of 1KG reference profiles that generates the reference PCA. Then, the retained synthetic profiles are projected on the 1KG PCA space. Finally, a K-nearest neighbors analysis using a range of K and D values is done.

computePoolSyntheticAncestryGr2(sampleRM, spRef, pRAIDS)

Arguments

sampleRM

a vector of character strings representing the identifiers of the 1KG reference profiles that should not be used to create the reference PCA. There should be one per sub-continental population. Those profiles are removed because those have been used to generate the synthetic profiles that are going to be analysed here. The sub-continental identifiers are used as names for the vector.

spRef

vector of character strings representing the known super population ancestry for the 1KG profiles. The 1KG profile identifiers are used as names for the vector.

pRAIDS

a RAIDSparam an object containing all RAIDS parameters.

Value

a list containing the following entries:

sample.id

a vector of character strings representing the identifiers of the synthetic profiles.

sample1Kg

a vector of character strings representing the identifiers of the reference 1KG profiles used to generate the synthetic profiles.

sp

a vector of character strings representing the known ancestry for the reference 1KG profiles used to generate the synthetic profiles.

matKNN

a data.frame containing 4 columns. The first column 'sample.id' contains the name of the synthetic profile. The second column 'D' represents the dimension D used to infer the ancestry. The third column 'K' represents the number of neighbors K used to infer the ancestry. The fourth column 'SuperPop' contains the inferred ancestry.

References

Galinsky KJ, Bhatia G, Loh PR, Georgiev S, Mukherjee S, Patterson NJ, Price AL. Fast Principal-Component Analysis Reveals Convergent Evolution of ADH1B in Europe and East Asia. Am J Hum Genet. 2016 Mar 3;98(3):456-72. doi: 10.1016/j.ajhg.2015.12.022. Epub 2016 Feb 25.

Author

Pascal Belleau, Astrid Deschênes and Alexander Krasnitz

Examples


## Load the known ancestry for the demo 1KG reference profiles
data(demoKnownSuperPop1KG)

# The name of the synthetic study
studyID <- "MYDATA.Synthetic"

samplesRM <- c("HG00246", "HG00325", "HG00611", "HG01173", "HG02165",
    "HG01112", "HG01615", "HG01968", "HG02658", "HG01850", "HG02013",
    "HG02465", "HG02974", "HG03814", "HG03445", "HG03689", "HG03789",
    "NA12751", "NA19107", "NA18548", "NA19075", "NA19475", "NA19712",
    "NA19731", "NA20528", "NA20908")

## Path to the demo Profile GDS file is located in this package
dataDir <- system.file("extdata/demoKNNSynthetic", 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)

result <- computePoolSyntheticAncestryGr2(sampleRM=samplesRM,
                             spRef=demoKnownSuperPop1KG,
                             pRAIDS=pRAIDS)
## The ancestry inference for the synthetic data using
## different K and D values
head(result$matKNN)
#>         sample.id D K superPop
#> 1 1.ex1.HG00246.1 2 2      SAS
#> 2 1.ex1.HG00325.1 2 2      EAS
#> 3 1.ex1.HG00611.1 2 2      SAS
#> 4 1.ex1.HG01173.1 2 2      SAS
#> 5 1.ex1.HG02165.1 2 2      EAS
#> 6 1.ex1.HG01112.1 2 2      AMR