genotypeCallsBayes {MPR}R Documentation

~~function to do ... ~~

Description

~~ A concise (1-5 lines) description of what the function does. ~~

Usage

genotypeCallsBayes(ALLELE.num, errorRate = 5e-04, eps = 1e-10, maxIterate = 100, verbose = FALSE)

Arguments

ALLELE.num ~~Describe ALLELE.num here~~
errorRate ~~Describe errorRate here~~
eps ~~Describe eps here~~
maxIterate ~~Describe maxIterate here~~
verbose ~~Describe verbose here~~

Details

~~ If necessary, more details than the description above ~~

Value

~Describe the value returned If it is a LIST, use

comp1 Description of 'comp1'
comp2 Description of 'comp2'

...

Warning

....

Note

~~further notes~~

~Make other sections like Warning with section{Warning }{....} ~

Author(s)

~~who you are~~

References

~put references to the literature/web site here ~

See Also

~~objects to See Also as help, ~~~

Examples

##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--    or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (ALLELE.num, errorRate = 5e-04, eps = 1e-10, maxIterate = 100, 
    verbose = FALSE) 
{
    P0.n <- 0.5
    P0.p1 <- P0.p2 <- (1 - P0.n)/2
    ALLELE.prob <- NULL
    P.n <- 1/3
    P.p1 <- P.p2 <- (1 - P.n)/2
    numIterate <- 1
    E <- errorRate
    while (abs(P0.n - P.n) > eps && numIterate <= maxIterate) {
        P0.p1 <- P.p1
        P0.p2 <- P.p2
        P0.n <- P.n
        n <- rowSums(ALLELE.num)
        k <- ALLELE.num[, 1]
        ALLELE.prob <- cbind((1 - E)^k * E^(n - k), 0.5^n, (1 - 
            E)^(n - k) * E^k) %*% diag(c(P0.p1, P0.n, P0.p2))
        ALLELE.type <- rep(NA, nrow(ALLELE.prob))
        ALLELE.maxprob <- rowMax(ALLELE.prob)
        ALLELE.type[ALLELE.prob[, 1] == ALLELE.maxprob] <- 1
        ALLELE.type[ALLELE.prob[, 3] == ALLELE.maxprob] <- 3
        ALLELE.type[ALLELE.prob[, 2] == ALLELE.maxprob | ALLELE.prob[, 
            1] == ALLELE.prob[, 3]] <- 2
        P.n <- mean(ALLELE.type == 2)
        P.p1 <- P.p2 <- (1 - P.n)/2
        if (verbose) 
            cat(P.p1, P.n, P.p2, table(filter.markers <- ALLELE.type != 
                2), "\n", sep = "\t")
        numIterate <- numIterate + 1
    }
    ALLELE.prob <- ALLELE.prob/rowSums(ALLELE.prob, na.rm = TRUE)
    list(prop = c(P.p1, P.n, P.p2), prob = ALLELE.prob, type = ALLELE.type)
  }

[Package MPR version 0.1 Index]