# HG changeset patch
# User fubar
# Date 1717220233 0
# Node ID 74074746ccd8cf662dc22ee79b6713b262c06be1
# Parent 5ef1ba2031f2e34e969a790b9092e2826ed8813b
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1c04ea76330d0148a7682b3c26846e5a5df21f99
diff -r 5ef1ba2031f2 -r 74074746ccd8 README.md
diff -r 5ef1ba2031f2 -r 74074746ccd8 Screenshot at 2024-04-30 16-11-29.png
Binary file Screenshot at 2024-04-30 16-11-29.png has changed
diff -r 5ef1ba2031f2 -r 74074746ccd8 autogenJB2.py
--- a/autogenJB2.py Thu Apr 25 07:25:52 2024 +0000
+++ b/autogenJB2.py Sat Jun 01 05:37:13 2024 +0000
@@ -77,7 +77,7 @@
for i, x in enumerate(genome_paths)
],
)
- logging.debug("@@@ paths=%s, genomes=%s" % (genome_paths, genomes))
+ logging.debug("@@@autogenJB2 paths=%s, genomes=%s" % (genome_paths, genomes))
assref_name = jc.process_genomes(genomes[0])
if not default_session_data.get(assref_name, None):
default_session_data[assref_name] = {
@@ -90,7 +90,6 @@
},
}
listtracks = trackList
- # foo.paf must have a foo_paf.fasta or fasta.gz to match
tnames = [x[2] for x in listtracks]
texts = [x[1] for x in listtracks]
for i, track in enumerate(listtracks):
@@ -105,22 +104,20 @@
if tpath.startswith("http://") or tpath.startswith("https://"):
useuri = "yes"
if trext == "paf":
- refname = trackname + "_paf.fasta"
- refdat = [x[2] for x in listtracks if x[2] == refname]
- if not refdat:
+ refdat = ["%s ~ %s" % (x[0],x[2]) for x in listtracks if x[1] in ["fasta", "fasta.gz"]]
+ if len(refdat) == 0:
jc.logging.warn(
- "!! No reference file %s corresponding to paf file %s found. Not building - there must be a corresponding fasta for each paf"
- % (refname, trackname)
+ "!! No reference file for %s found. Using main reference"
+ % (refname)
)
- sys.exit(3)
+ refdat = ["%s ~ %s" % (genomes[0].path, assref_name),]
else:
track_conf.update(
{
"conf": {
"options": {
"paf": {
- "genome": refdat,
- "genome_label": trackname,
+ "genome": ",".join(refdat)
}
}
}
diff -r 5ef1ba2031f2 -r 74074746ccd8 dm4_in_jb2.png
Binary file dm4_in_jb2.png has changed
diff -r 5ef1ba2031f2 -r 74074746ccd8 jb210demotracks.png
Binary file jb210demotracks.png has changed
diff -r 5ef1ba2031f2 -r 74074746ccd8 jb2_samplerMay5.png
Binary file jb2_samplerMay5.png has changed
diff -r 5ef1ba2031f2 -r 74074746ccd8 jbrowse2.py
--- a/jbrowse2.py Thu Apr 25 07:25:52 2024 +0000
+++ b/jbrowse2.py Sat Jun 01 05:37:13 2024 +0000
@@ -22,7 +22,7 @@
JB2VER = "v2.11.0"
# version pinned if cloning - but not cloning now
logCommands = True
-# useful for seeing what's being written but not for production setups
+# useful for seeing what's being written but NOT for production setups
TODAY = datetime.datetime.now().strftime("%Y-%m-%d")
SELF_LOCATION = os.path.dirname(os.path.realpath(__file__))
GALAXY_INFRASTRUCTURE_URL = None
@@ -41,32 +41,6 @@
}
-INDEX_TEMPLATE = """
-
-
-
-
-
-
-
-
-JBrowse
-
-
-
-
-
-
-"""
-
-
class ColorScaling(object):
COLOR_FUNCTION_TEMPLATE = """
@@ -491,7 +465,8 @@
nrow = len(fl)
else:
try:
- scontext = ssl.SSLContext(ssl.PROTOCOL_TLS)
+ scontext = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
+ scontext.check_hostname = False
scontext.verify_mode = ssl.VerifyMode.CERT_NONE
with urllib.request.urlopen(url, context=scontext) as f:
fl = f.readlines()
@@ -544,7 +519,8 @@
"""
if useuri:
faname = fapath
- scontext = ssl.SSLContext(ssl.PROTOCOL_TLS)
+ scontext = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
+ scontext.check_hostname = False
scontext.verify_mode = ssl.VerifyMode.CERT_NONE
with urllib.request.urlopen(url=faname + ".fai", context=scontext) as f:
fl = f.readline()
@@ -897,7 +873,7 @@
genseqad = gsa[0]["genome_sequence_adapter"]
else:
genseqad = "Not found"
- logging.warn("No adapter found for cram %s in gsa=%s" % (tId, gsa))
+ logging.warning("No adapter found for cram %s in gsa=%s" % (tId, gsa))
if useuri:
url = data
else:
@@ -965,7 +941,7 @@
url = data
else:
url = tId
- dest = "%s/%s" % (self.outdir, url)
+ dest = os.path.join(self.outdir, url)
cmd = "bgzip -c %s > %s" % (data, dest)
self.subprocess_popen(cmd)
cmd = ["tabix", "-f", "-p", "vcf", dest]
@@ -1032,7 +1008,7 @@
url = trackData["path"]
else:
url = tId + ".gz"
- dest = "%s/%s" % (self.outdir, url)
+ dest = os.path.join(self.outdir, url)
self._sort_gff(data, dest)
categ = trackData["category"]
trackDict = {
@@ -1078,7 +1054,7 @@
url = data
else:
url = tId + ".gz"
- dest = "%s/%s" % (self.outdir, url)
+ dest = os.path.join(self.outdir, url)
self._sort_bed(data, dest)
trackDict = {
"type": "FeatureTrack",
@@ -1125,7 +1101,7 @@
url = tId
useuri = data.startswith("http://") or data.startswith("https://")
if not useuri:
- dest = "%s/%s" % (self.outdir, url)
+ dest = os.path.join(self.outdir, url)
self.symlink_or_copy(os.path.realpath(data), dest)
nrow = self.getNrow(dest)
else:
@@ -1327,6 +1303,7 @@
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 = 50 # this is tricky since browser window width is unknown - this seems a compromise that sort of works....
track_types = {}
with open(self.config_json_file, "r") as config_file:
config_json = json.load(config_file)
@@ -1365,24 +1342,17 @@
"displays": [style_data],
}
)
- view_json = {
- "type": "LinearGenomeView",
- "offsetPx": 0,
- "minimized": False,
- "tracks": tracks_data,
- }
first = [x for x in self.ass_first_contigs if x[0] == gnome]
- if len(first) > 0:
- [gnome, refName, end] = first[0]
- start = 0
- end = int(end)
- drdict = {
- "refName": refName,
- "start": start,
- "end": end,
+ drdict = {
"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
else:
ddl = default_data.get("defaultLocation", None)
if ddl:
@@ -1400,6 +1370,13 @@
"@@@ regexp could not match contig:start..end in the supplied location %s - please fix"
% ddl
)
+ view_json = {
+ "type": "LinearGenomeView",
+ "offsetPx": 0,
+ "bpPerPx" : bpPerPx,
+ "minimized": False,
+ "tracks": tracks_data
+ }
if drdict.get("refName", None):
# TODO displayedRegions is not just zooming to the region, it hides the rest of the chromosome
view_json["displayedRegions"] = [
@@ -1415,7 +1392,6 @@
for key, value in mapped_chars.items():
session_name = session_name.replace(value, key)
session_json["name"] = session_name
-
if "views" not in session_json:
session_json["views"] = session_views
else:
@@ -1429,14 +1405,7 @@
def add_defsess_to_index(self, data):
"""
- PROBABLY NOW BROKEN by changes since this was deprecated temporarily as at April 18
-
- Included on request of the new codeowner, from Anthony's IUC PR.
- Had to be fixed to keep each assembly with the associated tracks for a default view.
- Originally used only the first assembly, putting all tracks there and so breaking some
- when tested with 2 or more.
-
- ----------------------------------------------------------
+ ----------------------------------------------------------
Add some default session settings: set some assemblies/tracks on/off
This allows to select a default view:
@@ -1461,6 +1430,33 @@
https://github.com/GMOD/jbrowse-components/discussions/3568
https://github.com/GMOD/jbrowse-components/pull/4148
"""
+
+
+ INDEX_TEMPLATE = """
+
+
+
+
+
+
+
+
+ JBrowse
+
+
+
+
+
+
+ """
+
new_index = "Nothing written"
session_spec = {"views": []}
logging.debug("def ass_first=%s\ndata=%s" % (self.ass_first_contigs, data))
@@ -1544,10 +1540,15 @@
"version.txt",
"test_data",
]:
- cmd = ["rm", "-rf", os.path.join(dest, fn)]
- self.subprocess_check_call(cmd)
- cmd = ["cp", os.path.join(INSTALLED_TO, "jb2_webserver.py"), dest]
- self.subprocess_check_call(cmd)
+ try:
+ path = os.path.join(dest, fn)
+ if os.path.isdir(path):
+ shutil.rmtree(path)
+ else:
+ 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"))
def parse_style_conf(item):
@@ -1561,7 +1562,7 @@
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"
+ "--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=JB2VER)
diff -r 5ef1ba2031f2 -r 74074746ccd8 jbrowse2.xml
--- a/jbrowse2.xml Thu Apr 25 07:25:52 2024 +0000
+++ b/jbrowse2.xml Sat Jun 01 05:37:13 2024 +0000
@@ -3,12 +3,23 @@
macros.xml
-
+ jbrowse2
+ python '${__tool_directory__}/jbrowse2.py' --version
+
+
+
+
+
+
+
+
+
+ 0:
--pafmeta '$pafs[0]'
- #set refs = [($pafs[0][2],$subCol[x],x) for x in $subCol.keys() if $subCol[x].ext == 'fasta']
#for $ref in $refs:
--pafreferencemeta '$ref'
#end for
@@ -310,67 +321,39 @@
]]>
-
+
-
+
-
+
-
-
+
+
-
+
-
+
-
+
-
-
+
-
+
@@ -389,114 +372,79 @@
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
+
+
+
-
+
-
+
-
+
-
+
-
-
+
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
@@ -504,99 +452,90 @@
-
-
-
+
+
+
-
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
@@ -604,20 +543,18 @@
-
-
-
+
+
+
-
+
-
+
-
-
+
+
@@ -625,65 +562,56 @@
-
-
-
+
+
+
-
+
-
+
-
-
+
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
-
+
+
-
+
-
-
+
+
-
-
-
+
+
+
@@ -691,72 +619,69 @@
-
-
-
+
+
+
-
+
-
+
-
-
-
+
+
+
-
-
+
+
-