comparison 16_fgsea/GSEA.R @ 2:9e75d29c2409 draft default tip

Uploaded
author dktanwar
date Mon, 18 Dec 2017 21:08:31 -0500
parents b75ceb945966
children
comparison
equal deleted inserted replaced
1:91eed1b5c009 2:9e75d29c2409
10 10
11 # Import library 11 # Import library
12 library("getopt") 12 library("getopt")
13 library("fgsea") 13 library("fgsea")
14 library("Rcpp") 14 library("Rcpp")
15 library("data.table")
15 16
16 options(stringAsfactors = FALSE, useFancyQuotes = FALSE) 17 options(stringAsfactors = FALSE, useFancyQuotes = FALSE)
17 18
18 # Take in trailing command line arguments 19 # Take in trailing command line arguments
19 args <- commandArgs(trailingOnly = TRUE) 20 args <- commandArgs(trailingOnly = TRUE)
33 # cat("\n input: ", options$input1) 34 # cat("\n input: ", options$input1)
34 # cat("\n input: ", options$input2) 35 # cat("\n input: ", options$input2)
35 # cat("\n output: ", options$output) 36 # cat("\n output: ", options$output)
36 37
37 # Rank file 38 # Rank file
38 ranks <- read.table(options$input1, header=F, colClasses = c("character", "numeric")) 39 ranks <- fread(options$input1, header=T, stringsAsFactors = F)
39 ranks <- setNames(ranks[,2], ranks[,1]) 40 ranks <- data.frame(ranks)
41 r <- ranks[abs(ranks$logFC) >= 0.5 & ranks$PValue <= 0.05,]
42 r <- r[,c(1, 2)]
43 ranks <- setNames(r[,2], r[,1])
40 44
41 # Pathways database 45 # Pathways database
42 pathways <- gmtPathways(options$input2) 46 pathways <- gmtPathways(options$input2)
43 47
44 # running analysis 48 # running analysis