Advertisement
Guest User

Untitled

a guest
Oct 2nd, 2017
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
R 1.10 KB | None | 0 0
  1. #!/usr/bin/R
  2. # Importing transcript abundance datasets with tximport
  3. library(tximportData)
  4. dir <- 'dwhelper/1/quants/quants'
  5. dir_quants <- '/home/prabat/dwhelper/1/quants'
  6. setwd(dir)
  7. samples <- read.csv('SraRunTable_1.csv', header = T)
  8. samples$condition <- factor(rep(c('A', 'B'), each = 9))
  9. rownames(samples) <- samples$Run_s
  10. files <- file.path(dir_quants, samples$Run_s, 'quant.sf')
  11. names(files) <- samples$Run_s
  12. names(files)
  13. files
  14. all(file.exists(files))
  15.  
  16. library(biomaRt)
  17. library(GenomicFeatures)
  18. # mart <- useMart(biomart = 'plants_mart', host = 'plants.ensembl.org')
  19. # datasets <- listDatasets(mart)
  20. # datasets[1:6, 1:2]
  21. #
  22. # idx <- grep('oryza', datasets$description, ignore.case = T)
  23. # datasets[idx, 1:2]
  24.  
  25. txdb <- makeTxDbFromBiomart(biomart="plants_mart",
  26.                             dataset="osativa_eg_gene",
  27.                             host="plants.ensembl.org")
  28. k <-  keys(txdb, keytype = 'GENEID')
  29. df <- select(txdb, keys = k, keytype = 'GENEID', columns = 'TXNAME')
  30.  
  31. tx2gene <- df[,2:1]
  32. head(tx2gene)
  33.  
  34. write.csv(x = tx2gene, file = 'tx2gene.csv')
  35. save(txdb, file = 'txdb')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement