Learn R Programming

pedtools (version 1.2.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

A vector of indices or names of one or several markers 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 of the same length as marker, containing marker names.

chrom

A character of the same length as marker, containing chromosome labels.

posMb

A numeric of the same length as marker, containing the physical marker positions in megabases (or 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