# HG changeset patch # User iuc # Date 1597999361 14400 # Node ID 17359b808b012164b28ad6fb5bd859f71c572a44 # Parent fd5dbf0f732e04e7febb06c78e6e7bab28364553 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 2f072c4183a0d1221fb9d81909aeeafb2dbda892" diff -r fd5dbf0f732e -r 17359b808b01 jbrowse.py --- 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() diff -r fd5dbf0f732e -r 17359b808b01 jbrowse.xml --- 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 @@ - + + + + + @@ -669,7 +671,7 @@ - + @@ -677,7 +679,7 @@ - + @@ -685,7 +687,7 @@ - + @@ -702,7 +704,7 @@ - + @@ -898,7 +900,7 @@ - + @@ -961,7 +963,7 @@ - + @@ -999,7 +1001,7 @@ - + @@ -1051,7 +1053,7 @@ - + @@ -1072,7 +1074,7 @@ - + @@ -1081,7 +1083,7 @@ - + diff -r fd5dbf0f732e -r 17359b808b01 macros.xml --- 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 @@ - 1.16.8 + 1.16.9 jbrowse @@ -15,7 +15,7 @@ \$GALAXY_JBROWSE_SHARED_DIR - galaxy1 + galaxy0