Mercurial > repos > fubar > jbrowse2
annotate autogenJB2.py @ 45:0ec526d2d8c1 draft
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 015c77d802595a85f78739ee2316b452c519c796-dirty
author | fubar |
---|---|
date | Fri, 01 Mar 2024 05:15:41 +0000 |
parents | bc57164eb270 |
children | 4181e97c70a7 |
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 ) |
39
bc57164eb270
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit ace841acd53be99494ed9bba8bb9e2ae212d3661
fubar
parents:
38
diff
changeset
|
46 parser.add_argument("--jbrowse2path", help="Path to JBrowse2 directory in biocontainer or Conda") |
bc57164eb270
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit ace841acd53be99494ed9bba8bb9e2ae212d3661
fubar
parents:
38
diff
changeset
|
47 parser.add_argument("--outdir", help="Output directory", required=True) |
35
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("--version", "-V", action="version", version="%(prog)s 2.10.2") |
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, |
39
bc57164eb270
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit ace841acd53be99494ed9bba8bb9e2ae212d3661
fubar
parents:
38
diff
changeset
|
66 jbrowse2path=args.jbrowse2path, |
30
8f02a84ee278
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff
changeset
|
67 genomes=[ |
8f02a84ee278
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff
changeset
|
68 { |
8f02a84ee278
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff
changeset
|
69 "path": x, |
8f02a84ee278
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff
changeset
|
70 "meta": { |
8f02a84ee278
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff
changeset
|
71 "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
|
72 "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
|
73 }, |
8f02a84ee278
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff
changeset
|
74 } |
8f02a84ee278
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff
changeset
|
75 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
|
76 ], |
8f02a84ee278
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff
changeset
|
77 ) |
35
15da358c3108
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents:
30
diff
changeset
|
78 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
|
79 jc.process_genomes() |
8f02a84ee278
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff
changeset
|
80 default_session_data = { |
8f02a84ee278
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff
changeset
|
81 "visibility": { |
8f02a84ee278
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff
changeset
|
82 "default_on": [], |
8f02a84ee278
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff
changeset
|
83 "default_off": [], |
8f02a84ee278
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff
changeset
|
84 }, |
8f02a84ee278
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff
changeset
|
85 "style": {}, |
8f02a84ee278
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff
changeset
|
86 "style_labels": {}, |
8f02a84ee278
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff
changeset
|
87 } |
35
15da358c3108
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents:
30
diff
changeset
|
88 |
15da358c3108
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents:
30
diff
changeset
|
89 listtracks = trackList |
30
8f02a84ee278
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff
changeset
|
90 # 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
|
91 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
|
92 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
|
93 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
|
94 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
|
95 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
|
96 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
|
97 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
|
98 if not refdat: |
8f02a84ee278
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff
changeset
|
99 jc.logging.warn( |
8f02a84ee278
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff
changeset
|
100 "!! 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
|
101 % (refname, trackname) |
30
8f02a84ee278
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff
changeset
|
102 ) |
8f02a84ee278
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff
changeset
|
103 sys.exit(3) |
8f02a84ee278
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff
changeset
|
104 else: |
8f02a84ee278
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff
changeset
|
105 track_conf = { |
8f02a84ee278
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff
changeset
|
106 "conf": { |
8f02a84ee278
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff
changeset
|
107 "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
|
108 "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
|
109 } |
8f02a84ee278
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff
changeset
|
110 } |
8f02a84ee278
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff
changeset
|
111 } |
35
15da358c3108
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents:
30
diff
changeset
|
112 elif trext == 'bam': |
38
07849bf248e3
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a74e469a81b38c7142f63de510ae31d3754d1767
fubar
parents:
36
diff
changeset
|
113 track_conf = {"conf": {"options": {"bam": {"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
|
114 elif trext == 'cram': |
38
07849bf248e3
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a74e469a81b38c7142f63de510ae31d3754d1767
fubar
parents:
36
diff
changeset
|
115 track_conf = {"conf": {"options": {"cram": {"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
|
116 else: |
8f02a84ee278
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff
changeset
|
117 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
|
118 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
|
119 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
|
120 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
|
121 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
|
122 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
|
123 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
|
124 |
8f02a84ee278
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff
changeset
|
125 if keys: |
8f02a84ee278
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff
changeset
|
126 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
|
127 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
|
128 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
|
129 else: |
15da358c3108
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents:
30
diff
changeset
|
130 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
|
131 # 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
|
132 # 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
|
133 # "style" |
8f02a84ee278
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff
changeset
|
134 # ] # 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
|
135 # 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
|
136 # 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
|
137 # "style_labels", None |
8f02a84ee278
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff
changeset
|
138 # ) |
8f02a84ee278
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff
changeset
|
139 # general_data = { |
8f02a84ee278
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff
changeset
|
140 # "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
|
141 # "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
|
142 # "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
|
143 # "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
|
144 # "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
|
145 # "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
|
146 # } |
8f02a84ee278
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff
changeset
|
147 # 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
|
148 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
|
149 if trackconf: |
8f02a84ee278
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff
changeset
|
150 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
|
151 else: |
8f02a84ee278
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff
changeset
|
152 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
|
153 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
|
154 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
|
155 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
|
156 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
|
157 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
|
158 # 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
|
159 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
|
160 print("!! empty collection supplied - nothing to process") |