paramlink (version 0.7-0)

markers: Marker genotypes for linkdat objects

Description

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

Usage

marker(x, ..., allelematrix, alleles=NULL, afreq=NULL, missing=0,
       chrom=NA, name=NA, pos=NA)
addMarker(x, m, alleles=NULL, afreq=NULL, missing=0)
setMarkers(x, m, map=NULL, dat=NULL, freq=NULL, missing = 0)
removeMarkers(x, markers)
modifyMarker(x, marker, ids, genotype, alleles, afreq, chrom, name, pos)
mendelianCheck(x, verbose=TRUE)

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.
m
a marker object or a matrix with alleles. (In setMarkers this matrix can contain data of several markers.)
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).
name
NA or a character (the name of the marker).
pos
NA or a non-negative real number indicating the genetic position (in cM) of the marker.
marker, markers
a numeric indicating which marker(s) to use/modify.
ids
a numeric indicating individual(s) to be modified.
genotype
a vector of length 1 or 2, containing the genotype to be given the ids individuals. See examples.
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).
map
a character containing the path to a map file in MERLIN style, i.e. with three columns: CHR (chromosome number), MARKER (marker identifier) and POS (centiMorgan position of the marker).
dat
a character containing the path to a dat file, MERLIN style. See MERLIN's online tutorial for details on format. Our use of this file here is mainly to communicate the ordering of the markers.
freq
a character with the path to a allele frequency file in MERLIN (short) format. (Not used if map=NULL.)
verbose
a logical. If TRUE, details of the markers failing the tests are shown.

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 identidier), 'pos' (chromosome position in cM). For addMarker, setMarkers, removeMarkers and modifyMarkers, a linkdat object is returned, whose markerdata element has been set/modified. For mendelianCheck, a numeric containing the indices of the markers that did not pass the tests.

See Also

linkdat

Examples

Run this code
data(toyped)
x = linkdat(toyped)
x
x = removeMarkers(x,1) # removing the only marker of x.

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

# a rare SNP for which all individuals are homozygous for the common allele.
m2 = marker(x, 1:4, 1, alleles=1:2, afreq=c(0.99, 0.01)) # the 'alleles' argument is important since only one allele is present.
m2
x = addMarker(x, m2)
x

x = modifyMarker(x, marker=1, ids=3, genotype='a') # this is a Mendelian error!
x = modifyMarker(x, marker=2, ids=1:2, genotype=1:2, alleles=1:3) # making the second marker triallelic, with heterozygous parents.
x

plot(x, marker=1)
err = mendelianCheck(x)
stopifnot(err==1)
x = removeMarkers(x, err)

Run the code above in your browser using DataLab