work/color-noa.R

#!/usr/bin/env Rscript

## ---- inputs

part_file = "surprise_partition"
colors_file <- gsub("_partition","_colors", part_file)

root = getrd()
devtools::load_all(root)

## ---- imports

suppressPackageStartupMessages({
  library(geneLists)
  library(dplyr)
  library(data.table)
})


## ---- load the data

data(list=part_file) # e.g. modularity_partition == partition
data(list=colors_file) # e.g. surprise_colors == module_colors
data(ipsd_gene_map) # gene_map


## ---- create noa table for cytoscape

df <- data.table(prot=names(partition), membership = partition)
df <- df %>% mutate(entrez=mapIDs(prot,"uniprot","entrez",gene_map))
df <- df %>% mutate(new = module_colors[paste0("M",membership)])
fwrite(df,"noa-color.csv")
twesleyb/Uezu2016 documentation built on Jan. 28, 2021, 3:56 p.m.