#' @export
vcf2plink <- function(vcf, out, mode = 1L) {
if(missing(out)) out <- rm.extension(vcf)
# Checking if required programs are installed on system path
program_on_path("plink")
# Checking mode
if(!mode %in% 1:2)
stop("mode must be 1 (for binary files ─ .bed/.bim/.fam) or 2 (for human-readable files ─ .ped/.map).")
# Conversion from VCF to Plink format
if(mode == 1L) {
# Conversion from VCF to Plink binary format
plink(`--vcf` = vcf, "--make-bed", `--out` = out)
} else {
# Conversion from VCF to Plink human-readable format
plink(`--vcf` = vcf, "--recode", `--out` = out)
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.