R/tools.R
generateVCF.RdThis 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)a single positive numeric specifying the cut-off to
keep a SNP. If NULL, all SNPs are retained. Default: NULL.
a integer between 1 to 22
chr1:22 specify SNP retained are on chr.
If NULL, all SNPs are retained. Default: NULL.
a character string representing the path and
the file name of the new VCF.
a RAIDSparam an object with all the RAIDS
parameters
The integer 0L when successful.
## 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)
#> Warning: appending column names to file
#> [1] 0
## Close GDS file (IMPORTANT)
closefn.gds(fileGDS)
## Remove temporary VCF file
unlink(vcfFile, force=TRUE)