markers {paramlink}R Documentation

Marker functions

Description

Functions for setting and manipulating marker genotypes for 'linkdat' objects.

Usage

marker(
  x,
  ...,
  allelematrix,
  alleles = NULL,
  afreq = NULL,
  missing = 0,
  chrom = NA,
  pos = NA,
  name = NA,
  mutmat = NULL
)

addMarker(x, m, ...)

setMarkers(x, m, annotations = NULL, missing = 0)

modifyMarker(x, marker, ids, genotype, alleles, afreq, chrom, name, pos)

getMarkers(x, markernames = NULL, chroms = NULL, fromPos = NULL, toPos = NULL)

removeMarkers(
  x,
  markers = NULL,
  markernames = NULL,
  chroms = NULL,
  fromPos = NULL,
  toPos = NULL
)

swapGenotypes(x, ids)

modifyMarkerMatrix(x, ids, new.alleles)

Arguments

x

a linkdat object

...

an even number of vectors, indicating individuals and their genotypes. See examples.

allelematrix

a matrix with one row per pedigree member and two columns per marker, containing the alleles for a single marker.

alleles

a numeric or character vector containing allele names.

afreq

a numerical vector with allele frequencies. An error is given if they don't sum to 1 (rounded to 3 decimals).

missing

a numeric - or character - of length 1, indicating the code for missing alleles.

chrom

NA or an integer (the chromosome number of the marker).

pos

NA or a non-negative real number indicating the genetic position (in cM) of the marker.

name

NA or a character (the name of the marker).

mutmat

a mutation matrix, or a list of two such matrices named 'female' and 'male'. The matrix/matrices must be square, with the allele labels as dimnames, and each row must sum to 1 (after rounding to 3 decimals).

m

a marker object or a matrix with alleles. (In setMarkers this matrix can contain data of several markers.)

annotations

a list of marker annotations.

marker, markers

a numeric indicating which marker(s) to use/modify.

ids

a numeric indicating individual(s) to be modified. In swapGenotypes this must have length 2.

genotype

a vector of length 1 or 2, containing the genotype to be given the ids individuals. See examples.

markernames

NULL or a character vector.

chroms

NULL or a numeric vector of chromosome numbers.

fromPos, toPos

NULL or a single numeric.

new.alleles

a numerical matrix of dimensions length(ids), 2*x$nMark. Entries refer to the internal allele numbering.

Value

The marker function returns an object of class marker: This is a numerical 2-column matrix with one row per individual, and attributes 'alleles' (a character vector with allele names), 'nalleles' (the number of alleles) and 'missing' (the input symbol for missing marker alleles), 'chrom' (chromosome number), 'name' (marker identifier), 'pos' (chromosome position in cM).

For addMarker, setMarkers, removeMarkers, modifyMarker, modifyMarkerMatrix and swapGenotypes, a linkdat object is returned, whose markerdata element has been set/modified.

For getMarkers a numeric vector containing marker numbers (i.e. their indices in x$markerdata) for the markers whose 'name' attribute is contained in markernames, 'chrom' attribute is contained in chroms, and 'pos' attribute is between from and to. NULL arguments are skipped, so getMarkers(x) will return seq_len(x$nMark) (i.e. all markers).

See Also

linkdat

Examples


x = linkdat(toyped)
x = removeMarkers(x, 1) # removing the only marker.
x

# Creating and adding a SNP marker with alleles 'a' and 'b', for which
# individual 1 is heterozygous, individuals 2 and 4 are homozygous for the
# 'b' allele, and individual 3 has a missing genotype.
m1 = marker(x, 1, c('a','b'), c(2,4), c('b','b'))
x = addMarker(x, m1)

# A rare SNP for which both children are heterozygous.
# The 'alleles' argument can be skipped, but is recommended to ensure
# correct order of the frequencies.
m2 = marker(x, 3:4, 1:2, alleles=1:2, afreq=c(0.99, 0.01))
x = addMarker(x, m2)

# Modifying the second marker:
# Making it triallelic, and adding a genotype to the father.
x = modifyMarker(x, marker=2, alleles=1:3, ids=1, genotype=2:3)

# Adding an empty SNP (all genotypes are missing):
x = addMarker(x, 0, alleles=c('A', 'B'))

# Similar shortcut for creating a marker for which all
# pedigree members are homozygous for an allele (say 'b'):
x = addMarker(x, 'b')
# Alternative: m = marker(x, 'b'); addMarker(x, m)



[Package paramlink version 1.1-5 Index]