adding renewed FOSSY heatmap
This commit is contained in:
parent
822103ec3a
commit
5239a8458a
BIN
073125_FOSSY_comm_heatmap.png
Normal file
BIN
073125_FOSSY_comm_heatmap.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 750 KiB |
@ -1,17 +0,0 @@
|
|||||||
1. SSH tunnel from your workstation using the following command:
|
|
||||||
|
|
||||||
ssh -N -L 8787:n3441:48367 mjilg@klone.hyak.uw.edu
|
|
||||||
|
|
||||||
and point your web browser to http://localhost:8787
|
|
||||||
|
|
||||||
2. log in to RStudio Server using the following credentials:
|
|
||||||
|
|
||||||
user: mjilg
|
|
||||||
password: WYkG3aRTe0NQjsw3Ayg6
|
|
||||||
|
|
||||||
When done using RStudio Server, terminate the job by:
|
|
||||||
|
|
||||||
1. Exit the RStudio Session ("power" button in the top right corner of the RStudio window)
|
|
||||||
2. Issue the following command on the login node:
|
|
||||||
|
|
||||||
scancel -f 27817681
|
|
@ -27,35 +27,69 @@ X <- do.call(rbind, neurobiber_df$normalized_features_vec)
|
|||||||
library(coop)
|
library(coop)
|
||||||
#cos_sim1 <- coop::cosine(t(X))
|
#cos_sim1 <- coop::cosine(t(X))
|
||||||
|
|
||||||
|
|
||||||
register_means <- aggregate(
|
register_means <- aggregate(
|
||||||
X,
|
X,
|
||||||
by = list(
|
by = list(
|
||||||
priority = neurobiber_df$priority,
|
|
||||||
outcome= neurobiber_df$task_status,
|
outcome= neurobiber_df$task_status,
|
||||||
phase = neurobiber_df$phase,
|
|
||||||
source = neurobiber_df$source,
|
source = neurobiber_df$source,
|
||||||
affiliation = neurobiber_df$AuthorWMFAffil
|
affiliation = neurobiber_df$AuthorWMFAffil
|
||||||
),
|
),
|
||||||
FUN = mean
|
FUN = mean
|
||||||
)
|
)
|
||||||
|
|
||||||
feature_mat <- as.matrix(register_means[, -(1:5)])
|
feature_mat <- as.matrix(register_means[, -(1:3)])
|
||||||
cos_sim_matrix <- coop::cosine(t(feature_mat))
|
cos_sim_matrix <- coop::cosine(t(feature_mat))
|
||||||
rownames(cos_sim_matrix) <- apply(register_means[, 1:5], 1, paste, collapse = "_")
|
rownames(cos_sim_matrix) <- apply(register_means[, 1:3], 1, paste, collapse = "_")
|
||||||
colnames(cos_sim_matrix) <- rownames(cos_sim_matrix)
|
colnames(cos_sim_matrix) <- rownames(cos_sim_matrix)
|
||||||
|
|
||||||
|
|
||||||
scaled_mat <- scale(cos_sim_matrix)
|
annotation_row <- data.frame(
|
||||||
|
affiliation = register_means$affiliation,
|
||||||
|
source = register_means$source
|
||||||
|
)
|
||||||
|
rownames(annotation_row) <- rownames(cos_sim_matrix)
|
||||||
|
|
||||||
|
annotation_col <- data.frame(
|
||||||
|
affiliation = register_means$affiliation,
|
||||||
|
source = register_means$source
|
||||||
|
)
|
||||||
|
rownames(annotation_col) <- colnames(cos_sim_matrix)
|
||||||
|
|
||||||
|
annotation_row <- annotation_row |>
|
||||||
|
mutate(affil = case_when(
|
||||||
|
affiliation == "True" ~ "WMF",
|
||||||
|
affiliation == "False" ~ "non-WMF"
|
||||||
|
)) |> select(-affiliation)
|
||||||
|
|
||||||
|
annotation_col <- annotation_col |>
|
||||||
|
mutate(affil = case_when(
|
||||||
|
affiliation == "True" ~ "WMF",
|
||||||
|
affiliation == "False" ~ "non-WMF"
|
||||||
|
)) |> select(-affiliation)
|
||||||
|
|
||||||
|
|
||||||
|
my_annotation_colors = list(
|
||||||
|
affil = c("WMF" = "green", "non-WMF" = "purple"),
|
||||||
|
source = c(c1 = "lightgrey", c2 = "grey", c3 = "black")
|
||||||
|
)
|
||||||
|
|
||||||
|
cos_sim_matrix[lower.tri(cos_sim_matrix)] <- NA
|
||||||
#pheatmap(scaled_mat, symm = TRUE)
|
#pheatmap(scaled_mat, symm = TRUE)
|
||||||
#heatmap(cos_sim_matrix, col=heat.colors(256), breaks=seq(-1, 1, length.out=257))
|
#heatmap(cos_sim_matrix, col=heat.colors(256), breaks=seq(-1, 1, length.out=257))
|
||||||
library(viridis)
|
library(viridis)
|
||||||
library(pheatmap)
|
library(pheatmap)
|
||||||
pheatmap(cos_sim_matrix,
|
fossy_heatmap <- pheatmap(cos_sim_matrix,
|
||||||
cluster_rows = FALSE, # Now features are clustered (rows)
|
cluster_rows = FALSE,
|
||||||
cluster_cols = FALSE,
|
cluster_cols = FALSE,
|
||||||
scale='none',
|
scale='none',
|
||||||
color = viridis(100)) # Standardize featu
|
annotation_row = annotation_row,
|
||||||
|
annotation_col = annotation_col,
|
||||||
|
annotation_colors = my_annotation_colors,
|
||||||
|
na_col = "white")
|
||||||
|
|
||||||
diag(cos_sim_matrix) <- NA
|
ggsave(filename = "073125_FOSSY_comm_heatmap.png", plot = fossy_heatmap, width = 9, height = 9, dpi = 800)
|
||||||
which(cos_sim_matrix == max(cos_sim_matrix, na.rm = TRUE), arr.ind = TRUE) # Most similar
|
|
||||||
which(cos_sim_matrix == min(cos_sim_matrix, na.rm = TRUE), arr.ind = TRUE) # Least similar
|
#diag(cos_sim_matrix) <- NA
|
||||||
|
#which(cos_sim_matrix == max(cos_sim_matrix, na.rm = TRUE), arr.ind = TRUE) # Most similar
|
||||||
|
#which(cos_sim_matrix == min(cos_sim_matrix, na.rm = TRUE), arr.ind = TRUE) # Least similar
|
||||||
|
Loading…
Reference in New Issue
Block a user