calculateRatio: Calculate Ratio

View source: R/calculateRatio.r

calculateRatioR Documentation

Calculate Ratio

Description

Calculates the peak height ratio between specified loci.

Usage

calculateRatio(
  data,
  ref = NULL,
  numerator = NULL,
  denominator = NULL,
  group = NULL,
  ol.rm = TRUE,
  ignore.case = TRUE,
  word = FALSE,
  exact = FALSE,
  debug = FALSE
)

Arguments

data

a data frame containing at least 'Sample.Name', 'Marker', 'Height', 'Allele'.

ref

a data frame containing at least 'Sample.Name', 'Marker', 'Allele'. If provided alleles matching 'ref' will be extracted from 'data' (see filterProfile).

numerator

character vector with marker names.

denominator

character vector with marker names.

group

character column name to group by.

ol.rm

logical indicating if off-ladder 'OL' alleles should be removed.

ignore.case

logical indicating if sample matching should ignore case.

word

logical indicating if word boundaries should be added before sample matching.

exact

logical indicating if exact sample matching should be used.

debug

logical indicating printing debug information.

Details

Default is to calculate the ratio between all unique pairwise combinations of markers/loci. If equal number of markers are provided in the numerator and the denominator the provided pairwise ratios will be calculated. If markers are provided in only the numerator or only the denominator the ratio of all possible combinations of the provided markers and the markers not provided will be calculated. If the number of markers provided are different in the numerator and in the denominator the shorter vector will be repeated to equal the longer vector in length. Data can be unfiltered or filtered since the sum of peak heights per marker is used. Off-ladder alleles is by default removed from the dataset before calculations.

Value

data.frame with with columns 'Sample.Name', 'Marker', 'Delta', 'Hb', 'Lb', 'MPH', 'TPH'.

Examples

data(set2)
# Calculate ratio between the shortest and longest marker in each dye.
numerator <- c("D3S1358", "AMEL", "D19S433")
denominator <- c("D2S1338", "D18S51", "FGA")
calculateRatio(data = set2, numerator = numerator, denominator = denominator)
calculateRatio(data = set2, numerator = NULL, denominator = "AMEL")
calculateRatio(data = set2, numerator = c("AMEL", "TH01"), denominator = NULL)
calculateRatio(data = set2, numerator = NULL, denominator = NULL)

OskarHansson/strvalidator documentation built on July 22, 2023, 12:04 p.m.