Type: | Package |
Title: | Plot Connectivity Between Cells from Different Time Points |
Version: | 0.1.0 |
Description: | It shows the connections between selected clusters from the latest time point and the clusters from all the previous time points. The transition matrices between time point t and t+1 are obtained from Waddington-OT analysis https://github.com/ScialdoneLab/WOTPLY. |
License: | GPL-3 |
Depends: | R (≥ 4.0) |
Imports: | network, GGally, sna |
Suggests: | testthat, knitr |
VignetteBuilder: | knitr |
biocViews: | software |
Encoding: | UTF-8 |
RoxygenNote: | 7.1.1 |
NeedsCompilation: | no |
Packaged: | 2022-09-09 09:31:08 UTC; gabriele.lubatti |
Author: | Gabriele Lubatti [aut, cre, cph] |
Maintainer: | Gabriele Lubatti <gabriele.lubatti@helmholtz-muenchen.de> |
Repository: | CRAN |
Date/Publication: | 2022-09-12 07:43:01 UTC |
WOTPLY
Description
A ggnet2 plot is generated showing the connections between selected_stages from the latest time point and the clusters from previous time points . The number of columns is equal to the numbers of time points. In each column, the cluster of the corresponding time point is shown as network node. The weight of the links between clusters at time points t and t+1 reflect the weight of the transition probabilities from list_transition_matrices.
Usage
WOTPLY(
list_transition_matrices,
selected_stages,
cluster_label,
legend_time,
customize_color,
top_link = NULL
)
Arguments
list_transition_matrices |
List of transition matrices. Each matrix contains the transition probabilitiesfrom the clusters at time t (on the columns) towards the clusters at time t+1 (on the rows). The matrices can be obtain from function get_transition_matrix |
selected_stages |
Vector with the name of the clusters related to the latest time point for which we want to know the connection to clusters at previous time points. |
cluster_label |
Vector with the cluster information for all the cells from all time points. |
legend_time |
Vector with time information with length equal to the number of time points. |
customize_color |
Character vector with the name of the colour for each cluster (node) in each time point. |
top_link |
Integer.Maximum number of links to select between clusters at time t and clusters at time t+1. Links are sorted according to the weight and then only the top_link are kept. If NULL (default), all the links are kept. |
Value
A ggnet2 plot
Author(s)
Gabriele Lubatti gabriele.lubatti@helmholtz-muenchen.de
See Also
https://CRAN.R-project.org/package=GGally
Examples
transition_1 <- matrix(1,ncol = 2,nrow = 2)
colnames(transition_1) <- c("Stage1", "Stage2")
row.names(transition_1) <- c("Stage1", "Stage2")
l_t <- list((transition_1))
selected_stages <- c("Stage1")
cluster_label <- c("Stage1", "Stage2")
legend_time <- c("Day1", "Day2")
customize_color <- c("#F8766D", "#00BFC4")
WOTPLY(l_t, selected_stages, cluster_label, legend_time, customize_color)
convert_names
Description
convert_names
Usage
convert_names(new_row, new_col, transition_matrix)
Arguments
new_row |
Vector with the new row names to assign to transition_matrix |
new_col |
Vector with the new column names to assign to transition_matrix |
transition_matrix |
Output from get_transition_matrix. |
Value
A matrix with row names equal to new_row and column names equal to new_col.
Author(s)
Gabriele Lubatti gabriele.lubatti@helmholtz-muenchen.de
Examples
transition_1 <- matrix(1, ncol = 2, nrow = 2)
colnames(transition_1) <- c("Stage1", "Stage2")
row.names(transition_1) <- c("Stage1", "Stage2")
col_name_new <- c("Stage1_new", "Stage2_new")
row_name_new <- c("Stage1_new", "Stage2_new")
transition_1 <- convert_names(row_name_new, col_name_new, transition_1)
get_transition_matrix
Description
The output of compute_all_transport_maps from pythonpackage WOT is a matrix. Each entry (i,j) describes the transition probability of cell i at time t towards cluster j at time t+1. From this matrix, the average of the transition probability for all the cells at time t belonging to the same cluster is computed. Finally only the entries of the resulting matrix with above threshold are kept. The row names of the final matrix are equal to level_t_plus, while the column names are equal to the levels of cluster_t.
Usage
get_transition_matrix(path, cluster_t, threshold, cells_t)
Arguments
path |
Character string with the path to the folder with the outputof the function compute_all_transport_maps from pythonpackage WOT. |
cluster_t |
Vector with cluster assignment for cells at time t. The length is equal to the length of cells_t. |
threshold |
Numeric value. Only entry of the transition matrix with weight equal or above threshold are kept. |
cells_t |
Character vector with the name of cells at time t for which we want to obtain the transition matrix. |
Value
A matrix with row names equal to level_t_plus and column names equal to the levels of cluster_t.
Author(s)
Gabriele Lubatti gabriele.lubatti@helmholtz-muenchen.de
See Also
https://broadinstitute.github.io/wot/
select_top_weights
Description
select_top_weights
Usage
select_top_weights(transition_matrix, top_link = NULL)
Arguments
transition_matrix |
Output from get_transition_matrix. |
top_link |
Integer.Maximum number of links to select between clusters at time t and clusters at time t+1. Links are sorted according to the weight and then only the top_link are kept. If NULL (default), all the links are kept. |
Value
A matrix
Author(s)
Gabriele Lubatti gabriele.lubatti@helmholtz-muenchen.de