# HG changeset patch
# User fubar
# Date 1709253638 0
# Node ID 07849bf248e3d6da29016c38e8f90a554fafd805
# Parent  7adde511daa1c02604c98b8c3ab880f004faf028
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a74e469a81b38c7142f63de510ae31d3754d1767
diff -r 7adde511daa1 -r 07849bf248e3 __pycache__/jbrowse2.cpython-310.pyc
Binary file __pycache__/jbrowse2.cpython-310.pyc has changed
diff -r 7adde511daa1 -r 07849bf248e3 autogenJB2.py
--- a/autogenJB2.py	Thu Feb 29 00:51:45 2024 +0000
+++ b/autogenJB2.py	Fri Mar 01 00:40:38 2024 +0000
@@ -109,9 +109,9 @@
                             }
                         }
                 elif trext == 'bam':
-                     track_conf = {"conf": {"options": {"bam": {"bam_indices": {"bam_index": track[3]}}}}}
+                     track_conf = {"conf": {"options": {"bam": {"bam_index": track[3]}}}}
                 elif trext == 'cram':
-                     track_conf = {"conf": {"options": {"cram": {"cram_indices": {"cram_index": track[3]}}}}}
+                     track_conf = {"conf": {"options": {"cram": {"cram_index": track[3]}}}}
                 else:
                     track_conf = {}
                 track_conf["format"] = trext
diff -r 7adde511daa1 -r 07849bf248e3 jbrowse2.py
--- a/jbrowse2.py	Thu Feb 29 00:51:45 2024 +0000
+++ b/jbrowse2.py	Fri Mar 01 00:40:38 2024 +0000
@@ -22,7 +22,7 @@
 
 TODAY = datetime.datetime.now().strftime("%Y-%m-%d")
 GALAXY_INFRASTRUCTURE_URL = None
-JB2REL = "v2.10.1"
+
 # version pinned for cloning
 
 mapped_chars = {
@@ -374,9 +374,10 @@
 
 
 class JbrowseConnector(object):
-    def __init__(self, outdir, genomes):
+    def __init__(self, outdir, jbrowse2path, genomes):
         self.giURL = GALAXY_INFRASTRUCTURE_URL
         self.outdir = outdir
+        self.jbrowse2path = jbrowse2path
         os.makedirs(self.outdir, exist_ok=True)
         self.genome_paths = genomes
         self.genome_name = None
@@ -1308,13 +1309,10 @@
             json.dump(self.config_json, config_file, indent=2)
 
     def clone_jbrowse(self):
-        """Clone a JBrowse directory into a destination directory."""
-        # dest = os.path.realpath(self.outdir)
+        """Clone a JBrowse directory into a destination directory. This also works in Biocontainer testing now """
         dest = self.outdir
-        cmd = ["rm", "-rf", dest + "/*"]
-        self.subprocess_check_call(cmd)
-        cmd = ["jbrowse", "create", dest, "-t", JB2VER, "-f"]
-        self.subprocess_check_call(cmd)
+        #self.subprocess_check_call(['jbrowse', 'create', dest, '--tag', f"{JB_VER}"])
+        shutil.copytree(self.jbrowse2path, dest, dirs_exist_ok=True)
         for fn in [
             "asset-manifest.json",
             "favicon.ico",
@@ -1323,13 +1321,9 @@
             "version.txt",
             "test_data",
         ]:
-            cmd = ["rm", "-rf", os.path.join(self.outdir, fn)]
+            cmd = ["rm", "-rf", os.path.join(dest, fn)]
             self.subprocess_check_call(cmd)
-        cmd = [
-            "cp",
-            os.path.join(INSTALLED_TO, "jb2_webserver.py"),
-            self.outdir,
-        ]
+        cmd = ["cp", os.path.join(INSTALLED_TO, "jb2_webserver.py"), dest]
         self.subprocess_check_call(cmd)
 
 
@@ -1349,6 +1343,7 @@
 if __name__ == "__main__":
     parser = argparse.ArgumentParser(description="", epilog="")
     parser.add_argument("--xml", help="Track Configuration")
+    parser.add_argument("--jbrowse2path", help="Path to JBrowse2 directory in biocontainer or Conda")
     parser.add_argument("--outdir", help="Output directory", default="out")
     parser.add_argument("--version", "-V", action="version", version="%(prog)s 2.0.1")
     args = parser.parse_args()
@@ -1364,6 +1359,7 @@
         GALAXY_INFRASTRUCTURE_URL = "http://" + GALAXY_INFRASTRUCTURE_URL
     jc = JbrowseConnector(
         outdir=args.outdir,
+        jbrowse2path=args.jbrowse2path,
         genomes=[
             {
                 "path": os.path.realpath(x.attrib["path"]),
diff -r 7adde511daa1 -r 07849bf248e3 jbrowse2.xml
--- a/jbrowse2.xml	Thu Feb 29 00:51:45 2024 +0000
+++ b/jbrowse2.xml	Fri Mar 01 00:40:38 2024 +0000
@@ -14,7 +14,12 @@
 ## Copy the XML file into the directory, mostly for debugging
 ## but nice if users want to reproduce locally
 cp '$trackxml' '$output.files_path/galaxy.xml' &&
+
+export JBROWSE2_PATH=\$(dirname \$(which jbrowse))/../opt/jbrowse2  &&
+
+## Once that's done, we run the python script to handle the real work
 python '$__tool_directory__/jbrowse2.py'
+--jbrowse2path \${JBROWSE2_PATH}
 --outdir '$output.files_path'
 --xml '$trackxml' &&
 #if $jbgen.zipOut == "true":
@@ -356,7 +361,7 @@
                 
                 
                     
-                        
+                        
                         
                     
                 
@@ -371,11 +376,10 @@
                     
                     
                     
-                    
+                    
                 
             
         
-
         
             
             
@@ -710,7 +714,6 @@
                 
             
         
-