comparison test-data/heatmap.txt @ 0:587c425b4e76 draft

Initial commit with version 1.0.0 of the cummeRbund wrapper.
author devteam
date Tue, 23 Dec 2014 15:58:27 -0500
parents
children 78fcfc04fcfe
comparison
equal deleted inserted replaced
-1:000000000000 0:587c425b4e76
1
2 R version 3.1.2 (2014-10-31) -- "Pumpkin Helmet"
3 Copyright (C) 2014 The R Foundation for Statistical Computing
4 Platform: x86_64-unknown-linux-gnu (64-bit)
5
6 R is free software and comes with ABSOLUTELY NO WARRANTY.
7 You are welcome to redistribute it under certain conditions.
8 Type 'license()' or 'licence()' for distribution details.
9
10 Natural language support but running in an English locale
11
12 R is a collaborative project with many contributors.
13 Type 'contributors()' for more information and
14 'citation()' on how to cite R or R packages in publications.
15
16 Type 'demo()' for some demos, 'help()' for on-line help, or
17 'help.start()' for an HTML browser interface to help.
18 Type 'q()' to quit R.
19
20 > ## Feature Selection ##
21 > get_features <- function(myGenes, f="gene") {
22 + if (f == "isoforms")
23 + return(isoforms(myGenes))
24 + else if (f == "tss")
25 + return(TSS(myGenes))
26 + else if (f == "cds")
27 + return(CDS(myGenes))
28 + else
29 + return(myGenes)
30 + }
31 >
32 > ## Main Function ##
33 >
34 > library(argparse)
35 Loading required package: proto
36 >
37 > parser <- ArgumentParser(description='Create a plot with cummeRbund')
38 >
39 > parser$add_argument('--type', dest='plotType', default='Density', required=TRUE)
40 > parser$add_argument('--height', dest='height', type='integer', default=960, required=TRUE)
41 > parser$add_argument('--width', dest='width', type='integer', default=1280, required=TRUE)
42 > parser$add_argument('--outfile', dest='filename', default="plot-unknown-0.png", required=TRUE)
43 > parser$add_argument('--input', dest='input_database', default="cuffData.db", required=TRUE)
44 > parser$add_argument('--smooth', dest='smooth', action="store_true", default=FALSE)
45 > parser$add_argument('--gene_selector', dest='gene_selector', action="store_true", default=FALSE)
46 > parser$add_argument('--replicates', dest='replicates', action="store_true", default=FALSE)
47 > parser$add_argument('--labcol', dest='labcol', action="store_true", default=FALSE)
48 > parser$add_argument('--labrow', dest='labrow', action="store_true", default=FALSE)
49 > parser$add_argument('--border', dest='border', action="store_true", default=FALSE)
50 > parser$add_argument('--summary', dest='summary', action="store_true", default=FALSE)
51 > parser$add_argument('--count', dest='count', action="store_true", default=FALSE)
52 > parser$add_argument('--error_bars', dest='error_bars', action="store_true", default=FALSE)
53 > parser$add_argument('--log10', dest='log10', action="store_true", default=FALSE)
54 > parser$add_argument('--features', dest='features', action="store", default="genes")
55 > parser$add_argument('--clustering', dest='clustering', action="store", default="both")
56 > parser$add_argument('--iter_max', dest='iter_max', action="store")
57 > parser$add_argument('--genes', dest='genes', action="append")
58 > parser$add_argument('--k', dest='k', action="store")
59 > parser$add_argument('--x', dest='x', action="store")
60 > parser$add_argument('--y', dest='y', action="store")
61 >
62 > args <- parser$parse_args()
63 >
64 > print(args)
65 $border
66 [1] FALSE
67
68 $clustering
69 [1] "both"
70
71 $count
72 [1] FALSE
73
74 $error_bars
75 [1] FALSE
76
77 $features
78 [1] "gene"
79
80 $filename
81 [1] "plot-heatmap-0.png"
82
83 $gene_selector
84 [1] FALSE
85
86 $genes
87 [1] "XLOC_000078"
88
89 $height
90 [1] 960
91
92 $input_database
93 [1] "/tmp/tmpCu9yWT/tmpPy7OpW/database/files/000/dataset_22.dat"
94
95 $iter_max
96 NULL
97
98 $k
99 NULL
100
101 $labcol
102 [1] TRUE
103
104 $labrow
105 [1] TRUE
106
107 $log10
108 [1] TRUE
109
110 $plotType
111 [1] "heatmap"
112
113 $replicates
114 [1] FALSE
115
116 $smooth
117 [1] FALSE
118
119 $summary
120 [1] FALSE
121
122 $width
123 [1] 1280
124
125 $x
126 NULL
127
128 $y
129 NULL
130
131 >
132 > #q()
133 >
134 > ## Load cummeRbund library
135 > library("cummeRbund")
136 Loading required package: BiocGenerics
137 Loading required package: parallel
138
139 Attaching package: ‘BiocGenerics’
140
141 The following objects are masked from ‘package:parallel’:
142
143 clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
144 clusterExport, clusterMap, parApply, parCapply, parLapply,
145 parLapplyLB, parRapply, parSapply, parSapplyLB
146
147 The following object is masked from ‘package:stats’:
148
149 xtabs
150
151 The following objects are masked from ‘package:base’:
152
153 anyDuplicated, append, as.data.frame, as.vector, cbind, colnames,
154 do.call, duplicated, eval, evalq, Filter, Find, get, intersect,
155 is.unsorted, lapply, Map, mapply, match, mget, order, paste, pmax,
156 pmax.int, pmin, pmin.int, Position, rank, rbind, Reduce, rep.int,
157 rownames, sapply, setdiff, sort, table, tapply, union, unique,
158 unlist, unsplit
159
160 Loading required package: RSQLite
161 Loading required package: DBI
162 Loading required package: ggplot2
163 Loading required package: reshape2
164 Loading required package: fastcluster
165
166 Attaching package: ‘fastcluster’
167
168 The following object is masked from ‘package:stats’:
169
170 hclust
171
172 Loading required package: rtracklayer
173 Loading required package: GenomicRanges
174 Loading required package: S4Vectors
175 Loading required package: stats4
176 Loading required package: IRanges
177 Loading required package: GenomeInfoDb
178 Loading required package: Gviz
179 Loading required package: grid
180
181 Attaching package: ‘cummeRbund’
182
183 The following object is masked from ‘package:GenomicRanges’:
184
185 promoters
186
187 The following object is masked from ‘package:IRanges’:
188
189 promoters
190
191 The following object is masked from ‘package:BiocGenerics’:
192
193 conditions
194
195 >
196 > ## Initialize cuff object
197 > cuff <- readCufflinks(dir = "", dbFile = args$input_database, rebuild = FALSE)
198 >
199 > ## Print out info
200 > print(cuff)
201 CuffSet instance with:
202 2 samples
203 87 genes
204 90 isoforms
205 88 TSS
206 0 CDS
207 87 promoters
208 88 splicing
209 0 relCDS
210 > sink("cuffdb_info.txt")
211 > print(cuff)
212 > print("SAMPLES:")
213 > samples(cuff)
214 > print("REPLICATES:")
215 > replicates(cuff)
216 > print("FEATURES:")
217 > print(annotation(genes(cuff)))
218 > cat(annotation(genes(cuff))[[1]],sep=",")
219 > sink()
220 >
221 > png(filename = args$filename, width = args$width, height = args$height, type=c('cairo-png'))
222 > tryCatch({
223 + if (args$plotType == 'density') {
224 + csDensity(genes(cuff), replicates=args$replicates, logMode=args$log10)
225 + }
226 + else if (args$plotType == 'boxplot') {
227 + csBoxplot(genes(cuff), replicates=args$replicates, logMode=args$log10)
228 + }
229 + else if (args$plotType == 'mds') {
230 + MDSplot(genes(cuff), replicates=args$replicates)
231 + }
232 + else if (args$plotType == 'pca') {
233 + PCAplot(genes(cuff), "PC1", "PC2", replicates=args$replicates)
234 + }
235 + else if (args$plotType == 'dendrogram') {
236 + csDendro(genes(cuff), replicates=args$replicates)
237 + }
238 + else if (args$plotType == 'scatter') {
239 + if (args$gene_selector) {
240 + myGenes <- getGenes(cuff, args$genes)
241 + csScatter(get_features(myGenes, args$features), args$x, args$y, smooth=args$smooth, logMode=args$log10)
242 + }
243 + else {
244 + csScatter(genes(cuff), args$x, args$y, smooth=args$smooth, logMode=args$log10)
245 + }
246 + }
247 + else if (args$plotType == 'volcano') {
248 + if (args$gene_selector) {
249 + myGenes <- get_features(getGenes(cuff, args$genes), args$features)
250 + }
251 + else {
252 + myGenes <- genes(cuff)
253 + }
254 + csVolcano(myGenes, args$x, args$y)
255 + }
256 + else if (args$plotType == 'heatmap') {
257 + if (args$gene_selector) {
258 + myGenes <- getGenes(cuff, args$genes)
259 + }
260 + else {
261 + myGenes <- getGenes(cuff,annotation(genes(cuff))[[1]])
262 + }
263 + csHeatmap(get_features(myGenes, args$features), clustering=args$clustering, labCol=args$labcol, labRow=args$labrow, border=args$border, logMode=args$log10)
264 + }
265 + else if (args$plotType == 'cluster') {
266 + myGenes <- getGenes(cuff, args$genes)
267 + csCluster(get_features(myGenes, args$features), k=args$k)
268 + }
269 + else if (args$plotType == 'dispersion') {
270 + dispersionPlot(genes(cuff))
271 + }
272 + else if (args$plotType == 'fpkmSCV') {
273 + fpkmSCVPlot(genes(cuff))
274 + }
275 + else if (args$plotType == 'scatterMatrix') {
276 + csScatterMatrix(genes(cuff))
277 + }
278 + else if (args$plotType == 'expressionplot') {
279 + myGenes <- getGenes(cuff, args$genes)
280 + expressionPlot(get_features(myGenes, args$features), drawSummary=args$summary, showErrorbars=args$error_bars, replicates=args$replicates)
281 + }
282 + else if (args$plotType == 'expressionbarplot') {
283 + myGeneId <- args$genes
284 + myGenes <- getGenes(cuff, myGeneId)
285 + expressionBarplot(get_features(myGenes, args$features), showErrorbars=args$error_bars, replicates=args$replicates)
286 + }
287 + else if (args$plotType == 'mds') {
288 + MDSplot(genes(cuff),replicates=args$replicates)
289 + }
290 + else if (args$plotType == 'pca') {
291 + PCAplot(genes(cuff),"PC1","PC2", replicates=args$replicates)
292 + }
293 + else if (args$plotType == 'maplot') {
294 + MAplot(genes(cuff), args$x, args$y, useCount=args$count)
295 + }
296 + else if (args$plotType == 'genetrack') {
297 + myGene <- getGene(cuff, args$genes)
298 + plotTracks(makeGeneRegionTrack(myGene))
299 + }
300 + },error = function(e) {
301 + write(paste("Failed:", e, sep=" "), stderr())
302 + q("no", 1, TRUE)
303 + })
304 Getting gene information:
305 FPKM
306 Differential Expression Data
307 Annotation Data
308 Replicate FPKMs
309 Counts
310 Getting isoforms information:
311 FPKM
312 Differential Expression Data
313 Annotation Data
314 Replicate FPKMs
315 Counts
316 Getting CDS information:
317 FPKM
318 Differential Expression Data
319 Annotation Data
320 Replicate FPKMs
321 Counts
322 Getting TSS information:
323 FPKM
324 Differential Expression Data
325 Annotation Data
326 Replicate FPKMs
327 Counts
328 Getting promoter information:
329 distData
330 Getting splicing information:
331 distData
332 Getting relCDS information:
333 distData
334 Using tracking_id, sample_name as id variables
335 No id variables; using all as measure variables
336 Fontconfig error: Cannot load default config file
337 > devname = dev.off()
338 >
339 > #end for
340 >