Mercurial > repos > devteam > cummerbund
comparison test-data/expressionplot.txt @ 6:c3b54a4b7741 draft default tip
"planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/cummerbund commit f929353ffb0623f2218d7dec459c7da62f3b0d24"
author | devteam |
---|---|
date | Mon, 06 Jul 2020 20:25:47 -0400 |
parents | 78fcfc04fcfe |
children |
comparison
equal
deleted
inserted
replaced
5:78fcfc04fcfe | 6:c3b54a4b7741 |
---|---|
1 > get_features <- function(myGenes, f="gene") { | |
2 + if (f == "isoforms") | |
3 + return(isoforms(myGenes)) | |
4 + else if (f == "tss") | |
5 + return(TSS(myGenes)) | |
6 + else if (f == "cds") | |
7 + return(CDS(myGenes)) | |
8 + else | |
9 + return(myGenes) | |
10 + } | |
11 > | |
12 > ## Main Function ## | |
13 > | |
14 > library(argparse) | |
15 Loading required package: proto | |
16 > | |
17 > parser <- ArgumentParser(description='Create a plot with cummeRbund') | |
18 > | |
19 > parser$add_argument('--type', dest='plotType', default='Density', required=TRUE) | |
20 > parser$add_argument('--height', dest='height', type='integer', default=960, required=TRUE) | |
21 > parser$add_argument('--width', dest='width', type='integer', default=1280, required=TRUE) | |
22 > parser$add_argument('--outfile', dest='filename', default="plot-unknown-0.png", required=TRUE) | |
23 > parser$add_argument('--input', dest='input_database', default="cuffData.db", required=TRUE) | |
24 > parser$add_argument('--smooth', dest='smooth', action="store_true", default=FALSE) | |
25 > parser$add_argument('--gene_selector', dest='gene_selector', action="store_true", default=FALSE) | |
26 > parser$add_argument('--replicates', dest='replicates', action="store_true", default=FALSE) | |
27 > parser$add_argument('--labcol', dest='labcol', action="store_true", default=FALSE) | |
28 > parser$add_argument('--labrow', dest='labrow', action="store_true", default=FALSE) | |
29 > parser$add_argument('--border', dest='border', action="store_true", default=FALSE) | |
30 > parser$add_argument('--summary', dest='summary', action="store_true", default=FALSE) | |
31 > parser$add_argument('--count', dest='count', action="store_true", default=FALSE) | |
32 > parser$add_argument('--error_bars', dest='error_bars', action="store_true", default=FALSE) | |
33 > parser$add_argument('--log10', dest='log10', action="store_true", default=FALSE) | |
34 > parser$add_argument('--features', dest='features', action="store", default="genes") | |
35 > parser$add_argument('--clustering', dest='clustering', action="store", default="both") | |
36 > parser$add_argument('--iter_max', dest='iter_max', action="store") | |
37 > parser$add_argument('--genes', dest='genes', action="append") | |
38 > parser$add_argument('--k', dest='k', action="store") | |
39 > parser$add_argument('--x', dest='x', action="store") | |
40 > parser$add_argument('--y', dest='y', action="store") | |
41 > | |
42 > args <- parser$parse_args() | |
43 > | |
44 > ## Load cummeRbund library | |
45 > library("cummeRbund") | |
46 Loading required package: BiocGenerics | |
47 Loading required package: methods | |
48 Loading required package: parallel | |
49 | |
50 Attaching package: ‘BiocGenerics’ | |
51 | |
52 The following objects are masked from ‘package:parallel’: | |
53 | |
54 clusterApply, clusterApplyLB, clusterCall, clusterEvalQ, | |
55 clusterExport, clusterMap, parApply, parCapply, parLapply, | |
56 parLapplyLB, parRapply, parSapply, parSapplyLB | |
57 | |
58 The following objects are masked from ‘package:stats’: | |
59 | |
60 IQR, mad, xtabs | |
61 | |
62 The following objects are masked from ‘package:base’: | |
63 | |
64 anyDuplicated, append, as.data.frame, cbind, colnames, do.call, | |
65 duplicated, eval, evalq, Filter, Find, get, grep, grepl, intersect, | |
66 is.unsorted, lapply, lengths, Map, mapply, match, mget, order, | |
67 paste, pmax, pmax.int, pmin, pmin.int, Position, rank, rbind, | |
68 Reduce, rownames, sapply, setdiff, sort, table, tapply, union, | |
69 unique, unsplit, which, which.max, which.min | |
70 | |
71 Loading required package: RSQLite | |
72 Loading required package: DBI | |
73 Loading required package: ggplot2 | |
74 Loading required package: reshape2 | |
75 Loading required package: fastcluster | |
76 | |
77 Attaching package: ‘fastcluster’ | |
78 | |
79 The following object is masked from ‘package:stats’: | |
80 | |
81 hclust | |
82 | |
83 Loading required package: rtracklayer | |
84 Loading required package: GenomicRanges | |
85 Loading required package: stats4 | |
86 Loading required package: S4Vectors | |
87 | |
88 Attaching package: ‘S4Vectors’ | |
89 | |
90 The following objects are masked from ‘package:base’: | |
91 | |
92 colMeans, colSums, expand.grid, rowMeans, rowSums | |
93 | |
94 Loading required package: IRanges | |
95 Loading required package: GenomeInfoDb | |
96 Loading required package: Gviz | |
97 Loading required package: grid | |
98 Warning: namespace ‘AnnotationHub’ is not available and has been replaced | |
99 by .GlobalEnv when processing object ‘plot.index’ | |
100 Warning: namespace ‘AnnotationHub’ is not available and has been replaced | |
101 by .GlobalEnv when processing object ‘plot.index’ | |
102 Warning: namespace ‘AnnotationHub’ is not available and has been replaced | |
103 by .GlobalEnv when processing object ‘plot.index’ | |
104 Warning: namespace ‘AnnotationHub’ is not available and has been replaced | |
105 by .GlobalEnv when processing object ‘plot.index’ | |
106 Warning: namespace ‘ensembldb’ is not available and has been replaced | |
107 by .GlobalEnv when processing object ‘plot.index’ | |
108 Warning: namespace ‘ensembldb’ is not available and has been replaced | |
109 by .GlobalEnv when processing object ‘plot.index’ | |
110 Warning: namespace ‘ensembldb’ is not available and has been replaced | |
111 by .GlobalEnv when processing object ‘plot.index’ | |
112 Warning: namespace ‘ensembldb’ is not available and has been replaced | |
113 by .GlobalEnv when processing object ‘plot.index’ | |
114 Warning: namespace ‘AnnotationHub’ is not available and has been replaced | |
115 by .GlobalEnv when processing object ‘plot.index’ | |
116 Warning: namespace ‘AnnotationHub’ is not available and has been replaced | |
117 by .GlobalEnv when processing object ‘plot.index’ | |
118 Warning: namespace ‘AnnotationHub’ is not available and has been replaced | |
119 by .GlobalEnv when processing object ‘plot.index’ | |
120 Warning: namespace ‘AnnotationHub’ is not available and has been replaced | |
121 by .GlobalEnv when processing object ‘plot.index’ | |
122 Warning: namespace ‘ensembldb’ is not available and has been replaced | |
123 by .GlobalEnv when processing object ‘plot.index’ | |
124 Warning: namespace ‘ensembldb’ is not available and has been replaced | |
125 by .GlobalEnv when processing object ‘plot.index’ | |
126 Warning: namespace ‘ensembldb’ is not available and has been replaced | |
127 by .GlobalEnv when processing object ‘plot.index’ | |
128 Warning: namespace ‘ensembldb’ is not available and has been replaced | |
129 by .GlobalEnv when processing object ‘plot.index’ | |
130 Warning: namespace ‘ensembldb’ is not available and has been replaced | |
131 by .GlobalEnv when processing object ‘plot.index’ | |
132 Warning: namespace ‘ensembldb’ is not available and has been replaced | |
133 by .GlobalEnv when processing object ‘plot.index’ | |
134 Warning: namespace ‘AnnotationHub’ is not available and has been replaced | |
135 by .GlobalEnv when processing object ‘plot.index’ | |
136 Warning: namespace ‘ensembldb’ is not available and has been replaced | |
137 by .GlobalEnv when processing object ‘plot.index’ | |
138 Warning: namespace ‘AnnotationHub’ is not available and has been replaced | |
139 by .GlobalEnv when processing object ‘plot.index’ | |
140 Warning: namespace ‘ensembldb’ is not available and has been replaced | |
141 by .GlobalEnv when processing object ‘plot.index’ | |
142 Warning: namespace ‘ensembldb’ is not available and has been replaced | |
143 by .GlobalEnv when processing object ‘plot.index’ | |
144 Warning: namespace ‘ensembldb’ is not available and has been replaced | |
145 by .GlobalEnv when processing object ‘plot.index’ | |
146 Warning: namespace ‘ensembldb’ is not available and has been replaced | |
147 by .GlobalEnv when processing object ‘plot.index’ | |
148 Warning: namespace ‘ensembldb’ is not available and has been replaced | |
149 by .GlobalEnv when processing object ‘plot.index’ | |
150 Warning: namespace ‘AnnotationHub’ is not available and has been replaced | |
151 by .GlobalEnv when processing object ‘plot.index’ | |
152 Warning: namespace ‘AnnotationHub’ is not available and has been replaced | |
153 by .GlobalEnv when processing object ‘plot.index’ | |
154 | |
155 Attaching package: ‘cummeRbund’ | |
156 | |
157 The following object is masked from ‘package:GenomicRanges’: | |
158 | |
159 promoters | |
160 | |
161 The following object is masked from ‘package:IRanges’: | |
162 | |
163 promoters | |
164 | |
165 The following object is masked from ‘package:BiocGenerics’: | |
166 | |
167 conditions | |
168 | |
169 > | |
170 > ## Initialize cuff object | |
171 > cuff <- readCufflinks(dir = "", dbFile = args$input_database, rebuild = FALSE) | |
172 > | |
173 > ## Print out info | |
174 > print(cuff) | |
175 CuffSet instance with: | |
176 2 samples | |
177 87 genes | |
178 90 isoforms | |
179 88 TSS | |
180 0 CDS | |
181 87 promoters | |
182 88 splicing | |
183 0 relCDS | |
184 > sink("cuffdb_info.txt") | |
185 > print(cuff) | |
186 > print("SAMPLES:") | |
187 > samples(cuff) | |
188 > print("REPLICATES:") | |
189 > replicates(cuff) | |
190 > print("FEATURES:") | |
191 > print(annotation(genes(cuff))) | |
192 > cat(annotation(genes(cuff))[[1]],sep=",") | |
193 > sink() | |
194 > | |
195 > png(filename = args$filename, width = args$width, height = args$height, type=c('cairo-png')) | |
196 > tryCatch({ | |
197 + if (args$plotType == 'density') { | |
198 + csDensity(genes(cuff), replicates=args$replicates, logMode=args$log10) | |
199 + } | |
200 + else if (args$plotType == 'boxplot') { | |
201 + csBoxplot(genes(cuff), replicates=args$replicates, logMode=args$log10) | |
202 + } | |
203 + else if (args$plotType == 'mds') { | |
204 + MDSplot(genes(cuff), replicates=args$replicates) | |
205 + } | |
206 + else if (args$plotType == 'pca') { | |
207 + PCAplot(genes(cuff), "PC1", "PC2", replicates=args$replicates) | |
208 + } | |
209 + else if (args$plotType == 'dendrogram') { | |
210 + csDendro(genes(cuff), replicates=args$replicates) | |
211 + } | |
212 + else if (args$plotType == 'scatter') { | |
213 + if (args$gene_selector) { | |
214 + myGenes <- getGenes(cuff, args$genes) | |
215 + csScatter(get_features(myGenes, args$features), args$x, args$y, smooth=args$smooth, logMode=args$log10) | |
216 + } | |
217 + else { | |
218 + csScatter(genes(cuff), args$x, args$y, smooth=args$smooth, logMode=args$log10) | |
219 + } | |
220 + } | |
221 + else if (args$plotType == 'volcano') { | |
222 + if (args$gene_selector) { | |
223 + myGenes <- get_features(getGenes(cuff, args$genes), args$features) | |
224 + } | |
225 + else { | |
226 + myGenes <- genes(cuff) | |
227 + } | |
228 + csVolcano(myGenes, args$x, args$y) | |
229 + } | |
230 + else if (args$plotType == 'heatmap') { | |
231 + if (args$gene_selector) { | |
232 + myGenes <- getGenes(cuff, args$genes) | |
233 + } | |
234 + else { | |
235 + myGenes <- getGenes(cuff,annotation(genes(cuff))[[1]]) | |
236 + } | |
237 + csHeatmap(get_features(myGenes, args$features), clustering=args$clustering, labCol=args$labcol, labRow=args$labrow, border=args$border, logMode=args$log10) | |
238 + } | |
239 + else if (args$plotType == 'cluster') { | |
240 + myGenes <- getGenes(cuff, args$genes) | |
241 + csCluster(get_features(myGenes, args$features), k=args$k) | |
242 + } | |
243 + else if (args$plotType == 'dispersion') { | |
244 + dispersionPlot(genes(cuff)) | |
245 + } | |
246 + else if (args$plotType == 'fpkmSCV') { | |
247 + fpkmSCVPlot(genes(cuff)) | |
248 + } | |
249 + else if (args$plotType == 'scatterMatrix') { | |
250 + csScatterMatrix(genes(cuff)) | |
251 + } | |
252 + else if (args$plotType == 'expressionplot') { | |
253 + myGenes <- getGenes(cuff, args$genes) | |
254 + expressionPlot(get_features(myGenes, args$features), drawSummary=args$summary, showErrorbars=args$error_bars, replicates=args$replicates) | |
255 + } | |
256 + else if (args$plotType == 'expressionbarplot') { | |
257 + myGeneId <- args$genes | |
258 + myGenes <- getGenes(cuff, myGeneId) | |
259 + expressionBarplot(get_features(myGenes, args$features), showErrorbars=args$error_bars, replicates=args$replicates) | |
260 + } | |
261 + else if (args$plotType == 'mds') { | |
262 + MDSplot(genes(cuff),replicates=args$replicates) | |
263 + } | |
264 + else if (args$plotType == 'pca') { | |
265 + PCAplot(genes(cuff),"PC1","PC2", replicates=args$replicates) | |
266 + } | |
267 + else if (args$plotType == 'maplot') { | |
268 + MAplot(genes(cuff), args$x, args$y, useCount=args$count) | |
269 + } | |
270 + else if (args$plotType == 'genetrack') { | |
271 + myGene <- getGene(cuff, args$genes) | |
272 + plotTracks(makeGeneRegionTrack(myGene)) | |
273 + } | |
274 + },error = function(e) { | |
275 + write(paste("Failed:", e, sep=" "), stderr()) | |
276 + q("no", 1, TRUE) | |
277 + }) | |
278 Getting gene information: | |
279 FPKM | |
280 Differential Expression Data | |
281 Annotation Data | |
282 Replicate FPKMs | |
283 Counts | |
284 Getting isoforms information: | |
285 FPKM | |
286 Differential Expression Data | |
287 Annotation Data | |
288 Replicate FPKMs | |
289 Counts | |
290 Getting CDS information: | |
291 FPKM | |
292 Differential Expression Data | |
293 Annotation Data | |
294 Replicate FPKMs | |
295 Counts | |
296 Getting TSS information: | |
297 FPKM | |
298 Differential Expression Data | |
299 Annotation Data | |
300 Replicate FPKMs | |
301 Counts | |
302 Getting promoter information: | |
303 distData | |
304 Getting splicing information: | |
305 distData | |
306 Getting relCDS information: | |
307 distData | |
308 > devname = dev.off() | |
309 > |