make_bed: Make bed files from genotype/phenotype data

View source: R/utility.R

make_bedR Documentation

Make bed files from genotype/phenotype data

Description

From input genotypes, metadata, and phenotypes, creates a bed, ped, map, and bim file for use in PLINK, GCTA, or other programs. Files of each type will be written to the current working directory with the "data" prefix. Note that file named "data.sh" will be written which must be ran via bash command line to produce the .bed binary file.

Usage

make_bed(
  x,
  meta,
  phenos,
  plink_path = "/usr/bin/plink.exe",
  return_objects = F,
  missing_genotypes = -9
)

Arguments

x

matrix or object coercable to a matrix. Genotypes, in phased format (two columns per individual). Genotypes should be in single number format (0 or 1), such as produced by process_ms.

meta

data.frame of object coercable to data.frame. Metadata for snp data, where column 1 is the chromsome and column 2 is the position on the chromosome in bp,such as produced by process_ms.

phenos

character vector. A vector containing the phenotypes for each individual, sorted identically to individuals in x.

return_objects

logical, default FALSE, If TRUE, returns a list with ped, bed, map, and bim data. Otherwise just saves files.

missing_genotypes

numeric, default -9. Encoding for missing alleles/genotypes.

Value

Either NULL or a list containing ped, bed, map, and bim formatted data.

Author(s)

William Hemstrom

References

Source code pulled from the snpR package by the same author for use here.


hemstrow/GeneArchEst documentation built on June 10, 2025, 5:06 a.m.