Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

divergence regions when rooting #148

Open
rcannood opened this issue Oct 12, 2019 · 0 comments
Open

divergence regions when rooting #148

rcannood opened this issue Oct 12, 2019 · 0 comments

Comments

@rcannood
Copy link
Member

rcannood commented Oct 12, 2019

What to do when rooting a trajectory with divergence regions? Should we remove the region and project the cell to the closest point in the trajectory? Or do we flip the divergence region and change the edges in the trajectory? We could make this a parameter of add_root().

Example code
library(tidyverse)
library(dyno)

cell_ids <- c("a", "b", "c", "d", "e", "f")
milestone_ids <- c("W", "X", "Y", "Z", "A")

milestone_network <- tribble(
  ~from, ~to, ~length, ~directed,
  "W", "X", 2, TRUE,
  "X", "Z", 4, TRUE,
  "X", "Y", 3, TRUE,
  "Z", "A", 5, TRUE
)

divergence_regions <- tribble(
  ~divergence_id, ~milestone_id, ~is_start,
  "XYZ", "X", TRUE,
  "XYZ", "Y", FALSE,
  "XYZ", "Z", FALSE
)

milestone_percentages <- tribble(
  ~cell_id, ~milestone_id, ~percentage,
  "a", "W", .9,
  "a", "X", .1,
  "b", "W", .2,
  "b", "X", .8,
  "c", "X", .8,
  "c", "Z", .2,
  "d", "X", .2,
  "d", "Y", .7,
  "d", "Z", .1,
  "e", "X", .3,
  "e", "Y", .2,
  "e", "Z", .5,
  "f", "Z", .8,
  "f", "A", .2
)

trajectory <- wrap_data(
  id = "test",
  cell_ids = cell_ids
) %>% add_trajectory(
  milestone_ids = milestone_ids,
  milestone_network = milestone_network,
  milestone_percentages = milestone_percentages,
  divergence_regions = divergence_regions
)

g1 <- plot_graph(trajectory, label_milestones = TRUE)

trajectory2 <- trajectory %>% add_root(root_milestone_id = "Y")
g2 <- plot_graph(trajectory2, label_milestones = TRUE)

patchwork::wrap_plots(g1, g2)

plot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant