diff autogenJB2.py @ 98:b1260bca5fdc draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 44d8fc559ecf5463a8f753561976fa26686c96f6
author bgruening
date Wed, 05 Jun 2024 10:00:07 +0000
parents 74074746ccd8
children 878c27dfea9d
line wrap: on
line diff
--- a/autogenJB2.py	Sat Jun 01 05:37:13 2024 +0000
+++ b/autogenJB2.py	Wed Jun 05 10:00:07 2024 +0000
@@ -77,7 +77,6 @@
                     for i, x in enumerate(genome_paths)
                 ],
             )
-            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,6 +89,7 @@
                     },
                 }
             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):
@@ -104,20 +104,22 @@
                 if tpath.startswith("http://") or tpath.startswith("https://"):
                     useuri = "yes"
                 if trext == "paf":
-                    refdat = ["%s ~ %s" % (x[0],x[2]) for x in listtracks if x[1] in ["fasta", "fasta.gz"]]
-                    if len(refdat) == 0:
+                    refname = trackname + "_paf.fasta"
+                    refdat = [x[2] for x in listtracks if x[2] == refname]
+                    if not refdat:
                         jc.logging.warn(
-                            "!! No reference file for %s found. Using main reference"
-                            % (refname)
+                            "No reference file %s corresponding to paf file %s found. Not building - there must be a corresponding fasta for each paf"
+                            % (refname, trackname)
                         )
-                        refdat = ["%s ~ %s" % (genomes[0].path, assref_name),]
+                        sys.exit(3)
                     else:
                         track_conf.update(
                             {
                                 "conf": {
                                     "options": {
                                         "paf": {
-                                            "genome": ",".join(refdat)
+                                            "genome": refdat,
+                                            "genome_label": trackname,
                                         }
                                     }
                                 }
@@ -140,7 +142,7 @@
                         sys.stdout.write("#### calling %s" % " ".join(cmd))
                         jc.subprocess_check_call(cmd)
                     track_conf.update(
-                        {"conf": {"options": {"bam": {"bam_index": " %s ~ %s," % (tpath,ipath)}}}}
+                        {"conf": {"options": {"bam": {"bam_index": " %s ~ %s," % (tpath, ipath)}}}}
                     )
                 elif trext == "cram":
                     ipath = track[3]
@@ -222,5 +224,5 @@
             # jc.text_index() not sure what broke here.
     else:
         sys.stderr.write(
-            "!!!! Collection has no suitable trackfiles for autogenJB2 - nothing to process"
+            "Collection has no suitable trackfiles for autogenJB2 - nothing to process"
         )