changeset 38:07849bf248e3 draft

planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a74e469a81b38c7142f63de510ae31d3754d1767
author fubar
date Fri, 01 Mar 2024 00:40:38 +0000
parents 7adde511daa1
children bc57164eb270
files __pycache__/jbrowse2.cpython-310.pyc autogenJB2.py jbrowse2.py jbrowse2.xml
diffstat 4 files changed, 19 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
Binary file __pycache__/jbrowse2.cpython-310.pyc has changed
--- 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
--- 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"]),
--- 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 @@
                 <param name="category" value="Default" />
                 <repeat name="data_tracks">
                     <conditional name="data_format">
-                        <param name="data_format_select" value="wiggle"/>
+                        <param name="data_format_select" value="bigwig"/>
                         <param name="annotation" value="bw/merlin.bw"/>
                     </conditional>
                 </repeat>
@@ -371,11 +376,10 @@
                     <has_text text="tool_id"></has_text>
                     <has_text text="trackFile path="></has_text>
                     <has_text text="file_ext=&quot;bigwig&quot;"></has_text>
-                    <has_text text="format=&quot;wiggle&quot;"></has_text>
+                    <has_text text="format=&quot;bigwig&quot;"></has_text>
                 </assert_contents>
             </output>
         </test>
-
         <test>
             <param name="reference_genome|genome_type_select" value="history"/>
             <param name="reference_genome|genome" value="merlin.fa"/>
@@ -710,7 +714,6 @@
                 </assert_contents>
             </output>
         </test>
-
         <!-- TODO add a synteny test -->
         <!-- TODO add a bam and a cram test -->
         <!-- TODO add an hic test -->