gl2hapmap: Converts a genlight object into HapMap format

View source: R/gl2hapmap.r

gl2hapmapR Documentation

Converts a genlight object into HapMap format

Description

Convert a genlight object into HapMap format, producing a file with the standard columns for SNP marker ID, chromosome, position, allele definitions and per-sample genotype calls encoded as nucleotide pairs.

The chromosome information for unmapped SNPs is coded as 0, and the position of SNPs without chromosome-scale position information is likewise coded as 0.

Usage

gl2hapmap(
  x,
  outfile = "gl_hapmap",
  outpath = NULL,
  chrom = NULL,
  pos = NULL,
  strand = "+",
  assembly = "",
  center = NA,
  protLSID = NA,
  assayLSID = NA,
  panelLSID = NA,
  QCcode = NA,
  verbose = NULL
)

Arguments

x

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

outfile

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

outpath

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

chrom

Field name from the slot loc.metrics where the chromosome of each SNP is stored; if supplied, this field takes precedence over the chromosome slot [default NULL].

pos

Field name from the slot loc.metrics where the SNP position is stored; if supplied, this field takes precedence over the position slot [default NULL].

strand

Orientation of the SNP in the DNA strand. Thus, SNPs could be in the forward (+) or in the reverse (-) orientation relative to the reference genome [default "+"].

assembly

Version of reference sequence assembly (from NCBI) [default ""].

center

Name of genotyping center that produced the genotypes [default NA].

protLSID

Identifier for HapMap protocol [default NA].

assayLSID

Identifier HapMap assay used for genotyping [default NA].

panelLSID

Identifier for panel of individuals genotyped [default NA].

QCcode

Quality control for all entries [default NA].

verbose

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

Value

returns no value (i.e. NULL)

Author(s)

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

See Also

Other linker: gi2gl(), gl2bayesAss(), gl2bayescan(), gl2bpp(), gl2demerelate(), gl2eigenstrat(), gl2faststructure(), gl2gapit(), gl2gds(), gl2genalex(), gl2genepop(), gl2geno(), gl2gi(), gl2hiphop(), gl2related(), gl2snapper(), gl2structure(), gl2treemix(), gl2vcf()

Examples


require("dartR.data")
# SNP data
if (isTRUE(getOption("dartR_fbm"))) platypus.gl <- gl.gen2fbm(platypus.gl)
gl2hapmap(platypus.gl, outpath = tempdir())



dartR.base documentation built on Nov. 18, 2026, 9:06 a.m.