Mercurial > repos > yhoogstrate > edger_with_design_matrix
comparison edgeR_Differential_Gene_Expression.xml @ 91:c81da57fff20 draft
Uploaded
| author | yhoogstrate |
|---|---|
| date | Mon, 09 Mar 2015 08:35:13 -0400 |
| parents | f87938c392bf |
| children | 31335aa52b2e |
comparison
equal
deleted
inserted
replaced
| 90:f87938c392bf | 91:c81da57fff20 |
|---|---|
| 1 <?xml version="1.0" encoding="UTF-8"?> | 1 <?xml version="1.0" encoding="UTF-8"?> |
| 2 <tool id="edger_dge" name="edgeR: Differential Gene(Expression) Analysis" version="3.0.3-latest.c"> | 2 <tool id="edger_dge" name="edgeR: Differential Gene(Expression) Analysis" version="3.0.3-latest.d"> |
| 3 <description>RNA-Seq gene expression analysis using edgeR (R package)</description> | 3 <description>RNA-Seq gene expression analysis using edgeR (R package)</description> |
| 4 | 4 |
| 5 <requirements> | 5 <requirements> |
| 6 <!--<requirement type="package" version="3.0.1">package_r3_withx</requirement>--> | |
| 7 <!--<requirement type="package" version="3.1.0">R</requirement>--> | |
| 8 <requirement type="package" version="3.0.3">R</requirement> | 6 <requirement type="package" version="3.0.3">R</requirement> |
| 9 <requirement type="package" version="latest">biocLite_edgeR_limma</requirement> | 7 <requirement type="package" version="latest">biocLite_edgeR_limma</requirement> |
| 10 <requirement type="package" version="1.3.18">graphicsmagick</requirement> | |
| 11 </requirements> | 8 </requirements> |
| 12 | 9 |
| 13 <version_command>R --vanilla --slave -e "library(edgeR) ; cat(sessionInfo()\$otherPkgs\$edgeR\$Version)" 2> /dev/null</version_command> | 10 <version_command>R --vanilla --slave -e "library(edgeR) ; cat(sessionInfo()\$otherPkgs\$edgeR\$Version)" 2> /dev/null</version_command> |
| 14 | 11 |
| 15 <command> | 12 <command> |
| 91 #else: | 88 #else: |
| 92 > /dev/null | 89 > /dev/null |
| 93 #end if | 90 #end if |
| 94 | 91 |
| 95 2> stderr.txt ; | 92 2> stderr.txt ; |
| 96 | |
| 97 #if $output_format_images.value == "png": | |
| 98 echo "Converting PDF figures to PNG" ; | |
| 99 | |
| 100 #if $output_MDSplot_logFC: | |
| 101 #set $output_MDSplot_logFC_tmp = str($output_MDSplot_logFC)+".png" | |
| 102 | |
| 103 gm convert $output_MDSplot_logFC png:$output_MDSplot_logFC_tmp ; | |
| 104 mv $output_MDSplot_logFC_tmp $output_MDSplot_logFC ; | |
| 105 #end if | |
| 106 | |
| 107 #if $output_MDSplot_bcv: | |
| 108 #set $output_MDSplot_bcv_tmp = str($output_MDSplot_bcv)+".png" | |
| 109 | |
| 110 gm convert $output_MDSplot_bcv png:$output_MDSplot_bcv_tmp ; | |
| 111 mv $output_MDSplot_bcv_tmp $output_MDSplot_bcv ; | |
| 112 #end if | |
| 113 | |
| 114 #if $output_BCVplot: | |
| 115 #set $output_BCVplot_tmp = str($output_BCVplot)+".png" | |
| 116 | |
| 117 gm convert $output_BCVplot png:$output_BCVplot_tmp ; | |
| 118 mv $output_BCVplot_tmp $output_BCVplot ; | |
| 119 #end if | |
| 120 | |
| 121 #if $output_MAplot: | |
| 122 #set $output_MAplot_tmp = str($output_MAplot)+".png" | |
| 123 | |
| 124 gm convert $output_MAplot png:$output_MAplot_tmp ; | |
| 125 mv $output_MAplot_tmp $output_MAplot ; | |
| 126 #end if | |
| 127 | |
| 128 #if $output_PValue_distribution_plot: | |
| 129 #set $output_PValue_distribution_plot_tmp = str($output_PValue_distribution_plot)+".png" | |
| 130 | |
| 131 gm convert $output_PValue_distribution_plot png:$output_PValue_distribution_plot_tmp ; | |
| 132 mv $output_PValue_distribution_plot_tmp $output_PValue_distribution_plot ; | |
| 133 #end if | |
| 134 | |
| 135 #if $output_hierarchical_clustering_plot: | |
| 136 #set $output_hierarchical_clustering_plot_tmp = str($output_hierarchical_clustering_plot)+".png" | |
| 137 | |
| 138 gm convert $output_hierarchical_clustering_plot png:$output_hierarchical_clustering_plot_tmp ; | |
| 139 mv $output_hierarchical_clustering_plot_tmp $output_hierarchical_clustering_plot ; | |
| 140 #end if | |
| 141 | |
| 142 #if $output_heatmap_plot: | |
| 143 #set $output_heatmap_plot_tmp = str($output_heatmap_plot)+".png" | |
| 144 | |
| 145 gm convert $output_heatmap_plot png:$output_heatmap_plot_tmp ; | |
| 146 mv $output_heatmap_plot_tmp $output_heatmap_plot ; | |
| 147 #end if | |
| 148 #end if | |
| 149 | 93 |
| 150 grep -v 'Calculating library sizes from column' stderr.txt > stderr2.txt ; rm stderr.txt ; mv stderr2.txt stderr.txt ; | 94 grep -v 'Calculating library sizes from column' stderr.txt > stderr2.txt ; rm stderr.txt ; mv stderr2.txt stderr.txt ; |
| 151 | 95 |
| 152 ## Locale error messages: | 96 ## Locale error messages: |
| 153 grep -v 'During startup - Warning messages' stderr.txt > stderr2.txt ; rm stderr.txt ; mv stderr2.txt stderr.txt ; | 97 grep -v 'During startup - Warning messages' stderr.txt > stderr2.txt ; rm stderr.txt ; mv stderr2.txt stderr.txt ; |
| 304 if(output_MDSplot_logFC != "/dev/null") { | 248 if(output_MDSplot_logFC != "/dev/null") { |
| 305 write("Creating MDS plot (logFC method)",stdout()) | 249 write("Creating MDS plot (logFC method)",stdout()) |
| 306 points <- plotMDS.DGEList(dge,top=500,labels=rep("",nrow(dge\$samples)))# Get coordinates of unflexible plot | 250 points <- plotMDS.DGEList(dge,top=500,labels=rep("",nrow(dge\$samples)))# Get coordinates of unflexible plot |
| 307 dev.off()# Kill it | 251 dev.off()# Kill it |
| 308 | 252 |
| 309 if(output_format_images == "pdf" || output_format_images == "png") { | 253 if(output_format_images == "pdf") { |
| 310 pdf(output_MDSplot_logFC,height=14,width=14) | 254 pdf(output_MDSplot_logFC,height=14,width=14) |
| 311 } else if(output_format_images == "svg") { | 255 } else if(output_format_images == "svg") { |
| 312 svg(output_MDSplot_logFC,height=14,width=14) | 256 svg(output_MDSplot_logFC,height=14,width=14) |
| 257 } else { | |
| 258 ## png(output_MDSplot_logFC) | |
| 259 ## png does not work out of the box in the Galaxy Toolshed Version of R due to its compile settings: https://biostar.usegalaxy.org/p/9170/ | |
| 260 | |
| 261 bitmap(output_MDSplot_logFC,type="png16m",height=14,width=14) | |
| 313 } | 262 } |
| 314 ## else { | 263 |
| 315 ## png(output_MDSplot_logFC) | |
| 316 ##} | |
| 317 ## png does not work out of the box in the Galaxy Toolshed Version of R due to its compile settings | |
| 318 | 264 |
| 319 diff_x <- abs(max(points\$x)-min(points\$x)) | 265 diff_x <- abs(max(points\$x)-min(points\$x)) |
| 320 diff_y <-(max(points\$y)-min(points\$y)) | 266 diff_y <-(max(points\$y)-min(points\$y)) |
| 321 plot(c(min(points\$x),max(points\$x) + 0.45 * diff_x), c(min(points\$y) - 0.05 * diff_y,max(points\$y) + 0.05 * diff_y), main="edgeR logFC-MDS Plot on top 500 genes",type="n", xlab="Leading logFC dim 1", ylab="Leading logFC dim 2") | 267 plot(c(min(points\$x),max(points\$x) + 0.45 * diff_x), c(min(points\$y) - 0.05 * diff_y,max(points\$y) + 0.05 * diff_y), main="edgeR logFC-MDS Plot on top 500 genes",type="n", xlab="Leading logFC dim 1", ylab="Leading logFC dim 2") |
| 322 points(points\$x,points\$y,pch=20) | 268 points(points\$x,points\$y,pch=20) |
| 330 write("Creating MDS plot (bcv method)",stdout()) | 276 write("Creating MDS plot (bcv method)",stdout()) |
| 331 pdf("/home/youri/Desktop/bcvmds.pdf") | 277 pdf("/home/youri/Desktop/bcvmds.pdf") |
| 332 points <- plotMDS.DGEList(dge,method="bcv",top=500,labels=rep("",nrow(dge\$samples)))# Get coordinates of unflexible plot | 278 points <- plotMDS.DGEList(dge,method="bcv",top=500,labels=rep("",nrow(dge\$samples)))# Get coordinates of unflexible plot |
| 333 dev.off()# Kill it | 279 dev.off()# Kill it |
| 334 | 280 |
| 335 if(output_format_images == "pdf" || output_format_images == "png") { | 281 if(output_format_images == "pdf") { |
| 336 pdf(output_MDSplot_bcv,height=14,width=14) | 282 pdf(output_MDSplot_bcv,height=14,width=14) |
| 337 } else if(output_format_images == "svg") { | 283 } else if(output_format_images == "svg") { |
| 338 svg(output_MDSplot_bcv,height=14,width=14) | 284 svg(output_MDSplot_bcv,height=14,width=14) |
| 285 } else { | |
| 286 ## png(output_MDSplot_bcv) | |
| 287 ## png does not work out of the box in the Galaxy Toolshed Version of R due to its compile settings: https://biostar.usegalaxy.org/p/9170/ | |
| 288 | |
| 289 bitmap(output_MDSplot_bcv,type="png16m",height=14,width=14) | |
| 339 } | 290 } |
| 340 ## else { | |
| 341 ## png(output_MDSplot_bcv) | |
| 342 ##} | |
| 343 ## png does not work out of the box in the Galaxy Toolshed Version of R due to its compile settings | |
| 344 | 291 |
| 345 diff_x <- abs(max(points\$x)-min(points\$x)) | 292 diff_x <- abs(max(points\$x)-min(points\$x)) |
| 346 diff_y <-(max(points\$y)-min(points\$y)) | 293 diff_y <-(max(points\$y)-min(points\$y)) |
| 347 plot(c(min(points\$x),max(points\$x) + 0.45 * diff_x), c(min(points\$y) - 0.05 * diff_y,max(points\$y) + 0.05 * diff_y), main="edgeR BCV-MDS Plot",type="n", xlab="Leading BCV dim 1", ylab="Leading BCV dim 2") | 294 plot(c(min(points\$x),max(points\$x) + 0.45 * diff_x), c(min(points\$y) - 0.05 * diff_y,max(points\$y) + 0.05 * diff_y), main="edgeR BCV-MDS Plot",type="n", xlab="Leading BCV dim 1", ylab="Leading BCV dim 2") |
| 348 points(points\$x,points\$y,pch=20) | 295 points(points\$x,points\$y,pch=20) |
| 354 | 301 |
| 355 | 302 |
| 356 if(output_BCVplot != "/dev/null") { | 303 if(output_BCVplot != "/dev/null") { |
| 357 write("Creating Biological coefficient of variation plot",stdout()) | 304 write("Creating Biological coefficient of variation plot",stdout()) |
| 358 | 305 |
| 359 if(output_format_images == "pdf" || output_format_images == "png") { | 306 if(output_format_images == "pdf") { |
| 360 pdf(output_BCVplot) | 307 pdf(output_BCVplot) |
| 361 } else if(output_format_images == "svg") { | 308 } else if(output_format_images == "svg") { |
| 362 svg(output_BCVplot) | 309 svg(output_BCVplot) |
| 310 } else { | |
| 311 ## png(output_BCVplot) | |
| 312 ## png does not work out of the box in the Galaxy Toolshed Version of R due to its compile settings: https://biostar.usegalaxy.org/p/9170/ | |
| 313 | |
| 314 bitmap(output_BCVplot,type="png16m") | |
| 363 } | 315 } |
| 364 ##else { | |
| 365 ## png(output_BCVplot) | |
| 366 ##} | |
| 367 | 316 |
| 368 plotBCV(dge, cex=0.4, main="edgeR: Biological coefficient of variation (BCV) vs abundance") | 317 plotBCV(dge, cex=0.4, main="edgeR: Biological coefficient of variation (BCV) vs abundance") |
| 369 dev.off() | 318 dev.off() |
| 370 } | 319 } |
| 371 | 320 |
| 390 etable <- etable[order(etable\$FDR), ] | 339 etable <- etable[order(etable\$FDR), ] |
| 391 | 340 |
| 392 if(output_MAplot != "/dev/null") { | 341 if(output_MAplot != "/dev/null") { |
| 393 write("Creating MA plot...",stdout()) | 342 write("Creating MA plot...",stdout()) |
| 394 | 343 |
| 395 if(output_format_images == "pdf" || output_format_images == "png") { | 344 if(output_format_images == "pdf") { |
| 396 pdf(output_MAplot) | 345 pdf(output_MAplot) |
| 397 } else if(output_format_images == "svg") { | 346 } else if(output_format_images == "svg") { |
| 398 svg(output_MAplot) | 347 svg(output_MAplot) |
| 348 } else { | |
| 349 ## png(output_MAplot) | |
| 350 ## png does not work out of the box in the Galaxy Toolshed Version of R due to its compile settings: https://biostar.usegalaxy.org/p/9170/ | |
| 351 | |
| 352 bitmap(output_MAplot,type="png16m") | |
| 399 } | 353 } |
| 400 ##else { | |
| 401 ## png(output_MAplot) | |
| 402 ##} | |
| 403 | 354 |
| 404 with(etable, plot(logCPM, logFC, pch=20, main="edgeR: Fold change vs abundance")) | 355 with(etable, plot(logCPM, logFC, pch=20, main="edgeR: Fold change vs abundance")) |
| 405 with(subset(etable, FDR < fdr), points(logCPM, logFC, pch=20, col="red")) | 356 with(subset(etable, FDR < fdr), points(logCPM, logFC, pch=20, col="red")) |
| 406 abline(h=c(-1,1), col="blue") | 357 abline(h=c(-1,1), col="blue") |
| 407 dev.off() | 358 dev.off() |
| 408 } | 359 } |
| 409 | 360 |
| 410 if(output_PValue_distribution_plot != "/dev/null") { | 361 if(output_PValue_distribution_plot != "/dev/null") { |
| 411 write("Creating P-value distribution plot...",stdout()) | 362 write("Creating P-value distribution plot...",stdout()) |
| 412 | 363 |
| 413 if(output_format_images == "pdf" || output_format_images == "png") { | 364 if(output_format_images == "pdf") { |
| 414 pdf(output_PValue_distribution_plot) | 365 pdf(output_PValue_distribution_plot,width=14,height=14) |
| 415 } else if(output_format_images == "svg") { | 366 } else if(output_format_images == "svg") { |
| 416 svg(output_PValue_distribution_plot) | 367 svg(output_PValue_distribution_plot,width=14,height=14) |
| 368 } else { | |
| 369 ## png(output_PValue_distribution_plot) | |
| 370 ## png does not work out of the box in the Galaxy Toolshed Version of R due to its compile settings: https://biostar.usegalaxy.org/p/9170/ | |
| 371 | |
| 372 bitmap(output_PValue_distribution_plot,type="png16m",width=14,height=14) | |
| 417 } | 373 } |
| 418 ##else { | |
| 419 ## png(output_PValue_distribution_plot) | |
| 420 ##} | |
| 421 | 374 |
| 422 expressed_genes <- subset(etable, PValue < 0.99) | 375 expressed_genes <- subset(etable, PValue < 0.99) |
| 423 h <- hist(expressed_genes\$PValue,breaks=nrow(expressed_genes)/15,main="Binned P-Values (< 0.99)") | 376 h <- hist(expressed_genes\$PValue,breaks=nrow(expressed_genes)/15,main="Binned P-Values (< 0.99)") |
| 424 center <- sum(h\$counts) / length(h\$counts) | 377 center <- sum(h\$counts) / length(h\$counts) |
| 425 lines(c(0,1),c(center,center),lty=2,col="red",lwd=2) | 378 lines(c(0,1),c(center,center),lty=2,col="red",lwd=2) |
| 435 } | 388 } |
| 436 } | 389 } |
| 437 | 390 |
| 438 if(output_heatmap_plot != "/dev/null") { | 391 if(output_heatmap_plot != "/dev/null") { |
| 439 | 392 |
| 440 if(output_format_images == "pdf" || output_format_images == "png") { | 393 if(output_format_images == "pdf") { |
| 441 pdf(output_heatmap_plot,width=10.5) | 394 pdf(output_heatmap_plot,width=10.5) |
| 442 } else if(output_format_images == "svg") { | 395 } else if(output_format_images == "svg") { |
| 443 svg(output_heatmap_plot,width=10.5) | 396 svg(output_heatmap_plot,width=10.5) |
| 397 } else { | |
| 398 ## png(output_heatmap_plot) | |
| 399 ## png does not work out of the box in the Galaxy Toolshed Version of R due to its compile settings: https://biostar.usegalaxy.org/p/9170/ | |
| 400 | |
| 401 bitmap(output_heatmap_plot,type="png16m",width=10.5) | |
| 444 } | 402 } |
| 445 ## else { | |
| 446 ## png(output_heatmap_plot,width=10.5) | |
| 447 ##} | |
| 448 | 403 |
| 449 etable2 <- topTags(lrt, n=100)\$table | 404 etable2 <- topTags(lrt, n=100)\$table |
| 450 order <- rownames(etable2) | 405 order <- rownames(etable2) |
| 451 cpm_sub <- cpm(dge,normalized.lib.sizes=TRUE,log=TRUE)[as.numeric(order),] | 406 cpm_sub <- cpm(dge,normalized.lib.sizes=TRUE,log=TRUE)[as.numeric(order),] |
| 452 heatmap(t(cpm_sub)) | 407 heatmap(t(cpm_sub)) |
