Skip to contents

This converts files in the VCF format (i.e. name.vcf) into PLINK v1.9 format (i.e. name.bed, name.bim, and name.fam) and/or PLINK v2.0 format (i.e. name.pvar, name.psam, and name.pgen)

Usage

convert_from_vcf(
  indir,
  name,
  qcdir = indir,
  verbose = FALSE,
  path2plink2 = NULL,
  gzipped = FALSE,
  makebed = TRUE,
  makepgen = FALSE,
  showPlinkOutput = TRUE
)

Arguments

indir

[character] /path/to/directory containing the basic vcf file, name.vcf or name.vcf.gz

name

[character] Prefix of VCF files, i.e. name.vcf or name.vcf.gz

qcdir

[character] /path/to/directory where the plink1.9 or plink2 data formations as returned by plink2 –vcf –make-bed or plink2 –vcf –make-pgen will be saved to. User needs writing permission to qcdir. Per default is qcdir=indir.

verbose

[logical] If TRUE, progress info is printed to standard out.

[character] Absolute path to PLINK executable (https://www.cog-genomics.org/plink/2.0/) i.e. plink 2 should be accessible as path2plink -h. The full name of the executable should be specified: for windows OS, this means path/plink.exe, for unix platforms this is path/plink. If not provided, assumed that PATH set-up works and PLINK will be found by exec('plink').

gzipped

[logical] Put as TRUE if the vcf file is gzipped (i.e. name.vcf.gz)

makebed

[logical] If TRUE, will output PLINK v1.9 files (i.e. name.bed, name.bim, and name.fam)

makepgen

[logical] If TRUE, will output PLINK v2.0 files (i.e. name.pvar, name.psam, and name.pgen)

showPlinkOutput

[logical] If TRUE, plink log and error messages are printed to standard out.

Value

Creates PLINK v1.9 or PLINK v2.0 datafiles

Examples

indir <- system.file("extdata", package="plinkQC")
qcdir <- tempdir()
name <- "data"
path2plink <- '/path/to/plink'
if (FALSE) { # \dontrun{
# the following code is not run on package build, as the path2plink on the
# user system is not known.
convert_to_plink2(indir=indir, qcdir=qcdir, name=name, path2plink2 = path2plink2)
} # }