diff edgeR_repenrich.R @ 6:83b5ea7cc342 draft

planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/repenrich commit e3c9f70fe670ee27d667cabd85bf820f63c94f7a
author artbio
date Fri, 07 Dec 2018 13:05:46 -0500
parents 15e3e29f310e
children 308591fd36e5
line wrap: on
line diff
--- a/edgeR_repenrich.R	Sun Nov 18 17:07:02 2018 -0500
+++ b/edgeR_repenrich.R	Fri Dec 07 13:05:46 2018 -0500
@@ -194,15 +194,26 @@
     logFC <- results[, "logFC"]
     # Plot the repeat classes
     classes <- with(results, reorder(class, -logFC, median))
+    classes
     par(mar=c(6,10,4,1))
     boxplot(logFC ~ classes, data=results, outline=FALSE, horizontal=TRUE,
-        las=2, xlab="log(Fold Change)", main=paste0(allcontrasts, ", by Class"))
+        las=2, xlab="log2(Fold Change)", main=paste0(allcontrasts, ", by Class"))
     abline(v=0)
     # Plot the repeat types
     types <- with(results, reorder(type, -logFC, median))
     boxplot(logFC ~ types, data=results, outline=FALSE, horizontal=TRUE,
-        las=2, xlab="log(Fold Change)", main=paste0(allcontrasts, ", by Type"))
+        las=2, xlab="log2(Fold Change)", main=paste0(allcontrasts, ", by Type"), yaxt="n")
+    axis(2, cex.axis=(1*16)/(length(levels(types))),
+         at=seq(from=1, to=length(levels(types))),
+         labels=levels(types), las=2)
     abline(v=0)
+    # volcano plot
+    TEdata = cbind(rownames(results), as.data.frame(results), score=-log(results$FDR, 10))
+    colnames(TEdata) = c("Tag","log2FC", "FDR", "Class", "Type", "score")
+    color = ifelse(TEdata$FDR<0.05, "red", "black")   
+    s <- subset(TEdata, FDR<0.01)
+    with(TEdata, plot(log2FC, score,  pch=20, col=color, main="Volcano plot (all tag types)", ylab="-log10(FDR)"))
+    text(s[,2], s[,6], labels = s[,5], pos = seq(from=1, to=3), cex=0.5)
 }
 
 # close the plot device