embedCurves: Embed trajectory in new space

Description Usage Arguments Details Value Examples

Description

This function takes the output of slingshot (or getCurves) and attempts to embed the curves in a different coordinate space than the one in which they were constructed. This should be considered as a visualization tool, only.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
embedCurves(x, newDimRed, ...)

## S4 method for signature 'SlingshotDataSet,matrix'
embedCurves(
  x,
  newDimRed,
  shrink = NULL,
  stretch = NULL,
  approx_points = NULL,
  smoother = NULL,
  shrink.method = NULL,
  ...
)

## S4 method for signature 'SingleCellExperiment,matrix'
embedCurves(
  x,
  newDimRed,
  shrink = NULL,
  stretch = NULL,
  approx_points = NULL,
  smoother = NULL,
  shrink.method = NULL,
  ...
)

## S4 method for signature 'SingleCellExperiment,character'
embedCurves(
  x,
  newDimRed,
  shrink = NULL,
  stretch = NULL,
  approx_points = NULL,
  smoother = NULL,
  shrink.method = NULL,
  ...
)

Arguments

x

an object containing slingshot output.

newDimRed

a matrix representing the new coordinate space in which to embed the slingshot curves.

...

Additional parameters to pass to scatter plot smoothing function, smoother.

shrink

logical or numeric between 0 and 1, determines whether and how much to shrink branching lineages toward their average prior to the split.

stretch

numeric factor by which curves can be extrapolated beyond endpoints. Default is 2, see principal_curve.

approx_points

numeric, whether curves should be approximated by a fixed number of points. If FALSE (or 0), no approximation will be performed and curves will contain as many points as the input data. If numeric, curves will be approximated by this number of points; preferably about 100 (see principal_curve).

smoother,

choice of scatter plot smoother. Same as principal_curve, but "lowess" option is replaced with "loess" for additional flexibility.

shrink.method

character denoting how to determine the appropriate amount of shrinkage for a branching lineage. Accepted values are the same as for kernel in density (default is "cosine"), as well as "tricube" and "density". See 'Details' for more.

Details

Many of the same parameters are used here as in getCurves. This function attempts to translate curves from one reduced dimensional space to another by predicting each dimension as a function of pseudotime (ie. the new curve is determined by a series of scatterplot smoothers predicting the coordinates in the new space as a function of pseudotime). Because the pseudotime values are not changed, this amounts to a single iteration of the iterative curve-fitting process used by getCurves.

Note that non-linear dimensionality reduction techniques (such as tSNE and UMAP) may produce discontinuities not observed in other spaces. Use caution when embedding curves in these spaces.

Value

a SlingshotDataSet containing curves in the new space.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
data("slingshotExample")
rd <- slingshotExample$rd
cl <- slingshotExample$cl
sds <- slingshot(rd, cl)
rd2 <- cbind(rd[,2] + rnorm(nrow(rd)), -rd[,1] + rnorm(nrow(rd)))
sds.new <- embedCurves(sds, rd2)
sds.new

plot(rd2, col = cl, asp = 1)
lines(sds.new, lwd = 3)

slingshot documentation built on Nov. 8, 2020, 5:51 p.m.