Allele frequency database
Functions for reading, setting and extracting allele frequency databases, in either "list" format or "allelic ladder" format.
getFreqDatabase(x, markers = NULL, format = c("list", "ladder")) setFreqDatabase(x, database, format = c("list", "ladder"), ...) readFreqDatabase(filename, format = c("list", "ladder"), ...) writeFreqDatabase(x, filename, markers = NULL, format = c("list", "ladder")) setFrequencyDatabase(...) getFrequencyDatabase(...) readFrequencyDatabase(...) writeFrequencyDatabase(...)
x |
A ped object, or a list of such. |
markers |
A character vector (with marker names) or a numeric vector (with marker indices). |
format |
Either "list" or "ladder". |
database |
Either a list or matrix/data frame with allele frequencies,
or a file path (to be passed on to |
... |
Optional arguments passed on to |
filename |
The path to a text file containing allele frequencies either in "list" or "allelic ladder" format. |
A frequency database in "list" format is a list of numeric vectors; each vector named with the allele labels, and the list itself named with the marker names.
Text files containing frequencies in "list" format should look as follows, where "marker1" and "marker2" are marker names, and "a1","a2",... are allele labels (which may be characters or numeric, but will always be converted to characters):
marker1 a1 0.2 a2 0.5 a3 0.3 marker2 a1 0.9 a2 0.1
A database in "allelic ladder" format is rectangular, i.e., a numeric matrix
(or data frame), with allele labels as row names and markers as column
names. NA
entries correspond to unobserved alleles.
getFreqDatabase
: either a list (if format = "list"
) or a data
frame (if format = "ladder"
)
readFreqDatabase
: a list (also if format = "ladder"
) of named
numeric vectors
setFreqDatabase
: a modified version of x
loc1 = list(name = "m1", afreq = c(a = .1, b = .9)) loc2 = list(name = "m2", afreq = c("1" = .2, "10.2" = .3, "3" = .5)) x = setMarkers(singleton(1), locus = list(loc1, loc2)) db = getFreqDatabase(x) db y = setFreqDatabase(x, database = db) stopifnot(identical(x, y)) # The database can also be read directly from file tmp = tempfile() write("m1\na 0.1\nb 0.9\n\nm2\n1 0.2\n3 0.5\n10.2 0.3", tmp) z = setFreqDatabase(x, database = tmp) stopifnot(all.equal(x, z))
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.