Previous changeset 107:a074cd6b5905 (2024-06-23) Next changeset 109:27e9ddaaf325 (2024-06-29) |
Commit message:
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 9de1453a009c254ab11b16ae8a56cb5c22b131bf |
modified:
__pycache__/jbrowse2.cpython-312.pyc jbrowse2.py jbrowse2.xml macros.xml |
added:
bedscoreplugin.js configbedscore.sample |
b |
diff -r a074cd6b5905 -r 5d1259b88c27 __pycache__/jbrowse2.cpython-312.pyc |
b |
Binary file __pycache__/jbrowse2.cpython-312.pyc has changed |
b |
diff -r a074cd6b5905 -r 5d1259b88c27 bedscoreplugin.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bedscoreplugin.js Sat Jun 29 06:10:22 2024 +0000 |
b |
@@ -0,0 +1,26 @@ +// colour bed regions according to score - must have columns and score as part of the adapter setup +;(function () { + class Plugin { + name = 'BedScorePlugin'; + version = '1.0'; + + install(pluginManager) { + pluginManager.jexl.addFunction('customColor', feature => { + if (Number(feature.get('score')) > 0) { + return 'red'; + } else { + return 'blue'; + } + }) + } + + configure(pluginManager) {} + } + + // the plugin will be included in both the main thread and web worker, so + // install plugin to either window or self (webworker global scope) + ;(typeof self !== 'undefined' ? self : window).JBrowsePluginBedScorePlugin = + { + default: Plugin, + } +})() |
b |
diff -r a074cd6b5905 -r 5d1259b88c27 configbedscore.sample --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/configbedscore.sample Sat Jun 29 06:10:22 2024 +0000 |
[ |
@@ -0,0 +1,183 @@ +{ + "configuration": { + "rpc": { + "defaultDriver": "WebWorkerRpcDriver", + "drivers": { + "MainThreadRpcDriver": {}, + "WebWorkerRpcDriver": {} + } + }, + "logoPath": { + "locationType": "UriLocation", + "uri": "" + } + }, + "plugins": [ {"name": "BedScorePlugin", "umdLoc": { "uri": "bedscoreplugin.js" } } ], + "assemblies": [ + { + "name": "Merlin", + "sequence": { + "type": "ReferenceSequenceTrack", + "trackId": "Merlin-ReferenceSequenceTrack", + "adapter": { + "type": "BgzipFastaAdapter", + "fastaLocation": { + "locationType": "UriLocation", + "uri": "Merlin.fa.gz" + }, + "faiLocation": { + "locationType": "UriLocation", + "uri": "Merlin.fa.gz.fai" + }, + "metadataLocation": { + "locationType": "UriLocation", + "uri": "/path/to/fa.metadata.yaml" + }, + "gziLocation": { + "locationType": "UriLocation", + "uri": "Merlin.fa.gz.gzi" + } + }, + "displays": [ + { + "type": "LinearReferenceSequenceDisplay", + "displayId": "Merlin-ReferenceSequenceTrack-LinearReferenceSequenceDisplay" + }, + { + "type": "LinearGCContentDisplay", + "displayId": "Merlin-ReferenceSequenceTrack-LinearGCContentDisplay" + } + ] + } + } + ], + "tracks": [ + { + "type": "FeatureTrack", + "trackId": "test-6.bed_2.bed", + "name": "test-6.bed_2.bed", + "assemblyNames": [ + "Merlin" + ], + "adapter": { + "type": "BedTabixAdapter", + "bedGzLocation": { + "locationType": "UriLocation", + "uri": "test-6.bed_2.bed.gz" + }, + "index": { + "location": { + "locationType": "UriLocation", + "uri": "test-6.bed_2.bed.gz.tbi" + } + }, + "columnNames": [ + "chr", + "start", + "end", + "name", + "score" + ], + "scoreColumn": "score" + }, + "displays": [ + { + "type": "LinearBasicDisplay", + "displayId": "test-6.bed_2.bed-LinearBasicDisplay", + "renderer": { + "type": "SvgFeatureRenderer", + "color1": "jexl:customColor(feature)" + } + }, + { + "type": "LinearArcDisplay", + "displayId": "test-6.bed_2.bed-LinearArcDisplay" + } + ] + } + ], + "internetAccounts": [], + "aggregateTextSearchAdapters": [], + "connections": [], + "defaultSession": { + "drawerPosition": "right", + "drawerWidth": 384, + "widgets": { + "GridBookmark": { + "id": "GridBookmark", + "type": "GridBookmarkWidget" + }, + "hierarchicalTrackSelector": { + "id": "hierarchicalTrackSelector", + "type": "HierarchicalTrackSelectorWidget", + "initialized": true, + "collapsed": {}, + "view": "hzDuu9vlddMGFqOsaKwGq", + "faceted": { + "filterText": "", + "showSparse": false, + "showFilters": true, + "showOptions": false, + "panelWidth": 400 + } + } + }, + "activeWidgets": { + "hierarchicalTrackSelector": "hierarchicalTrackSelector" + }, + "minimized": false, + "id": "E6V-suQtYj1PSAnmq6-jz", + "name": "New session 6/29/2024, 2:40:30 PM", + "margin": 0, + "views": [ + { + "id": "hzDuu9vlddMGFqOsaKwGq", + "minimized": false, + "type": "LinearGenomeView", + "offsetPx": 0, + "bpPerPx": 88.97425334706489, + "displayedRegions": [ + { + "refName": "Merlin", + "start": 0, + "end": 172788, + "reversed": false, + "assemblyName": "Merlin" + } + ], + "tracks": [ + { + "id": "sZaD_oFrn0S3MqLdbNEZI", + "type": "FeatureTrack", + "configuration": "test-6.bed_2.bed", + "minimized": false, + "displays": [ + { + "id": "JmJklY1ylJY0_SB-IDkNm", + "type": "LinearBasicDisplay", + "configuration": "test-6.bed_2.bed-LinearBasicDisplay" + } + ] + } + ], + "hideHeader": false, + "hideHeaderOverview": false, + "hideNoTracksActive": false, + "trackSelectorType": "hierarchical", + "showCenterLine": false, + "showCytobandsSetting": true, + "trackLabels": "", + "showGridlines": true, + "showBookmarkHighlights": true, + "showBookmarkLabels": true + } + ], + "sessionTracks": [], + "sessionAssemblies": [], + "temporaryAssemblies": [], + "connectionInstances": [], + "sessionConnections": [], + "focusedViewId": "hzDuu9vlddMGFqOsaKwGq", + "sessionPlugins": [] + } +} |
b |
diff -r a074cd6b5905 -r 5d1259b88c27 jbrowse2.py --- a/jbrowse2.py Sun Jun 23 06:59:56 2024 +0000 +++ b/jbrowse2.py Sat Jun 29 06:10:22 2024 +0000 |
[ |
@@ -4,7 +4,6 @@ import binascii import copy import datetime -# import hashlib import json import logging import os @@ -21,7 +20,7 @@ logging.basicConfig(level=logging.DEBUG) log = logging.getLogger("jbrowse") -JB2VER = "v2.11.1" +JB2VER = "v2.12.3" # version pinned if cloning - but not cloning now logCommands = True # useful for seeing what's being written but not for production setups @@ -757,7 +756,7 @@ self.tracksToAdd[gname].append(copy.copy(trackDict)) self.trackIdlist.append(copy.copy(tId)) if self.config_json.get("plugins", None): - self.config_json["plugins"].append(mafPlugin[0]) + self.config_json["plugins"].append(mafPlugin["plugins"][0]) else: self.config_json.update(mafPlugin) @@ -1068,6 +1067,7 @@ self.trackIdlist.append(copy.copy(tId)) def add_bed(self, data, ext, trackData): + bedPlugin = {"name": "BedScorePlugin", "umdLoc": { "uri": "bedscoreplugin.js" } } tId = trackData["label"] categ = trackData["category"] useuri = trackData["useuri"].lower() == "yes" @@ -1077,6 +1077,16 @@ url = tId + ".gz" dest = os.path.join(self.outdir, url) self._sort_bed(data, dest) + if True or trackData.get("usebedscore",None): + bedgzlocation = { + "uri": url, + "columnNames": ["chr","start","end","name","score"], + "scoreColumn": "score", + } + else: + bedgzlocation = { + "uri": url, + } trackDict = { "type": "FeatureTrack", "trackId": tId, @@ -1087,19 +1097,21 @@ categ, ], "type": "BedTabixAdapter", - "bedGzLocation": { - "uri": url, - }, + "bedGzLocation": bedgzlocation, "index": { "location": { "uri": url + ".tbi", - } + }, }, }, "displays": [ { "type": "LinearBasicDisplay", "displayId": "%s-LinearBasicDisplay" % tId, + "renderer": { + "type": "SvgFeatureRenderer", + "color1": "jexl:customColor(feature)", + }, }, { "type": "LinearPileupDisplay", @@ -1113,6 +1125,10 @@ } style_json = self._prepare_track_style(trackDict) trackDict["style"] = style_json + if self.config_json.get("plugins", None): + self.config_json["plugins"].append(bedPlugin) + else: + self.config_json["plugins"] = [bedPlugin,] self.tracksToAdd[trackData["assemblyNames"]].append(copy.copy(trackDict)) self.trackIdlist.append(copy.copy(tId)) @@ -1340,23 +1356,10 @@ tId = track_conf["trackId"] if tId in default_data[gnome]["visibility"]["default_on"]: track_types[tId] = track_conf["type"] - style_data = default_data[gnome]["style"].get(tId, {}) - if not style_data: - logging.debug( - "No style data for %s in available default data %s" - % (tId, default_data) - ) - else: - logging.debug( - "style data for %s = %s" - % (tId, style_data) - ) - - if style_data.get('type',None) == None: - style_data["type"] = "LinearBasicDisplay" + display = {"type": "linearBasicDisplay"} if "displays" in track_conf: - disp = track_conf["displays"][0]["type"] - style_data["type"] = disp + display["type"] = track_conf["displays"][0]["type"] + display["configuration"] = track_conf["displays"][0]["displayId"] if track_conf.get("style_labels", None): # TODO fix this: it should probably go in a renderer block (SvgFeatureRenderer) but still does not work # TODO move this to per track displays? @@ -1365,7 +1368,7 @@ { "type": track_types[tId], "configuration": tId, - "displays": [style_data], + "displays": [display], } ) first = [x for x in self.ass_first_contigs if x[0] == gnome] @@ -1554,7 +1557,8 @@ os.remove(path) except OSError as e: log.error("Error: %s - %s." % (e.filename, e.strerror)) - shutil.copyfile(os.path.join(INSTALLED_TO, "jb2_webserver.py"), os.path.join(dest, "jb2_webserver.py")) + for neededfile in ["jb2_webserver.py", "bedscoreplugin.js"]: + shutil.copyfile(os.path.join(INSTALLED_TO, neededfile), os.path.join(dest, neededfile)) def parse_style_conf(item): @@ -1627,6 +1631,9 @@ trackfiles = track.findall("files/trackFile") if trackfiles: for x in trackfiles: + isBed = False + if x.attrib['ext'] == "bed": + isBed = True track_conf["label"] = "%s_%d" % ( x.attrib["label"].replace(" ", "_").replace(",", "_").replace("/","_"), trackI, @@ -1675,7 +1682,6 @@ {}, # No metadata for multiple bigwig ) ) - track_conf["category"] = track.attrib["cat"] track_conf["format"] = track.attrib["format"] track_conf["conf"] = etree_to_dict(track.find("options")) @@ -1686,22 +1692,6 @@ if not vis: vis = "default_off" default_session_data[primaryGenome]["visibility"][vis].append(key) - trakdat = jc.tracksToAdd[primaryGenome] - stile = {} - for trak in trakdat: - if trak["trackId"] == key: - stile = trak.get("style", {}) - if track.find("options/style"): - for item in track.find("options/style"): - if item.text: - stile[item.tag] = parse_style_conf(item) - logging.debug("stile=%s" % stile) - default_session_data[primaryGenome]["style"][key] = stile - if track.find("options/style_labels"): - default_session_data[primaryGenome]["style_labels"][key] = { - item.tag: parse_style_conf(item) - for item in track.find("options/style_labels") - } default_session_data[primaryGenome]["tracks"].append(key) default_session_data["defaultLocation"] = root.find( "metadata/general/defaultLocation" |
b |
diff -r a074cd6b5905 -r 5d1259b88c27 jbrowse2.xml --- a/jbrowse2.xml Sun Jun 23 06:59:56 2024 +0000 +++ b/jbrowse2.xml Sat Jun 29 06:10:22 2024 +0000 |
b |
@@ -304,6 +304,7 @@ </cool> #else if str($track.data_format.data_format_select) == "bed": <bed> + <usebedscore>${track.data_format.jbstyle.usebedscore}</usebedscore> </bed> #else if str($track.data_format.data_format_select) == "sparql": <label>${track.data_format.label}</label> |
b |
diff -r a074cd6b5905 -r 5d1259b88c27 macros.xml --- a/macros.xml Sun Jun 23 06:59:56 2024 +0000 +++ b/macros.xml Sat Jun 29 06:10:22 2024 +0000 |
b |
@@ -1,5 +1,5 @@ <macros> - <token name="@TOOL_VERSION@">2.12.2</token> + <token name="@TOOL_VERSION@">2.12.3</token> <xml name="edamInc"> <edam_topics> <edam_topic>topic_3307</edam_topic> @@ -240,6 +240,7 @@ <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"/> </section> </xml> <xml name="track_styling_feature"> |