diff jbrowse2.py @ 132:1efcc387bef4 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b76c8cc45b31e105e6bb51abc5a5728cfd3e3f99
author bgruening
date Thu, 17 Oct 2024 11:58:53 +0000
parents e188a9d25ed2
children cec274db51c0
line wrap: on
line diff
--- a/jbrowse2.py	Sat Oct 12 23:11:22 2024 +0000
+++ b/jbrowse2.py	Thu Oct 17 11:58:53 2024 +0000
@@ -1130,18 +1130,24 @@
         self.trackIdlist.append(tId)
 
     def add_paf(self, data, trackData, pafOpts, **kwargs):
+        canPIF = False
         tname = trackData["name"]
         tId = trackData["label"]
         url = tId
-        usePIF = False  # much faster if indexed remotely or locally
+        usePIF = False  # much faster if indexed remotely or locally but broken in biocontainer.
         useuri = data.startswith("http://") or data.startswith("https://")
         if not useuri:
-            url = "%s.pif.gz" % tId
-            cmd = "sort -b -k1,1 -k2,3n -k3,4n '%s' | bgzip -c > '%s'" % (data, url)
-            self.subprocess_popen(cmd)
-            cmd = ["tabix", "-b", "3", "-e", "4", "-f", url]
-            self.subprocess_check_call(cmd)
-            usePIF = True
+            if canPIF:
+                fakeName = '%s.paf' % tId
+                url = "%s.pif.gz" % tId
+                cmd = ["cp", data, fakeName]
+                self.subprocess_check_call(cmd)
+                cmd = ["jbrowse", "make-pif", fakeName]  # jbrowse pif input.paf --out output.pif.gz # specify output file, creates output.pif.gz.tbi also
+                self.subprocess_check_call(cmd)
+                usePIF = True
+            else:
+                dest = os.path.join(self.outdir, url)
+                self.symlink_or_copy(os.path.realpath(data), dest)
         else:
             url = data
             if data.endswith(".pif.gz") or data.endswith(".paf.gz"):  # is tabix