changeset 40:17359b808b01 draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 2f072c4183a0d1221fb9d81909aeeafb2dbda892"
author iuc
date Fri, 21 Aug 2020 04:42:41 -0400
parents fd5dbf0f732e
children 8774b28235bb
files jbrowse.py jbrowse.xml macros.xml
diffstat 3 files changed, 48 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/jbrowse.py	Tue Apr 28 10:01:04 2020 -0400
+++ b/jbrowse.py	Fri Aug 21 04:42:41 2020 -0400
@@ -323,14 +323,14 @@
         galaxy=GALAXY_INFRASTRUCTURE_URL,
         encoded_id=metadata['dataset_id'],
         tool_id=metadata['tool_tool_id'],
-        tool_version=metadata['tool_tool_version'],
+        # tool_version=metadata['tool_tool_version'],
     )
     return metadata
 
 
 class JbrowseConnector(object):
 
-    def __init__(self, jbrowse, outdir, genomes, standalone=False, gencode=1):
+    def __init__(self, jbrowse, outdir, genomes, standalone=None, gencode=1):
         self.cs = ColorScaling()
         self.jbrowse = jbrowse
         self.outdir = outdir
@@ -339,8 +339,10 @@
         self.gencode = gencode
         self.tracksToIndex = []
 
-        if standalone:
+        if standalone == "complete":
             self.clone_jbrowse(self.jbrowse, self.outdir)
+        elif standalone == "minimal":
+            self.clone_jbrowse(self.jbrowse, self.outdir, minimal=True)
         else:
             try:
                 os.makedirs(self.outdir)
@@ -391,6 +393,10 @@
             log.error(err)
             raise RuntimeError("Command failed with exit code %s" % (retcode))
 
+    def subprocess_check_output(self, command):
+        log.debug('cd %s && %s', self.outdir, ' '.join(command))
+        return subprocess.check_output(command, cwd=self.outdir)
+
     def _jbrowse_bin(self, command):
         return os.path.realpath(os.path.join(self.jbrowse, 'bin', command))
 
@@ -501,7 +507,7 @@
 
     def add_bigwig(self, data, trackData, wiggleOpts, **kwargs):
         dest = os.path.join('data', 'raw', trackData['label'] + '.bw')
-        cmd = ['ln', '-s', data, dest]
+        cmd = ['cp', data, dest]
         self.subprocess_check_call(cmd)
 
         url = os.path.join('raw', trackData['label'] + '.bw')
@@ -1069,23 +1075,31 @@
                 with open(os.path.join(self.outdir, 'data', 'trackList2.json'), 'w') as handle:
                     json.dump(trackListJson, handle)
 
-    def clone_jbrowse(self, jbrowse_dir, destination):
+    def clone_jbrowse(self, jbrowse_dir, destination, minimal=False):
         """Clone a JBrowse directory into a destination directory.
         """
-        # JBrowse seems to have included some bad symlinks, cp ignores bad symlinks
-        # unlike copytree
-        cmd = ['cp', '-r', os.path.join(jbrowse_dir, '.'), destination]
-        log.debug(' '.join(cmd))
-        subprocess.check_call(cmd)
+        if minimal:
+            # Should be the absolute minimum required for JBrowse to function.
+            interesting = [
+                'dist', 'img', 'index.html', 'jbrowse.conf', 'jbrowse_conf.json', 'webpack.config.js'
+            ]
+            for i in interesting:
+                cmd = ['cp', '-r', os.path.join(jbrowse_dir, i), destination]
+                self.subprocess_check_call(cmd)
+        else:
+            # JBrowse seems to have included some bad symlinks, cp ignores bad symlinks
+            # unlike copytree
+            cmd = ['cp', '-r', os.path.join(jbrowse_dir, '.'), destination]
+            self.subprocess_check_call(cmd)
+
         cmd = ['mkdir', '-p', os.path.join(destination, 'data', 'raw')]
-        log.debug(' '.join(cmd))
-        subprocess.check_call(cmd)
+        self.subprocess_check_call(cmd)
 
         # http://unix.stackexchange.com/a/38691/22785
         # JBrowse releases come with some broken symlinks
         cmd = ['find', destination, '-type', 'l', '-xtype', 'l']
-        log.debug(' '.join(cmd))
-        symlinks = subprocess.check_output(cmd)
+        symlinks = self.subprocess_check_output(cmd)
+
         for i in symlinks:
             try:
                 os.unlink(i)
@@ -1099,7 +1113,7 @@
 
     parser.add_argument('--jbrowse', help='Folder containing a jbrowse release')
     parser.add_argument('--outdir', help='Output directory', default='out')
-    parser.add_argument('--standalone', help='Standalone mode includes a copy of JBrowse', action='store_true')
+    parser.add_argument('--standalone', choices=['complete', 'minimal', 'data'], help='Standalone mode includes a copy of JBrowse')
     parser.add_argument('--version', '-V', action='version', version="%(prog)s 0.8.0")
     args = parser.parse_args()
 
--- a/jbrowse.xml	Tue Apr 28 10:01:04 2020 -0400
+++ b/jbrowse.xml	Fri Aug 21 04:42:41 2020 -0400
@@ -22,14 +22,12 @@
 python '$__tool_directory__/jbrowse.py'
 
 --jbrowse \${JBROWSE_SOURCE_DIR}
-#if str($standalone) == "Complete":
-    --standalone
-#end if
+--standalone '$standalone'
 
 --outdir $output.files_path
 $trackxml &&
 
-#if str($standalone) == "Complete":
+#if str($standalone) != "data":
     cp $output.files_path/index.html $output;
 #else:
     cp $dummyIndex $output;
@@ -372,7 +370,11 @@
         </when>
     </conditional>
 
-    <param name="standalone" type="boolean" truevalue="Complete" falsevalue="Data Directory" checked="true" label="Produce Standalone Instance" help="Produce a full, working JBrowse instance or just the data directory. Data dir mode is experimental and intended to be used with Apollo"/>
+    <param name="standalone" label="Output JBrowse" type="select">
+        <option value="complete">Complete, for viewing and further local development (JBrowse, tools, documentation, etc.)</option>
+        <option value="minimal" selected="true">Minimal for viewing (Documentation removed)</option>
+        <option value="data">Data directory only (primarily for use with Apollo, requires extra steps to serve as website)</option>
+    </param>
 
     <param name="gencode" type="select" label="Genetic Code">
       <option value="1">1. The Standard Code</option>
@@ -669,7 +671,7 @@
       <param name="reference_genome|genome_type_select" value="history"/>
       <param name="reference_genome|genome" value="merlin.fa"/>
       <param name="gencode" value="1" />
-      <param name="standalone" value="Data Directory" />
+      <param name="standalone" value="data" />
       <param name="uglyTestingHack" value="enabled" />
       <output name="output" file="gencode/test-1.xml" lines_diff="16"/>
     </test>
@@ -677,7 +679,7 @@
       <param name="reference_genome|genome_type_select" value="history"/>
       <param name="reference_genome|genome" value="merlin.fa"/>
       <param name="gencode" value="11" />
-      <param name="standalone" value="Data Directory" />
+      <param name="standalone" value="data" />
       <param name="uglyTestingHack" value="enabled" />
       <output name="output" file="gencode/test.xml" lines_diff="16"/>
     </test>
@@ -685,7 +687,7 @@
       <param name="reference_genome|genome_type_select" value="history"/>
       <param name="reference_genome|genome" value="merlin.fa"/>
       <param name="gencode" value="11" />
-      <param name="standalone" value="Data Directory" />
+      <param name="standalone" value="data" />
       <repeat name="track_groups">
         <param name="category" value="Default" />
         <repeat name="data_tracks">
@@ -702,7 +704,7 @@
       <param name="reference_genome|genome_type_select" value="history"/>
       <param name="reference_genome|genome" value="merlin.fa"/>
       <param name="gencode" value="11" />
-      <param name="standalone" value="Data Directory" />
+      <param name="standalone" value="data" />
       <repeat name="track_groups">
         <param name="category" value="Auto Coloured" />
         <repeat name="data_tracks">
@@ -898,7 +900,7 @@
         <param name="reference_genome|genome_type_select" value="history"/>
         <param name="reference_genome|genome" value="merlin.fa"/>
         <param name="gencode" value="11" />
-        <param name="standalone" value="Data Directory" />
+        <param name="standalone" value="data" />
 
         <repeat name="track_groups">
             <param name="category" value="With menu or index" />
@@ -961,7 +963,7 @@
         <param name="reference_genome|genome_type_select" value="history"/>
         <param name="reference_genome|genome" value="merlin.fa"/>
         <param name="gencode" value="11" />
-        <param name="standalone" value="Data Directory" />
+        <param name="standalone" value="data" />
 
         <repeat name="track_groups">
             <param name="category" value="With canvas config" />
@@ -999,7 +1001,7 @@
         <param name="reference_genome|genome_type_select" value="history"/>
         <param name="reference_genome|genome" value="merlin.fa"/>
         <param name="gencode" value="11" />
-        <param name="standalone" value="Data Directory" />
+        <param name="standalone" value="data" />
 
         <repeat name="track_groups">
             <param name="category" value="With custom track config" />
@@ -1051,7 +1053,7 @@
         <param name="reference_genome|genome_type_select" value="history"/>
         <param name="reference_genome|genome" value="merlin.fa"/>
         <param name="gencode" value="11" />
-        <param name="standalone" value="Data Directory" />
+        <param name="standalone" value="data" />
 
         <repeat name="track_groups">
             <param name="category" value="Auto Coloured" />
@@ -1072,7 +1074,7 @@
         <param name="reference_genome|genome_type_select" value="indexed"/>
         <param name="reference_genome|genome" value="merlin"/>
         <param name="gencode" value="1" />
-        <param name="standalone" value="Data Directory" />
+        <param name="standalone" value="data" />
         <param name="uglyTestingHack" value="enabled" />
         <output name="output" file="gencode/test-data_table.xml" lines_diff="4" />
     </test>
@@ -1081,7 +1083,7 @@
         <param name="reference_genome|genome_type_select" value="history"/>
         <param name="reference_genome|genome" value="merlin.fa"/>
         <param name="gencode" value="11" />
-        <param name="standalone" value="Data Directory" />
+        <param name="standalone" value="data" />
 
         <repeat name="track_groups">
             <param name="category" value="External endpoints" />
--- a/macros.xml	Tue Apr 28 10:01:04 2020 -0400
+++ b/macros.xml	Fri Aug 21 04:42:41 2020 -0400
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <macros>
-  <token name="@TOOL_VERSION@">1.16.8</token>
+  <token name="@TOOL_VERSION@">1.16.9</token>
   <xml name="requirements">
     <requirements>
       <requirement type="package" version="@TOOL_VERSION@">jbrowse</requirement>
@@ -15,7 +15,7 @@
     </requirements>
   </xml>
   <token name="@DATA_DIR@">\$GALAXY_JBROWSE_SHARED_DIR</token>
-  <token name="@WRAPPER_VERSION@">galaxy1</token>
+  <token name="@WRAPPER_VERSION@">galaxy0</token>
   <token name="@ATTRIBUTION@"><![CDATA[
 **Attribution**