annotate customProDB.R @ 1:ad130eaa3a05 draft

planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
author galaxyp
date Fri, 12 May 2017 13:17:40 -0400
parents 8ccfff69dd57
children 2cba79e6037e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
8ccfff69dd57 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
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
2
8ccfff69dd57 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)
8ccfff69dd57 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)]))
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
5
8ccfff69dd57 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
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
7 withCallingHandlers({
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
8
8ccfff69dd57 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
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
10
8ccfff69dd57 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)
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
12
8ccfff69dd57 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"))
8ccfff69dd57 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"))
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
15
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
16
8ccfff69dd57 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()
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
18
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
19 option_list$bam <- make_option('--bam', type='character')
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
20 option_list$bai <- make_option('--bai', type='character')
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
21 option_list$vcf <- make_option('--vcf', type='character')
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
22 option_list$exon_anno <- make_option('--exon_anno', type='character')
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
23 option_list$proteinseq <- make_option('--proteinseq', type='character')
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
24 option_list$procodingseq <- make_option('--procodingseq', type='character')
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
25 option_list$ids <- make_option('--ids', type='character')
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
26 option_list$dbsnpinCoding <- make_option('--dbsnpinCoding', type='character')
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
27 option_list$cosmic <- make_option('--cosmic', type='character')
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
28 option_list$annotationFromHistory <- make_option('--annotationFromHistory', type='logical', action="store_true", default=FALSE)
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
29 option_list$rpkmCutoff <- make_option('--rpkmCutoff', type='character')
1
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
30 option_list$outputIndels <- make_option('--outputIndels', type='logical', action="store_true", default=FALSE)
0
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
31 #option_list$outputNovelJunctions <- make_option('--outputNovelJunctions', type='logical', action="store_true", default=FALSE)
1
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
32 #option_list$bedFile <- make_option('--bedFile', type='character')
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
33 #option_list$bsGenome <- make_option('--bsGenome', type='character')
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
34 option_list$outputRData <- make_option('--outputRData', type='logical', action="store_true", default=FALSE)
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
35 option_list$outputSQLite <- make_option('--outputSQLite', type='logical', action="store_true", default=FALSE)
0
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
36
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
37
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
38 opt <- parse_args(OptionParser(option_list=option_list))
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
39
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
40
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
41 customProDB <- function(
1
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
42 bam_file = GalaxyInputFile(required=TRUE),
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
43 bai_file = GalaxyInputFile(required=TRUE),
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
44 vcf_file = GalaxyInputFile(required=TRUE),
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
45 exon_anno_file = GalaxyInputFile(required=TRUE),
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
46 proteinseq_file = GalaxyInputFile(required=TRUE),
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
47 procodingseq_file = GalaxyInputFile(required=TRUE),
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
48 ids_file = GalaxyInputFile(required=TRUE),
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
49 dbsnpinCoding_file = GalaxyInputFile(required=FALSE),
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
50 cosmic_file = GalaxyInputFile(required=FALSE),
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
51 annotationFromHistory = GalaxyLogicalParam(required=FALSE),
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
52 rpkmCutoff = GalaxyNumericParam(required=TRUE),
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
53 outputIndels = GalaxyLogicalParam(required=FALSE),
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
54 outputRData = GalaxyLogicalParam(required=FALSE),
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
55 outputSQLite = GalaxyLogicalParam(required=FALSE)
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
56 #,outputNovelJunctions = GalaxyLogicalParam(required=FALSE)
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
57 #,bedFile = GalaxyInputFile(required=FALSE)
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
58 #,bsGenome = GalaxyCharacterParam(required=FALSE)
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
59 )
0
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
60 {
1
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
61 old <- options(stringsAsFactors = FALSE, gsubfn.engine = "R")
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
62 on.exit(options(old), add = TRUE)
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
63
0
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
64 file.symlink(exon_anno_file, paste(getwd(), "exon_anno.RData", sep="/"))
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
65 file.symlink(proteinseq_file, paste(getwd(), "proseq.RData", sep="/"))
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
66 file.symlink(procodingseq_file, paste(getwd(), "procodingseq.RData", sep="/"))
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
67 file.symlink(ids_file, paste(getwd(), "ids.RData", sep="/"))
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
68
1
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
69 load(exon_anno_file)
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
70 load(proteinseq_file)
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
71 load(procodingseq_file)
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
72 load(ids_file)
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
73
0
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
74 if (length(dbsnpinCoding_file) > 0)
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
75 {
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
76 file.symlink(dbsnpinCoding_file, paste(getwd(), "dbsnpinCoding.RData", sep="/"))
1
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
77 labelrsid = TRUE
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
78 load(dbsnpinCoding_file)
0
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
79 }
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
80 else
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
81 {
1
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
82 dbsnpinCoding = NULL
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
83 labelrsid = FALSE
0
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
84 }
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
85
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
86 if (length(cosmic_file) > 0)
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
87 {
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
88 file.symlink(cosmic_file, paste(getwd(), "cosmic.RData", sep="/"))
1
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
89 use_cosmic = TRUE
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
90 load(cosmic_file)
0
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
91 }
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
92 else
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
93 {
1
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
94 cosmic = NULL
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
95 use_cosmic = FALSE
0
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
96 }
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
97
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
98 bamLink = "input.bam"
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
99 file.symlink(bam_file, bamLink)
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
100 file.symlink(bai_file, paste(bamLink, ".bai", sep=""))
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
101
1
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
102 # load from GitHub until conda package is available
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
103 download.file("https://github.com/ggrothendieck/sqldf/archive/master.zip", "sqldf.zip", quiet=TRUE)
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
104 unzip("sqldf.zip")
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
105 devtools::load_all("sqldf-master")
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
106
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
107 # load customProDB from GitHub (NOTE: downloading the zip is faster than cloning the repo with git2r or devtools::install_github)
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
108 download.file("https://github.com/chambm/customProDB/archive/master.zip", "customProDB.zip", quiet=TRUE)
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
109 unzip("customProDB.zip")
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
110 devtools::load_all("customProDB-master")
0
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
111
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
112 easyRun(bamFile=bamLink, vcfFile=vcf_file, annotation_path=getwd(),
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
113 rpkm_cutoff=rpkmCutoff, outfile_path=".", outfile_name="output",
1
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
114 nov_junction=FALSE, INDEL=outputIndels,
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
115 lablersid=labelrsid, COSMIC=use_cosmic)
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
116
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
117 # save variant annotations to an RData file (needed by proBAMr)
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
118 if (outputRData || outputSQLite)
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
119 {
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
120 variantAnnotation = getVariantAnnotation(vcf_file, ids, exon, proteinseq, procodingseq, dbsnpinCoding, cosmic)
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
121 if (outputRData) save(variantAnnotation, file="output.rdata")
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
122 }
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
123
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
124 if (outputSQLite)
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
125 {
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
126 # create protein-centric variant annotation table (needed by Galaxy-P viewer MVP)
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
127 varproseq = unique(rbind(variantAnnotation$snvproseq, variantAnnotation$indelproseq))
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
128 ref_vs_var_seq = sqldf::sqldf("SELECT reference.pro_name, variant.pro_name AS var_pro_name, reference.peptide AS ref_seq, variant.peptide AS var_seq
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
129 FROM proteinseq reference, varproseq variant
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
130 WHERE reference.tx_name=variant.tx_name
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
131 GROUP BY variant.pro_name")
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
132 getCigarishString = function(ref, var)
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
133 {
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
134 a = Biostrings::pairwiseAlignment(ref, var)
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
135 d = gsub("[A-Z]", "=", Biostrings::compareStrings(a@pattern, a@subject))
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
136 r = rle(strsplit(d, "")[[1]])
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
137 gsub("-", "D", gsub("\\+", "I", gsub("\\?", "X", paste0(r$lengths, r$values, collapse=""))))
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
138 }
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
139 ref_vs_var_seq$cigar = mapply(FUN=getCigarishString, ref_vs_var_seq$ref_seq, ref_vs_var_seq$var_seq, USE.NAMES=FALSE)
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
140 ref_vs_var_seq$annotation = substring(ref_vs_var_seq$var_pro_name, stringr::str_length(ref_vs_var_seq$pro_name)+2)
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
141
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
142 variant_annotation_sqlite = dbConnect(RSQLite::SQLite(), "output_variant_annotation.sqlite")
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
143 dbWriteTable(variant_annotation_sqlite,
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
144 "variant_annotation",
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
145 sqldf::sqldf("SELECT var_pro_name, pro_name, cigar, annotation FROM ref_vs_var_seq"))
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
146 DBI::dbExecute(variant_annotation_sqlite, "CREATE INDEX variant_annotation_var_pro_name ON variant_annotation (var_pro_name)")
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
147
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
148 # save genomic mapping to a SQLite file (needed by Galaxy-P viewer MVP)
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
149 exon$cds_start = as.integer(exon$cds_start)
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
150 exon$cds_end = as.integer(exon$cds_end)
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
151 genomic_mapping_sqlite = dbConnect(RSQLite::SQLite(), "output_genomic_mapping.sqlite")
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
152 varprocoding = unique(rbind(variantAnnotation$snvprocoding, variantAnnotation$indelprocoding))
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
153 dbWriteTable(genomic_mapping_sqlite,
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
154 "genomic_mapping",
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
155 sqldf::sqldf("SELECT exon.gene_name, exon.tx_name, varprocoding.pro_name, cds_start, cds_end,
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
156 chromosome_name AS chr_name, cds_chr_start, cds_chr_end, exon.strand
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
157 FROM exon, varprocoding
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
158 WHERE exon.tx_id=varprocoding.tx_id AND cds_chr_start > 0
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
159 GROUP BY exon.tx_id, rank
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
160 UNION
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
161 SELECT gene_name, tx_name, pro_name, cds_start, cds_end,
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
162 chromosome_name AS chr_name, cds_chr_start, cds_chr_end, exon.strand
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
163 FROM exon
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
164 WHERE cds_chr_start > 0
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
165 GROUP BY tx_id, rank"))
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
166 DBI::dbExecute(genomic_mapping_sqlite, "CREATE INDEX genomic_mapping_pro_name ON genomic_mapping (pro_name)")
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
167 }
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
168
ad130eaa3a05 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit e025f5b4d590c44537cf0702e2fb040a28f98fec
galaxyp
parents: 0
diff changeset
169 invisible(NULL)
0
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
170 }
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
171
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
172
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
173 params <- list()
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
174 for(param in names(opt))
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
175 {
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
176 if (!param == "help")
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
177 params[param] <- opt[param]
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
178 }
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
179
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
180 setClass("GalaxyRemoteError", contains="character")
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
181 wrappedFunction <- function(f)
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
182 {
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
183 tryCatch(do.call(f, params),
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
184 error=function(e) new("GalaxyRemoteError", conditionMessage(e)))
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
185 }
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
186
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
187
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
188 suppressPackageStartupMessages(library(RGalaxy))
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
189 do.call(customProDB, params)
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
190
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
191 ## end warning handler
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
192 }, warning = function(w) {
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
193 cat(paste("Warning:", conditionMessage(w), "\n"))
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
194 invokeRestart("muffleWarning")
8ccfff69dd57 planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/custom_pro_db commit 4bb5b663989d5f04e8fb74b111456f16d6edaa66
galaxyp
parents:
diff changeset
195 })