| Title: | Robust Ancestry Inference using Data Synthesis |
|---|---|
| Description: | This package implements specialized algorithms that enable genetic ancestry inference from various cancer sequences sources (RNA, Exome and Whole-Genome sequences). This package also implements a simulation algorithm that generates synthetic cancer-derived data. This code and analysis pipeline was designed and developed for the following publication: Belleau, P et al. Genetic Ancestry Inference from Cancer-Derived Molecular Data across Genomic and Transcriptomic Platforms. Cancer Res 1 January 2023; 83 (1): 49–58. |
| Authors: | Pascal Belleau [cre, aut] (ORCID: <https://orcid.org/0000-0002-0802-1071>), Astrid Deschênes [aut] (ORCID: <https://orcid.org/0000-0001-7846-6749>), David A. Tuveson [aut] (ORCID: <https://orcid.org/0000-0002-8017-2712>), Alexander Krasnitz [aut], National Institutes of Health [fnd] (ROR: <https://ror.org/01cwqze88>) |
| Maintainer: | Pascal Belleau <[email protected]> |
| License: | Apache License (>= 2) |
| Version: | 1.11.1 |
| Built: | 2026-11-06 00:38:11 UTC |
| Source: | https://github.com/bioc/RAIDS |
The function extracts the information about the pruned SNVs from the 1KG GDS file and adds entries related to the pruned SNVs in the Profile GDS file. The nodes are added to the Profile GDS file: 'sample.id', 'snp.id', 'snp.chromosome', 'snp.position', 'snp.index', 'genotype' and 'lap'.
add1KG2SampleGDS(gdsReference, fileProfileGDS, currentProfile, studyID)add1KG2SampleGDS(gdsReference, fileProfileGDS, currentProfile, studyID)
gdsReference |
an object of class gds.class (a GDS file), the opened 1KG GDS file. |
fileProfileGDS |
a |
currentProfile |
a |
studyID |
a |
The function returns 0L when successful.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Required library for GDS library(SNPRelate) ## Path to the demo 1KG GDS file is located in this package dataDir <- system.file("extdata/tests", package="RAIDS") fileGDS <- file.path(dataDir, "ex1_good_small_1KG.gds") ## The data.frame containing the information about the study ## The 3 mandatory columns: "studyID", "study.desc", "study.platform" ## The entries should be strings, not factors (stringsAsFactors=FALSE) studyDF <- data.frame(study.id="MYDATA", study.desc="Description", study.platform="PLATFORM", stringsAsFactors=FALSE) ## Temporary Profile file fileProfile <- file.path(tempdir(), "ex2.gds") ## Copy required file file.copy(file.path(dataDir, "ex1_demo_with_pruning.gds"), fileProfile) ## Open 1KG file gds1KG <- snpgdsOpen(fileGDS) ## Compute the list of pruned SNVs for a specific profile 'ex1' ## and save it in the Profile GDS file 'ex2.gds' add1KG2SampleGDS(gdsReference=gds1KG, fileProfileGDS=fileProfile, currentProfile=c("ex1"), studyID=studyDF$study.id) ## Close the 1KG GDS file (important) closefn.gds(gds1KG) ## Check content of Profile GDS file ## The 'pruned.study' entry should be present content <- openfn.gds(fileProfile) content ## Close the Profile GDS file (important) closefn.gds(content) ## Remove Profile GDS file (created for demo purpose) unlink(fileProfile, force=TRUE)## Required library for GDS library(SNPRelate) ## Path to the demo 1KG GDS file is located in this package dataDir <- system.file("extdata/tests", package="RAIDS") fileGDS <- file.path(dataDir, "ex1_good_small_1KG.gds") ## The data.frame containing the information about the study ## The 3 mandatory columns: "studyID", "study.desc", "study.platform" ## The entries should be strings, not factors (stringsAsFactors=FALSE) studyDF <- data.frame(study.id="MYDATA", study.desc="Description", study.platform="PLATFORM", stringsAsFactors=FALSE) ## Temporary Profile file fileProfile <- file.path(tempdir(), "ex2.gds") ## Copy required file file.copy(file.path(dataDir, "ex1_demo_with_pruning.gds"), fileProfile) ## Open 1KG file gds1KG <- snpgdsOpen(fileGDS) ## Compute the list of pruned SNVs for a specific profile 'ex1' ## and save it in the Profile GDS file 'ex2.gds' add1KG2SampleGDS(gdsReference=gds1KG, fileProfileGDS=fileProfile, currentProfile=c("ex1"), studyID=studyDF$study.id) ## Close the 1KG GDS file (important) closefn.gds(gds1KG) ## Check content of Profile GDS file ## The 'pruned.study' entry should be present content <- openfn.gds(fileProfile) content ## Close the Profile GDS file (important) closefn.gds(content) ## Remove Profile GDS file (created for demo purpose) unlink(fileProfile, force=TRUE)
The function appends the information about the ld blocks into the Population Reference SNV Annotation GDS file. The information is extracted from the Population Reference GDS file and files \'.det\'.
addBlockFromDetFile( fileReferenceGDS, gdsRefAnnotFile, pathBlock, superPop, blockName = "ldBlock", blockDesc = "Not Define", verbose = FALSE )addBlockFromDetFile( fileReferenceGDS, gdsRefAnnotFile, pathBlock, superPop, blockName = "ldBlock", blockDesc = "Not Define", verbose = FALSE )
fileReferenceGDS |
a |
gdsRefAnnotFile |
a |
pathBlock |
a |
superPop |
a |
blockName |
a |
blockDesc |
a |
verbose |
a |
More information about GDS file format can be found at the Bioconductor gdsfmt website: https://bioconductor.org/packages/gdsfmt/
OL when the function is successful.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Path to the demo pedigree file is located in this package dataDir <- system.file("extdata", package="RAIDS") fileAnnotGDS <- file.path(tempdir(), "ex1_good_small_1KG_Ann_GDS.gds") ## Demo of of output file det from the plink block ## command for chromosome 1 fileLdBlock <- file.path(dirname(fileAnnotGDS), "block.sp.EUR.Ex.chr1.blocks.det") file.copy(file.path(dataDir, "tests", "ex1_NoBlockGene.1KG_Annot_GDS.gds"), fileAnnotGDS) file.copy(file.path(dataDir, "block.sp.EUR.Ex.chr1.blocks.det"), fileLdBlock) ## GDS Reference file fileReferenceGDS <- file.path(dataDir, "tests", "ex1_good_small_1KG.gds") ## Append information associated to blocks addBlockFromDetFile(fileReferenceGDS=fileReferenceGDS, gdsRefAnnotFile=fileAnnotGDS, pathBlock=dirname(fileAnnotGDS), superPop="EUR") gdsAnnot1KG <- openfn.gds(fileAnnotGDS) print(gdsAnnot1KG) closefn.gds(gdsAnnot1KG) ## Remove temporary file unlink(fileAnnotGDS, force=TRUE) unlink(fileLdBlock, force=TRUE)## Path to the demo pedigree file is located in this package dataDir <- system.file("extdata", package="RAIDS") fileAnnotGDS <- file.path(tempdir(), "ex1_good_small_1KG_Ann_GDS.gds") ## Demo of of output file det from the plink block ## command for chromosome 1 fileLdBlock <- file.path(dirname(fileAnnotGDS), "block.sp.EUR.Ex.chr1.blocks.det") file.copy(file.path(dataDir, "tests", "ex1_NoBlockGene.1KG_Annot_GDS.gds"), fileAnnotGDS) file.copy(file.path(dataDir, "block.sp.EUR.Ex.chr1.blocks.det"), fileLdBlock) ## GDS Reference file fileReferenceGDS <- file.path(dataDir, "tests", "ex1_good_small_1KG.gds") ## Append information associated to blocks addBlockFromDetFile(fileReferenceGDS=fileReferenceGDS, gdsRefAnnotFile=fileAnnotGDS, pathBlock=dirname(fileAnnotGDS), superPop="EUR") gdsAnnot1KG <- openfn.gds(fileAnnotGDS) print(gdsAnnot1KG) closefn.gds(gdsAnnot1KG) ## Remove temporary file unlink(fileAnnotGDS, force=TRUE) unlink(fileLdBlock, force=TRUE)
The function appends the information about the blocks into the Population Reference SNV Annotation GDS file. The information is extracted from the Population Reference GDS file.
addGeneBlockGDSRefAnnot( gdsReference, gdsRefAnnotFile, winSize = 10000, ensDb, suffixBlockName )addGeneBlockGDSRefAnnot( gdsReference, gdsRefAnnotFile, winSize = 10000, ensDb, suffixBlockName )
gdsReference |
an object of class gds.class (a GDS file), the opened Reference GDS file. |
gdsRefAnnotFile |
a |
winSize |
a single positive |
ensDb |
An object with the ensembl genome annotation
Default: |
suffixBlockName |
a |
The integer OL when the function is successful.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Required library library(SNPRelate) ## Path to the demo pedigree file is located in this package dataDir <- system.file("extdata", package="RAIDS") fileAnnotGDS <- file.path(tempdir(), "ex1_good_small_1KG_Ann_GDS.gds") ## Required library if (requireNamespace("EnsDb.Hsapiens.v86", quietly=TRUE)) { file.copy(file.path(dataDir, "tests", "ex1_NoBlockGene.1KG_Annot_GDS.gds"), fileAnnotGDS) ## Making a "short cut" on the ensDb object edb <- EnsDb.Hsapiens.v86::EnsDb.Hsapiens.v86 ## GDS Reference file fileReferenceGDS <- file.path(dataDir, "tests", "ex1_good_small_1KG.gds") ## Open the reference GDS file (demo version) gds1KG <- snpgdsOpen(fileReferenceGDS) ## Append information associated to blocks addGeneBlockGDSRefAnnot(gdsReference=gds1KG, gdsRefAnnotFile=fileAnnotGDS, ensDb=edb, suffixBlockName="EnsDb.Hsapiens.v86") gdsAnnot1KG <- openfn.gds(fileAnnotGDS) print(gdsAnnot1KG) print(read.gdsn(index.gdsn(gdsAnnot1KG, "block.annot"))) ## Close GDS files closefn.gds(gds1KG) closefn.gds(gdsAnnot1KG) ## Remove temporary file unlink(fileAnnotGDS, force=TRUE) }## Required library library(SNPRelate) ## Path to the demo pedigree file is located in this package dataDir <- system.file("extdata", package="RAIDS") fileAnnotGDS <- file.path(tempdir(), "ex1_good_small_1KG_Ann_GDS.gds") ## Required library if (requireNamespace("EnsDb.Hsapiens.v86", quietly=TRUE)) { file.copy(file.path(dataDir, "tests", "ex1_NoBlockGene.1KG_Annot_GDS.gds"), fileAnnotGDS) ## Making a "short cut" on the ensDb object edb <- EnsDb.Hsapiens.v86::EnsDb.Hsapiens.v86 ## GDS Reference file fileReferenceGDS <- file.path(dataDir, "tests", "ex1_good_small_1KG.gds") ## Open the reference GDS file (demo version) gds1KG <- snpgdsOpen(fileReferenceGDS) ## Append information associated to blocks addGeneBlockGDSRefAnnot(gdsReference=gds1KG, gdsRefAnnotFile=fileAnnotGDS, ensDb=edb, suffixBlockName="EnsDb.Hsapiens.v86") gdsAnnot1KG <- openfn.gds(fileAnnotGDS) print(gdsAnnot1KG) print(read.gdsn(index.gdsn(gdsAnnot1KG, "block.annot"))) ## Close GDS files closefn.gds(gds1KG) closefn.gds(gdsAnnot1KG) ## Remove temporary file unlink(fileAnnotGDS, force=TRUE) }
The function appends the information about the blocks into the Population Reference SNV Annotation GDS file. The information is extracted from the Population Reference GDS file.
addGeneBlockRefAnnot( fileReferenceGDS, gdsRefAnnotFile, winSize = 10000, ensDb, suffixBlockName )addGeneBlockRefAnnot( fileReferenceGDS, gdsRefAnnotFile, winSize = 10000, ensDb, suffixBlockName )
fileReferenceGDS |
a |
gdsRefAnnotFile |
a |
winSize |
a single positive |
ensDb |
An object with the ensembl genome annotation
Default: |
suffixBlockName |
a |
The integer OL when the function is successful.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Path to the demo pedigree file is located in this package dataDir <- system.file("extdata", package="RAIDS") fileAnnotGDS <- file.path(tempdir(), "ex1_good_small_1KG_Ann_GDS.gds") ## Required library if (requireNamespace("EnsDb.Hsapiens.v86", quietly=TRUE)) { file.copy(file.path(dataDir, "tests", "ex1_NoBlockGene.1KG_Annot_GDS.gds"), fileAnnotGDS) ## Making a "short cut" on the ensDb object edb <- EnsDb.Hsapiens.v86::EnsDb.Hsapiens.v86 ## GDS Reference file fileReferenceGDS <- file.path(dataDir, "tests", "ex1_good_small_1KG.gds") ## Append information associated to blocks addGeneBlockRefAnnot(fileReferenceGDS=fileReferenceGDS, gdsRefAnnotFile=fileAnnotGDS, ensDb=edb, suffixBlockName="EnsDb.Hsapiens.v86") gdsAnnot1KG <- openfn.gds(fileAnnotGDS) print(gdsAnnot1KG) print(read.gdsn(index.gdsn(gdsAnnot1KG, "block.annot"))) closefn.gds(gdsAnnot1KG) ## Remove temporary file unlink(fileAnnotGDS, force=TRUE) }## Path to the demo pedigree file is located in this package dataDir <- system.file("extdata", package="RAIDS") fileAnnotGDS <- file.path(tempdir(), "ex1_good_small_1KG_Ann_GDS.gds") ## Required library if (requireNamespace("EnsDb.Hsapiens.v86", quietly=TRUE)) { file.copy(file.path(dataDir, "tests", "ex1_NoBlockGene.1KG_Annot_GDS.gds"), fileAnnotGDS) ## Making a "short cut" on the ensDb object edb <- EnsDb.Hsapiens.v86::EnsDb.Hsapiens.v86 ## GDS Reference file fileReferenceGDS <- file.path(dataDir, "tests", "ex1_good_small_1KG.gds") ## Append information associated to blocks addGeneBlockRefAnnot(fileReferenceGDS=fileReferenceGDS, gdsRefAnnotFile=fileAnnotGDS, ensDb=edb, suffixBlockName="EnsDb.Hsapiens.v86") gdsAnnot1KG <- openfn.gds(fileAnnotGDS) print(gdsAnnot1KG) print(read.gdsn(index.gdsn(gdsAnnot1KG, "block.annot"))) closefn.gds(gdsAnnot1KG) ## Remove temporary file unlink(fileAnnotGDS, force=TRUE) }
The function extracts the information about the pruned SNVs from the 1KG GDS file and adds entries related to the pruned SNVs in the Profile GDS file. The nodes are added to the Profile GDS file: 'sample.id', 'snp.id', 'snp.chromosome', 'snp.position', 'snp.index', 'genotype' and 'lap'.
addGenotypeProfile(pRAIDS)addGenotypeProfile(pRAIDS)
pRAIDS |
a |
The function returns 0L when successful.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Required library for GDS library(gdsfmt) ## Path to the demo Reference GDS file is located in this package dataDir <- system.file("extdata/tests", package="RAIDS") fileGDS <- file.path(dataDir, "ex1_good_small_1KG.gds") ## The data.frame containing the information about the study ## The 3 mandatory columns: "study.id", "study.desc", "study.platform" ## The entries should be strings, not factors (stringsAsFactors=FALSE) studyDF <- data.frame(study.id = "MYDATA", study.desc = "Description", study.platform = "PLATFORM", stringsAsFactors = FALSE) ## The data.frame containing the information about the samples ## The entries should be strings, not factors (stringsAsFactors=FALSE) samplePED <- data.frame(Name.ID = c("ex1", "ex2"), Case.ID = c("Patient_h11", "Patient_h12"), Diagnosis = rep("Cancer", 2), Sample.Type = rep("Primary Tumor", 2), Source = rep("Databank B", 2), stringsAsFactors = FALSE) rownames(samplePED) <- samplePED$Name.ID ## Temporary Profile GDS file pathProfileGDS <- tempdir() profileFile <- file.path(pathProfileGDS, "ex1.gds") pRAIDS <- RAIDSparam(profileFile=file.path(dataDir, "ex1.txt.gz"), studyDF=studyDF, genoSource="snp-pileup", pedStudy=samplePED, pathProfileGDS=pathProfileGDS, fileReferenceGDS=fileGDS ) ## Copy the Profile GDS file demo that has not been pruned yet file.copy(file.path(dataDir, "ex1_demo.gds"), profileFile) ## Compute the list of pruned SNVs for a specific profile 'ex1' ## and save it in the Profile GDS file 'ex1.gds' pRAIDS <- pruningProfile2(pRAIDS) RAIDS::addGenotypeProfile(pRAIDS) content <- openfn.gds(profileFile) content ## Close the Profile GDS file (important) closefn.gds(content) ## Remove Profile GDS file (created for demo purpose) unlink(profileFile, force=TRUE)## Required library for GDS library(gdsfmt) ## Path to the demo Reference GDS file is located in this package dataDir <- system.file("extdata/tests", package="RAIDS") fileGDS <- file.path(dataDir, "ex1_good_small_1KG.gds") ## The data.frame containing the information about the study ## The 3 mandatory columns: "study.id", "study.desc", "study.platform" ## The entries should be strings, not factors (stringsAsFactors=FALSE) studyDF <- data.frame(study.id = "MYDATA", study.desc = "Description", study.platform = "PLATFORM", stringsAsFactors = FALSE) ## The data.frame containing the information about the samples ## The entries should be strings, not factors (stringsAsFactors=FALSE) samplePED <- data.frame(Name.ID = c("ex1", "ex2"), Case.ID = c("Patient_h11", "Patient_h12"), Diagnosis = rep("Cancer", 2), Sample.Type = rep("Primary Tumor", 2), Source = rep("Databank B", 2), stringsAsFactors = FALSE) rownames(samplePED) <- samplePED$Name.ID ## Temporary Profile GDS file pathProfileGDS <- tempdir() profileFile <- file.path(pathProfileGDS, "ex1.gds") pRAIDS <- RAIDSparam(profileFile=file.path(dataDir, "ex1.txt.gz"), studyDF=studyDF, genoSource="snp-pileup", pedStudy=samplePED, pathProfileGDS=pathProfileGDS, fileReferenceGDS=fileGDS ) ## Copy the Profile GDS file demo that has not been pruned yet file.copy(file.path(dataDir, "ex1_demo.gds"), profileFile) ## Compute the list of pruned SNVs for a specific profile 'ex1' ## and save it in the Profile GDS file 'ex1.gds' pRAIDS <- pruningProfile2(pRAIDS) RAIDS::addGenotypeProfile(pRAIDS) content <- openfn.gds(profileFile) content ## Close the Profile GDS file (important) closefn.gds(content) ## Remove Profile GDS file (created for demo purpose) unlink(profileFile, force=TRUE)
This function adds the information about the unrelated patients
to the Reference GDS file. More specifically, it creates the field
sample.ref which as the value 1 when the sample
is unrelated and the value 0 otherwise.
The sample.ref is filled based on the information present in the
input RDS file.
addRef2GDS1KG(fileNameGDS, filePart)addRef2GDS1KG(fileNameGDS, filePart)
fileNameGDS |
a |
filePart |
a |
The integer 0L when successful.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Locate RDS with unrelated/related status for 1KG samples dataDir <- system.file("extdata", package="RAIDS") rdsFilePath <- file.path(dataDir, "unrelatedPatientsInfo_Demo.rds") ## Create a temporary GDS file in an test directory dataDir <- system.file("extdata/tests", package="RAIDS") gdsFilePath <- file.path(dataDir, "GDS_TEMP_201.gds") ## Create and open the GDS file tmpGDS <- createfn.gds(filename=gdsFilePath) ## Create "sample.id" node (the node must be present) sampleIDs <- c("HG00104", "HG00109", "HG00110") add.gdsn(node=tmpGDS, name="sample.id", val=sampleIDs) ## Create "snp.id" node (the node must be present) snpIDs <- c("s1", "s2", "s3", "s4", "s5", "s6") add.gdsn(node=tmpGDS, name="snp.id", val=snpIDs) ## Create "snp.position" node (the node must be present) snpPositions <- c(16102, 51478, 51897, 51927, 54489, 54707) add.gdsn(node=tmpGDS, name="snp.position", val=snpPositions) ## Create "snp.chromosome" node (the node must be present) snpPositions <- c(1, 1, 1, 1, 1, 1) add.gdsn(node=tmpGDS, name="snp.chromosome", val=snpPositions) ## Create "genotype" node (the node must be present) genotype <- matrix(rep(1, 18), ncol = 3) add.gdsn(node=tmpGDS, name="genotype", val=genotype) ## Close GDS file closefn.gds(tmpGDS) ## Create "sample.ref" node in GDS file using RDS information addRef2GDS1KG(fileNameGDS=gdsFilePath, filePart=rdsFilePath) ## Read sample reference data.frame fileGDS <- openfn.gds(gdsFilePath, readonly=TRUE) read.gdsn(index.gdsn(node=fileGDS, path="sample.ref")) closefn.gds(gdsfile=fileGDS) ## Delete the temporary GDS file unlink(x=gdsFilePath, force=TRUE)## Locate RDS with unrelated/related status for 1KG samples dataDir <- system.file("extdata", package="RAIDS") rdsFilePath <- file.path(dataDir, "unrelatedPatientsInfo_Demo.rds") ## Create a temporary GDS file in an test directory dataDir <- system.file("extdata/tests", package="RAIDS") gdsFilePath <- file.path(dataDir, "GDS_TEMP_201.gds") ## Create and open the GDS file tmpGDS <- createfn.gds(filename=gdsFilePath) ## Create "sample.id" node (the node must be present) sampleIDs <- c("HG00104", "HG00109", "HG00110") add.gdsn(node=tmpGDS, name="sample.id", val=sampleIDs) ## Create "snp.id" node (the node must be present) snpIDs <- c("s1", "s2", "s3", "s4", "s5", "s6") add.gdsn(node=tmpGDS, name="snp.id", val=snpIDs) ## Create "snp.position" node (the node must be present) snpPositions <- c(16102, 51478, 51897, 51927, 54489, 54707) add.gdsn(node=tmpGDS, name="snp.position", val=snpPositions) ## Create "snp.chromosome" node (the node must be present) snpPositions <- c(1, 1, 1, 1, 1, 1) add.gdsn(node=tmpGDS, name="snp.chromosome", val=snpPositions) ## Create "genotype" node (the node must be present) genotype <- matrix(rep(1, 18), ncol = 3) add.gdsn(node=tmpGDS, name="genotype", val=genotype) ## Close GDS file closefn.gds(tmpGDS) ## Create "sample.ref" node in GDS file using RDS information addRef2GDS1KG(fileNameGDS=gdsFilePath, filePart=rdsFilePath) ## Read sample reference data.frame fileGDS <- openfn.gds(gdsFilePath, readonly=TRUE) read.gdsn(index.gdsn(node=fileGDS, path="sample.ref")) closefn.gds(gdsfile=fileGDS) ## Delete the temporary GDS file unlink(x=gdsFilePath, force=TRUE)
The information about the samples present in the 1KG GDS file is added into the GDS Sample file. Only the information about the unrelated samples from the 1OOO Genome Study are copied into the GDS Sample file. The information is only added to the GDS Sample file when the 1KG Study is not already present in the GDS Sample file. The sample information for all selected samples is appended to the GDS Sample file "study.annot" node. The study information is appended to the GDS Sample file "study.list" node.
addStudy1Kg(gdsReference, fileProfileGDS, verbose = FALSE)addStudy1Kg(gdsReference, fileProfileGDS, verbose = FALSE)
gdsReference |
an object of class gds.class (a GDS file), the opened 1KG GDS file. |
fileProfileGDS |
a |
verbose |
a |
The integer 0L when successful.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Required library for GDS library(gdsfmt) ## Get the temp folder tempDir <- tempdir() ## Create a temporary 1KG GDS file and add needed information fileName1KG <- file.path(tempDir, "GDS_TEMP_addStudy1Kg_1KG.gds") gds1KG <- createfn.gds(filename=fileName1KG) add.gdsn(gds1KG, "sample.id", c("HTT101", "HTT102", "HTT103")) samples <- data.frame(sex=c(1, 1, 2), pop.group=c("GBR", "GIH", "GBR"), superPop=c("EUR", "SAS", "EUR"), batch=rep(0, 3), stringsAsFactors = FALSE) add.gdsn(gds1KG, "sample.annot", samples) add.gdsn(gds1KG, "sample.ref", c(1,0, 1)) sync.gds(gds1KG) ## Create a temporary Profile GDS file fileNameProfile <- file.path(tempDir, "GDS_TEMP_addStudy1Kg_Sample.gds") gdsProfile <- createfn.gds(fileNameProfile) study.list <- data.frame(study.id=c("HTT Study"), study.desc=c("Important Study"), study.platform=c("Panel"), stringsAsFactors=FALSE) add.gdsn(gdsProfile, "study.list", study.list) study.annot <- data.frame(data.id=c("TOTO1"), case.id=c("TOTO1"), sample.type=c("Study"), diagnosis=c("Study"), source=rep("IGSR"), study.id=c("Study"), stringsAsFactors=FALSE) add.gdsn(gdsProfile, "study.annot", study.annot) sync.gds(gdsProfile) closefn.gds(gdsProfile) ## Append information about the 1KG samples into the Profile GDS file ## The Profile GDS file will contain 'study.list' and 'study.annot' entries addStudy1Kg(gdsReference=gds1KG, fileProfileGDS=fileNameProfile, verbose=TRUE) closefn.gds(gds1KG) unlink(fileNameProfile, recursive=TRUE, force=TRUE) unlink(fileName1KG, recursive=TRUE, force=TRUE) unlink(tempDir)## Required library for GDS library(gdsfmt) ## Get the temp folder tempDir <- tempdir() ## Create a temporary 1KG GDS file and add needed information fileName1KG <- file.path(tempDir, "GDS_TEMP_addStudy1Kg_1KG.gds") gds1KG <- createfn.gds(filename=fileName1KG) add.gdsn(gds1KG, "sample.id", c("HTT101", "HTT102", "HTT103")) samples <- data.frame(sex=c(1, 1, 2), pop.group=c("GBR", "GIH", "GBR"), superPop=c("EUR", "SAS", "EUR"), batch=rep(0, 3), stringsAsFactors = FALSE) add.gdsn(gds1KG, "sample.annot", samples) add.gdsn(gds1KG, "sample.ref", c(1,0, 1)) sync.gds(gds1KG) ## Create a temporary Profile GDS file fileNameProfile <- file.path(tempDir, "GDS_TEMP_addStudy1Kg_Sample.gds") gdsProfile <- createfn.gds(fileNameProfile) study.list <- data.frame(study.id=c("HTT Study"), study.desc=c("Important Study"), study.platform=c("Panel"), stringsAsFactors=FALSE) add.gdsn(gdsProfile, "study.list", study.list) study.annot <- data.frame(data.id=c("TOTO1"), case.id=c("TOTO1"), sample.type=c("Study"), diagnosis=c("Study"), source=rep("IGSR"), study.id=c("Study"), stringsAsFactors=FALSE) add.gdsn(gdsProfile, "study.annot", study.annot) sync.gds(gdsProfile) closefn.gds(gdsProfile) ## Append information about the 1KG samples into the Profile GDS file ## The Profile GDS file will contain 'study.list' and 'study.annot' entries addStudy1Kg(gdsReference=gds1KG, fileProfileGDS=fileNameProfile, verbose=TRUE) closefn.gds(gds1KG) unlink(fileNameProfile, recursive=TRUE, force=TRUE) unlink(fileName1KG, recursive=TRUE, force=TRUE) unlink(tempDir)
This function runs most steps leading to the ancestry inference call on a specific profile. First, the function creates the Profile GDS file for the specific profile using the information from a RDS Sample description file and the Population Reference GDS file.
ancestryInferencePCAKNN(pRAIDS = RAIDSparam())ancestryInferencePCAKNN(pRAIDS = RAIDSparam())
pRAIDS |
a |
The runExomeAncestry() function generates 3 types of files in the OUTPUT directory.
The ancestry inference CSV file (".Ancestry.csv" file)
The inference information RDS file (".infoCall.rds" file)
The parameter information RDS files from the synthetic inference ("KNN.synt.*.rds" files in a sub-directory)
In addition, a sub-directory (named using the profile ID) is also created.
a list containing 4 entries:
pcaSample a list containing the information related
to the eigenvectors. The list contains those 3 entries:
sample.id a character string representing the unique
identifier of the current profile.
eigenvector.ref a matrix of numeric containing
the eigenvectors for the reference profiles.
eigenvector a matrix of numeric containing the
eigenvectors for the current profile projected on the PCA from the
reference profiles.
paraSample a list containing the results with
different D and K values that lead to optimal parameter
selection. The list contains those entries:
dfPCA a data.frame containing statistical results
on all combined synthetic results done with a fixed value of D (the
number of dimensions). The data.frame contains those columns:
D a numeric representing the value of D (the
number of dimensions).
median a numeric representing the median of the
minimum AUROC obtained (within super populations) for all combination of
the fixed D value and all tested K values.
mad a numeric representing the MAD of the minimum
AUROC obtained (within super populations) for all combination of the fixed
D value and all tested K values.
upQuartile a numeric representing the upper quartile
of the minimum AUROC obtained (within super populations) for all
combination of the fixed D value and all tested K values.
k a numeric representing the optimal K value
(the number of neighbors) for a fixed D value.
dfPop a data.frame containing statistical results on
all combined synthetic results done with different values of D (the
number of dimensions) and K (the number of neighbors).
The data.frame contains those columns:
D a numeric representing the value of D (the
number of dimensions).
K a numeric representing the value of K (the
number of neighbors).
AUROC.min a numeric representing the minimum accuracy
obtained by grouping all the synthetic results by super-populations, for
the specified values of D and K.
AUROC a numeric representing the accuracy obtained
by grouping all the synthetic results for the specified values of D
and K.
Accu.CM a numeric representing the value of accuracy
of the confusion matrix obtained by grouping all the synthetic results for
the specified values of D and K.
dfAUROC a data.frame the summary of the results by
super-population. The data.frame contains
those columns:
D a numeric representing the value of D (the
number of dimensions).
K a numeric representing the value of K (the
number of neighbors).
Call a character string representing the
super-population.
L a numeric representing the lower value of the 95%
confidence interval for the AUROC obtained for the fixed values of
super-population, D and K.
AUROC a numeric representing the AUROC obtained for
the fixed values of super-population, D and K.
H a numeric representing the higher value of the 95%
confidence interval for the AUROC obtained for the fixed values of
super-population, D and K.
D a numeric representing the optimal D value
(the number of dimensions) for the specific profile.
K a numeric representing the optimal K value
(the number of neighbors) for the specific profile.
listD a numeric representing the optimal D
values (the number of dimensions) for the specific profile. More than one
D is possible.
KNNSample a data.frame containing the inferred
ancestry for different values of K and D. The
data.frame contains those columns:
sample.id a character string representing the unique
identifier of the current profile.
D a numeric representing the value of D (the
number of dimensions) used to infer the ancestry.
K a numeric representing the value of K (the
number of neighbors) used to infer the ancestry.
SuperPop a character string representing the inferred
ancestry for the specified D and K values.
KNNSynthetic a data.frame containing the inferred
ancestry for each synthetic data for different values of K and
D.
The data.frame
contains those columns:
sample.id a character string representing the unique
identifier of the current synthetic data.
D a numeric representing the value of D (the
number of dimensions) used to infer the ancestry.
K a numeric representing the value of K (the
number of neighbors) used to infer the ancestry.
infer.superPop a character string representing the
inferred ancestry for the specified D and K values.
ref.superPop a character string representing the known
ancestry from the reference
Ancestry a data.frame containing the inferred
ancestry for the current profile. The data.frame contains those
columns:
sample.id a character string representing the unique
identifier of the current profile.
D a numeric representing the value of D (the
number of dimensions) used to infer the ancestry.
K a numeric representing the value of K (the
number of neighbors) used to infer the ancestry.
SuperPop a character string representing the inferred
ancestry.
pRAIDS a list of class RAIDSparam a list of
the parameters.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
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.
## Path to the demo 1KG GDS file is located in this package dataDir <- system.file("extdata", package="RAIDS") ################################################################# ## The 1KG GDS file and the 1KG SNV Annotation GDS file ## need to be located in the same directory ## Note that the 1KG GDS file used for this example is a ## simplified version and CANNOT be used for any real analysis ################################################################# path1KG <- file.path(dataDir, "tests") fileReferenceGDS <- file.path(path1KG, "ex1_good_small_1KG.gds") fileAnnotGDS <- file.path(path1KG, "ex1_good_small_1KG_Annot.gds") ################################################################# ## The Sample SNP pileup files (one per sample) need ## to be located in the same directory. ################################################################# demoProfileEx1 <- file.path(dataDir, "example", "snpPileup", "ex1.txt.gz") ################################################################# ## The path where the Profile GDS Files (one per sample) ## will be created need to be specified. ################################################################# pathProfileGDS <- file.path(tempdir(), "out.tmp") if(!dir.exists(pathProfileGDS)){ dir.create(pathProfileGDS) } #################################################################### ## Fix seed to ensure reproducible results #################################################################### set.seed(3043) pRAIDS <- RAIDS:::RAIDSparam(profileFile=demoProfileEx1, genoSource="snp-pileup", pathProfileGDS=pathProfileGDS, fileReferenceGDS=fileReferenceGDS, fileReferenceAnnotGDS=fileAnnotGDS ) res <- ancestryInferencePCAKNN(pRAIDS=pRAIDS) res$Ancestry unlink(file.path(pathProfileGDS, paste0(pedStudy(res$pRAIDS)$Name.ID[1], ".gds")) , force=TRUE) if (length(dir(pathProfileGDS)) == 0) { unlink(pathProfileGDS, recursive = TRUE) }## Path to the demo 1KG GDS file is located in this package dataDir <- system.file("extdata", package="RAIDS") ################################################################# ## The 1KG GDS file and the 1KG SNV Annotation GDS file ## need to be located in the same directory ## Note that the 1KG GDS file used for this example is a ## simplified version and CANNOT be used for any real analysis ################################################################# path1KG <- file.path(dataDir, "tests") fileReferenceGDS <- file.path(path1KG, "ex1_good_small_1KG.gds") fileAnnotGDS <- file.path(path1KG, "ex1_good_small_1KG_Annot.gds") ################################################################# ## The Sample SNP pileup files (one per sample) need ## to be located in the same directory. ################################################################# demoProfileEx1 <- file.path(dataDir, "example", "snpPileup", "ex1.txt.gz") ################################################################# ## The path where the Profile GDS Files (one per sample) ## will be created need to be specified. ################################################################# pathProfileGDS <- file.path(tempdir(), "out.tmp") if(!dir.exists(pathProfileGDS)){ dir.create(pathProfileGDS) } #################################################################### ## Fix seed to ensure reproducible results #################################################################### set.seed(3043) pRAIDS <- RAIDS:::RAIDSparam(profileFile=demoProfileEx1, genoSource="snp-pileup", pathProfileGDS=pathProfileGDS, fileReferenceGDS=fileReferenceGDS, fileReferenceAnnotGDS=fileAnnotGDS ) res <- ancestryInferencePCAKNN(pRAIDS=pRAIDS) res$Ancestry unlink(file.path(pathProfileGDS, paste0(pedStudy(res$pRAIDS)$Name.ID[1], ".gds")) , force=TRUE) if (length(dir(pathProfileGDS)) == 0) { unlink(pathProfileGDS, recursive = TRUE) }
A generic function for getting the anchorId slot in a S4 object.
anchorId(x)anchorId(x)
x |
a S4 object. |
a value from the anchorId slot in the S4 object.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(anchorId="character")) # Create an instance obj <- new("MyClass", anchorId="123") # Call the generic (assuming a method is implemented) # anchorId(obj)# Define a dummy class to show usage setClass("MyClass", slots = list(anchorId="character")) # Create an instance obj <- new("MyClass", anchorId="123") # Call the generic (assuming a method is implemented) # anchorId(obj)
A function for getting the anchorId slot in a
RAIDSparam class.
## S4 method for signature 'RAIDSparam' anchorId(x)## S4 method for signature 'RAIDSparam' anchorId(x)
x |
a |
a character string representing the name of the
identifier of the quasi non-admixed profile from the reference.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the anchorId slot for the object anchorId(paramDemo)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the anchorId slot for the object anchorId(paramDemo)
A generic function for replacement of anchorId slot in a S4 object.
anchorId(x) <- valueanchorId(x) <- value
x |
a S4 object. |
value |
the new value to assign or update. |
the modified S4 object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(anchorId="character")) # Create an instance obj <- new("MyClass", anchorId="123") # Call the generic (assuming a method is implemented) # anchorId(obj) <- "333"# Define a dummy class to show usage setClass("MyClass", slots = list(anchorId="character")) # Create an instance obj <- new("MyClass", anchorId="123") # Call the generic (assuming a method is implemented) # anchorId(obj) <- "333"
A function for replacement of anchorId slot in a
RAIDSparam class.
## S4 replacement method for signature 'RAIDSparam' anchorId(x) <- value## S4 replacement method for signature 'RAIDSparam' anchorId(x) <- value
x |
a |
value |
a |
the modified RAIDSparam object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign new value to the anchorId slot in the object anchorId(paramDemo) <- "sp0.95vT"## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign new value to the anchorId slot in the object anchorId(paramDemo) <- "sp0.95vT"
A generic function for getting the batch slot in a S4 object.
batch(x)batch(x)
x |
a S4 object. |
a value from the batch slot in the S4 object.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(batch="character")) # Create an instance obj <- new("MyClass", batch="123") # Call the generic (assuming a method is implemented) # batch(obj)# Define a dummy class to show usage setClass("MyClass", slots = list(batch="character")) # Create an instance obj <- new("MyClass", batch="123") # Call the generic (assuming a method is implemented) # batch(obj)
A function for getting the batch slot in a
RAIDSparam class.
## S4 method for signature 'RAIDSparam' batch(x)## S4 method for signature 'RAIDSparam' batch(x)
x |
a |
a single positive integer representing the current
identifier for the batch.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the batch slot for the object batch(paramDemo)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the batch slot for the object batch(paramDemo)
A generic function for replacement of batch slot in a S4 object.
batch(x) <- valuebatch(x) <- value
x |
a S4 object. |
value |
the new value to assign or update. |
the modified S4 object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(batch="character")) # Create an instance obj <- new("MyClass", batch="123") # Call the generic (assuming a method is implemented) # batch(obj) <- "333"# Define a dummy class to show usage setClass("MyClass", slots = list(batch="character")) # Create an instance obj <- new("MyClass", batch="123") # Call the generic (assuming a method is implemented) # batch(obj) <- "333"
A function for replacement of batch slot in a
RAIDSparam class.
## S4 replacement method for signature 'RAIDSparam' batch(x) <- value## S4 replacement method for signature 'RAIDSparam' batch(x) <- value
x |
a |
value |
a single positive |
the modified RAIDSparam object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign a new value to the batch slot in the object batch(paramDemo) <- 34L## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign a new value to the batch slot in the object batch(paramDemo) <- 34L
A generic function for getting the blockTypeId slot in a S4 object.
blockTypeId(x)blockTypeId(x)
x |
a S4 object. |
a value from the blockTypeId slot in the S4 object.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(blockTypeId="character")) # Create an instance obj <- new("MyClass", blockTypeId="123") # Call the generic (assuming a method is implemented) # blockTypeId(obj)# Define a dummy class to show usage setClass("MyClass", slots = list(blockTypeId="character")) # Create an instance obj <- new("MyClass", blockTypeId="123") # Call the generic (assuming a method is implemented) # blockTypeId(obj)
A function for getting the blockTypeId slot in a
RAIDSparam class.
## S4 method for signature 'RAIDSparam' blockTypeId(x)## S4 method for signature 'RAIDSparam' blockTypeId(x)
x |
a |
a single character string corresponding to the block type
used to extract the block identifiers.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the blockTypeId slot for the object blockTypeId(paramDemo)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the blockTypeId slot for the object blockTypeId(paramDemo)
A generic function for replacement of blockTypeId slot in a S4 object.
blockTypeId(x) <- valueblockTypeId(x) <- value
x |
a S4 object. |
value |
the new value to assign or update. |
the modified S4 object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(blockTypeId="character")) # Create an instance obj <- new("MyClass", blockTypeId="123") # Call the generic (assuming a method is implemented) # blockTypeId(obj) <- "333"# Define a dummy class to show usage setClass("MyClass", slots = list(blockTypeId="character")) # Create an instance obj <- new("MyClass", blockTypeId="123") # Call the generic (assuming a method is implemented) # blockTypeId(obj) <- "333"
A function for replacement of blockTypeId slot in a
RAIDSparam class.
## S4 replacement method for signature 'RAIDSparam' blockTypeId(x) <- value## S4 replacement method for signature 'RAIDSparam' blockTypeId(x) <- value
x |
a |
value |
a single |
the modified RAIDSparam object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign the new blockTypeId to the blockTypeId slot in the object blockTypeId(paramDemo) <- "TEST"## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign the new blockTypeId to the blockTypeId slot in the object blockTypeId(paramDemo) <- "TEST"
A virtual class that groups character and NULL
together.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
A generic function for getting the chrInfo slot in a S4 object.
chrInfo(x)chrInfo(x)
x |
a S4 object. |
a value from the chrInfo slot in the S4 object.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(chrInfo="character")) # Create an instance obj <- new("MyClass", chrInfo="123") # Call the generic (assuming a method is implemented) # chrInfo(obj)# Define a dummy class to show usage setClass("MyClass", slots = list(chrInfo="character")) # Create an instance obj <- new("MyClass", chrInfo="123") # Call the generic (assuming a method is implemented) # chrInfo(obj)
A function for getting the chrInfo slot in a
RAIDSparam class.
## S4 method for signature 'RAIDSparam' chrInfo(x)## S4 method for signature 'RAIDSparam' chrInfo(x)
x |
a |
a vector of positive integer values
representing the length of the chromosomes.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the chrInfo slot for the object chrInfo(paramDemo)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the chrInfo slot for the object chrInfo(paramDemo)
A generic function for replacement of chrInfo slot in a S4 object.
chrInfo(x) <- valuechrInfo(x) <- value
x |
a S4 object. |
value |
the new value to assign or update. |
the modified S4 object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(chrInfo="character")) # Create an instance obj <- new("MyClass", chrInfo="123") # Call the generic (assuming a method is implemented) # chrInfo(obj) <- "333"# Define a dummy class to show usage setClass("MyClass", slots = list(chrInfo="character")) # Create an instance obj <- new("MyClass", chrInfo="123") # Call the generic (assuming a method is implemented) # chrInfo(obj) <- "333"
A function for replacement of chrInfo slot in a
RAIDSparam class.
## S4 replacement method for signature 'RAIDSparam' chrInfo(x) <- value## S4 replacement method for signature 'RAIDSparam' chrInfo(x) <- value
x |
a |
value |
a |
the modified RAIDSparam object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign the new chrInfo to the chrInfo slot in the object chrInfo(paramDemo) <- c(122222L, 333333L)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign the new chrInfo to the chrInfo slot in the object chrInfo(paramDemo) <- c(122222L, 333333L)
A generic function for getting the cleanADMIXTUREFiles slot in a S4 object.
cleanADMIXTUREFiles(x)cleanADMIXTUREFiles(x)
x |
a S4 object. |
a value from the cleanADMIXTUREFiles slot in the S4 object.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(cleanADMIXTUREFiles="character")) # Create an instance obj <- new("MyClass", cleanADMIXTUREFiles="123") # Call the generic (assuming a method is implemented) # cleanADMIXTUREFiles(obj)# Define a dummy class to show usage setClass("MyClass", slots = list(cleanADMIXTUREFiles="character")) # Create an instance obj <- new("MyClass", cleanADMIXTUREFiles="123") # Call the generic (assuming a method is implemented) # cleanADMIXTUREFiles(obj)
A function for getting the cleanADMIXTUREFiles slot in a
RAIDSparam class.
## S4 method for signature 'RAIDSparam' cleanADMIXTUREFiles(x)## S4 method for signature 'RAIDSparam' cleanADMIXTUREFiles(x)
x |
a |
a single logical indicating if message information should be
printed.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the cleanADMIXTUREFiles slot for the object cleanADMIXTUREFiles(paramDemo)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the cleanADMIXTUREFiles slot for the object cleanADMIXTUREFiles(paramDemo)
A generic function for replacement of cleanADMIXTUREFiles slot in a S4 object.
cleanADMIXTUREFiles(x) <- valuecleanADMIXTUREFiles(x) <- value
x |
a S4 object. |
value |
the new value to assign or update. |
the modified S4 object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(cleanADMIXTUREFiles="character")) # Create an instance obj <- new("MyClass", cleanADMIXTUREFiles="123") # Call the generic (assuming a method is implemented) # cleanADMIXTUREFiles(obj) <- TRUE# Define a dummy class to show usage setClass("MyClass", slots = list(cleanADMIXTUREFiles="character")) # Create an instance obj <- new("MyClass", cleanADMIXTUREFiles="123") # Call the generic (assuming a method is implemented) # cleanADMIXTUREFiles(obj) <- TRUE
A function for replacement of cleanADMIXTUREFiles slot in a
RAIDSparam class.
## S4 replacement method for signature 'RAIDSparam' cleanADMIXTUREFiles(x) <- value## S4 replacement method for signature 'RAIDSparam' cleanADMIXTUREFiles(x) <- value
x |
a |
value |
a single |
the modified RAIDSparam object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign new value to the cleanADMIXTUREFiles slot in the object cleanADMIXTUREFiles(paramDemo) <- TRUE## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign new value to the cleanADMIXTUREFiles slot in the object cleanADMIXTUREFiles(paramDemo) <- TRUE
TODO
computeAdmixtureProportions(pRAIDS)computeAdmixtureProportions(pRAIDS)
pRAIDS |
a |
TODO
a list containing 2 entries:
profileQ a matrix containing the admixture
proportions of the profile
syntheticQ a matrix containing for each
synthetic profile the admixture proportions of the synthetic profile,
the synthetic proportions of the reference using the same position as
the profile, and the admixture proportion of the gold standard
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Not run: ## 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/demoAncestryCall", package="RAIDS") pathOut <- file.path(tempdir(), "out.tmp") if(!dir.exists(pathOut)){ dir.create(pathOut) } # 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(pathOut) # , "ex1.gds" file.copy(file.path(dataDir, "ex1.gds"), file.path(pathOut)) 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 ## Path to admixture ## pathADMIXTURE <- "PATH/admixture" pRAIDS <- RAIDSparam(studyDF=studyDF, pedStudy=pedStudy, pathProfileGDS=pathProfileGDS, fileReferenceGDS=fileReferenceGDS, fieldPopInfAnc="SuperPop", pathADMIXTURE=pathADMIXTURE) res <- computeAdmixtureProportions(pRAIDS=pRAIDS) dir(file.path(pathProfileGDS)) head(res$profileQ) head(res$syntheticQ) unlink(file.path(pathOut), recursive = TRUE)#' ## End(Not run)## Not run: ## 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/demoAncestryCall", package="RAIDS") pathOut <- file.path(tempdir(), "out.tmp") if(!dir.exists(pathOut)){ dir.create(pathOut) } # 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(pathOut) # , "ex1.gds" file.copy(file.path(dataDir, "ex1.gds"), file.path(pathOut)) 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 ## Path to admixture ## pathADMIXTURE <- "PATH/admixture" pRAIDS <- RAIDSparam(studyDF=studyDF, pedStudy=pedStudy, pathProfileGDS=pathProfileGDS, fileReferenceGDS=fileReferenceGDS, fieldPopInfAnc="SuperPop", pathADMIXTURE=pathADMIXTURE) res <- computeAdmixtureProportions(pRAIDS=pRAIDS) dir(file.path(pathProfileGDS)) head(res$profileQ) head(res$syntheticQ) unlink(file.path(pathOut), recursive = TRUE)#' ## End(Not run)
The function select the optimal K and D parameters for a specific profile. The results on the synthetic data are used for the parameter selection. Once the optimal parameters are selected, the ancestry is inferred for the specific profile.
computeAncestryFromSynthetic( gdsReference, gdsProfile, syntheticKNN, pedSyn, currentProfile, spRef, studyIDSyn, np = 1L, listCatPop = c("EAS", "EUR", "AFR", "AMR", "SAS"), fieldPopInRef = "superPop", fieldPopInfAnc = "SuperPop", kList = seq(2, 15, 1), pcaList = seq(2, 15, 1), algorithm = c("exact", "randomized"), eigenCount = 32L, missingRate = NaN, verbose = FALSE )computeAncestryFromSynthetic( gdsReference, gdsProfile, syntheticKNN, pedSyn, currentProfile, spRef, studyIDSyn, np = 1L, listCatPop = c("EAS", "EUR", "AFR", "AMR", "SAS"), fieldPopInRef = "superPop", fieldPopInfAnc = "SuperPop", kList = seq(2, 15, 1), pcaList = seq(2, 15, 1), algorithm = c("exact", "randomized"), eigenCount = 32L, missingRate = NaN, verbose = FALSE )
gdsReference |
an object of class gds.class (a GDS file), the opened 1KG GDS file. |
gdsProfile |
an object of class |
syntheticKNN |
a |
pedSyn |
a |
currentProfile |
a |
spRef |
a |
studyIDSyn |
a |
np |
a single positive |
listCatPop |
a |
fieldPopInRef |
a |
fieldPopInfAnc |
a |
kList |
a |
pcaList |
a |
algorithm |
a |
eigenCount |
a single |
missingRate |
a |
verbose |
a |
a list containing 4 entries:
pcaSample a list containing the information related
to the eigenvectors. The list contains those 3 entries:
sample.id a character string representing the unique
identifier of the current profile.
eigenvector.ref a matrix of numeric containing
the eigenvectors for the reference profiles.
eigenvector a matrix of numeric containing the
eigenvectors for the current profile projected on the PCA from the
reference profiles.
paraSample a list containing the results with
different D and K values that lead to optimal parameter
selection. The list contains those entries:
dfPCA a data.frame containing statistical results
on all combined synthetic results done with a fixed value of D (the
number of dimensions). The data.frame contains those columns:
D a numeric representing the value of D (the
number of dimensions).
median a numeric representing the median of the
minimum AUROC obtained (within super populations) for all combination of
the fixed D value and all tested K values.
mad a numeric representing the MAD of the minimum
AUROC obtained (within super populations) for all combination of the fixed
D value and all tested K values.
upQuartile a numeric representing the upper quartile
of the minimum AUROC obtained (within super populations) for all
combination of the fixed D value and all tested K values.
k a numeric representing the optimal K value
(the number of neighbors) for a fixed D value.
dfPop a data.frame containing statistical results on
all combined synthetic results done with different values of D (the
number of dimensions) and K (the number of neighbors).
The data.frame contains those columns:
D a numeric representing the value of D (the
number of dimensions).
K a numeric representing the value of K (the
number of neighbors).
AUROC.min a numeric representing the minimum accuracy
obtained by grouping all the synthetic results by super-populations, for
the specified values of D and K.
AUROC a numeric representing the accuracy obtained
by grouping all the synthetic results for the specified values of D
and K.
Accu.CM a numeric representing the value of accuracy
of the confusion matrix obtained by grouping all the synthetic results for
the specified values of D and K.
dfAUROC a data.frame the summary of the results by
super-population. The data.frame contains
those columns:
D a numeric representing the value of D (the
number of dimensions).
K a numeric representing the value of K (the
number of neighbors).
Call a character string representing the
super-population.
L a numeric representing the lower value of the 95%
confidence interval for the AUROC obtained for the fixed values of
super-population, D and K.
AUROC a numeric representing the AUROC obtained for the
fixed values of super-population, D and K.
H a numeric representing the higher value of the 95%
confidence interval for the AUROC obtained for the fixed values of
super-population, D and K.
D a numeric representing the optimal D value
(the number of dimensions) for the specific profile.
K a numeric representing the optimal K value
(the number of neighbors) for the specific profile.
listD a numeric representing the optimal D
values (the number of dimensions) for the specific profile. More than one
D is possible.
KNNSample a list containing the inferred ancestry
using different D and K values. The list contains
those entries:
sample.id a character string representing the unique
identifier of the current profile.
matKNN a data.frame containing the inferred ancestry
for different values of K and D. The data.frame
contains those columns:
sample.id a character string representing the unique
identifier of the current profile.
D a numeric representing the value of D (the
number of dimensions) used to infer the ancestry.
K a numeric representing the value of K (the
number of neighbors) used to infer the ancestry.
SuperPop a character string representing the inferred
ancestry for the specified D and K values.
Ancestry a data.frame containing the inferred
ancestry for the current profile. The data.frame contains those
columns:
sample.id a character string representing the unique
identifier of the current profile.
D a numeric representing the value of D (the
number of dimensions) used to infer the ancestry.
K a numeric representing the value of K (the
number of neighbors) used to infer the ancestry.
SuperPop a character string representing the inferred
ancestry.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
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.
## Required library library(gdsfmt) ## Load the known ancestry for the demo 1KG reference profiles data(demoKnownSuperPop1KG) ## The Reference GDS file path1KG <- system.file("extdata/tests", package="RAIDS") ## Open the Reference GDS file gdsRef <- snpgdsOpen(file.path(path1KG, "ex1_good_small_1KG.gds")) ## Path to the demo synthetic results files ## List of the KNN result files from PCA run on synthetic data dataDirRes <- system.file("extdata/demoAncestryCall/ex1", package="RAIDS") listFilesName <- dir(file.path(dataDirRes), ".rds") listFiles <- file.path(file.path(dataDirRes) , listFilesName) syntheticKNN <- lapply(listFiles, FUN=function(x){return(readRDS(x))}) syntheticKNN <- do.call(rbind, syntheticKNN) # The name of the synthetic study studyID <- "MYDATA.Synthetic" ## Path to the demo Profile GDS file is located in this package dataDir <- system.file("extdata/demoAncestryCall", package="RAIDS") ## Open the Profile GDS file gdsProfile <- snpgdsOpen(file.path(dataDir, "ex1.gds")) ## Not run: pedSyn <- RAIDS:::prepPedSynthetic1KG(gdsReference=gdsRef, gdsSample=gdsProfile, studyID=studyID, popName="superPop") ## Run the ancestry inference on one profile called 'ex1' ## The values of K and D used for the inference are selected using the ## synthetic results listFiles=listFiles, resCall <- RAIDS:::computeAncestryFromSynthetic(gdsReference=gdsRef, gdsProfile=gdsProfile, syntheticKNN = syntheticKNN, pedSyn = pedSyn, currentProfile=c("ex1"), spRef=demoKnownSuperPop1KG, studyIDSyn=studyID, np=1L) ## The ancestry called with the optimal D and K values resCall$Ancestry ## End(Not run) ## Close the GDS files (important) closefn.gds(gdsProfile) closefn.gds(gdsRef)## Required library library(gdsfmt) ## Load the known ancestry for the demo 1KG reference profiles data(demoKnownSuperPop1KG) ## The Reference GDS file path1KG <- system.file("extdata/tests", package="RAIDS") ## Open the Reference GDS file gdsRef <- snpgdsOpen(file.path(path1KG, "ex1_good_small_1KG.gds")) ## Path to the demo synthetic results files ## List of the KNN result files from PCA run on synthetic data dataDirRes <- system.file("extdata/demoAncestryCall/ex1", package="RAIDS") listFilesName <- dir(file.path(dataDirRes), ".rds") listFiles <- file.path(file.path(dataDirRes) , listFilesName) syntheticKNN <- lapply(listFiles, FUN=function(x){return(readRDS(x))}) syntheticKNN <- do.call(rbind, syntheticKNN) # The name of the synthetic study studyID <- "MYDATA.Synthetic" ## Path to the demo Profile GDS file is located in this package dataDir <- system.file("extdata/demoAncestryCall", package="RAIDS") ## Open the Profile GDS file gdsProfile <- snpgdsOpen(file.path(dataDir, "ex1.gds")) ## Not run: pedSyn <- RAIDS:::prepPedSynthetic1KG(gdsReference=gdsRef, gdsSample=gdsProfile, studyID=studyID, popName="superPop") ## Run the ancestry inference on one profile called 'ex1' ## The values of K and D used for the inference are selected using the ## synthetic results listFiles=listFiles, resCall <- RAIDS:::computeAncestryFromSynthetic(gdsReference=gdsRef, gdsProfile=gdsProfile, syntheticKNN = syntheticKNN, pedSyn = pedSyn, currentProfile=c("ex1"), spRef=demoKnownSuperPop1KG, studyIDSyn=studyID, np=1L) ## The ancestry called with the optimal D and K values resCall$Ancestry ## End(Not run) ## Close the GDS files (important) closefn.gds(gdsProfile) closefn.gds(gdsRef)
The function select the optimal K and D parameters for a specific profile. The results on the synthetic data are used for the parameter selection. Once the optimal parameters are selected, the ancestry is inferred for the specific profile.
computeAncestryFromSynthetic2( syntheticKNN, pedSyn, spRef, listCatPop = c("EAS", "EUR", "AFR", "AMR", "SAS"), pRAIDS = pRAIDS )computeAncestryFromSynthetic2( syntheticKNN, pedSyn, spRef, listCatPop = c("EAS", "EUR", "AFR", "AMR", "SAS"), pRAIDS = pRAIDS )
syntheticKNN |
a |
pedSyn |
a |
spRef |
a |
listCatPop |
a |
pRAIDS |
a |
a list containing 4 entries:
pcaSample a list containing the information related
to the eigenvectors. The list contains those 3 entries:
sample.id a character string representing the unique
identifier of the current profile.
eigenvector.ref a matrix of numeric containing
the eigenvectors for the reference profiles.
eigenvector a matrix of numeric containing the
eigenvectors for the current profile projected on the PCA from the
reference profiles.
paraSample a list containing the results with
different D and K values that lead to optimal parameter
selection. The list contains those entries:
dfPCA a data.frame containing statistical results
on all combined synthetic results done with a fixed value of D (the
number of dimensions). The data.frame contains those columns:
D a numeric representing the value of D (the
number of dimensions).
median a numeric representing the median of the
minimum AUROC obtained (within super populations) for all combination of
the fixed D value and all tested K values.
mad a numeric representing the MAD of the minimum
AUROC obtained (within super populations) for all combination of the fixed
D value and all tested K values.
upQuartile a numeric representing the upper quartile
of the minimum AUROC obtained (within super populations) for all
combination of the fixed D value and all tested K values.
k a numeric representing the optimal K value
(the number of neighbors) for a fixed D value.
dfPop a data.frame containing statistical results on
all combined synthetic results done with different values of D (the
number of dimensions) and K (the number of neighbors).
The data.frame contains those columns:
D a numeric representing the value of D (the
number of dimensions).
K a numeric representing the value of K (the
number of neighbors).
AUROC.min a numeric representing the minimum accuracy
obtained by grouping all the synthetic results by super-populations, for
the specified values of D and K.
AUROC a numeric representing the accuracy obtained
by grouping all the synthetic results for the specified values of D
and K.
Accu.CM a numeric representing the value of accuracy
of the confusion matrix obtained by grouping all the synthetic results for
the specified values of D and K.
dfAUROC a data.frame the summary of the results by
super-population. The data.frame contains
those columns:
D a numeric representing the value of D (the
number of dimensions).
K a numeric representing the value of K (the
number of neighbors).
Call a character string representing the
super-population.
L a numeric representing the lower value of the 95%
confidence interval for the AUROC obtained for the fixed values of
super-population, D and K.
AUROC a numeric representing the AUROC obtained for the
fixed values of super-population, D and K.
H a numeric representing the higher value of the 95%
confidence interval for the AUROC obtained for the fixed values of
super-population, D and K.
D a numeric representing the optimal D value
(the number of dimensions) for the specific profile.
K a numeric representing the optimal K value
(the number of neighbors) for the specific profile.
listD a numeric representing the optimal D
values (the number of dimensions) for the specific profile. More than one
D is possible.
KNNSample a list containing the inferred ancestry
using different D and K values. The list contains
those entries:
sample.id a character string representing the unique
identifier of the current profile.
matKNN a data.frame containing the inferred ancestry
for different values of K and D. The data.frame
contains those columns:
sample.id a character string representing the unique
identifier of the current profile.
D a numeric representing the value of D (the
number of dimensions) used to infer the ancestry.
K a numeric representing the value of K (the
number of neighbors) used to infer the ancestry.
SuperPop a character string representing the inferred
ancestry for the specified D and K values.
Ancestry a data.frame containing the inferred
ancestry for the current profile. The data.frame contains those
columns:
sample.id a character string representing the unique
identifier of the current profile.
D a numeric representing the value of D (the
number of dimensions) used to infer the ancestry.
K a numeric representing the value of K (the
number of neighbors) used to infer the ancestry.
SuperPop a character string representing the inferred
ancestry.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
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.
## 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) spRef <- getRefSuperPop2(pRAIDS) syntheticKNN <- readRDS(file.path(dataDir, "ex1", "KNN.synt.ex1.2.rds")) resCall <- computeAncestryFromSynthetic2(syntheticKNN=syntheticKNN, pedSyn=pedSyn, spRef=spRef, listCatPop=c("EAS", "EUR", "AFR", "AMR", "SAS"), pRAIDS=pRAIDS) resCall$Ancestry## 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) spRef <- getRefSuperPop2(pRAIDS) syntheticKNN <- readRDS(file.path(dataDir, "ex1", "KNN.synt.ex1.2.rds")) resCall <- computeAncestryFromSynthetic2(syntheticKNN=syntheticKNN, pedSyn=pedSyn, spRef=spRef, listCatPop=c("EAS", "EUR", "AFR", "AMR", "SAS"), pRAIDS=pRAIDS) resCall$Ancestry
The function select the optimal K and D parameters for a specific profile. The results on the synthetic data are used for the parameter selection. Once the optimal parameters are selected, the ancestry is inferred for the specific profile.
computeAncestryFromSyntheticFile( gdsReference, gdsProfile, listFiles, currentProfile, spRef, studyIDSyn, np = 1L, listCatPop = c("EAS", "EUR", "AFR", "AMR", "SAS"), fieldPopIn1KG = "superPop", fieldPopInfAnc = "SuperPop", kList = seq(2, 15, 1), pcaList = seq(2, 15, 1), algorithm = c("exact", "randomized"), eigenCount = 32L, missingRate = NaN, verbose = FALSE )computeAncestryFromSyntheticFile( gdsReference, gdsProfile, listFiles, currentProfile, spRef, studyIDSyn, np = 1L, listCatPop = c("EAS", "EUR", "AFR", "AMR", "SAS"), fieldPopIn1KG = "superPop", fieldPopInfAnc = "SuperPop", kList = seq(2, 15, 1), pcaList = seq(2, 15, 1), algorithm = c("exact", "randomized"), eigenCount = 32L, missingRate = NaN, verbose = FALSE )
gdsReference |
an object of class gds.class (a GDS file), the opened 1KG GDS file. |
gdsProfile |
an object of class |
listFiles |
a |
currentProfile |
a |
spRef |
a |
studyIDSyn |
a |
np |
a single positive |
listCatPop |
a |
fieldPopIn1KG |
a |
fieldPopInfAnc |
a |
kList |
a |
pcaList |
a |
algorithm |
a |
eigenCount |
a single |
missingRate |
a |
verbose |
a |
a list containing 4 entries:
pcaSample a list containing the information related
to the eigenvectors. The list contains those 3 entries:
sample.id a character string representing the unique
identifier of the current profile.
eigenvector.ref a matrix of numeric containing
the eigenvectors for the reference profiles.
eigenvector a matrix of numeric containing the
eigenvectors for the current profile projected on the PCA from the
reference profiles.
paraSample a list containing the results with
different D and K values that lead to optimal parameter
selection. The list contains those entries:
dfPCA a data.frame containing statistical results
on all combined synthetic results done with a fixed value of D (the
number of dimensions). The data.frame contains those columns:
D a numeric representing the value of D (the
number of dimensions).
median a numeric representing the median of the
minimum AUROC obtained (within super populations) for all combination of
the fixed D value and all tested K values.
mad a numeric representing the MAD of the minimum
AUROC obtained (within super populations) for all combination of the fixed
D value and all tested K values.
upQuartile a numeric representing the upper quartile
of the minimum AUROC obtained (within super populations) for all
combination of the fixed D value and all tested K values.
k a numeric representing the optimal K value
(the number of neighbors) for a fixed D value.
dfPop a data.frame containing statistical results on
all combined synthetic results done with different values of D (the
number of dimensions) and K (the number of neighbors).
The data.frame contains those columns:
D a numeric representing the value of D (the
number of dimensions).
K a numeric representing the value of K (the
number of neighbors).
AUROC.min a numeric representing the minimum accuracy
obtained by grouping all the synthetic results by super-populations, for
the specified values of D and K.
AUROC a numeric representing the accuracy obtained
by grouping all the synthetic results for the specified values of D
and K.
Accu.CM a numeric representing the value of accuracy
of the confusion matrix obtained by grouping all the synthetic results for
the specified values of D and K.
dfAUROC a data.frame the summary of the results by
super-population. The data.frame contains
those columns:
pcaD a numeric representing the value of D (the
number of dimensions).
K a numeric representing the value of K (the
number of neighbors).
Call a character string representing the
super-population.
L a numeric representing the lower value of the 95%
confidence interval for the AUROC obtained for the fixed values of
super-population, D and K.
AUR a numeric representing the AUROC obtained for the
fixed values of super-population, D and K.
H a numeric representing the higher value of the 95%
confidence interval for the AUROC obtained for the fixed values of
super-population, D and K.
D a numeric representing the optimal D value
(the number of dimensions) for the specific profile.
K a numeric representing the optimal K value
(the number of neighbors) for the specific profile.
listD a numeric representing the optimal D
values (the number of dimensions) for the specific profile. More than one
D is possible.
KNNSample a list containing the inferred ancestry
using different D and K values. The list contains
those entries:
sample.id a character string representing the unique
identifier of the current profile.
matKNN a data.frame containing the inferred ancestry
for different values of K and D. The data.frame
contains those columns:
sample.id a character string representing the unique
identifier of the current profile.
D a numeric representing the value of D (the
number of dimensions) used to infer the ancestry.
K a numeric representing the value of K (the
number of neighbors) used to infer the ancestry.
SuperPop a character string representing the inferred
ancestry for the specified D and K values.
Ancestry a data.frame containing the inferred
ancestry for the current profile. The data.frame contains those
columns:
sample.id a character string representing the unique
identifier of the current profile.
D a numeric representing the value of D (the
number of dimensions) used to infer the ancestry.
K a numeric representing the value of K (the
number of neighbors) used to infer the ancestry.
SuperPop a character string representing the inferred
ancestry.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
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.
## Required library library(gdsfmt) ## Load the known ancestry for the demo 1KG reference profiles data(demoKnownSuperPop1KG) ## The Reference GDS file path1KG <- system.file("extdata/tests", package="RAIDS") ## Open the Reference GDS file gdsRef <- snpgdsOpen(file.path(path1KG, "ex1_good_small_1KG.gds")) ## Path to the demo synthetic results files ## List of the KNN result files from PCA run on synthetic data dataDirRes <- system.file("extdata/demoAncestryCall/ex1", package="RAIDS") listFilesName <- dir(file.path(dataDirRes), ".rds") listFiles <- file.path(file.path(dataDirRes) , listFilesName) # The name of the synthetic study studyID <- "MYDATA.Synthetic" ## Path to the demo Profile GDS file is located in this package dataDir <- system.file("extdata/demoAncestryCall", package="RAIDS") ## Open the Profile GDS file gdsProfile <- snpgdsOpen(file.path(dataDir, "ex1.gds")) ## Run the ancestry inference on one profile called 'ex1' ## The values of K and D used for the inference are selected using the ## synthetic results resCall <- computeAncestryFromSyntheticFile(gdsReference=gdsRef, gdsProfile=gdsProfile, listFiles=listFiles, currentProfile=c("ex1"), spRef=demoKnownSuperPop1KG, studyIDSyn=studyID, np=1L) ## The ancestry called with the optimal D and K values resCall$Ancestry ## Close the GDS files (important) closefn.gds(gdsProfile) closefn.gds(gdsRef)## Required library library(gdsfmt) ## Load the known ancestry for the demo 1KG reference profiles data(demoKnownSuperPop1KG) ## The Reference GDS file path1KG <- system.file("extdata/tests", package="RAIDS") ## Open the Reference GDS file gdsRef <- snpgdsOpen(file.path(path1KG, "ex1_good_small_1KG.gds")) ## Path to the demo synthetic results files ## List of the KNN result files from PCA run on synthetic data dataDirRes <- system.file("extdata/demoAncestryCall/ex1", package="RAIDS") listFilesName <- dir(file.path(dataDirRes), ".rds") listFiles <- file.path(file.path(dataDirRes) , listFilesName) # The name of the synthetic study studyID <- "MYDATA.Synthetic" ## Path to the demo Profile GDS file is located in this package dataDir <- system.file("extdata/demoAncestryCall", package="RAIDS") ## Open the Profile GDS file gdsProfile <- snpgdsOpen(file.path(dataDir, "ex1.gds")) ## Run the ancestry inference on one profile called 'ex1' ## The values of K and D used for the inference are selected using the ## synthetic results resCall <- computeAncestryFromSyntheticFile(gdsReference=gdsRef, gdsProfile=gdsProfile, listFiles=listFiles, currentProfile=c("ex1"), spRef=demoKnownSuperPop1KG, studyIDSyn=studyID, np=1L) ## The ancestry called with the optimal D and K values resCall$Ancestry ## Close the GDS files (important) closefn.gds(gdsProfile) closefn.gds(gdsRef)
The function runs k-nearest neighbors analysis on a one specific profile. The function uses the 'knn' package.
computeKNNRefSample( listEigenvector, listCatPop = c("EAS", "EUR", "AFR", "AMR", "SAS"), spRef, fieldPopInfAnc = "SuperPop", kList = seq(2, 15, 1), pcaList = seq(2, 15, 1) )computeKNNRefSample( listEigenvector, listCatPop = c("EAS", "EUR", "AFR", "AMR", "SAS"), spRef, fieldPopInfAnc = "SuperPop", kList = seq(2, 15, 1), pcaList = seq(2, 15, 1) )
listEigenvector |
a |
listCatPop |
a |
spRef |
|
fieldPopInfAnc |
a |
kList |
a |
pcaList |
a |
a list containing 4 entries:
sample.id a vector of character strings
representing the identifier of the profile analysed.
matKNN a data.frame containing the super population
inference for the profile for different values of PCA
dimensions D and k-neighbors values K. The fourth column title
corresponds to the fieldPopInfAnc parameter.
The data.frame contains 4 columns:
sample.id a character string representing
the identifier of the profile analysed.
D a numeric strings representing
the value of the PCA dimension used to infer the ancestry.
K a numeric strings representing
the value of the k-neighbors used to infer the ancestry..
fieldPopInfAnc a character string representing
the inferred ancestry.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## 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) ## The PCA with 1 profile projected on the 1KG reference PCA ## Only one profile is retained pca <- demoPCASyntheticProfiles pca$sample.id <- pca$sample.id[1] pca$eigenvector <- pca$eigenvector[1, , drop=FALSE] ## Projects profile on 1KG PCA results <- computeKNNRefSample(listEigenvector=pca, listCatPop=c("EAS", "EUR", "AFR", "AMR", "SAS"), spRef=demoKnownSuperPop1KG, fieldPopInfAnc="SuperPop", kList=seq(10, 15, 1), pcaList=seq(10, 15, 1)) ## The assigned ancestry to the profile for different values of K and D head(results$matKNN)## 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) ## The PCA with 1 profile projected on the 1KG reference PCA ## Only one profile is retained pca <- demoPCASyntheticProfiles pca$sample.id <- pca$sample.id[1] pca$eigenvector <- pca$eigenvector[1, , drop=FALSE] ## Projects profile on 1KG PCA results <- computeKNNRefSample(listEigenvector=pca, listCatPop=c("EAS", "EUR", "AFR", "AMR", "SAS"), spRef=demoKnownSuperPop1KG, fieldPopInfAnc="SuperPop", kList=seq(10, 15, 1), pcaList=seq(10, 15, 1)) ## The assigned ancestry to the profile for different values of K and D head(results$matKNN)
The function runs k-nearest neighbors analysis on a subset of the synthetic data set. The function uses the 'knn' package.
computeKNNRefSyn(listEigenvector, pRAIDS)computeKNNRefSyn(listEigenvector, pRAIDS)
listEigenvector |
a |
pRAIDS |
a |
a list containing 4 entries:
sample.id a vector of character strings
representing the identifiers of the synthetic profiles analysed.
sample1Kg a vector of character strings
representing the identifiers of the 1KG reference profiles used to
generate the synthetic profiles.
sp a vector of character strings representing
the known super population ancestry of the 1KG reference profiles used
to generate the synthetic profiles.
matKNN a data.frame containing the super population
inference for each synthetic profiles for different values of PCA
dimensions D and k-neighbors values K. The fourth column title
corresponds to the fieldPopInfAnc parameter.
The data.frame contains 4 columns:
sample.id a character string representing
the identifier of the synthetic profile analysed.
D a numeric strings representing
the value of the PCA dimension used to infer the super population.
K a numeric strings representing
the value of the k-neighbors used to infer the super population.
fieldPopInfAnc value a character string representing
the inferred ancestry.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## 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") # The name of the synthetic study studyID <- "MYDATA.Synthetic" 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) ## Projects synthetic profiles on 1KG PCA results <- computeKNNRefSyn(listEigenvector=demoPCASyntheticProfiles, pRAIDS=pRAIDS) ## The inferred ancestry for the synthetic profiles for different values ## of D and K head(results$matKNN)## 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") # The name of the synthetic study studyID <- "MYDATA.Synthetic" 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) ## Projects synthetic profiles on 1KG PCA results <- computeKNNRefSyn(listEigenvector=demoPCASyntheticProfiles, pRAIDS=pRAIDS) ## The inferred ancestry for the synthetic profiles for different values ## of D and K head(results$matKNN)
The function runs k-nearest neighbors analysis on a subset of the synthetic data set. The function uses the 'knn' package.
computeKNNRefSynthetic( gdsProfile, listEigenvector, listCatPop = c("EAS", "EUR", "AFR", "AMR", "SAS"), studyIDSyn, spRef, fieldPopInfAnc = "SuperPop", kList = seq(2, 15, 1), pcaList = seq(2, 15, 1) )computeKNNRefSynthetic( gdsProfile, listEigenvector, listCatPop = c("EAS", "EUR", "AFR", "AMR", "SAS"), studyIDSyn, spRef, fieldPopInfAnc = "SuperPop", kList = seq(2, 15, 1), pcaList = seq(2, 15, 1) )
gdsProfile |
an object of class
|
listEigenvector |
a |
listCatPop |
a |
studyIDSyn |
a |
spRef |
|
fieldPopInfAnc |
a |
kList |
a |
pcaList |
a |
a list containing 4 entries:
sample.id a vector of character strings
representing the identifiers of the synthetic profiles analysed.
sample1Kg a vector of character strings
representing the identifiers of the 1KG reference profiles used to
generate the synthetic profiles.
sp a vector of character strings representing
the known super population ancestry of the 1KG reference profiles used
to generate the synthetic profiles.
matKNN a data.frame containing the super population
inference for each synthetic profiles for different values of PCA
dimensions D and k-neighbors values K. The fourth column title
corresponds to the fieldPopInfAnc parameter.
The data.frame contains 4 columns:
sample.id a character string representing
the identifier of the synthetic profile analysed.
D a numeric strings representing
the value of the PCA dimension used to infer the super population.
K a numeric strings representing
the value of the k-neighbors used to infer the super population.
fieldPopInfAnc value a character string representing
the inferred ancestry.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## 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) ## Close Profile GDS file (important) closefn.gds(gdsProfile)## 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) ## Close Profile GDS file (important) closefn.gds(gdsProfile)
The function projects the synthetic profiles onto existing principal component axes generated using the reference 1KG profiles. The reference profiles used to generate the synthetic profiles have previously been removed from the set of reference profiles.
computePCAMultiSynthetic( gdsProfile, listPCA, sampleRef, studyIDSyn, verbose = FALSE )computePCAMultiSynthetic( gdsProfile, listPCA, sampleRef, studyIDSyn, verbose = FALSE )
gdsProfile |
an object of class gds.class (a GDS file), an opened Profile GDS file. |
listPCA |
a |
sampleRef |
a |
studyIDSyn |
a |
verbose |
a |
a list containing 3 entries:
a vector of character strings representing
the identifiers of the synthetic profiles that have been projected onto
the 1KG PCA.
a matrix of numeric with the
eigenvectors of the 1KG reference profiles used to generate the PCA.
a matrix of numeric with the
eigenvectors of the synthetic profiles projected onto the 1KG PCA.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Required library library(gdsfmt) ## Loading demo PCA on subset of 1KG reference dataset data(demoPCA1KG) ## 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.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") names(samplesRM) <- c("GBR", "FIN", "CHS","PUR", "CDX", "CLM", "IBS", "PEL", "PJL", "KHV", "ACB", "GWD", "ESN", "BEB", "MSL", "STU", "ITU", "CEU", "YRI", "CHB", "JPT", "LWK", "ASW", "MXL", "TSI", "GIH") ## Open the Profile GDS file gdsProfile <- snpgdsOpen(file.path(dataDir, "ex1.gds")) ## Projects synthetic profiles on 1KG PCA results <- computePCAMultiSynthetic(gdsProfile=gdsProfile, listPCA=demoPCA1KG, sampleRef=samplesRM, studyIDSyn=studyID, verbose=FALSE) ## The eigenvectors for the synthetic profiles head(results$eigenvector) ## Close Profile GDS file (important) closefn.gds(gdsProfile)## Required library library(gdsfmt) ## Loading demo PCA on subset of 1KG reference dataset data(demoPCA1KG) ## 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.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") names(samplesRM) <- c("GBR", "FIN", "CHS","PUR", "CDX", "CLM", "IBS", "PEL", "PJL", "KHV", "ACB", "GWD", "ESN", "BEB", "MSL", "STU", "ITU", "CEU", "YRI", "CHB", "JPT", "LWK", "ASW", "MXL", "TSI", "GIH") ## Open the Profile GDS file gdsProfile <- snpgdsOpen(file.path(dataDir, "ex1.gds")) ## Projects synthetic profiles on 1KG PCA results <- computePCAMultiSynthetic(gdsProfile=gdsProfile, listPCA=demoPCA1KG, sampleRef=samplesRM, studyIDSyn=studyID, verbose=FALSE) ## The eigenvectors for the synthetic profiles head(results$eigenvector) ## Close Profile GDS file (important) closefn.gds(gdsProfile)
This function generates a PCA using the know reference profiles. Them, it projects the specified profile onto the PCA axes.
computePCARefSample( gdsProfile, currentProfile, studyIDRef = "Ref.1KG", np = 1L, algorithm = c("exact", "randomized"), eigenCount = 32L, missingRate = NaN, verbose = FALSE )computePCARefSample( gdsProfile, currentProfile, studyIDRef = "Ref.1KG", np = 1L, algorithm = c("exact", "randomized"), eigenCount = 32L, missingRate = NaN, verbose = FALSE )
gdsProfile |
an object of class gds.class, an opened Profile GDS file. |
currentProfile |
a single |
studyIDRef |
a single |
np |
a single positive |
algorithm |
a |
eigenCount |
a single |
missingRate |
a |
verbose |
a |
a list containing 3 entries:
sample.id a character string representing the unique
identifier of the analyzed profile.
eigenvector.ref a matrix of numeric
representing the eigenvectors of the reference profiles.
eigenvector a matrix of numeric representing
the eigenvectors of the analyzed profile.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
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.
## Required library library(gdsfmt) ## Path to the demo Profile GDS file is located in this package dataDir <- system.file("extdata/demoAncestryCall", package="RAIDS") ## Open the Profile GDS file gdsProfile <- snpgdsOpen(file.path(dataDir, "ex1.gds")) ## Project a profile onto a PCA generated using reference profiles ## The reference profiles come from 1KG resPCA <- computePCARefSample(gdsProfile=gdsProfile, currentProfile=c("ex1"), studyIDRef="Ref.1KG", np=1L, verbose=FALSE) resPCA$sample.id resPCA$eigenvector ## Close the GDS files (important) closefn.gds(gdsProfile)## Required library library(gdsfmt) ## Path to the demo Profile GDS file is located in this package dataDir <- system.file("extdata/demoAncestryCall", package="RAIDS") ## Open the Profile GDS file gdsProfile <- snpgdsOpen(file.path(dataDir, "ex1.gds")) ## Project a profile onto a PCA generated using reference profiles ## The reference profiles come from 1KG resPCA <- computePCARefSample(gdsProfile=gdsProfile, currentProfile=c("ex1"), studyIDRef="Ref.1KG", np=1L, verbose=FALSE) resPCA$sample.id resPCA$eigenvector ## Close the GDS files (important) closefn.gds(gdsProfile)
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.
computePoolSyntheticAncestryGr( gdsProfile, sampleRM, spRef, studyIDSyn, np = 1L, listCatPop = c("EAS", "EUR", "AFR", "AMR", "SAS"), fieldPopInfAnc = "SuperPop", kList = seq(2, 15, 1), pcaList = seq(2, 15, 1), algorithm = c("exact", "randomized"), eigenCount = 32L, missingRate = 0.025, verbose = FALSE )computePoolSyntheticAncestryGr( gdsProfile, sampleRM, spRef, studyIDSyn, np = 1L, listCatPop = c("EAS", "EUR", "AFR", "AMR", "SAS"), fieldPopInfAnc = "SuperPop", kList = seq(2, 15, 1), pcaList = seq(2, 15, 1), algorithm = c("exact", "randomized"), eigenCount = 32L, missingRate = 0.025, verbose = FALSE )
gdsProfile |
an object of class
|
sampleRM |
a |
spRef |
|
studyIDSyn |
a |
np |
a single positive |
listCatPop |
a |
fieldPopInfAnc |
a |
kList |
a |
pcaList |
a |
algorithm |
a |
eigenCount |
a single |
missingRate |
a |
verbose |
a |
a list containing the following entries:
a vector of character strings representing
the identifiers of the synthetic profiles.
a vector of character strings representing
the identifiers of the reference 1KG profiles used to generate the
synthetic profiles.
a vector of character strings representing the
known ancestry for the reference 1KG profiles used to generate the
synthetic profiles.
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.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
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.
## Required library library(gdsfmt) ## 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") names(samplesRM) <- c("GBR", "FIN", "CHS","PUR", "CDX", "CLM", "IBS", "PEL", "PJL", "KHV", "ACB", "GWD", "ESN", "BEB", "MSL", "STU", "ITU", "CEU", "YRI", "CHB", "JPT", "LWK", "ASW", "MXL", "TSI", "GIH") ## 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")) ## Run a PCA analysis and a K-nearest neighbors analysis on a small set ## of synthetic data results <- computePoolSyntheticAncestryGr(gdsProfile=gdsProfile, sampleRM=samplesRM, studyIDSyn=studyID, np=1L, spRef=demoKnownSuperPop1KG, kList=seq(10,15,1), pcaList=seq(10,15,1), eigenCount=15L) ## The ancestry inference for the synthetic data using ## different K and D values head(results$matKNN) ## Close Profile GDS file (important) closefn.gds(gdsProfile)## Required library library(gdsfmt) ## 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") names(samplesRM) <- c("GBR", "FIN", "CHS","PUR", "CDX", "CLM", "IBS", "PEL", "PJL", "KHV", "ACB", "GWD", "ESN", "BEB", "MSL", "STU", "ITU", "CEU", "YRI", "CHB", "JPT", "LWK", "ASW", "MXL", "TSI", "GIH") ## 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")) ## Run a PCA analysis and a K-nearest neighbors analysis on a small set ## of synthetic data results <- computePoolSyntheticAncestryGr(gdsProfile=gdsProfile, sampleRM=samplesRM, studyIDSyn=studyID, np=1L, spRef=demoKnownSuperPop1KG, kList=seq(10,15,1), pcaList=seq(10,15,1), eigenCount=15L) ## The ancestry inference for the synthetic data using ## different K and D values head(results$matKNN) ## Close Profile GDS file (important) closefn.gds(gdsProfile)
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)computePoolSyntheticAncestryGr2(sampleRM, spRef, pRAIDS)
sampleRM |
a |
spRef |
|
pRAIDS |
a |
a list containing the following entries:
a vector of character strings representing
the identifiers of the synthetic profiles.
a vector of character strings representing
the identifiers of the reference 1KG profiles used to generate the
synthetic profiles.
a vector of character strings representing the
known ancestry for the reference 1KG profiles used to generate the
synthetic profiles.
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.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
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.
## 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)## 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)
The function calculates the AUROC of the inferences for specific values of D and K using the inferred ancestry results from the synthetic profiles. The calculations are done on each super-population separately as well as on all the results together.
computeSyntheticROC( matKNN, matKNNAncestryColumn, pedCall, pedCallAncestryColumn, listCall = c("EAS", "EUR", "AFR", "AMR", "SAS") )computeSyntheticROC( matKNN, matKNNAncestryColumn, pedCall, pedCallAncestryColumn, listCall = c("EAS", "EUR", "AFR", "AMR", "SAS") )
matKNN |
a |
matKNNAncestryColumn |
a |
pedCall |
a |
pedCallAncestryColumn |
a |
listCall |
a |
list containing 3 entries:
matAUROC.All a data.frame containing the AUROC for all
the ancestry results.
matAUROC.Call a data.frame containing the AUROC
information for each super-population.
listROC.Call a list containing the output from the
roc function for each super-population.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Loading demo dataset containing pedigree information for synthetic ## profiles and known ancestry of the profiles used to generate the ## synthetic profiles data(pedSynthetic) ## Loading demo dataset containing the inferred ancestry results ## for the synthetic data data(matKNNSynthetic) ## The inferred ancestry results for the synthetic data using ## values of D=6 and K=5 matKNN <- matKNNSynthetic[matKNNSynthetic$K == 6 & matKNNSynthetic$D == 5, ] ## Compile statistics from the ## synthetic profiles for fixed values of D and K results <- RAIDS:::computeSyntheticROC(matKNN=matKNN, matKNNAncestryColumn="SuperPop", pedCall=pedSynthetic, pedCallAncestryColumn="superPop", listCall=c("EAS", "EUR", "AFR", "AMR", "SAS")) results$matAUROC.All results$matAUROC.Call results$listROC.Call## Loading demo dataset containing pedigree information for synthetic ## profiles and known ancestry of the profiles used to generate the ## synthetic profiles data(pedSynthetic) ## Loading demo dataset containing the inferred ancestry results ## for the synthetic data data(matKNNSynthetic) ## The inferred ancestry results for the synthetic data using ## values of D=6 and K=5 matKNN <- matKNNSynthetic[matKNNSynthetic$K == 6 & matKNNSynthetic$D == 5, ] ## Compile statistics from the ## synthetic profiles for fixed values of D and K results <- RAIDS:::computeSyntheticROC(matKNN=matKNN, matKNNAncestryColumn="SuperPop", pedCall=pedSynthetic, pedCallAncestryColumn="superPop", listCall=c("EAS", "EUR", "AFR", "AMR", "SAS")) results$matAUROC.All results$matAUROC.Call results$listROC.Call
This function extracts the required information from an output generated by RAIDS to create a graphic representation of the accuracy for different values of PCA dimensions and K-neighbors through all tested ancestries.
createAccuracyGraph( fileRDS, title = "", selectD = c(3, 7, 11), selectColor = c("#5e688a", "#cd5700", "#CC79A7") )createAccuracyGraph( fileRDS, title = "", selectD = c(3, 7, 11), selectColor = c("#5e688a", "#cd5700", "#CC79A7") )
fileRDS |
a |
title |
a |
selectD |
a |
selectColor |
a |
a ggplot object containing the graphic representation of the
accuracy for different values of PCA dimensions and K-neighbors through
all tested ancestries.
Astrid Deschênes and Pascal Belleau
## Required library library(ggplot2) ## Path to RDS file with ancestry information generated by RAIDS (demo file) dataDir <- system.file("extdata", package="RAIDS") fileRDS <- file.path(dataDir, "TEST_01.infoCall.RDS") ## Create accuracy graph accuracyGraph <- createAccuracyGraph(fileRDS=fileRDS, title="Test 01", selectD=c(3,6,9,12,15), selectColor=c("steelblue", "darkorange", "violet", "pink", "gray80")) accuracyGraph## Required library library(ggplot2) ## Path to RDS file with ancestry information generated by RAIDS (demo file) dataDir <- system.file("extdata", package="RAIDS") fileRDS <- file.path(dataDir, "TEST_01.infoCall.RDS") ## Create accuracy graph accuracyGraph <- createAccuracyGraph(fileRDS=fileRDS, title="Test 01", selectD=c(3,6,9,12,15), selectColor=c("steelblue", "darkorange", "violet", "pink", "gray80")) accuracyGraph
This function extracts the required information from an output generated by RAIDS to create a graphic representation of the accuracy for different values of PCA dimensions and K-neighbors through all tested ancestries.
createAUROCGraph( dfAUROC, title = "", selectD = c(3, 7, 11), selectColor = c("#5e688a", "#cd5700", "#CC79A7") )createAUROCGraph( dfAUROC, title = "", selectD = c(3, 7, 11), selectColor = c("#5e688a", "#cd5700", "#CC79A7") )
dfAUROC |
a |
title |
a |
selectD |
a |
selectColor |
a |
a ggplot object containing the graphic representation of the
accuracy for different values of PCA dimensions and K-neighbors through
all tested ancestries.
Astrid Deschênes and Pascal Belleau
## Required library library(ggplot2) ## Path to RDS file with ancestry information generated by RAIDS (demo file) dataDir <- system.file("extdata", package="RAIDS") fileRDS <- file.path(dataDir, "TEST_01.infoCall.RDS") info <- readRDS(fileRDS) dfAUROC <- info$paraSample$dfAUROC ## Some of the column names must be updated to fit new standards colnames(dfAUROC) <- c("D", "K", "Call", "L", "AUROC", "H") ## Create accuracy graph accuracyGraph <- createAUROCGraph(dfAUROC=dfAUROC, title="Test 01", selectD=c(3, 6, 9, 12, 15), selectColor=c("steelblue", "darkorange", "violet", "pink", "gray40")) accuracyGraph## Required library library(ggplot2) ## Path to RDS file with ancestry information generated by RAIDS (demo file) dataDir <- system.file("extdata", package="RAIDS") fileRDS <- file.path(dataDir, "TEST_01.infoCall.RDS") info <- readRDS(fileRDS) dfAUROC <- info$paraSample$dfAUROC ## Some of the column names must be updated to fit new standards colnames(dfAUROC) <- c("D", "K", "Call", "L", "AUROC", "H") ## Create accuracy graph accuracyGraph <- createAUROCGraph(dfAUROC=dfAUROC, title="Test 01", selectD=c(3, 6, 9, 12, 15), selectColor=c("steelblue", "darkorange", "violet", "pink", "gray40")) accuracyGraph
The function uses the information for the Reference GDS file
and the RDS Sample Description file to create the Profile GDS file. One
Profile GDS file is created per profile. One Profile GDS file will be
created for each entry present in the listProfiles parameter.
createStudy2GDS1KG( pathGeno = file.path("data", "sampleGeno"), filePedRDS = NULL, pedStudy = NULL, fileNameGDS, batch = 1, studyDF, listProfiles = NULL, pathProfileGDS = NULL, genoSource = c("snp-pileup", "generic", "VCF"), verbose = FALSE )createStudy2GDS1KG( pathGeno = file.path("data", "sampleGeno"), filePedRDS = NULL, pedStudy = NULL, fileNameGDS, batch = 1, studyDF, listProfiles = NULL, pathProfileGDS = NULL, genoSource = c("snp-pileup", "generic", "VCF"), verbose = FALSE )
pathGeno |
a |
filePedRDS |
a |
pedStudy |
a |
fileNameGDS |
a |
batch |
a single positive |
studyDF |
a |
listProfiles |
a |
pathProfileGDS |
a |
genoSource |
a |
verbose |
a |
The function returns 0L when successful.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Path to the demo 1KG GDS file is located in this package dataDir <- system.file("extdata/tests", package="RAIDS") fileGDS <- file.path(dataDir, "ex1_good_small_1KG.gds") ## The data.frame containing the information about the study ## The 3 mandatory columns: "study.id", "study.desc", "study.platform" ## The entries should be strings, not factors (stringsAsFactors=FALSE) studyDF <- data.frame(study.id = "MYDATA", study.desc = "Description", study.platform = "PLATFORM", stringsAsFactors = FALSE) ## The data.frame containing the information about the samples ## The entries should be strings, not factors (stringsAsFactors=FALSE) samplePED <- data.frame(Name.ID=c("ex1", "ex2"), Case.ID=c("Patient_h11", "Patient_h12"), Diagnosis=rep("Cancer", 2), Sample.Type=rep("Primary Tumor", 2), Source=rep("Databank B", 2), stringsAsFactors=FALSE) rownames(samplePED) <- samplePED$Name.ID ## Create the Profile GDS File for samples in 'listSamples' vector ## (in this case, samples "ex1") ## The Profile GDS file is created in the pathProfileGDS directory result <- createStudy2GDS1KG(pathGeno=dataDir, pedStudy=samplePED, fileNameGDS=fileGDS, studyDF=studyDF, listProfiles=c("ex1"), pathProfileGDS=tempdir(), genoSource="snp-pileup", verbose=FALSE) ## The function returns OL when successful result ## The Profile GDS file 'ex1.gds' has been created in the ## specified directory list.files(tempdir()) ## Remove Profile GDS file (created for demo purpose) unlink(file.path(tempdir(), "ex1.gds"), force=TRUE)## Path to the demo 1KG GDS file is located in this package dataDir <- system.file("extdata/tests", package="RAIDS") fileGDS <- file.path(dataDir, "ex1_good_small_1KG.gds") ## The data.frame containing the information about the study ## The 3 mandatory columns: "study.id", "study.desc", "study.platform" ## The entries should be strings, not factors (stringsAsFactors=FALSE) studyDF <- data.frame(study.id = "MYDATA", study.desc = "Description", study.platform = "PLATFORM", stringsAsFactors = FALSE) ## The data.frame containing the information about the samples ## The entries should be strings, not factors (stringsAsFactors=FALSE) samplePED <- data.frame(Name.ID=c("ex1", "ex2"), Case.ID=c("Patient_h11", "Patient_h12"), Diagnosis=rep("Cancer", 2), Sample.Type=rep("Primary Tumor", 2), Source=rep("Databank B", 2), stringsAsFactors=FALSE) rownames(samplePED) <- samplePED$Name.ID ## Create the Profile GDS File for samples in 'listSamples' vector ## (in this case, samples "ex1") ## The Profile GDS file is created in the pathProfileGDS directory result <- createStudy2GDS1KG(pathGeno=dataDir, pedStudy=samplePED, fileNameGDS=fileGDS, studyDF=studyDF, listProfiles=c("ex1"), pathProfileGDS=tempdir(), genoSource="snp-pileup", verbose=FALSE) ## The function returns OL when successful result ## The Profile GDS file 'ex1.gds' has been created in the ## specified directory list.files(tempdir()) ## Remove Profile GDS file (created for demo purpose) unlink(file.path(tempdir(), "ex1.gds"), force=TRUE)
A virtual class that groups data.frame and NULL
together.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
The object is a vector.
data(demoKnownSuperPop1KG)data(demoKnownSuperPop1KG)
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.
The vector containing the know super population ancestry
for the demo 1KG reference profiles.
computeKNNRefSyntheticfor running a k-nearest neighbors analysis on a subset of the synthetic data set.
computePoolSyntheticAncestryGrfor 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) ## Close Profile GDS file (important) closefn.gds(gdsProfile)## 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) ## Close Profile GDS file (important) closefn.gds(gdsProfile)
The object is a list.
data(demoPCA1KG)data(demoPCA1KG)
The list containing the PCA results for a small subset of
the reference 1KG dataset. The list contains 2 entries:
a vector of SNV identifiers specifying selected SNVs
for the PCA analysis.
a snpgdsPCAClass object containing the eigenvalues
as generated by snpgdsPCA function.
This object can be
used to test the computePCAMultiSynthetic function.
The list containing the PCA results for a small subset of
the reference 1KG dataset. The list contains 2 entries:
a vector of SNV identifiers specifying selected SNVs
for the PCA analysis.
a snpgdsPCAClass object containing the eigenvalues
as generated by snpgdsPCA function.
## Required library library(gdsfmt) ## Loading demo PCA on subset of 1KG reference dataset data(demoPCA1KG) ## 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.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") names(samplesRM) <- c("GBR", "FIN", "CHS","PUR", "CDX", "CLM", "IBS", "PEL", "PJL", "KHV", "ACB", "GWD", "ESN", "BEB", "MSL", "STU", "ITU", "CEU", "YRI", "CHB", "JPT", "LWK", "ASW", "MXL", "TSI", "GIH") ## Open the Profile GDS file gdsProfile <- snpgdsOpen(file.path(dataDir, "ex1.gds")) ## Projects synthetic profiles on demo 1KG PCA results <- computePCAMultiSynthetic(gdsProfile=gdsProfile, listPCA=demoPCA1KG, sampleRef=samplesRM, studyIDSyn=studyID, verbose=FALSE) ## The eigenvectors for the synthetic profiles head(results$eigenvector) ## Close Profile GDS file (important) closefn.gds(gdsProfile)## Required library library(gdsfmt) ## Loading demo PCA on subset of 1KG reference dataset data(demoPCA1KG) ## 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.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") names(samplesRM) <- c("GBR", "FIN", "CHS","PUR", "CDX", "CLM", "IBS", "PEL", "PJL", "KHV", "ACB", "GWD", "ESN", "BEB", "MSL", "STU", "ITU", "CEU", "YRI", "CHB", "JPT", "LWK", "ASW", "MXL", "TSI", "GIH") ## Open the Profile GDS file gdsProfile <- snpgdsOpen(file.path(dataDir, "ex1.gds")) ## Projects synthetic profiles on demo 1KG PCA results <- computePCAMultiSynthetic(gdsProfile=gdsProfile, listPCA=demoPCA1KG, sampleRef=samplesRM, studyIDSyn=studyID, verbose=FALSE) ## The eigenvectors for the synthetic profiles head(results$eigenvector) ## Close Profile GDS file (important) closefn.gds(gdsProfile)
The object is a list.
data(demoPCASyntheticProfiles)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.
This object can be
used to test the computeKNNRefSynthetic function.
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.
computeKNNRefSyntheticfor 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) ## Close Profile GDS file (important) closefn.gds(gdsProfile)## 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) ## Close Profile GDS file (important) closefn.gds(gdsProfile)
The object is a data.frame.
data(demoPedigreeEx1)data(demoPedigreeEx1)
The data.frame containing the information about a demo
profile called 'ex1'. the data.frame has 5 columns:
a character string representing the unique
identifier of the profile.
a character string representing the unique
identifier of the case associated to the profile.
a character string describing the type of
profile.
a character string describing the diagnosis of the
profile.
a character string describing the source of the
profile.
This object can be
used to test the runExomeAncestry function.
The data.frame containing the information about a demo
profile called 'ex1'. the data.frame has 5 columns:
a character string representing the unique
identifier of the profile.
a character string representing the unique
identifier of the case associated to the profile.
a character string describing the type of
profile.
a character string describing the diagnosis of the
profile.
a character string describing the source of the
profile.
runExomeAncestryfor running runs most steps leading to the ancestry inference call on a specific exome profile.
## Required library for GDS library(SNPRelate) ## Path to the demo 1KG GDS file is located in this package dataDir <- system.file("extdata", package="RAIDS") ################################################################# ## Load the information about the profile ################################################################# data(demoPedigreeEx1) head(demoPedigreeEx1) ################################################################# ## The 1KG GDS file and the 1KG SNV Annotation GDS file ## need to be located in the same directory ## Note that the 1KG GDS file used for this example is a ## simplified version and CANNOT be used for any real analysis ################################################################# path1KG <- file.path(dataDir, "tests") fileReferenceGDS <- file.path(path1KG, "ex1_good_small_1KG.gds") fileAnnotGDS <- file.path(path1KG, "ex1_good_small_1KG_Annot.gds") ################################################################# ## The Sample SNP pileup files (one per sample) need ## to be located in the same directory. ################################################################# pathGeno <- file.path(dataDir, "example", "snpPileup") ################################################################# ## The path where the Profile GDS Files (one per sample) ## will be created need to be specified. ################################################################# pathProfileGDS <- file.path(tempdir(), "out.tmp") pathOut <- file.path(tempdir(), "res.out") ################################################################# ## A data frame containing general information about the study ## is also required. The data frame must have ## those 3 columns: "studyID", "study.desc", "study.platform" ################################################################# studyDF <- data.frame(study.id="MYDATA", study.desc="Description", study.platform="PLATFORM", stringsAsFactors=FALSE) #################################################################### ## Fix seed to ensure reproducible results #################################################################### set.seed(2043) gds1KG <- snpgdsOpen(fileReferenceGDS) dataRef <- select1KGPop(gds1KG, nbProfiles=2L) closefn.gds(gds1KG) ## Required library for this example to run correctly if (requireNamespace("Seqinfo", quietly=TRUE) && requireNamespace("BSgenome.Hsapiens.UCSC.hg38", quietly=TRUE)) { ## Chromosome length information ## chr23 is chrX, chr24 is chrY and chrM is 25 chrInfo <- Seqinfo::seqlengths(BSgenome.Hsapiens.UCSC.hg38::Hsapiens)[1:25] runExomeAncestry(pedStudy=demoPedigreeEx1, studyDF=studyDF, pathProfileGDS=pathProfileGDS, pathGeno=pathGeno, pathOut=pathOut, fileReferenceGDS=fileReferenceGDS, fileReferenceAnnotGDS=fileAnnotGDS, chrInfo=chrInfo, syntheticRefDF=dataRef, genoSource="snp-pileup") unlink(pathProfileGDS, recursive=TRUE, force=TRUE) unlink(pathOut, recursive=TRUE, force=TRUE) }## Required library for GDS library(SNPRelate) ## Path to the demo 1KG GDS file is located in this package dataDir <- system.file("extdata", package="RAIDS") ################################################################# ## Load the information about the profile ################################################################# data(demoPedigreeEx1) head(demoPedigreeEx1) ################################################################# ## The 1KG GDS file and the 1KG SNV Annotation GDS file ## need to be located in the same directory ## Note that the 1KG GDS file used for this example is a ## simplified version and CANNOT be used for any real analysis ################################################################# path1KG <- file.path(dataDir, "tests") fileReferenceGDS <- file.path(path1KG, "ex1_good_small_1KG.gds") fileAnnotGDS <- file.path(path1KG, "ex1_good_small_1KG_Annot.gds") ################################################################# ## The Sample SNP pileup files (one per sample) need ## to be located in the same directory. ################################################################# pathGeno <- file.path(dataDir, "example", "snpPileup") ################################################################# ## The path where the Profile GDS Files (one per sample) ## will be created need to be specified. ################################################################# pathProfileGDS <- file.path(tempdir(), "out.tmp") pathOut <- file.path(tempdir(), "res.out") ################################################################# ## A data frame containing general information about the study ## is also required. The data frame must have ## those 3 columns: "studyID", "study.desc", "study.platform" ################################################################# studyDF <- data.frame(study.id="MYDATA", study.desc="Description", study.platform="PLATFORM", stringsAsFactors=FALSE) #################################################################### ## Fix seed to ensure reproducible results #################################################################### set.seed(2043) gds1KG <- snpgdsOpen(fileReferenceGDS) dataRef <- select1KGPop(gds1KG, nbProfiles=2L) closefn.gds(gds1KG) ## Required library for this example to run correctly if (requireNamespace("Seqinfo", quietly=TRUE) && requireNamespace("BSgenome.Hsapiens.UCSC.hg38", quietly=TRUE)) { ## Chromosome length information ## chr23 is chrX, chr24 is chrY and chrM is 25 chrInfo <- Seqinfo::seqlengths(BSgenome.Hsapiens.UCSC.hg38::Hsapiens)[1:25] runExomeAncestry(pedStudy=demoPedigreeEx1, studyDF=studyDF, pathProfileGDS=pathProfileGDS, pathGeno=pathGeno, pathOut=pathOut, fileReferenceGDS=fileReferenceGDS, fileReferenceAnnotGDS=fileAnnotGDS, chrInfo=chrInfo, syntheticRefDF=dataRef, genoSource="snp-pileup") unlink(pathProfileGDS, recursive=TRUE, force=TRUE) unlink(pathOut, recursive=TRUE, force=TRUE) }
A generic function for getting the eigenCount slot in a S4 object.
eigenCount(x)eigenCount(x)
x |
a S4 object. |
a value from the eigenCount slot in the S4 object.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(eigenCount="character")) # Create an instance obj <- new("MyClass", eigenCount="123") # Call the generic (assuming a method is implemented) # eigenCount(obj)# Define a dummy class to show usage setClass("MyClass", slots = list(eigenCount="character")) # Create an instance obj <- new("MyClass", eigenCount="123") # Call the generic (assuming a method is implemented) # eigenCount(obj)
A function for getting the eigenCount slot in a
RAIDSparam class.
## S4 method for signature 'RAIDSparam' eigenCount(x)## S4 method for signature 'RAIDSparam' eigenCount(x)
x |
a |
a single integer indicating the number of
eigenvectors that will be in the output of the snpgdsPCA
function; if 'eigenCount' <= 0, then all eigenvectors are returned.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the eigenCount slot for the object eigenCount(paramDemo)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the eigenCount slot for the object eigenCount(paramDemo)
A generic function for replacement of eigenCount slot in a S4 object.
eigenCount(x) <- valueeigenCount(x) <- value
x |
a S4 object. |
value |
the new value to assign or update. |
the modified S4 object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(eigenCount="character")) # Create an instance obj <- new("MyClass", eigenCount="123") # Call the generic (assuming a method is implemented) # eigenCount(obj) <- "333"# Define a dummy class to show usage setClass("MyClass", slots = list(eigenCount="character")) # Create an instance obj <- new("MyClass", eigenCount="123") # Call the generic (assuming a method is implemented) # eigenCount(obj) <- "333"
A function for replacement of eigenCount slot in a
RAIDSparam class.
## S4 replacement method for signature 'RAIDSparam' eigenCount(x) <- value## S4 replacement method for signature 'RAIDSparam' eigenCount(x) <- value
x |
a |
value |
a single |
the modified RAIDSparam object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign new value to the eigenCount slot in the object eigenCount(paramDemo) <- 33L## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign new value to the eigenCount slot in the object eigenCount(paramDemo) <- 33L
A generic function for getting the eigenCountSyn slot in a S4 object.
eigenCountSyn(x)eigenCountSyn(x)
x |
a S4 object. |
a value from the eigenCountSyn slot in the S4 object.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(eigenCountSyn="character")) # Create an instance obj <- new("MyClass", eigenCountSyn="123") # Call the generic (assuming a method is implemented) # eigenCountSyn(obj)# Define a dummy class to show usage setClass("MyClass", slots = list(eigenCountSyn="character")) # Create an instance obj <- new("MyClass", eigenCountSyn="123") # Call the generic (assuming a method is implemented) # eigenCountSyn(obj)
A function for getting the eigenCountSyn slot in a
RAIDSparam class.
## S4 method for signature 'RAIDSparam' eigenCountSyn(x)## S4 method for signature 'RAIDSparam' eigenCountSyn(x)
x |
a |
a single integer indicating the number of
eigenvectors TODO
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the eigenCountSyn slot for the object eigenCountSyn(paramDemo)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the eigenCountSyn slot for the object eigenCountSyn(paramDemo)
A generic function for replacement of eigenCountSyn slot in a S4 object.
eigenCountSyn(x) <- valueeigenCountSyn(x) <- value
x |
a S4 object. |
value |
the new value to assign or update. |
the modified S4 object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(eigenCountSyn="character")) # Create an instance obj <- new("MyClass", eigenCountSyn="123") # Call the generic (assuming a method is implemented) # eigenCountSyn(obj) <- "333"# Define a dummy class to show usage setClass("MyClass", slots = list(eigenCountSyn="character")) # Create an instance obj <- new("MyClass", eigenCountSyn="123") # Call the generic (assuming a method is implemented) # eigenCountSyn(obj) <- "333"
A function for replacement of eigenCountSyn slot in a
RAIDSparam class.
## S4 replacement method for signature 'RAIDSparam' eigenCountSyn(x) <- value## S4 replacement method for signature 'RAIDSparam' eigenCountSyn(x) <- value
x |
a |
value |
a single |
the modified RAIDSparam object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign new value to the eigenCountSyn slot in the object eigenCountSyn(paramDemo) <- 33L## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign new value to the eigenCountSyn slot in the object eigenCountSyn(paramDemo) <- 33L
The function estimates the allelic fraction of the SNVs for a specific profile and add the information to the associated Profile GDS file. The allelic fraction estimation method is adapted to the type of study (DNA or RNA).
estimateAllelicFraction( gdsReference, gdsProfile, currentProfile, studyID, chrInfo, studyType = c("DNA", "RNA"), minCov = 10L, minProb = 0.999, eProb = 0.001, cutOffLOH = -5, cutOffHomoScore = -3, wAR = 9, cutOffAR = 3, gdsRefAnnot = NULL, blockID = NULL, verbose = FALSE )estimateAllelicFraction( gdsReference, gdsProfile, currentProfile, studyID, chrInfo, studyType = c("DNA", "RNA"), minCov = 10L, minProb = 0.999, eProb = 0.001, cutOffLOH = -5, cutOffHomoScore = -3, wAR = 9, cutOffAR = 3, gdsRefAnnot = NULL, blockID = NULL, verbose = FALSE )
gdsReference |
an object of class |
gdsProfile |
an object of class |
currentProfile |
a |
studyID |
a |
chrInfo |
a |
studyType |
a |
minCov |
a single positive |
minProb |
a single |
eProb |
a single |
cutOffLOH |
a single |
cutOffHomoScore |
a single |
wAR |
a single positive |
cutOffAR |
a single |
gdsRefAnnot |
an object of class |
blockID |
a |
verbose |
a |
The chrInfo parameter contains the length of the chromosomes. The
length of the chromosomes can be obtain through the
seqlengths
library.
As example, for hg38 genome:
if (requireNamespace("Seqinfo", quietly=TRUE) &&
requireNamespace("BSgenome.Hsapiens.UCSC.hg38", quietly=TRUE)) {
chrInfo <- Seqinfo::seqlengths(BSgenome.Hsapiens.UCSC.hg38::Hsapiens)[1:25]
}
The integer 0L when successful.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Required library for GDS library(gdsfmt) ## Path to the demo 1KG GDS file located in this package dataDir <- system.file("extdata/tests", package="RAIDS") fileGDS <- file.path(dataDir, "ex1_good_small_1KG.gds") ## Profile GDS file for one profile fileProfile <- file.path(tempdir(), "ex1.gds") ## Copy the Profile GDS file demo that has been pruned and annotated ## into current directory file.copy(file.path(dataDir, "ex1_demo_with_pruning_and_1KG_annot.gds"), fileProfile) ## Open the reference GDS file (demo version) gds1KG <- snpgdsOpen(fileGDS) ## Profile GDS file for one profile profileGDS <- openfn.gds(fileProfile, readonly=FALSE) ## Required library for this example to run correctly if (requireNamespace("Seqinfo", quietly=TRUE) && requireNamespace("BSgenome.Hsapiens.UCSC.hg38", quietly=TRUE)) { ## Chromosome length information ## chr23 is chrX, chr24 is chrY and chrM is 25 chrInfo <- Seqinfo::seqlengths(BSgenome.Hsapiens.UCSC.hg38::Hsapiens)[1:25] ## Estimate the allelic fraction of the pruned SNVs estimateAllelicFraction(gdsReference=gds1KG, gdsProfile=profileGDS, currentProfile="ex1", studyID="MYDATA", chrInfo=chrInfo, studyType="DNA", minCov=10L, minProb=0.999, eProb=0.001, cutOffLOH=-5, cutOffHomoScore=-3, wAR=9, cutOffAR=3, gdsRefAnnot=NULL, blockID=NULL) ## The allelic fraction is saved in the 'lap' node of Profile GDS file ## The 'lap' entry should be present profileGDS ## Close both GDS files (important) closefn.gds(profileGDS) closefn.gds(gds1KG) ## Remove Profile GDS file (created for demo purpose) unlink(fileProfile, force=TRUE) }## Required library for GDS library(gdsfmt) ## Path to the demo 1KG GDS file located in this package dataDir <- system.file("extdata/tests", package="RAIDS") fileGDS <- file.path(dataDir, "ex1_good_small_1KG.gds") ## Profile GDS file for one profile fileProfile <- file.path(tempdir(), "ex1.gds") ## Copy the Profile GDS file demo that has been pruned and annotated ## into current directory file.copy(file.path(dataDir, "ex1_demo_with_pruning_and_1KG_annot.gds"), fileProfile) ## Open the reference GDS file (demo version) gds1KG <- snpgdsOpen(fileGDS) ## Profile GDS file for one profile profileGDS <- openfn.gds(fileProfile, readonly=FALSE) ## Required library for this example to run correctly if (requireNamespace("Seqinfo", quietly=TRUE) && requireNamespace("BSgenome.Hsapiens.UCSC.hg38", quietly=TRUE)) { ## Chromosome length information ## chr23 is chrX, chr24 is chrY and chrM is 25 chrInfo <- Seqinfo::seqlengths(BSgenome.Hsapiens.UCSC.hg38::Hsapiens)[1:25] ## Estimate the allelic fraction of the pruned SNVs estimateAllelicFraction(gdsReference=gds1KG, gdsProfile=profileGDS, currentProfile="ex1", studyID="MYDATA", chrInfo=chrInfo, studyType="DNA", minCov=10L, minProb=0.999, eProb=0.001, cutOffLOH=-5, cutOffHomoScore=-3, wAR=9, cutOffAR=3, gdsRefAnnot=NULL, blockID=NULL) ## The allelic fraction is saved in the 'lap' node of Profile GDS file ## The 'lap' entry should be present profileGDS ## Close both GDS files (important) closefn.gds(profileGDS) closefn.gds(gds1KG) ## Remove Profile GDS file (created for demo purpose) unlink(fileProfile, force=TRUE) }
A generic function for getting the fieldPopInfAnc slot in a S4 object.
fieldPopInfAnc(x)fieldPopInfAnc(x)
x |
a S4 object. |
a value from the fieldPopInfAnc slot in the S4 object.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(fieldPopInfAnc="character")) # Create an instance obj <- new("MyClass", fieldPopInfAnc="123") # Call the generic (assuming a method is implemented) # fieldPopInfAnc(obj)# Define a dummy class to show usage setClass("MyClass", slots = list(fieldPopInfAnc="character")) # Create an instance obj <- new("MyClass", fieldPopInfAnc="123") # Call the generic (assuming a method is implemented) # fieldPopInfAnc(obj)
A function for getting the fieldPopInfAnc slot in a
RAIDSparam class.
## S4 method for signature 'RAIDSparam' fieldPopInfAnc(x)## S4 method for signature 'RAIDSparam' fieldPopInfAnc(x)
x |
a |
a character string representing the name of
the column in the data frame that contains the inferred
super-population ancestry for the samples. The column should be
present in the data frame.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the fieldPopInfAnc slot for the object fieldPopInfAnc(paramDemo)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the fieldPopInfAnc slot for the object fieldPopInfAnc(paramDemo)
A generic function for replacement of fieldPopInfAnc slot in a S4 object.
fieldPopInfAnc(x) <- valuefieldPopInfAnc(x) <- value
x |
a S4 object. |
value |
the new value to assign or update. |
the modified S4 object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(fieldPopInfAnc="character")) # Create an instance obj <- new("MyClass", fieldPopInfAnc="123") # Call the generic (assuming a method is implemented) # fieldPopInfAnc(obj) <- "333"# Define a dummy class to show usage setClass("MyClass", slots = list(fieldPopInfAnc="character")) # Create an instance obj <- new("MyClass", fieldPopInfAnc="123") # Call the generic (assuming a method is implemented) # fieldPopInfAnc(obj) <- "333"
A function for replacement of fieldPopInfAnc slot in a
RAIDSparam class.
## S4 replacement method for signature 'RAIDSparam' fieldPopInfAnc(x) <- value## S4 replacement method for signature 'RAIDSparam' fieldPopInfAnc(x) <- value
x |
a |
value |
a |
the modified RAIDSparam object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign new value to the fieldPopInfAnc slot in the object fieldPopInfAnc(paramDemo) <- "superPOPULATION"## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign new value to the fieldPopInfAnc slot in the object fieldPopInfAnc(paramDemo) <- "superPOPULATION"
A generic function for getting the fieldPopInRef slot in a S4 object.
fieldPopInRef(x)fieldPopInRef(x)
x |
a S4 object. |
a value from the fieldPopInRef slot in the S4 object.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(fieldPopInRef="character")) # Create an instance obj <- new("MyClass", fieldPopInRef="123") # Call the generic (assuming a method is implemented) # fieldPopInRef(obj)# Define a dummy class to show usage setClass("MyClass", slots = list(fieldPopInRef="character")) # Create an instance obj <- new("MyClass", fieldPopInRef="123") # Call the generic (assuming a method is implemented) # fieldPopInRef(obj)
A function for getting the fieldPopInRef slot in a
RAIDSparam class.
## S4 method for signature 'RAIDSparam' fieldPopInRef(x)## S4 method for signature 'RAIDSparam' fieldPopInRef(x)
x |
a |
a character string representing the name of the
column that contains the known ancestry for the reference profiles in
the Population Reference GDS file (corresponding to the
fileReferenceGDS parameter).
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the fieldPopInRef slot for the object fieldPopInRef(paramDemo)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the fieldPopInRef slot for the object fieldPopInRef(paramDemo)
A generic function for replacement of fieldPopInRef slot in a S4 object.
fieldPopInRef(x) <- valuefieldPopInRef(x) <- value
x |
a S4 object. |
value |
the new value to assign or update. |
the modified S4 object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(fieldPopInRef="character")) # Create an instance obj <- new("MyClass", fieldPopInRef="123") # Call the generic (assuming a method is implemented) # fieldPopInRef(obj) <- "333"# Define a dummy class to show usage setClass("MyClass", slots = list(fieldPopInRef="character")) # Create an instance obj <- new("MyClass", fieldPopInRef="123") # Call the generic (assuming a method is implemented) # fieldPopInRef(obj) <- "333"
A function for replacement of fieldPopInRef slot in a
RAIDSparam class.
## S4 replacement method for signature 'RAIDSparam' fieldPopInRef(x) <- value## S4 replacement method for signature 'RAIDSparam' fieldPopInRef(x) <- value
x |
a |
value |
a |
the modified RAIDSparam object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign new value to the fieldPopInRef slot in the object fieldPopInRef(paramDemo) <- "newPop"## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign new value to the fieldPopInRef slot in the object fieldPopInRef(paramDemo) <- "newPop"
A generic function for getting the fieldSubPop slot in a S4 object.
fieldSubPop(x)fieldSubPop(x)
x |
a S4 object. |
a value from the fieldSubPop slot in the S4 object.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(fieldSubPop="character")) # Create an instance obj <- new("MyClass", fieldSubPop="123") # Call the generic (assuming a method is implemented) # fieldSubPop(obj)# Define a dummy class to show usage setClass("MyClass", slots = list(fieldSubPop="character")) # Create an instance obj <- new("MyClass", fieldSubPop="123") # Call the generic (assuming a method is implemented) # fieldSubPop(obj)
A function for getting the fieldSubPop slot in a
RAIDSparam class.
## S4 method for signature 'RAIDSparam' fieldSubPop(x)## S4 method for signature 'RAIDSparam' fieldSubPop(x)
x |
a |
a character string representing the name of the column
in the Population Reference GDS file (corresponding to the
fileReferenceGDS parameter) that contains the sub-population
information for the samples. The column should be present in the Population
Reference GDS file.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the fieldSubPop slot for the object fieldSubPop(paramDemo)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the fieldSubPop slot for the object fieldSubPop(paramDemo)
A generic function for replacement of fieldSubPop slot in a S4 object.
fieldSubPop(x) <- valuefieldSubPop(x) <- value
x |
a S4 object. |
value |
the new value to assign or update. |
the modified S4 object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(fieldSubPop="character")) # Create an instance obj <- new("MyClass", fieldSubPop="123") # Call the generic (assuming a method is implemented) # fieldSubPop(obj) <- "333"# Define a dummy class to show usage setClass("MyClass", slots = list(fieldSubPop="character")) # Create an instance obj <- new("MyClass", fieldSubPop="123") # Call the generic (assuming a method is implemented) # fieldSubPop(obj) <- "333"
A function for replacement of fieldSubPop slot in a
RAIDSparam class.
## S4 replacement method for signature 'RAIDSparam' fieldSubPop(x) <- value## S4 replacement method for signature 'RAIDSparam' fieldSubPop(x) <- value
x |
a |
value |
a |
the modified RAIDSparam object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign new value to the fieldSubPop slot in the object fieldSubPop(paramDemo) <- "super.POPULATION.group"## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign new value to the fieldSubPop slot in the object fieldSubPop(paramDemo) <- "super.POPULATION.group"
A generic function for getting the fileReferenceAnnotGDS slot in a S4 object.
fileReferenceAnnotGDS(x)fileReferenceAnnotGDS(x)
x |
a S4 object. |
a value from the fileReferenceAnnotGDS slot in the S4 object.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(fileReferenceAnnotGDS="character")) # Create an instance obj <- new("MyClass", fileReferenceAnnotGDS="123") # Call the generic (assuming a method is implemented) # fileReferenceAnnotGDS(obj)# Define a dummy class to show usage setClass("MyClass", slots = list(fileReferenceAnnotGDS="character")) # Create an instance obj <- new("MyClass", fileReferenceAnnotGDS="123") # Call the generic (assuming a method is implemented) # fileReferenceAnnotGDS(obj)
A function for getting the fileReferenceAnnotGDS slot in a
RAIDSparam class.
## S4 method for signature 'RAIDSparam' fileReferenceAnnotGDS(x)## S4 method for signature 'RAIDSparam' fileReferenceAnnotGDS(x)
x |
a |
NULL or a character string representing the file
name of the Population Reference GDS Annotation file.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the fileReferenceAnnotGDS slot for the object fileReferenceAnnotGDS(paramDemo)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the fileReferenceAnnotGDS slot for the object fileReferenceAnnotGDS(paramDemo)
A generic function for replacement of fileReferenceAnnotGDS slot in a S4 object.
fileReferenceAnnotGDS(x) <- valuefileReferenceAnnotGDS(x) <- value
x |
a S4 object. |
value |
the new value to assign or update. |
the modified S4 object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(fileReferenceAnnotGDS="character")) # Create an instance obj <- new("MyClass", fileReferenceAnnotGDS="123") # Call the generic (assuming a method is implemented) # fileReferenceAnnotGDS(obj) <- "333"# Define a dummy class to show usage setClass("MyClass", slots = list(fileReferenceAnnotGDS="character")) # Create an instance obj <- new("MyClass", fileReferenceAnnotGDS="123") # Call the generic (assuming a method is implemented) # fileReferenceAnnotGDS(obj) <- "333"
A function for replacement of fileReferenceAnnotGDS slot in a
RAIDSparam class.
## S4 replacement method for signature 'RAIDSparam' fileReferenceAnnotGDS(x) <- value## S4 replacement method for signature 'RAIDSparam' fileReferenceAnnotGDS(x) <- value
x |
a |
value |
|
the modified RAIDSparam object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Directory where demo GDS files are located dataDir <- system.file("extdata", package="RAIDS") ## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign the existing file to the fileReferenceAnnotGDS slot in the object fileReferenceAnnotGDS(paramDemo) <- file.path(dataDir, "tests/ex1_good_small_1KG_Annot.gds")## Directory where demo GDS files are located dataDir <- system.file("extdata", package="RAIDS") ## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign the existing file to the fileReferenceAnnotGDS slot in the object fileReferenceAnnotGDS(paramDemo) <- file.path(dataDir, "tests/ex1_good_small_1KG_Annot.gds")
A generic function for getting the fileReferenceGDS slot in a S4 object.
fileReferenceGDS(x)fileReferenceGDS(x)
x |
a S4 object. |
a value from the fileReferenceGDS slot in the S4 object.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(fileReferenceGDS="character")) # Create an instance obj <- new("MyClass", fileReferenceGDS="123") # Call the generic (assuming a method is implemented) # fileReferenceGDS(obj)# Define a dummy class to show usage setClass("MyClass", slots = list(fileReferenceGDS="character")) # Create an instance obj <- new("MyClass", fileReferenceGDS="123") # Call the generic (assuming a method is implemented) # fileReferenceGDS(obj)
A function for getting the fileReferenceGDS slot in a
RAIDSparam class.
## S4 method for signature 'RAIDSparam' fileReferenceGDS(x)## S4 method for signature 'RAIDSparam' fileReferenceGDS(x)
x |
a |
NULL or a single character string representing
the file name of the Reference GDS file.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the fileReferenceGDS slot for the object fileReferenceGDS(paramDemo)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the fileReferenceGDS slot for the object fileReferenceGDS(paramDemo)
A generic function for replacement of fileReferenceGDS slot in a S4 object.
fileReferenceGDS(x) <- valuefileReferenceGDS(x) <- value
x |
a S4 object. |
value |
the new value to assign or update. |
the modified S4 object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(fileReferenceGDS="character")) # Create an instance obj <- new("MyClass", fileReferenceGDS="123") # Call the generic (assuming a method is implemented) # fileReferenceGDS(obj) <- "333"# Define a dummy class to show usage setClass("MyClass", slots = list(fileReferenceGDS="character")) # Create an instance obj <- new("MyClass", fileReferenceGDS="123") # Call the generic (assuming a method is implemented) # fileReferenceGDS(obj) <- "333"
A function for replacement of fileReferenceGDS slot in a
RAIDSparam class.
## S4 replacement method for signature 'RAIDSparam' fileReferenceGDS(x) <- value## S4 replacement method for signature 'RAIDSparam' fileReferenceGDS(x) <- value
x |
a |
value |
|
the modified RAIDSparam object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Directory where demo GDS files are located dataDir <- system.file("extdata", package="RAIDS") ## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign the existing file to the fileReferenceGDS slot in the object fileReferenceGDS(paramDemo) <- file.path(dataDir, "tests/ex1_good_small_1KG.gds")## Directory where demo GDS files are located dataDir <- system.file("extdata", package="RAIDS") ## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign the existing file to the fileReferenceGDS slot in the object fileReferenceGDS(paramDemo) <- file.path(dataDir, "tests/ex1_good_small_1KG.gds")
This function generates the GDS file that will contain the information from Reference. The function also add the samples information, the SNP information and the genotyping information into the GDS file.
generateGDS1KG( pathGeno = file.path("data", "sampleGeno"), filePedRDS, fileSNVIndex, fileSNVSelected, fileNameGDS, listSamples = NULL, verbose = FALSE )generateGDS1KG( pathGeno = file.path("data", "sampleGeno"), filePedRDS, fileSNVIndex, fileSNVSelected, fileNameGDS, listSamples = NULL, verbose = FALSE )
pathGeno |
a |
filePedRDS |
a |
fileSNVIndex |
a |
fileSNVSelected |
a |
fileNameGDS |
a |
listSamples |
a |
verbose |
a |
More information about GDS file format can be found at the Bioconductor gdsfmt website: https://bioconductor.org/packages/gdsfmt/
The integer 0L when successful.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Path to the demo pedigree file is located in this package dataDir <- system.file("extdata", package="RAIDS") ## Path to the CSV genoytype files pathGeno <- file.path(dataDir, "demoProfileGenotypes") ## The RDS file containing the pedigree information pedigreeFile <- file.path(dataDir, "PedigreeReferenceDemo.rds") ## The RDS file containing the indexes of the retained SNPs snpIndexFile <- file.path(dataDir, "listSNPIndexes_Demo.rds") ## The RDS file containing the filtered SNP information filterSNVFile <- file.path(dataDir, "mapSNVSelected_Demo.rds") ## Temporary Reference GDS file tempRefGDS <- file.path(tempdir(), "1KG_TEMP.gds") ## Create a temporary Reference GDS file generateGDS1KG(pathGeno=pathGeno, filePedRDS=pedigreeFile, fileSNVIndex=snpIndexFile, fileSNVSelected=filterSNVFile, fileNameGDS=tempRefGDS, listSamples=NULL) ## Remove temporary files unlink(tempRefGDS, force=TRUE)## Path to the demo pedigree file is located in this package dataDir <- system.file("extdata", package="RAIDS") ## Path to the CSV genoytype files pathGeno <- file.path(dataDir, "demoProfileGenotypes") ## The RDS file containing the pedigree information pedigreeFile <- file.path(dataDir, "PedigreeReferenceDemo.rds") ## The RDS file containing the indexes of the retained SNPs snpIndexFile <- file.path(dataDir, "listSNPIndexes_Demo.rds") ## The RDS file containing the filtered SNP information filterSNVFile <- file.path(dataDir, "mapSNVSelected_Demo.rds") ## Temporary Reference GDS file tempRefGDS <- file.path(tempdir(), "1KG_TEMP.gds") ## Create a temporary Reference GDS file generateGDS1KG(pathGeno=pathGeno, filePedRDS=pedigreeFile, fileSNVIndex=snpIndexFile, fileSNVSelected=filterSNVFile, fileNameGDS=tempRefGDS, listSamples=NULL) ## Remove temporary files unlink(tempRefGDS, force=TRUE)
The function applies a cut-off filter to the SNP information file to retain only the SNP that have a frequency superior or equal to the specified cut-off in at least one super population. The information about the retained SNPs is saved in a RDS format file. A RDS file containing the indexes of the retained SNP is also created.
generateMapSnvSel(cutOff = 0.01, fileSNV, fileSNPsRDS, fileFREQ)generateMapSnvSel(cutOff = 0.01, fileSNV, fileSNPsRDS, fileFREQ)
cutOff |
a single |
fileSNV |
a |
fileSNPsRDS |
a |
fileFREQ |
a |
The filtered SNP information RDS file (parameter fileFREQ), contains
a data.frame with those columns:
a character string representing the chromosome where
the SNV is located.
a character string representing the SNV position on the
chromosome.
a character string representing the reference DNA base
for the SNV.
a character string representing the alternative DNA base
for the SNV.
\
a character string representing the allele frequency
of the EAS super population.
a character string representing the allele frequency
of the AFR super population.
a character string representing the allele frequency
of the AMR super population.
a character string representing the allele frequency
of the SAS super population.
The integer 0 when successful.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Path to the demo pedigree file is located in this package dataDir <- system.file("extdata", package="RAIDS") ## Demo SNV information file used as input snvFile <- file.path(dataDir, "matFreqSNV_Demo.txt.bz2") ## Temporary output files ## The first file contains the indexes of the retained SNPs ## The second file contains the filtered SNP information snpIndexFile <- file.path(tempdir(), "listSNP_TEMP.rds") filterSNVFile <- file.path(tempdir(), "mapSNVSel_TEMP.rds") ## Create a data.frame containing the information of the retained ## samples (samples with existing genotyping files) generateMapSnvSel(cutOff=0.01, fileSNV=snvFile, fileSNPsRDS=snpIndexFile, fileFREQ=filterSNVFile) ## Remove temporary files unlink(snpIndexFile, force=TRUE) unlink(filterSNVFile, force=TRUE)## Path to the demo pedigree file is located in this package dataDir <- system.file("extdata", package="RAIDS") ## Demo SNV information file used as input snvFile <- file.path(dataDir, "matFreqSNV_Demo.txt.bz2") ## Temporary output files ## The first file contains the indexes of the retained SNPs ## The second file contains the filtered SNP information snpIndexFile <- file.path(tempdir(), "listSNP_TEMP.rds") filterSNVFile <- file.path(tempdir(), "mapSNVSel_TEMP.rds") ## Create a data.frame containing the information of the retained ## samples (samples with existing genotyping files) generateMapSnvSel(cutOff=0.01, fileSNV=snvFile, fileSNPsRDS=snpIndexFile, fileFREQ=filterSNVFile) ## Remove temporary files unlink(snpIndexFile, force=TRUE) unlink(filterSNVFile, force=TRUE)
The function is adding the phase information into the Reference Phase GDS file. The phase information is extracted from a Reference GDS file and is added into a Reference Phase GDS file. An entry called 'phase' is added to the Reference Phase GDS file.
generatePhase1KG2GDS( gdsReference, gdsReferencePhase, pathGeno, fileSNVIndex, verbose = FALSE )generatePhase1KG2GDS( gdsReference, gdsReferencePhase, pathGeno, fileSNVIndex, verbose = FALSE )
gdsReference |
an object of class gds.class (GDS file), an opened Reference GDS file. |
gdsReferencePhase |
an object of class gds.class (GDS file), an opened Reference Phase GDS file. |
pathGeno |
a |
fileSNVIndex |
a |
verbose |
a |
The function returns 0L when successful.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Required package library(gdsfmt) ## Path to the demo pedigree file is located in this package dataDir <- system.file("extdata", package="RAIDS") ## Path where the demo genotype CSV files are located pathGeno <- file.path(dataDir, "demoProfileGenotypes") ## The RDS file containing the pedigree information pedigreeFile <- file.path(dataDir, "PedigreeReferenceDemo.rds") ## The RDS file containing the indexes of the retained SNPs snpIndexFile <- file.path(dataDir, "listSNPIndexes_Demo.rds") ## The RDS file containing the filtered SNP information filterSNVFile <- file.path(dataDir, "mapSNVSelected_Demo.rds") ## Temporary Reference GDS file containing reference information fileReferenceGDS <- file.path(tempdir(), "1KG_TEMP_02.gds") ## Create a temporary Reference GDS file containing information from 1KG generateGDS1KG(pathGeno=pathGeno, filePedRDS=pedigreeFile, fileSNVIndex=snpIndexFile, fileSNVSelected=filterSNVFile, fileNameGDS=fileReferenceGDS, listSamples=NULL) ## Temporary Phase GDS file that will contain the 1KG Phase information fileRefPhaseGDS <- file.path(tempdir(), "1KG_TEMP_Phase_02.gds") ## Create Reference Phase GDS file gdsPhase <- createfn.gds(fileRefPhaseGDS) ## Open Reference GDS file gdsRef <- openfn.gds(fileReferenceGDS) ## Fill temporary Reference Phase GDS file if (FALSE) { generatePhase1KG2GDS(gdsReference=gdsRef, gdsReferencePhase=gdsPhase, pathGeno=pathGeno, fileSNVIndex=snpIndexFile, verbose=FALSE) } ## Close Reference Phase information file closefn.gds(gdsPhase) ## Close Reference information file closefn.gds(gdsRef) ## Remove temporary files unlink(fileReferenceGDS, force=TRUE) unlink(fileRefPhaseGDS, force=TRUE)## Required package library(gdsfmt) ## Path to the demo pedigree file is located in this package dataDir <- system.file("extdata", package="RAIDS") ## Path where the demo genotype CSV files are located pathGeno <- file.path(dataDir, "demoProfileGenotypes") ## The RDS file containing the pedigree information pedigreeFile <- file.path(dataDir, "PedigreeReferenceDemo.rds") ## The RDS file containing the indexes of the retained SNPs snpIndexFile <- file.path(dataDir, "listSNPIndexes_Demo.rds") ## The RDS file containing the filtered SNP information filterSNVFile <- file.path(dataDir, "mapSNVSelected_Demo.rds") ## Temporary Reference GDS file containing reference information fileReferenceGDS <- file.path(tempdir(), "1KG_TEMP_02.gds") ## Create a temporary Reference GDS file containing information from 1KG generateGDS1KG(pathGeno=pathGeno, filePedRDS=pedigreeFile, fileSNVIndex=snpIndexFile, fileSNVSelected=filterSNVFile, fileNameGDS=fileReferenceGDS, listSamples=NULL) ## Temporary Phase GDS file that will contain the 1KG Phase information fileRefPhaseGDS <- file.path(tempdir(), "1KG_TEMP_Phase_02.gds") ## Create Reference Phase GDS file gdsPhase <- createfn.gds(fileRefPhaseGDS) ## Open Reference GDS file gdsRef <- openfn.gds(fileReferenceGDS) ## Fill temporary Reference Phase GDS file if (FALSE) { generatePhase1KG2GDS(gdsReference=gdsRef, gdsReferencePhase=gdsPhase, pathGeno=pathGeno, fileSNVIndex=snpIndexFile, verbose=FALSE) } ## Close Reference Phase information file closefn.gds(gdsPhase) ## Close Reference information file closefn.gds(gdsRef) ## Remove temporary files unlink(fileReferenceGDS, force=TRUE) unlink(fileRefPhaseGDS, force=TRUE)
The function is adding the phase information into the Reference Phase GDS file. The phase information is extracted from a Reference GDS file and is added into a Reference Phase GDS file. An entry called 'phase' is added to the Reference Phase GDS file.
generatePhaseRef( fileReferenceGDS, fileReferenceAnnotGDS, pathGeno, fileSNVIndex, verbose = FALSE )generatePhaseRef( fileReferenceGDS, fileReferenceAnnotGDS, pathGeno, fileSNVIndex, verbose = FALSE )
fileReferenceGDS |
a |
fileReferenceAnnotGDS |
a |
pathGeno |
a |
fileSNVIndex |
a |
verbose |
a |
The function returns 0L when successful.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Path to the demo pedigree file is located in this package dataDir <- system.file("extdata", package="RAIDS") ## Path where the demo genotype CSV files are located pathGeno <- file.path(dataDir, "demoProfileGenotypes") ## The RDS file containing the pedigree information pedigreeFile <- file.path(dataDir, "PedigreeReferenceDemo.rds") ## The RDS file containing the indexes of the retained SNPs snpIndexFile <- file.path(dataDir, "listSNPIndexes_Demo.rds") ## The RDS file containing the filtered SNP information filterSNVFile <- file.path(dataDir, "mapSNVSelected_Demo.rds") ## Temporary Reference GDS file containing reference information fileReferenceGDS <- file.path(tempdir(), "1KG_TEMP_02.gds") ## Create a temporary Reference GDS file containing information from 1KG generateGDS1KG(pathGeno=pathGeno, filePedRDS=pedigreeFile, fileSNVIndex=snpIndexFile, fileSNVSelected=filterSNVFile, fileNameGDS=fileReferenceGDS, listSamples=NULL) ## Temporary Phase GDS file that will contain the 1KG Phase information fileRefPhaseGDS <- file.path(tempdir(), "1KG_TEMP_Phase_02.gds") ## Fill temporary Reference Phase GDS file if (FALSE) { generatePhaseRef(fileReferenceGDS=fileReferenceGDS, fileReferenceAnnotGDS=fileRefPhaseGDS, pathGeno=pathGeno, fileSNVIndex=snpIndexFile, verbose=FALSE) } ## Remove temporary files unlink(fileReferenceGDS, force=TRUE) unlink(fileRefPhaseGDS, force=TRUE)## Path to the demo pedigree file is located in this package dataDir <- system.file("extdata", package="RAIDS") ## Path where the demo genotype CSV files are located pathGeno <- file.path(dataDir, "demoProfileGenotypes") ## The RDS file containing the pedigree information pedigreeFile <- file.path(dataDir, "PedigreeReferenceDemo.rds") ## The RDS file containing the indexes of the retained SNPs snpIndexFile <- file.path(dataDir, "listSNPIndexes_Demo.rds") ## The RDS file containing the filtered SNP information filterSNVFile <- file.path(dataDir, "mapSNVSelected_Demo.rds") ## Temporary Reference GDS file containing reference information fileReferenceGDS <- file.path(tempdir(), "1KG_TEMP_02.gds") ## Create a temporary Reference GDS file containing information from 1KG generateGDS1KG(pathGeno=pathGeno, filePedRDS=pedigreeFile, fileSNVIndex=snpIndexFile, fileSNVSelected=filterSNVFile, fileNameGDS=fileReferenceGDS, listSamples=NULL) ## Temporary Phase GDS file that will contain the 1KG Phase information fileRefPhaseGDS <- file.path(tempdir(), "1KG_TEMP_Phase_02.gds") ## Fill temporary Reference Phase GDS file if (FALSE) { generatePhaseRef(fileReferenceGDS=fileReferenceGDS, fileReferenceAnnotGDS=fileRefPhaseGDS, pathGeno=pathGeno, fileSNVIndex=snpIndexFile, verbose=FALSE) } ## Remove temporary files unlink(fileReferenceGDS, force=TRUE) unlink(fileRefPhaseGDS, force=TRUE)
This function extract the SNPs that pass a frequency cut-off in at least one super population from a GDS SNP information file and save the retained SNP information into a VCF file.
generateVCF(freqCutoff = NULL, chr = NULL, fileOut, pRAIDS)generateVCF(freqCutoff = NULL, chr = NULL, fileOut, pRAIDS)
freqCutoff |
a single positive |
chr |
a |
fileOut |
a |
pRAIDS |
a |
The integer 0L when successful.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Required library library(gdsfmt) ## Path to the demo pedigree file is located in this package dataDir <- system.file("extdata", package="RAIDS") ## Demo 1KG Reference GDS file fileGDS <- openfn.gds(file.path(dataDir, "PopulationReferenceDemo.gds")) ## Output VCF file that will be created (temporary) vcfFile <- file.path(tempdir(), "Demo_TMP_01.vcf") ## Create a VCF file with the SNV dataset present in the GDS file ## No cutoff on frequency, so all SNVs are saved snvListVCF(gdsReference=fileGDS, fileOut=vcfFile, offset=0L, freqCutoff=NULL) ## Close GDS file (IMPORTANT) closefn.gds(fileGDS) ## Remove temporary VCF file unlink(vcfFile, force=TRUE)## Required library library(gdsfmt) ## Path to the demo pedigree file is located in this package dataDir <- system.file("extdata", package="RAIDS") ## Demo 1KG Reference GDS file fileGDS <- openfn.gds(file.path(dataDir, "PopulationReferenceDemo.gds")) ## Output VCF file that will be created (temporary) vcfFile <- file.path(tempdir(), "Demo_TMP_01.vcf") ## Create a VCF file with the SNV dataset present in the GDS file ## No cutoff on frequency, so all SNVs are saved snvListVCF(gdsReference=fileGDS, fileOut=vcfFile, offset=0L, freqCutoff=NULL) ## Close GDS file (IMPORTANT) closefn.gds(fileGDS) ## Remove temporary VCF file unlink(vcfFile, force=TRUE)
A generic function for getting the genome slot in a S4 object.
genome(x)genome(x)
x |
a S4 object. |
a value from the genome slot in the S4 object.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(genome="character")) # Create an instance obj <- new("MyClass", genome="123") # Call the generic (assuming a method is implemented) # genome(obj)# Define a dummy class to show usage setClass("MyClass", slots = list(genome="character")) # Create an instance obj <- new("MyClass", genome="123") # Call the generic (assuming a method is implemented) # genome(obj)
A function for getting the genome slot in a
RAIDSparam class.
## S4 method for signature 'RAIDSparam' genome(x)## S4 method for signature 'RAIDSparam' genome(x)
x |
a |
character string with one possible value: 'HG38'.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the genome slot for the object genome(paramDemo)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the genome slot for the object genome(paramDemo)
A generic function for getting the genoSource slot in a S4 object.
genoSource(x)genoSource(x)
x |
a S4 object. |
a value from the genoSource slot in the S4 object.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(genoSource="character")) # Create an instance obj <- new("MyClass", genoSource="123") # Call the generic (assuming a method is implemented) # genoSource(obj)# Define a dummy class to show usage setClass("MyClass", slots = list(genoSource="character")) # Create an instance obj <- new("MyClass", genoSource="123") # Call the generic (assuming a method is implemented) # genoSource(obj)
A function for getting the genoSource slot in a
RAIDSparam class.
## S4 method for signature 'RAIDSparam' genoSource(x)## S4 method for signature 'RAIDSparam' genoSource(x)
x |
a |
a single character string corresponding to the type
of file with the genotype and the allele information of the profile that
will be provided in the 'profileFile' slot. The valid options are: "VCF",
"generic", "snp-pileup", and "bam".
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the genoSource slot for the object genoSource(paramDemo)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the genoSource slot for the object genoSource(paramDemo)
A generic function for replacement of genoSource slot in a S4 object.
genoSource(x) <- valuegenoSource(x) <- value
x |
a S4 object. |
value |
the new value to assign or update. |
the modified S4 object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(genoSource="character")) # Create an instance obj <- new("MyClass", genoSource="123") # Call the generic (assuming a method is implemented) # genoSource(obj) <- "333"# Define a dummy class to show usage setClass("MyClass", slots = list(genoSource="character")) # Create an instance obj <- new("MyClass", genoSource="123") # Call the generic (assuming a method is implemented) # genoSource(obj) <- "333"
A function for replacement of genoSource slot in a
RAIDSparam class.
## S4 replacement method for signature 'RAIDSparam' genoSource(x) <- value## S4 replacement method for signature 'RAIDSparam' genoSource(x) <- value
x |
a |
value |
a single |
the modified RAIDSparam object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign the new study type to the genoSource slot in the object genoSource(paramDemo) <- "bam"## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign the new study type to the genoSource slot in the object genoSource(paramDemo) <- "bam"
A generic function for getting the genoType slot in a S4 object.
genoType(x)genoType(x)
x |
a S4 object. |
a value from the genoType slot in the S4 object.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(genoType="character")) # Create an instance obj <- new("MyClass", genoType="123") # Call the generic (assuming a method is implemented) # genoType(obj)# Define a dummy class to show usage setClass("MyClass", slots = list(genoType="character")) # Create an instance obj <- new("MyClass", genoType="123") # Call the generic (assuming a method is implemented) # genoType(obj)
A function for getting the genoType slot in a
RAIDSparam class.
## S4 method for signature 'RAIDSparam' genoType(x)## S4 method for signature 'RAIDSparam' genoType(x)
x |
a |
a single character string representing the field
in the GDS profile file that contains all the genotype information.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the genoType slot for the object genoType(paramDemo)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the genoType slot for the object genoType(paramDemo)
A generic function for replacement of genoType slot in a S4 object.
genoType(x) <- valuegenoType(x) <- value
x |
a S4 object. |
value |
the new value to assign or update. |
the modified S4 object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(genoType="character")) # Create an instance obj <- new("MyClass", genoType="123") # Call the generic (assuming a method is implemented) # genoType(obj) <- "333"# Define a dummy class to show usage setClass("MyClass", slots = list(genoType="character")) # Create an instance obj <- new("MyClass", genoType="123") # Call the generic (assuming a method is implemented) # genoType(obj) <- "333"
A function for replacement of genoType slot in a
RAIDSparam class.
## S4 replacement method for signature 'RAIDSparam' genoType(x) <- value## S4 replacement method for signature 'RAIDSparam' genoType(x) <- value
x |
a |
value |
a single |
the modified RAIDSparam object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign new value to the genoType slot in the object genoType(paramDemo) <- "geno.REF"## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign new value to the genoType slot in the object genoType(paramDemo) <- "geno.REF"
This function extract the SNPs that pass a frequency cut-off in at least one super population from a GDS SNP information file and save the retained SNP information into a VCF file.
getMatrixPopSynthetic(pRAIDS)getMatrixPopSynthetic(pRAIDS)
pRAIDS |
a |
a matrix containing the sample identifiers and where
each column is the name of a subcontinental population. The number of
row corresponds to the number of samples for each subcontinental population.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
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) matGr <- getMatrixPopSynthetic(pRAIDS) dim(matGr)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) matGr <- getMatrixPopSynthetic(pRAIDS) dim(matGr)
The function extract the specified column for the 'sample.ref'
node present in the Reference GDS file. The column must be present in the
data.frame saved in the 'sample.ref' node. Only the information for
the reference profiles is returned. The values
represent the known ancestry assignation.
getRef1KGPop(gdsReference, popName = "superPop")getRef1KGPop(gdsReference, popName = "superPop")
gdsReference |
an object of class gds.class (a GDS file), the opened Reference GDS file. |
popName |
a |
vector of character strings representing the content
of the extracted column for the 1KG GDS 'sample.ref' node. The values
represent the known ancestry assignation. The profile
identifiers are used as names for the vector.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Required library library(gdsfmt) ## Path to the demo pedigree file is located in this package dataDir <- system.file("extdata", package="RAIDS") ## Open existing demo 1K GDS file with "sample.ref" node nameFileGDS <- file.path(dataDir, "PopulationReferenceDemo.gds") fileGDS <- snpgdsOpen(nameFileGDS) ## Extract super population information for the 1KG profiles getRef1KGPop(gdsReference=fileGDS, popName="superPop") ## Close 1K GDS file closefn.gds(fileGDS)## Required library library(gdsfmt) ## Path to the demo pedigree file is located in this package dataDir <- system.file("extdata", package="RAIDS") ## Open existing demo 1K GDS file with "sample.ref" node nameFileGDS <- file.path(dataDir, "PopulationReferenceDemo.gds") fileGDS <- snpgdsOpen(nameFileGDS) ## Extract super population information for the 1KG profiles getRef1KGPop(gdsReference=fileGDS, popName="superPop") ## Close 1K GDS file closefn.gds(fileGDS)
The function extract the specified column for the 'sample.ref'
node present in the Reference GDS file. The column must be present in the
data.frame saved in the 'sample.ref' node. Only the information for
the reference profiles is returned. The values
represent the known ancestry assignation.
getRefSuperPop(fileReferenceGDS)getRefSuperPop(fileReferenceGDS)
fileReferenceGDS |
a |
vector of character strings representing the content
of the extracted column for the 1KG GDS 'sample.ref' node. The values
represent the known ancestry assignation. The profile
identifiers are used as names for the vector.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Path to the demo pedigree file is located in this package dataDir <- system.file("extdata", package="RAIDS") ## Open existing demo 1K GDS file with "sample.ref" node nameFileGDS <- file.path(dataDir, "PopulationReferenceDemo.gds") ## Extract super population information for the 1KG profiles getRefSuperPop(fileReferenceGDS=nameFileGDS)## Path to the demo pedigree file is located in this package dataDir <- system.file("extdata", package="RAIDS") ## Open existing demo 1K GDS file with "sample.ref" node nameFileGDS <- file.path(dataDir, "PopulationReferenceDemo.gds") ## Extract super population information for the 1KG profiles getRefSuperPop(fileReferenceGDS=nameFileGDS)
The function extract the specified column for the 'sample.ref'
node present in the Reference GDS file. The column must be present in the
data.frame saved in the 'sample.ref' node. Only the information for
the reference profiles is returned. The values
represent the known ancestry assignation.
getRefSuperPop2(pRAIDS)getRefSuperPop2(pRAIDS)
pRAIDS |
a |
vector of character strings representing the content
of the extracted column for the 1KG GDS 'sample.ref' node. The values
represent the known ancestry assignation. The profile
identifiers are used as names for the vector.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
dataDir <- system.file("extdata/tests", package="RAIDS") ## Path for gds reference files fileGDS <- file.path(dataDir, "ex1_good_small_1KG.gds") pRAIDS <- RAIDSparam(fileReferenceGDS=fileGDS) spRef <- getRefSuperPop2(pRAIDS) head(spRef)dataDir <- system.file("extdata/tests", package="RAIDS") ## Path for gds reference files fileGDS <- file.path(dataDir, "ex1_good_small_1KG.gds") pRAIDS <- RAIDSparam(fileReferenceGDS=fileGDS) spRef <- getRefSuperPop2(pRAIDS) head(spRef)
This function merge all the genotyping files associated to one specific sample into one file. That merged VCF file will be saved in a specified directory and will have the name of the sample. It will also be compressed (bzip). The function will merge the files for all samples present in the input directory.
groupChr1KGSNV(pathGenoChr, pathOut)groupChr1KGSNV(pathGenoChr, pathOut)
pathGenoChr |
a |
pathOut |
a |
The integer 0L when successful or FALSE if not.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Path to the demo vcf files in this package dataDir <- system.file("extdata", package="RAIDS") pathGenoTar <- file.path(dataDir, "demoGenoChr", "demoGenoChr.tar") ## Path where the chromosomes files will be located pathGeno <- file.path(tempdir(), "tempGeno") dir.create(pathGeno, showWarnings=FALSE) ## Untar the file that contains the VCF files for 3 samples split by ## chromosome (one directory per chromosome) untar(tarfile=pathGenoTar, exdir=pathGeno) ## Path where the output VCF file will be created is ## the same where the split VCF are (pathGeno) ## The files must not exist if (!file.exists(file.path(pathGeno, "NA12003.csv.bz2")) && !file.exists(file.path(pathGeno, "NA12004.csv.bz2")) && !file.exists(file.path(pathGeno, "NA12005.csv.bz2"))) { ## Return 0 when successful ## The files "NA12003.csv.bz2", "NA12004.csv.bz2" and ## "NA12005.csv.bz2" should not be present in the current directory groupChr1KGSNV(pathGenoChr=pathGeno, pathOut=pathGeno) ## Validate that files have been created file.exists(file.path(pathGeno, "NA12003.csv.bz2")) file.exists(file.path(pathGeno, "NA12004.csv.bz2")) file.exists(file.path(pathGeno, "NA12005.csv.bz2")) } ## Remove temporary directory unlink(pathGeno, recursive=TRUE, force=TRUE)## Path to the demo vcf files in this package dataDir <- system.file("extdata", package="RAIDS") pathGenoTar <- file.path(dataDir, "demoGenoChr", "demoGenoChr.tar") ## Path where the chromosomes files will be located pathGeno <- file.path(tempdir(), "tempGeno") dir.create(pathGeno, showWarnings=FALSE) ## Untar the file that contains the VCF files for 3 samples split by ## chromosome (one directory per chromosome) untar(tarfile=pathGenoTar, exdir=pathGeno) ## Path where the output VCF file will be created is ## the same where the split VCF are (pathGeno) ## The files must not exist if (!file.exists(file.path(pathGeno, "NA12003.csv.bz2")) && !file.exists(file.path(pathGeno, "NA12004.csv.bz2")) && !file.exists(file.path(pathGeno, "NA12005.csv.bz2"))) { ## Return 0 when successful ## The files "NA12003.csv.bz2", "NA12004.csv.bz2" and ## "NA12005.csv.bz2" should not be present in the current directory groupChr1KGSNV(pathGenoChr=pathGeno, pathOut=pathGeno) ## Validate that files have been created file.exists(file.path(pathGeno, "NA12003.csv.bz2")) file.exists(file.path(pathGeno, "NA12004.csv.bz2")) file.exists(file.path(pathGeno, "NA12005.csv.bz2")) } ## Remove temporary directory unlink(pathGeno, recursive=TRUE, force=TRUE)
The function identify patients that are genetically related in the Reference file. It generates a first RDS file with the list of unrelated patient. It also generates a second RDS file with the kinship coefficient between the patients.
identifyRelative(gds, maf = 0.05, thresh = 2^(-11/2), fileIBD, filePart)identifyRelative(gds, maf = 0.05, thresh = 2^(-11/2), fileIBD, filePart)
gds |
an object of class
|
maf |
a single |
thresh |
a single |
fileIBD |
a |
filePart |
a |
NULL invisibly.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Required package library(gdsfmt) ## Path to the demo pedigree file is located in this package dataDir <- system.file("extdata", package="RAIDS") ## Open existing demo Reference GDS file fileGDS <- file.path(dataDir, "PopulationReferenceDemo.gds") tmpGDS <- snpgdsOpen(fileGDS) ## Temporary output files ## The first RDS file will contain the list of unrelated patients ## The second RDS file will contain the kinship information between patients patientTmpFile <- "unrelatedPatients_TEMP.rds" ibdTmpFile <- "ibd_TEMP.rds" ## Different code depending of the withr package availability if (requireNamespace("withr", quietly=TRUE)) { ## Temporary output files ## The first RDS file will contain the list of unrelated patients ## The second RDS file will contain the kinship information ## between patients patientTmpFileLocal <- withr::local_file(patientTmpFile) ibdTmpFileLocal <- withr::local_file(ibdTmpFile) ## Identify unrelated patients in demo Reference GDS file identifyRelative(gds=tmpGDS, maf=0.05, thresh=2^(-11/2), fileIBD=ibdTmpFileLocal, filePart=patientTmpFileLocal) ## Close demo Reference GDS file closefn.gds(tmpGDS) ## Remove temporary files withr::deferred_run() } else { ## Identify unrelated patients in demo Reference GDS file identifyRelative(gds=tmpGDS, maf=0.05, thresh=2^(-11/2), fileIBD=ibdTmpFile, filePart=patientTmpFile) ## Close demo Reference GDS file closefn.gds(tmpGDS) ## Remove temporary files unlink(patientTmpFile, force=TRUE) unlink(ibdTmpFile, force=TRUE) }## Required package library(gdsfmt) ## Path to the demo pedigree file is located in this package dataDir <- system.file("extdata", package="RAIDS") ## Open existing demo Reference GDS file fileGDS <- file.path(dataDir, "PopulationReferenceDemo.gds") tmpGDS <- snpgdsOpen(fileGDS) ## Temporary output files ## The first RDS file will contain the list of unrelated patients ## The second RDS file will contain the kinship information between patients patientTmpFile <- "unrelatedPatients_TEMP.rds" ibdTmpFile <- "ibd_TEMP.rds" ## Different code depending of the withr package availability if (requireNamespace("withr", quietly=TRUE)) { ## Temporary output files ## The first RDS file will contain the list of unrelated patients ## The second RDS file will contain the kinship information ## between patients patientTmpFileLocal <- withr::local_file(patientTmpFile) ibdTmpFileLocal <- withr::local_file(ibdTmpFile) ## Identify unrelated patients in demo Reference GDS file identifyRelative(gds=tmpGDS, maf=0.05, thresh=2^(-11/2), fileIBD=ibdTmpFileLocal, filePart=patientTmpFileLocal) ## Close demo Reference GDS file closefn.gds(tmpGDS) ## Remove temporary files withr::deferred_run() } else { ## Identify unrelated patients in demo Reference GDS file identifyRelative(gds=tmpGDS, maf=0.05, thresh=2^(-11/2), fileIBD=ibdTmpFile, filePart=patientTmpFile) ## Close demo Reference GDS file closefn.gds(tmpGDS) ## Remove temporary files unlink(patientTmpFile, force=TRUE) unlink(ibdTmpFile, force=TRUE) }
The function identify patients that are genetically related in the Reference file. It generates a first RDS file with the list of unrelated patient. It also generates a second RDS file with the kinship coefficient between the patients.
identifyRelativeRef( fileReferenceGDS, maf = 0.05, thresh = 2^(-11/2), fileIBD, filePart )identifyRelativeRef( fileReferenceGDS, maf = 0.05, thresh = 2^(-11/2), fileIBD, filePart )
fileReferenceGDS |
a |
maf |
a single |
thresh |
a single |
fileIBD |
a |
filePart |
a |
NULL invisibly.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Path to the demo pedigree file is located in this package dataDir <- system.file("extdata", package="RAIDS") ## Open existing demo Reference GDS file fileGDS <- file.path(dataDir, "PopulationReferenceDemo.gds") ## Temporary output files ## The first RDS file will contain the list of unrelated patients ## The second RDS file will contain the kinship information between patients patientTmpFile <- "unrelatedPatients_TEMP.rds" ibdTmpFile <- "ibd_TEMP.rds" ## Different code depending of the withr package availability if (requireNamespace("withr", quietly=TRUE)) { ## Temporary output files ## The first RDS file will contain the list of unrelated patients ## The second RDS file will contain the kinship information ## between patients patientTmpFileLocal <- withr::local_file(patientTmpFile) ibdTmpFileLocal <- withr::local_file(ibdTmpFile) ## Identify unrelated patients in demo Reference GDS file identifyRelativeRef(fileReferenceGDS=fileGDS, maf=0.05, thresh=2^(-11/2), fileIBD=ibdTmpFileLocal, filePart=patientTmpFileLocal) ## Remove temporary files withr::deferred_run() } else { ## Identify unrelated patients in demo Reference GDS file identifyRelativeRef(fileReferenceGDS=fileGDS, maf=0.05, thresh=2^(-11/2), fileIBD=ibdTmpFile, filePart=patientTmpFile) ## Remove temporary files unlink(patientTmpFile, force=TRUE) unlink(ibdTmpFile, force=TRUE) }## Path to the demo pedigree file is located in this package dataDir <- system.file("extdata", package="RAIDS") ## Open existing demo Reference GDS file fileGDS <- file.path(dataDir, "PopulationReferenceDemo.gds") ## Temporary output files ## The first RDS file will contain the list of unrelated patients ## The second RDS file will contain the kinship information between patients patientTmpFile <- "unrelatedPatients_TEMP.rds" ibdTmpFile <- "ibd_TEMP.rds" ## Different code depending of the withr package availability if (requireNamespace("withr", quietly=TRUE)) { ## Temporary output files ## The first RDS file will contain the list of unrelated patients ## The second RDS file will contain the kinship information ## between patients patientTmpFileLocal <- withr::local_file(patientTmpFile) ibdTmpFileLocal <- withr::local_file(ibdTmpFile) ## Identify unrelated patients in demo Reference GDS file identifyRelativeRef(fileReferenceGDS=fileGDS, maf=0.05, thresh=2^(-11/2), fileIBD=ibdTmpFileLocal, filePart=patientTmpFileLocal) ## Remove temporary files withr::deferred_run() } else { ## Identify unrelated patients in demo Reference GDS file identifyRelativeRef(fileReferenceGDS=fileGDS, maf=0.05, thresh=2^(-11/2), fileIBD=ibdTmpFile, filePart=patientTmpFile) ## Remove temporary files unlink(patientTmpFile, force=TRUE) unlink(ibdTmpFile, force=TRUE) }
This function runs most steps leading to the ancestry inference call on a specific RNA profile. First, the function creates the Profile GDS file for the specific profile using the information from a RDS Sample description file and the Population Reference GDS file.
inferAncestry( profileFile, pathProfileGDS, fileReferenceGDS, fileReferenceAnnotGDS, chrInfo, syntheticRefDF, genoSource = c("snp-pileup", "generic", "VCF", "bam"), np = 1L, verbose = FALSE )inferAncestry( profileFile, pathProfileGDS, fileReferenceGDS, fileReferenceAnnotGDS, chrInfo, syntheticRefDF, genoSource = c("snp-pileup", "generic", "VCF", "bam"), np = 1L, verbose = FALSE )
profileFile |
a |
pathProfileGDS |
a |
fileReferenceGDS |
a |
fileReferenceAnnotGDS |
a |
chrInfo |
a |
syntheticRefDF |
a
|
genoSource |
a |
np |
a single positive |
verbose |
a |
a list containing 4 entries:
pcaSample a list containing the information related
to the eigenvectors. The list contains those 3 entries:
sample.id a character string representing the unique
identifier of the current profile.
eigenvector.ref a matrix of numeric containing
the eigenvectors for the reference profiles.
eigenvector a matrix of numeric containing the
eigenvectors for the current profile projected on the PCA from the
reference profiles.
paraSample a list containing the results with
different D and K values that lead to optimal parameter
selection. The list contains those entries:
dfPCA a data.frame containing statistical results
on all combined synthetic results done with a fixed value of D (the
number of dimensions). The data.frame contains those columns:
D a numeric representing the value of D (the
number of dimensions).
median a numeric representing the median of the
minimum AUROC obtained (within super populations) for all combination of
the fixed D value and all tested K values.
mad a numeric representing the MAD of the minimum
AUROC obtained (within super populations) for all combination of the fixed
D value and all tested K values.
upQuartile a numeric representing the upper quartile
of the minimum AUROC obtained (within super populations) for all
combination of the fixed D value and all tested K values.
k a numeric representing the optimal K value
(the number of neighbors) for a fixed D value.
dfPop a data.frame containing statistical results on
all combined synthetic results done with different values of D (the
number of dimensions) and K (the number of neighbors).
The data.frame contains those columns:
D a numeric representing the value of D (the
number of dimensions).
K a numeric representing the value of K (the
number of neighbors).
AUROC.min a numeric representing the minimum accuracy
obtained by grouping all the synthetic results by super-populations, for
the specified values of D and K.
AUROC a numeric representing the accuracy obtained
by grouping all the synthetic results for the specified values of D
and K.
Accu.CM a numeric representing the value of accuracy
of the confusion matrix obtained by grouping all the synthetic results for
the specified values of D and K.
dfAUROC a data.frame the summary of the results by
super-population. The data.frame contains
those columns:
D a numeric representing the value of D (the
number of dimensions).
K a numeric representing the value of K (the
number of neighbors).
Call a character string representing the
super-population.
L a numeric representing the lower value of the 95%
confidence interval for the AUROC obtained for the fixed values of
super-population, D and K.
AUROC a numeric representing the AUROC obtained for the
fixed values of super-population, D and K.
H a numeric representing the higher value of the 95%
confidence interval for the AUROC obtained for the fixed values of
super-population, D and K.
D a numeric representing the optimal D value
(the number of dimensions) for the specific profile.
K a numeric representing the optimal K value
(the number of neighbors) for the specific profile.
listD a numeric representing the optimal D
values (the number of dimensions) for the specific profile. More than one
D is possible.
KNNSample a data.frame containing the inferred ancestry
for different values of K and D. The data.frame
contains those columns:
sample.id a character string representing the unique
identifier of the current profile.
D a numeric representing the value of D (the
number of dimensions) used to infer the ancestry.
K a numeric representing the value of K (the
number of neighbors) used to infer the ancestry.
SuperPop a character string representing the inferred
ancestry for the specified D and K values.
KNNSynthetic a data.frame containing the inferred ancestry
for each synthetic data for different values of K and D.
The data.frame
contains those columns: "sample.id", "D", "K", "infer.superPop", "ref.superPop"
sample.id a character string representing the unique
identifier of the current synthetic data.
D a numeric representing the value of D (the
number of dimensions) used to infer the ancestry.
K a numeric representing the value of K (the
number of neighbors) used to infer the ancestry.
infer.superPop a character string representing the inferred
ancestry for the specified D and K values.
ref.superPop a character string representing the known
ancestry from the reference
Ancestry a data.frame containing the inferred
ancestry for the current profile. The data.frame contains those
columns:
sample.id a character string representing the unique
identifier of the current profile.
D a numeric representing the value of D (the
number of dimensions) used to infer the ancestry.
K a numeric representing the value of K (the
number of neighbors) used to infer the ancestry.
SuperPop a character string representing the inferred
ancestry.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
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.
## Required library for GDS library(SNPRelate) ## Path to the demo 1KG GDS file is located in this package dataDir <- system.file("extdata", package="RAIDS") ################################################################# ## The 1KG GDS file and the 1KG SNV Annotation GDS file ## need to be located in the same directory ## Note that the 1KG GDS file used for this example is a ## simplified version and CANNOT be used for any real analysis ################################################################# path1KG <- file.path(dataDir, "tests") fileReferenceGDS <- file.path(path1KG, "ex1_good_small_1KG.gds") fileAnnotGDS <- file.path(path1KG, "ex1_good_small_1KG_Annot.gds") ################################################################# ## The Sample SNP pileup files (one per sample) need ## to be located in the same directory. ################################################################# demoProfileEx1 <- file.path(dataDir, "example", "snpPileup", "ex1.txt.gz") ################################################################# ## The path where the Profile GDS Files (one per sample) ## will be created need to be specified. ################################################################# pathProfileGDS <- file.path(tempdir(), "out.tmp") #################################################################### ## Fix seed to ensure reproducible results #################################################################### set.seed(3043) gds1KG <- snpgdsOpen(fileReferenceGDS) dataRef <- select1KGPop(gds1KG, nbProfiles=2L) closefn.gds(gds1KG) ## Required library for this example to run correctly if (requireNamespace("Seqinfo", quietly=TRUE) && requireNamespace("BSgenome.Hsapiens.UCSC.hg38", quietly=TRUE)) { ## Chromosome length information ## chr23 is chrX, chr24 is chrY and chrM is 25 chrInfo <- Seqinfo::seqlengths(BSgenome.Hsapiens.UCSC.hg38::Hsapiens)[1:25] res <- inferAncestry(profileFile=demoProfileEx1, pathProfileGDS=pathProfileGDS, fileReferenceGDS=fileReferenceGDS, fileReferenceAnnotGDS=fileAnnotGDS, chrInfo=chrInfo, syntheticRefDF=dataRef, genoSource="snp-pileup") unlink(pathProfileGDS, recursive=TRUE, force=TRUE) }## Required library for GDS library(SNPRelate) ## Path to the demo 1KG GDS file is located in this package dataDir <- system.file("extdata", package="RAIDS") ################################################################# ## The 1KG GDS file and the 1KG SNV Annotation GDS file ## need to be located in the same directory ## Note that the 1KG GDS file used for this example is a ## simplified version and CANNOT be used for any real analysis ################################################################# path1KG <- file.path(dataDir, "tests") fileReferenceGDS <- file.path(path1KG, "ex1_good_small_1KG.gds") fileAnnotGDS <- file.path(path1KG, "ex1_good_small_1KG_Annot.gds") ################################################################# ## The Sample SNP pileup files (one per sample) need ## to be located in the same directory. ################################################################# demoProfileEx1 <- file.path(dataDir, "example", "snpPileup", "ex1.txt.gz") ################################################################# ## The path where the Profile GDS Files (one per sample) ## will be created need to be specified. ################################################################# pathProfileGDS <- file.path(tempdir(), "out.tmp") #################################################################### ## Fix seed to ensure reproducible results #################################################################### set.seed(3043) gds1KG <- snpgdsOpen(fileReferenceGDS) dataRef <- select1KGPop(gds1KG, nbProfiles=2L) closefn.gds(gds1KG) ## Required library for this example to run correctly if (requireNamespace("Seqinfo", quietly=TRUE) && requireNamespace("BSgenome.Hsapiens.UCSC.hg38", quietly=TRUE)) { ## Chromosome length information ## chr23 is chrX, chr24 is chrY and chrM is 25 chrInfo <- Seqinfo::seqlengths(BSgenome.Hsapiens.UCSC.hg38::Hsapiens)[1:25] res <- inferAncestry(profileFile=demoProfileEx1, pathProfileGDS=pathProfileGDS, fileReferenceGDS=fileReferenceGDS, fileReferenceAnnotGDS=fileAnnotGDS, chrInfo=chrInfo, syntheticRefDF=dataRef, genoSource="snp-pileup") unlink(pathProfileGDS, recursive=TRUE, force=TRUE) }
This function runs most steps leading to the ancestry inference call on a specific RNA profile. First, the function creates the Profile GDS file for the specific profile using the information from a RDS Sample description file and the Population Reference GDS file.
inferAncestryDNA( profileFile, pathProfileGDS, fileReferenceGDS, fileReferenceAnnotGDS, chrInfo, syntheticRefDF, genoSource = c("snp-pileup", "generic", "VCF", "bam"), np = 1L, verbose = FALSE )inferAncestryDNA( profileFile, pathProfileGDS, fileReferenceGDS, fileReferenceAnnotGDS, chrInfo, syntheticRefDF, genoSource = c("snp-pileup", "generic", "VCF", "bam"), np = 1L, verbose = FALSE )
profileFile |
a |
pathProfileGDS |
a |
fileReferenceGDS |
a |
fileReferenceAnnotGDS |
a |
chrInfo |
a |
syntheticRefDF |
a
|
genoSource |
a |
np |
a single positive |
verbose |
a |
a list containing 4 entries:
pcaSample a list containing the information related
to the eigenvectors. The list contains those 3 entries:
sample.id a character string representing the unique
identifier of the current profile.
eigenvector.ref a matrix of numeric containing
the eigenvectors for the reference profiles.
eigenvector a matrix of numeric containing the
eigenvectors for the current profile projected on the PCA from the
reference profiles.
paraSample a list containing the results with
different D and K values that lead to optimal parameter
selection. The list contains those entries:
dfPCA a data.frame containing statistical results
on all combined synthetic results done with a fixed value of D (the
number of dimensions). The data.frame contains those columns:
D a numeric representing the value of D (the
number of dimensions).
median a numeric representing the median of the
minimum AUROC obtained (within super populations) for all combination of
the fixed D value and all tested K values.
mad a numeric representing the MAD of the minimum
AUROC obtained (within super populations) for all combination of the fixed
D value and all tested K values.
upQuartile a numeric representing the upper quartile
of the minimum AUROC obtained (within super populations) for all
combination of the fixed D value and all tested K values.
k a numeric representing the optimal K value
(the number of neighbors) for a fixed D value.
dfPop a data.frame containing statistical results on
all combined synthetic results done with different values of D (the
number of dimensions) and K (the number of neighbors).
The data.frame contains those columns:
D a numeric representing the value of D (the
number of dimensions).
K a numeric representing the value of K (the
number of neighbors).
AUROC.min a numeric representing the minimum accuracy
obtained by grouping all the synthetic results by super-populations, for
the specified values of D and K.
AUROC a numeric representing the accuracy obtained
by grouping all the synthetic results for the specified values of D
and K.
Accu.CM a numeric representing the value of accuracy
of the confusion matrix obtained by grouping all the synthetic results for
the specified values of D and K.
dfAUROC a data.frame the summary of the results by
super-population. The data.frame contains
those columns:
D a numeric representing the value of D (the
number of dimensions).
K a numeric representing the value of K (the
number of neighbors).
Call a character string representing the
super-population.
L a numeric representing the lower value of the 95%
confidence interval for the AUROC obtained for the fixed values of
super-population, D and K.
AUROC a numeric representing the AUROC obtained for the
fixed values of super-population, D and K.
H a numeric representing the higher value of the 95%
confidence interval for the AUROC obtained for the fixed values of
super-population, D and K.
D a numeric representing the optimal D value
(the number of dimensions) for the specific profile.
K a numeric representing the optimal K value
(the number of neighbors) for the specific profile.
listD a numeric representing the optimal D
values (the number of dimensions) for the specific profile. More than one
D is possible.
KNNSample a data.frame containing the inferred ancestry
for different values of K and D. The data.frame
contains those columns:
sample.id a character string representing the unique
identifier of the current profile.
D a numeric representing the value of D (the
number of dimensions) used to infer the ancestry.
K a numeric representing the value of K (the
number of neighbors) used to infer the ancestry.
SuperPop a character string representing the inferred
ancestry for the specified D and K values.
KNNSynthetic a data.frame containing the inferred ancestry
for each synthetic data for different values of K and D.
The data.frame
contains those columns: "sample.id", "D", "K", "infer.superPop", "ref.superPop"
sample.id a character string representing the unique
identifier of the current synthetic data.
D a numeric representing the value of D (the
number of dimensions) used to infer the ancestry.
K a numeric representing the value of K (the
number of neighbors) used to infer the ancestry.
infer.superPop a character string representing the inferred
ancestry for the specified D and K values.
ref.superPop a character string representing the known
ancestry from the reference
Ancestry a data.frame containing the inferred
ancestry for the current profile. The data.frame contains those
columns:
sample.id a character string representing the unique
identifier of the current profile.
D a numeric representing the value of D (the
number of dimensions) used to infer the ancestry.
K a numeric representing the value of K (the
number of neighbors) used to infer the ancestry.
SuperPop a character string representing the inferred
ancestry.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
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.
## Required library for GDS library(SNPRelate) ## Path to the demo 1KG GDS file is located in this package dataDir <- system.file("extdata", package="RAIDS") ################################################################# ## The 1KG GDS file and the 1KG SNV Annotation GDS file ## need to be located in the same directory ## Note that the 1KG GDS file used for this example is a ## simplified version and CANNOT be used for any real analysis ################################################################# path1KG <- file.path(dataDir, "tests") fileReferenceGDS <- file.path(path1KG, "ex1_good_small_1KG.gds") fileAnnotGDS <- file.path(path1KG, "ex1_good_small_1KG_Annot.gds") ################################################################# ## The Sample SNP pileup files (one per sample) need ## to be located in the same directory. ################################################################# demoProfileEx1 <- file.path(dataDir, "example", "snpPileup", "ex1.txt.gz") ################################################################# ## The path where the Profile GDS Files (one per sample) ## will be created need to be specified. ################################################################# pathProfileGDS <- file.path(tempdir(), "out.tmp") #################################################################### ## Fix seed to ensure reproducible results #################################################################### set.seed(3043) gds1KG <- snpgdsOpen(fileReferenceGDS) dataRef <- select1KGPop(gds1KG, nbProfiles=2L) closefn.gds(gds1KG) ## Required library for this example to run correctly if (requireNamespace("Seqinfo", quietly=TRUE) && requireNamespace("BSgenome.Hsapiens.UCSC.hg38", quietly=TRUE)) { ## Chromosome length information ## chr23 is chrX, chr24 is chrY and chrM is 25 chrInfo <- Seqinfo::seqlengths(BSgenome.Hsapiens.UCSC.hg38::Hsapiens)[1:25] res <- inferAncestryDNA(profileFile=demoProfileEx1, pathProfileGDS=pathProfileGDS, fileReferenceGDS=fileReferenceGDS, fileReferenceAnnotGDS=fileAnnotGDS, chrInfo=chrInfo, syntheticRefDF=dataRef, genoSource="snp-pileup") unlink(pathProfileGDS, recursive=TRUE, force=TRUE) }## Required library for GDS library(SNPRelate) ## Path to the demo 1KG GDS file is located in this package dataDir <- system.file("extdata", package="RAIDS") ################################################################# ## The 1KG GDS file and the 1KG SNV Annotation GDS file ## need to be located in the same directory ## Note that the 1KG GDS file used for this example is a ## simplified version and CANNOT be used for any real analysis ################################################################# path1KG <- file.path(dataDir, "tests") fileReferenceGDS <- file.path(path1KG, "ex1_good_small_1KG.gds") fileAnnotGDS <- file.path(path1KG, "ex1_good_small_1KG_Annot.gds") ################################################################# ## The Sample SNP pileup files (one per sample) need ## to be located in the same directory. ################################################################# demoProfileEx1 <- file.path(dataDir, "example", "snpPileup", "ex1.txt.gz") ################################################################# ## The path where the Profile GDS Files (one per sample) ## will be created need to be specified. ################################################################# pathProfileGDS <- file.path(tempdir(), "out.tmp") #################################################################### ## Fix seed to ensure reproducible results #################################################################### set.seed(3043) gds1KG <- snpgdsOpen(fileReferenceGDS) dataRef <- select1KGPop(gds1KG, nbProfiles=2L) closefn.gds(gds1KG) ## Required library for this example to run correctly if (requireNamespace("Seqinfo", quietly=TRUE) && requireNamespace("BSgenome.Hsapiens.UCSC.hg38", quietly=TRUE)) { ## Chromosome length information ## chr23 is chrX, chr24 is chrY and chrM is 25 chrInfo <- Seqinfo::seqlengths(BSgenome.Hsapiens.UCSC.hg38::Hsapiens)[1:25] res <- inferAncestryDNA(profileFile=demoProfileEx1, pathProfileGDS=pathProfileGDS, fileReferenceGDS=fileReferenceGDS, fileReferenceAnnotGDS=fileAnnotGDS, chrInfo=chrInfo, syntheticRefDF=dataRef, genoSource="snp-pileup") unlink(pathProfileGDS, recursive=TRUE, force=TRUE) }
This function runs most steps leading to the ancestry inference call on a specific RNA profile. First, the function creates the Profile GDS file for the specific profile using the information from a RDS Sample description file and the Population Reference GDS file.
inferAncestryGeneAware( profileFile, pathProfileGDS, fileReferenceGDS, fileReferenceAnnotGDS, chrInfo, syntheticRefDF, genoSource = c("snp-pileup", "generic", "VCF", "bam"), np = 1L, blockTypeID, verbose = FALSE )inferAncestryGeneAware( profileFile, pathProfileGDS, fileReferenceGDS, fileReferenceAnnotGDS, chrInfo, syntheticRefDF, genoSource = c("snp-pileup", "generic", "VCF", "bam"), np = 1L, blockTypeID, verbose = FALSE )
profileFile |
a |
pathProfileGDS |
a |
fileReferenceGDS |
a |
fileReferenceAnnotGDS |
a |
chrInfo |
a |
syntheticRefDF |
a
|
genoSource |
a |
np |
a single positive |
blockTypeID |
a |
verbose |
a |
The runExomeAncestry() function generates 3 types of files in the OUTPUT directory.
The ancestry inference CSV file (".Ancestry.csv" file)
The inference information RDS file (".infoCall.rds" file)
The parameter information RDS files from the synthetic inference ("KNN.synt.*.rds" files in a sub-directory)
In addition, a sub-directory (named using the profile ID) is also created.
a list containing 4 entries:
pcaSample a list containing the information related
to the eigenvectors. The list contains those 3 entries:
sample.id a character string representing the unique
identifier of the current profile.
eigenvector.ref a matrix of numeric containing
the eigenvectors for the reference profiles.
eigenvector a matrix of numeric containing the
eigenvectors for the current profile projected on the PCA from the
reference profiles.
paraSample a list containing the results with
different D and K values that lead to optimal parameter
selection. The list contains those entries:
dfPCA a data.frame containing statistical results
on all combined synthetic results done with a fixed value of D (the
number of dimensions). The data.frame contains those columns:
D a numeric representing the value of D (the
number of dimensions).
median a numeric representing the median of the
minimum AUROC obtained (within super populations) for all combination of
the fixed D value and all tested K values.
mad a numeric representing the MAD of the minimum
AUROC obtained (within super populations) for all combination of the fixed
D value and all tested K values.
upQuartile a numeric representing the upper quartile
of the minimum AUROC obtained (within super populations) for all
combination of the fixed D value and all tested K values.
k a numeric representing the optimal K value
(the number of neighbors) for a fixed D value.
dfPop a data.frame containing statistical results on
all combined synthetic results done with different values of D (the
number of dimensions) and K (the number of neighbors).
The data.frame contains those columns:
D a numeric representing the value of D (the
number of dimensions).
K a numeric representing the value of K (the
number of neighbors).
AUROC.min a numeric representing the minimum accuracy
obtained by grouping all the synthetic results by super-populations, for
the specified values of D and K.
AUROC a numeric representing the accuracy obtained
by grouping all the synthetic results for the specified values of D
and K.
Accu.CM a numeric representing the value of accuracy
of the confusion matrix obtained by grouping all the synthetic results for
the specified values of D and K.
dfAUROC a data.frame the summary of the results by
super-population. The data.frame contains
those columns:
D a numeric representing the value of D (the
number of dimensions).
K a numeric representing the value of K (the
number of neighbors).
Call a character string representing the
super-population.
L a numeric representing the lower value of the 95%
confidence interval for the AUROC obtained for the fixed values of
super-population, D and K.
AUROC a numeric representing the AUROC obtained for
the fixed values of super-population, D and K.
H a numeric representing the higher value of the 95%
confidence interval for the AUROC obtained for the fixed values of
super-population, D and K.
D a numeric representing the optimal D value
(the number of dimensions) for the specific profile.
K a numeric representing the optimal K value
(the number of neighbors) for the specific profile.
listD a numeric representing the optimal D
values (the number of dimensions) for the specific profile. More than one
D is possible.
KNNSample a data.frame containing the inferred
ancestry for different values of K and D. The
data.frame contains those columns:
sample.id a character string representing the unique
identifier of the current profile.
D a numeric representing the value of D (the
number of dimensions) used to infer the ancestry.
K a numeric representing the value of K (the
number of neighbors) used to infer the ancestry.
SuperPop a character string representing the inferred
ancestry for the specified D and K values.
KNNSynthetic a data.frame containing the inferred
ancestry for each synthetic data for different values of K and
D.
The data.frame
contains those columns:
sample.id a character string representing the unique
identifier of the current synthetic data.
D a numeric representing the value of D (the
number of dimensions) used to infer the ancestry.
K a numeric representing the value of K (the
number of neighbors) used to infer the ancestry.
infer.superPop a character string representing the
inferred ancestry for the specified D and K values.
ref.superPop a character string representing the known
ancestry from the reference
Ancestry a data.frame containing the inferred
ancestry for the current profile. The data.frame contains those
columns:
sample.id a character string representing the unique
identifier of the current profile.
D a numeric representing the value of D (the
number of dimensions) used to infer the ancestry.
K a numeric representing the value of K (the
number of neighbors) used to infer the ancestry.
SuperPop a character string representing the inferred
ancestry.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
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.
## Required library for GDS library(SNPRelate) ## Path to the demo 1KG GDS file is located in this package dataDir <- system.file("extdata", package="RAIDS") ################################################################# ## The 1KG GDS file and the 1KG SNV Annotation GDS file ## need to be located in the same directory ## Note that the 1KG GDS file used for this example is a ## simplified version and CANNOT be used for any real analysis ################################################################# path1KG <- file.path(dataDir, "tests") fileReferenceGDS <- file.path(path1KG, "ex1_good_small_1KG.gds") fileAnnotGDS <- file.path(path1KG, "ex1_good_small_1KG_Annot.gds") ################################################################# ## The Sample SNP pileup files (one per sample) need ## to be located in the same directory. ################################################################# demoProfileEx1 <- file.path(dataDir, "example", "snpPileup", "ex1.txt.gz") ################################################################# ## The path where the Profile GDS Files (one per sample) ## will be created need to be specified. ################################################################# pathProfileGDS <- file.path(tempdir(), "out.tmp") #################################################################### ## Fix seed to ensure reproducible results #################################################################### set.seed(3043) gds1KG <- snpgdsOpen(fileReferenceGDS) dataRef <- select1KGPop(gds1KG, nbProfiles=2L) closefn.gds(gds1KG) ## Required library for this example to run correctly if (requireNamespace("Seqinfo", quietly=TRUE) && requireNamespace("BSgenome.Hsapiens.UCSC.hg38", quietly=TRUE)) { ## Chromosome length information ## chr23 is chrX, chr24 is chrY and chrM is 25 chrInfo <- Seqinfo::seqlengths(BSgenome.Hsapiens.UCSC.hg38::Hsapiens)[1:25] res <- inferAncestryGeneAware(profileFile=demoProfileEx1, pathProfileGDS=pathProfileGDS, fileReferenceGDS=fileReferenceGDS, fileReferenceAnnotGDS=fileAnnotGDS, chrInfo=chrInfo, syntheticRefDF=dataRef, blockTypeID="GeneS.Ensembl.Hsapiens.v86", genoSource="snp-pileup") unlink(pathProfileGDS, recursive=TRUE, force=TRUE) }## Required library for GDS library(SNPRelate) ## Path to the demo 1KG GDS file is located in this package dataDir <- system.file("extdata", package="RAIDS") ################################################################# ## The 1KG GDS file and the 1KG SNV Annotation GDS file ## need to be located in the same directory ## Note that the 1KG GDS file used for this example is a ## simplified version and CANNOT be used for any real analysis ################################################################# path1KG <- file.path(dataDir, "tests") fileReferenceGDS <- file.path(path1KG, "ex1_good_small_1KG.gds") fileAnnotGDS <- file.path(path1KG, "ex1_good_small_1KG_Annot.gds") ################################################################# ## The Sample SNP pileup files (one per sample) need ## to be located in the same directory. ################################################################# demoProfileEx1 <- file.path(dataDir, "example", "snpPileup", "ex1.txt.gz") ################################################################# ## The path where the Profile GDS Files (one per sample) ## will be created need to be specified. ################################################################# pathProfileGDS <- file.path(tempdir(), "out.tmp") #################################################################### ## Fix seed to ensure reproducible results #################################################################### set.seed(3043) gds1KG <- snpgdsOpen(fileReferenceGDS) dataRef <- select1KGPop(gds1KG, nbProfiles=2L) closefn.gds(gds1KG) ## Required library for this example to run correctly if (requireNamespace("Seqinfo", quietly=TRUE) && requireNamespace("BSgenome.Hsapiens.UCSC.hg38", quietly=TRUE)) { ## Chromosome length information ## chr23 is chrX, chr24 is chrY and chrM is 25 chrInfo <- Seqinfo::seqlengths(BSgenome.Hsapiens.UCSC.hg38::Hsapiens)[1:25] res <- inferAncestryGeneAware(profileFile=demoProfileEx1, pathProfileGDS=pathProfileGDS, fileReferenceGDS=fileReferenceGDS, fileReferenceAnnotGDS=fileAnnotGDS, chrInfo=chrInfo, syntheticRefDF=dataRef, blockTypeID="GeneS.Ensembl.Hsapiens.v86", genoSource="snp-pileup") unlink(pathProfileGDS, recursive=TRUE, force=TRUE) }
A generic function for getting the inferenceType slot in a S4 object.
inferenceType(x)inferenceType(x)
x |
a S4 object. |
a value from the inferenceType slot in the S4 object.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(inferenceType="character")) # Create an instance obj <- new("MyClass", inferenceType="123") # Call the generic (assuming a method is implemented) # inferenceType(obj)# Define a dummy class to show usage setClass("MyClass", slots = list(inferenceType="character")) # Create an instance obj <- new("MyClass", inferenceType="123") # Call the generic (assuming a method is implemented) # inferenceType(obj)
A function for getting the inferenceType slot in a
RAIDSparam class.
## S4 method for signature 'RAIDSparam' inferenceType(x)## S4 method for signature 'RAIDSparam' inferenceType(x)
x |
a |
a single character string representing the genotype
ancestry inference method.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the inferenceType slot for the object inferenceType(paramDemo)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the inferenceType slot for the object inferenceType(paramDemo)
A generic function for replacement of inferenceType slot in a S4 object.
inferenceType(x) <- valueinferenceType(x) <- value
x |
a S4 object. |
value |
the new value to assign or update. |
the modified S4 object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(inferenceType="character")) # Create an instance obj <- new("MyClass", inferenceType="123") # Call the generic (assuming a method is implemented) # inferenceType(obj) <- "333"# Define a dummy class to show usage setClass("MyClass", slots = list(inferenceType="character")) # Create an instance obj <- new("MyClass", inferenceType="123") # Call the generic (assuming a method is implemented) # inferenceType(obj) <- "333"
A function for replacement of inferenceType slot in a
RAIDSparam class.
## S4 replacement method for signature 'RAIDSparam' inferenceType(x) <- value## S4 replacement method for signature 'RAIDSparam' inferenceType(x) <- value
x |
a |
value |
a single |
the modified RAIDSparam object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Directory where demo GDS files are located dataDir <- system.file("extdata", package="RAIDS") ## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign a new value to the inferenceType slot in the object inferenceType(paramDemo) <- "haploAdmixture"## Directory where demo GDS files are located dataDir <- system.file("extdata", package="RAIDS") ## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign a new value to the inferenceType slot in the object inferenceType(paramDemo) <- "haploAdmixture"
A generic function for getting the kList slot in a S4 object.
kList(x)kList(x)
x |
a S4 object. |
a value from the kList slot in the S4 object.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(kList="character")) # Create an instance obj <- new("MyClass", kList="123") # Call the generic (assuming a method is implemented) # kList(obj)# Define a dummy class to show usage setClass("MyClass", slots = list(kList="character")) # Create an instance obj <- new("MyClass", kList="123") # Call the generic (assuming a method is implemented) # kList(obj)
A function for getting the kList slot in a
RAIDSparam class.
## S4 method for signature 'RAIDSparam' kList(x)## S4 method for signature 'RAIDSparam' kList(x)
x |
a |
a vector of positive integer representing the
values tested for the K parameter. The K parameter
represents the number of neighbors used in the K-nearest neighbor analysis.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the kList slot for the object kList(paramDemo)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the kList slot for the object kList(paramDemo)
A generic function for replacement of kList slot in a S4 object.
kList(x) <- valuekList(x) <- value
x |
a S4 object. |
value |
the new value to assign or update. |
the modified S4 object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(kList="character")) # Create an instance obj <- new("MyClass", kList="123") # Call the generic (assuming a method is implemented) # kList(obj) <- "333"# Define a dummy class to show usage setClass("MyClass", slots = list(kList="character")) # Create an instance obj <- new("MyClass", kList="123") # Call the generic (assuming a method is implemented) # kList(obj) <- "333"
A function for replacement of kList slot in a
RAIDSparam class.
## S4 replacement method for signature 'RAIDSparam' kList(x) <- value## S4 replacement method for signature 'RAIDSparam' kList(x) <- value
x |
a |
value |
a |
the modified RAIDSparam object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign new value to the kList slot in the object kList(paramDemo) <- c(2L, 3L, 4L, 5L)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign new value to the kList slot in the object kList(paramDemo) <- c(2L, 3L, 4L, 5L)
A generic function for getting the listPos slot in a S4 object.
listPos(x)listPos(x)
x |
a S4 object. |
a value from the listPos slot in the S4 object.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(listPos="character")) # Create an instance obj <- new("MyClass", listPos="123") # Call the generic (assuming a method is implemented) # listPos(obj)# Define a dummy class to show usage setClass("MyClass", slots = list(listPos="character")) # Create an instance obj <- new("MyClass", listPos="123") # Call the generic (assuming a method is implemented) # listPos(obj)
A function for getting the listPos slot in a
RAIDSparam class.
## S4 method for signature 'RAIDSparam' listPos(x)## S4 method for signature 'RAIDSparam' listPos(x)
x |
a |
a single positive integer specifying the number of
threads to be used.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the listPos slot for the object listPos(paramDemo)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the listPos slot for the object listPos(paramDemo)
A generic function for replacement of listPos slot in a S4 object.
listPos(x) <- valuelistPos(x) <- value
x |
a S4 object. |
value |
the new value to assign or update. |
the modified S4 object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(listPos="character")) # Create an instance obj <- new("MyClass", listPos="123") # Call the generic (assuming a method is implemented) # listPos(obj) <- "333"# Define a dummy class to show usage setClass("MyClass", slots = list(listPos="character")) # Create an instance obj <- new("MyClass", listPos="123") # Call the generic (assuming a method is implemented) # listPos(obj) <- "333"
A function for replacement of listPos slot in a
RAIDSparam class.
## S4 replacement method for signature 'RAIDSparam' listPos(x) <- value## S4 replacement method for signature 'RAIDSparam' listPos(x) <- value
x |
a |
value |
|
the modified RAIDSparam object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign new values to the listPos slot in the object listPos(paramDemo) <-data.frame(snp.chromosome=c("1", "1"), snp.position=c(12232, 433333))## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign new values to the listPos slot in the object listPos(paramDemo) <-data.frame(snp.chromosome=c("1", "1"), snp.position=c(12232, 433333))
data.frame containing the
inferred ancestry on the synthetic profiles.The object is a data.frame with 4 columns.
data(matKNNSynthetic)data(matKNNSynthetic)
The data.frame containing the information about the
synthetic profiles. The data.frame contains 4 columns:
sample.id a character string representing the unique
synthetic profile identifier.
D a numeric representing the number of dimensions used
to infer the ancestry of the synthetic profile.
K a numeric representing the number of neighbors used
to infer the ancestry of the synthetic profile.
SuperPop a character string representing the
inferred ancestry of the synthetic profile for the specific D and K values.
This dataset can be
used to test the computeSyntheticROC function.
The data.frame containing the information about the
synthetic profiles. The data.frame contains 4 columns:
sample.id a character string representing the unique
synthetic profile identifier.
D a numeric representing the number of dimensions used
to infer the ancestry of the synthetic profile.
K a numeric representing the number of neighbors used
to infer the ancestry of the synthetic profile.
SuperPop a character string representing the
inferred ancestry of the synthetic profile for the specific D and K values.
computeSyntheticROCfor calculating the AUROC of the inferences for specific values of D and K using the inferred ancestry results from the synthetic profiles
## Loading demo dataset containing pedigree information for synthetic ## profiles data(pedSynthetic) ## Loading demo dataset containing the inferred ancestry results ## for the synthetic data data(matKNNSynthetic) ## Retain one K and one D value matKNN <- matKNNSynthetic[matKNNSynthetic$D == 5 & matKNNSynthetic$K == 4, ] ## Compile statistics from the ## synthetic profiles for fixed values of D and K results <- RAIDS:::computeSyntheticROC(matKNN=matKNN, matKNNAncestryColumn="SuperPop", pedCall=pedSynthetic, pedCallAncestryColumn="superPop", listCall=c("EAS", "EUR", "AFR", "AMR", "SAS")) results$matAUROC.All results$matAUROC.Call results$listROC.Call## Loading demo dataset containing pedigree information for synthetic ## profiles data(pedSynthetic) ## Loading demo dataset containing the inferred ancestry results ## for the synthetic data data(matKNNSynthetic) ## Retain one K and one D value matKNN <- matKNNSynthetic[matKNNSynthetic$D == 5 & matKNNSynthetic$K == 4, ] ## Compile statistics from the ## synthetic profiles for fixed values of D and K results <- RAIDS:::computeSyntheticROC(matKNN=matKNN, matKNNAncestryColumn="SuperPop", pedCall=pedSynthetic, pedCallAncestryColumn="superPop", listCall=c("EAS", "EUR", "AFR", "AMR", "SAS")) results$matAUROC.All results$matAUROC.Call results$listROC.Call
A generic function for getting the minCov slot in a S4 object.
minCov(x)minCov(x)
x |
a S4 object. |
a value from the minCov slot in the S4 object.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(minCov="character")) # Create an instance obj <- new("MyClass", minCov="123") # Call the generic (assuming a method is implemented) # minCov(obj)# Define a dummy class to show usage setClass("MyClass", slots = list(minCov="character")) # Create an instance obj <- new("MyClass", minCov="123") # Call the generic (assuming a method is implemented) # minCov(obj)
A function for getting the minCov slot in a
RAIDSparam class.
## S4 method for signature 'RAIDSparam' minCov(x)## S4 method for signature 'RAIDSparam' minCov(x)
x |
a |
a single positive integer representing the minimum
required coverage.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the minCov slot for the object minCov(paramDemo)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the minCov slot for the object minCov(paramDemo)
A generic function for replacement of minCov slot in a S4 object.
minCov(x) <- valueminCov(x) <- value
x |
a S4 object. |
value |
the new value to assign or update. |
the modified S4 object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(minCov="character")) # Create an instance obj <- new("MyClass", minCov="123") # Call the generic (assuming a method is implemented) # minCov(obj) <- "333"# Define a dummy class to show usage setClass("MyClass", slots = list(minCov="character")) # Create an instance obj <- new("MyClass", minCov="123") # Call the generic (assuming a method is implemented) # minCov(obj) <- "333"
A function for replacement of minCov slot in a
RAIDSparam class.
A function for replacement of minCov slot in a
RAIDSparam class.
## S4 replacement method for signature 'RAIDSparam' minCov(x) <- value ## S4 replacement method for signature 'RAIDSparam' minCov(x) <- value## S4 replacement method for signature 'RAIDSparam' minCov(x) <- value ## S4 replacement method for signature 'RAIDSparam' minCov(x) <- value
x |
a |
value |
a single positive |
the modified RAIDSparam object when the new value is valid.
the modified RAIDSparam object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign a new value to the minCov slot in the object minCov(paramDemo) <- 3L ## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign a new value to the minCov slot in the object minCov(paramDemo) <- 3L## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign a new value to the minCov slot in the object minCov(paramDemo) <- 3L ## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign a new value to the minCov slot in the object minCov(paramDemo) <- 3L
A generic function for getting the minProb slot in a S4 object.
minProb(x)minProb(x)
x |
a S4 object. |
a value from the minProb slot in the S4 object.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(minProb="character")) # Create an instance obj <- new("MyClass", minProb="123") # Call the generic (assuming a method is implemented) # minProb(obj)# Define a dummy class to show usage setClass("MyClass", slots = list(minProb="character")) # Create an instance obj <- new("MyClass", minProb="123") # Call the generic (assuming a method is implemented) # minProb(obj)
A function for getting the minProb slot in a
RAIDSparam class.
## S4 method for signature 'RAIDSparam' minProb(x)## S4 method for signature 'RAIDSparam' minProb(x)
x |
a |
a single numeric between 0 and 1
representing the probability that the calculated genotype call is correct.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the minProb slot for the object minProb(paramDemo)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the minProb slot for the object minProb(paramDemo)
A generic function for replacement of minProb slot in a S4 object.
minProb(x) <- valueminProb(x) <- value
x |
a S4 object. |
value |
the new value to assign or update. |
the modified S4 object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(minProb="character")) # Create an instance obj <- new("MyClass", minProb="123") # Call the generic (assuming a method is implemented) # minProb(obj) <- "333"# Define a dummy class to show usage setClass("MyClass", slots = list(minProb="character")) # Create an instance obj <- new("MyClass", minProb="123") # Call the generic (assuming a method is implemented) # minProb(obj) <- "333"
A function for replacement of minProb slot in a
RAIDSparam class.
## S4 replacement method for signature 'RAIDSparam' minProb(x) <- value## S4 replacement method for signature 'RAIDSparam' minProb(x) <- value
x |
a |
value |
a single |
the modified RAIDSparam object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign a new value to the minProb slot in the object minProb(paramDemo) <- 0.03## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign a new value to the minProb slot in the object minProb(paramDemo) <- 0.03
A generic function for getting the nbSim slot in a S4 object.
nbSim(x)nbSim(x)
x |
a S4 object. |
a value from the nbSim slot in the S4 object.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(nbSim="character")) # Create an instance obj <- new("MyClass", nbSim="123") # Call the generic (assuming a method is implemented) # nbSim(obj)# Define a dummy class to show usage setClass("MyClass", slots = list(nbSim="character")) # Create an instance obj <- new("MyClass", nbSim="123") # Call the generic (assuming a method is implemented) # nbSim(obj)
A function for getting the nbSim slot in a
RAIDSparam class.
## S4 method for signature 'RAIDSparam' nbSim(x)## S4 method for signature 'RAIDSparam' nbSim(x)
x |
a |
a positive integer representing TODO.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the nbSim slot for the object nbSim(paramDemo)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the nbSim slot for the object nbSim(paramDemo)
A generic function for replacement of nbSim slot in a S4 object.
nbSim(x) <- valuenbSim(x) <- value
x |
a S4 object. |
value |
the new value to assign or update. |
the modified S4 object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(nbSim="character")) # Create an instance obj <- new("MyClass", nbSim="123") # Call the generic (assuming a method is implemented) # nbSim(obj) <- "333"# Define a dummy class to show usage setClass("MyClass", slots = list(nbSim="character")) # Create an instance obj <- new("MyClass", nbSim="123") # Call the generic (assuming a method is implemented) # nbSim(obj) <- "333"
A function for replacement of nbSim slot in a
RAIDSparam class.
## S4 replacement method for signature 'RAIDSparam' nbSim(x) <- value## S4 replacement method for signature 'RAIDSparam' nbSim(x) <- value
x |
a |
value |
a positive |
the modified RAIDSparam object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign a new value to the nbSim slot in the object nbSim(paramDemo) <- 1L## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign a new value to the nbSim slot in the object nbSim(paramDemo) <- 1L
A generic function for getting the np slot in a S4 object.
np(x)np(x)
x |
a S4 object. |
a value from the np slot in the S4 object.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(np="character")) # Create an instance obj <- new("MyClass", np="123") # Call the generic (assuming a method is implemented) # np(obj)# Define a dummy class to show usage setClass("MyClass", slots = list(np="character")) # Create an instance obj <- new("MyClass", np="123") # Call the generic (assuming a method is implemented) # np(obj)
A function for getting the np slot in a
RAIDSparam class.
## S4 method for signature 'RAIDSparam' np(x)## S4 method for signature 'RAIDSparam' np(x)
x |
a |
a single positive integer specifying the number of
threads to be used.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the np slot for the object np(paramDemo)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the np slot for the object np(paramDemo)
A generic function for replacement of np slot in a S4 object.
np(x) <- valuenp(x) <- value
x |
a S4 object. |
value |
the new value to assign or update. |
the modified S4 object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(np="character")) # Create an instance obj <- new("MyClass", np="123") # Call the generic (assuming a method is implemented) # np(obj) <- "333"# Define a dummy class to show usage setClass("MyClass", slots = list(np="character")) # Create an instance obj <- new("MyClass", np="123") # Call the generic (assuming a method is implemented) # np(obj) <- "333"
A function for replacement of np slot in a
RAIDSparam class.
## S4 replacement method for signature 'RAIDSparam' np(x) <- value## S4 replacement method for signature 'RAIDSparam' np(x) <- value
x |
a |
value |
a single positive |
the modified RAIDSparam object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign a new value to the np slot in the object np(paramDemo) <-3L## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign a new value to the np slot in the object np(paramDemo) <-3L
A generic function for getting the paramAncestry slot in a S4 object.
paramAncestry(x)paramAncestry(x)
x |
a S4 object. |
a value from the paramAncestry slot in the S4 object.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(paramAncestry="character")) # Create an instance obj <- new("MyClass", paramAncestry="123") # Call the generic (assuming a method is implemented) # paramAncestry(obj)# Define a dummy class to show usage setClass("MyClass", slots = list(paramAncestry="character")) # Create an instance obj <- new("MyClass", paramAncestry="123") # Call the generic (assuming a method is implemented) # paramAncestry(obj)
A function for getting the paramAncestry slot in a
RAIDSparam class.
## S4 method for signature 'RAIDSparam' paramAncestry(x)## S4 method for signature 'RAIDSparam' paramAncestry(x)
x |
a |
a list of parameters related to ancestry.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the paramAncestry slot for the object paramAncestry(paramDemo)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the paramAncestry slot for the object paramAncestry(paramDemo)
A generic function for replacement of paramAncestry slot in a S4 object.
paramAncestry(x) <- valueparamAncestry(x) <- value
x |
a S4 object. |
value |
the new value to assign or update. |
the modified S4 object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(paramAncestry="character")) # Create an instance obj <- new("MyClass", paramAncestry="123") # Call the generic (assuming a method is implemented) # paramAncestry(obj) <- "333"# Define a dummy class to show usage setClass("MyClass", slots = list(paramAncestry="character")) # Create an instance obj <- new("MyClass", paramAncestry="123") # Call the generic (assuming a method is implemented) # paramAncestry(obj) <- "333"
A function for replacement of paramAncestry slot in a
RAIDSparam class.
## S4 replacement method for signature 'RAIDSparam' paramAncestry(x) <- value## S4 replacement method for signature 'RAIDSparam' paramAncestry(x) <- value
x |
a |
value |
a |
the modified RAIDSparam object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign the new chrInfo to the paramAncestry slot in the object paramAncestry(paramDemo) <- list(ScanBamParam=NULL, PileupParam=NULL, yieldSize=1000023)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign the new chrInfo to the paramAncestry slot in the object paramAncestry(paramDemo) <- list(ScanBamParam=NULL, PileupParam=NULL, yieldSize=1000023)
A generic function for getting the pathADMIXTURE slot in a S4 object.
pathADMIXTURE(x)pathADMIXTURE(x)
x |
a S4 object. |
a value from the pathADMIXTURE slot in the S4 object.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(pathADMIXTURE="character")) # Create an instance obj <- new("MyClass", pathADMIXTURE="123") # Call the generic (assuming a method is implemented) # pathADMIXTURE(obj)# Define a dummy class to show usage setClass("MyClass", slots = list(pathADMIXTURE="character")) # Create an instance obj <- new("MyClass", pathADMIXTURE="123") # Call the generic (assuming a method is implemented) # pathADMIXTURE(obj)
A function for getting the pathADMIXTURE slot in a
RAIDSparam class.
## S4 method for signature 'RAIDSparam' pathADMIXTURE(x)## S4 method for signature 'RAIDSparam' pathADMIXTURE(x)
x |
a |
a character string representing the path pf
the software ADMIXTURE and the binary.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the pathADMIXTURE slot for the object pathADMIXTURE(paramDemo)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the pathADMIXTURE slot for the object pathADMIXTURE(paramDemo)
A generic function for replacement of pathADMIXTURE slot in a S4 object.
pathADMIXTURE(x) <- valuepathADMIXTURE(x) <- value
x |
a S4 object. |
value |
the new value to assign or update. |
the modified S4 object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(pathADMIXTURE="character")) # Create an instance obj <- new("MyClass", pathADMIXTURE="123") # Call the generic (assuming a method is implemented) # pathADMIXTURE(obj) <- "333"# Define a dummy class to show usage setClass("MyClass", slots = list(pathADMIXTURE="character")) # Create an instance obj <- new("MyClass", pathADMIXTURE="123") # Call the generic (assuming a method is implemented) # pathADMIXTURE(obj) <- "333"
A function for replacement of pathADMIXTURE slot in a
RAIDSparam class.
## S4 replacement method for signature 'RAIDSparam' pathADMIXTURE(x) <- value## S4 replacement method for signature 'RAIDSparam' pathADMIXTURE(x) <- value
x |
a |
value |
a |
the modified RAIDSparam object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Directory where demo GDS files are located dataDir <- system.file("extdata", package="RAIDS") ## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign the existing path to the pathADMIXTURE slot in the object pathADMIXTURE(paramDemo) <- file.path(dataDir)## Directory where demo GDS files are located dataDir <- system.file("extdata", package="RAIDS") ## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign the existing path to the pathADMIXTURE slot in the object pathADMIXTURE(paramDemo) <- file.path(dataDir)
A generic function for getting the pathProfileGDS slot in a S4 object.
pathProfileGDS(x)pathProfileGDS(x)
x |
a S4 object. |
a value from the pathProfileGDS slot in the S4 object.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(pathProfileGDS="character")) # Create an instance obj <- new("MyClass", pathProfileGDS="123") # Call the generic (assuming a method is implemented) # pathProfileGDS(obj)# Define a dummy class to show usage setClass("MyClass", slots = list(pathProfileGDS="character")) # Create an instance obj <- new("MyClass", pathProfileGDS="123") # Call the generic (assuming a method is implemented) # pathProfileGDS(obj)
A function for getting the pathProfileGDS slot in a
RAIDSparam class.
## S4 method for signature 'RAIDSparam' pathProfileGDS(x)## S4 method for signature 'RAIDSparam' pathProfileGDS(x)
x |
a |
NULL or a single character string representing the
path to the directory where the GDS Profile files will be created.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the pathProfileGDS slot for the object pathProfileGDS(paramDemo)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the pathProfileGDS slot for the object pathProfileGDS(paramDemo)
A generic function for replacement of pathProfileGDS slot in a S4 object.
pathProfileGDS(x) <- valuepathProfileGDS(x) <- value
x |
a S4 object. |
value |
the new value to assign or update. |
the modified S4 object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(pathProfileGDS="character")) # Create an instance obj <- new("MyClass", pathProfileGDS="123") # Call the generic (assuming a method is implemented) # pathProfileGDS(obj) <- "333"# Define a dummy class to show usage setClass("MyClass", slots = list(pathProfileGDS="character")) # Create an instance obj <- new("MyClass", pathProfileGDS="123") # Call the generic (assuming a method is implemented) # pathProfileGDS(obj) <- "333"
A function for replacement of pathProfileGDS slot in a
RAIDSparam class.
## S4 replacement method for signature 'RAIDSparam' pathProfileGDS(x) <- value## S4 replacement method for signature 'RAIDSparam' pathProfileGDS(x) <- value
x |
a |
value |
|
the modified RAIDSparam object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Directory where demo GDS files are located dataDir <- system.file("extdata", package="RAIDS") ## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign the existing path to the pathProfileGDS slot in the object pathProfileGDS(paramDemo) <- file.path(dataDir)## Directory where demo GDS files are located dataDir <- system.file("extdata", package="RAIDS") ## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign the existing path to the pathProfileGDS slot in the object pathProfileGDS(paramDemo) <- file.path(dataDir)
A generic function for getting the PCAalgorithm slot in a S4 object.
PCAalgorithm(x)PCAalgorithm(x)
x |
a S4 object. |
a value from the PCAalgorithm slot in the S4 object.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(PCAalgorithm="character")) # Create an instance obj <- new("MyClass", PCAalgorithm="123") # Call the generic (assuming a method is implemented) # PCAalgorithm(obj)# Define a dummy class to show usage setClass("MyClass", slots = list(PCAalgorithm="character")) # Create an instance obj <- new("MyClass", PCAalgorithm="123") # Call the generic (assuming a method is implemented) # PCAalgorithm(obj)
A function for getting the PCAalgorithm slot in a
RAIDSparam class.
## S4 method for signature 'RAIDSparam' PCAalgorithm(x)## S4 method for signature 'RAIDSparam' PCAalgorithm(x)
x |
a |
a character string representing the algorithm to use
with the snpgdsPCA function.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the PCAalgorithm slot for the object PCAalgorithm(paramDemo)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the PCAalgorithm slot for the object PCAalgorithm(paramDemo)
A generic function for replacement of PCAalgorithm slot in a S4 object.
PCAalgorithm(x) <- valuePCAalgorithm(x) <- value
x |
a S4 object. |
value |
the new value to assign or update. |
the modified S4 object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(PCAalgorithm="character")) # Create an instance obj <- new("MyClass", PCAalgorithm="123") # Call the generic (assuming a method is implemented) # PCAalgorithm(obj) <- "333"# Define a dummy class to show usage setClass("MyClass", slots = list(PCAalgorithm="character")) # Create an instance obj <- new("MyClass", PCAalgorithm="123") # Call the generic (assuming a method is implemented) # PCAalgorithm(obj) <- "333"
A function for replacement of PCAalgorithm slot in a
RAIDSparam class.
## S4 replacement method for signature 'RAIDSparam' PCAalgorithm(x) <- value## S4 replacement method for signature 'RAIDSparam' PCAalgorithm(x) <- value
x |
a |
value |
a |
the modified RAIDSparam object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign new value to the PCAalgorithm slot in the object PCAalgorithm(paramDemo) <- "randomized"## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign new value to the PCAalgorithm slot in the object PCAalgorithm(paramDemo) <- "randomized"
A generic function for getting the pcaList slot in a S4 object.
pcaList(x)pcaList(x)
x |
a S4 object. |
a value from the pcaList slot in the S4 object.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(pcaList="character")) # Create an instance obj <- new("MyClass", pcaList="123") # Call the generic (assuming a method is implemented) # pcaList(obj)# Define a dummy class to show usage setClass("MyClass", slots = list(pcaList="character")) # Create an instance obj <- new("MyClass", pcaList="123") # Call the generic (assuming a method is implemented) # pcaList(obj)
A function for getting the pcaList slot in a
RAIDSparam class.
## S4 method for signature 'RAIDSparam' pcaList(x)## S4 method for signature 'RAIDSparam' pcaList(x)
x |
a |
a vector of positive integer representing the values
tested for the D parameter. The D parameter represents the
number of dimensions used in the PCA analysis.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the pcaList slot for the object pcaList(paramDemo)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the pcaList slot for the object pcaList(paramDemo)
A generic function for replacement of pcaList slot in a S4 object.
pcaList(x) <- valuepcaList(x) <- value
x |
a S4 object. |
value |
the new value to assign or update. |
the modified S4 object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(pcaList="character")) # Create an instance obj <- new("MyClass", pcaList="123") # Call the generic (assuming a method is implemented) # pcaList(obj) <- "333"# Define a dummy class to show usage setClass("MyClass", slots = list(pcaList="character")) # Create an instance obj <- new("MyClass", pcaList="123") # Call the generic (assuming a method is implemented) # pcaList(obj) <- "333"
A function for replacement of pcaList slot in a
RAIDSparam class.
## S4 replacement method for signature 'RAIDSparam' pcaList(x) <- value## S4 replacement method for signature 'RAIDSparam' pcaList(x) <- value
x |
a |
value |
a |
the modified RAIDSparam object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign new value to the pcaList slot in the object pcaList(paramDemo) <- c(2L, 3L, 4L, 5L)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign new value to the pcaList slot in the object pcaList(paramDemo) <- c(2L, 3L, 4L, 5L)
A generic function for getting the PCAmissingRate slot in a S4 object.
PCAmissingRate(x)PCAmissingRate(x)
x |
a S4 object. |
a value from the PCAmissingRate slot in the S4 object.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(PCAmissingRate="character")) # Create an instance obj <- new("MyClass", PCAmissingRate="123") # Call the generic (assuming a method is implemented) # PCAmissingRate(obj)# Define a dummy class to show usage setClass("MyClass", slots = list(PCAmissingRate="character")) # Create an instance obj <- new("MyClass", PCAmissingRate="123") # Call the generic (assuming a method is implemented) # PCAmissingRate(obj)
A function for getting the PCAmissingRate slot in a
RAIDSparam class.
## S4 method for signature 'RAIDSparam' PCAmissingRate(x)## S4 method for signature 'RAIDSparam' PCAmissingRate(x)
x |
a |
a positive numeric representing the maximum missing rate
accepted to use SNPs in the PCA analysis done with the
snpgdsPCA function. If NaN, no missing threshold.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the PCAmissingRate slot for the object PCAmissingRate(paramDemo)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the PCAmissingRate slot for the object PCAmissingRate(paramDemo)
A generic function for replacement of PCAmissingRate slot in a S4 object.
PCAmissingRate(x) <- valuePCAmissingRate(x) <- value
x |
a S4 object. |
value |
the new value to assign or update. |
the modified S4 object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(PCAmissingRate="character")) # Create an instance obj <- new("MyClass", PCAmissingRate="123") # Call the generic (assuming a method is implemented) # PCAmissingRate(obj) <- "333"# Define a dummy class to show usage setClass("MyClass", slots = list(PCAmissingRate="character")) # Create an instance obj <- new("MyClass", PCAmissingRate="123") # Call the generic (assuming a method is implemented) # PCAmissingRate(obj) <- "333"
A function for replacement of PCAmissingRate slot in a
RAIDSparam class.
## S4 replacement method for signature 'RAIDSparam' PCAmissingRate(x) <- value## S4 replacement method for signature 'RAIDSparam' PCAmissingRate(x) <- value
x |
a |
value |
a positive |
the modified RAIDSparam object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign new value to the PCAmissingRate slot in the object PCAmissingRate(paramDemo) <- 0.03322## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign new value to the PCAmissingRate slot in the object PCAmissingRate(paramDemo) <- 0.03322
A generic function for getting the pedStudy slot in a S4 object.
pedStudy(x)pedStudy(x)
x |
a S4 object. |
a value from the pedStudy slot in the S4 object.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(studyDF="character")) # Create an instance obj <- new("MyClass", studyDF="123") # Call the generic (assuming a method is implemented) # studyDF(obj)# Define a dummy class to show usage setClass("MyClass", slots = list(studyDF="character")) # Create an instance obj <- new("MyClass", studyDF="123") # Call the generic (assuming a method is implemented) # studyDF(obj)
A function for getting the pedStudy slot in a
RAIDSparam class.
## S4 method for signature 'RAIDSparam' pedStudy(x)## S4 method for signature 'RAIDSparam' pedStudy(x)
x |
a |
a data.frame.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the pedStudy slot for the object pedStudy(paramDemo)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the pedStudy slot for the object pedStudy(paramDemo)
A generic function for replacement of pedStudy slot in a S4 object.
pedStudy(x) <- valuepedStudy(x) <- value
x |
a S4 object. |
value |
the new value to assign or update. |
the modified S4 object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(pedStudy="character")) # Create an instance obj <- new("MyClass", pedStudy="123") # Call the generic (assuming a method is implemented) # pedStudy(obj) <- "333"# Define a dummy class to show usage setClass("MyClass", slots = list(pedStudy="character")) # Create an instance obj <- new("MyClass", pedStudy="123") # Call the generic (assuming a method is implemented) # pedStudy(obj) <- "333"
A function for replacement of pedStudy slot in a
RAIDSparam class.
## S4 replacement method for signature 'RAIDSparam' pedStudy(x) <- value## S4 replacement method for signature 'RAIDSparam' pedStudy(x) <- value
x |
a |
value |
a |
the modified RAIDSparam object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Demo PED study pedStudy <- data.frame(Name.ID=c("TEST11", "Test12"), Case.ID=c("Case1", "Case2"), Sample.Type=c("Cancer", "Cancer"), Diagnosis=c("sarcoma", "sarcoma"), Source=c("CSHL", "CSHL"), stringsAsFactors=FALSE, row.names=c("TEST11", "Test12")) ## Assign the new PED study to the pedStudy slot in the object pedStudy(paramDemo) <- pedStudy## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Demo PED study pedStudy <- data.frame(Name.ID=c("TEST11", "Test12"), Case.ID=c("Case1", "Case2"), Sample.Type=c("Cancer", "Cancer"), Diagnosis=c("sarcoma", "sarcoma"), Source=c("CSHL", "CSHL"), stringsAsFactors=FALSE, row.names=c("TEST11", "Test12")) ## Assign the new PED study to the pedStudy slot in the object pedStudy(paramDemo) <- pedStudy
data.frame containing the information related to
synthetic profiles. The ancestry of the profiles used to generate the
synthetic profiles must be present.The object is a data.frame with 7 columns. The row names of
the data.frame must be the profile unique identifiers.
data(pedSynthetic)data(pedSynthetic)
The data.frame containing the information about the
synthetic profiles. The row names of
the data.frame correspond to the profile unique identifiers.
The data.frame contains 7 columns:
data.id a character string representing the unique
synthetic profile identifier.
case.id a character string representing the unique
profile identifier that was used to generate the synthetic profile.
sample.type a character string representing the type
of profile.
diagnosis a character string representing the
diagnosis of profile that was used to generate the synthetic profile.
source a character string representing the
source of the synthetic profile.
study.id a character string representing the
name of the study to which the synthetic profile is associated.
superPop a character string representing the
super population of the profile that was used to generate the synthetic
profile.
This dataset can be
used to test the computeSyntheticROC function.
The data.frame containing the information about the
synthetic profiles. The row names of
the data.frame correspond to the profile unique identifiers.
The data.frame contains 7 columns:
data.id a character string representing the unique
synthetic profile identifier.
case.id a character string representing the unique
profile identifier that was used to generate the synthetic profile.
sample.type a character string representing the type
of profile.
diagnosis a character string representing the
diagnosis of profile that was used to generate the synthetic profile.
source a character string representing the
source of the synthetic profile.
study.id a character string representing the
name of the study to which the synthetic profile is associated.
superPop a character string representing the
super population of the profile that was used to generate the synthetic
profile.
computeSyntheticROCfor calculating the AUROC of the inferences for specific values of D and K using the inferred ancestry results from the synthetic profiles
## Loading demo dataset containing pedigree information for synthetic ## profiles data(pedSynthetic) ## Loading demo dataset containing the inferred ancestry results ## for the synthetic data data(matKNNSynthetic) ## Retain one K and one D value matKNN <- matKNNSynthetic[matKNNSynthetic$D == 5 & matKNNSynthetic$K == 4, ] ## Compile statistics from the ## synthetic profiles for fixed values of D and K results <- RAIDS:::computeSyntheticROC(matKNN=matKNN, matKNNAncestryColumn="SuperPop", pedCall=pedSynthetic, pedCallAncestryColumn="superPop", listCall=c("EAS", "EUR", "AFR", "AMR", "SAS")) results$matAUROC.All results$matAUROC.Call results$listROC.Call## Loading demo dataset containing pedigree information for synthetic ## profiles data(pedSynthetic) ## Loading demo dataset containing the inferred ancestry results ## for the synthetic data data(matKNNSynthetic) ## Retain one K and one D value matKNN <- matKNNSynthetic[matKNNSynthetic$D == 5 & matKNNSynthetic$K == 4, ] ## Compile statistics from the ## synthetic profiles for fixed values of D and K results <- RAIDS:::computeSyntheticROC(matKNN=matKNN, matKNNAncestryColumn="SuperPop", pedCall=pedSynthetic, pedCallAncestryColumn="superPop", listCall=c("EAS", "EUR", "AFR", "AMR", "SAS")) results$matAUROC.All results$matAUROC.Call results$listROC.Call
A generic function for getting the phase slot in a S4 object.
phase(x)phase(x)
x |
a S4 object. |
a value from the phase slot in the S4 object.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(phase="character")) # Create an instance obj <- new("MyClass", phase="123") # Call the generic (assuming a method is implemented) # phase(obj)# Define a dummy class to show usage setClass("MyClass", slots = list(phase="character")) # Create an instance obj <- new("MyClass", phase="123") # Call the generic (assuming a method is implemented) # phase(obj)
A function for getting the phase slot in a
RAIDSparam class.
## S4 method for signature 'RAIDSparam' phase(x)## S4 method for signature 'RAIDSparam' phase(x)
x |
a |
a single logical TODO
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the phase slot for the object phase(paramDemo)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the phase slot for the object phase(paramDemo)
A generic function for replacement of phase slot in a S4 object.
phase(x) <- valuephase(x) <- value
x |
a S4 object. |
value |
the new value to assign or update. |
the modified S4 object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(phase="character")) # Create an instance obj <- new("MyClass", phase="123") # Call the generic (assuming a method is implemented) # phase(obj) <- "333"# Define a dummy class to show usage setClass("MyClass", slots = list(phase="character")) # Create an instance obj <- new("MyClass", phase="123") # Call the generic (assuming a method is implemented) # phase(obj) <- "333"
A function for replacement of phase slot in a
RAIDSparam class.
## S4 replacement method for signature 'RAIDSparam' phase(x) <- value## S4 replacement method for signature 'RAIDSparam' phase(x) <- value
x |
a |
value |
a single |
the modified RAIDSparam object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign new value to the phase slot in the object phase(paramDemo) <- TRUE## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign new value to the phase slot in the object phase(paramDemo) <- TRUE
A generic function for getting the phaseType slot in a S4 object.
phaseType(x)phaseType(x)
x |
a S4 object. |
a value from the phaseType slot in the S4 object.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(phaseType="character")) # Create an instance obj <- new("MyClass", phaseType="123") # Call the generic (assuming a method is implemented) # phaseType(obj)# Define a dummy class to show usage setClass("MyClass", slots = list(phaseType="character")) # Create an instance obj <- new("MyClass", phaseType="123") # Call the generic (assuming a method is implemented) # phaseType(obj)
A function for getting the phaseType slot in a
RAIDSparam class.
## S4 method for signature 'RAIDSparam' phaseType(x)## S4 method for signature 'RAIDSparam' phaseType(x)
x |
a |
a single character string TODO
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the phaseType slot for the object phaseType(paramDemo)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the phaseType slot for the object phaseType(paramDemo)
A generic function for replacement of phaseType slot in a S4 object.
phaseType(x) <- valuephaseType(x) <- value
x |
a S4 object. |
value |
the new value to assign or update. |
the modified S4 object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(phaseType="character")) # Create an instance obj <- new("MyClass", phaseType="123") # Call the generic (assuming a method is implemented) # phaseType(obj) <- "333"# Define a dummy class to show usage setClass("MyClass", slots = list(phaseType="character")) # Create an instance obj <- new("MyClass", phaseType="123") # Call the generic (assuming a method is implemented) # phaseType(obj) <- "333"
A function for replacement of phaseType slot in a
RAIDSparam class.
## S4 replacement method for signature 'RAIDSparam' phaseType(x) <- value## S4 replacement method for signature 'RAIDSparam' phaseType(x) <- value
x |
a |
value |
a single |
the modified RAIDSparam object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign new value to the phaseType slot in the object phaseType(paramDemo) <- "test"## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign new value to the phaseType slot in the object phaseType(paramDemo) <- "test"
A generic function for getting the offposOffsetset slot in a S4 object.
posOffset(x)posOffset(x)
x |
a S4 object. |
a value from the posOffset slot in the S4 object.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(posOffset="character")) # Create an instance obj <- new("MyClass", posOffset="123") # Call the generic (assuming a method is implemented) # posOffset(obj)# Define a dummy class to show usage setClass("MyClass", slots = list(posOffset="character")) # Create an instance obj <- new("MyClass", posOffset="123") # Call the generic (assuming a method is implemented) # posOffset(obj)
A function for getting the posOffset slot in a
RAIDSparam class.
## S4 method for signature 'RAIDSparam' posOffset(x)## S4 method for signature 'RAIDSparam' posOffset(x)
x |
a |
a single integer that is added to the SNP position to
switch from 0-based to 1-based coordinate when needed (or reverse).
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the posOffset slot for the object posOffset(paramDemo)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the posOffset slot for the object posOffset(paramDemo)
A generic function for replacement of posOffset slot in a S4 object.
posOffset(x) <- valueposOffset(x) <- value
x |
a S4 object. |
value |
the new value to assign or update. |
the modified S4 object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(posOffset="character")) # Create an instance obj <- new("MyClass", posOffset="123") # Call the generic (assuming a method is implemented) # posOffset(obj) <- "333"# Define a dummy class to show usage setClass("MyClass", slots = list(posOffset="character")) # Create an instance obj <- new("MyClass", posOffset="123") # Call the generic (assuming a method is implemented) # posOffset(obj) <- "333"
A function for replacement of posOffset slot in a
RAIDSparam class.
## S4 replacement method for signature 'RAIDSparam' posOffset(x) <- value## S4 replacement method for signature 'RAIDSparam' posOffset(x) <- value
x |
a |
value |
a single |
the modified RAIDSparam object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign a new value to the posOffset slot in the object posOffset(paramDemo) <- 0L## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign a new value to the posOffset slot in the object posOffset(paramDemo) <- 0L
A generic function for getting the pRecomb slot in a S4 object.
pRecomb(x)pRecomb(x)
x |
a S4 object. |
a value from the pRecomb slot in the S4 object.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(pRecomb="character")) # Create an instance obj <- new("MyClass", pRecomb="123") # Call the generic (assuming a method is implemented) # pRecomb(obj)# Define a dummy class to show usage setClass("MyClass", slots = list(pRecomb="character")) # Create an instance obj <- new("MyClass", pRecomb="123") # Call the generic (assuming a method is implemented) # pRecomb(obj)
A function for getting the pRecomb slot in a
RAIDSparam class.
## S4 method for signature 'RAIDSparam' pRecomb(x)## S4 method for signature 'RAIDSparam' pRecomb(x)
x |
a |
a single positive numeric between 0 and 1
that represents the frequency of phase switching in the synthetic profiles.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the pRecomb slot for the object pRecomb(paramDemo)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the pRecomb slot for the object pRecomb(paramDemo)
A generic function for replacement of pRecomb slot in a S4 object.
pRecomb(x) <- valuepRecomb(x) <- value
x |
a S4 object. |
value |
the new value to assign or update. |
the modified S4 object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(pRecomb="character")) # Create an instance obj <- new("MyClass", pRecomb="123") # Call the generic (assuming a method is implemented) # pRecomb(obj) <- "333"# Define a dummy class to show usage setClass("MyClass", slots = list(pRecomb="character")) # Create an instance obj <- new("MyClass", pRecomb="123") # Call the generic (assuming a method is implemented) # pRecomb(obj) <- "333"
A function for replacement of pRecomb slot in a
RAIDSparam class.
## S4 replacement method for signature 'RAIDSparam' pRecomb(x) <- value## S4 replacement method for signature 'RAIDSparam' pRecomb(x) <- value
x |
a |
value |
a single positive |
the modified RAIDSparam object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign a new value to the pRecomb slot in the object pRecomb(paramDemo) <- 0.03## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign a new value to the pRecomb slot in the object pRecomb(paramDemo) <- 0.03
A generic function for getting the prefix slot in a S4 object.
prefix(x)prefix(x)
x |
a S4 object. |
a value from the prefix slot in the S4 object.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(prefix="character")) # Create an instance obj <- new("MyClass", prefix="123") # Call the generic (assuming a method is implemented) # prefix(obj)# Define a dummy class to show usage setClass("MyClass", slots = list(prefix="character")) # Create an instance obj <- new("MyClass", prefix="123") # Call the generic (assuming a method is implemented) # prefix(obj)
A function for getting the prefix slot in a
RAIDSparam class.
A function for getting the prefix slot in a
RAIDSparam class.
A function for getting the prefix slot in a
RAIDSparam class.
## S4 method for signature 'RAIDSparam' prefix(x) ## S4 method for signature 'RAIDSparam' prefix(x) ## S4 method for signature 'RAIDSparam' prefix(x)## S4 method for signature 'RAIDSparam' prefix(x) ## S4 method for signature 'RAIDSparam' prefix(x) ## S4 method for signature 'RAIDSparam' prefix(x)
x |
a |
a single character string representing TODO.
a single character string representing TODO.
a single character string representing TODO.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the prefix slot for the object prefix(paramDemo) ## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the prefix slot for the object prefix(paramDemo) ## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the prefix slot for the object prefix(paramDemo)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the prefix slot for the object prefix(paramDemo) ## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the prefix slot for the object prefix(paramDemo) ## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the prefix slot for the object prefix(paramDemo)
A generic function for replacement of prefix slot in a S4 object.
prefix(x) <- valueprefix(x) <- value
x |
a S4 object. |
value |
the new value to assign or update. |
the modified S4 object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(prefix="character")) # Create an instance obj <- new("MyClass", prefix="123") # Call the generic (assuming a method is implemented) # prefix(obj) <- "333"# Define a dummy class to show usage setClass("MyClass", slots = list(prefix="character")) # Create an instance obj <- new("MyClass", prefix="123") # Call the generic (assuming a method is implemented) # prefix(obj) <- "333"
A function for replacement of prefix slot in a
RAIDSparam class.
## S4 replacement method for signature 'RAIDSparam' prefix(x) <- value## S4 replacement method for signature 'RAIDSparam' prefix(x) <- value
x |
a |
value |
a single |
the modified RAIDSparam object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign a new value to the prefix slot in the object prefix(paramDemo) <- "test"## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign a new value to the prefix slot in the object prefix(paramDemo) <- "test"
Using the pedigree file from Reference, this function extracts
needed information and formats it into a data.frame so in can
be used in following steps of the ancestry inference process. The
function also requires that the genotyping files associated to each
sample be available in a specified directory.
prepPed1KG(filePed, pathGeno = file.path("data", "sampleGeno"), batch = 0L)prepPed1KG(filePed, pathGeno = file.path("data", "sampleGeno"), batch = 0L)
filePed |
a |
pathGeno |
a |
batch |
a |
a data.frame containing the needed pedigree information
from Reference. The data.frame contains those columns:
a character string representing the profile unique
ID.
a character string representing the profile name.
a character string representing the sex of the profile.
a character string representing the
sub-continental ancestry of the profile.
a character string representing the continental
ancestry of the profile.
a integer representing the batch of the profile.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Path to the demo pedigree file is located in this package dataDir <- system.file("extdata", package="RAIDS") ## Path where the demo genotype CSV files are located pathGeno <- file.path(dataDir, "demoProfileGenotypes") ## Demo pedigree file pedDemoFile <- file.path(dataDir, "PedigreeDemo.ped") ## Create a data.frame containing the information of the retained ## samples (samples with existing genotyping files) prepPed1KG(filePed=pedDemoFile, pathGeno=pathGeno, batch=0L)## Path to the demo pedigree file is located in this package dataDir <- system.file("extdata", package="RAIDS") ## Path where the demo genotype CSV files are located pathGeno <- file.path(dataDir, "demoProfileGenotypes") ## Demo pedigree file pedDemoFile <- file.path(dataDir, "PedigreeDemo.ped") ## Create a data.frame containing the information of the retained ## samples (samples with existing genotyping files) prepPed1KG(filePed=pedDemoFile, pathGeno=pathGeno, batch=0L)
The 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)prepPedSyntheticRef(pRAIDS)
pRAIDS |
a |
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.
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.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## 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)## 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)
This function write with P-matrix
prepPMatrix(anchor, snpId, matGr = NULL, pRAIDS)prepPMatrix(anchor, snpId, matGr = NULL, pRAIDS)
anchor |
a |
snpId |
a |
matGr |
a |
pRAIDS |
a |
a list containing one entry per ancestral group:
ancestral group a list contenains 2 entries:
f a list contenains number of rows in
matGr + 1 entries:
vectorthe first is frequency for all the anchor of each snpId
vectorthe other is frequency for all the anchor minus one row of matGr of each snpId
index a vector contenains 2 entriescontenains
number of rows in matGr entries. Each value is the index of the row
for which the f of this index corresponds.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Required library library(SNPRelate) data(demoKnownSuperPop1KG) ## 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") matGr <- getMatrixPopSynthetic(pRAIDS=pRAIDS) fileGDSProfile <- file.path(pathProfileGDS(pRAIDS), paste0(pedStudy(pRAIDS)$Name.ID[1], ".gds")) gdsProfile <- snpgdsOpen(fileGDSProfile) pruned <- read.gdsn(index.gdsn(gdsProfile, "pruned.study")) snpgdsClose(gdsProfile) gdsReference <- snpgdsOpen(fileReferenceGDS(pRAIDS)) admixDesc <- read.gdsn(index.gdsn(gdsReference, "admixture.desc")) pos <- admixDesc[admixDesc$id == anchorId(pRAIDS), "id.seq"] anchor <- read.gdsn(index.gdsn(gdsReference, "anchor.ref"), start=c(1, pos), count=c(-1,1)) snpgdsClose(gdsReference) rowF <- prepPMatrix( anchor=anchor, snpId = pruned, matGr=matGr, pRAIDS=pRAIDS) names(rowF)## Required library library(SNPRelate) data(demoKnownSuperPop1KG) ## 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") matGr <- getMatrixPopSynthetic(pRAIDS=pRAIDS) fileGDSProfile <- file.path(pathProfileGDS(pRAIDS), paste0(pedStudy(pRAIDS)$Name.ID[1], ".gds")) gdsProfile <- snpgdsOpen(fileGDSProfile) pruned <- read.gdsn(index.gdsn(gdsProfile, "pruned.study")) snpgdsClose(gdsProfile) gdsReference <- snpgdsOpen(fileReferenceGDS(pRAIDS)) admixDesc <- read.gdsn(index.gdsn(gdsReference, "admixture.desc")) pos <- admixDesc[admixDesc$id == anchorId(pRAIDS), "id.seq"] anchor <- read.gdsn(index.gdsn(gdsReference, "anchor.ref"), start=c(1, pos), count=c(-1,1)) snpgdsClose(gdsReference) rowF <- prepPMatrix( anchor=anchor, snpId = pruned, matGr=matGr, pRAIDS=pRAIDS) names(rowF)
This function add entries related to synthetic profiles into a Profile GDS file. The entries are related to two types of information: the synthetic study and the synthetic profiles.
The study information is appended to the Profile GDS file "study.list" node. The "study.platform" entry is always set to 'Synthetic'.
The profile information, for all selected synthetic profiles, is appended to the Profile GDS file "study.annot" node. Both the "Source" and the "Sample.Type" entries are always set to 'Synthetic'.
The synthetic profiles are assigned unique names by combining:
prefix.data.id.profile.listSampleRef.simulation
number(1 to nbSim)
prepSynthetic( fileProfileGDS, listSampleRef, profileID, studyDF, nbSim = 1L, prefix = "", verbose = FALSE )prepSynthetic( fileProfileGDS, listSampleRef, profileID, studyDF, nbSim = 1L, prefix = "", verbose = FALSE )
fileProfileGDS |
a |
listSampleRef |
a |
profileID |
a |
studyDF |
a |
nbSim |
a single positive |
prefix |
a single |
verbose |
a |
0L when successful.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Required library library(gdsfmt) ## Path to the demo 1KG GDS file is located in this package dataDir <- system.file("extdata/tests", package="RAIDS") ## Temporary Profile GDS file fileNameGDS <- file.path(tempdir(), "ex1.gds") ## Copy the Profile GDS file demo that has been pruned and annotated file.copy(file.path(dataDir, "ex1_demo_with_pruning_and_1KG_annot.gds"), fileNameGDS) ## Information about the synthetic data set syntheticStudyDF <- data.frame(study.id="MYDATA.Synthetic", study.desc="MYDATA synthetic data", study.platform="PLATFORM", stringsAsFactors=FALSE) ## Add information related to the synthetic profiles into the Profile GDS prepSynthetic(fileProfileGDS=fileNameGDS, listSampleRef=c("HG00243", "HG00150"), profileID="ex1", studyDF=syntheticStudyDF, nbSim=1L, prefix="synthetic", verbose=FALSE) ## Open Profile GDS file profileGDS <- openfn.gds(fileNameGDS) ## The synthetic profiles should be added in the 'study.annot' entry tail(read.gdsn(index.gdsn(profileGDS, "study.annot"))) ## The synthetic study information should be added to ## the 'study.list' entry tail(read.gdsn(index.gdsn(profileGDS, "study.list"))) ## Close GDS file (important) closefn.gds(profileGDS) ## Remove Profile GDS file (created for demo purpose) unlink(fileNameGDS, force=TRUE)## Required library library(gdsfmt) ## Path to the demo 1KG GDS file is located in this package dataDir <- system.file("extdata/tests", package="RAIDS") ## Temporary Profile GDS file fileNameGDS <- file.path(tempdir(), "ex1.gds") ## Copy the Profile GDS file demo that has been pruned and annotated file.copy(file.path(dataDir, "ex1_demo_with_pruning_and_1KG_annot.gds"), fileNameGDS) ## Information about the synthetic data set syntheticStudyDF <- data.frame(study.id="MYDATA.Synthetic", study.desc="MYDATA synthetic data", study.platform="PLATFORM", stringsAsFactors=FALSE) ## Add information related to the synthetic profiles into the Profile GDS prepSynthetic(fileProfileGDS=fileNameGDS, listSampleRef=c("HG00243", "HG00150"), profileID="ex1", studyDF=syntheticStudyDF, nbSim=1L, prefix="synthetic", verbose=FALSE) ## Open Profile GDS file profileGDS <- openfn.gds(fileNameGDS) ## The synthetic profiles should be added in the 'study.annot' entry tail(read.gdsn(index.gdsn(profileGDS, "study.annot"))) ## The synthetic study information should be added to ## the 'study.list' entry tail(read.gdsn(index.gdsn(profileGDS, "study.list"))) ## Close GDS file (important) closefn.gds(profileGDS) ## Remove Profile GDS file (created for demo purpose) unlink(fileNameGDS, force=TRUE)
A generic function for getting the profileFile slot in a S4 object.
profileFile(x)profileFile(x)
x |
a S4 object. |
a value from the profileFile slot in the S4 object.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(profileFile="character")) # Create an instance obj <- new("MyClass", profileFile="123") # Call the generic (assuming a method is implemented) # profileFile(obj)# Define a dummy class to show usage setClass("MyClass", slots = list(profileFile="character")) # Create an instance obj <- new("MyClass", profileFile="123") # Call the generic (assuming a method is implemented) # profileFile(obj)
A function for getting the profileFile slot in a
RAIDSparam class.
## S4 method for signature 'RAIDSparam' profileFile(x)## S4 method for signature 'RAIDSparam' profileFile(x)
x |
a |
NULL or a character string representing the path to
the file with genotype and the allele information of the profile.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the profileFile slot for the object profileFile(paramDemo)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the profileFile slot for the object profileFile(paramDemo)
A generic function for replacement of profileFile slot in a S4 object.
profileFile(x) <- valueprofileFile(x) <- value
x |
a S4 object. |
value |
the new value to assign or update. |
the modified S4 object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(profileFile="character")) # Create an instance obj <- new("MyClass", profileFile="123") # Call the generic (assuming a method is implemented) # profileFile(obj) <- "333"# Define a dummy class to show usage setClass("MyClass", slots = list(profileFile="character")) # Create an instance obj <- new("MyClass", profileFile="123") # Call the generic (assuming a method is implemented) # profileFile(obj) <- "333"
A function for replacement of profileFile slot in a
RAIDSparam class.
## S4 replacement method for signature 'RAIDSparam' profileFile(x) <- value## S4 replacement method for signature 'RAIDSparam' profileFile(x) <- value
x |
a |
value |
|
the modified RAIDSparam object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Directory where demo GDS files are located dataDir <- system.file("extdata", package="RAIDS") ## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Adjust the genoSource slot to the updated format file genoSource(paramDemo) <- "generic" ## Assign the existing profile file to the profileFile slot in the object profileFile(paramDemo) <- file.path(dataDir, "tests/ex1.txt.gz")## Directory where demo GDS files are located dataDir <- system.file("extdata", package="RAIDS") ## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Adjust the genoSource slot to the updated format file genoSource(paramDemo) <- "generic" ## Assign the existing profile file to the profileFile slot in the object profileFile(paramDemo) <- file.path(dataDir, "tests/ex1.txt.gz")
First, the function creates the Profile GDS file for the specific profile using the information from a RDS Sample description file and the Population Reference GDS file.
profileGenoSynthesis(pRAIDS)profileGenoSynthesis(pRAIDS)
pRAIDS |
a |
The integer OL when the function is successful.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Path to the demo 1KG GDS file is located in this package dataDir <- system.file("extdata", package="RAIDS") ################################################################# ## The 1KG GDS file and the 1KG SNV Annotation GDS file ## need to be located in the same directory ## Note that the 1KG GDS file used for this example is a ## simplified version and CANNOT be used for any real analysis ################################################################# path1KG <- file.path(dataDir, "tests") fileReferenceGDS <- file.path(path1KG, "ex1_good_small_1KG.gds") fileAnnotGDS <- file.path(path1KG, "ex1_good_small_1KG_Annot.gds") ################################################################# ## The Sample SNP pileup files (one per sample) need ## to be located in the same directory. ################################################################# demoProfileEx1 <- file.path(dataDir, "example", "snpPileup", "ex1.txt.gz") ################################################################# ## The path where the Profile GDS Files (one per sample) ## will be created need to be specified. ################################################################# pathProfileGDS <- file.path(tempdir(), "out.tmp") if(!dir.exists(pathProfileGDS)){ dir.create(pathProfileGDS) } #################################################################### ## Fix seed to ensure reproducible results #################################################################### set.seed(3043) pRAIDS <- RAIDSparam(profileFile=demoProfileEx1, genoSource="snp-pileup", pathProfileGDS=pathProfileGDS, fileReferenceGDS=fileReferenceGDS, fileReferenceAnnotGDS=fileAnnotGDS ) pRAIDS <- profileGenoSynthesis(pRAIDS=pRAIDS) unlink(file.path(pathProfileGDS, paste0(pedStudy(pRAIDS)$Name.ID[1], ".gds")) , force=TRUE) if (length(dir(pathProfileGDS)) == 0) { unlink(pathProfileGDS, recursive = TRUE) }## Path to the demo 1KG GDS file is located in this package dataDir <- system.file("extdata", package="RAIDS") ################################################################# ## The 1KG GDS file and the 1KG SNV Annotation GDS file ## need to be located in the same directory ## Note that the 1KG GDS file used for this example is a ## simplified version and CANNOT be used for any real analysis ################################################################# path1KG <- file.path(dataDir, "tests") fileReferenceGDS <- file.path(path1KG, "ex1_good_small_1KG.gds") fileAnnotGDS <- file.path(path1KG, "ex1_good_small_1KG_Annot.gds") ################################################################# ## The Sample SNP pileup files (one per sample) need ## to be located in the same directory. ################################################################# demoProfileEx1 <- file.path(dataDir, "example", "snpPileup", "ex1.txt.gz") ################################################################# ## The path where the Profile GDS Files (one per sample) ## will be created need to be specified. ################################################################# pathProfileGDS <- file.path(tempdir(), "out.tmp") if(!dir.exists(pathProfileGDS)){ dir.create(pathProfileGDS) } #################################################################### ## Fix seed to ensure reproducible results #################################################################### set.seed(3043) pRAIDS <- RAIDSparam(profileFile=demoProfileEx1, genoSource="snp-pileup", pathProfileGDS=pathProfileGDS, fileReferenceGDS=fileReferenceGDS, fileReferenceAnnotGDS=fileAnnotGDS ) pRAIDS <- profileGenoSynthesis(pRAIDS=pRAIDS) unlink(file.path(pathProfileGDS, paste0(pedStudy(pRAIDS)$Name.ID[1], ".gds")) , force=TRUE) if (length(dir(pathProfileGDS)) == 0) { unlink(pathProfileGDS, recursive = TRUE) }
A generic function for getting the pruningMethod slot in a S4 object.
pruningMethod(x)pruningMethod(x)
x |
a S4 object. |
a value from the pruningMethod slot in the S4 object.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(pruningMethod="character")) # Create an instance obj <- new("MyClass", pruningMethod="123") # Call the generic (assuming a method is implemented) # pruningMethod(obj)# Define a dummy class to show usage setClass("MyClass", slots = list(pruningMethod="character")) # Create an instance obj <- new("MyClass", pruningMethod="123") # Call the generic (assuming a method is implemented) # pruningMethod(obj)
A function for getting the pruningMethod slot in a
RAIDSparam class.
A function for getting the pruningMethod slot in a
RAIDSparam class.
## S4 method for signature 'RAIDSparam' pruningMethod(x) ## S4 method for signature 'RAIDSparam' pruningMethod(x)## S4 method for signature 'RAIDSparam' pruningMethod(x) ## S4 method for signature 'RAIDSparam' pruningMethod(x)
x |
a |
a single character string representing the method that
will be used to calculate the linkage disequilibrium in the
snpgdsLDpruning() function.
a single character string representing the method that
will be used to calculate the linkage disequilibrium in the
snpgdsLDpruning() function.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the pruningMethod slot for the object pruningMethod(paramDemo) ## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the pruningMethod slot for the object pruningMethod(paramDemo)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the pruningMethod slot for the object pruningMethod(paramDemo) ## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the pruningMethod slot for the object pruningMethod(paramDemo)
A generic function for replacement of pruningMethod slot in a S4 object.
pruningMethod(x) <- valuepruningMethod(x) <- value
x |
a S4 object. |
value |
the new value to assign or update. |
the modified S4 object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(pruningMethod="character")) # Create an instance obj <- new("MyClass", pruningMethod="123") # Call the generic (assuming a method is implemented) # pruningMethod(obj) <- "333"# Define a dummy class to show usage setClass("MyClass", slots = list(pruningMethod="character")) # Create an instance obj <- new("MyClass", pruningMethod="123") # Call the generic (assuming a method is implemented) # pruningMethod(obj) <- "333"
A function for replacement of pruningMethod slot in a
RAIDSparam class.
## S4 replacement method for signature 'RAIDSparam' pruningMethod(x) <- value## S4 replacement method for signature 'RAIDSparam' pruningMethod(x) <- value
x |
a |
value |
a single |
the modified RAIDSparam object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign new value to the pruningMethod slot in the object pruningMethod(paramDemo) <- "r"## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign new value to the pruningMethod slot in the object pruningMethod(paramDemo) <- "r"
This function computes the list of pruned SNVs for a
specific profile. When
a group of SNVs are in linkage disequilibrium, only one SNV from that group
is retained. The linkage disequilibrium is calculated with the
snpgdsLDpruning() function. The initial list of
SNVs that are passed to the snpgdsLDpruning()
function can be specified by the user.
pruningProfile2(pRAIDS)pruningProfile2(pRAIDS)
pRAIDS |
a |
The function returns a RAIDSparam an object with all the RAIDS
parameters updated.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Path to the demo Reference GDS file is located in this package dataDir <- system.file("extdata/tests", package="RAIDS") fileGDS <- file.path(dataDir, "ex1_good_small_1KG.gds") ## The data.frame containing the information about the study ## The 3 mandatory columns: "study.id", "study.desc", "study.platform" ## The entries should be strings, not factors (stringsAsFactors=FALSE) studyDF <- data.frame(study.id = "MYDATA", study.desc = "Description", study.platform = "PLATFORM", stringsAsFactors = FALSE) ## The data.frame containing the information about the samples ## The entries should be strings, not factors (stringsAsFactors=FALSE) samplePED <- data.frame(Name.ID = c("ex1", "ex2"), Case.ID = c("Patient_h11", "Patient_h12"), Diagnosis = rep("Cancer", 2), Sample.Type = rep("Primary Tumor", 2), Source = rep("Databank B", 2), stringsAsFactors = FALSE) rownames(samplePED) <- samplePED$Name.ID ## Temporary Profile GDS file pathProfileGDS <- tempdir() profileFile <- file.path(pathProfileGDS, "ex1.gds") pRAIDS <- RAIDSparam( studyDF=studyDF, profileFile=file.path(dataDir, "ex1.txt.gz"), genoSource = "snp-pileup", pedStudy=samplePED, pathProfileGDS=pathProfileGDS, fileReferenceGDS=fileGDS) ## Copy the Profile GDS file demo that has not been pruned yet file.copy(file.path(dataDir, "ex1_demo.gds"), profileFile) ## Compute the list of pruned SNVs for a specific profile 'ex1' ## and save it in the Profile GDS file 'ex1.gds' pRAIDS <- pruningProfile2(pRAIDS) ## Check content of Profile GDS file ## The 'pruned.study' entry should be present content <- openfn.gds(profileFile) content ## Close the Profile GDS file (important) closefn.gds(content) ## Remove Profile GDS file (created for demo purpose) unlink(profileFile, force=TRUE)## Path to the demo Reference GDS file is located in this package dataDir <- system.file("extdata/tests", package="RAIDS") fileGDS <- file.path(dataDir, "ex1_good_small_1KG.gds") ## The data.frame containing the information about the study ## The 3 mandatory columns: "study.id", "study.desc", "study.platform" ## The entries should be strings, not factors (stringsAsFactors=FALSE) studyDF <- data.frame(study.id = "MYDATA", study.desc = "Description", study.platform = "PLATFORM", stringsAsFactors = FALSE) ## The data.frame containing the information about the samples ## The entries should be strings, not factors (stringsAsFactors=FALSE) samplePED <- data.frame(Name.ID = c("ex1", "ex2"), Case.ID = c("Patient_h11", "Patient_h12"), Diagnosis = rep("Cancer", 2), Sample.Type = rep("Primary Tumor", 2), Source = rep("Databank B", 2), stringsAsFactors = FALSE) rownames(samplePED) <- samplePED$Name.ID ## Temporary Profile GDS file pathProfileGDS <- tempdir() profileFile <- file.path(pathProfileGDS, "ex1.gds") pRAIDS <- RAIDSparam( studyDF=studyDF, profileFile=file.path(dataDir, "ex1.txt.gz"), genoSource = "snp-pileup", pedStudy=samplePED, pathProfileGDS=pathProfileGDS, fileReferenceGDS=fileGDS) ## Copy the Profile GDS file demo that has not been pruned yet file.copy(file.path(dataDir, "ex1_demo.gds"), profileFile) ## Compute the list of pruned SNVs for a specific profile 'ex1' ## and save it in the Profile GDS file 'ex1.gds' pRAIDS <- pruningProfile2(pRAIDS) ## Check content of Profile GDS file ## The 'pruned.study' entry should be present content <- openfn.gds(profileFile) content ## Close the Profile GDS file (important) closefn.gds(content) ## Remove Profile GDS file (created for demo purpose) unlink(profileFile, force=TRUE)
This function computes the list of pruned SNVs for a
specific profile. When
a group of SNVs are in linkage disequilibrium, only one SNV from that group
is retained. The linkage disequilibrium is calculated with the
snpgdsLDpruning() function. The initial list of
SNVs that are passed to the snpgdsLDpruning()
function can be specified by the user.
pruningSample( gdsReference, method = c("corr", "r", "dprime", "composite"), currentProfile, studyID, listSNP = NULL, slideWindowMaxBP = 500000L, thresholdLD = sqrt(0.1), np = 1L, verbose = FALSE, chr = NULL, superPopMinAF = NULL, keepPrunedGDS = TRUE, pathProfileGDS = NULL, keepFile = FALSE, pathPrunedGDS = ".", outPrefix = "pruned" )pruningSample( gdsReference, method = c("corr", "r", "dprime", "composite"), currentProfile, studyID, listSNP = NULL, slideWindowMaxBP = 500000L, thresholdLD = sqrt(0.1), np = 1L, verbose = FALSE, chr = NULL, superPopMinAF = NULL, keepPrunedGDS = TRUE, pathProfileGDS = NULL, keepFile = FALSE, pathPrunedGDS = ".", outPrefix = "pruned" )
gdsReference |
an object of class gds.class (a GDS file), the 1 KG GDS file (reference data set). |
method |
a |
currentProfile |
a |
studyID |
a |
listSNP |
a |
slideWindowMaxBP |
a single positive |
thresholdLD |
a single |
np |
a single positive |
verbose |
a |
chr |
a |
superPopMinAF |
a single positive |
keepPrunedGDS |
a |
pathProfileGDS |
a |
keepFile |
a |
pathPrunedGDS |
a |
outPrefix |
a |
The function returns 0L when successful.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Required library for GDS library(gdsfmt) ## Path to the demo Reference GDS file is located in this package dataDir <- system.file("extdata/tests", package="RAIDS") fileGDS <- file.path(dataDir, "ex1_good_small_1KG.gds") ## The data.frame containing the information about the study ## The 3 mandatory columns: "study.id", "study.desc", "study.platform" ## The entries should be strings, not factors (stringsAsFactors=FALSE) studyDF <- data.frame(study.id = "MYDATA", study.desc = "Description", study.platform = "PLATFORM", stringsAsFactors = FALSE) ## The data.frame containing the information about the samples ## The entries should be strings, not factors (stringsAsFactors=FALSE) samplePED <- data.frame(Name.ID = c("ex1", "ex2"), Case.ID = c("Patient_h11", "Patient_h12"), Diagnosis = rep("Cancer", 2), Sample.Type = rep("Primary Tumor", 2), Source = rep("Databank B", 2), stringsAsFactors = FALSE) rownames(samplePED) <- samplePED$Name.ID ## Temporary Profile GDS file profileFile <- file.path(tempdir(), "ex1.gds") ## Copy the Profile GDS file demo that has not been pruned yet file.copy(file.path(dataDir, "ex1_demo.gds"), profileFile) ## Open 1KG file gds1KG <- snpgdsOpen(fileGDS) ## Compute the list of pruned SNVs for a specific profile 'ex1' ## and save it in the Profile GDS file 'ex1.gds' pruningSample(gdsReference=gds1KG, currentProfile=c("ex1"), studyID = studyDF$study.id, pathProfileGDS=tempdir()) ## Close the Reference GDS file (important) closefn.gds(gds1KG) ## Check content of Profile GDS file ## The 'pruned.study' entry should be present content <- openfn.gds(profileFile) content ## Close the Profile GDS file (important) closefn.gds(content) ## Remove Profile GDS file (created for demo purpose) unlink(profileFile, force=TRUE)## Required library for GDS library(gdsfmt) ## Path to the demo Reference GDS file is located in this package dataDir <- system.file("extdata/tests", package="RAIDS") fileGDS <- file.path(dataDir, "ex1_good_small_1KG.gds") ## The data.frame containing the information about the study ## The 3 mandatory columns: "study.id", "study.desc", "study.platform" ## The entries should be strings, not factors (stringsAsFactors=FALSE) studyDF <- data.frame(study.id = "MYDATA", study.desc = "Description", study.platform = "PLATFORM", stringsAsFactors = FALSE) ## The data.frame containing the information about the samples ## The entries should be strings, not factors (stringsAsFactors=FALSE) samplePED <- data.frame(Name.ID = c("ex1", "ex2"), Case.ID = c("Patient_h11", "Patient_h12"), Diagnosis = rep("Cancer", 2), Sample.Type = rep("Primary Tumor", 2), Source = rep("Databank B", 2), stringsAsFactors = FALSE) rownames(samplePED) <- samplePED$Name.ID ## Temporary Profile GDS file profileFile <- file.path(tempdir(), "ex1.gds") ## Copy the Profile GDS file demo that has not been pruned yet file.copy(file.path(dataDir, "ex1_demo.gds"), profileFile) ## Open 1KG file gds1KG <- snpgdsOpen(fileGDS) ## Compute the list of pruned SNVs for a specific profile 'ex1' ## and save it in the Profile GDS file 'ex1.gds' pruningSample(gdsReference=gds1KG, currentProfile=c("ex1"), studyID = studyDF$study.id, pathProfileGDS=tempdir()) ## Close the Reference GDS file (important) closefn.gds(gds1KG) ## Check content of Profile GDS file ## The 'pruned.study' entry should be present content <- openfn.gds(profileFile) content ## Close the Profile GDS file (important) closefn.gds(content) ## Remove Profile GDS file (created for demo purpose) unlink(profileFile, force=TRUE)
The function uses all parameters to create a
RAIDSparam class object that contains all the parameters used
in the RAIDS workflow.
RAIDSparam( studyDF = NULL, studyDFSyn = NULL, pedStudy = NULL, studyType = c("LD", "GeneAware"), genoSource = NULL, blockTypeId = "GeneS.Ensembl.Hsapiens.v86", reference = "1KGv1.0", genome = "HG38", chrInfo = NULL, paramAncestry = NULL, profileFile = NULL, profileFileGeno = NULL, pathProfileGDS = NULL, fileReferenceGDS = NULL, fileReferenceAnnotGDS = NULL, inferenceType = "PCAknn", sampleRef = NULL, batch = 1L, prefix = "1", nbSim = 1L, posOffset = -1L, minCov = 10L, minProb = 0.999, seqError = 0.001, seqErrorSyn = 0.001, pRecomb = 0.01, np = 1L, listPos = NULL, syntheticRefDF = NULL, pruningMethod = c("corr", "r", "dprime", "composite"), slideWindowMaxBP = 500000L, thresholdLD = sqrt(0.1), specificSNV = NULL, genoType = "geno.ref", phaseType = "phase.ref", phase = FALSE, PCAmissingRate = 0.025, PCAalgorithm = "exact", eigenCount = 32L, eigenCountSyn = 15L, kList = seq(2L, 15L, 1L), pcaList = seq(2L, 15L, 1L), fieldPopInRef = "superPop", fieldPopInfAnc = "superPop", fieldSubPop = "pop.group", anchorId = "sp0.95v0.2", pathADMIXTURE = NULL, seedADMIXTURE = 432L, cleanADMIXTUREFiles = TRUE, verbose = FALSE )RAIDSparam( studyDF = NULL, studyDFSyn = NULL, pedStudy = NULL, studyType = c("LD", "GeneAware"), genoSource = NULL, blockTypeId = "GeneS.Ensembl.Hsapiens.v86", reference = "1KGv1.0", genome = "HG38", chrInfo = NULL, paramAncestry = NULL, profileFile = NULL, profileFileGeno = NULL, pathProfileGDS = NULL, fileReferenceGDS = NULL, fileReferenceAnnotGDS = NULL, inferenceType = "PCAknn", sampleRef = NULL, batch = 1L, prefix = "1", nbSim = 1L, posOffset = -1L, minCov = 10L, minProb = 0.999, seqError = 0.001, seqErrorSyn = 0.001, pRecomb = 0.01, np = 1L, listPos = NULL, syntheticRefDF = NULL, pruningMethod = c("corr", "r", "dprime", "composite"), slideWindowMaxBP = 500000L, thresholdLD = sqrt(0.1), specificSNV = NULL, genoType = "geno.ref", phaseType = "phase.ref", phase = FALSE, PCAmissingRate = 0.025, PCAalgorithm = "exact", eigenCount = 32L, eigenCountSyn = 15L, kList = seq(2L, 15L, 1L), pcaList = seq(2L, 15L, 1L), fieldPopInRef = "superPop", fieldPopInfAnc = "superPop", fieldSubPop = "pop.group", anchorId = "sp0.95v0.2", pathADMIXTURE = NULL, seedADMIXTURE = 432L, cleanADMIXTUREFiles = TRUE, verbose = FALSE )
studyDF |
a |
studyDFSyn |
a |
pedStudy |
a |
studyType |
a single |
genoSource |
a single |
blockTypeId |
a single |
reference |
a |
genome |
a |
chrInfo |
a |
paramAncestry |
a |
profileFile |
a |
profileFileGeno |
TODO |
pathProfileGDS |
a single |
fileReferenceGDS |
a single |
fileReferenceAnnotGDS |
a |
inferenceType |
a single |
sampleRef |
a |
batch |
a single positive |
prefix |
a single |
nbSim |
a positive |
posOffset |
a single |
minCov |
a single positive |
minProb |
a single |
seqError |
a single |
seqErrorSyn |
a single |
pRecomb |
a single positive |
np |
a single positive |
listPos |
a |
syntheticRefDF |
a
Default: |
pruningMethod |
a |
slideWindowMaxBP |
a single positive |
thresholdLD |
a single positive |
specificSNV |
a |
genoType |
a single |
phaseType |
a TODO. Default: |
phase |
a |
PCAmissingRate |
a positive |
PCAalgorithm |
a |
eigenCount |
a single |
eigenCountSyn |
a TODO. Default: |
kList |
a |
pcaList |
a |
fieldPopInRef |
a |
fieldPopInfAnc |
a |
fieldSubPop |
a |
anchorId |
a |
pathADMIXTURE |
a |
seedADMIXTURE |
a single |
cleanADMIXTUREFiles |
a single |
verbose |
a |
The chrInfo parameter contains the length of the chromosomes. The
length of the chromosomes can be obtain through the
seqlengths library.
As example, for hg38 genome:
if (requireNamespace("Seqinfo", quietly=TRUE) &&
requireNamespace("BSgenome.Hsapiens.UCSC.hg38", quietly=TRUE)) {
chrInfo <- Seqinfo::seqlengths(BSgenome.Hsapiens.UCSC.hg38::Hsapiens)[1:25]
}
an object of class RAIDSparam that contains all the
required parameters needed by the RAIDS workflow.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## New object of class "RAIDSparam" with default parameters newParam1 <- RAIDSparam() ## New object of class "RAIDSparam" with non-default parameters newParam2 <- RAIDSparam(studyDF=data.frame(study.id="Test1", study.desc="Test Desc", study.platform="Test", stringsAsFactors=FALSE), nbSim=1L, minCov=8L)## New object of class "RAIDSparam" with default parameters newParam1 <- RAIDSparam() ## New object of class "RAIDSparam" with non-default parameters newParam2 <- RAIDSparam(studyDF=data.frame(study.id="Test1", study.desc="Test Desc", study.platform="Test", stringsAsFactors=FALSE), nbSim=1L, minCov=8L)
An S4 class to represent the RAIDS parameters
The chrInfo slot contains the length of the chromosomes. The
length of the chromosomes can be obtain through the
seqlengths library.
As example, for hg38 genome:
if (requireNamespace("Seqinfo", quietly=TRUE) &&
requireNamespace("BSgenome.Hsapiens.UCSC.hg38", quietly=TRUE)) {
chrInfo <- Seqinfo::seqlengths(BSgenome.Hsapiens.UCSC.hg38::Hsapiens)[1:25]
}
studyDFa data.frame containing the information about the
study associated to the analysed sample(s). The data.frame must have
those 3 columns: "study.id", "study.desc", "study.platform". All columns
must be in character strings (no factors). Default:
data.frame(study.id="NotDef", study.desc="NotDef",
study.platform="NotDef", stringsAsFactors=FALSE).
studyDFSyna data.frame containing the information about the
synthetic data to the analysed sample(s). The data.frame must have
those 3 columns: "study.id", "study.desc", "study.platform". All columns
must be in character strings (no factors). Default:
data.frame(study.id="NotDef.Synthetic",
study.desc="NotDef synthetic data", study.platform="Synthetic",
stringsAsFactors=FALSE).
pedStudya data.frame containing the information TODO
with those mandatory columns: "Name.ID",
"Case.ID", "Sample.Type", "Diagnosis", and "Source". All columns must be in
character strings (no factors). All row names should correspond to the
values in the "Name.ID" column.
Default: data.frame(Name.ID=c("ProfileId"), Case.ID=c("ProfileId"),
Sample.Type=c("type"), Diagnosis="NotDef", Source=c("NotDef"),
stringsAsFactors=FALSE, row.names = c("ProfileId")).
studyTypea single character string representing the type of
study. The possible choices are: "LD" and "GeneAware". The type of study
affects the way the estimation of the allelic fraction is done.
Default: "LD".
genoSourcea single character string corresponding to the type
of file with the genotype and the allele information of the profile that
will be provided in the 'profileFile' slot. The valid options are: "VCF",
"generic", "snp-pileup", and "bam". The "generic" format CSV file
must have at least these columns: 'Chromosome', 'Position', 'Ref', 'Alt',
'Count', 'File1R', and 'File1A'. The 'Count' is the depth at the
specified position; 'FileR' is the depth of the reference allele, and
'File1A' is the depth of the specific alternative allele.
Finally, in the case of a "VCF" file, the file must have at least those
genotype fields: GT, AD, and DP. Default: NULL.
blockTypeIda single character string corresponding to
the block type used to extract the block identifiers. The block type must
be present in the GDS Reference Annotation file.
Default: "GeneS.Ensembl.Hsapiens.v86".
referencea single character string with two possible values:
'1KGv1.0', '1k_hgdpV0.1'. It specifies the type of inference.
Default: "1KGv1.0".
genomea character string with one possible value:
'HG38'. It specifies the genome used. Default: "HG38".
chrInfoa vector of positive integer values
representing the length of the chromosomes. See 'details' section.
Default: seqlengths(Hsapiens)[seq_len(25)].
paramAncestrya list of parameters related to ancestry.
The list should contain those three entries: ScanBamParam,
PileupParam, and yieldSize.
Default: list(ScanBamParam=NULL, PileupParam=NULL,
yieldSize=10000000).
profileFilea character string representing the path to the
file with genotype and the allele information of the profile. The format
of the accepted file is determined by the value in the 'genoSource' slot.
A profile would have a file with extension "vcf.gz" when 'genoSource' slot
is "VCF". If 'genoSource' is "generic" or "snp-pileup", then ".txt.gz".
If 'genoSource' is "bam", then ".bam" (the file needs to be indexed with a
existing corresponding ".bai" file). Default: NULL.
profileFileGenonot used in the current version
pathProfileGDSa single character string representing the
path to the directory where the GDS Profile files will be created. If
specified, the directory must exist.
Default: NULL.
fileReferenceGDSa single character string representing
the file name of the Reference GDS file. If specified, the file
must exist. Default: NULL.
fileReferenceAnnotGDSa character string representing the
file name of the Population Reference GDS Annotation file. If specified,
the file must exist. Default: NULL.
inferenceTypea single character string representing the
genotype ancestry inference method. The two possible values:
'PCAknn' and 'haploAdmixture'. Default: "PCAknn".
sampleRefa vector of character strings that represent
a subset of sample identifiers from the GDS Reference File. Those samples
will be used for the ancestry inference. If NULL,
all the samples are retained. This is usefull if you want to removed some
specific samples (ex: samples with admixed ancestry).
Default: NULL.
batcha single positive integer representing the current
identifier for the batch. Beware, this field is not stored anymore.
Default: 1L.
prefixa single character string representing at the
beginning of the synthetic name id. Default: "1".
nbSima positive integer representing number of
replicated synthitic data (restricted to 1 for
the moment). Default: 1L.
posOffseta single integer that is added to the SNP position to
switch from 0-based to 1-based coordinate when needed (or reverse).
Default: -1L.
minCova single positive integer representing the minimum
required coverage. Default: 10L.
minProba single numeric between 0 and 1
representing the probability that the calculated genotype call is correct.
Default: 0.999.
seqErrora single numeric between 0 and 1
representing the probability of sequencing error.
Default: 0.001.
seqErrorSyna single numeric between 0 and 1
representing the probability of sequencing error for synthetic.
Default: 0.001.
pRecomba single positive numeric between 0 and
1 that represents the frequency of phase switching in the
synthetic profiles. Default: 0.01.
npa single positive integer specifying the number of
threads to be used. Default: 1L.
listPosa data.frame containing 2 columns named:
"snp.chromosome" and "snp.position". The first column,
called "snp.chromosome", contains the name of the chromosome where the
SNV is located. The second column, called "snp.position", contains the
position of the SNV on the chromosome. Default: NULL.
syntheticRefDFa data.frame containing a subset of
reference profiles for each sub-population present in the Reference GDS
file. The data.frame must have those columns:
a character string representing the sample
identifier.
a character string representing the
subcontinental population assigned to the sample.
a character string representing the
super-population assigned to the sample.
Default: NULL.
pruningMethoda single character string representing the
method that will be used to calculate the linkage disequilibrium in the
snpgdsLDpruning() function. The 4 possible values
are: "corr", "r", "dprime", and "composite". Default: "corr".
slideWindowMaxBPa single positive integer that represents
the maximum basepairs (bp) in the sliding window. This parameter is used
for the LD pruning done by the snpgdsLDpruning
function. Default: 500000L.
thresholdLDa single positive numeric value that represents
the LD threshold used in the snpgdsLDpruning
function. Default: sqrt(0.1).
specificSNVa data.frame containing 2 columns. The first
column, called "snp.chromosome" contains the name of the chromosome where
the SNV is located. The second column, called "snp.position", contains the
position of the SNV on the chromosome. Optionally, the column "snvKeep"
contains the SNV index in the reference or -1 if not in the reference. It
is used during the pruning step. Default: NULL.
genoTypea single character string representing the field
in the GDS profile file that contains all the genotype information.
Default: "geno.ref".
phaseTypea TODO. Default: "phase.ref".
phasea logical indicating TODO. Default: FALSE.
PCAmissingRatea positive numeric representing the maximum
missing rate retained accepted to use SNPs in the PCA analysis done
with the snpgdsPCA function. If NaN, no
missing threshold. Default: 0.025.
PCAalgorithma single character string representing the
algorithm to use with the snpgdsPCA function. The
algorithm must be implemented and available to the
snpgdsPCA function. The current options are:
'exact' or 'randomized'.
Default: "exact".
eigenCounta single integer indicating the number of
eigenvectors that will be in the output of the snpgdsPCA
function; if 'eigenCount' <= 0, then all eigenvectors are returned.
Default: 32L.
eigenCountSyna TODO. Default: 15L.
kLista vector of positive integer representing the
values tested for the K parameter. The K parameter represents the
number of neighbors used in the K-nearest neighbor analysis.
Default: seq(2L, 15L, 1L).
pcaLista vector of positive integer representing
the values tested for the D parameter. The D parameter represents the
number of dimensions used in the PCA analysis.
Default: seq(2L, 15L, 1L).
fieldPopInRefa single character string representing the name
of the column that contains the known ancestry for the reference profiles in
the Population Reference GDS file (corresponding to the
fileReferenceGDS parameter). Default: "superPop".
fieldPopInfAnca character string representing the name of
the column in the data frame that contains the inferred
super-population ancestry for the samples. The column should be
present in the data frame. Default: "superPop".
fieldSubPopa character string representing the name of
the column in the Population Reference GDS file (corresponding to the
fileReferenceGDS parameter) that contains the sub-population
information for the samples. The column should be present in the Population
Reference GDS file. Default: "pop.group".
anchorIda character string representing the name of the
identifier of the quasi non-admixed profile from the reference.
Default: "sp0.95v0.2".
pathADMIXTUREa character string representing the path pf
the software ADMIXTURE and the binary. If it use a function using ADMIXTURE, then
if it is null, it will try to find it with Sys.which("admixture").
Default: NULL.
seedADMIXTUREa single integer seed for
ADMIXTURE program. Default: 432L.
cleanADMIXTUREFilesa single logical indicating if RAIDS
removes ADMIXTURE files after processing. Default: TRUE.
verbosea logical indicating if message information should be
printed. Default: FALSE.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
A generic function for getting the reference slot in a S4 object.
reference(x)reference(x)
x |
a S4 object. |
a value from the reference slot in the S4 object.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(reference="character")) # Create an instance obj <- new("MyClass", reference="123") # Call the generic (assuming a method is implemented) # reference(obj)# Define a dummy class to show usage setClass("MyClass", slots = list(reference="character")) # Create an instance obj <- new("MyClass", reference="123") # Call the generic (assuming a method is implemented) # reference(obj)
A function for getting the reference slot in a
RAIDSparam class.
## S4 method for signature 'RAIDSparam' reference(x)## S4 method for signature 'RAIDSparam' reference(x)
x |
a |
a single character string with two possible values:
'1KGv1.0', '1k_hgdpV0.1'. It specifies the type of inference.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the reference slot for the object reference(paramDemo)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the reference slot for the object reference(paramDemo)
A generic function for replacement of reference slot in a S4 object.
reference(x) <- valuereference(x) <- value
x |
a S4 object. |
value |
the new value to assign or update. |
the modified S4 object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(reference="character")) # Create an instance obj <- new("MyClass", reference="123") # Call the generic (assuming a method is implemented) # reference(obj) <- "333"# Define a dummy class to show usage setClass("MyClass", slots = list(reference="character")) # Create an instance obj <- new("MyClass", reference="123") # Call the generic (assuming a method is implemented) # reference(obj) <- "333"
A function for replacement of reference slot in a
RAIDSparam class.
## S4 replacement method for signature 'RAIDSparam' reference(x) <- value## S4 replacement method for signature 'RAIDSparam' reference(x) <- value
x |
a |
value |
a single |
the modified RAIDSparam object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign the new reference to the reference slot in the object reference(paramDemo) <- "1k_hgdpV0.1"## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign the new reference to the reference slot in the object reference(paramDemo) <- "1k_hgdpV0.1"
TODO
runADMIXTURE(pathOut, fileBed, seedAdmix = 3435L, pRAIDS)runADMIXTURE(pathOut, fileBed, seedAdmix = 3435L, pRAIDS)
pathOut |
a |
fileBed |
a |
seedAdmix |
a |
pRAIDS |
a |
TODO
0L when successful.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Not run: ## 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/demoAncestryCall", package="RAIDS") pathOut <- file.path(tempdir(), "out.tmp") if(!dir.exists(pathOut)){ dir.create(pathOut) } # 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 ## Path to admixture ## pathADMIXTURE <- "PATH/admixture" pRAIDS <- RAIDSparam(studyDF=studyDF, pedStudy=pedStudy, pathProfileGDS=pathProfileGDS, fileReferenceGDS=fileReferenceGDS, fieldPopInfAnc="SuperPop", pathADMIXTURE=pathADMIXTURE) matPIndex <- RAIDS:::computePmatrix(pathOut=pathOut, pRAIDS=pRAIDS) RAIDS:::generateProfilePlinkFiles(pathOut, pRAIDS) profileQ <- runADMIXTURE(pathOut = file.path(pathOut, "profileAdmixture"), fileBed = paste0(pedStudy(pRAIDS)$Name.ID[1], ".bed"), seedAdmix=seedADMIXTURE(pRAIDS), pRAIDS) dir(file.path(pathOut,"profileAdmixture")) print(profileQ) unlink(file.path(pathOut), recursive = TRUE) ## End(Not run)## Not run: ## 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/demoAncestryCall", package="RAIDS") pathOut <- file.path(tempdir(), "out.tmp") if(!dir.exists(pathOut)){ dir.create(pathOut) } # 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 ## Path to admixture ## pathADMIXTURE <- "PATH/admixture" pRAIDS <- RAIDSparam(studyDF=studyDF, pedStudy=pedStudy, pathProfileGDS=pathProfileGDS, fileReferenceGDS=fileReferenceGDS, fieldPopInfAnc="SuperPop", pathADMIXTURE=pathADMIXTURE) matPIndex <- RAIDS:::computePmatrix(pathOut=pathOut, pRAIDS=pRAIDS) RAIDS:::generateProfilePlinkFiles(pathOut, pRAIDS) profileQ <- runADMIXTURE(pathOut = file.path(pathOut, "profileAdmixture"), fileBed = paste0(pedStudy(pRAIDS)$Name.ID[1], ".bed"), seedAdmix=seedADMIXTURE(pRAIDS), pRAIDS) dir(file.path(pathOut,"profileAdmixture")) print(profileQ) unlink(file.path(pathOut), recursive = TRUE) ## End(Not run)
This function runs most steps leading to the ancestry inference call on a specific exome profile. First, the function creates the Profile GDS file for the specific profile using the information from a RDS Sample description file and the Population reference GDS file.
runExomeAncestry( pedStudy, studyDF, pathProfileGDS, pathGeno, pathOut, fileReferenceGDS, fileReferenceAnnotGDS, chrInfo, syntheticRefDF, genoSource = c("snp-pileup", "generic", "VCF"), np = 1L, verbose = FALSE )runExomeAncestry( pedStudy, studyDF, pathProfileGDS, pathGeno, pathOut, fileReferenceGDS, fileReferenceAnnotGDS, chrInfo, syntheticRefDF, genoSource = c("snp-pileup", "generic", "VCF"), np = 1L, verbose = FALSE )
pedStudy |
a |
studyDF |
a |
pathProfileGDS |
a |
pathGeno |
a |
pathOut |
a |
fileReferenceGDS |
a |
fileReferenceAnnotGDS |
a |
chrInfo |
a |
syntheticRefDF |
a
|
genoSource |
a |
np |
a single positive |
verbose |
a |
The runExomeAncestry() function generates 3 types of files in the OUTPUT directory.
The ancestry inference CSV file (".Ancestry.csv" file)
The inference information RDS file (".infoCall.rds" file)
The parameter information RDS files from the synthetic inference ("KNN.synt.*.rds" files in a sub-directory)
In addition, a sub-directory (named using the profile ID) is also created.
The integer 0L when successful. See details section for
more information about the generated output files.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
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.
## Required library for GDS library(SNPRelate) ## Path to the demo 1KG GDS file is located in this package dataDir <- system.file("extdata", package="RAIDS") ################################################################# ## Load the information about the profile ################################################################# data(demoPedigreeEx1) head(demoPedigreeEx1) ################################################################# ## The 1KG GDS file and the 1KG SNV Annotation GDS file ## need to be located in the same directory ## Note that the 1KG GDS file used for this example is a ## simplified version and CANNOT be used for any real analysis ################################################################# path1KG <- file.path(dataDir, "tests") fileReferenceGDS <- file.path(path1KG, "ex1_good_small_1KG.gds") fileAnnotGDS <- file.path(path1KG, "ex1_good_small_1KG_Annot.gds") ################################################################# ## The Sample SNP pileup files (one per sample) need ## to be located in the same directory. ################################################################# pathGeno <- file.path(dataDir, "example", "snpPileup") ################################################################# ## The path where the Profile GDS Files (one per sample) ## will be created need to be specified. ################################################################# pathProfileGDS <- file.path(tempdir(), "out.tmp") pathOut <- file.path(tempdir(), "res.out") ################################################################# ## A data frame containing general information about the study ## is also required. The data frame must have ## those 3 columns: "studyID", "study.desc", "study.platform" ################################################################# studyDF <- data.frame(study.id="MYDATA", study.desc="Description", study.platform="PLATFORM", stringsAsFactors=FALSE) #################################################################### ## Fix seed to ensure reproducible results #################################################################### set.seed(3043) gds1KG <- snpgdsOpen(fileReferenceGDS) dataRef <- select1KGPop(gds1KG, nbProfiles=2L) closefn.gds(gds1KG) ## Required library for this example to run correctly if (requireNamespace("Seqinfo", quietly=TRUE) && requireNamespace("BSgenome.Hsapiens.UCSC.hg38", quietly=TRUE)) { ## Chromosome length information ## chr23 is chrX, chr24 is chrY and chrM is 25 chrInfo <- Seqinfo::seqlengths(BSgenome.Hsapiens.UCSC.hg38::Hsapiens)[1:25] runExomeAncestry(pedStudy=demoPedigreeEx1, studyDF=studyDF, pathProfileGDS=pathProfileGDS, pathGeno=pathGeno, pathOut=pathOut, fileReferenceGDS=fileReferenceGDS, fileReferenceAnnotGDS=fileAnnotGDS, chrInfo=chrInfo, syntheticRefDF=dataRef, genoSource="snp-pileup") unlink(pathProfileGDS, recursive=TRUE, force=TRUE) unlink(pathOut, recursive=TRUE, force=TRUE) }## Required library for GDS library(SNPRelate) ## Path to the demo 1KG GDS file is located in this package dataDir <- system.file("extdata", package="RAIDS") ################################################################# ## Load the information about the profile ################################################################# data(demoPedigreeEx1) head(demoPedigreeEx1) ################################################################# ## The 1KG GDS file and the 1KG SNV Annotation GDS file ## need to be located in the same directory ## Note that the 1KG GDS file used for this example is a ## simplified version and CANNOT be used for any real analysis ################################################################# path1KG <- file.path(dataDir, "tests") fileReferenceGDS <- file.path(path1KG, "ex1_good_small_1KG.gds") fileAnnotGDS <- file.path(path1KG, "ex1_good_small_1KG_Annot.gds") ################################################################# ## The Sample SNP pileup files (one per sample) need ## to be located in the same directory. ################################################################# pathGeno <- file.path(dataDir, "example", "snpPileup") ################################################################# ## The path where the Profile GDS Files (one per sample) ## will be created need to be specified. ################################################################# pathProfileGDS <- file.path(tempdir(), "out.tmp") pathOut <- file.path(tempdir(), "res.out") ################################################################# ## A data frame containing general information about the study ## is also required. The data frame must have ## those 3 columns: "studyID", "study.desc", "study.platform" ################################################################# studyDF <- data.frame(study.id="MYDATA", study.desc="Description", study.platform="PLATFORM", stringsAsFactors=FALSE) #################################################################### ## Fix seed to ensure reproducible results #################################################################### set.seed(3043) gds1KG <- snpgdsOpen(fileReferenceGDS) dataRef <- select1KGPop(gds1KG, nbProfiles=2L) closefn.gds(gds1KG) ## Required library for this example to run correctly if (requireNamespace("Seqinfo", quietly=TRUE) && requireNamespace("BSgenome.Hsapiens.UCSC.hg38", quietly=TRUE)) { ## Chromosome length information ## chr23 is chrX, chr24 is chrY and chrM is 25 chrInfo <- Seqinfo::seqlengths(BSgenome.Hsapiens.UCSC.hg38::Hsapiens)[1:25] runExomeAncestry(pedStudy=demoPedigreeEx1, studyDF=studyDF, pathProfileGDS=pathProfileGDS, pathGeno=pathGeno, pathOut=pathOut, fileReferenceGDS=fileReferenceGDS, fileReferenceAnnotGDS=fileAnnotGDS, chrInfo=chrInfo, syntheticRefDF=dataRef, genoSource="snp-pileup") unlink(pathProfileGDS, recursive=TRUE, force=TRUE) unlink(pathOut, recursive=TRUE, force=TRUE) }
This function runs most steps leading to the ancestry inference call on a specific RNA profile. First, the function creates the Profile GDS file for the specific profile using the information from a RDS Sample description file and the Population Reference GDS file.
runRNAAncestry( pedStudy, studyDF, pathProfileGDS, pathGeno, pathOut, fileReferenceGDS, fileReferenceAnnotGDS, chrInfo, syntheticRefDF, genoSource = c("snp-pileup", "generic", "VCF"), np = 1L, blockTypeID, verbose = FALSE )runRNAAncestry( pedStudy, studyDF, pathProfileGDS, pathGeno, pathOut, fileReferenceGDS, fileReferenceAnnotGDS, chrInfo, syntheticRefDF, genoSource = c("snp-pileup", "generic", "VCF"), np = 1L, blockTypeID, verbose = FALSE )
pedStudy |
a |
studyDF |
a |
pathProfileGDS |
a |
pathGeno |
a |
pathOut |
a |
fileReferenceGDS |
a |
fileReferenceAnnotGDS |
a |
chrInfo |
a |
syntheticRefDF |
a
|
genoSource |
a |
np |
a single positive |
blockTypeID |
a |
verbose |
a |
The runExomeAncestry() function generates 3 types of files in the OUTPUT directory.
The ancestry inference CSV file (".Ancestry.csv" file)
The inference information RDS file (".infoCall.rds" file)
The parameter information RDS files from the synthetic inference ("KNN.synt.*.rds" files in a sub-directory)
In addition, a sub-directory (named using the profile ID) is also created.
The integer 0L when successful. See details section for
more information about the generated output files.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
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.
## Required library for GDS library(SNPRelate) ## Path to the demo 1KG GDS file is located in this package dataDir <- system.file("extdata", package="RAIDS") ################################################################# ## Load the information about the profile ################################################################# data(demoPedigreeEx1) head(demoPedigreeEx1) ################################################################# ## The 1KG GDS file and the 1KG SNV Annotation GDS file ## need to be located in the same directory ## Note that the 1KG GDS file used for this example is a ## simplified version and CANNOT be used for any real analysis ################################################################# path1KG <- file.path(dataDir, "tests") fileReferenceGDS <- file.path(path1KG, "ex1_good_small_1KG.gds") fileAnnotGDS <- file.path(path1KG, "ex1_good_small_1KG_Annot.gds") ################################################################# ## The Sample SNP pileup files (one per sample) need ## to be located in the same directory. ################################################################# pathGeno <- file.path(dataDir, "example", "snpPileup") ################################################################# ## The path where the Profile GDS Files (one per sample) ## will be created need to be specified. ################################################################# pathProfileGDS <- file.path(tempdir(), "out.tmp") pathOut <- file.path(tempdir(), "res.out") ################################################################# ## A data frame containing general information about the study ## is also required. The data frame must have ## those 3 columns: "studyID", "study.desc", "study.platform" ################################################################# studyDF <- data.frame(study.id="MYDATA", study.desc="Description", study.platform="PLATFORM", stringsAsFactors=FALSE) #################################################################### ## Fix seed to ensure reproducible results #################################################################### set.seed(3043) gds1KG <- snpgdsOpen(fileReferenceGDS) dataRef <- select1KGPop(gds1KG, nbProfiles=2L) closefn.gds(gds1KG) ## Required library for this example to run correctly if (requireNamespace("Seqinfo", quietly=TRUE) && requireNamespace("BSgenome.Hsapiens.UCSC.hg38", quietly=TRUE)) { ## Chromosome length information ## chr23 is chrX, chr24 is chrY and chrM is 25 chrInfo <- Seqinfo::seqlengths(BSgenome.Hsapiens.UCSC.hg38::Hsapiens)[1:25] runRNAAncestry(pedStudy=demoPedigreeEx1, studyDF=studyDF, pathProfileGDS=pathProfileGDS, pathGeno=pathGeno, pathOut=pathOut, fileReferenceGDS=fileReferenceGDS, fileReferenceAnnotGDS=fileAnnotGDS, chrInfo=chrInfo, syntheticRefDF=dataRef, blockTypeID="GeneS.Ensembl.Hsapiens.v86", genoSource="snp-pileup") unlink(pathProfileGDS, recursive=TRUE, force=TRUE) unlink(pathOut, recursive=TRUE, force=TRUE) }## Required library for GDS library(SNPRelate) ## Path to the demo 1KG GDS file is located in this package dataDir <- system.file("extdata", package="RAIDS") ################################################################# ## Load the information about the profile ################################################################# data(demoPedigreeEx1) head(demoPedigreeEx1) ################################################################# ## The 1KG GDS file and the 1KG SNV Annotation GDS file ## need to be located in the same directory ## Note that the 1KG GDS file used for this example is a ## simplified version and CANNOT be used for any real analysis ################################################################# path1KG <- file.path(dataDir, "tests") fileReferenceGDS <- file.path(path1KG, "ex1_good_small_1KG.gds") fileAnnotGDS <- file.path(path1KG, "ex1_good_small_1KG_Annot.gds") ################################################################# ## The Sample SNP pileup files (one per sample) need ## to be located in the same directory. ################################################################# pathGeno <- file.path(dataDir, "example", "snpPileup") ################################################################# ## The path where the Profile GDS Files (one per sample) ## will be created need to be specified. ################################################################# pathProfileGDS <- file.path(tempdir(), "out.tmp") pathOut <- file.path(tempdir(), "res.out") ################################################################# ## A data frame containing general information about the study ## is also required. The data frame must have ## those 3 columns: "studyID", "study.desc", "study.platform" ################################################################# studyDF <- data.frame(study.id="MYDATA", study.desc="Description", study.platform="PLATFORM", stringsAsFactors=FALSE) #################################################################### ## Fix seed to ensure reproducible results #################################################################### set.seed(3043) gds1KG <- snpgdsOpen(fileReferenceGDS) dataRef <- select1KGPop(gds1KG, nbProfiles=2L) closefn.gds(gds1KG) ## Required library for this example to run correctly if (requireNamespace("Seqinfo", quietly=TRUE) && requireNamespace("BSgenome.Hsapiens.UCSC.hg38", quietly=TRUE)) { ## Chromosome length information ## chr23 is chrX, chr24 is chrY and chrM is 25 chrInfo <- Seqinfo::seqlengths(BSgenome.Hsapiens.UCSC.hg38::Hsapiens)[1:25] runRNAAncestry(pedStudy=demoPedigreeEx1, studyDF=studyDF, pathProfileGDS=pathProfileGDS, pathGeno=pathGeno, pathOut=pathOut, fileReferenceGDS=fileReferenceGDS, fileReferenceAnnotGDS=fileAnnotGDS, chrInfo=chrInfo, syntheticRefDF=dataRef, blockTypeID="GeneS.Ensembl.Hsapiens.v86", genoSource="snp-pileup") unlink(pathProfileGDS, recursive=TRUE, force=TRUE) unlink(pathOut, recursive=TRUE, force=TRUE) }
TODO
runSynADMIXTURE(pathOut, matPIndex, pRAIDS)runSynADMIXTURE(pathOut, matPIndex, pRAIDS)
pathOut |
a |
matPIndex |
a |
pRAIDS |
a |
TODO
0L when successful.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Not run: ## 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/demoAncestryCall", package="RAIDS") pathOut <- file.path(tempdir(), "out.tmp") if(!dir.exists(pathOut)){ dir.create(pathOut) } # 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 ## Path to admixture ## pathADMIXTURE <- "PATH/admixture" pRAIDS <- RAIDSparam(studyDF=studyDF, pedStudy=pedStudy, pathProfileGDS=pathProfileGDS, fileReferenceGDS=fileReferenceGDS, fieldPopInfAnc="SuperPop", pathADMIXTURE=pathADMIXTURE) matPIndex <- RAIDS:::computePmatrix(pathOut=pathOut, pRAIDS=pRAIDS) RAIDS:::generateProfilePlinkFiles(pathOut, pRAIDS) syntheticQ <- runSynADMIXTURE(pathOut=pathOut, matPIndex=matPIndex, pRAIDS=pRAIDS) dir(file.path(pathOut)) head(syntheticQ) unlink(file.path(pathOut), recursive = TRUE) ## End(Not run)## Not run: ## 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/demoAncestryCall", package="RAIDS") pathOut <- file.path(tempdir(), "out.tmp") if(!dir.exists(pathOut)){ dir.create(pathOut) } # 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 ## Path to admixture ## pathADMIXTURE <- "PATH/admixture" pRAIDS <- RAIDSparam(studyDF=studyDF, pedStudy=pedStudy, pathProfileGDS=pathProfileGDS, fileReferenceGDS=fileReferenceGDS, fieldPopInfAnc="SuperPop", pathADMIXTURE=pathADMIXTURE) matPIndex <- RAIDS:::computePmatrix(pathOut=pathOut, pRAIDS=pRAIDS) RAIDS:::generateProfilePlinkFiles(pathOut, pRAIDS) syntheticQ <- runSynADMIXTURE(pathOut=pathOut, matPIndex=matPIndex, pRAIDS=pRAIDS) dir(file.path(pathOut)) head(syntheticQ) unlink(file.path(pathOut), recursive = TRUE) ## End(Not run)
A generic function for getting the sampleRef slot in a S4 object.
sampleRef(x)sampleRef(x)
x |
a S4 object. |
a value from the sampleRef slot in the S4 object.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(sampleRef="character")) # Create an instance obj <- new("MyClass", sampleRef="123") # Call the generic (assuming a method is implemented) # sampleRef(obj)# Define a dummy class to show usage setClass("MyClass", slots = list(sampleRef="character")) # Create an instance obj <- new("MyClass", sampleRef="123") # Call the generic (assuming a method is implemented) # sampleRef(obj)
A function for getting the sampleRef slot in a
RAIDSparam class.
## S4 method for signature 'RAIDSparam' sampleRef(x)## S4 method for signature 'RAIDSparam' sampleRef(x)
x |
a |
NULL or a vector of character strings that
represent a subset of sample identifiers from the GDS Reference File.
Those samples will be used for the ancestry inference. If NULL, all
the samples are retained.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the sampleRef slot for the object sampleRef(paramDemo)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the sampleRef slot for the object sampleRef(paramDemo)
A generic function for replacement of sampleRef slot in a S4 object.
sampleRef(x) <- valuesampleRef(x) <- value
x |
a S4 object. |
value |
the new value to assign or update. |
the modified S4 object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(sampleRef="character")) # Create an instance obj <- new("MyClass", sampleRef="123") # Call the generic (assuming a method is implemented) # sampleRef(obj) <- "333"# Define a dummy class to show usage setClass("MyClass", slots = list(sampleRef="character")) # Create an instance obj <- new("MyClass", sampleRef="123") # Call the generic (assuming a method is implemented) # sampleRef(obj) <- "333"
A function for replacement of sampleRef slot in a
RAIDSparam class.
## S4 replacement method for signature 'RAIDSparam' sampleRef(x) <- value## S4 replacement method for signature 'RAIDSparam' sampleRef(x) <- value
x |
a |
value |
|
the modified RAIDSparam object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign new values to the sampleRef slot in the object sampleRef(paramDemo) <- c("Sample1", "Sample2")## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign new values to the sampleRef slot in the object sampleRef(paramDemo) <- c("Sample1", "Sample2")
A generic function for getting the seedADMIXTURE slot in a S4 object.
seedADMIXTURE(x)seedADMIXTURE(x)
x |
a S4 object. |
a value from the seedADMIXTURE slot in the S4 object.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(seedADMIXTURE="character")) # Create an instance obj <- new("MyClass", seedADMIXTURE="123") # Call the generic (assuming a method is implemented) # seedADMIXTURE(obj)# Define a dummy class to show usage setClass("MyClass", slots = list(seedADMIXTURE="character")) # Create an instance obj <- new("MyClass", seedADMIXTURE="123") # Call the generic (assuming a method is implemented) # seedADMIXTURE(obj)
A function for getting the seedADMIXTURE slot in a
RAIDSparam class.
## S4 method for signature 'RAIDSparam' seedADMIXTURE(x)## S4 method for signature 'RAIDSparam' seedADMIXTURE(x)
x |
a |
a single integer seed for
ADMIXTURE program.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the seedADMIXTURE slot for the object seedADMIXTURE(paramDemo)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the seedADMIXTURE slot for the object seedADMIXTURE(paramDemo)
A generic function for replacement of seedADMIXTURE slot in a S4 object.
seedADMIXTURE(x) <- valueseedADMIXTURE(x) <- value
x |
a S4 object. |
value |
the new value to assign or update. |
the modified S4 object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(seedADMIXTURE="character")) # Create an instance obj <- new("MyClass", seedADMIXTURE="123") # Call the generic (assuming a method is implemented) # seedADMIXTURE(obj) <- "333"# Define a dummy class to show usage setClass("MyClass", slots = list(seedADMIXTURE="character")) # Create an instance obj <- new("MyClass", seedADMIXTURE="123") # Call the generic (assuming a method is implemented) # seedADMIXTURE(obj) <- "333"
A function for replacement of seedADMIXTURE slot in a
RAIDSparam class.
## S4 replacement method for signature 'RAIDSparam' seedADMIXTURE(x) <- value## S4 replacement method for signature 'RAIDSparam' seedADMIXTURE(x) <- value
x |
a |
value |
a single |
the modified RAIDSparam object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign new value to the seedADMIXTURE slot in the object seedADMIXTURE(paramDemo) <- 33L## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign new value to the seedADMIXTURE slot in the object seedADMIXTURE(paramDemo) <- 33L
The function randomly selects a fixed number of reference for each subcontinental population present in the 1KG GDS file. When a subcontinental population has less samples than the fixed number, all samples from the subcontinental population are selected.
select1KGPop(gdsReference, nbProfiles)select1KGPop(gdsReference, nbProfiles)
gdsReference |
an object of class gds.class (a GDS file), the opened 1KG GDS file. |
nbProfiles |
a single positive |
a data.frame containing those columns:
a character string representing the sample
identifier.
a character string representing the
subcontinental population assigned to the sample.
a character string representing the
super-population assigned to the sample.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Required library library(gdsfmt) ## The number of samples needed by subcontinental population ## The number is small for demonstration purpose nbProfiles <- 5L ## Open 1KG GDS Demo file ## This file only one superpopulation (for demonstration purpose) dataDir <- system.file("extdata", package="RAIDS") fileGDS <- file.path(dataDir, "PopulationReferenceDemo.gds") gdsFileOpen <- openfn.gds(fileGDS, readonly=TRUE) ## Extract a selected number of random samples ## for each subcontinental population ## In the 1KG GDS Demo file, there is one subcontinental population dataR <- select1KGPop(gdsReference=gdsFileOpen, nbProfiles=nbProfiles) ## Close the 1KG GDS Demo file (important) closefn.gds(gdsFileOpen)## Required library library(gdsfmt) ## The number of samples needed by subcontinental population ## The number is small for demonstration purpose nbProfiles <- 5L ## Open 1KG GDS Demo file ## This file only one superpopulation (for demonstration purpose) dataDir <- system.file("extdata", package="RAIDS") fileGDS <- file.path(dataDir, "PopulationReferenceDemo.gds") gdsFileOpen <- openfn.gds(fileGDS, readonly=TRUE) ## Extract a selected number of random samples ## for each subcontinental population ## In the 1KG GDS Demo file, there is one subcontinental population dataR <- select1KGPop(gdsReference=gdsFileOpen, nbProfiles=nbProfiles) ## Close the 1KG GDS Demo file (important) closefn.gds(gdsFileOpen)
The function randomly selects a fixed number of reference for each subcontinental population present in the 1KG GDS file. When a subcontinental population has less samples than the fixed number, all samples from the subcontinental population are selected.
select1KGPopForSynthetic(fileReferenceGDS, nbProfiles)select1KGPopForSynthetic(fileReferenceGDS, nbProfiles)
fileReferenceGDS |
a |
nbProfiles |
a single positive |
a data.frame containing those columns:
a character string representing the sample
identifier.
a character string representing the
subcontinental population assigned to the sample.
a character string representing the
super-population assigned to the sample.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Required library library(gdsfmt) ## The number of samples needed by subcontinental population ## The number is small for demonstration purpose nbProfiles <- 5L ## 1KG GDS Demo file ## This file only one superpopulation (for demonstration purpose) dataDir <- system.file("extdata", package="RAIDS") fileGDS <- file.path(dataDir, "PopulationReferenceDemo.gds") ## Extract a selected number of random samples ## for each subcontinental population ## In the 1KG GDS Demo file, there is one subcontinental population dataR <- select1KGPopForSynthetic(fileReferenceGDS=fileGDS, nbProfiles=nbProfiles)## Required library library(gdsfmt) ## The number of samples needed by subcontinental population ## The number is small for demonstration purpose nbProfiles <- 5L ## 1KG GDS Demo file ## This file only one superpopulation (for demonstration purpose) dataDir <- system.file("extdata", package="RAIDS") fileGDS <- file.path(dataDir, "PopulationReferenceDemo.gds") ## Extract a selected number of random samples ## for each subcontinental population ## In the 1KG GDS Demo file, there is one subcontinental population dataR <- select1KGPopForSynthetic(fileReferenceGDS=fileGDS, nbProfiles=nbProfiles)
The function randomly selects a fixed number of reference for each subcontinental population present in the 1KG GDS file. When a subcontinental population has less samples than the fixed number, all samples from the subcontinental population are selected.
selectForSynthetic(pRAIDS, nbProfiles = 30L)selectForSynthetic(pRAIDS, nbProfiles = 30L)
pRAIDS |
a |
nbProfiles |
a single positive |
a data.frame containing those columns:
a character string representing the sample
identifier.
a character string representing the
subcontinental population assigned to the sample.
a character string representing the
super-population assigned to the sample.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Path to the demo 1KG GDS file is located in this package dataDir <- system.file("extdata", package="RAIDS") ################################################################# ## The 1KG GDS file and the 1KG SNV Annotation GDS file ## need to be located in the same directory ## Note that the 1KG GDS file used for this example is a ## simplified version and CANNOT be used for any real analysis ################################################################# path1KG <- file.path(dataDir, "tests") fileReferenceGDS <- file.path(path1KG, "ex1_good_small_1KG.gds") fileAnnotGDS <- file.path(path1KG, "ex1_good_small_1KG_Annot.gds") #################################################################### ## Fix seed to ensure reproducible results #################################################################### set.seed(3043) pRAIDS <- RAIDSparam( fileReferenceGDS=fileReferenceGDS, fileReferenceAnnotGDS=fileAnnotGDS ) ## The number of samples needed by subcontinental population ## The number is small for demonstration purpose nbProfiles <- 5L ## Extract a selected number of random samples ## for each subcontinental population ## In the 1KG GDS Demo file, there is one subcontinental population dataR <- selectForSynthetic(pRAIDS=pRAIDS, nbProfiles=nbProfiles)## Path to the demo 1KG GDS file is located in this package dataDir <- system.file("extdata", package="RAIDS") ################################################################# ## The 1KG GDS file and the 1KG SNV Annotation GDS file ## need to be located in the same directory ## Note that the 1KG GDS file used for this example is a ## simplified version and CANNOT be used for any real analysis ################################################################# path1KG <- file.path(dataDir, "tests") fileReferenceGDS <- file.path(path1KG, "ex1_good_small_1KG.gds") fileAnnotGDS <- file.path(path1KG, "ex1_good_small_1KG_Annot.gds") #################################################################### ## Fix seed to ensure reproducible results #################################################################### set.seed(3043) pRAIDS <- RAIDSparam( fileReferenceGDS=fileReferenceGDS, fileReferenceAnnotGDS=fileAnnotGDS ) ## The number of samples needed by subcontinental population ## The number is small for demonstration purpose nbProfiles <- 5L ## Extract a selected number of random samples ## for each subcontinental population ## In the 1KG GDS Demo file, there is one subcontinental population dataR <- selectForSynthetic(pRAIDS=pRAIDS, nbProfiles=nbProfiles)
A generic function for getting the seqError slot in a S4 object.
seqError(x)seqError(x)
x |
a S4 object. |
a value from the seqError slot in the S4 object.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(seqError="character")) # Create an instance obj <- new("MyClass", seqError="123") # Call the generic (assuming a method is implemented) # seqError(obj)# Define a dummy class to show usage setClass("MyClass", slots = list(seqError="character")) # Create an instance obj <- new("MyClass", seqError="123") # Call the generic (assuming a method is implemented) # seqError(obj)
A function for getting the seqError slot in a
RAIDSparam class.
## S4 method for signature 'RAIDSparam' seqError(x)## S4 method for signature 'RAIDSparam' seqError(x)
x |
a |
a single numeric between 0 and 1
representing the probability of sequencing error.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the seqError slot for the object seqError(paramDemo)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the seqError slot for the object seqError(paramDemo)
A generic function for replacement of seqError slot in a S4 object.
seqError(x) <- valueseqError(x) <- value
x |
a S4 object. |
value |
the new value to assign or update. |
the modified S4 object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(seqError="character")) # Create an instance obj <- new("MyClass", seqError="123") # Call the generic (assuming a method is implemented) # seqError(obj) <- "333"# Define a dummy class to show usage setClass("MyClass", slots = list(seqError="character")) # Create an instance obj <- new("MyClass", seqError="123") # Call the generic (assuming a method is implemented) # seqError(obj) <- "333"
A function for replacement of seqError slot in a
RAIDSparam class.
## S4 replacement method for signature 'RAIDSparam' seqError(x) <- value## S4 replacement method for signature 'RAIDSparam' seqError(x) <- value
x |
a |
value |
a single |
the modified RAIDSparam object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign a new value to the seqError slot in the object seqError(paramDemo) <- 0.03## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign a new value to the seqError slot in the object seqError(paramDemo) <- 0.03
A generic function for getting the seqErrorSyn slot in a S4 object.
seqErrorSyn(x)seqErrorSyn(x)
x |
a S4 object. |
a value from the seqErrorSyn slot in the S4 object.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(seqErrorSyn="character")) # Create an instance obj <- new("MyClass", seqErrorSyn="123") # Call the generic (assuming a method is implemented) # seqErrorSyn(obj)# Define a dummy class to show usage setClass("MyClass", slots = list(seqErrorSyn="character")) # Create an instance obj <- new("MyClass", seqErrorSyn="123") # Call the generic (assuming a method is implemented) # seqErrorSyn(obj)
A function for getting the seqErrorSyn slot in a
RAIDSparam class.
## S4 method for signature 'RAIDSparam' seqErrorSyn(x)## S4 method for signature 'RAIDSparam' seqErrorSyn(x)
x |
a |
a single numeric between 0 and 1
representing the probability of sequencing error for synthetic.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the seqErrorSyn slot for the object seqErrorSyn(paramDemo)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the seqErrorSyn slot for the object seqErrorSyn(paramDemo)
A generic function for replacement of seqErrorSyn slot in a S4 object.
seqErrorSyn(x) <- valueseqErrorSyn(x) <- value
x |
a S4 object. |
value |
the new value to assign or update. |
the modified S4 object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(seqErrorSyn="character")) # Create an instance obj <- new("MyClass", seqErrorSyn="123") # Call the generic (assuming a method is implemented) # seqErrorSyn(obj) <- "333"# Define a dummy class to show usage setClass("MyClass", slots = list(seqErrorSyn="character")) # Create an instance obj <- new("MyClass", seqErrorSyn="123") # Call the generic (assuming a method is implemented) # seqErrorSyn(obj) <- "333"
A function for replacement of seqErrorSyn slot in a
RAIDSparam class.
## S4 replacement method for signature 'RAIDSparam' seqErrorSyn(x) <- value## S4 replacement method for signature 'RAIDSparam' seqErrorSyn(x) <- value
x |
a |
value |
a single |
the modified RAIDSparam object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign a new value to the seqErrorSyn slot in the object seqErrorSyn(paramDemo) <- 0.03## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign a new value to the seqErrorSyn slot in the object seqErrorSyn(paramDemo) <- 0.03
A generic function for getting the slideWindowMaxBP slot in a S4 object.
slideWindowMaxBP(x)slideWindowMaxBP(x)
x |
a S4 object. |
a value from the slideWindowMaxBP slot in the S4 object.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(slideWindowMaxBP="character")) # Create an instance obj <- new("MyClass", slideWindowMaxBP="123") # Call the generic (assuming a method is implemented) # slideWindowMaxBP(obj)# Define a dummy class to show usage setClass("MyClass", slots = list(slideWindowMaxBP="character")) # Create an instance obj <- new("MyClass", slideWindowMaxBP="123") # Call the generic (assuming a method is implemented) # slideWindowMaxBP(obj)
A function for getting the slideWindowMaxBP slot in a
RAIDSparam class.
## S4 method for signature 'RAIDSparam' slideWindowMaxBP(x)## S4 method for signature 'RAIDSparam' slideWindowMaxBP(x)
x |
a |
a single positive integer that represents the maximum
basepairs (bp) in the sliding window. This parameter is used for
the LD pruning done by the snpgdsLDpruning
function.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the slideWindowMaxBP slot for the object slideWindowMaxBP(paramDemo)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the slideWindowMaxBP slot for the object slideWindowMaxBP(paramDemo)
A generic function for replacement of slideWindowMaxBP slot in a S4 object.
slideWindowMaxBP(x) <- valueslideWindowMaxBP(x) <- value
x |
a S4 object. |
value |
the new value to assign or update. |
the modified S4 object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(slideWindowMaxBP="character")) # Create an instance obj <- new("MyClass", slideWindowMaxBP="123") # Call the generic (assuming a method is implemented) # slideWindowMaxBP(obj) <- "333"# Define a dummy class to show usage setClass("MyClass", slots = list(slideWindowMaxBP="character")) # Create an instance obj <- new("MyClass", slideWindowMaxBP="123") # Call the generic (assuming a method is implemented) # slideWindowMaxBP(obj) <- "333"
A function for replacement of slideWindowMaxBP slot in a
RAIDSparam class.
## S4 replacement method for signature 'RAIDSparam' slideWindowMaxBP(x) <- value## S4 replacement method for signature 'RAIDSparam' slideWindowMaxBP(x) <- value
x |
a |
value |
a single positive |
the modified RAIDSparam object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign new value to the slideWindowMaxBP slot in the object slideWindowMaxBP(paramDemo) <- 1000L## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign new value to the slideWindowMaxBP slot in the object slideWindowMaxBP(paramDemo) <- 1000L
data.frame containing the
SNV information.The object is a data.frame with 17 columns.
data(snpPositionDemo)data(snpPositionDemo)
The data.frame containing the information about the
synthetic profiles. The data.frame contains 4 columns:
cnt.tot a integer representing the number of reads at
the SNV position.
cnt.ref a integer representing the number of reads
corresponding to the reference at the SNV position.
cnt.alt a integer representing the number of reads
different than the reference at the SNV position.
snp.pos a integer representing the position of the
SNV on the chromosome.
snp.chr a integer representing the chromosome on which
the SNV is located.
normal.geno a integer representing the genotype
(0=wild-type reference; 1=heterozygote; 2=homozygote alternative;
3=unkown).
pruned a logical indicated if the SNV is pruned.
snp.index a integer representing the index of the
SNV in the reference SNV GDS file.
keep a logical indicated if the genotype
exists for the SNV.
hetero a logical indicated if the SNV is
heterozygote.
homo a logical indicated if the SNV is homozygote.
block.id a integer representing the block identifier
associated to the current SNV.
phase a integer representing the block identifier
associated to the current SNV.
lap a numeric representing the lower allelic
fraction.
LOH a integer indicating if the SNV is in an LOH
region (0=not LOH, 1=in LOH).
imbAR a integer indicating if the SNV is in an
imbalanced region (-1=not classified as imbalanced or LOH, 0=in LOH;
1=tested positive for imbalance in at least 1 window).
freq a numeric representing the frequency of the
variant in the the reference.
This dataset can be
used to test the calcAFMLRNA and tableBlockAF
internal functions.
The data.frame containing the information about the
synthetic profiles. The data.frame contains 4 columns:
cnt.tot a integer representing the number of reads at
the SNV position.
cnt.ref a integer representing the number of reads
corresponding to the reference at the SNV position.
cnt.alt a integer representing the number of reads
different than the reference at the SNV position.
snp.pos a integer representing the position of the
SNV on the chromosome.
snp.chr a integer representing the chromosome on which
the SNV is located.
normal.geno a integer representing the genotype
(0=wild-type reference; 1=heterozygote; 2=homozygote alternative; 3=unkown).
pruned a logical indicated if the SNV is pruned.
snp.index a integer representing the index of the
SNV in the reference SNV GDS file.
keep a logical indicated if the genotype
exists for the SNV.
hetero a logical indicated if the SNV is heterozygote.
homo a logical indicated if the SNV is homozygote.
block.id a integer representing the block identifier
associated to the current SNV.
phase a integer representing the block identifier
associated to the current SNV.
lap a numeric representing the lower allelic fraction.
LOH a integer indicating if the SNV is in an LOH region
(0=not LOH, 1=in LOH).
imbAR a integer indicating if the SNV is in an
imbalanced region (-1=not classified as imbalanced or LOH, 0=in LOH;
1=tested positive for imbalance in at least 1 window).
freq a numeric representing the frequency of the
variant in the the reference.
## Loading demo dataset containing SNV information data(snpPositionDemo) ## Only use a subset of heterozygote SNVs related to one block subset <- snpPositionDemo[which(snpPositionDemo$block.id == 2750 & snpPositionDemo$hetero), c("cnt.ref", "cnt.alt", "phase")] ## Compute the log likelihood ratio based on the coverage of ## each allele in a specific block result <- RAIDS:::calcAFMLRNA(subset) head(result)## Loading demo dataset containing SNV information data(snpPositionDemo) ## Only use a subset of heterozygote SNVs related to one block subset <- snpPositionDemo[which(snpPositionDemo$block.id == 2750 & snpPositionDemo$hetero), c("cnt.ref", "cnt.alt", "phase")] ## Compute the log likelihood ratio based on the coverage of ## each allele in a specific block result <- RAIDS:::calcAFMLRNA(subset) head(result)
This function extract the SNPs that pass a frequency cut-off in at least one super population from a GDS SNP information file and save the retained SNP information into a VCF file.
snvListVCF(gdsReference, fileOut, offset = 0L, freqCutoff = NULL)snvListVCF(gdsReference, fileOut, offset = 0L, freqCutoff = NULL)
gdsReference |
an object of class |
fileOut |
a |
offset |
a single |
freqCutoff |
a single positive |
The integer 0L when successful.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Required library library(gdsfmt) ## Path to the demo pedigree file is located in this package dataDir <- system.file("extdata", package="RAIDS") ## Demo 1KG Reference GDS file fileGDS <- openfn.gds(file.path(dataDir, "PopulationReferenceDemo.gds")) ## Output VCF file that will be created (temporary) vcfFile <- file.path(tempdir(), "Demo_TMP_01.vcf") ## Create a VCF file with the SNV dataset present in the GDS file ## No cutoff on frequency, so all SNVs are saved snvListVCF(gdsReference=fileGDS, fileOut=vcfFile, offset=0L, freqCutoff=NULL) ## Close GDS file (IMPORTANT) closefn.gds(fileGDS) ## Remove temporary VCF file unlink(vcfFile, force=TRUE)## Required library library(gdsfmt) ## Path to the demo pedigree file is located in this package dataDir <- system.file("extdata", package="RAIDS") ## Demo 1KG Reference GDS file fileGDS <- openfn.gds(file.path(dataDir, "PopulationReferenceDemo.gds")) ## Output VCF file that will be created (temporary) vcfFile <- file.path(tempdir(), "Demo_TMP_01.vcf") ## Create a VCF file with the SNV dataset present in the GDS file ## No cutoff on frequency, so all SNVs are saved snvListVCF(gdsReference=fileGDS, fileOut=vcfFile, offset=0L, freqCutoff=NULL) ## Close GDS file (IMPORTANT) closefn.gds(fileGDS) ## Remove temporary VCF file unlink(vcfFile, force=TRUE)
This function extract the SNPs that pass a frequency cut-off in at least one super population from a GDS SNP information file and save the retained SNP information into a VCF file.
snvListVCFRef(pRAIDS, fileOut, freqCutoff = NULL)snvListVCFRef(pRAIDS, fileOut, freqCutoff = NULL)
pRAIDS |
a TODO. |
fileOut |
a |
freqCutoff |
a single positive |
The integer 0L when successful.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## TODO## TODO
A generic function for getting the specificSNV slot in a S4 object.
specificSNV(x)specificSNV(x)
x |
a S4 object. |
a value from the specificSNV slot in the S4 object.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(specificSNV="character")) # Create an instance obj <- new("MyClass", specificSNV="123") # Call the generic (assuming a method is implemented) # specificSNV(obj)# Define a dummy class to show usage setClass("MyClass", slots = list(specificSNV="character")) # Create an instance obj <- new("MyClass", specificSNV="123") # Call the generic (assuming a method is implemented) # specificSNV(obj)
A function for getting the specificSNV slot in a
RAIDSparam class.
## S4 method for signature 'RAIDSparam' specificSNV(x)## S4 method for signature 'RAIDSparam' specificSNV(x)
x |
a |
NULL or a data.frame containing 2 columns. The first
column, called "snp.chromosome" contains the name of the chromosome where
the SNV is located. The second column, called "snp.position", contains the
position of the SNV on the chromosome. Optionally, the column "snvKeep"
contains the SNV index in the reference or -1 if not in the reference. It
is used during the pruning step.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the specificSNV slot for the object specificSNV(paramDemo)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the specificSNV slot for the object specificSNV(paramDemo)
A generic function for replacement of specificSNV slot in a S4 object.
specificSNV(x) <- valuespecificSNV(x) <- value
x |
a S4 object. |
value |
the new value to assign or update. |
the modified S4 object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(specificSNV="character")) # Create an instance obj <- new("MyClass", specificSNV="123") # Call the generic (assuming a method is implemented) # specificSNV(obj) <- "333"# Define a dummy class to show usage setClass("MyClass", slots = list(specificSNV="character")) # Create an instance obj <- new("MyClass", specificSNV="123") # Call the generic (assuming a method is implemented) # specificSNV(obj) <- "333"
A function for replacement of specificSNV slot in a
RAIDSparam class.
## S4 replacement method for signature 'RAIDSparam' specificSNV(x) <- value## S4 replacement method for signature 'RAIDSparam' specificSNV(x) <- value
x |
a |
value |
|
the modified RAIDSparam object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign new value to the specificSNV slot in the object specificSNV(paramDemo) <- data.frame(snp.chromosome=c("1", "1"), snp.position=c(13333, 2222213))## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign new value to the specificSNV slot in the object specificSNV(paramDemo) <- data.frame(snp.chromosome=c("1", "1"), snp.position=c(13333, 2222213))
The function groups the samples per subcontinental population and generates a matrix containing the sample identifiers and where each column is a subcontinental population.
splitSelectByPop(dataRef)splitSelectByPop(dataRef)
dataRef |
a
|
a matrix containing the sample identifiers and where
each column is the name of a subcontinental population. The number of
row corresponds to the number of samples for each subcontinental population.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## A data.frame containing samples from 2 subcontinental populations demo <- data.frame(sample.id=c("SampleA", "SampleB", "SampleC", "SampleD"), pop.group=c("TSI", "TSI", "YRI", "YRI"), superPop=c("EUR", "EUR", "AFR", "AFR")) ## Generate a matrix populated with the sample identifiers and where ## each row is a subcontinental population splitSelectByPop(dataRef=demo)## A data.frame containing samples from 2 subcontinental populations demo <- data.frame(sample.id=c("SampleA", "SampleB", "SampleC", "SampleD"), pop.group=c("TSI", "TSI", "YRI", "YRI"), superPop=c("EUR", "EUR", "AFR", "AFR")) ## Generate a matrix populated with the sample identifiers and where ## each row is a subcontinental population splitSelectByPop(dataRef=demo)
A generic function for getting the studyDF slot in a
class. The function is implemented for the RAIDSparam class.
studyDF(x)studyDF(x)
x |
an object. |
an object.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
A function for getting the studyDF slot in a
RAIDSparam class.
## S4 method for signature 'RAIDSparam' studyDF(x)## S4 method for signature 'RAIDSparam' studyDF(x)
x |
a |
a data.frame.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the studyDF slot for the object studyDF(paramDemo)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the studyDF slot for the object studyDF(paramDemo)
A generic function for replacement of studyDF slot in a S4 object.
studyDF(x) <- valuestudyDF(x) <- value
x |
a S4 object. |
value |
the new value to assign or update. |
the modified S4 object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(studyDF="character")) # Create an instance obj <- new("MyClass", studyDF="123") # Call the generic (assuming a method is implemented) # studyDF(obj) <- "333"# Define a dummy class to show usage setClass("MyClass", slots = list(studyDF="character")) # Create an instance obj <- new("MyClass", studyDF="123") # Call the generic (assuming a method is implemented) # studyDF(obj) <- "333"
RAIDSparam objectA function for replacement of the studyDF slot in a
RAIDSparam class.
## S4 replacement method for signature 'RAIDSparam' studyDF(x) <- value## S4 replacement method for signature 'RAIDSparam' studyDF(x) <- value
x |
a |
value |
a |
the modified RAIDSparam object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Demo study data frame studyDF <- data.frame(study.id="TEST1", study.desc="Study1", study.platform="CSHL", stringsAsFactors=FALSE) ## Assign the new table to the studyDF slot in the object studyDF(paramDemo) <- studyDF## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Demo study data frame studyDF <- data.frame(study.id="TEST1", study.desc="Study1", study.platform="CSHL", stringsAsFactors=FALSE) ## Assign the new table to the studyDF slot in the object studyDF(paramDemo) <- studyDF
A generic function for getting the studyDFSyn slot in a
class. The function is implemented for the RAIDSparam class.
studyDFSyn(x)studyDFSyn(x)
x |
an object. |
an object.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
A function for getting the studyDFSyn slot in a
RAIDSparam class.
## S4 method for signature 'RAIDSparam' studyDFSyn(x)## S4 method for signature 'RAIDSparam' studyDFSyn(x)
x |
a |
a data.frame.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the studyDFSyn slot for the object studyDFSyn(paramDemo)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the studyDFSyn slot for the object studyDFSyn(paramDemo)
A generic function for replacement of studyDFSyn slot in a S4 object.
studyDFSyn(x) <- valuestudyDFSyn(x) <- value
x |
an S4 object. |
value |
the new value to assign or update. |
the modified S4 object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(studyDFSyn="character")) # Create an instance obj <- new("MyClass", studyDFSyn="123") # Call the generic (assuming a method is implemented) # studyDFSyn(obj) <- "333"# Define a dummy class to show usage setClass("MyClass", slots = list(studyDFSyn="character")) # Create an instance obj <- new("MyClass", studyDFSyn="123") # Call the generic (assuming a method is implemented) # studyDFSyn(obj) <- "333"
RAIDSparam objectA function for replacement of the studyDFSyn slot in a
RAIDSparam class.
## S4 replacement method for signature 'RAIDSparam' studyDFSyn(x) <- value## S4 replacement method for signature 'RAIDSparam' studyDFSyn(x) <- value
x |
a |
value |
a |
the modified RAIDSparam object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Demo synthetic study data frame studyDFSyn <- data.frame(study.id="TEST1", study.desc="Synthetic", study.platform="CSHL", stringsAsFactors=FALSE) ## Assign the new table to the studyDFSyn slot in the object studyDFSyn(paramDemo) <- studyDFSyn## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Demo synthetic study data frame studyDFSyn <- data.frame(study.id="TEST1", study.desc="Synthetic", study.platform="CSHL", stringsAsFactors=FALSE) ## Assign the new table to the studyDFSyn slot in the object studyDFSyn(paramDemo) <- studyDFSyn
A generic function for getting the studyType slot in a S4 object.
studyType(x)studyType(x)
x |
a S4 object. |
a value from the studyType slot in the S4 object.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(studyType="character")) # Create an instance obj <- new("MyClass", studyType="123") # Call the generic (assuming a method is implemented) # studyType(obj)# Define a dummy class to show usage setClass("MyClass", slots = list(studyType="character")) # Create an instance obj <- new("MyClass", studyType="123") # Call the generic (assuming a method is implemented) # studyType(obj)
A function for getting the studyType slot in a
RAIDSparam class.
## S4 method for signature 'RAIDSparam' studyType(x)## S4 method for signature 'RAIDSparam' studyType(x)
x |
a |
a single character string representing the type
of study.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the studyType slot for the object studyType(paramDemo)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the studyType slot for the object studyType(paramDemo)
A generic function for replacement of studyType slot in a S4 object.
studyType(x) <- valuestudyType(x) <- value
x |
a S4 object. |
value |
the new value to assign or update. |
the modified S4 object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(studyType="character")) # Create an instance obj <- new("MyClass", studyType="123") # Call the generic (assuming a method is implemented) # studyType(obj) <- "333"# Define a dummy class to show usage setClass("MyClass", slots = list(studyType="character")) # Create an instance obj <- new("MyClass", studyType="123") # Call the generic (assuming a method is implemented) # studyType(obj) <- "333"
A function for replacement of studyType slot in a
RAIDSparam class.
## S4 replacement method for signature 'RAIDSparam' studyType(x) <- value## S4 replacement method for signature 'RAIDSparam' studyType(x) <- value
x |
a |
value |
a single |
the modified RAIDSparam object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign the new study type to the studyType slot in the object studyType(paramDemo) <- "GeneAware"## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign the new study type to the studyType slot in the object studyType(paramDemo) <- "GeneAware"
The functions uses one cancer profile in combination with one 1KG reference profile to generate an synthetic profile that is saved in the Profile GDS file.
When more than one 1KG reference profiles are specified, the function recursively generates synthetic profiles for each cancer profile + 1KG reference profile combination.
The number of synthetic profiles generated by combination is specified by the number of simulation requested.
syntheticGeno( gdsReference, gdsRefAnnot, fileProfileGDS, profileID, listSampleRef, nbSim = 1L, prefix = "", pRecomb = 0.01, minProb = 0.999, seqError = 0.001 )syntheticGeno( gdsReference, gdsRefAnnot, fileProfileGDS, profileID, listSampleRef, nbSim = 1L, prefix = "", pRecomb = 0.01, minProb = 0.999, seqError = 0.001 )
gdsReference |
an object of class |
gdsRefAnnot |
an object of class |
fileProfileGDS |
a |
profileID |
a |
listSampleRef |
a |
nbSim |
a single positive |
prefix |
a |
pRecomb |
a single positive |
minProb |
a single positive |
seqError |
a single positive |
The integer OL when the function is successful.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Required library library(gdsfmt) ## Path to the demo 1KG GDS file is located in this package dataDir <- system.file("extdata/tests", package="RAIDS") ## Profile GDS file (temporary) fileNameGDS <- file.path(tempdir(), "ex1.gds") ## Copy the Profile GDS file demo that has been pruned and annotated file.copy(file.path(dataDir, "ex1_demo_with_pruning_and_1KG_annot.gds"), fileNameGDS) ## Information about the synthetic data set syntheticStudyDF <- data.frame(study.id="MYDATA.Synthetic", study.desc="MYDATA synthetic data", study.platform="PLATFORM", stringsAsFactors=FALSE) ## Add information related to the synthetic profiles into the Profile GDS prepSynthetic(fileProfileGDS=fileNameGDS, listSampleRef=c("HG00243", "HG00150"), profileID="ex1", studyDF=syntheticStudyDF, nbSim=1L, prefix="synthTest", verbose=FALSE) ## The 1KG files gds1KG <- snpgdsOpen(file.path(dataDir, "ex1_good_small_1KG.gds")) gds1KGAnnot <- openfn.gds(file.path(dataDir, "ex1_good_small_1KG_Annot.gds")) ## Generate the synthetic profiles and add them into the Profile GDS syntheticGeno(gdsReference=gds1KG, gdsRefAnnot=gds1KGAnnot, fileProfileGDS=fileNameGDS, profileID="ex1", listSampleRef=c("HG00243", "HG00150"), nbSim=1, prefix="synthTest", pRecomb=0.01, minProb=0.999, seqError=0.001) ## Open Profile GDS file profileGDS <- openfn.gds(fileNameGDS) tail(read.gdsn(index.gdsn(profileGDS, "sample.id"))) ## Close GDS files (important) closefn.gds(profileGDS) closefn.gds(gds1KG) closefn.gds(gds1KGAnnot) ## Remove Profile GDS file (created for demo purpose) unlink(fileNameGDS, force=TRUE)## Required library library(gdsfmt) ## Path to the demo 1KG GDS file is located in this package dataDir <- system.file("extdata/tests", package="RAIDS") ## Profile GDS file (temporary) fileNameGDS <- file.path(tempdir(), "ex1.gds") ## Copy the Profile GDS file demo that has been pruned and annotated file.copy(file.path(dataDir, "ex1_demo_with_pruning_and_1KG_annot.gds"), fileNameGDS) ## Information about the synthetic data set syntheticStudyDF <- data.frame(study.id="MYDATA.Synthetic", study.desc="MYDATA synthetic data", study.platform="PLATFORM", stringsAsFactors=FALSE) ## Add information related to the synthetic profiles into the Profile GDS prepSynthetic(fileProfileGDS=fileNameGDS, listSampleRef=c("HG00243", "HG00150"), profileID="ex1", studyDF=syntheticStudyDF, nbSim=1L, prefix="synthTest", verbose=FALSE) ## The 1KG files gds1KG <- snpgdsOpen(file.path(dataDir, "ex1_good_small_1KG.gds")) gds1KGAnnot <- openfn.gds(file.path(dataDir, "ex1_good_small_1KG_Annot.gds")) ## Generate the synthetic profiles and add them into the Profile GDS syntheticGeno(gdsReference=gds1KG, gdsRefAnnot=gds1KGAnnot, fileProfileGDS=fileNameGDS, profileID="ex1", listSampleRef=c("HG00243", "HG00150"), nbSim=1, prefix="synthTest", pRecomb=0.01, minProb=0.999, seqError=0.001) ## Open Profile GDS file profileGDS <- openfn.gds(fileNameGDS) tail(read.gdsn(index.gdsn(profileGDS, "sample.id"))) ## Close GDS files (important) closefn.gds(profileGDS) closefn.gds(gds1KG) closefn.gds(gds1KGAnnot) ## Remove Profile GDS file (created for demo purpose) unlink(fileNameGDS, force=TRUE)
The functions uses one cancer profile in combination with one 1KG reference profile to generate an synthetic profile that is saved in the Profile GDS file.
When more than one 1KG reference profiles are specified, the function recursively generates synthetic profiles for each cancer profile + 1KG reference profile combination.
The number of synthetic profiles generated by combination is specified by the number of simulation requested.
syntheticGeno2(pRAIDS)syntheticGeno2(pRAIDS)
pRAIDS |
a |
The integer OL when the function is successful.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Required library library(gdsfmt) ## Path to the demo 1KG GDS file is located in this package dataDir <- system.file("extdata/tests", package="RAIDS") ## Profile GDS file (temporary) pathProfileGDS <- tempdir() fileNameGDS <- file.path(pathProfileGDS, "ex1.gds") ## Copy the Profile GDS file demo that has been pruned and annotated file.copy(file.path(dataDir, "ex1_demo_with_pruning_and_1KG_annot.gds"), fileNameGDS) studyDF <- data.frame(study.id = "MYDATA", study.desc = "Description", study.platform = "PLATFORM", stringsAsFactors = FALSE) samplePED <- data.frame(Name.ID = c("ex1", "ex2"), Case.ID = c("Patient_h11", "Patient_h12"), Diagnosis = rep("Cancer", 2), Sample.Type = rep("Primary Tumor", 2), Source = rep("Databank B", 2), stringsAsFactors = FALSE) rownames(samplePED) <- samplePED$Name.ID pRAIDS <- RAIDSparam(profileFile=file.path(dataDir, "ex1.txt.gz"), genoSource="snp-pileup", studyDF=studyDF, pedStudy=samplePED, prefix="synthTest", pathProfileGDS=pathProfileGDS, fileReferenceGDS=file.path(dataDir, "ex1_good_small_1KG.gds"), fileReferenceAnnotGDS=file.path(dataDir, "ex1_good_small_1KG_Annot.gds") ) syntheticRefDF(pRAIDS) <- selectForSynthetic(pRAIDS = pRAIDS, nbProfiles=30L) ## Generate the synthetic profiles and add them into the Profile GDS syntheticGeno2(pRAIDS) profileGDS <- openfn.gds(fileNameGDS) tail(read.gdsn(index.gdsn(profileGDS, "sample.id"))) ## Close GDS files (important) closefn.gds(profileGDS) ## Remove Profile GDS file (created for demo purpose) unlink(fileNameGDS, force=TRUE)## Required library library(gdsfmt) ## Path to the demo 1KG GDS file is located in this package dataDir <- system.file("extdata/tests", package="RAIDS") ## Profile GDS file (temporary) pathProfileGDS <- tempdir() fileNameGDS <- file.path(pathProfileGDS, "ex1.gds") ## Copy the Profile GDS file demo that has been pruned and annotated file.copy(file.path(dataDir, "ex1_demo_with_pruning_and_1KG_annot.gds"), fileNameGDS) studyDF <- data.frame(study.id = "MYDATA", study.desc = "Description", study.platform = "PLATFORM", stringsAsFactors = FALSE) samplePED <- data.frame(Name.ID = c("ex1", "ex2"), Case.ID = c("Patient_h11", "Patient_h12"), Diagnosis = rep("Cancer", 2), Sample.Type = rep("Primary Tumor", 2), Source = rep("Databank B", 2), stringsAsFactors = FALSE) rownames(samplePED) <- samplePED$Name.ID pRAIDS <- RAIDSparam(profileFile=file.path(dataDir, "ex1.txt.gz"), genoSource="snp-pileup", studyDF=studyDF, pedStudy=samplePED, prefix="synthTest", pathProfileGDS=pathProfileGDS, fileReferenceGDS=file.path(dataDir, "ex1_good_small_1KG.gds"), fileReferenceAnnotGDS=file.path(dataDir, "ex1_good_small_1KG_Annot.gds") ) syntheticRefDF(pRAIDS) <- selectForSynthetic(pRAIDS = pRAIDS, nbProfiles=30L) ## Generate the synthetic profiles and add them into the Profile GDS syntheticGeno2(pRAIDS) profileGDS <- openfn.gds(fileNameGDS) tail(read.gdsn(index.gdsn(profileGDS, "sample.id"))) ## Close GDS files (important) closefn.gds(profileGDS) ## Remove Profile GDS file (created for demo purpose) unlink(fileNameGDS, force=TRUE)
A generic function for getting the syntheticRefDF slot in a S4 object.
syntheticRefDF(x)syntheticRefDF(x)
x |
a S4 object. |
a value from the syntheticRefDF slot in the S4 object.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(syntheticRefDF="character")) # Create an instance obj <- new("MyClass", syntheticRefDF="123") # Call the generic (assuming a method is implemented) # syntheticRefDF(obj)# Define a dummy class to show usage setClass("MyClass", slots = list(syntheticRefDF="character")) # Create an instance obj <- new("MyClass", syntheticRefDF="123") # Call the generic (assuming a method is implemented) # syntheticRefDF(obj)
A function for getting the syntheticRefDF slot in a
RAIDSparam class.
## S4 method for signature 'RAIDSparam' syntheticRefDF(x)## S4 method for signature 'RAIDSparam' syntheticRefDF(x)
x |
a |
NULL or a data.frame containing a subset of
reference profiles for each sub-population present in the Reference GDS
file.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the syntheticRefDF slot for the object syntheticRefDF(paramDemo)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the syntheticRefDF slot for the object syntheticRefDF(paramDemo)
A generic function for replacement of syntheticRefDF slot in a S4 object.
syntheticRefDF(x) <- valuesyntheticRefDF(x) <- value
x |
a S4 object. |
value |
the new value to assign or update. |
the modified S4 object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(syntheticRefDF="character")) # Create an instance obj <- new("MyClass", syntheticRefDF="123") # Call the generic (assuming a method is implemented) # syntheticRefDF(obj) <- "333"# Define a dummy class to show usage setClass("MyClass", slots = list(syntheticRefDF="character")) # Create an instance obj <- new("MyClass", syntheticRefDF="123") # Call the generic (assuming a method is implemented) # syntheticRefDF(obj) <- "333"
A function for replacement of syntheticRefDF slot in a
RAIDSparam class.
## S4 replacement method for signature 'RAIDSparam' syntheticRefDF(x) <- value## S4 replacement method for signature 'RAIDSparam' syntheticRefDF(x) <- value
x |
a |
value |
|
the modified RAIDSparam object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign new values to the syntheticRefDF slot in the object syntheticRefDF(paramDemo) <- data.frame(sample.id=c("A", "B"), pop.group=c("CEU", "CEU"), superPop=c("EUR", "EUR"))## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign new values to the syntheticRefDF slot in the object syntheticRefDF(paramDemo) <- data.frame(sample.id=c("A", "B"), pop.group=c("CEU", "CEU"), superPop=c("EUR", "EUR"))
A generic function for getting the thresholdLD slot in a S4 object.
thresholdLD(x)thresholdLD(x)
x |
a S4 object. |
a value from the thresholdLD slot in the S4 object.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(thresholdLD="character")) # Create an instance obj <- new("MyClass", thresholdLD="123") # Call the generic (assuming a method is implemented) # thresholdLD(obj)# Define a dummy class to show usage setClass("MyClass", slots = list(thresholdLD="character")) # Create an instance obj <- new("MyClass", thresholdLD="123") # Call the generic (assuming a method is implemented) # thresholdLD(obj)
A function for getting the thresholdLD slot in a
RAIDSparam class.
## S4 method for signature 'RAIDSparam' thresholdLD(x)## S4 method for signature 'RAIDSparam' thresholdLD(x)
x |
a |
a single positive numeric value that represents
the LD threshold used in the snpgdsLDpruning
function.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the thresholdLD slot for the object thresholdLD(paramDemo)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the thresholdLD slot for the object thresholdLD(paramDemo)
A generic function for replacement of thresholdLD slot in a S4 object.
thresholdLD(x) <- valuethresholdLD(x) <- value
x |
a S4 object. |
value |
the new value to assign or update. |
the modified S4 object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(thresholdLD="character")) # Create an instance obj <- new("MyClass", thresholdLD="123") # Call the generic (assuming a method is implemented) # thresholdLD(obj) <- "333"# Define a dummy class to show usage setClass("MyClass", slots = list(thresholdLD="character")) # Create an instance obj <- new("MyClass", thresholdLD="123") # Call the generic (assuming a method is implemented) # thresholdLD(obj) <- "333"
A function for replacement of thresholdLD slot in a
RAIDSparam class.
## S4 replacement method for signature 'RAIDSparam' thresholdLD(x) <- value## S4 replacement method for signature 'RAIDSparam' thresholdLD(x) <- value
x |
a |
value |
a single positive |
the modified RAIDSparam object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign new value to the thresholdLD slot in the object thresholdLD(paramDemo) <- 1000L## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign new value to the thresholdLD slot in the object thresholdLD(paramDemo) <- 1000L
A generic function for getting the verbose slot in a S4 object.
verbose(x)verbose(x)
x |
a S4 object. |
a value from the verbose slot in the S4 object.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(verbose="character")) # Create an instance obj <- new("MyClass", verbose="123") # Call the generic (assuming a method is implemented) # verbose(obj)# Define a dummy class to show usage setClass("MyClass", slots = list(verbose="character")) # Create an instance obj <- new("MyClass", verbose="123") # Call the generic (assuming a method is implemented) # verbose(obj)
A function for getting the verbose slot in a
RAIDSparam class.
## S4 method for signature 'RAIDSparam' verbose(x)## S4 method for signature 'RAIDSparam' verbose(x)
x |
a |
a single logical indicating if message information should be
printed.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the verbose slot for the object verbose(paramDemo)## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Extract the verbose slot for the object verbose(paramDemo)
A generic function for replacement of verbose slot in a S4 object.
verbose(x) <- valueverbose(x) <- value
x |
a S4 object. |
value |
the new value to assign or update. |
the modified S4 object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
# Define a dummy class to show usage setClass("MyClass", slots = list(verbose="character")) # Create an instance obj <- new("MyClass", verbose="123") # Call the generic (assuming a method is implemented) # verbose(obj) <- "333"# Define a dummy class to show usage setClass("MyClass", slots = list(verbose="character")) # Create an instance obj <- new("MyClass", verbose="123") # Call the generic (assuming a method is implemented) # verbose(obj) <- "333"
A function for replacement of verbose slot in a
RAIDSparam class.
## S4 replacement method for signature 'RAIDSparam' verbose(x) <- value## S4 replacement method for signature 'RAIDSparam' verbose(x) <- value
x |
a |
value |
a single |
the modified RAIDSparam object when the new value is valid.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign new value to the verbose slot in the object verbose(paramDemo) <- TRUE## Create a RAIDSparam object paramDemo <- RAIDSparam() ## Assign new value to the verbose slot in the object verbose(paramDemo) <- TRUE
This function extract the SNPs that pass a frequency cut-off in at least one super population from a GDS SNP information file and save the retained SNP information into a VCF file.
writeBedProfile( fileOut, listProfile, listRM = NULL, profileOnly = FALSE, pRAIDS )writeBedProfile( fileOut, listProfile, listRM = NULL, profileOnly = FALSE, pRAIDS )
fileOut |
a |
listProfile |
a |
listRM |
a |
profileOnly |
a |
pRAIDS |
a |
The integer 0L when successful.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## 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/demoAncestryCall", package="RAIDS") pathOut <- file.path(tempdir(), "out.tmp") if(!dir.exists(pathOut)){ dir.create(pathOut) } # 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") writeBedProfile(fileOut=file.path(pathOut, paste0(pedStudy(pRAIDS)$Name.ID[1], ".bed")), listProfile=pedStudy(pRAIDS)$Name.ID[1], profileOnly = TRUE, pRAIDS=pRAIDS) dir(file.path(pathOut)) unlink(file.path(pathOut, paste0(pedStudy(pRAIDS)$Name.ID[1], ".bed"))) unlink(file.path(pathOut), recursive=TRUE)## 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/demoAncestryCall", package="RAIDS") pathOut <- file.path(tempdir(), "out.tmp") if(!dir.exists(pathOut)){ dir.create(pathOut) } # 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") writeBedProfile(fileOut=file.path(pathOut, paste0(pedStudy(pRAIDS)$Name.ID[1], ".bed")), listProfile=pedStudy(pRAIDS)$Name.ID[1], profileOnly = TRUE, pRAIDS=pRAIDS) dir(file.path(pathOut)) unlink(file.path(pathOut, paste0(pedStudy(pRAIDS)$Name.ID[1], ".bed"))) unlink(file.path(pathOut), recursive=TRUE)
This function extract the SNPs that pass a frequency cut-off in at least one super population from a GDS SNP information file and save the retained SNP information into a VCF file.
writeBimPruned(fileOut, pRAIDS)writeBimPruned(fileOut, pRAIDS)
fileOut |
a |
pRAIDS |
a |
The integer 0L when successful.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## 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/demoAncestryCall", package="RAIDS") pathOut <- file.path(tempdir(), "out.tmp") if(!dir.exists(pathOut)){ dir.create(pathOut) } # 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") writeBimPruned(file.path(pathOut, "test.bim"), pRAIDS) dir(file.path(pathOut)) unlink(file.path(pathOut, "test.bim")) unlink(file.path(pathOut), recursive=TRUE)## 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/demoAncestryCall", package="RAIDS") pathOut <- file.path(tempdir(), "out.tmp") if(!dir.exists(pathOut)){ dir.create(pathOut) } # 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") writeBimPruned(file.path(pathOut, "test.bim"), pRAIDS) dir(file.path(pathOut)) unlink(file.path(pathOut, "test.bim")) unlink(file.path(pathOut), recursive=TRUE)
This function extract the SNPs that pass a frequency cut-off in at least one super population from a GDS SNP information file and save the retained SNP information into a VCF file.
writeFamProfile( fileOut, listProfile, listRM = NULL, profileOnly = FALSE, pRAIDS )writeFamProfile( fileOut, listProfile, listRM = NULL, profileOnly = FALSE, pRAIDS )
fileOut |
a |
listProfile |
a |
listRM |
a TODO. Default: |
profileOnly |
a |
pRAIDS |
a |
The integer 0L when successful.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## 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/demoAncestryCall", package="RAIDS") pathOut <- file.path(tempdir(), "out.tmp") if(!dir.exists(pathOut)){ dir.create(pathOut) } # 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") writeFamProfile(fileOut=file.path(pathOut, paste0(pedStudy(pRAIDS)$Name.ID[1], ".fam")), listProfile=pedStudy(pRAIDS)$Name.ID[1], profileOnly = TRUE, pRAIDS=pRAIDS) dir(file.path(pathOut)) unlink(file.path(pathOut, paste0(pedStudy(pRAIDS)$Name.ID[1], ".fam"))) unlink(file.path(pathOut), recursive=TRUE)## 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/demoAncestryCall", package="RAIDS") pathOut <- file.path(tempdir(), "out.tmp") if(!dir.exists(pathOut)){ dir.create(pathOut) } # 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") writeFamProfile(fileOut=file.path(pathOut, paste0(pedStudy(pRAIDS)$Name.ID[1], ".fam")), listProfile=pedStudy(pRAIDS)$Name.ID[1], profileOnly = TRUE, pRAIDS=pRAIDS) dir(file.path(pathOut)) unlink(file.path(pathOut, paste0(pedStudy(pRAIDS)$Name.ID[1], ".fam"))) unlink(file.path(pathOut), recursive=TRUE)
This function write with P-matrix
writePMatrix(pathOut, rowF, pRAIDS)writePMatrix(pathOut, rowF, pRAIDS)
pathOut |
a |
rowF |
a |
pRAIDS |
a |
a array of the frequency matrix.
Pascal Belleau, Astrid Deschênes and Alexander Krasnitz
## see computePmatrix## see computePmatrix