R/RcppExports.R

Defines functions strat_otherPopERRORsP strat_ERRORssGP old_strat_ERRORsP strat_ERRORsP ssGP sP strat_otherPopERRORssGP falseNeg_ERRORsP IS_rel_ERRORssGP ERRORssGP

# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

#' estimatign error rates for single-sided grandparent pair vs unrelated
#' Monte Carlo used for estimating false negative
#' Importance sampling Monte Carlo used for estimating false positive
#' @param baselineParams Dirichlet parameters for allele frequencies
#' @param unsampledPopParams Dirichlet parameters for allele frequencies
#' @param missingParams Beta parameters for missing genotypes (failure to genotype rate)
#' @param genotypeKey list of matrix for each locus, col1 is genotype, col2 is allele 1, col3 is allele 2
#' @param genotypeErrorRates list of matrix for each locus, rows are actual genotype, columns are observed,
#'   values are probability
#' @param llrToTest Vector of llr's to test as threshold values
#' @param N number of samples to take
#' @keywords internal
#' @noRd
#' @export
ERRORssGP <- function(baselineParams, unsampledPopParams, missingParams, genotypeKey, genotypeErrorRates, llrToTest, N, seed, MIexcludeProb, maxMissingGenos) {
    .Call(`_gRandma_ERRORssGP`, baselineParams, unsampledPopParams, missingParams, genotypeKey, genotypeErrorRates, llrToTest, N, seed, MIexcludeProb, maxMissingGenos)
}

#' estimatign error rates for single-sided grandparent pair for other true relationship types
#' Importance sampling Monte Carlo used for estimating false positive
#' @param baselineParams Dirichlet parameters for allele frequencies
#' @param unsampledPopParams Dirichlet parameters for allele frequencies
#' @param missingParams Beta parameters for missing genotypes (failure to genotype rate)
#' @param genotypeKey list of matrix for each locus, col1 is genotype, col2 is allele 1, col3 is allele 2
#' @param genotypeErrorRates list of matrix for each locus, rows are actual genotype, columns are observed,
#'   values are probability
#' @param llrToTest Vector of llr's to test as threshold values
#' @param N number of samples to take
#' @param trueRel integer corresponding to true relationship type
#' @keywords internal
#' @noRd
#' @export
IS_rel_ERRORssGP <- function(baselineParams, unsampledPopParams, missingParams, genotypeKey, genotypeErrorRates, llrToTest, N, trueRel, seed, MIexcludeProb, maxMissingGenos) {
    .Call(`_gRandma_IS_rel_ERRORssGP`, baselineParams, unsampledPopParams, missingParams, genotypeKey, genotypeErrorRates, llrToTest, N, trueRel, seed, MIexcludeProb, maxMissingGenos)
}

#' estimatign error rates for parent - offspring pair vs unrelated
#' Monte Carlo used for estimating false negative
#' @param baselineParams Dirichlet parameters for allele frequencies
#' @param unsampledPopParams Dirichlet parameters for allele frequencies
#' @param missingParams Beta parameters for missing genotypes (failure to genotype rate)
#' @param genotypeKey list of matrix for each locus, col1 is genotype, col2 is allele 1, col3 is allele 2
#' @param genotypeErrorRates list of matrix for each locus, rows are actual genotype, columns are observed,
#'   values are probability
#' @param llrToTest Vector of llr's to test as threshold values
#' @param N number of samples to take
#' @keywords internal
#' @noRd
#' @export
falseNeg_ERRORsP <- function(baselineParams, unsampledPopParams, missingParams, genotypeKey, genotypeErrorRates, llrToTest, N, seed, MIexcludeProb, maxMissingGenos) {
    .Call(`_gRandma_falseNeg_ERRORsP`, baselineParams, unsampledPopParams, missingParams, genotypeKey, genotypeErrorRates, llrToTest, N, seed, MIexcludeProb, maxMissingGenos)
}

#' estimating false positive error rates for single-sided grandparent pair vs unrelated
#' with individuls from one population being assigned to a different population
#' stratified Monte Carlo used for estimating false positive
#' strata are number of observed mendelian incompatibilities in the trio
#' 
#' 
#' 
#' @param baselineParams Dirichlet parameters for allele frequencies
#' @param unsampledPopParams Dirichlet parameters for allele frequencies
#' @param missingParams Beta parameters for missing genotypes (failure to genotype rate)
#' @param genotypeKey list of matrix for each locus, col1 is genotype, col2 is allele 1, col3 is allele 2
#' @param genotypeErrorRates list of matrix for each locus, rows are actual genotype, columns are observed,
#'   values are probability
#' @param llrToTest Vector of llr's to test as threshold values
#' @param itersPerMI number of samples to take in each strata
#' @param seed random number generation seed
#' @param skipBaseline added unsampled pops to skip as baseline
#' @param MIexcludeProb maximum prob to lead to GP exclusion
#' @param maxMissingGenos maximum number of missing genotypes allowed in an individual
#' @keywords internal
#' @noRd
#' @export
strat_otherPopERRORssGP <- function(baselineParams, unsampledPopParams, missingParams, genotypeKey, genotypeErrorRates, llrToTest, itersPerMI, seed, skipBaseline, MIexcludeProb, maxMissingGenos) {
    .Call(`_gRandma_strat_otherPopERRORssGP`, baselineParams, unsampledPopParams, missingParams, genotypeKey, genotypeErrorRates, llrToTest, itersPerMI, seed, skipBaseline, MIexcludeProb, maxMissingGenos)
}

#' calculating llr of parent - offspring pair vs unrelated
#' returning a matrix of descendent, grandparentPopulation, grandparent1, grandparent2, llr
#' @param baseline baseline individuals, col1 is pop, col2 is id, cols 3... are genotypes
#' @param mixture mixture individulas col1 is id, cols 2... are genotypes
#' @param baselineParams Dirichlet parameters for allele frequencies
#' @param unsampledPopParams Dirichlet parameters for allele frequencies
#' @param genotypeKey list of matrix for each locus, col1 is genotype, col2 is allele 1, col3 is allele 2
#' @param genotypeErrorRates list of matrix for each locus, rows are actual genotype, columns are observed,
#'   values are probability
#' @param saveLLR the minimum LLR to include the output in the results (only used if filterLLR is true)
#' @param MIexcludeProb the maximum probability of exclusion for a true grandparent pair due to 
#'   Mendelian incompatibilities
#' @param filterLLR true to filter results based on saveLLR, false to not
#' @keywords internal
#' @noRd
#' @export
sP <- function(baseline, mixture, baselineParams, unsampledPopParams, genotypeKey, genotypeErrorRates, saveLLR, MIexcludeProb, filterLLR) {
    .Call(`_gRandma_sP`, baseline, mixture, baselineParams, unsampledPopParams, genotypeKey, genotypeErrorRates, saveLLR, MIexcludeProb, filterLLR)
}

#' calculating llr of single-sided grandparent pair vs unrelated
#' returning a matrix of descendent, grandparentPopulation, grandparent1, grandparent2, llr
#' @param baseline baseline individuals, col1 is pop, col2 is id, cols 3... are genotypes
#' @param mixture mixture individulas col1 is id, cols 2... are genotypes
#' @param crossRecords col1 is pop, col2 is id 1, col3 is id2
#' @param baselineParams Dirichlet parameters for allele frequencies
#' @param unsampledPopParams Dirichlet parameters for allele frequencies
#' @param genotypeKey list of matrix for each locus, col1 is genotype, col2 is allele 1, col3 is allele 2
#' @param genotypeErrorRates list of matrix for each locus, rows are actual genotype, columns are observed,
#'   values are probability
#' @param saveLLR the minimum LLR to include the output in the results (only used if filterLLR is true)
#' @param MIexcludeProb the maximum probability of exclusion for a true grandparent pair due to 
#'   Mendelian incompatibilities
#' @param filterLLR true to filter results based on saveLLR, false to not
#' @keywords internal
#' @noRd
#' @export
ssGP <- function(baseline, mixture, crossRecords, baselineParams, unsampledPopParams, genotypeKey, genotypeErrorRates, saveLLR, MIexcludeProb, filterLLR) {
    .Call(`_gRandma_ssGP`, baseline, mixture, crossRecords, baselineParams, unsampledPopParams, genotypeKey, genotypeErrorRates, saveLLR, MIexcludeProb, filterLLR)
}

#' estimating positive error rates for parent - offspring pairs
#' stratified Monte Carlo used for estimating false positive
#' @param baselineParams Dirichlet parameters for allele frequencies
#' @param unsampledPopParams Dirichlet parameters for allele frequencies
#' @param missingParams Beta parameters for missing genotypes (failure to genotype rate)
#' @param genotypeKey list of matrix for each locus, col1 is genotype, col2 is allele 1, col3 is allele 2
#' @param genotypeErrorRates list of matrix for each locus, rows are actual genotype, columns are observed,
#'   values are probability
#' @param llrToTest Vector of llr's to test as threshold values
#' @param N number of samples to take
#' @param trueRel an integer indicating the true relationship to simulate: 0 = unrelated, 1 = aunt,
#'   2 = half aunt, 3 = cousin of parent
#' @keywords internal
#' @noRd
#' @export
strat_ERRORsP <- function(baselineParams, unsampledPopParams, missingParams, genotypeKey, genotypeErrorRates, llrToTest, itersPerMI, seed, trueRel, MIexcludeProb, maxMissingGenos) {
    .Call(`_gRandma_strat_ERRORsP`, baselineParams, unsampledPopParams, missingParams, genotypeKey, genotypeErrorRates, llrToTest, itersPerMI, seed, trueRel, MIexcludeProb, maxMissingGenos)
}

#' estimating positive error rates for parent - offspring pairs
#' stratified Monte Carlo used for estimating false positive
#' @param baselineParams Dirichlet parameters for allele frequencies
#' @param unsampledPopParams Dirichlet parameters for allele frequencies
#' @param missingParams Beta parameters for missing genotypes (failure to genotype rate)
#' @param genotypeKey list of matrix for each locus, col1 is genotype, col2 is allele 1, col3 is allele 2
#' @param genotypeErrorRates list of matrix for each locus, rows are actual genotype, columns are observed,
#'   values are probability
#' @param llrToTest Vector of llr's to test as threshold values
#' @param N number of samples to take
#' @param trueRel an integer indicating the true relationship to simulate: 0 = unrelated, 1 = aunt,
#'   2 = half aunt, 3 = cousin of parent
#' @keywords internal
#' @noRd
#' @export
old_strat_ERRORsP <- function(baselineParams, unsampledPopParams, missingParams, genotypeKey, genotypeErrorRates, llrToTest, itersPerMI, seed, trueRel, MIexcludeProb) {
    .Call(`_gRandma_old_strat_ERRORsP`, baselineParams, unsampledPopParams, missingParams, genotypeKey, genotypeErrorRates, llrToTest, itersPerMI, seed, trueRel, MIexcludeProb)
}

#' estimatign error rates for single-sided grandparent pair vs unrelated
#' Monte Carlo used for estimating false negative
#' Importance sampling Monte Carlo used for estimating false positive
#' @param baselineParams Dirichlet parameters for allele frequencies
#' @param unsampledPopParams Dirichlet parameters for allele frequencies
#' @param missingParams Beta parameters for missing genotypes (failure to genotype rate)
#' @param genotypeKey list of matrix for each locus, col1 is genotype, col2 is allele 1, col3 is allele 2
#' @param genotypeErrorRates list of matrix for each locus, rows are actual genotype, columns are observed,
#'   values are probability
#' @param llrToTest Vector of llr's to test as threshold values
#' @param N number of samples to take
#' @param maxMissingGenos the maximum number of missing genotypes for a sample to be used 
#' @keywords internal
#' @noRd
#' @export
strat_ERRORssGP <- function(baselineParams, unsampledPopParams, missingParams, genotypeKey, genotypeErrorRates, llrToTest, itersPerMI, seed, trueRel, MIexcludeProb, maxMissingGenos) {
    .Call(`_gRandma_strat_ERRORssGP`, baselineParams, unsampledPopParams, missingParams, genotypeKey, genotypeErrorRates, llrToTest, itersPerMI, seed, trueRel, MIexcludeProb, maxMissingGenos)
}

#' estimating false positive error rates for single-sided grandparent pair vs unrelated
#' with individuls from one population being assigned to a different population
#' Stratified sampling Monte Carlo used for estimating false positive 
#' 
#' 
#' This version uses trios from the current "baseline" pop as the importance sampling distribution
#' 
#' @param baselineParams Dirichlet parameters for allele frequencies
#' @param unsampledPopParams Dirichlet parameters for allele frequencies
#' @param missingParams Beta parameters for missing genotypes (failure to genotype rate)
#' @param genotypeKey list of matrix for each locus, col1 is genotype, col2 is allele 1, col3 is allele 2
#' @param genotypeErrorRates list of matrix for each locus, rows are actual genotype, columns are observed,
#'   values are probability
#' @param llrToTest Vector of llr's to test as threshold values
#' @param N number of samples to take
#' @param skipBaseline added unsampled pops to skip as baseline
#' @keywords internal
#' @noRd
#' @export
strat_otherPopERRORsP <- function(baselineParams, unsampledPopParams, missingParams, genotypeKey, genotypeErrorRates, llrToTest, itersPerMI, seed, skipBaseline, MIexcludeProb, maxMissingGenos) {
    .Call(`_gRandma_strat_otherPopERRORsP`, baselineParams, unsampledPopParams, missingParams, genotypeKey, genotypeErrorRates, llrToTest, itersPerMI, seed, skipBaseline, MIexcludeProb, maxMissingGenos)
}
delomast/gRandma documentation built on March 8, 2024, 2:26 a.m.