changeset 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 e1bb35f6ca28
files PSM2SAM.R PSM2SAM.xml
diffstat 2 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/PSM2SAM.R	Fri Oct 02 14:14:15 2015 -0400
+++ b/PSM2SAM.R	Thu Nov 12 18:11:28 2015 -0500
@@ -1,5 +1,8 @@
 #!/usr/bin/env Rscript
 
+initial.options <- commandArgs(trailingOnly = FALSE)
+script_parent_dir <- dirname(sub("--file=", "", initial.options[grep("--file=", initial.options)]))
+
 ## begin warning handler
 withCallingHandlers({
 
@@ -36,10 +39,10 @@
 	XScolumn = GalaxyCharacterParam(required=TRUE), 
 	OutputFile = GalaxyOutput("proSAM","sam"))
 {
-    if (length(exon_anno_file) == 0) { exon_anno_file = "/export/src/tools-galaxyp-chambm/tools/bumbershoot/psm_to_sam/tool-data/exon_anno.RData" }
-    if (length(proteinseq_file) == 0) { proteinseq_file = "/export/src/tools-galaxyp-chambm/tools/bumbershoot/psm_to_sam/tool-data/proseq.RData" }
-    if (length(procodingseq_file) == 0) { procodingseq_file = "/export/src/tools-galaxyp-chambm/tools/bumbershoot/psm_to_sam/tool-data/procodingseq.RData" }
-    if (length(header_file) == 0) { header_file = "/export/src/tools-galaxyp-chambm/tools/bumbershoot/psm_to_sam/tool-data/header_refseq_hg19.txt" }
+    if (length(exon_anno_file) == 0) { exon_anno_file = paste(script_parent_dir, "tool-data/exon_anno.RData", sep="/") }
+    if (length(proteinseq_file) == 0) { proteinseq_file = paste(script_parent_dir, "tool-data/proseq.RData", sep="/") }
+    if (length(procodingseq_file) == 0) { procodingseq_file = paste(script_parent_dir, "tool-data/procodingseq.RData", sep="/") }
+    if (length(header_file) == 0) { header_file = paste(script_parent_dir, "tool-data/header_refseq_hg19.txt", sep="/") }
 
     if (!file.exists(header_file)) { gstop("failed to read header file") }
     if (file.exists(OutputFile))
@@ -63,7 +66,7 @@
     options(stringsAsFactors=FALSE)
 
     scoreName = XScolumn
-    columnName = gsub(":", "_", scoreName)
+    columnName = gsub("[^A-Z0-9]", "_", scoreName)
     
     passedPSM <- tryCatch({
         #read.delim(passedPSM_file, row.names=1)
--- a/PSM2SAM.xml	Fri Oct 02 14:14:15 2015 -0400
+++ b/PSM2SAM.xml	Thu Nov 12 18:11:28 2015 -0500
@@ -1,5 +1,8 @@
 <tool id="PSMtoSAM" name="PSM to SAM" version="1.3.2">
   <description>Generate SAM files from PSMs.</description>
+  <stdio>
+    <exit_code range="1:" level="fatal" description="Job Failed" />
+  </stdio>
   <command interpreter="Rscript --vanilla">PSM2SAM.R
        #if str($input).strip() != "":
           --passedPSM="$input"