changeset 0:11033bdad2ca draft

planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/jbrowse commit f745b23c84a615bf434d717c8c0e553a012f0268
author gga
date Mon, 11 Sep 2017 05:49:16 -0400
parents
children 4065bcff8e85
files README.rst jbrowse_to_container.py jbrowse_to_container.xml macros.xml
diffstat 4 files changed, 147 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/README.rst	Mon Sep 11 05:49:16 2017 -0400
@@ -0,0 +1,9 @@
+JBrowse to container
+====================
+
+    JBrowse is a fast, embeddable genome browser built completely with
+    JavaScript and HTML5
+
+This tool is only useful when running both JBrowse and Galaxy containers as done
+in the
+`Galaxy Genome Annotation dockerized GMOD deployment example <https://github.com/galaxy-genome-annotation/dockerized-gmod-deployment>`__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jbrowse_to_container.py	Mon Sep 11 05:49:16 2017 -0400
@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+from __future__ import print_function
+
+import argparse
+import base64
+
+
+if __name__ == '__main__':
+    parser = argparse.ArgumentParser(description='Generates an iframe to access a jbrowse instance')
+    parser.add_argument('external_jbrowse_url', help='Jbrowse full URL')
+
+    args = parser.parse_args()
+
+    # This is base64 encoded to get past the toolshed's filters.
+    HTML_TPL = """
+    PGh0bWw+PGhlYWQ+PHRpdGxlPkVtYmVkZGVkIEpCcm93c2UgQWNjZXNzPC90aXRsZT48c3R5bGUg
+    dHlwZT0idGV4dC9jc3MiPmJvZHkge3ttYXJnaW46IDA7fX0gaWZyYW1lIHt7Ym9yZGVyOiAwO3dp
+    ZHRoOiAxMDAlO2hlaWdodDogMTAwJX19PC9zdHlsZT48L2hlYWQ+PGJvZHk+PGlmcmFtZSBzcmM9
+    IntiYXNlX3VybH0iPjwvaWZyYW1lPjwvYm9keT48L2h0bWw+DQo=
+    """
+    HTML_TPL = base64.b64decode(HTML_TPL.replace('\n', ''))
+
+print(HTML_TPL.format(base_url=args.external_jbrowse_url))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jbrowse_to_container.xml	Mon Sep 11 05:49:16 2017 -0400
@@ -0,0 +1,80 @@
+<?xml version="1.0"?>
+<tool id="jbrowse_to_container" name="Add organisms to JBrowse container" version="@WRAPPER_VERSION@">
+    <description>will replace any existing organism</description>
+    <macros>
+        <import>macros.xml</import>
+    </macros>
+    <expand macro="requirements"/>
+    <command detect_errors="aggressive"><![CDATA[
+
+        if [ -z "@DATA_DIR@" ]; then
+            echo '@DATA_DIR@ variable must be set to use this tool';
+            exit 1;
+        fi;
+
+        rm -rf "@DATA_DIR@/"*
+
+        &&
+
+        #for $org in $organisms:
+            #if $org.advanced.unique_id:
+                #set dataset_name = $org.advanced.unique_id
+            #else:
+                #set dataset_name = $org.jbrowse.id
+            #end if
+
+            cp -R '${org.jbrowse.extra_files_path}/data/' "@DATA_DIR@/${dataset_name}"
+
+            &&
+
+            echo -e "[general]\ndataset_id  = ${dataset_name}" >> "@DATA_DIR@/${dataset_name}/tracks.conf"
+
+            &&
+        #end for
+
+        cp $trackList "@DATA_DIR@/datasets.conf"
+
+        &&
+
+        python $__tool_directory__/jbrowse_to_container.py @JBROWSE_BASE_URL@ > $output
+      ]]></command>
+    <configfiles>
+        <configfile name="trackList">
+            <![CDATA[
+#for $org in $organisms:
+#if $org.advanced.unique_id:
+#set dataset_name = $org.advanced.unique_id
+#else:
+#set dataset_name = $org.jbrowse.id
+#end if
+[datasets.$dataset_name]
+url  = ?data=data/${dataset_name}
+name = $org.name
+#end for
+            ]]>
+        </configfile>
+    </configfiles>
+    <inputs>
+        <repeat name="organisms" title="Organism">
+            <param name="jbrowse" type="data" format="html" label="JBrowse HTML Output" />
+            <param name="name" type="text" label="Display name" optional="False" />
+            <section name="advanced" title="Advanced" expanded="False">
+                <param name="unique_id" type="text" label="Unique ID" help="will be used in HTTP links (default=auto generated id). WARNING: If set, pay attention to have different ID for each dataset." optional="True">
+                    <validator type="regex" message="Value must be a not empty string composed by alphanumeric characters and underscores">^\w+$</validator>
+                </param>
+            </section>
+        </repeat>
+    </inputs>
+    <outputs>
+        <data format="html" name="output"/>
+    </outputs>
+    <help><![CDATA[
+**What it does**
+Adds an organism to a JBrowse instance. The tool takes the output of a
+JBrowse run as that contains all of the necessary information for which
+tracks are appropriate for a given analysis.
+
+@ATTRIBUTION@
+    ]]></help>
+    <expand macro="citations"/>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/macros.xml	Mon Sep 11 05:49:16 2017 -0400
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<macros>
+    <xml name="requirements">
+        <requirements>
+            <requirement type="package" version="2.7">python</requirement>
+            <yield/>
+        </requirements>
+    </xml>
+
+    <token name="@DATA_DIR@">\$GALAXY_JBROWSE_SHARED_DIR</token>
+    <token name="@JBROWSE_BASE_URL@">\$GALAXY_JBROWSE_SHARED_URL</token>
+    <token name="@WRAPPER_VERSION@">0.5.1</token>
+
+    <xml name="stdio">
+        <stdio>
+            <exit_code range="1:"/>
+            <exit_code range=":-1"/>
+            <regex match="Error:"/>
+            <regex match="Exception:"/>
+        </stdio>
+    </xml>
+
+    <token name="@ATTRIBUTION@"><![CDATA[
+**Attribution**
+
+This Galaxy tool relies on the JBrowse, maintained by the GMOD Community. The Galaxy wrapper is developed by Eric Rasche
+]]>
+    </token>
+
+    <xml name="citations">
+        <citations>
+            <citation type="doi">10.1101/gr.094607.109</citation>
+        </citations>
+    </xml>
+</macros>