cnet_heatmap_guide.md

Brief steps to produce a Cnet-Heatmap plot

  1. Run multiEnrichMap()

  2. Apply appropriate p_cutoff, and topEnrichN to reduce the number of pathways per enrichment result, topEnrichN from 10 to 20 for two enrichment results; topEnrichN 4 to 10 for four or more enrichment results.

  3. Run mem_plot_folio()

cairo_pdf(file="folio_mem_DM_AffySoma_top20_23apr2020.pdf",
   height=12, width=12, pointsize=11, onefile=TRUE);
mem_dm_plots <- mem_plot_folio(mem_dm_affysoma,
   do_which=2:5,
   pathway_column_split=4,
   main="Dermatomyositis Affy-SomaLogic");
dev.off();

Extract cnet_collapsed_set as the Cnet plot to use for the Cnet-Heatmap.

ht_opt("legend_border"="black");
cnet_collapsed_set <- mem_dm_plots$cnet_collapsed_set;

# Optionally rotate igraph layout coordinates to help position labels
#cnet_collapsed_set <- rotate_igraph_layout(cnet_collapsed_set, degree=180);
#cnet_collapsed_set <- spread_igraph_labels(cnet_collapsed_set);

E(cnet_collapsed_set)$color <- "#BBBBBB99";
V(cnet_collapsed_set)$frame.color <- "#77777799";
isset <- V(cnet_collapsed_set)$nodeType %in% "Set";
V(cnet_collapsed_set)$label <- ifelse(isset,
   V(cnet_collapsed_set)$name,
   V(cnet_collapsed_set)$label);
V(cnet_collapsed_set)$label.family <- "Arial";
V(cnet_collapsed_set)$label.color <- ifelse(isset,
   "grey85",
   "grey10");
## Manually add distance for label from node
V(cnet_collapsed_set)$label.dist <- 0.8;
V(cnet_collapsed_set)$label.dist[igrep("^PR", V(cnet_collapsed_set)$name)] <- 2;
{cairo_pdf(file="DM_Lupus_GeneProtein_MultiEnrich_Heatmap_27apr2020.pdf",
   height=9, width=10, pointsize=12);
all_samples_dmsle2
igroups_dlgp <- gsubOrdered("[a-z_ ]+", "", all_cohort_type[all_samples_dmsle2])
colorV_dlgp <- nameVector(mem_dmlupus_affysoma$colorV,
   levels(factor(igroups_dlgp[all_samples_dmsle2])));
pch_dlgp2 <- plot_cnet_heatmaps(mem_folio=mem_dmlupus_affysoma_plots6,
   iexprs_ctr=all_pergene_exprs_ctr,
   isamples=all_samples_dmsle2,
   rotate_degrees=15,
   layout_reflect="y",
   igroups=igroups_dlgp,
   set_names=c("A","B","D","C"),
   set_panel_row=list(c(1:5), c(1:4), c(6:8), c(6:8)),
   cnet_mar=c(0.5, 6.2, 0.7, 6),
   vjust=c(0.9, 0.9, -0.5, -0.5),
   strwrap_width=c(60, 33, 36, 36),
   colorV=colorV_dlgp)
dev.off();}
## Convert to data.frame format
dlgp_df_cnet <- get_shared_pathways(ipa_pathways_all,
   groups=mem_dmlupus_affysoma$enrichLabels,
   cnet=mem_dmlupus_affysoma_plots6_v2$cnet_collapsed_set,
   subset_cnet=TRUE);
## save to xlsx
save_shared_pathways(file="DM_Lupus_GeneProtein_MultiEnrich_Heatmap_top4_20apr2020.xlsx",
   df=dlgp_df_cnet,
   sheetName="multienrich_DM_Lupus_GP",
   colorSub=colorSub);


jmw86069/multienrichjam documentation built on Feb. 7, 2024, 12:58 a.m.