changeset 0:3c2c36beddb1 draft default tip

planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/bumbershoot/data_manager_customProDB commit 141369f97aa2804d2bbfd9ed620ea2a5574994c2-dirty
author galaxyp
date Fri, 15 Jan 2016 15:52:56 -0500
parents
children
files data_manager/customProDB_annotation.R data_manager/customProDB_annotation.xml data_manager_conf.xml
diffstat 3 files changed, 122 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/data_manager/customProDB_annotation.R	Fri Jan 15 15:52:56 2016 -0500
@@ -0,0 +1,69 @@
+#!/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({
+
+library(methods) # Because Rscript does not always do this
+
+options('useFancyQuotes' = FALSE)
+
+suppressPackageStartupMessages(library("optparse"))
+suppressPackageStartupMessages(library("RGalaxy"))
+
+
+option_list <- list()
+option_list$dbkey <- make_option('--dbkey', type='character')
+option_list$outputFile <- make_option('--outputFile', type='character')
+
+opt <- parse_args(OptionParser(option_list=option_list))
+
+
+customProDB_annotation <- function(
+	dbkey = GalaxyCharacterParam(required=TRUE), 
+	outputFile = GalaxyOutput("output","json"))
+{
+    if (file.exists(outputFile))
+    {
+        if (file.info(outputFile)$size > 0) { gstop("output file already exists") }
+        else
+        {
+            tryCatch(
+            {
+                file.remove(outputFile)
+            }, error=function(err)
+            {
+                gstop("failed to remove empty existing file")
+            })
+        }
+    }
+
+    gstop("what you talkin bout willis?!")
+}
+
+
+params <- list()
+for(param in names(opt))
+{
+    if (!param == "help")
+        params[param] <- opt[param]
+}
+
+setClass("GalaxyRemoteError", contains="character")
+wrappedFunction <- function(f)
+{
+    tryCatch(do.call(f, params),
+        error=function(e) new("GalaxyRemoteError", conditionMessage(e)))
+}
+
+
+suppressPackageStartupMessages(library(RGalaxy))
+do.call(customProDB_annotation, params)
+
+## end warning handler
+}, warning = function(w) {
+    cat(paste("Warning:", conditionMessage(w), "\n"))
+    invokeRestart("muffleWarning")
+})
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/data_manager/customProDB_annotation.xml	Fri Jan 15 15:52:56 2016 -0500
@@ -0,0 +1,31 @@
+<tool id="custom_pro_db_annotation_data_manager" name="CustomProDB Annotation" tool_type="manage_data" version="0.0.1">
+    <description>builder</description>
+    <command interpreter="Rscript --vanilla">customProDB_annotation.R
+      --outputFile "${out_file}"
+      --dbkey "${dbkey}"
+      2&gt;&amp;1
+    </command>
+    <stdio>
+        <exit_code range=":-1" />
+        <exit_code range="1:" />
+    </stdio>
+    <inputs>
+        <!--<param name="all_fasta_source" type="select" label="Source FASTA Sequence">
+            <options from_data_table="all_fasta"/>
+        </param>
+        <param type="text" name="sequence_name" value="" label="Name of sequence" />
+        <param type="text" name="sequence_id" value="" label="ID for sequence" />-->
+        <param type="text" name="dbkey" value="" label="UCSC dbKey for reference genome" />
+    </inputs>
+    <outputs>
+        <data name="out_file" format="data_manager_json"/>
+    </outputs>
+
+    <help>
+
+.. class:: infomark
+
+**Notice:** If you leave name, description, or id blank, it will be generated automatically. 
+
+    </help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/data_manager_conf.xml	Fri Jan 15 15:52:56 2016 -0500
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<data_managers>
+
+    <data_manager tool_file="data_manager/customProDB_annotation.xml" id="customProDB_annotation_builder" version="0.0.1">
+        <data_table name="customProDB">
+            <output>
+                <column name="value" />
+                <column name="dbkey" />
+                <column name="name" />
+                <column name="path" output_ref="out_file" >
+                    <move type="directory" relativize_symlinks="True">
+                        <!-- <source>${path}</source>--> <!-- out_file.extra_files_path is used as base by default --> <!-- if no source, eg for type=directory, then refers to base -->
+                        <target base="${GALAXY_DATA_MANAGER_DATA_PATH}">${dbkey}/customProDB/${value}</target>
+                    </move>
+                    <value_translation>${GALAXY_DATA_MANAGER_DATA_PATH}/${dbkey}/customProDB/${value}/${path}</value_translation>
+                    <value_translation type="function">abspath</value_translation>
+                </column>
+            </output>
+        </data_table>
+    </data_manager>
+
+</data_managers>