Learn R Programming

pedtools (version 0.9.0)

marker: Marker objects

Description

Creating a marker object associated with a pedigree

Usage

marker(x, ..., allelematrix = NULL, alleles = NULL, afreq = NULL,
  chrom = NA, posMb = NA, posCm = NA, name = NA, mutmod = NULL,
  rate = NULL, validate = TRUE)

Arguments

x

a ped object

...

one or more expressions of the form id = genotype, where id is the ID label of a member of x, and genotype is a numeric or character vector of length 1 or 2 (see Examples).

allelematrix

a matrix with 2 columns and pedsize(x) rows. If this is non-NULL, then ... must be empty.

alleles

a character (or coercible to character) containing allele names. If not given, and afreq is named, names(afreq) is used. The default action is to take the sorted vector of distinct alleles occurring in allelematrix or ....

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.

chrom

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

posMb

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

posCm

a nonnegative real number: the centiMorgan position of the marker. Default: NA.

name

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

mutmod, rate

mutation model parameters. These are passed directly to pedmut::mutationModel(); see there for details. Note: mutmod corresponds to the model parameter. Default: NULL (no mutation model).

validate

if TRUE, the validity of the created marker object is checked.

Value

An object of class marker. This is an integer matrix with 2 columns and one row per individual, and the following attributes:

  • alleles (a character vector with allele labels)

  • afreq (allele frequencies; default rep.int(1/length(alleles), length(alleles)))

  • chrom (chromosome number; default = NA)

  • posMb (physical location in megabases; default = NA)

  • posCm (position in centiMorgan; default = NA)

  • name (marker identifier; default = NA)

  • mutmod (a list of two (male and female) mutation matrices; default = NULL)

See Also

marker_attach

Examples

Run this code
# NOT RUN {
x = nuclearPed(father = "fa", mother = "mo", children = "child")

# A rare SNP marker for which the child is heterozygous
m = marker(x, child = 1:2, alleles = 1:2, afreq = c(0.01, 0.99))

# Sometimes it is useful to attach the marker to the pedigree
x = setMarkers(x, m)

# A marker with a "proportional" mutation model,
# with different rates for males and females
mutrates = list(female = 0.1, male = 0.2)
marker(x, alleles = 1:2, mutmod = "prop", rate = mutrates)

# }

Run the code above in your browser using DataLab