R/RcppExports.R

Defines functions .SampleReads .DeduceProp .SimulateGeno .SimulateProp .SimulateFreq .rdirichlet_cpp .FilterMissing .FormatVariant .FormatHaplotype .ForwardBackward .EmissionProbApprox .EmissionProbExact .TransProbComponents .TransProbCompute .InitProbCompute .tAncestryStates .AncestryStates .FormatLocal .ScaleGenoMat .FormatAccFreq .FormatAccProp .InitializeFreq .ComputeAlpha UpdateParam ComputeLogLik

Documented in ComputeLogLik UpdateParam

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

#' Calculate the log-likelihood
#'
#' @param Geno
#' List of genotying matrices of size "number of markers",
#' with each matrix of dimension "number of individuals" x "number of alleles"
#' whose elements consists of discrete or continuous dosages
#' @param Prop
#' Matrix of admixture proportions of dimension
#' "number of individuals" x "number of groups"
#' @param Freq
#' List of allele frequency matrices of size "number of markers",
#' with each matrix of dimension "number of groups" x "number of alleles"
#' @param NbThreads
#' Number of threads to be used (positive integer) with 0 default values
#' setting automatically all threads available
#' @return log-likelihood
ComputeLogLik <- function(Geno, Prop, Freq, NbThreads = 0L) {
    .Call(`_AdmixPoly_ComputeLogLik`, Geno, Prop, Freq, NbThreads)
}

#' Update Prop and Freq parameters for EM step
#'
#' @param Geno
#' List of genotying matrices of size "number of markers",
#' with each matrix of dimension "number of individuals" x "number of alleles"
#' whose elements consists of discrete or continuous dosages
#' @param Prop
#' Matrix of admixture coefficients of dimension
#' "number of individuaks" x "number of groups"
#' @param Freq
#' List of allele frequency matrices of size "number of markers",
#' with each matrix of dimension "number of groups" x "number of alleles"
#' @param ParamToUpdate
#' Specify "both", "Prop" or "Freq" to update both admixture proportions and
#' allele frequencies, only admixture proportions or only allele frequencies,
#' respectively
#' @param MinParamBound
#' Minimum bound value for parameters
#' @param NbThreads
#' Number of threads to be used (positive integer) with 0 default values
#' setting automatically all threads available
#' @return list of updated parameters with two elements: Prop and Freq
UpdateParam <- function(Geno, Prop, Freq, ParamToUpdate = "both", MinParamBound = 1e-6, NbThreads = 0L) {
    .Call(`_AdmixPoly_UpdateParam`, Geno, Prop, Freq, ParamToUpdate, MinParamBound, NbThreads)
}

.ComputeAlpha <- function(r, v) {
    .Call(`_AdmixPoly_ComputeAlpha`, r, v)
}

.InitializeFreq <- function(Geno, K, Group_names, Seed, MinParamBound = 1e-6, NbThreads = 0L) {
    .Call(`_AdmixPoly_InitializeFreq`, Geno, K, Group_names, Seed, MinParamBound, NbThreads)
}

.FormatAccProp <- function(AccParam, N, K, MinParamBound) {
    .Call(`_AdmixPoly_FormatAccProp`, AccParam, N, K, MinParamBound)
}

.FormatAccFreq <- function(AccParam, N, K, Lm, MinParamBound) {
    .Call(`_AdmixPoly_FormatAccFreq`, AccParam, N, K, Lm, MinParamBound)
}

.ScaleGenoMat <- function(Geno, P) {
    invisible(.Call(`_AdmixPoly_ScaleGenoMat`, Geno, P))
}

.FormatLocal <- function(Geno, Freq, GeneticMap, Ind, K_active, P, NbThreads = 0L) {
    .Call(`_AdmixPoly_FormatLocal`, Geno, Freq, GeneticMap, Ind, K_active, P, NbThreads)
}

.AncestryStates <- function(K, P) {
    .Call(`_AdmixPoly_AncestryStates`, K, P)
}

.tAncestryStates <- function(K, P) {
    .Call(`_AdmixPoly_tAncestryStates`, K, P)
}

.InitProbCompute <- function(Prop, P) {
    .Call(`_AdmixPoly_InitProbCompute`, Prop, P)
}

.TransProbCompute <- function(Prop, P, Dist, SmoothParam, NbThreads = 0L) {
    .Call(`_AdmixPoly_TransProbCompute`, Prop, P, Dist, SmoothParam, NbThreads)
}

.TransProbComponents <- function(Prop, P, MaxRec = 2L, NbThreads = 0L) {
    .Call(`_AdmixPoly_TransProbComponents`, Prop, P, MaxRec, NbThreads)
}

.EmissionProbExact <- function(Geno, Ancestry, Freq) {
    .Call(`_AdmixPoly_EmissionProbExact`, Geno, Ancestry, Freq)
}

.EmissionProbApprox <- function(Geno, Ancestry, Freq) {
    .Call(`_AdmixPoly_EmissionProbApprox`, Geno, Ancestry, Freq)
}

.ForwardBackward <- function(Geno, Prop, P, Freq, PairwiseDist, DistVal, SmoothParam, MaxRec = -1L, EmisProbMaxPermut = 0L, NbThreads = 0L) {
    .Call(`_AdmixPoly_ForwardBackward`, Geno, Prop, P, Freq, PairwiseDist, DistVal, SmoothParam, MaxRec, EmisProbMaxPermut, NbThreads)
}

.FormatHaplotype <- function(HPA, MarkerInfo, PS_unique, NbThreads = 0L, Verbose = TRUE) {
    .Call(`_AdmixPoly_FormatHaplotype`, HPA, MarkerInfo, PS_unique, NbThreads, Verbose)
}

.FormatVariant <- function(VCF, MarkerInfo, AlleleDepthField, AlleleDepthType, NbThreads = 0L, Verbose = TRUE) {
    .Call(`_AdmixPoly_FormatVariant`, VCF, MarkerInfo, AlleleDepthField, AlleleDepthType, NbThreads, Verbose)
}

.FilterMissing <- function(Geno, MaxMarkerMissing, MaxIndMissing, NbThreads = 0L, Verbose = TRUE) {
    .Call(`_AdmixPoly_FilterMissing`, Geno, MaxMarkerMissing, MaxIndMissing, NbThreads, Verbose)
}

.rdirichlet_cpp <- function(N, J, alpha, Seed) {
    .Call(`_AdmixPoly_rdirichlet_cpp`, N, J, alpha, Seed)
}

.SimulateFreq <- function(Marker_names, Group_names, L, AlphaFreq = 1, Seed = 123L, NbThreads = 0L) {
    .Call(`_AdmixPoly_SimulateFreq`, Marker_names, Group_names, L, AlphaFreq, Seed, NbThreads)
}

.SimulateProp <- function(Ind_names, Group_names, AlphaProp = 1, Seed = 123L) {
    .Call(`_AdmixPoly_SimulateProp`, Ind_names, Group_names, AlphaProp, Seed)
}

.SimulateGeno <- function(Prop, Freq, PairwiseDist, P, SmoothParam = 1, Seed = 123L, NbThreads = 0L) {
    .Call(`_AdmixPoly_SimulateGeno`, Prop, Freq, PairwiseDist, P, SmoothParam, Seed, NbThreads)
}

.DeduceProp <- function(Ancestry) {
    .Call(`_AdmixPoly_DeduceProp`, Ancestry)
}

.SampleReads <- function(Geno, Depth, SeqError = 0, Seed = 123L, NbThreads = 0L) {
    .Call(`_AdmixPoly_SampleReads`, Geno, Depth, SeqError, Seed, NbThreads)
}

Try the AdmixPoly package in your browser

Any scripts or data that you put into this service are public.

AdmixPoly documentation built on June 18, 2026, 1:06 a.m.