view 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
line wrap: on
line source


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
remove_dups <- FALSE

input <- read.table('/tmp/tmpqa0_mcvo/files/3/1/c/dataset_31cbce15-3708-4c78-bdf6-aca07697ccb7.dat', header=file_has_header, sep="\t", quote="")
ids <- as.character(input[, 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 if (organism == "Rn"){
    suppressPackageStartupMessages(library(org.Rn.eg.db))
    db <- org.Rn.eg.db
} else if (organism == "At"){
    suppressPackageStartupMessages(library(org.At.tair.db))
    db <- org.At.tair.db
} else {
    cat(paste("Organism type not supported", organism))
}

cols <- unlist(strsplit(output_cols, ","))
result <- select(db, keys=ids, keytype=id_type, columns=cols)

if(remove_dups) {
    result <- result[!duplicated(result$ENSEMBL),]
}

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)