annotate autogenJB2.py @ 0:53c2be00bb6f draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
author bgruening
date Wed, 05 Jun 2024 08:15:49 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
1 import argparse
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
2 import logging
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
3 import os
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
4 import sys
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
5
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
6 from jbrowse2 import JbrowseConnector as jbC
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
7
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
8
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
9 logging.basicConfig(level=logging.DEBUG)
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
10 log = logging.getLogger("jbrowse")
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
11
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
12 if __name__ == "__main__":
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
13 parser = argparse.ArgumentParser(description="", epilog="")
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
14 parser.add_argument("--sessName", help="Session name", default="AutoJBrowse")
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
15 parser.add_argument(
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
16 "--trackmeta",
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
17 help="Repeatable 'filename,filext,filepath,[bai/crai path for filesystem bam/cram]' for JBrowse2 tracks",
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
18 default=[],
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
19 action="append",
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
20 )
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
21 parser.add_argument(
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
22 "--referencemeta",
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
23 help="Repeatable 'filename, filext, filepath, ... ,' for JBrowse2 reference tracks - usually only one needed",
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
24 default=[],
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
25 action="append",
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
26 )
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
27 parser.add_argument(
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
28 "--pafmeta",
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
29 help="Repeatable. Each is a 'pafname, filext, filepath, ... ,' for a JBrowse2 paf track",
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
30 default=[],
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
31 action="append",
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
32 )
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
33 parser.add_argument(
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
34 "--pafreferencemeta",
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
35 help="Repeatable. Each is a 'pafname,refpath,refname' Every pafname must have one or more",
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
36 default=[],
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
37 action="append",
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
38 )
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
39 parser.add_argument(
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
40 "--jbrowse2path", help="Path to JBrowse2 directory in biocontainer or Conda"
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
41 )
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
42 parser.add_argument("--outdir", help="Output directory", required=True)
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
43 parser.add_argument("--version", "-V", action="version", version="%(prog)s 2.10.2")
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
44 args = parser.parse_args()
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
45 sessName = args.sessName
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
46 default_session_data = {}
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
47 # --trackmeta $jbrowseme[$key],$jbrowseme[$key].ext,'$key'
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
48 trackList = [x.strip().split(",") for x in args.trackmeta if x > ""]
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
49 refList = [x.strip().split(",") for x in args.referencemeta if x > ""]
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
50 if len(refList) > 0:
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
51 listgenomes = [f for f in refList if f[1] in ["fasta", "fasta.gz"]]
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
52 # assume no pafs here
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
53 if len(listgenomes) > 0:
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
54 genome_paths = [x[0] for x in listgenomes]
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
55 genome_names = [x[2] for x in listgenomes]
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
56 guseuri = []
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
57 for x in genome_paths:
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
58 if x.startswith("http://") or x.startswith("https://"):
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
59 guseuri.append("yes")
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
60 else:
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
61 guseuri.append("no")
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
62 jc = jbC(
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
63 outdir=args.outdir,
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
64 jbrowse2path=args.jbrowse2path,
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
65 )
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
66 genomes = (
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
67 [
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
68 {
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
69 "path": x,
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
70 "label": genome_names[i],
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
71 "useuri": guseuri[i],
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
72 "meta": {
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
73 "name": genome_names[i],
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
74 "dataset_dname": genome_names[i],
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
75 },
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
76 }
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
77 for i, x in enumerate(genome_paths)
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
78 ],
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
79 )
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
80 assref_name = jc.process_genomes(genomes[0])
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
81 if not default_session_data.get(assref_name, None):
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
82 default_session_data[assref_name] = {
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
83 "tracks": [],
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
84 "style": {},
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
85 "style_labels": {},
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
86 "visibility": {
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
87 "default_on": [],
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
88 "default_off": [],
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
89 },
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
90 }
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
91 listtracks = trackList
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
92 # foo.paf must have a foo_paf.fasta or fasta.gz to match
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
93 tnames = [x[2] for x in listtracks]
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
94 texts = [x[1] for x in listtracks]
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
95 for i, track in enumerate(listtracks):
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
96 track_conf = {
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
97 "trackfiles": [],
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
98 "category": "autogenerated",
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
99 "assemblyNames": assref_name,
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
100 }
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
101 tpath, trext, trackname = track[:3]
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
102 track_conf["dataset_id"] = trackname
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
103 useuri = "no"
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
104 if tpath.startswith("http://") or tpath.startswith("https://"):
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
105 useuri = "yes"
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
106 if trext == "paf":
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
107 refname = trackname + "_paf.fasta"
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
108 refdat = [x[2] for x in listtracks if x[2] == refname]
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
109 if not refdat:
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
110 jc.logging.warn(
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
111 "No reference file %s corresponding to paf file %s found. Not building - there must be a corresponding fasta for each paf"
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
112 % (refname, trackname)
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
113 )
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
114 sys.exit(3)
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
115 else:
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
116 track_conf.update(
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
117 {
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
118 "conf": {
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
119 "options": {
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
120 "paf": {
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
121 "genome": refdat,
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
122 "genome_label": trackname,
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
123 }
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
124 }
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
125 }
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
126 }
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
127 )
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
128 elif trext == "bam":
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
129 ipath = track[3]
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
130 if not os.path.exists(ipath):
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
131 ipath = os.path.realpath(
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
132 os.path.join(jc.outdir, trackname + ".bai")
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
133 )
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
134 cmd = [
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
135 "samtools",
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
136 "index",
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
137 "-b",
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
138 "-o",
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
139 ipath,
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
140 os.path.realpath(track[0]),
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
141 ]
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
142 sys.stdout.write("#### calling %s" % " ".join(cmd))
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
143 jc.subprocess_check_call(cmd)
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
144 track_conf.update(
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
145 {"conf": {"options": {"bam": {"bam_index": " %s ~ %s," % (tpath, ipath)}}}}
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
146 )
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
147 elif trext == "cram":
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
148 ipath = track[3]
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
149 if not os.path.exists(ipath):
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
150 ipath = os.path.realpath(
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
151 os.path.join("./", trackname + ".crai")
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
152 )
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
153 cmd = [
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
154 "samtools",
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
155 "index",
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
156 "-c",
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
157 "-o",
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
158 ipath,
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
159 os.path.realpath(track[0]),
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
160 ]
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
161 jc.subprocess_check_call(cmd)
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
162 track_conf.update(
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
163 {"conf": {"options": {"cram": {"cram_index": "%s ~ %s," % (tpath, ipath)}}}}
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
164 )
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
165 track_conf["path"] = tpath
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
166 track_conf["format"] = trext
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
167 track_conf["name"] = trackname
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
168 track_conf["label"] = trackname
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
169 track_conf["trackfiles"].append((tpath, trext, useuri, trackname, {}))
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
170 keys = jc.process_annotations(track_conf)
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
171
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
172 if keys:
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
173 for key in keys:
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
174 if trext in [
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
175 "bigwig",
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
176 "gff",
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
177 "gff3",
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
178 "vcf",
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
179 "maf",
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
180 "bed",
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
181 "hic"
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
182 ]:
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
183 default_session_data[assref_name]["visibility"]["default_on"].append(key)
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
184 else:
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
185 default_session_data[assref_name]["visibility"]["default_off"].append(
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
186 key
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
187 )
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
188 if trext in ["gff", "gff3", "bed", "vcf", "maf", "blastxml"]:
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
189 ttype = "LinearBasicDisplay"
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
190 if trext == "vcf":
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
191 ttype = "LinearVariantDisplay"
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
192 style_json = {
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
193 "type": ttype,
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
194 "trackShowLabels": False,
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
195 "trackShowDescriptions": False,
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
196 }
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
197 default_session_data[assref_name]["style"][key] = style_json
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
198 default_session_data[assref_name]["tracks"].append(key)
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
199 # general_data = {
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
200 # "analytics": root.find("metadata/general/analytics").text,
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
201 # "primary_color": root.find("metadata/general/primary_color").text,
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
202 # "secondary_color": root.find("metadata/general/secondary_color").text,
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
203 # "tertiary_color": root.find("metadata/general/tertiary_color").text,
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
204 # "quaternary_color": root.find("metadata/general/quaternary_color").text,
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
205 # "font_size": root.find("metadata/general/font_size").text,
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
206 # }
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
207 jc.add_general_configuration({})
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
208 trackconf = jc.config_json.get("tracks", [])
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
209 for gnome in jc.genome_names:
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
210 trackconf += jc.tracksToAdd[gnome]
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
211 logging.debug(
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
212 "++++ adding trackconf=%s for gnome %s" % (trackconf, gnome)
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
213 )
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
214 jc.config_json["tracks"] = trackconf
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
215 assconf = jc.config_json.get("assemblies", [])
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
216 assconf += jc.assemblies
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
217 jc.config_json["assemblies"] = assconf
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
218 logging.debug("+++assemblies=%s, gnames=%s" % (assconf, jc.genome_names))
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
219 jc.write_config()
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
220 default_session_data.update({"session_name": sessName})
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
221 track_conf.update(default_session_data)
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
222 jc.add_default_session(default_session_data)
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
223 # jc.add_defsess_to_index(default_session_data)
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
224 # jc.text_index() not sure what broke here.
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
225 else:
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
226 sys.stderr.write(
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
227 "Collection has no suitable trackfiles for autogenJB2 - nothing to process"
53c2be00bb6f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 0a86c88a95b0d1cc49d84544136de6556b95320f
bgruening
parents:
diff changeset
228 )