changeset 49:7e867ff86e44 draft

planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a-dirty
author fubar
date Thu, 07 Mar 2024 00:27:48 +0000
parents 460d5b6c5d98
children f350467f9433
files jb2_urlconf.py jbrowse2.py
diffstat 2 files changed, 127 insertions(+), 56 deletions(-) [+]
line wrap: on
line diff
--- a/jb2_urlconf.py	Wed Mar 06 10:37:49 2024 +0000
+++ b/jb2_urlconf.py	Thu Mar 07 00:27:48 2024 +0000
@@ -1,3 +1,4 @@
+
 inconf = open('config.json', 'r').readlines()
 with open('config.json.local', 'w') as bak:
     bak.write(''.join(inconf))
@@ -7,10 +8,11 @@
     ispath = False
     if row.strip().startswith(utag):
             ispath = True
-            parth = row.split(utag)[1].strip()
-            inconf[i] = '%s%s' % (urlbase, parth)
+            parth = row.split(utag)[1].strip().replace('"','').replace("'",'')
+            inconf[i] = '%s "%s%s"' % (utag, urlbase, parth)
 with open('config.json', 'w') as outconf:
     outconf.write(''.join(inconf))
 
 
 
+
--- a/jbrowse2.py	Wed Mar 06 10:37:49 2024 +0000
+++ b/jbrowse2.py	Thu Mar 07 00:27:48 2024 +0000
@@ -602,17 +602,23 @@
         useuri = trackData["useuri"].lower() == "yes"
         if useuri:
             uri = data
+            adapt = {
+                "type": "HicAdapter",
+                "hicLocation": uri,
+                "locationType": "UriLocation",
+            },
         else:
             uri = trackData["hic_url"]
+            adapt = {
+                "type": "HicAdapter",
+                "hicLocation": uri,
+            },
         trackDict = {
             "type": "HicTrack",
             "trackId": tId,
             "name": uri,
             "assemblyNames": [self.genome_name],
-            "adapter": {
-                "type": "HicAdapter",
-                "hicLocation": uri,
-            },
+            "adapter":  adapt,
             "displays": [
                 {
                     "type": "LinearHicDisplay",
@@ -781,13 +787,21 @@
         useuri = trackData["useuri"].lower() == "yes"
         if useuri:
             url = data
+            adapt = {
+                "type": "BigWigAdapter",
+                "bigWigLocation": {"uri": url},
+                "locationType": "UriLocation",
+            }
         else:
             url = "%s.bigwig" % trackData["label"]
             # slashes in names cause path trouble
             dest = os.path.join(self.outdir, url)
             cmd = ["cp", data, dest]
             self.subprocess_check_call(cmd)
-        bwloc = {"uri": url}
+            adapt = {
+                "type": "BigWigAdapter",
+                "bigWigLocation": {"uri": url},
+            }
         tId = trackData["label"]
         trackDict = {
             "type": "QuantitativeTrack",
@@ -796,10 +810,7 @@
             "assemblyNames": [
                 self.genome_name,
             ],
-            "adapter": {
-                "type": "BigWigAdapter",
-                "bigWigLocation": bwloc,
-            },
+            "adapter":  adapt,
             "displays": [
                 {
                     "type": "LinearWiggleDisplay",
@@ -818,12 +829,31 @@
         bindex = bam_index
         if useuri:
             url = data
+            adapt =  {
+                "type": "BamAdapter",
+                "bamLocation": {"uri": url},
+                "index": {
+                    "location": {
+                        "uri": bindex,
+                       "locationType": "UriLocation",
+                       }
+                }
+            }
         else:
             fname = "%s.bam" % trackData["label"]
             dest = "%s/%s" % (self.outdir, fname)
             url = fname
             bindex = fname + '.bai'
             self.subprocess_check_call(["cp", data, dest])
+            adapt =  {
+                "type": "BamAdapter",
+                "bamLocation": {"uri": url},
+                "index": {
+                    "location": {
+                        "uri": bindex,
+                       }
+                    }
+                }
             if bam_index is not None and os.path.exists(bam_index):
                 if not os.path.exists(bindex):
                     # bai most probably made by galaxy and stored in galaxy dirs, need to copy it to dest
@@ -844,15 +874,7 @@
             "trackId": tId,
             "name": trackData["name"],
             "assemblyNames": [self.genome_name],
-            "adapter": {
-                "type": "BamAdapter",
-                "bamLocation": {"uri": url},
-                "index": {
-                    "location": {
-                        "uri": bindex,
-                    }
-                },
-            },
+            "adapter": adapt,
             "displays": [
                 {
                     "type": "LinearAlignmentsDisplay",
@@ -871,13 +893,29 @@
         bindex = cram_index
         if useuri:
             url = data
+            adapt =  {
+                "type": "CramAdapter",
+                "cramLocation": {"uri": url},
+                "craiLocation": {
+                    "uri": bindex,
+                    "locationType": "UriLocation",
+                },
+                "sequenceAdapter": self.genome_sequence_adapter,
+               }
         else:
             fname = "%s.cram" % trackData["label"]
             dest = "%s/%s" % (self.outdir, fname)
             bindex = fname + '.bai'
             url = fname
             self.subprocess_check_call(["cp", data, dest])
-
+            adapt =  {
+                "type": "CramAdapter",
+                "cramLocation": {"uri": url},
+                "craiLocation": {
+                    "uri": bindex,
+                },
+                "sequenceAdapter": self.genome_sequence_adapter,
+               }
             if bindex is not None and os.path.exists(bindex):
                 if not os.path.exists(dest+'.crai'):
                     # most probably made by galaxy and stored in galaxy dirs, need to copy it to dest
@@ -900,14 +938,7 @@
             "trackId": tId,
             "name": trackData["name"],
             "assemblyNames": [self.genome_name],
-            "adapter": {
-                "type": "CramAdapter",
-                "cramLocation": {"uri": url},
-                "craiLocation": {
-                    "uri": bindex,
-                },
-                "sequenceAdapter": self.genome_sequence_adapter,
-            },
+            "adapter": adapt,
             "displays": [
                 {
                     "type": "LinearAlignmentsDisplay",
@@ -930,6 +961,19 @@
         useuri = trackData["useuri"].lower() == "yes"
         if useuri:
             url = data
+            adapt = {
+                "type": "VcfTabixAdapter",
+                "vcfGzLocation": {
+                    "uri": url,
+                    "locationType": "UriLocation",
+                },
+                "index": {
+                    "location": {
+                        "uri": url + ".tbi",
+                        "locationType": "UriLocation",
+                    }
+                },
+            },
         else:
             url = "%s.vcf.gz" % tId
             dest = "%s/%s" % (self.outdir, url)
@@ -937,12 +981,7 @@
             self.subprocess_popen(cmd)
             cmd = ["tabix", "-f", "-p", "vcf", dest]
             self.subprocess_check_call(cmd)
-        trackDict = {
-            "type": "VariantTrack",
-            "trackId": tId,
-            "name": trackData["name"],
-            "assemblyNames": [self.genome_name],
-            "adapter": {
+            adapt = {
                 "type": "VcfTabixAdapter",
                 "vcfGzLocation": {
                     "uri": url
@@ -952,7 +991,13 @@
                         "uri": url + ".tbi",
                     }
                 },
-            },
+            }
+        trackDict = {
+            "type": "VariantTrack",
+            "trackId": tId,
+            "name": trackData["name"],
+            "assemblyNames": [self.genome_name],
+            "adapter": adapt,
             "displays": [
                 {
                     "type": "LinearVariantDisplay",
@@ -995,17 +1040,24 @@
         useuri = trackData["useuri"].lower() == "yes"
         if useuri:
             url = trackData["path"]
+            adapter = {
+                "type": "Gff3TabixAdapter",
+                "gffGzLocation": {
+                    "uri": url,
+                    "locationType": "UriLocation",
+                },
+                "index": {
+                    "location": {
+                        "uri": url + ".tbi",
+                        "locationType": "UriLocation",
+                    }
+                },
+            }
         else:
             url = "%s.%s.gz" % (trackData["label"], ext)
             dest = "%s/%s" % (self.outdir, url)
             self._sort_gff(data, dest)
-        tId = trackData["label"]
-        trackDict = {
-            "type": "FeatureTrack",
-            "trackId": tId,
-            "name": trackData["name"],
-            "assemblyNames": [self.genome_name],
-            "adapter": {
+            adapter = {
                 "type": "Gff3TabixAdapter",
                 "gffGzLocation": {
                     "uri": url,
@@ -1015,7 +1067,14 @@
                         "uri": url + ".tbi",
                     }
                 },
-            },
+            }
+        tId = trackData["label"]
+        trackDict = {
+            "type": "FeatureTrack",
+            "trackId": tId,
+            "name": trackData["name"],
+            "assemblyNames": [self.genome_name],
+            "adapter": adapt,
             "displays": [
                 {
                     "type": "LinearBasicDisplay",
@@ -1037,16 +1096,24 @@
         useuri = trackData["useuri"].lower() == "yes"
         if useuri:
             url = data
+            adapt = {
+                "type": "BedTabixAdapter",
+                "bedGzLocation": {
+                    "uri": url,
+                    "locationType": "UriLocation",
+                },
+                "index": {
+                    "location": {
+                        "uri": url + ".tbi",
+                        "locationType": "UriLocation",
+                    }
+                },
+            }
         else:
             url = "%s.%s.gz" % (trackData["label"], ext)
             dest = "%s/%s" % (self.outdir, url)
             self._sort_bed(data, dest)
-        trackDict = {
-            "type": "FeatureTrack",
-            "trackId": tId,
-            "name": trackData["name"],
-            "assemblyNames": [self.genome_name],
-            "adapter": {
+            adapt = {
                 "type": "BedTabixAdapter",
                 "bedGzLocation": {
                     "uri": url,
@@ -1056,7 +1123,13 @@
                         "uri": url + ".tbi",
                     }
                 },
-            },
+            }
+        trackDict = {
+            "type": "FeatureTrack",
+            "trackId": tId,
+            "name": trackData["name"],
+            "assemblyNames": [self.genome_name],
+            "adapter": adapt,
             "displays": [
                 {
                     "type": "LinearBasicDisplay",
@@ -1106,11 +1179,7 @@
             "trackId": tId,
             "assemblyNames": passnames,
             "name": tname,
-            "adapter": {
-                "type": "PAFAdapter",
-                "pafLocation": {"uri": url},
-                "assemblyNames": passnames,
-            },
+            "adapter": adapt,
             # "displays": [
             # {
             # "type": "LinearSyntenyDisplay",