changeset 5:efc64d8f4b72 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
author fubar
date Tue, 09 Jan 2024 05:24:48 +0000
parents 54396f0323f4
children 79f7265f90bd
files jbrowse2.py jbrowse2.xml macros.xml plants.sh tstar.sh
diffstat 5 files changed, 49 insertions(+), 52 deletions(-) [+]
line wrap: on
line diff
--- a/jbrowse2.py	Tue Jan 09 02:37:42 2024 +0000
+++ b/jbrowse2.py	Tue Jan 09 05:24:48 2024 +0000
@@ -19,7 +19,7 @@
 log = logging.getLogger("jbrowse")
 TODAY = datetime.datetime.now().strftime("%Y-%m-%d")
 GALAXY_INFRASTRUCTURE_URL = None
-JB2REL="v2.10.0"
+JB2REL = "v2.10.0"
 # version pinned for cloning
 
 mapped_chars = {
@@ -435,16 +435,18 @@
             "displayId": "%s-LinearBasicDisplay" % trackDict["trackId"],
         }
 
-        if trackDict.get("displays", None):
-            style_data["type"] = trackDict["displays"]["type"]
-            style_data["displayId"] = trackDict["displays"]["displayId"]
-        return {"displays": [style_data]}
+        if trackDict.get("displays", None):  # use first if multiple like bed
+            style_data["type"] = trackDict["displays"][0]["type"]
+            style_data["displayId"] = trackDict["displays"][0]["displayId"]
+        return {
+            "displays": [
+                style_data,
+            ]
+        }
 
     def process_genomes(self):
         assemblies = []
         for i, genome_node in enumerate(self.genome_paths):
-            if self.debug:
-                log.info("genome_node=%s" % str(genome_node))
             genome_name = genome_node["meta"]["dataset_dname"].strip()
             if len(genome_name.split()) > 1:
                 genome_name = genome_name.split()[0]
@@ -550,7 +552,6 @@
             uri: 'https://s3.amazonaws.com/jbrowse.org/genomes/GRCh38/fasta/GRCh38.fa.gz.gzi',
         Cool will not be likely to be a good fit - see discussion at https://github.com/GMOD/jbrowse-components/issues/2438
         """
-        log.info("#### trackData=%s" % trackData)
         tId = trackData["label"]
         # can be served - if public.
         # dsId = trackData["metadata"]["dataset_id"]
@@ -579,8 +580,8 @@
                 },
             ],
         }
-        # style_json = self._prepare_track_style(trackDict)
-        # trackDict["style"] = style_json
+        style_json = self._prepare_track_style(trackDict)
+        trackDict["style"] = style_json
         self.tracksToAdd.append(trackDict)
         self.trackIdlist.append(tId)
 
@@ -614,8 +615,6 @@
             dest,
         ]
         self.subprocess_check_call(cmd)
-        if True or self.debug:
-            log.info("### convertMAF.sh called as %s" % " ".join(cmd))
         # Construct samples list
         # We could get this from galaxy metadata, not sure how easily.
         ps = subprocess.Popen(["grep", "^s [^ ]*", "-o", data], stdout=subprocess.PIPE)
@@ -625,8 +624,6 @@
         soutp = outp.split("\n")
         samp = [x.split("s ")[1] for x in soutp if x.startswith("s ")]
         samples = [x.split(".")[0] for x in samp]
-        if self.debug:
-            log.info("### got samples = %s " % (samples))
         trackDict = {
             "type": "MafTrack",
             "trackId": tId,
@@ -644,9 +641,16 @@
                 },
             },
             "assemblyNames": [self.genome_name],
+            "displays": [
+                {
+                    "type": "LinearBasicDisplay",
+                    "displayId": "%s-LinearBasicDisplay" % tId,
+                },
+                {"type": "LinearArcDisplay", "displayId": "%s-LinearArcDisplay" % tId},
+            ],
         }
-        # style_json = self._prepare_track_style(trackDict)
-        # trackDict["style"] = style_json
+        style_json = self._prepare_track_style(trackDict)
+        trackDict["style"] = style_json
         self.tracksToAdd.append(trackDict)
         self.trackIdlist.append(tId)
         if self.config_json.get("plugins", None):
@@ -714,6 +718,8 @@
                 {"type": "LinearArcDisplay", "displayId": "%s-LinearArcDisplay" % tId},
             ],
         }
+        style_json = self._prepare_track_style(trackDict)
+        trackDict["style"] = style_json
         self.tracksToAdd.append(trackDict)
         self.trackIdlist.append(tId)
 
@@ -744,8 +750,8 @@
                 }
             ],
         }
-        # style_json = self._prepare_track_style(trackDict)
-        # trackDict["style"] = style_json
+        style_json = self._prepare_track_style(trackDict)
+        trackDict["style"] = style_json
         self.tracksToAdd.append(trackDict)
         self.trackIdlist.append(tId)
 
@@ -755,7 +761,6 @@
         dest = "%s/%s" % (self.outdir, fname)
         url = fname
         self.subprocess_check_call(["cp", data, dest])
-        log.info("### copied %s to %s" % (data, dest))
         bloc = {"uri": url}
         if bam_index is not None and os.path.exists(os.path.realpath(bam_index)):
             # bai most probably made by galaxy and stored in galaxy dirs, need to copy it to dest
@@ -792,8 +797,8 @@
                 },
             ],
         }
-        # style_json = self._prepare_track_style(trackDict)
-        # trackDict["style"] = style_json
+        style_json = self._prepare_track_style(trackDict)
+        trackDict["style"] = style_json
         self.tracksToAdd.append(trackDict)
         self.trackIdlist.append(tId)
 
@@ -840,8 +845,8 @@
                 },
             ],
         }
-        # style_json = self._prepare_track_style(trackDict)
-        # trackDict["style"] = style_json
+        style_json = self._prepare_track_style(trackDict)
+        trackDict["style"] = style_json
         self.tracksToAdd.append(trackDict)
         self.trackIdlist.append(tId)
 
@@ -893,8 +898,8 @@
                 {"type": "LinearArcDisplay", "displayId": "%s-LinearArcDisplay" % tId},
             ],
         }
-        # style_json = self._prepare_track_style(trackDict)
-        # trackDict["style"] = style_json
+        style_json = self._prepare_track_style(trackDict)
+        trackDict["style"] = style_json
         self.tracksToAdd.append(trackDict)
         self.trackIdlist.append(tId)
 
@@ -922,14 +927,18 @@
             },
             "displays": [
                 {
+                    "type": "LinearPileupDisplay",
+                    "displayId": "%s-LinearPileupDisplay" % tId,
+                },
+                {
                     "type": "LinearBasicDisplay",
                     "displayId": "%s-LinearBasicDisplay" % tId,
                 },
                 {"type": "LinearArcDisplay", "displayId": "%s-LinearArcDisplay" % tId},
             ],
         }
-        # style_json = self._prepare_track_style(trackDict)
-        # trackDict["style"] = style_json
+        style_json = self._prepare_track_style(trackDict)
+        trackDict["style"] = style_json
         self.tracksToAdd.append(trackDict)
         self.trackIdlist.append(tId)
 
@@ -1151,17 +1160,11 @@
 
         # We need to know the track type from the config.json generated just before
         track_types = {}
-        logging.info("### add default session has data = %s\n" % str(data))
         with open(self.config_json_file, "r") as config_file:
             config_json = json.load(config_file)
-        logging.info("### config.json read \n%s\n" % (config_json))
 
         for track_conf in self.tracksToAdd:  # config_json["tracks"]:
             track_types[track_conf["trackId"]] = track_conf["type"]
-        logging.info(
-            "### self.tracksToAdd = %s; track_types = %s"
-            % (str(self.tracksToAdd), str(track_types))
-        )
 
         for on_track in data["visibility"]["default_on"]:
             style_data = {"type": "LinearBasicDisplay", "height": 100}
@@ -1263,7 +1266,7 @@
     def clone_jbrowse(self):
         """Clone a JBrowse directory into a destination directory."""
         dest = self.outdir
-        cmd = ["jbrowse", "create", "-t",JB2REL, "-f", dest]
+        cmd = ["jbrowse", "create", "-t", JB2REL, "-f", dest]
         self.subprocess_check_call(cmd)
         for fn in [
             "asset-manifest.json",
@@ -1437,12 +1440,7 @@
             pass
         track_conf["conf"] = etree_to_dict(track.find("options"))
         jc.add_general_configuration(general_data)
-        print("## processed", str(track_conf), "trackIdlist", jc.trackIdlist)
     x = open(args.xml, "r").read()
-    log.info(
-        "###done processing xml=%s; trackIdlist=%s, config=%s"
-        % (x, jc.trackIdlist, str(jc.config_json))
-    )
     jc.config_json["tracks"] = jc.tracksToAdd
     if jc.usejson:
         jc.write_config()
--- a/jbrowse2.xml	Tue Jan 09 02:37:42 2024 +0000
+++ b/jbrowse2.xml	Tue Jan 09 05:24:48 2024 +0000
@@ -997,8 +997,6 @@
 can be used to let your users understand relationships between large
 groups of tracks.
 
-.. image:: sections.png
-
 Annotation Tracks
 -----------------
 
@@ -1011,6 +1009,11 @@
 These are standard feature tracks. They usually highlight genes,
 mRNAs and other features of interest along a genomic region.
 
+When these contain tens of millions of features, such as repeat regions from a VGP assembly, displaying one at a time leads
+to extremely slow loading times when a large region is in view, unless the "LinearPileupDisplay" display option is
+selected for that track in the styling options section. The default is LinearBasicDisplay, which shows all details and works
+well for relatively sparse bed files.
+
 BAM Pileups
 ~~~~~~~~~~~
 
@@ -1021,8 +1024,6 @@
 BlastXML
 ~~~~~~~~
 
-.. image:: blast.png
-
 JiG now supports both blastn and blastp datasets. JiG internally uses a
 blastXML to gapped GFF3 tool to convert your blastxml datasets into a
 format amenable to visualization in JBrowse. This tool is also
@@ -1044,12 +1045,6 @@
 **Protein blast search** option merely informs underlying tools that
 they should adjust feature locations by 3x.
 
-Bigwig XY
-~~~~~~~~~
-
-.. image:: bigwig.png
-
-
 
 VCFs/SNPs
 ~~~~~~~~~
--- a/macros.xml	Tue Jan 09 02:37:42 2024 +0000
+++ b/macros.xml	Tue Jan 09 05:24:48 2024 +0000
@@ -280,8 +280,8 @@
     </xml>
 
     <xml name="track_styling_linear">
-        <param label="Show labels" name="show_labels" type="boolean" checked="true" truevalue="true" falsevalue="false" />
-        <param label="Show descriptions" name="show_descriptions" type="boolean" checked="true" truevalue="true" falsevalue="false" />
+        <param label="Show labels" name="show_labels" type="boolean" checked="false" truevalue="true" falsevalue="false" />
+        <param label="Show descriptions" name="show_descriptions" type="boolean" checked="false" truevalue="true" falsevalue="false" />
         <param name="display_mode" type="select" label="Display mode">
             <option value="normal" selected="true">normal</option>
             <option value="compact">compact</option>
@@ -296,8 +296,12 @@
         <conditional name="track_style">
             <param name="display" type="select" label="Display style" help="How the track will be displayed by default">
                 <option value="LinearBasicDisplay" selected="true">LinearBasicDisplay</option>
+                <option value="LinearPileupDisplay">LinearPileupDisplay - good for dense tracks at scale</option>
                 <option value="LinearArcDisplay">LinearArcDisplay</option>
             </param>
+            <when value="LinearPileupDisplay">
+                <expand macro="track_styling_linear"/>
+            </when>
             <when value="LinearBasicDisplay">
                 <expand macro="track_styling_linear"/>
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plants.sh	Tue Jan 09 05:24:48 2024 +0000
@@ -0,0 +1,1 @@
+planemo shed_update --shed_target toolshed --owner fubar --name jbrowse2 --shed_key 8d01f2f35d48a0405f72d6d37aedde60 jbrowse2
--- a/tstar.sh	Tue Jan 09 02:37:42 2024 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-tar -cvz --exclude *.gz --exclude *.png jbrowse2/* > jb2.tgz