diff jbrowse2.py @ 120:af482048ca1a draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 59fe39774d791bc684811b6ce03e13ef093d074e
author fubar
date Tue, 24 Sep 2024 03:57:09 +0000
parents 794aecef8327
children
line wrap: on
line diff
--- a/jbrowse2.py	Sat Sep 21 06:13:01 2024 +0000
+++ b/jbrowse2.py	Tue Sep 24 03:57:09 2024 +0000
@@ -10,6 +10,7 @@
 import re
 import shutil
 import ssl
+import string
 import struct
 import subprocess
 import tempfile
@@ -1600,7 +1601,8 @@
     args = parser.parse_args()
     tree = ET.parse(args.xml)
     root = tree.getroot()
-
+    removeMe = string.punctuation.replace('.','').replace('/','').replace('-','')
+    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 +1619,7 @@
         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 +1657,7 @@
                     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 +1665,7 @@
                     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"]),
                             )