SHARE
TWEET

Untitled

a guest Oct 13th, 2019 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. library(readr)
  2. library(stringr)
  3. library(ggplot2)
  4. library(ggseqlogo)
  5.  
  6. setwd("~/Documents/NPS James/MEME sequence logo plots/Fig2/Search1")
  7.  
  8. # Provide path to meme matrix files
  9. input <- list.files("~/Documents/NPS James/MEME sequence logo plots/Fig2/Search1")
  10.  
  11. # Read files and prepare list for ggseqlogo
  12. Fig2A <- list()
  13. for (i in 1:length(input)) {
  14.   x <- data.matrix(read.table(input[i],header = TRUE, sep = "", numerals = c("no.loss")), rownames.force = NA)
  15.   x <- t(x)
  16.   Fig2A[[i]]<-x
  17. }
  18.  
  19. ggseqlogo(Fig2A, ncol=1)
  20.  
  21. setwd("~/Documents/NPS James/MEME sequence logo plots/Fig2")
  22.  
  23. # Save plot to pdf
  24. pdf('2A.pdf',  width=6.5, height=5)
  25. ggseqlogo(Fig2A, ncol=1)
  26. dev.off()
  27.  
  28.  
  29. setwd("~/Documents/NPS James/MEME sequence logo plots/Fig2/Search2")
  30.  
  31. input2 <- list.files("~/Documents/NPS James/MEME sequence logo plots/Fig2/Search2")
  32.  
  33.  
  34. Fig2B <- list()
  35. for (i in 1:length(input2)) {
  36.   x <- data.matrix(read.table(input2[i],header = TRUE, sep = "", numerals = c("no.loss")), rownames.force = NA)
  37.   x <- t(x)
  38.   Fig2B[[i]]<-x
  39. }
  40.  
  41. setwd("~/Documents/NPS James/MEME sequence logo plots/Fig2")
  42.  
  43. pdf('2C.pdf',  width=6.89, height=1.6)
  44. ggseqlogo(Fig2B, ncol=1)
  45. dev.off()
  46.  
  47. setwd("~/Documents/NPS James/MEME sequence logo plots/Fig3")
  48. input3 <- list.files("~/Documents/NPS James/MEME sequence logo plots/Fig3")
  49.  
  50. Fig3 <- list()
  51. for (i in 1:length(input3)) {
  52.   x <- data.matrix(read.table(input3[i],header = TRUE, sep = "", numerals = c("no.loss")), rownames.force = NA)
  53.   x <- t(x)
  54.   Fig3[[i]]<-x
  55. }
  56.  
  57. pdf('3.pdf',  width=6.6, height=3.2)
  58. ggseqlogo(rev(Fig3), ncol=1)
  59. dev.off()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top