Commit bef3e8d0 authored by smorabit's avatar smorabit
Browse files

network vis tutorial

parent 4360a543
Loading
Loading
Loading
Loading
+23 −8
Original line number Diff line number Diff line
@@ -1625,6 +1625,7 @@ RunModuleUMAP <- function(
  metric = "cosine",
  spread=1,
  min_dist=0.4,
  supervised = FALSE,
  ...
){

@@ -1658,14 +1659,28 @@ RunModuleUMAP <- function(
  umap_TOM <- TOM[selected_genes,unlist(hub_list)]

  # run UMAP
  if(supervised){
    print('running supervised UMAP:')
    hub_umap <-  uwot::umap(
      X = umap_TOM,
      min_dist = min_dist,
      n_neighbors= n_neighbors,
      metric = metric,
      spread=spread,
      y = modules$module, # for supervised UMAP
      ...
    )
  } else {
    hub_umap <-  uwot::umap(
      X = umap_TOM,
      min_dist = min_dist,
      n_neighbors= n_neighbors,
      metric = metric,
      spread=spread,
      ...
    )
  }


  # set up plotting df
  plot_df <- as.data.frame(hub_umap)
+17 −0
Original line number Diff line number Diff line
@@ -3,3 +3,20 @@ scale01 <- function(x){
  y <- min(x); z <- max(x);
  (x-y) / (z-y)
}

umap_theme <- function(){
  theme(
    axis.line=element_blank(),
    axis.text.x=element_blank(),
    axis.text.y=element_blank(),
    axis.ticks=element_blank(),
    axis.title.x=element_blank(),
    axis.title.y=element_blank(),
    panel.background=element_blank(),
    panel.border=element_blank(),
    panel.grid.major=element_blank(),
    panel.grid.minor=element_blank(),
    plot.background=element_blank(),
    plot.title = element_text(hjust = 0.5)
  )
}
+1 −1
Original line number Diff line number Diff line
@@ -758,7 +758,7 @@ HubGeneNetworkPlot <- function(
  return_graph=FALSE,
  edge.alpha=0.25,
  vertex.label.cex=0.5,
  hub.vertex.size=4,
  hub.vertex.size=4,Ω
  other.vertex.size=1,
  wgcna_name=NULL,
  ...
+1.32 MiB
Loading image diff...
+268 KiB
Loading image diff...
Loading