Mercurial > repos > iuc > annotatemyids
annotate test-data/out_rscript.txt @ 13:133f36c29579 draft
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotatemyids commit 669d17e476ed4e3a57c697e42f690f9650e855d8
author | iuc |
---|---|
date | Sat, 21 Jan 2023 14:58:02 +0000 |
parents | 4f2967b27e67 |
children |
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 |
11
4f2967b27e67
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotatemyids commit 3e791f5bd978eee4cd42787c33d4cccc76612c9e
iuc
parents:
0
diff
changeset
|
11 remove_dups <- FALSE |
0
442e2d79b05c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotatemyids commit 46271ad3015ee41a825860084b2ab9d8081ecab8
iuc
parents:
diff
changeset
|
12 |
11
4f2967b27e67
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotatemyids commit 3e791f5bd978eee4cd42787c33d4cccc76612c9e
iuc
parents:
0
diff
changeset
|
13 input <- read.table('/tmp/tmpqa0_mcvo/files/3/1/c/dataset_31cbce15-3708-4c78-bdf6-aca07697ccb7.dat', header=file_has_header, sep="\t", quote="") |
4f2967b27e67
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotatemyids commit 3e791f5bd978eee4cd42787c33d4cccc76612c9e
iuc
parents:
0
diff
changeset
|
14 ids <- as.character(input[, 1]) |
0
442e2d79b05c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotatemyids commit 46271ad3015ee41a825860084b2ab9d8081ecab8
iuc
parents:
diff
changeset
|
15 |
442e2d79b05c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotatemyids commit 46271ad3015ee41a825860084b2ab9d8081ecab8
iuc
parents:
diff
changeset
|
16 if(organism == "Hs"){ |
442e2d79b05c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotatemyids commit 46271ad3015ee41a825860084b2ab9d8081ecab8
iuc
parents:
diff
changeset
|
17 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
|
18 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
|
19 } 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
|
20 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
|
21 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
|
22 } 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
|
23 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
|
24 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
|
25 } 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
|
26 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
|
27 db <- org.Dr.eg.db |
11
4f2967b27e67
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotatemyids commit 3e791f5bd978eee4cd42787c33d4cccc76612c9e
iuc
parents:
0
diff
changeset
|
28 } else if (organism == "Rn"){ |
4f2967b27e67
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotatemyids commit 3e791f5bd978eee4cd42787c33d4cccc76612c9e
iuc
parents:
0
diff
changeset
|
29 suppressPackageStartupMessages(library(org.Rn.eg.db)) |
4f2967b27e67
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotatemyids commit 3e791f5bd978eee4cd42787c33d4cccc76612c9e
iuc
parents:
0
diff
changeset
|
30 db <- org.Rn.eg.db |
4f2967b27e67
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotatemyids commit 3e791f5bd978eee4cd42787c33d4cccc76612c9e
iuc
parents:
0
diff
changeset
|
31 } else if (organism == "At"){ |
4f2967b27e67
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotatemyids commit 3e791f5bd978eee4cd42787c33d4cccc76612c9e
iuc
parents:
0
diff
changeset
|
32 suppressPackageStartupMessages(library(org.At.tair.db)) |
4f2967b27e67
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotatemyids commit 3e791f5bd978eee4cd42787c33d4cccc76612c9e
iuc
parents:
0
diff
changeset
|
33 db <- org.At.tair.db |
0
442e2d79b05c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotatemyids commit 46271ad3015ee41a825860084b2ab9d8081ecab8
iuc
parents:
diff
changeset
|
34 } else { |
442e2d79b05c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotatemyids commit 46271ad3015ee41a825860084b2ab9d8081ecab8
iuc
parents:
diff
changeset
|
35 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
|
36 } |
442e2d79b05c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotatemyids commit 46271ad3015ee41a825860084b2ab9d8081ecab8
iuc
parents:
diff
changeset
|
37 |
442e2d79b05c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotatemyids commit 46271ad3015ee41a825860084b2ab9d8081ecab8
iuc
parents:
diff
changeset
|
38 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
|
39 result <- select(db, keys=ids, keytype=id_type, columns=cols) |
11
4f2967b27e67
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotatemyids commit 3e791f5bd978eee4cd42787c33d4cccc76612c9e
iuc
parents:
0
diff
changeset
|
40 |
4f2967b27e67
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotatemyids commit 3e791f5bd978eee4cd42787c33d4cccc76612c9e
iuc
parents:
0
diff
changeset
|
41 if(remove_dups) { |
4f2967b27e67
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotatemyids commit 3e791f5bd978eee4cd42787c33d4cccc76612c9e
iuc
parents:
0
diff
changeset
|
42 result <- result[!duplicated(result$ENSEMBL),] |
4f2967b27e67
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotatemyids commit 3e791f5bd978eee4cd42787c33d4cccc76612c9e
iuc
parents:
0
diff
changeset
|
43 } |
4f2967b27e67
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotatemyids commit 3e791f5bd978eee4cd42787c33d4cccc76612c9e
iuc
parents:
0
diff
changeset
|
44 |
4f2967b27e67
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotatemyids commit 3e791f5bd978eee4cd42787c33d4cccc76612c9e
iuc
parents:
0
diff
changeset
|
45 write.table(result, file='/tmp/tmpqa0_mcvo/job_working_directory/000/4/outputs/galaxy_dataset_b06fd1c6-69cb-4c43-9caf-1a445a3b8b2e.dat', sep="\t", row.names=FALSE, quote=FALSE) |
0
442e2d79b05c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotatemyids commit 46271ad3015ee41a825860084b2ab9d8081ecab8
iuc
parents:
diff
changeset
|
46 |
442e2d79b05c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/annotatemyids commit 46271ad3015ee41a825860084b2ab9d8081ecab8
iuc
parents:
diff
changeset
|
47 |