comparison 16_fgsea/.Rhistory @ 0:b75ceb945966 draft

Uploaded
author dktanwar
date Mon, 11 Dec 2017 09:52:26 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:b75ceb945966
1 setwd("/Volumes/BINF1_Raid/home/dtanwar/projects/H3K4me3_McMasterU/exp/20171026-GO_analysis_232_changed_genes-11/20171027-ranked_genes_232")
2 table <- read.delim("./input/20170722-genes_info_TSS_500bp.txt.xz", sep = "\t", header = T,
3 stringsAsFactors = F)
4 View(table)
5 table <- read.delim("./input/20170722-genes_info_TSS_500bp.txt.xz", sep = "\t", header = T,
6 stringsAsFactors = F)[,c(22,7)]
7 View(table)
8 sp_table <- split(x = table, f = table$SYMBOL)
9 genes <- lapply(sp_table, function(x){
10 a <- x[1,]
11 a[,2] <- mean(x[,2])
12 return(a)
13 })
14 library(plyr)
15 gl <- ldply(genes, data.frame)
16 View(gl)
17 gl <- ldply(genes, data.frame)[,-1]
18 View(gl)
19 gl[,1] <- toupper(gl[,1])
20 View(gl)
21 write.table(gl, "./output/ranked_genes_list_232.rnk", quote = F, sep = "\t", row.names = F, col.names = F)
22 setwd("/Volumes/BINF1_Raid/home/dtanwar/projects/H3K4me3_McMasterU/exp/20171026-GO_analysis_232_changed_genes-11/20171027-01_ranked_genes_232")
23 library(plyr)
24 table <- read.delim("./input/20170722-genes_info_TSS_500bp.txt.xz", sep = "\t", header = T,
25 stringsAsFactors = F)[,c(22,7)]
26 sp_table <- split(x = table, f = table$SYMBOL)
27 genes <- lapply(sp_table, function(x){
28 a <- x[1,]
29 a[,2] <- mean(x[,2])
30 return(a)
31 })
32 gl <- ldply(genes, data.frame)[,-1]
33 write.table(gl, "./output/20171029-original_ranked_genes_list_232.rnk", quote = F, sep = "\t", row.names = F, col.names = F)
34 gl[,1] <- toupper(gl[,1])
35 write.table(gl, "./output/ranked_genes_list_232.rnk", quote = F, sep = "\t", row.names = F, col.names = F)
36 library(plyr)
37 table <- read.delim("./input/20170722-genes_info_TSS_500bp.txt.xz", sep = "\t", header = T,
38 stringsAsFactors = F)[,c(22,7)]
39 sp_table <- split(x = table, f = table$SYMBOL)
40 genes <- lapply(sp_table, function(x){
41 a <- x[1,]
42 a[,2] <- mean(x[,2])
43 return(a)
44 })
45 gl <- ldply(genes, data.frame)[,-1]
46 gl
47 write.table(gl, "./output/20171029-original_ranked_genes_list_232.rnk", quote = F, sep = "\t", row.names = F, col.names = F)
48 gl[,1] <- toupper(gl[,1])
49 write.table(gl, "./output/ranked_genes_list_232.rnk", quote = F, sep = "\t", row.names = F, col.names = F)
50 # Send R errors to stderr
51 options(show.error.messages = F, error = function(){cat(geterrmessage(), file = stderr()); q("no", 1, F)})
52 # Avoid crashing Galaxy with an UTF8 error on German LC settings
53 loc <- Sys.setlocale("LC_MESSAGES", "en_US.UTF-8")
54 # Import libraries
55 library("GenomicRanges")
56 source("https://bioconductor.org/biocLite.R")
57 biocLite()
58 source("http://bioconductor.org/biocLite.R")
59 biocLite()
60 library("getopt")
61 library("edgeR")
62 library("openxlsx")
63 library("data.table")
64 biocLite("getopt")
65 # biocLite("openxlsx")
66 biocLite("data.table")
67 # Send R errors to stderr
68 options(show.error.messages = F, error = function(){cat(geterrmessage(), file = stderr()); q("no", 1, F)})
69 # Avoid crashing Galaxy with an UTF8 error on German LC settings
70 loc <- Sys.setlocale("LC_MESSAGES", "en_US.UTF-8")
71 library("getopt")
72 library("edgeR")
73 biocLite("getopt")
74 source("http://bioconductor.org/biocLite.R")
75 biocLite()
76 biocLite("edgeR")
77 biocLite("edgeR")
78 biocLite("Rcpp")
79 biocLite("limma")
80 biocLite("edgeR")
81 biocLite("edgeR")
82 source("http://bioconductor.org/biocLite.R")
83 biocLite()
84 biocLite("edgeR")
85 biocLite("GenomicRanges")
86 biocLite("Rsamtools")
87 # Import libraries
88 library("GenomicRanges")
89 library("Rsamtools")
90 library("rtracklayer")
91 library("parallel")
92 library("foreach")
93 library("doParallel")
94 library("GenomicFeatures")
95 library("Gviz")
96 library("getopt")
97 library("data.table")
98 library("BSgenome")
99 library("Biobase")
100 library("iterators")
101 library("Biostrings")
102 library("IRanges")
103 library("BiocGenerics")
104 library("AnnotationDbi")
105 library("XVector")
106 library("GenomeInfoDb")
107 library("S4Vectors")
108 library("GenomicAlignments")
109 library("BSgenome.Hsapiens.UCSC.hg19")
110 library("org.Hs.eg.db")
111 library("BSgenome.Mmusculus.UCSC.mm10")
112 library("org.Mm.eg.db")
113 library("getopt")
114 library("edgeR")
115 # library("openxlsx")
116 library("data.table")
117 options(stringAsfactors = FALSE, useFancyQuotes = FALSE)
118 source("https://bioconductor.org/biocLite.R")
119 biocLite()
120 source("https://bioconductor.org/biocLite.R")
121 biocLite()
122 library("getopt")
123 library("edgeR")
124 # library("openxlsx")
125 library("data.table")
126 source("https://bioconductor.org/biocLite.R")
127 biocLite("edgeR")
128 library("getopt")
129 library("edgeR")
130 # library("openxlsx")
131 library("data.table")
132 options(stringAsfactors = FALSE, useFancyQuotes = FALSE)
133 # Take in trailing command line arguments
134 args <- commandArgs(trailingOnly = TRUE)
135 # Get options using the spec as defined by the enclosed list
136 # Options are read from the default: commandArgs(TRUE)
137 option_specification = matrix(c(
138 'input1', 'i1', 2, 'character',
139 'input2', 'i2', 2, 'character',
140 'input3', 'i3', 2, 'integer',
141 'input4', 'i4', 2, 'integer',
142 'output', 'o', 2, 'character'
143 ), byrow=TRUE, ncol=4);
144 # Parse options
145 options = getopt(option_specification)
146 library("rworldmap")
147 install.packages("rworldmap")
148 library("rworldmap")
149 theCountries <- c("DEU", "COD", "BFA")
150 malDF <- data.frame(country = c("DEU", "COD", "BFA"),
151 malaria = c(1, 1, 1))
152 malMap <- joinCountryData2Map(malDF, joinCode = "ISO3",
153 nameJoinColumn = "country")
154 mapCountryData(malMap, nameColumnToPlot="malaria", catMethod = "categorical",
155 missingCountryCol = gray(.8))
156 require(rgdal)
157 require(rgeos)
158 require(ggplot2)
159 install.packages("rgdal")
160 install.packages("rgeos")
161 require(rgdal)
162 require(rgeos)
163 require(ggplot2)
164 655 + 290 + 658
165 235+38+186
166 370+357+50+37+59+386+30+112+300
167 750+22+49+25+317
168 750+22+49+25+317 +6
169 239 + 61+760
170 1060+1169+1701
171 235+38+186
172 3930+459
173 653+571+546+211+
174 0
175 1981+1235+1148
176 4364+43
177 1701-40
178 459+1661+1060
179 459+1661+1060 +1169
180 459-27
181 370+205+6+179+360+455
182 432+1575+1060+1169
183 mat <- matrix(data = c(1:9), nrow = 3, ncol = 3, byrow = T)
184 mat
185 apply(mat, 1, mean)
186 apply(mat, 2, mean)
187 vec <- 1:10
188 apply(X = vec, 1, print)
189 apply(X = vec, 2, print)
190 sapply(X = vec, FUN = print)
191 sapply(X = vec, FUN = print, simplify = T)
192 sapply(X = vec, FUN = print, simplify = F)
193 sapply(X = vec, FUN = function(x) x -1)
194 as.integer(c(4.1, 5.2, 6.3, 6.4))
195 as.numeric(c(4.1, 5.2, 6.3, 6.4))
196 ?quantile
197 ?read.table
198 ?hist
199 ?boxplot
200 ?read.csv
201 ?quantile
202 quantile(x <- rnorm(1001)) # Extremes & Quartiles by default
203 res <- matrix(as.numeric(NA), 9, 7)
204 res
205 for(type in 1:9) res[type, ] <- y <- quantile(x, p, type = type)
206 dimnames(res) <- list(1:9, names(y))
207 for(type in 1:9) res[type, ] <- y <- quantile(x, p, type = type)
208 setwd("~/Desktop/planemo_tools/16_fgsea")
209 # Send R errors to stderr
210 options(show.error.messages = F, error = function(){cat(geterrmessage(), file = stderr()); q("no", 1, F)})
211 # Avoid crashing Galaxy with an UTF8 error on German LC settings
212 loc <- Sys.setlocale("LC_MESSAGES", "en_US.UTF-8")
213 # Import library
214 library("getopt")
215 library("fgsea")
216 options(stringAsfactors = FALSE, useFancyQuotes = FALSE)
217 # Take in trailing command line arguments
218 args <- commandArgs(trailingOnly = TRUE)
219 sessionInfo()