Advertisement
Guest User

Untitled

a guest
May 23rd, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. # export
  2. write.table(dxr1, 'exon_results.txt', sep = '\t', row.names = F)
  3.  
  4. # explore results
  5. sig <- dxr1[!is.na(dxr1$padj),]
  6. sig <- sig[sig$padj <= 0.05,]
  7. sig_df <- arrange(as.data.frame(sig), log2fold_shCtr_sh2)
  8. write.table(sig_df, 'exon_results_sig.txt', sep = '\t', row.names = F)
  9. DEXSeqHTML(dxr1)
  10.  
  11. # plots
  12. plotDEXSeq(dxr1, "PLAUR", legend=TRUE, cex.axis=1.2, cex=1.3, lwd=2)
  13. plotDEXSeq(dxr1, "PLAUR", displayTranscripts=TRUE, legend=TRUE, cex.axis=1.2, cex=1.3, lwd=2)
  14. plotDEXSeq(dxr1, "PLAUR", expression=FALSE, norCounts=TRUE, legend=TRUE, cex.axis=1.2, cex=1.3, lwd=2)
  15.  
  16. # re-orient exons and compute p values (first exon versus last exon)
  17. x <- data.frame(dxr1)
  18. s <- split(x, x$groupID)
  19.  
  20. output <- NULL
  21. for (elmt in s) {
  22. line <- NULL
  23. if (elmt$genomicData.strand[1] == '-') {
  24. line <- c(elmt$groupID[1],
  25. elmt$featureID[length(elmt$featureID)],
  26. elmt$padj[length(elmt$padj)],
  27. elmt$featureID[1],
  28. elmt$padj[1])
  29. }
  30. else {
  31. line <- c(elmt$groupID[1],
  32. elmt$featureID[1],
  33. elmt$padj[1],
  34. elmt$featureID[length(elmt$featureID)],
  35. elmt$padj[length(elmt$padj)])
  36. }
  37. output <- rbind(output, line)
  38. }
  39.  
  40. o <- data.frame(output, row.names = NULL, stringsAsFactors = F)
  41. colnames(o) <- c('Group', 'FirstExon', 'pval_first', 'LastExon', 'pval_last')
  42. o$pval_first <- as.numeric(o$pval_first)
  43. o$pval_last <- as.numeric(o$pval_last)
  44.  
  45. p_df <- NULL
  46. for (p in seq(0,1,0.01)) {
  47. p_df <- rbind(p_df, c(as.numeric(table(o[!is.na(o[,3]),][,3]<p)[2]) / nrow(o[!is.na(o[,3]),]),
  48. as.numeric(table(o[!is.na(o[,5]),][,5]<p)[2]) / nrow(o[!is.na(o[,5]),])))
  49. }
  50.  
  51. plot(p_df, type = 'l')
  52. lines(seq(0,1,0.01), seq(0,1,0.01))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement