view 16_fgsea/.Rhistory @ 0:b75ceb945966 draft

Uploaded
author dktanwar
date Mon, 11 Dec 2017 09:52:26 -0500
parents
children
line wrap: on
line source

setwd("/Volumes/BINF1_Raid/home/dtanwar/projects/H3K4me3_McMasterU/exp/20171026-GO_analysis_232_changed_genes-11/20171027-ranked_genes_232")
table <- read.delim("./input/20170722-genes_info_TSS_500bp.txt.xz", sep = "\t", header = T,
stringsAsFactors = F)
View(table)
table <- read.delim("./input/20170722-genes_info_TSS_500bp.txt.xz", sep = "\t", header = T,
stringsAsFactors = F)[,c(22,7)]
View(table)
sp_table <- split(x = table, f = table$SYMBOL)
genes <- lapply(sp_table, function(x){
a <- x[1,]
a[,2] <- mean(x[,2])
return(a)
})
library(plyr)
gl <- ldply(genes, data.frame)
View(gl)
gl <- ldply(genes, data.frame)[,-1]
View(gl)
gl[,1] <- toupper(gl[,1])
View(gl)
write.table(gl, "./output/ranked_genes_list_232.rnk", quote = F, sep = "\t", row.names = F, col.names = F)
setwd("/Volumes/BINF1_Raid/home/dtanwar/projects/H3K4me3_McMasterU/exp/20171026-GO_analysis_232_changed_genes-11/20171027-01_ranked_genes_232")
library(plyr)
table <- read.delim("./input/20170722-genes_info_TSS_500bp.txt.xz", sep = "\t", header = T,
stringsAsFactors = F)[,c(22,7)]
sp_table <- split(x = table, f = table$SYMBOL)
genes <- lapply(sp_table, function(x){
a <- x[1,]
a[,2] <- mean(x[,2])
return(a)
})
gl <- ldply(genes, data.frame)[,-1]
write.table(gl, "./output/20171029-original_ranked_genes_list_232.rnk", quote = F, sep = "\t", row.names = F, col.names = F)
gl[,1] <- toupper(gl[,1])
write.table(gl, "./output/ranked_genes_list_232.rnk", quote = F, sep = "\t", row.names = F, col.names = F)
library(plyr)
table <- read.delim("./input/20170722-genes_info_TSS_500bp.txt.xz", sep = "\t", header = T,
stringsAsFactors = F)[,c(22,7)]
sp_table <- split(x = table, f = table$SYMBOL)
genes <- lapply(sp_table, function(x){
a <- x[1,]
a[,2] <- mean(x[,2])
return(a)
})
gl <- ldply(genes, data.frame)[,-1]
gl
write.table(gl, "./output/20171029-original_ranked_genes_list_232.rnk", quote = F, sep = "\t", row.names = F, col.names = F)
gl[,1] <- toupper(gl[,1])
write.table(gl, "./output/ranked_genes_list_232.rnk", quote = F, sep = "\t", row.names = F, col.names = F)
# Send R errors to stderr
options(show.error.messages = F, error = function(){cat(geterrmessage(), file = stderr()); q("no", 1, F)})
# Avoid crashing Galaxy with an UTF8 error on German LC settings
loc <- Sys.setlocale("LC_MESSAGES", "en_US.UTF-8")
# Import libraries
library("GenomicRanges")
source("https://bioconductor.org/biocLite.R")
biocLite()
source("http://bioconductor.org/biocLite.R")
biocLite()
library("getopt")
library("edgeR")
library("openxlsx")
library("data.table")
biocLite("getopt")
# biocLite("openxlsx")
biocLite("data.table")
# Send R errors to stderr
options(show.error.messages = F, error = function(){cat(geterrmessage(), file = stderr()); q("no", 1, F)})
# Avoid crashing Galaxy with an UTF8 error on German LC settings
loc <- Sys.setlocale("LC_MESSAGES", "en_US.UTF-8")
library("getopt")
library("edgeR")
biocLite("getopt")
source("http://bioconductor.org/biocLite.R")
biocLite()
biocLite("edgeR")
biocLite("edgeR")
biocLite("Rcpp")
biocLite("limma")
biocLite("edgeR")
biocLite("edgeR")
source("http://bioconductor.org/biocLite.R")
biocLite()
biocLite("edgeR")
biocLite("GenomicRanges")
biocLite("Rsamtools")
# Import libraries
library("GenomicRanges")
library("Rsamtools")
library("rtracklayer")
library("parallel")
library("foreach")
library("doParallel")
library("GenomicFeatures")
library("Gviz")
library("getopt")
library("data.table")
library("BSgenome")
library("Biobase")
library("iterators")
library("Biostrings")
library("IRanges")
library("BiocGenerics")
library("AnnotationDbi")
library("XVector")
library("GenomeInfoDb")
library("S4Vectors")
library("GenomicAlignments")
library("BSgenome.Hsapiens.UCSC.hg19")
library("org.Hs.eg.db")
library("BSgenome.Mmusculus.UCSC.mm10")
library("org.Mm.eg.db")
library("getopt")
library("edgeR")
# library("openxlsx")
library("data.table")
options(stringAsfactors = FALSE, useFancyQuotes = FALSE)
source("https://bioconductor.org/biocLite.R")
biocLite()
source("https://bioconductor.org/biocLite.R")
biocLite()
library("getopt")
library("edgeR")
# library("openxlsx")
library("data.table")
source("https://bioconductor.org/biocLite.R")
biocLite("edgeR")
library("getopt")
library("edgeR")
# library("openxlsx")
library("data.table")
options(stringAsfactors = FALSE, useFancyQuotes = FALSE)
# Take in trailing command line arguments
args <- commandArgs(trailingOnly = TRUE)
# Get options using the spec as defined by the enclosed list
# Options are read from the default: commandArgs(TRUE)
option_specification = matrix(c(
'input1', 'i1', 2, 'character',
'input2', 'i2', 2, 'character',
'input3', 'i3', 2, 'integer',
'input4', 'i4', 2, 'integer',
'output', 'o', 2, 'character'
), byrow=TRUE, ncol=4);
# Parse options
options = getopt(option_specification)
library("rworldmap")
install.packages("rworldmap")
library("rworldmap")
theCountries <- c("DEU", "COD", "BFA")
malDF <- data.frame(country = c("DEU", "COD", "BFA"),
malaria = c(1, 1, 1))
malMap <- joinCountryData2Map(malDF, joinCode = "ISO3",
nameJoinColumn = "country")
mapCountryData(malMap, nameColumnToPlot="malaria", catMethod = "categorical",
missingCountryCol = gray(.8))
require(rgdal)
require(rgeos)
require(ggplot2)
install.packages("rgdal")
install.packages("rgeos")
require(rgdal)
require(rgeos)
require(ggplot2)
655 + 290 + 658
235+38+186
370+357+50+37+59+386+30+112+300
750+22+49+25+317
750+22+49+25+317 +6
239 + 61+760
1060+1169+1701
235+38+186
3930+459
653+571+546+211+
0
1981+1235+1148
4364+43
1701-40
459+1661+1060
459+1661+1060 +1169
459-27
370+205+6+179+360+455
432+1575+1060+1169
mat <- matrix(data = c(1:9), nrow = 3, ncol = 3, byrow = T)
mat
apply(mat, 1, mean)
apply(mat, 2, mean)
vec <- 1:10
apply(X = vec, 1, print)
apply(X = vec, 2, print)
sapply(X = vec, FUN = print)
sapply(X = vec, FUN = print, simplify = T)
sapply(X = vec, FUN = print, simplify = F)
sapply(X = vec, FUN = function(x) x -1)
as.integer(c(4.1, 5.2, 6.3, 6.4))
as.numeric(c(4.1, 5.2, 6.3, 6.4))
?quantile
?read.table
?hist
?boxplot
?read.csv
?quantile
quantile(x <- rnorm(1001)) # Extremes & Quartiles by default
res <- matrix(as.numeric(NA), 9, 7)
res
for(type in 1:9) res[type, ] <- y <- quantile(x,  p, type = type)
dimnames(res) <- list(1:9, names(y))
for(type in 1:9) res[type, ] <- y <- quantile(x,  p, type = type)
setwd("~/Desktop/planemo_tools/16_fgsea")
# Send R errors to stderr
options(show.error.messages = F, error = function(){cat(geterrmessage(), file = stderr()); q("no", 1, F)})
# Avoid crashing Galaxy with an UTF8 error on German LC settings
loc <- Sys.setlocale("LC_MESSAGES", "en_US.UTF-8")
# Import library
library("getopt")
library("fgsea")
options(stringAsfactors = FALSE, useFancyQuotes = FALSE)
# Take in trailing command line arguments
args <- commandArgs(trailingOnly = TRUE)
sessionInfo()