write.plink: Write a 'genotypes' object as a PLINK binary fileset

Description Usage Arguments Details Value References See Also

Description

Write a genotypes object as a PLINK binary fileset

Usage

1
2
write.plink(gty, prefix, map = NULL, fam = NULL, intensity = FALSE,
  keep.chrnames = FALSE, ...)

Arguments

gty

an genotypes object

prefix

path to the PLINK fileset to generate, excluding *.bed suffix

map

a valid marker map; overrides existing map

fam

sample metadata to override any existing metadata

intensity

whether to write intensity matrices, if present (to *.bii file)

keep.chrnames

whether to keep chromosome names as-is, or allow them to be converted to PLINK's style

...

ignored

Details

Writes a PLINK binary fileset using pure R. The fileset is generated in the "variant-major" format (the default in all recent versions of PLINK), with appropriate magic number. Complete sample metadata and a complete marker map, including reference alleles (columns "A1" and "A2"), are both required.

This function only supports writing from character (allele enconding "native") genotypes, in order to avoid ambiguity around the correspondence between alleles and numeric genotypes. But numeric genotypes can be converted back to character via recode.genotypes(,"native").

If intensity data is saved, it is written to a binary file with suffix *.bii in little-endian encoding. First the X-intensity and then the Y-intensity matrix are convered to a single vector in column-major fashion, and the result is written to disk. Intensities are pre-multiplied by 10,000 and truncated to integers of size 2 bytes (max 2^16-1) to save space; this means values will be clipped to 6.5535 or less. In practice, for Illumina arrays, this makes essentially no difference at all for downstream analysis.

Value

TRUE on completion

References

PLINK v1.9: https://www.cog-genomics.org/plink2

Purcell S et al. (2007) PLINK: a toolset for whole-genome association and population-based linkage analysis. Am J Hum Genet 81(3): 559-575. doi:10.1086/519795.

See Also

read.plink


andrewparkermorgan/argyle documentation built on May 10, 2019, 11:08 a.m.