R/RcppExports.R

# This file was generated by Rcpp::compileAttributes
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

#' Compute likelihoods for populations of origin 
#' 
#' @param snp_zeroes Matrix of counts of the "zero" allele at L SNPs in P populations.  
#' This is an L x P integer matrix where L is the number of SNP
#' loci and P is the number of populations in the baseline. The observed number of 0 alleles
#' at locus j in population p is snp_zeroes[j,p]
#' @param snp_ones Same as above, but for the 1 allele at each SNP.
#' @param genos  Matrix of the genotypes of N individuals at each of the L loci.  Genotypes are represented
#' as the number of "1" alleles.  This is an L x N integer matrix.  The genotype of the ith individual at 
#' the locus j is genos(j,i).
#' @param lambda The parameter of the beta distribution for the frequency of the "1" allele.
#' 
#' @return Returns a P x N numeric matrix which contains the the probabilities the individuals originate from
#' certain populations.  The probability that the ith originated from population p is ouput(p,i).   
#' @export
P_likelihood <- function(snp_zeroes, snp_ones, genos, lambda) {
    .Call('SNPcontam_P_likelihood', PACKAGE = 'SNPcontam', snp_zeroes, snp_ones, genos, lambda)
}

#' Compute likelihoods for populations of origin 
#' 
#' @param snp_zeroes Matrix of counts of the "zero" allele at L SNPs in P populations.  
#' This is an L x P integer matrix where L is the number of SNP
#' loci and P is the number of populations in the baseline. The observed number of 0 alleles
#' at locus j in population p is snp_zeroes[j,p]
#' @param snp_ones Same as above, but for the 1 allele at each SNP.
#' @param genos  Matrix of the genotypes of N individuals at each of the L loci.  Genotypes are represented
#' as the number of "1" alleles.  This is an L x N integer matrix.  The genotype of the ith individual at 
#' the locus j is genos(j,i).
#' @param lambda The parameter of the beta distribution for the frequency of the "1" allele.
#' 
#' @return Returns a P*P x N numeric matrix which contains the the probabilities that contaminated individuals 
#' originated from certain combintations of two populations.  The probability that the ith individual's contamination 
#' originated from population p1 and p2 is ouput(N*(p1-1) + p2,i) + output(N*(p2-1) + p1,i) if p1 and p2
#' are different populations and output(N*(p1-1) + p1,i) if p1 and p2 are the same population.    
#' @export
Pcontam <- function(snp_zeroes, snp_ones, genos, lambda) {
    .Call('SNPcontam_Pcontam', PACKAGE = 'SNPcontam', snp_zeroes, snp_ones, genos, lambda)
}
eriqande/SNPcontam documentation built on May 16, 2019, 8:44 a.m.