Learn R Programming

dartR.base (version 0.98)

gl2vcf: Converts a genlight object into vcf format

Description

This function exports a genlight object into VCF format and save it into a file.

Usage

gl2vcf(
  x,
  plink.bin.path = getwd(),
  outfile = "gl_vcf",
  outpath = NULL,
  snp.pos = "0",
  snp.chr = "0",
  chr.format = "character",
  pos.cM = "0",
  ID.dad = "0",
  ID.mum = "0",
  sex.code = "unknown",
  phen.value = "0",
  verbose = NULL
)

Value

returns no value (i.e. NULL)

Arguments

x

Name of the genlight object containing the SNP data [required].

plink.bin.path

Path of PLINK binary file [default getwd())].

outfile

File name of the output file [default 'gl_vcf'].

outpath

Path where to save the output file [default global working directory or if not specified, tempdir()].

snp.pos

Field name from the slot loc.metrics where the SNP position is stored [default '0'].

snp.chr

Field name from the slot loc.metrics where the chromosome of each is stored [default '0'].

chr.format

Whether chromosome information is stored as 'numeric' or as 'character', see details [default 'character'].

pos.cM

A vector, with as many elements as there are loci, containing the SNP position in morgans or centimorgans [default '0'].

ID.dad

A vector, with as many elements as there are individuals, containing the ID of the father, '0' if father isn't in dataset [default '0'].

ID.mum

A vector, with as many elements as there are individuals, containing the ID of the mother, '0' if mother isn't in dataset [default '0'].

sex.code

A vector, with as many elements as there are individuals, containing the sex code ('male', 'female', 'unknown') [default 'unknown'].

phen.value

A vector, with as many elements as there are individuals, containing the phenotype value. '1' = control, '2' = case, '0' = unknown [default '0'].

verbose

Verbosity: 0, silent or fatal errors; 1, begin and end; 2, progress log; 3, progress and results summary; 5, full report [default 2 or as specified using gl.set.verbosity].

Author

Custodian: Luis Mijangos (Post to https://groups.google.com/d/forum/dartr)

Details

This function requires to download the binary file of PLINK 1.9 and provide its path (plink.bin.path). The binary file can be downloaded from: https://www.cog-genomics.org/plink/ The chromosome information for unmapped SNPS is coded as 0. Family ID is taken from x$pop Within-family ID (cannot be '0') is taken from indNames(x) Variant identifier is taken from locNames(x)

References

Danecek, P., Auton, A., Abecasis, G., Albers, C. A., Banks, E., DePristo, M. A., ... & 1000 Genomes Project Analysis Group. (2011). The variant call format and VCFtools. Bioinformatics, 27(15), 2156-2158.

See Also

Other linker: gl2bayesAss(), gl2bayescan(), gl2bpp(), gl2demerelate(), gl2eigenstrat(), gl2faststructure(), gl2gds(), gl2genalex(), gl2genepop(), gl2geno(), gl2gi(), gl2hiphop(), gl2phylip(), gl2plink(), gl2related(), gl2sa(), gl2structure(), gl2treemix()

Examples

Run this code
if (FALSE) {
#this example needs plink installed to work
require("dartR.data")
gl2vcf(platypus.gl,snp.pos='ChromPos_Platypus_Chrom_NCBIv1',
 snp.chr = 'Chrom_Platypus_Chrom_NCBIv1')
}

Run the code above in your browser using DataLab