simulateRandomWalksFromTips: Simulate Random Walks From All Tips

Description Usage Arguments Value Examples

View source: R/diffusion.R

Description

This automates the process of performing random walks for many tips. See simulateRandomWalk for more information. The output of this function can be passed to processRandomWalksFromTips directly to convert these walk data into visitation frequencies.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
simulateRandomWalksFromTips(
  object,
  tip.group.id,
  root.cells,
  transition.matrix,
  n.per.tip = 10000,
  root.visits = 1,
  max.steps = ncol(object@logupx.data),
  verbose = T
)

Arguments

object

An URD object

tip.group.id

(Character) The name of the clustering that defines tips

root.cells

(Character vector) Names of cells that constitute the root

transition.matrix

(Matrix or dgCMatrix) Biased transition matrix

n.per.tip

(Numeric) Number of walks to do per tip

root.visits

(Numeric) Number of steps to take that visit a root.cell before stopping

verbose

(Logical) Whether to report on progress

max.visits

(Numeric) Abandon walks that take more steps than this, as it likely means that it has gotten stuck. (Default is number of cells in the data. On large data, may want to lower this value.)

Value

List (of tips) of lists (of walk paths) of character vectors

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# Determine the parameters of the logistic used to bias the transition probabilities. The procedure
# is relatively robust to this parameter, but the cell numbers may need to be modified for larger
# or smaller data sets.
axial.ptlogistic <- pseudotimeDetermineLogistic(axial, "pseudotime", optimal.cells.forward=20, max.cells.back=40, do.plot = T)

# Bias the transition matrix acording to pseudotime
axial.biased.tm <- as.matrix(pseudotimeWeightTransitionMatrix(axial, "pseudotime", logistic.params=axial.ptlogistic))

# Simulate the biased random walks from each tip
axial.walks <- simulateRandomWalksFromTips(axial, tip.group.id="tip.clusters", root.cells=root.cells, transition.matrix = axial.biased.tm, n.per.tip = 25000, root.visits = 1, max.steps = 5000, verbose = F)

# Process the biased random walks into visitation frequencies
axial <- processRandomWalksFromTips(axial, axial.walks, verbose = F)

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