If trajectory inference needs to be manually done condition per condition, this allows to merge them into one. It requires manual mapping of lineages.
merge_sds(..., mapping, condition_id = seq_len(ncol(mapping)), scale = FALSE)
... | Slingshot datasets |
---|---|
mapping | a matrix, one column per dataset. Each row amounts to lineage mapping. |
condition_id | A vector of condition for each condition. Default to integer values in order of appearance |
scale | If TRUE (default), lineages that are mapped are scaled to have the same length. |
A modified slingshot dataset that can be used for downstream steps.
The function assumes that each lineage in a dataset maps to exactly one lineage in another dataset. Anything else needs to be done manually.
data(list = 'slingshotExample', package = "slingshot") if (!"cl" %in% ls()) { rd <- slingshotExample$rd cl <- slingshotExample$cl } sds <- slingshot::slingshot(rd, cl) merge_sds(sds, sds, mapping = matrix(c(1, 2, 1, 2), nrow = 2))#> class: PseudotimeOrdering #> dim: 280 2 #> metadata(4): lineages mst slingParams curves #> pathStats(2): pseudotime weights #> cellnames(280): cell-1 cell-2 ... cell-139 cell-140 #> cellData names(2): reducedDim clusterLabels #> pathnames(2): Lineage1 Lineage2 #> pathData names(0):