writePed: Write a pedigree to file

View source: R/writePed.R

writePedR Documentation

Write a pedigree to file

Description

Write a pedigree to file

Usage

writePed(
  x,
  prefix,
  what = "ped",
  famid = is.pedList(x),
  header = TRUE,
  merlin = FALSE,
  verbose = TRUE
)

Arguments

x

A ped object

prefix

A character string giving the prefix of the files. For instance, if prefix = "myped" and what = c("ped", "map"), the output files are "myped.ped" and "myped.map" in the current directory. Paths to other folder may be included, e.g. prefix = "path-to-my-dir/myped".

what

A subset of the character vector c("ped", "map", "dat", "freq"), indicating which files should be created. By default only the "ped" file is created. This option is ignored if merlin = TRUE.

famid

A logical indicating if family ID should be included as the first column in the ped file. The family ID is taken from famid(x). If x is a list of pedigrees, the family IDs are taken from names(x), or if this is NULL, the component-wise famid() values. Missing values are replaced by natural numbers. This option is ignored if merlin = TRUE.

header

A logical indicating if column names should be included in the ped file. This option is ignored if merlin = TRUE.

merlin

A logical. If TRUE, "ped", "map", "dat" and "freq" files are written in a format readable by the MERLIN software. In particular MERLIN requires non-numerical allele labels in the frequency file.

verbose

A logical.

Value

A character vector with the file names.

Examples


x = nuclearPed(1)
x = addMarker(x, "3" = "a/b", name = "m1")

# Write to file
fn = writePed(x, prefix = tempfile("test"))

# Read
y = readPed(fn)

stopifnot(identical(x, y))


pedtools documentation built on Nov. 5, 2023, 5:06 p.m.