localMPR {MPR}R Documentation

~~function to do ... ~~

Description

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

Usage

localMPR(baseData, allele.matrix = NULL, maxIterate = 50, returnNumIterate = FALSE, maxNStep = 5, verbose = FALSE, strEND = "\n", ...)

Arguments

baseData ~~Describe baseData here~~
allele.matrix ~~Describe allele.matrix here~~
maxIterate ~~Describe maxIterate here~~
returnNumIterate ~~Describe returnNumIterate here~~
maxNStep ~~Describe maxNStep here~~
verbose ~~Describe verbose here~~
strEND ~~Describe strEND here~~
... ~~Describe ... 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 (baseData, allele.matrix = NULL, maxIterate = 50, returnNumIterate = FALSE, 
    maxNStep = 5, verbose = FALSE, strEND = "\n", ...) 
{
    if (is.null(allele.matrix)) 
        allele.matrix <- base2Allele(baseData)
    if (nrow(baseData) == ncol(allele.matrix)) 
        allele.matrix <- t(allele.matrix)
    if (nrow(baseData) != nrow(allele.matrix)) 
        stop("nrow(baseData)!=nrow(allele.matrix), allele.matrix error!!!")
    newALLELE <- ALLELE <- allele.matrix
    genoData <- base2Geno(baseData, allele.matrix)
    newRSum <- oriRSum <- length(baseData)
    numStepSize <- 1
    numIterate <- 0
    while (numStepSize <= maxNStep) {
        numIterate <- numIterate + 1
        if (verbose) 
            cat("\r", numIterate, "\t", newRSum, "\t", numStepSize, 
                "\n")
        oriRSum <- newRSum
        loopRes <- .loopMPR(genoData, allele.matrix = ALLELE, 
            numStep = numStepSize)
        newRSum <- loopRes[[1]]
        if (oriRSum > newRSum) {
            ALLELE <- loopRes[[2]]
            genoData <- loopRes[[3]]
            numStepSize <- 1
        }
        else {
            numStepSize <- numStepSize + 1
        }
    }
    if (verbose) 
        cat("\tDone.", strEND)
    rownames(ALLELE) <- rownames(baseData)
    if (returnNumIterate) 
        list(allele = ALLELE, num_iterate = numIterate, numR = newRSum)
    else ALLELE
  }

[Package MPR version 0.1 Index]