getgenotypes_R: fetch genotype matrix for specified markers (assemble by...

View source: R/mega2rcreate.R

getgenotypes_RR Documentation

fetch genotype matrix for specified markers (assemble by rows)

Description

This function calls the C++ function that does all the heavy lifting. It passes the locus_index and the locus_offset in the unified_genotype_table from the markers_arg argument. It also gathers other data.frames that are in the "global" ENV environment. One frame contains a bit vector of compressed genotype information, another contains the alleles for each marker, and finally there are some bookkeeping related data. Note this function is for Testing only and is not exported.

Usage

getgenotypes_R(markers_arg, sepstr = "", envir = ENV)

Arguments

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 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

sepstr

separator string for alleles (default is none)

envir

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

Details

The unified_genotype_table contains one raw vector for each person. In the vector there are two bits for each genotype. This function creates an output matrix by selecting from each row all the needed markers and then repeating for each person.

Value

a matrix of genotypes represented as a nucleotide pair. There is one column for each marker in markers_arg argument. There is one row for each person in the family (fam) table.

Examples

## Not run: 
# genotypes for all persons in markers data.frame argument
getgenotypes_R(ENV$markers)

# genotypes for all persons in chromosome n
getgenotypes_R(ENV$markers[ENV$markers$chromosome == n,])

## End(Not run)

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