Learn R Programming

slingshot (version 2.1.1)

predict,PseudotimeOrdering-method: Predict from a Slingshot model

Description

Map new observations onto simultaneous principal curves fitted by slingshot.

Usage

# S4 method for PseudotimeOrdering
predict(object, newdata = NULL)

# S4 method for SlingshotDataSet predict(object, newdata = NULL)

Arguments

object

a PseudotimeOrdering or SlingshotDataSet containing simultaneous principal curves to use for prediction.

newdata

a matrix or data frame of new points in the same reduced-dimensional space as the original input to slingshot (or getLineages).

Value

An object of the same type as object, based on the input newdata. New cells are treated as "unclustered", but other metadata is preserved. The curves slot represents the projections of each new cell onto the existing curves. As with standard slingshot output, the lineage-specific pseudotimes and assignment weights can be accessed via the functions slingPseudotime and slingCurveWeights.

Details

This function is a method for the generic function predict with inputs being either a PseudotimeOrdering or SlingshotDataSet. If no newdata argument is provided, it will return the original results, given by object.

See Also

slingshot

Examples

Run this code
# NOT RUN {
data("slingshotExample")
rd <- slingshotExample$rd
cl <- slingshotExample$cl
pto <- slingshot(rd, cl, start.clus = '1')

x <- cbind(runif(100, min = -5, max = 10), runif(100, min = -4, max = 4))
predict(pto, x)

# }

Run the code above in your browser using DataLab