gl2gapit: Converts a genlight object into a format suitable for input...

View source: R/gl2gapit.r

gl2gapitR Documentation

Converts a genlight object into a format suitable for input to GAPIT

Description

Converts a genlight object containing SNP data into a hapmap-style data.frame as expected by GAPIT (Genome Association and Prediction Integrated Tool) and writes it to file as tab-delimited text.

Usage

gl2gapit(x, outfile = "gl_gapit", outpath = NULL, verbose = NULL)

Arguments

x

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

outfile

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

outpath

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

verbose

Verbosity: 0, silent or fatal errors; 1, begin and end; 2, progress log; 3, progress and results summary; 5, full report [default NULL, adopting the global verbosity set by gl.set.verbosity(), or 2 if no global is set].

Details

The returned data.frame follows the hapmap layout that GAPIT reads with header = FALSE: the first row repeats the column names, the first eleven columns are the hapmap descriptors (rs, alleles, chrom, pos, strand, assembly, center, protLSID, assayLSID, panel, QCcode) and each remaining column carries one individual. Genotypes double the allele letters (for example CC, CT) and missing data is coded 00.

Chromosome names are recoded to integer codes assigned in alphabetical order of the distinct names; the name-to-code mapping is reported at verbose >= 2. If the chromosome or position slot is empty, dummy values are used (chromosome 1 for all loci; positions 1 to the number of loci) with a warning at verbose >= 2.

The data.frame is written to file.path(outpath, outfile) as tab-delimited text without quotes, ready for GAPIT to read.

Value

The hapmap-style data.frame, returned invisibly.

Author(s)

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

See Also

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

Examples


t1 <- platypus.gl
# assigning chromosome
t1$chromosome <- t1$other$loc.metrics$Chrom_Platypus_Chrom_NCBIv1
# assigning SNP position
t1$position <- t1$other$loc.metrics$ChromPos_Platypus_Chrom_NCBIv1
res <- gl2gapit(t1, outpath = tempdir())



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