pseudotimeWeightTransitionMatrix: Weight transition matrix by pseudotime

Description Usage Arguments Value Examples

View source: R/diffusion.R

Description

This takes the matrix of transition probabilities and biases them according to the difference in pseudotime between each pair of cells. The parameters of the logistic function can be manually chosen or determined using pseudotimeDetermineLogistic. The biased transition matrix is used as input to simulateRandomWalk or simulateRandomWalksFromTips.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
pseudotimeWeightTransitionMatrix(
  object,
  pseudotime,
  x0 = NULL,
  k = NULL,
  logistic.params = NULL,
  pseudotime.direction = "<",
  max.records = 2.25e+08,
  verbose = F
)

Arguments

object

An URD object

pseudotime

(Character) Name of pseudotime to use for biasing (i.e. a column name of @pseudotime)

x0

(Numeric) Inflection point of the logistic function (in terms of pseudotime difference). Can be left NULL if logistic.params is specified.

k

(Numeric) Slope of the logistic function. Can be left NULL if logistic.params is specified.

logistic.params

(List) Output from pseudotimeDetermineLogistic that specifies both x0 and k.

pseudotime.direction

(Character: ">" or "<") Which direction to bias the transition probabilities ("<" is default, which biases them to move toward cells with younger pseudotime.)

max.records

(Numeric) To prevent RAM / addressable space problems, maximum transitions to process at a time

verbose

(Logical) Provide status updates?

Value

Sparse Matrix (dgCMatrix) of transition probabilities, weighted by pseudotime

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Determine parameters of logistic function
diffusion.logistic <- pseudotimeDetermineLogistic(object, "pseudotime", optimal.cells.forward = 40, max.cells.back = 80, pseudotime.direction = "<", do.plot = T, print.values = T)

# Generate biased transition matrix
biased.tm <- pseudotimeWeightTransitionMatrix(object, pseudotime = "pseudotime", logistic.params = diffusion.logistic, pseudotime.direction = "<")

# Simulate random walks
these.walks <- simulateRandomWalk(start.cells = tip.10.cells, transition.matrix = biased.tm, end.cells = root.cells, n = 50000, end.visits = 1, verbose.freq = 2500, max.steps = 5000)

# Process walks into visitation frequency
object <- processRandomWalks(object, walks = these.walks, walks.name = "10", verbose = F)

farrellja/URD documentation built on June 17, 2020, 4:48 a.m.