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