Convert DAVID gene-sets to GMT format
Instructions
install R from
http://cran.r-project.org/- before running the script, make sure you have changed the working directory to the file location
use the GUI menu (e.g., Mac OS: Misc/Change Working Directory)
or setwd ("...") where '...' is the path
check using list.files () that the file you want to convert is present
- copy-and-paste the following script into the R console
the output file will be: DAVID.GMT
R Script
file.name <- "..."
gs.df <- read.table (
file = file.name,
sep = "\t", header = F,
stringsAsFactors = F,
col.names = c ("Eg.ID", "Gs.ID")
)
gs.ls <- unstack (gs.df, form = Eg.ID ~ Gs.ID)
cat (
paste (
names (gs.ls), names (gs.ls),
sapply (gs.ls, paste, collapse = "\t"),
sep = "\t"
),
sep = "\n",
file = "DAVID.GMT"
) 