Mercurial > repos > galaxyp > psm_to_sam
comparison PSM2SAM.R @ 1:34f9e847dd4e draft
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/psm_to_sam commit cf9086847f3153e28b697b5f4b0da1a677eb165a-dirty
| author | galaxyp |
|---|---|
| date | Thu, 12 Nov 2015 18:11:28 -0500 |
| parents | c506e5dac2bb |
| children | ce09f1a1bbad |
comparison
equal
deleted
inserted
replaced
| 0:c506e5dac2bb | 1:34f9e847dd4e |
|---|---|
| 1 #!/usr/bin/env Rscript | 1 #!/usr/bin/env Rscript |
| 2 | |
| 3 initial.options <- commandArgs(trailingOnly = FALSE) | |
| 4 script_parent_dir <- dirname(sub("--file=", "", initial.options[grep("--file=", initial.options)])) | |
| 2 | 5 |
| 3 ## begin warning handler | 6 ## begin warning handler |
| 4 withCallingHandlers({ | 7 withCallingHandlers({ |
| 5 | 8 |
| 6 library(methods) # Because Rscript does not always do this | 9 library(methods) # Because Rscript does not always do this |
| 34 procodingseq_file = GalaxyInputFile(), | 37 procodingseq_file = GalaxyInputFile(), |
| 35 header_file = GalaxyInputFile(), | 38 header_file = GalaxyInputFile(), |
| 36 XScolumn = GalaxyCharacterParam(required=TRUE), | 39 XScolumn = GalaxyCharacterParam(required=TRUE), |
| 37 OutputFile = GalaxyOutput("proSAM","sam")) | 40 OutputFile = GalaxyOutput("proSAM","sam")) |
| 38 { | 41 { |
| 39 if (length(exon_anno_file) == 0) { exon_anno_file = "/export/src/tools-galaxyp-chambm/tools/bumbershoot/psm_to_sam/tool-data/exon_anno.RData" } | 42 if (length(exon_anno_file) == 0) { exon_anno_file = paste(script_parent_dir, "tool-data/exon_anno.RData", sep="/") } |
| 40 if (length(proteinseq_file) == 0) { proteinseq_file = "/export/src/tools-galaxyp-chambm/tools/bumbershoot/psm_to_sam/tool-data/proseq.RData" } | 43 if (length(proteinseq_file) == 0) { proteinseq_file = paste(script_parent_dir, "tool-data/proseq.RData", sep="/") } |
| 41 if (length(procodingseq_file) == 0) { procodingseq_file = "/export/src/tools-galaxyp-chambm/tools/bumbershoot/psm_to_sam/tool-data/procodingseq.RData" } | 44 if (length(procodingseq_file) == 0) { procodingseq_file = paste(script_parent_dir, "tool-data/procodingseq.RData", sep="/") } |
| 42 if (length(header_file) == 0) { header_file = "/export/src/tools-galaxyp-chambm/tools/bumbershoot/psm_to_sam/tool-data/header_refseq_hg19.txt" } | 45 if (length(header_file) == 0) { header_file = paste(script_parent_dir, "tool-data/header_refseq_hg19.txt", sep="/") } |
| 43 | 46 |
| 44 if (!file.exists(header_file)) { gstop("failed to read header file") } | 47 if (!file.exists(header_file)) { gstop("failed to read header file") } |
| 45 if (file.exists(OutputFile)) | 48 if (file.exists(OutputFile)) |
| 46 { | 49 { |
| 47 if (file.info(OutputFile)$size > 0) { gstop("output file already exists") } | 50 if (file.info(OutputFile)$size > 0) { gstop("output file already exists") } |
| 61 suppressPackageStartupMessages(library(Biostrings)) | 64 suppressPackageStartupMessages(library(Biostrings)) |
| 62 | 65 |
| 63 options(stringsAsFactors=FALSE) | 66 options(stringsAsFactors=FALSE) |
| 64 | 67 |
| 65 scoreName = XScolumn | 68 scoreName = XScolumn |
| 66 columnName = gsub(":", "_", scoreName) | 69 columnName = gsub("[^A-Z0-9]", "_", scoreName) |
| 67 | 70 |
| 68 passedPSM <- tryCatch({ | 71 passedPSM <- tryCatch({ |
| 69 #read.delim(passedPSM_file, row.names=1) | 72 #read.delim(passedPSM_file, row.names=1) |
| 70 suppressPackageStartupMessages(library(RSQLite)) | 73 suppressPackageStartupMessages(library(RSQLite)) |
| 71 drv <- dbDriver("SQLite") | 74 drv <- dbDriver("SQLite") |
