applyFnToMarkers: apply a function to the genotypes from a set of markers

applyFnToMarkersR Documentation

apply a function to the genotypes from a set of markers

Description

A matrix of the genotypes for all the specified markers is generated. Then, the call back function, op, is called with the markers, NULL (for the range), and the 'environment'.

Usage

applyFnToMarkers(op      = function (markers, range, envir) {},
                markers_arg,
                envir = ENV)

Arguments

op

Is a function of three arguments. It will be called once by applyFnToMarkers in a try/catch context. The arguments are:

markers

Marker data for each marker in geno. A marker is a data frame with the following 5 observations:

locus_link

is the ordinal ranking of this marker among all loci

locus_link_fill

is the position of corresponding marker genotype data in the unified_genotype_table

MarkerName

is the text name of the marker

chromosome

is the integer chromosome number

position

is the integer base pair position of marker

range

NULL: to indicate no explicit range was specified.

envir

An 'environment' holding Mega2R data frames and state data.

markers_arg

a data frame with the following 5 observations:

locus_link

is the ordinal ranking of this marker among all loci

locus_link_fill

is the position of corresponding marker genotype data in the unified_genotype_table

MarkerName

is the text name of the marker

chromosome

is the integer chromosome number

position

is the integer base pair position of marker

envir

an 'environment' that contains all the data frames created from the SQLite database.

Value

None

Examples

  db = system.file("exdata", "seqsimm.db", package="Mega2R")
  ENV = read.Mega2DB(db)
  show = function(m, r, e) {
      print(r)
      print(m)
      print(head(getgenotypes(m, envir = e)))
  }

   # apply function "show" to all genotypes > 5,000,000 bp
   applyFnToMarkers(show, ENV$markers[ENV$markers$position > 5000000,])



Mega2R documentation built on May 29, 2024, 1:14 a.m.