annotate data_manager/customProDB_annotation.R @ 0:45755942ae7b draft

planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
author galaxyp
date Tue, 14 Mar 2017 14:11:55 -0400
parents
children 9b4ee836e35b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
1 #!/usr/bin/env Rscript
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
2
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
3 initial.options <- commandArgs(trailingOnly = FALSE)
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
4 script_parent_dir <- dirname(sub("--file=", "", initial.options[grep("--file=", initial.options)]))
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
5
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
6 ## begin warning handler
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
7 withCallingHandlers({
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
8
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
9 library(methods) # Because Rscript does not always do this
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
10
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
11 options('useFancyQuotes' = FALSE)
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
12
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
13 suppressPackageStartupMessages(library("optparse"))
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
14 suppressPackageStartupMessages(library("RGalaxy"))
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
15
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
16
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
17 option_list <- list()
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
18 option_list$dbkey <- make_option('--dbkey', type='character')
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
19 option_list$dbsnp <- make_option('--dbsnp', type='character')
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
20 option_list$cosmic <- make_option('--cosmic', type='logical')
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
21 option_list$outputFile <- make_option('--outputFile', type='character')
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
22 option_list$dbkey_description <- make_option('--dbkey_description', type='character')
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
23
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
24 opt <- parse_args(OptionParser(option_list=option_list))
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
25
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
26
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
27 customProDB_annotation <- function(
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
28 dbkey = GalaxyCharacterParam(required=TRUE),
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
29 dbsnp_str = GalaxyCharacterParam(required=FALSE),
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
30 cosmic = GalaxyLogicalParam(required=FALSE),
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
31 dbkey_description = GalaxyCharacterParam(required=FALSE),
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
32 outputFile = GalaxyOutput("output","json"))
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
33 {
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
34 if (!file.exists(outputFile))
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
35 {
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
36 gstop("json params file does not exist")
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
37 }
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
38
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
39 if (length(dbkey_description) < 1)
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
40 {
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
41 dbkey_description = dbkey
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
42 }
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
43
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
44 if (length(dbsnp_str) > 0)
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
45 {
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
46 dbsnp = dbsnp_str
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
47 }
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
48 else
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
49 {
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
50 dbsnp = NULL
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
51 }
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
52
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
53 use_cosmic = FALSE
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
54 if (length(cosmic) > 0)
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
55 {
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
56 if (grepl("^hg", dbkey))
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
57 {
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
58 use_cosmic = TRUE
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
59 }
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
60 else
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
61 {
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
62 gstop("COSMIC annotation requested but dbkey does not indicate a human genome (e.g. hg19)")
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
63 }
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
64 }
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
65
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
66 suppressPackageStartupMessages(library(rjson))
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
67 params = fromJSON(file=outputFile)
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
68 target_directory = params$output_data[[1]]$extra_files_path
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
69 dir.create(target_directory)
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
70
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
71 tryCatch(
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
72 {
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
73 file.remove(outputFile)
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
74 }, error=function(err)
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
75 {
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
76 gstop("failed to remove json params file after reading")
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
77 })
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
78
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
79 ucscTableCodingFastaURL = paste("http://genome.ucsc.edu/cgi-bin/hgTables?db=", dbkey, "&hgSeq.cdsExon=on&hgSeq.granularity=gene&hgSeq.casing=exon&hgSeq.repMasking=lower&hgta_doGenomicDna=get+sequence&hgta_group=genes&hgta_track=refGene&hgta_table=refGene&hgta_regionType=genome", sep="")
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
80 ucscTableProteinFastaURL = paste("http://genome.ucsc.edu/cgi-bin/hgTables?db=", dbkey, "&hgta_geneSeqType=protein&hgta_doGenePredSequence=submit&hgta_track=refGene&hgta_table=refGene", sep="")
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
81 codingFastaFilepath = paste(target_directory, "/", dbkey, ".cds.fa", sep="")
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
82 proteinFastaFilepath = paste(target_directory, "/", dbkey, ".protein.fa", sep="")
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
83
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
84 suppressPackageStartupMessages(library(customProDB))
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
85 options(timeout=3600)
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
86
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
87 cat(paste("Downloading coding FASTA from:", ucscTableCodingFastaURL, "\n"))
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
88 download.file(ucscTableCodingFastaURL, codingFastaFilepath, quiet=T, mode='wb')
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
89
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
90 cat(paste("Downloading protein FASTA from:", ucscTableProteinFastaURL, "\n"))
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
91 download.file(ucscTableProteinFastaURL, proteinFastaFilepath, quiet=T, mode='wb')
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
92
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
93 cat(paste("Preparing Refseq annotation files\n"))
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
94 customProDB::PrepareAnnotationRefseq(genome=dbkey, CDSfasta=codingFastaFilepath, pepfasta=proteinFastaFilepath, annotation_path=target_directory, dbsnp=dbsnp, COSMIC=use_cosmic)
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
95
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
96 outputPath = paste(dbkey, "/customProDB", sep="")
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
97 output = list(data_tables = list())
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
98 output[["data_tables"]][["customProDB"]]=c(path=outputPath, name=dbkey_description, dbkey=dbkey, value=dbkey)
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
99 write(toJSON(output), file=outputFile)
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
100 }
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
101
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
102
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
103 params <- list()
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
104 for(param in names(opt))
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
105 {
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
106 if (!param == "help")
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
107 params[param] <- opt[param]
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
108 }
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
109
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
110 setClass("GalaxyRemoteError", contains="character")
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
111 wrappedFunction <- function(f)
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
112 {
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
113 tryCatch(do.call(f, params),
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
114 error=function(e) new("GalaxyRemoteError", conditionMessage(e)))
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
115 }
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
116
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
117
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
118 suppressPackageStartupMessages(library(RGalaxy))
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
119 do.call(customProDB_annotation, params)
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
120
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
121 ## end warning handler
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
122 }, warning = function(w) {
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
123 cat(paste("Warning:", conditionMessage(w), "\n"))
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
124 invokeRestart("muffleWarning")
45755942ae7b planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
125 })