diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/out_rscript.txt	Wed Jan 03 15:25:26 2018 -0500
@@ -0,0 +1,34 @@
+
+options( show.error.messages=F, error = function () { cat( geterrmessage(), file=stderr() ); q( "no", 1, F ) } )
+
+# we need that to not crash galaxy with an UTF8 error on German LC settings.
+loc <- Sys.setlocale("LC_MESSAGES", "en_US.UTF-8")
+
+id_type <- "ENSEMBL"
+organism <- "Hs"
+output_cols <- "ENSEMBL,ENTREZID,SYMBOL,GENENAME"
+file_has_header <- FALSE
+
+ids <- as.character(read.table("/tmp/tmpY5XREO/files/000/dataset_3.dat", header=file_has_header)[,1])
+
+if(organism == "Hs"){
+    suppressPackageStartupMessages(library(org.Hs.eg.db))
+    db <- org.Hs.eg.db
+} else if (organism == "Mm"){
+    suppressPackageStartupMessages(library(org.Mm.eg.db))
+    db <- org.Mm.eg.db
+} else if (organism == "Dm"){
+    suppressPackageStartupMessages(library(org.Dm.eg.db))
+    db <- org.Dm.eg.db
+} else if (organism == "Dr"){
+    suppressPackageStartupMessages(library(org.Dr.eg.db))
+    db <- org.Dr.eg.db
+} else {
+    cat(paste("Organism type not supported", organism))
+}
+
+cols <- unlist(strsplit(output_cols, ","))
+result <- select(db, keys=ids, keytype=id_type, columns=cols)
+write.table(result, file="/tmp/tmpY5XREO/files/000/dataset_4.dat", sep="\t", row.names=FALSE, quote=FALSE)
+
+    
\ No newline at end of file