Mega2VCF: generate a VCF file set for a collection of markers

View source: R/mega2vcf.R

Mega2VCFR Documentation

generate a VCF file set for a collection of markers

Description

Generate a VCF file from the specified Mega2 SQLite database. The file is named "prefix".vcf If the markers argument is.null(), the entire envir$markers set is used, otherwise markers argument MUST be rows of the markers (envir$markers) data frame. In addition, several other files are generated to hold additional database information: "prefix".fam, "prefix".freq, "prefix".map, "prefix".phe, and "prefix".pen, which contain the pedigree, allele frequency, marker genetic and physical map position, member phenotype and phenotype penetrance data.

Usage

Mega2VCF(
  prefix,
  markers = NULL,
  mapno = 0,
  alleleOrder = "default",
  envir = ENV
)

Arguments

prefix

prefix of output files including the VCF file (see Description section above). This prefix can include a path.

markers

markers selected to be in the VCF output file

mapno

specify which map index to use for genetic distances. The function showMapNames() will print out the internal map numbers corresponding to all the maps in the Mega2 database.

alleleOrder

how to order alleles in VCF file. 'default' is Mega2order, 'minor' is minor allele freq first, 'major' is major allele freq first, and 'name' is ascending ascii character order of allele name.

envir

'environment' containing SQLite database and other globals

Value

None

Note

This code in this package illustrates how to extract the various kinds of data in the Mega2 data frames to use for further processing. Some of the data internal representations are a bit quirky but the code "explains" it all.

Examples

db = system.file("exdata", "seqsimm.db", package="Mega2R")
ENV = read.Mega2DB(db)
vcfdir = file.path(where_mega2rtutorial_data(), "vcfr")
if (!dir.exists(vcfdir)) dir.create(vcfdir)
vcffile = file.path(where_mega2rtutorial_data(), "vcfr", "vcf.01")
Mega2VCF(vcffile, ENV$markers[ENV$markers$chromosome == 1, ][1:10,], envir = ENV)
list.files(vcfdir)


Mega2R documentation built on May 29, 2024, 1:14 a.m.