changeset 112:56f9a6e0fe80 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 566509061b742b73c8dd1a1db6813fbf6a7a3792
author bgruening
date Thu, 04 Jul 2024 08:40:21 +0000
parents 0a532764dcfa
children 878c27dfea9d
files __pycache__/jbrowse2.cpython-312.pyc jbrowse2.py jbrowse2.xml macros.xml
diffstat 4 files changed, 39 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
Binary file __pycache__/jbrowse2.cpython-312.pyc has changed
--- a/jbrowse2.py	Tue Jul 02 05:08:17 2024 +0000
+++ b/jbrowse2.py	Thu Jul 04 08:40:21 2024 +0000
@@ -707,7 +707,7 @@
         }
         categ = trackData["category"]
         fname = tId
-        dest = "%s/%s" % (self.outdir, fname)
+        dest = os.path.join(self.outdir, fname)
         gname = trackData["assemblyNames"]
 
         cmd = [
@@ -1074,7 +1074,7 @@
         self.trackIdlist.append(tId)
 
     def add_bed(self, data, ext, trackData):
-        bedPlugin = {"name": "BedScorePlugin", "umdLoc": { "uri": "bedscoreplugin.js" } }
+        bedPlugin = {"name": "BedScorePlugin", "umdLoc": {"uri": "bedscoreplugin.js"}}
         tId = trackData["label"]
         categ = trackData["category"]
         useuri = trackData["useuri"].lower() == "yes"
@@ -1084,16 +1084,16 @@
             url = tId + ".gz"
             dest = os.path.join(self.outdir, url)
             self._sort_bed(data, dest)
-        if True or trackData.get("usebedscore",None):
+        if True or trackData.get("usebedscore", None):
             bedgzlocation = {
-                    "uri": url,
-                    "columnNames": ["chr","start","end","name","score"],
-                    "scoreColumn": "score",
-                }
+                "uri": url,
+                "columnNames": ["chr", "start", "end", "name", "score"],
+                "scoreColumn": "score",
+            }
         else:
             bedgzlocation = {
-                    "uri": url,
-                }
+                "uri": url,
+            }
         trackDict = {
             "type": "FeatureTrack",
             "trackId": tId,
@@ -1118,7 +1118,7 @@
                     "renderer": {
                         "type": "SvgFeatureRenderer",
                         "color1": "jexl:customColor(feature)",
-                        },
+                    },
                 },
                 {
                     "type": "LinearPileupDisplay",
@@ -1171,7 +1171,7 @@
             if gname not in self.genome_names:
                 # ignore if already there - eg for duplicates among pafs.
                 asstrack, first_contig = self.make_assembly(gpath, gname, useuri)
-                self.genome_names.append(copy.copy(gname))
+                self.genome_names.append(gname)
                 self.tracksToAdd[gname] = []
                 self.assemblies.append(copy.copy(asstrack))
                 self.ass_first_contigs.append(copy.copy(first_contig))
@@ -1225,7 +1225,7 @@
         category = track["category"].replace("__pd__date__pd__", TODAY)
         tt1 = ",/ :;\\"
         tt2 = "______"
-        labttab = str.maketrans(tt1,tt2)
+        labttab = str.maketrans(tt1, tt2)
         for trackIndex, (
             dataset_path,
             dataset_ext,
@@ -1335,7 +1335,6 @@
             else:
                 logging.warning("Do not know how to handle %s", dataset_ext)
             # Return non-human label for use in other fields
-            logging.debug("### processanno ext=%s trackstoadd = %s" % (dataset_ext, self.tracksToAdd))
             yield outputTrackConfig["label"]
 
     def add_default_session(self, default_data):
@@ -1344,8 +1343,8 @@
         .add_default_view() and other configuration code adapted from
          https://github.com/abretaud/tools-iuc/blob/jbrowse2/tools/jbrowse2/jbrowse2.py
         """
-        # TODO using the default session for now, but check out session specs in the future https://github.com/GMOD/jbrowse-components/issues/2708
-        bpPerPx = self.bpPerPx # Browser window width is unknown and default session cannot be used to figure it out in JB2 code so could be 200-2000+ pixels.
+        #  TODO using the default session for now, but check out session specs in the future https://github.com/GMOD/jbrowse-components/issues/2708
+        bpPerPx = self.bpPerPx  # Browser window width is unknown and default session cannot be used to figure it out in JB2 code so could be 200-2000+ pixels.
         track_types = {}
         with open(self.config_json_file, "r") as config_file:
             config_json = json.load(config_file)
@@ -1374,7 +1373,7 @@
                             "style data for %s = %s"
                             % (tId, style_data)
                         )
-                    if style_data.get('type',None) == None:
+                    if style_data.get('type', None) is None:
                         style_data["type"] = "LinearBasicDisplay"
                     if "displays" in track_conf:
                         disp = track_conf["displays"][0]["type"]
@@ -1396,20 +1395,20 @@
                     )
             first = [x for x in self.ass_first_contigs if x[0] == gnome]
             drdict = {
-                    "reversed": False,
-                    "assemblyName": gnome,
-                }
+                "reversed": False,
+                "assemblyName": gnome,
+            }
             if len(first) > 0:
                 [gnome, refName, end] = first[0]
                 drdict["refName"] = refName
                 drdict["start"] = 0
                 end = int(end)
-                drdict["end"] = end        
+                drdict["end"] = end
             else:
                 ddl = default_data.get("defaultLocation", None)
                 if ddl:
                     loc_match = re.search(r"^([^:]+):([\d,]*)\.*([\d,]*)$", ddl)
-                    # allow commas like 100,000 but ignore as integer 
+                    # allow commas like 100,000 but ignore as integer
                     if loc_match:
                         refName = loc_match.group(1)
                         drdict["refName"] = refName
@@ -1425,7 +1424,7 @@
             view_json = {
                 "type": "LinearGenomeView",
                 "offsetPx": 0,
-                "bpPerPx" : bpPerPx,
+                "bpPerPx": bpPerPx,
                 "minimized": False,
                 "tracks": tracks_data
             }
@@ -1656,9 +1655,9 @@
                 for x in trackfiles:
                     isBed = False
                     if x.attrib['ext'] == "bed":
-                        isBed = True                   
+                        isBed = True
                     track_conf["label"] = "%s_%d" % (
-                        x.attrib["label"].replace(" ", "_").replace(",", "_").replace("/","_"),
+                        x.attrib["label"].replace(" ", "_").replace(",", "_").replace("/", "_"),
                         trackI,
                     )
                     trackI += 1
--- a/jbrowse2.xml	Tue Jul 02 05:08:17 2024 +0000
+++ b/jbrowse2.xml	Thu Jul 04 08:40:21 2024 +0000
@@ -8,7 +8,6 @@
         <xref type="bio.tools">jbrowse2</xref>
     </xrefs>
     <expand macro="requirements"/>
-    <expand macro="creators"/>
     <required_files>
         <include path="autogenJB2.py"/>
         <include path="blastxml_to_gapped_gff3.py"/>
@@ -350,8 +349,7 @@
                     <param name="uri" type="text" label="URI pointing to tabix compressed fasta - must always be on-line" 
                         help="Warning: Requires an internet connection to view. If this URI is not available for any reason, the track will show an error. Saves disk storage">
                     </param>
-                    <param name="refname" type="text" label="Reference dbkey for tracks with this genome, such as hg38 or SacCer4">
-                    </param>
+                    <param name="refname" type="text" label="Reference dbkey for tracks with this genome, such as hg38 or SacCer4"/>
                 </when>
             </conditional>
             <repeat name="track_groups" title="Track Group">
@@ -1152,7 +1150,7 @@
 
 Browser tracks need a coordinate system, based on the reference genome, so that must be chosen before adding groups of tracks.
 
-At present, 10 Galaxy datatypes that can be turned into a track for display - in all cases, the selected reference genome must have been 
+Many Galaxy datatypes can be turned into a track for display - in all cases, the selected reference genome must have been 
 used to generate the data:
 
     bam
@@ -1198,6 +1196,17 @@
 Annotation Tracks
 -----------------
 
+
+BED
+~~~
+
+Bed feature annotation usually requires clicking on the feature. 
+
+Bed files created by the *Bigwig extremes to bed features* tool have the score in column 5
+set to *1* for regions above the quantile and *-1* for regions below. It is possible to set an advanced option for each bed track, to use the bed score in column 5 
+for the feature colour, giving red and blue using a JBrowse2 plugin, so they are easy to distinguish in a combined track.
+
+
 MAF
 ~~~
 
--- a/macros.xml	Tue Jul 02 05:08:17 2024 +0000
+++ b/macros.xml	Thu Jul 04 08:40:21 2024 +0000
@@ -108,7 +108,7 @@
             <param name="zipOut" type="boolean" truevalue="true" falsevalue="false" checked="false" label="Create a zip archive for downloading rather than viewing" help="Default is to make an interactive browser appear when the 'eye' icon is activated"/>
             <param name="defaultLocation" type="text" value="" label="Subset to display to new users" help="Initial subset to be shown for users who have never visited the browser before. Example: 'ctgA:1234..5678"/>
             <param name="session_name" type="text" value="New JBrowse2 session" label="Session name" help="Displayed at the top of the window"/>
-            <param name="bpPerPx" type="integer" value="50" label="Base pairs per display pixel for default view" help="Make the default window show more or less BP of sequence. For some reason not automatable in JB2, sorry"/>
+            <param name="bpPerPx" type="integer" min="1" value="50" label="Base pairs per display pixel for default view" help="Make the default window show more or less BP of sequence. For some reason not automatable in JB2, sorry"/>
             <param name="enableAnalytics" type="boolean" truevalue="true" falsevalue="false" checked="false" label="Enable analytics" help="Will send usage data to Google Analytics, see https://github.com/GMOD/jbrowse-components/issues/1166"/>
             <param name="primary_color" type="color" value="#0D233F" label="Primary color">
                 <sanitizer>
@@ -240,7 +240,8 @@
                 <option value="LinearPileupDisplay">LinearPileupDisplay - good for dense tracks at scale</option>
                 <option value="LinearArcDisplay">LinearArcDisplay</option>
             </param>
-            <param name="usebedscore" type="boolean" truevalue="true" falsevalue="false" checked="true" label="Use column 5 as a score for the display if bed format"/>            
+            <param name="usebedscore" type="boolean" truevalue="true" falsevalue="false" checked="false" label="Use column 5 as a score for the display if bed format"
+            help="The *Bigwig extremes to bed features* tool generates bed files with scores 1 or -1. This option renders them red and blue"/>            
         </section>
     </xml>
     <xml name="track_styling_feature">