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
)

Arguments

fileOut

a character string representing the path and the file name of the new fam file.

listProfile

a vector of character representing the list of profile from gdsProfile to keep.

listRM

a TODO. Default: NULL.

profileOnly

a integer TODO. Default: FALSE.

pRAIDS

a RAIDSparam an object with all the RAIDS parameters.

Value

The integer 0L when successful.

Author

Pascal Belleau, Astrid Deschênes and Alexander Krasnitz

Examples


## 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)
#> Writing: /tmp/Rtmp46wk9V/out.tmp/ex1.fam
#> [1] 0

dir(file.path(pathOut))
#> [1] "ex1.fam"

unlink(file.path(pathOut, paste0(pedStudy(pRAIDS)$Name.ID[1], ".fam")))
unlink(file.path(pathOut), recursive=TRUE)