Learn R Programming

MBASED (version 1.6.0)

logLikelihoodCalculator1s: Function that given observed count data along a known haplotype returns a function that can calculate the likelihood of observing that data for a supplied underlying haplotype frequency.

Description

Function that given observed count data along a known haplotype returns a function that can calculate the likelihood of observing that data for a supplied underlying haplotype frequency.

Usage

logLikelihoodCalculator1s(lociHapACounts, lociTotalCounts, lociHapANoASEProbs, lociRhos, checkArgs = FALSE)

Arguments

lociHapACounts
counts of haplotype A-supporting reads at individual loci. Must be a vector of non-negative integers.
lociTotalCounts
total read counts of at individual loci. Must be a vector of positive integers.
lociHapANoASEProbs
probabilities of observing haplotype A-supporting reads at individual loci under conditions of no ASE (e.g., vector with all entries set to 0.5, if there is no pre-existing allelic bias at any locus). Must be a vector with entries >0 and
lociRhos
dispersion parameters of beta distribution at individual loci (set to 0 if the read count-generating distribution at the locus is binomial). Must be a numeric vector with entries >=0 and
checkArgs
single boolean specifying whether arguments should be checked for adherence to specifications. DEFAULT: FALSE

Value

a function of a single argument pHapA that calculates log likelihood of the observed data if the true underlying haplotype A frequency is pHapA.

Details

Given observed read counts supporting hapltoype A at a collection of loci, the total read counts at those loci, the probablities of observing haplotype A-supporting reads under conditions of no ASE and the dispersion parameters, this function returns a function of a single argument, pHapA, that calculates the likelihood of observing the given haplotype A-supporting counts under the assumption that the true underlying frequency of haplotype A is pHapA.

Examples

Run this code
LLC <- MBASED:::logLikelihoodCalculator1s(lociHapACounts=c(5, 12), lociTotalCounts=c(10, 24), lociHapANoASEProbs=c(0.5, 0.5), lociRhos=c(0,0))
LLC(0.5) ## the MLE estimate of hapA frequency
LLC(0.1) ## highly implausible value of pHapA
LLC (0.51)

Run the code above in your browser using DataLab