Learn R Programming

pedtools (version 1.1.0)

marker_setattr: Set marker attributes

Description

These functions set or modify various attributes of markers attached to a pedigree. They are sometimes more convenient (and pipe-friendly) than the in-place modifiers described in marker_inplace.

Usage

setGenotype(x, marker = NULL, id, geno)

setAfreq(x, marker, afreq)

setMarkername(x, marker = NULL, name)

setChrom(x, marker = NULL, chrom)

setPosition(x, marker = NULL, posMb)

Arguments

x

A ped object or a list of ped objects.

marker

The index or name of a marker attached to x.

id

The ID label of a single pedigree member.

geno

a character vector of length pedsize(x), with genotypes written in the format "a/b".

afreq

a numeric of the same length as alleles, indicating the population frequency of each allele. A warning is issued if the frequencies don't sum to 1 after rounding to 3 decimals. If the vector is named, and alleles is not NULL, an error is raised if setequal(names(afreq), alleles) is not TRUE. If afreq is not specified, all alleles are given equal frequencies.

name

a character string: the name of the marker. Default: NA.

chrom

a single integer: the chromosome number. Default: NA.

posMb

a nonnegative real number: the physical position of the marker, in megabases. Default: NA.

Value

A copy of x with modified attributes.

Examples

Run this code
# NOT RUN {
x = nuclearPed(1) |>
  addMarker(alleles = 1:2) |>
  setMarkername(marker = 1, name = "M") |>
  setGenotype(marker = "M", id = 1, geno = "1/2") |>
  setAfreq(marker = "M", afreq = c(`1` = 0.1, `2` = 0.9)) |>
  setChrom(marker = "M", chrom = 1) |>
  setPosition(marker = "M", posMb = 123.45)

# Of course, all of this could have been done on creation:
y = addMarker(nuclearPed(), `1` = "1/2", afreq = c(`1` = 0.1, `2` = 0.9),
              name = "M", chrom = 1, posMb = 123.45)
stopifnot(identical(x, y))

# }

Run the code above in your browser using DataLab