annotate autogenJB2.py @ 36:5f39f745682f draft

planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
author fubar
date Thu, 29 Feb 2024 00:47:58 +0000
parents 15da358c3108
children 07849bf248e3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
30
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
1 import argparse
35
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
2 import logging
30
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
3 import sys
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
4
35
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
5 from jbrowse2 import JbrowseConnector as jbC
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
6
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
7 logging.basicConfig(level=logging.debug)
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
8 log = logging.getLogger("jbrowse")
30
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
9
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
10
35
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
11 def makeDefaultLocation():
30
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
12
35
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
13 refName = jc.genome_firstcontig
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
14 defloc = "%s:100..10000" % refName
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
15 print ('defloc',defloc)
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
16 return defloc
30
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
17
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
18
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
19 if __name__ == "__main__":
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
20 parser = argparse.ArgumentParser(description="", epilog="")
35
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
21 parser.add_argument("--sessName", help="Session name", default="AutoJBrowse")
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
22 parser.add_argument(
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
23 "--trackmeta",
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
24 help="Repeatable of 'filename, filext,filepath, ... ,' for JBrowse2 tracks",
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
25 default=[],
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
26 action="append",
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
27 )
30
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
28 parser.add_argument(
35
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
29 "--referencemeta",
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
30 help="Repeatable 'filename, filext, filepath, ... ,' for JBrowse2 reference tracks",
30
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
31 default=[],
35
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
32 action="append",
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
33 )
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
34 parser.add_argument(
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
35 "--pafmeta",
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
36 help="Repeatable. Each is a 'filename, filext, filepath, ... ,' for a JBrowse2 paf track",
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
37 default=[],
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
38 action="append",
30
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
39 )
35
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
40 parser.add_argument(
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
41 "--pafreferencemeta",
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
42 help="Repeatable. Each is a 'pafname,filepath,refname,filepath,refname....'. Every paf must have a corresponding one ",
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
43 default=[],
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
44 action="append",
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
45 )
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
46
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
47 parser.add_argument("--version", "-V", action="version", version="%(prog)s 2.10.2")
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
48 parser.add_argument("--outdir", help="Output directory", required=True)
30
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
49 args = parser.parse_args()
35
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
50 sessName = args.sessName
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
51 # --trackmeta $jbrowseme[$key],$jbrowseme[$key].ext,'$key'
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
52 trackList = [x.strip().split(",") for x in args.trackmeta if x > '']
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
53 refList = [x.strip().split(",") for x in args.referencemeta if x > '']
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
54 print("tracklist = %s\nreflist = %s" % (trackList,refList))
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
55 if len(refList) > 0:
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
56 listgenomes = [f for f in refList if f[1] in ['fasta', 'fasta.gz']]
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
57 # assume no pafs here
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
58 print('genomes=%s' % listgenomes)
30
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
59 if len(listgenomes) > 0:
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
60 genome_paths = [
35
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
61 x[0] for x in listgenomes
30
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
62 ] # expect genome_1_genomename.fasta etc
35
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
63 genome_names = [x[2] for x in listgenomes]
30
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
64 jc = jbC(
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
65 outdir=args.outdir,
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
66 genomes=[
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
67 {
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
68 "path": x,
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
69 "meta": {
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
70 "name": genome_names[i],
35
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
71 "dataset_dname": genome_names[i],
30
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
72 },
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
73 }
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
74 for i, x in enumerate(genome_paths)
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
75 ],
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
76 )
35
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
77 sys.stdout.write('$$$ genome_paths:%s genome_names: %s' % (genome_paths,genome_names))
30
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
78 jc.process_genomes()
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
79 default_session_data = {
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
80 "visibility": {
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
81 "default_on": [],
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
82 "default_off": [],
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
83 },
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
84 "style": {},
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
85 "style_labels": {},
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
86 }
35
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
87
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
88 listtracks = trackList
30
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
89 # foo.paf must have a foo_paf.fasta or fasta.gz to match
35
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
90 tnames = [x[2] for x in listtracks]
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
91 texts = [x[1] for x in listtracks]
30
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
92 for i, track in enumerate(listtracks):
35
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
93 tpath, trext, trackname = track[:3]
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
94 if trext == "paf":
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
95 refname = trackname + "_paf.fasta"
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
96 refdat = [x[2] for x in listtracks if x[2] == refname]
30
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
97 if not refdat:
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
98 jc.logging.warn(
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
99 "!! No reference file %s corresponding to paf file %s found. Not building - there must be a corresponding fasta for each paf"
35
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
100 % (refname, trackname)
30
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
101 )
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
102 sys.exit(3)
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
103 else:
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
104 track_conf = {
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
105 "conf": {
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
106 "options": {
35
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
107 "paf": {"genome": refdat, "genome_label": trackname}
30
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
108 }
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
109 }
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
110 }
35
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
111 elif trext == 'bam':
36
5f39f745682f planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 35
diff changeset
112 track_conf = {"conf": {"options": {"bam": {"bam_indices": {"bam_index": track[3]}}}}}
35
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
113 elif trext == 'cram':
36
5f39f745682f planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 35
diff changeset
114 track_conf = {"conf": {"options": {"cram": {"cram_indices": {"cram_index": track[3]}}}}}
30
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
115 else:
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
116 track_conf = {}
35
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
117 track_conf["format"] = trext
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
118 track_conf["name"] = trackname
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
119 track_conf["label"] = trackname
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
120 track_conf["trackfiles"] = [(tpath, trext, trackname,{}),]
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
121 track_conf["category"] = "Autogenerated"
30
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
122 keys = jc.process_annotations(track_conf)
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
123
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
124 if keys:
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
125 for key in keys:
35
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
126 if trext in ["bigwig", "gff3", "gff", "vcf", "maf",]:
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
127 default_session_data["visibility"]["default_on"].append(key)
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
128 else:
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
129 default_session_data["visibility"]["default_off"].append(key)
30
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
130 # if track_conf.get("style", None):
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
131 # default_session_data["style"][key] = track_conf[
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
132 # "style"
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
133 # ] # TODO do we need this anymore?
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
134 # if track_conf.get("style_lables", None):
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
135 # default_session_data["style_labels"][key] = track_conf.get(
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
136 # "style_labels", None
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
137 # )
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
138 # general_data = {
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
139 # "analytics": root.find("metadata/general/analytics").text,
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
140 # "primary_color": root.find("metadata/general/primary_color").text,
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
141 # "secondary_color": root.find("metadata/general/secondary_color").text,
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
142 # "tertiary_color": root.find("metadata/general/tertiary_color").text,
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
143 # "quaternary_color": root.find("metadata/general/quaternary_color").text,
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
144 # "font_size": root.find("metadata/general/font_size").text,
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
145 # }
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
146 # jc.add_general_configuration(general_data)
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
147 trackconf = jc.config_json.get("tracks", None)
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
148 if trackconf:
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
149 jc.config_json["tracks"].update(jc.tracksToAdd)
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
150 else:
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
151 jc.config_json["tracks"] = jc.tracksToAdd
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
152 jc.write_config()
35
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
153 defLoc = makeDefaultLocation()
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
154 default_session_data.update({"defaultLocation": defLoc, "session_name": sessName})
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
155 track_conf.update(default_session_data)
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
156 jc.add_default_session(default_session_data)
30
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
157 # jc.text_index() not sure what broke here.
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
158 else:
35
15da358c3108 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 30
diff changeset
159 print("!! empty collection supplied - nothing to process")