diff autogenJB2.py @ 67:cefe9dbf1d80 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 6dac6d6debf44c68eae2785e926fb8420f76958e-dirty
author fubar
date Thu, 28 Mar 2024 12:17:24 +0000
parents bc10ad1dfb98
children 7230a2422507
line wrap: on
line diff
--- a/autogenJB2.py	Thu Mar 28 11:53:38 2024 +0000
+++ b/autogenJB2.py	Thu Mar 28 12:17:24 2024 +0000
@@ -5,10 +5,10 @@
 
 from jbrowse2 import JbrowseConnector as jbC
 
-logging.basicConfig(level=logging.debug)
+
+logging.basicConfig(level=logging.DEBUG)
 log = logging.getLogger("jbrowse")
 
-
 if __name__ == "__main__":
     parser = argparse.ArgumentParser(description="", epilog="")
     parser.add_argument("--sessName", help="Session name", default="AutoJBrowse")
@@ -62,7 +62,8 @@
                 outdir=args.outdir,
                 jbrowse2path=args.jbrowse2path,
             )
-            genomes=[
+            genomes = (
+                [
                     {
                         "path": x,
                         "label": genome_names[i],
@@ -74,6 +75,7 @@
                     }
                     for i, x in enumerate(genome_paths)
                 ],
+            )
             logging.warn("#!!! paths=%s, genomes=%s" % (genome_paths, genomes))
             assref_name = jc.process_genomes(genomes[0])
             default_session_data = {
@@ -89,7 +91,11 @@
             tnames = [x[2] for x in listtracks]
             texts = [x[1] for x in listtracks]
             for i, track in enumerate(listtracks):
-                track_conf = {"trackfiles": [], "category": "autogenerated", "assemblyNames": assref_name}
+                track_conf = {
+                    "trackfiles": [],
+                    "category": "autogenerated",
+                    "assemblyNames": assref_name,
+                }
                 tpath, trext, trackname = track[:3]
                 track_conf["dataset_id"] = trackname
                 useuri = "no"
@@ -165,7 +171,8 @@
                     for key in keys:
                         if trext in [
                             "bigwig",
-                            "gff", "gff3",
+                            "gff",
+                            "gff3",
                             "vcf",
                             "maf",
                         ]:
@@ -179,9 +186,9 @@
                             if trext == "vcf":
                                 ttype = "LinearVariantDisplay"
                             style_json = {
-                            "type": ttype,
-                            "trackShowLabels": False,
-                            "trackShowDescriptions": False
+                                "type": ttype,
+                                "trackShowLabels": False,
+                                "trackShowDescriptions": False,
                             }
                             default_session_data["style"][key] = style_json
             # general_data = {
@@ -196,11 +203,12 @@
             trackconf = jc.config_json.get("tracks", [])
             for gnome in jc.genome_names:
                 trackconf += jc.tracksToAdd[gnome]
+            logging.warn(
+                "^^%% adding trackconf=%s for gnome %s" % (trackconf, gnome)
+            )
             jc.config_json["tracks"] = trackconf
             jc.write_config()
-            default_session_data.update(
-                {"session_name": sessName}
-            )
+            default_session_data.update({"session_name": sessName})
             track_conf.update(default_session_data)
             jc.add_default_session(default_session_data)
             # jc.text_index() not sure what broke here.
@@ -208,4 +216,3 @@
         sys.stderr.write(
             "!!!! Collection has no suitable trackfiles for autogenJB2 - nothing to process"
         )
-