diff autogenJB2.py @ 48:460d5b6c5d98 draft

planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a-dirty
author fubar
date Wed, 06 Mar 2024 10:37:49 +0000
parents 4181e97c70a7
children ae12977c0e5e
line wrap: on
line diff
--- a/autogenJB2.py	Wed Mar 06 00:23:02 2024 +0000
+++ b/autogenJB2.py	Wed Mar 06 10:37:49 2024 +0000
@@ -90,13 +90,14 @@
                 "style": {},
                 "style_labels": {},
             }
-
+            track_conf = {}
             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):
                 tpath, trext, trackname = track[:3]
+                track_conf["dataset_id"] = trackname
                 if trext == "paf":
                     refname = trackname + "_paf.fasta"
                     refdat = [x[2] for x in listtracks if x[2] == refname]
@@ -107,13 +108,13 @@
                         )
                         sys.exit(3)
                     else:
-                        track_conf = {
+                        track_conf.update({
                             "conf": {
                                 "options": {
                                     "paf": {"genome": refdat, "genome_label": trackname}
                                 }
                             }
-                        }
+                        })
                 elif trext == "bam":
                     ipath  = track[3]
                     if not os.path.exists(ipath):
@@ -121,7 +122,7 @@
                         cmd = ["samtools", "index", "-b", "-o", ipath, os.path.realpath(track[0])]
                         sys.stdout.write('#### calling %s' % ' '.join(cmd))
                         jc.subprocess_check_call(cmd)
-                    track_conf = {"conf": {"options": {"bam": {"bam_index": ipath}}}}
+                    track_conf.update({"conf": {"options": {"bam": {"bam_index": ipath}}}})
                 elif trext == "cram":
                     ipath  = track[3]
                     if not os.path.exists(ipath):
@@ -130,9 +131,8 @@
                         cmd = ["samtools", "index", "-c", "-o", ipath, os.path.realpath(track[0])]
                         sys.stdout.write('#### calling %s' % ' '.join(cmd))
                         jc.subprocess_check_call(cmd)
-                    track_conf = {"conf": {"options": {"cram": {"cram_index": ipath}}}}
-                else:
-                    track_conf = {}
+                    track_conf.update({"conf": {"options": {"cram": {"cram_index": ipath}}}})
+                track_conf["path"] = tpath
                 track_conf["format"] = trext
                 track_conf["name"] = trackname
                 track_conf["label"] = trackname
@@ -140,9 +140,9 @@
                 useuri = 'no'
                 if useu:
                     useuri = 'yes'
-                track_conf["trackfiles"] = [
-                    (tpath, trext, useuri, trackname, {}),
-                ]
+                    track_conf["trackfiles"] = [
+                        (tpath, trext, useuri, trackname, {}),
+                    ]
                 track_conf["category"] = "Autogenerated"
                 keys = jc.process_annotations(track_conf)