diff --git a/tools/jbrowse2/jbrowse2.py b/tools/jbrowse2/jbrowse2.py index b8a0024a4b..f2ae4cac13 100644 --- a/tools/jbrowse2/jbrowse2.py +++ b/tools/jbrowse2/jbrowse2.py @@ -10,6 +10,7 @@ import re import shutil import ssl +import string import struct import subprocess import tempfile @@ -20,7 +21,7 @@ logging.basicConfig(level=logging.DEBUG) log = logging.getLogger("jbrowse") -JB2VER = "v2.12.3" +JB2VER = "v2.15.4" # version pinned if cloning - but not cloning now logCommands = True # useful for seeing what's being written but not for production setups @@ -419,7 +420,7 @@ def __init__(self, outdir, jbrowse2path): self.tracksToAdd = {} self.config_json = {} self.config_json_file = os.path.join(outdir, "config.json") - self.clone_jbrowse() + self.clone_jbrowse(realclone=False) def get_cwd(self, cwd): if cwd: @@ -620,18 +621,9 @@ def text_index(self): # Index tracks args = [ "jbrowse", - "text-index", - "--target", - self.outdir, - "--assemblies", - self.genome_name, + "text-index" ] - - tracks = ",".join(self.trackIdlist) - if tracks: - args += ["--tracks", tracks] - - self.subprocess_check_call(args) + self.subprocess_check_call(args) def add_hic(self, data, trackData): """ @@ -1555,7 +1547,7 @@ def clone_jbrowse(self, realclone=False): """ dest = self.outdir - if realclone: + if (not os.path.exists(self.jbrowse2path)) or realclone: self.subprocess_check_call( ["jbrowse", "create", dest, "-f", "--tag", f"{JB2VER}"] ) @@ -1600,7 +1592,9 @@ def parse_style_conf(item): args = parser.parse_args() tree = ET.parse(args.xml) root = tree.getroot() - + removeMe = string.punctuation.replace('.', ' ').replace('/', '').replace('-', '') + # first is a space because space needs to be added here for removal from labels as paths. + nopunct = str.maketrans(dict.fromkeys(removeMe)) # This should be done ASAP GALAXY_INFRASTRUCTURE_URL = root.find("metadata/galaxyUrl").text # Sometimes this comes as `localhost` without a protocol @@ -1617,7 +1611,7 @@ def parse_style_conf(item): genomes = [ { "path": x.attrib["path"], - "label": x.attrib["label"].split(" ")[0].replace(",", ""), + "label": x.attrib["label"].split(" ")[0].translate(nopunct), "useuri": x.attrib["useuri"], "meta": metadata_from_node(x.find("metadata")), } @@ -1655,7 +1649,7 @@ def parse_style_conf(item): if x.attrib['ext'] == "bed": isBed = True track_conf["label"] = "%s_%d" % ( - x.attrib["label"].replace(" ", "_").replace(",", "_").replace("/", "_"), + x.attrib["label"].translate(nopunct), trackI, ) trackI += 1 @@ -1663,7 +1657,7 @@ def parse_style_conf(item): if is_multi_bigwig: multi_bigwig_paths.append( ( - track_conf["label"], + track_conf["label"].translate(nopunct), track_conf["useuri"], os.path.realpath(x.attrib["path"]), ) @@ -1770,4 +1764,5 @@ def parse_style_conf(item): jc.write_config() # note that this can be left in the config.json but has NO EFFECT if add_defsess_to_index is called. # jc.add_defsess_to_index(default_session_data) - # jc.text_index() not sure what broke here. + # this command line tool appears currently broken - or at least not working here. + # jc.text_index() diff --git a/tools/jbrowse2/jbrowse2.xml b/tools/jbrowse2/jbrowse2.xml index 027617fda0..308a3cf7a3 100644 --- a/tools/jbrowse2/jbrowse2.xml +++ b/tools/jbrowse2/jbrowse2.xml @@ -16,12 +16,13 @@ + python '${__tool_directory__}/jbrowse2.py' --version + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + +
\$GALAXY_JBROWSE_SHARED_DIR - 0 + 1 diff --git a/tools/jbrowse2/test-data/bw/m:e.r.l .i-n.bw b/tools/jbrowse2/test-data/bw/m:e.r.l .i-n.bw new file mode 100755 index 0000000000..ca01be4dad Binary files /dev/null and b/tools/jbrowse2/test-data/bw/m:e.r.l .i-n.bw differ