comparison test-data/out_rscript.txt @ 0:442e2d79b05c draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotatemyids commit 46271ad3015ee41a825860084b2ab9d8081ecab8
author iuc
date Wed, 03 Jan 2018 15:25:26 -0500
parents
children 4f2967b27e67
comparison
equal deleted inserted replaced
-1:000000000000 0:442e2d79b05c
1
2 options( show.error.messages=F, error = function () { cat( geterrmessage(), file=stderr() ); q( "no", 1, F ) } )
3
4 # we need that to not crash galaxy with an UTF8 error on German LC settings.
5 loc <- Sys.setlocale("LC_MESSAGES", "en_US.UTF-8")
6
7 id_type <- "ENSEMBL"
8 organism <- "Hs"
9 output_cols <- "ENSEMBL,ENTREZID,SYMBOL,GENENAME"
10 file_has_header <- FALSE
11
12 ids <- as.character(read.table("/tmp/tmpY5XREO/files/000/dataset_3.dat", header=file_has_header)[,1])
13
14 if(organism == "Hs"){
15 suppressPackageStartupMessages(library(org.Hs.eg.db))
16 db <- org.Hs.eg.db
17 } else if (organism == "Mm"){
18 suppressPackageStartupMessages(library(org.Mm.eg.db))
19 db <- org.Mm.eg.db
20 } else if (organism == "Dm"){
21 suppressPackageStartupMessages(library(org.Dm.eg.db))
22 db <- org.Dm.eg.db
23 } else if (organism == "Dr"){
24 suppressPackageStartupMessages(library(org.Dr.eg.db))
25 db <- org.Dr.eg.db
26 } else {
27 cat(paste("Organism type not supported", organism))
28 }
29
30 cols <- unlist(strsplit(output_cols, ","))
31 result <- select(db, keys=ids, keytype=id_type, columns=cols)
32 write.table(result, file="/tmp/tmpY5XREO/files/000/dataset_4.dat", sep="\t", row.names=FALSE, quote=FALSE)
33
34