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

There should be an exported function that plots the true model #9

Open
rdiaz02 opened this issue Jan 16, 2024 · 1 comment
Open

There should be an exported function that plots the true model #9

rdiaz02 opened this issue Jan 16, 2024 · 1 comment

Comments

@rdiaz02
Copy link
Owner

rdiaz02 commented Jan 16, 2024

This works for DAGs

plot_model <- function(x, main = "") {
    method_info <- igraph::graph_from_data_frame(x[, c("From", "To")])
    parent_set <- evamtools:::parent_set_from_edges(x)
    evamtools:::plot_method(method_info = method_info,
                            parent_set = parent_set,
                            edges = x, 
                            method = main)
  }

where is the usual data frame with From, To, etc.

Improve and do something similar for MHN.

The above is simplified from plot_evam in file evam_plotting.R

@rdiaz02
Copy link
Owner Author

rdiaz02 commented Jan 20, 2024

And it should also include the paths (transitions) between genoytpes:

plot_hypercube_transitions <- function(x, main = "") {
    obj <- list(edges = x,
                parent_set = evamtools:::parent_set_from_edges(x))
    tmat <- as.matrix(evamtools:::cpm2tm(obj)$trans_mat_genots)
    evamtools:::plot_genot_fg(tmat, plot_type = "trans_mat")
  }
  
So we can do
  pdf(file = "true_models.pdf", width = 11, height = 11)
  par(mfrow = c(2, 2))
  par(oma = c(2, 2, 2, 2))
  plot_model(dag1)
  plot_model(dag2)
  plot_hypercube_transitions(dag1)
  title("dag1: \nTrue transitions between genotypes")
  plot_hypercube_transitions(dag2)
  title("dag2: \nTrue transitions between genotypes")
  dev.off()

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