applyFnToRanges | R Documentation |
First, for each range, determine the markers that fall between the start and end
base pair of the range. Then, for each set of
markers generate a matrix of the genotypes of those markers. Finally, the op
function is called for
each range with the arguments: markers, range, and 'environment'.
applyFnToRanges(op = function (markers, range, envir) {},
ranges_arg = NULL,
indices_arg = NULL,
fuzz_arg = 0,
envir = ENV)
op |
Is a function of three arguments. It will be called repeatedly by
|
ranges_arg |
is a data frame that contains at least 4 observations: a name, a chromosome, a start base pair position and an end base pair position. |
indices_arg |
is a vector of 3 integers that specify the location of chromosome, start base pair column and end base pair column of the ranges_arg data frame. An optional fourth integer indicates the column containing the name of the ranges. |
fuzz_arg |
is an integer vector of length one or two. The first argument is used to reduce the start base pair selected from each range and the second to increase the end base pair position. (If only one value is present, it is used for both changes.) Note: The values can be positive or negative. |
envir |
an 'environment' that contains all the data frames created from the SQLite database. |
None
If the ranges_arg and indices_arg are NULL or missing, then the default ranges that have been set by setRanges
are used. If setRanges
has not been called, a default set of the ranges is used.
db = system.file("exdata", "seqsimm.db", package="Mega2R")
ENV = read.Mega2DB(db)
show = function(m, r, e) {
print(r)
print(m)
print(head(getgenotypesraw(m, envir = e)))
}
# apply function "show" to all genotypes on chromosomes 1 for two base pair
# ranges
applyFnToRanges(show,
ranges_arg =
matrix(c(1, 2244000, 2245000,
1, 3762500, 3765000),
ncol = 3, nrow = 2, byrow = TRUE),
indices_arg = 1:3)
# apply function "show" to all genotypes on chromosomes 1 for two base pair
# ranges
applyFnToRanges(show,
ranges_arg =
matrix(c(1, 2240000, 2245000, "range1",
1, 3760000, 3765000, "range2"),
ncol = 4, nrow = 2, byrow = TRUE),
indices_arg = 1:4)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.