R/maximizeInterpolant.R

Defines functions maximizeInterpolant

Documented in maximizeInterpolant

maximizeInterpolant <- function( x, y ) 
# maximizeInterpolant: written by Aaron Lun
#
# This function takes an ordered set of spline points and a likelihood matrix where each row 
# corresponds to a tag and each column corresponds to a spline point. It then calculates the 
# position at which the maximum interpolated likelihood occurs for each by solving the derivative
# of the spline function.
{
    if (is.vector(y)) {
        y<-rbind(y)
        warning("coverting vector of likelihoods to matrix format for interpolation")
    }
    if (length(x)!=ncol(y)) { 
        stop("number of columns must equal number of spline points")
    } else if (is.unsorted(x) || anyDuplicated(x)) {
        stop("spline points must be unique and sorted")
    }

#	Performing some type checking.
	if (!is.double(x)) storage.mode(x)<-"double"
	if (!is.double(y)) storage.mode(y)<-"double"
    out<-.Call(.cxx_maximize_interpolant, x, y)
    return(out)
}

Try the edgeR package in your browser

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

edgeR documentation built on Jan. 16, 2021, 2:03 a.m.