annotate autogenJB2.py @ 30:8f02a84ee278 draft

planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
author fubar
date Wed, 21 Feb 2024 02:57:30 +0000
parents
children 15da358c3108
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
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
2 import re
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
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
5 from jbrowse2 import jbrowseConnector as jbC
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
6
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
7
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
8 def makeDefaultLocation(jc, defLoc=None):
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 refName = None
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
11 drdict = {
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
12 "reversed": False,
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
13 "assemblyName": jc.genome_name,
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
14 "start": 0,
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
15 "end": 100000,
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
16 }
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 if defLoc:
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
19 loc_match = re.search(r"^([^:]+):([\d,]*)\.*([\d,]*)$", defLoc)
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
20 # allow commas like 100,000 but ignore as integer
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
21 if loc_match:
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
22 refName = loc_match.group(1)
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
23 drdict["refName"] = refName
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
24 if loc_match.group(2) > "":
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
25 drdict["start"] = int(loc_match.group(2).replace(",", ""))
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
26 if loc_match.group(3) > "":
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
27 drdict["end"] = int(loc_match.group(3).replace(",", ""))
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
28 else:
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
29 jc.logging.info(
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
30 "@@@ regexp could not match contig:start..end in the supplied location %s - please fix"
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
31 % defLoc
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
32 )
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
33 else:
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
34 drdict["refName"] = jc.genome_firstcontig
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
35 if drdict.get("refName", None):
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
36 jc.logging.info("@@@ defaultlocation %s for default session" % drdict)
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
37 return drdict
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
38 else:
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
39 jc.logging.info("@@@ no contig name found for default session - please add one!")
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
40 return None
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
41
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
42
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
43 if __name__ == "__main__":
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
44 parser = argparse.ArgumentParser(description="", epilog="")
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
45 parser.add_argument("--sessname", help="Session name", default="AutoJBrowse")
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
46 parser.add_argument(
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
47 "--collection",
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
48 help="Collection of 'filepath, filename, filext' for JBrowse2",
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
49 default=[],
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
50 action="extend",
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
51 )
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
52 parser.add_argument("--version", "-V", action="version", version="%(prog)s 0.0.1")
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
53 args = parser.parse_args()
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
54 sessName = args.sessname
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
55 flistList = [x.split(",") for x in args.collection]
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
56 if flistList:
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
57 listgenomes = [f for f in flistList if f[0].startswith("REFERENCE_")]
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
58 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
59 genome_paths = [
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
60 x[1] for x in listgenomes
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
61 ] # expect genome_1_genomename.fasta etc
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
62 genome_names = [x[0].split("REFERENCE_")[1] for x in listgenomes]
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
63 jc = jbC(
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
64 outdir=args.outdir,
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
65 genomes=[
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
66 {
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
67 "path": x,
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
68 "meta": {
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
69 "name": genome_names[i],
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
70 },
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
71 }
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
72 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
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 jc.process_genomes()
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
76 default_session_data = {
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
77 "visibility": {
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
78 "default_on": [],
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
79 "default_off": [],
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
80 },
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
81 "style": {},
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
82 "style_labels": {},
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 defLoc = makeDefaultLocation(jc)
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
85 listtracks = [f for f in flistList if not f[0].startswith("REFERENCE_")]
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
86 # foo.paf must have a foo_paf.fasta or fasta.gz to match
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
87 tnames = [x[0] for x in listtracks]
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
88 texts = [x[2] for x in listtracks]
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
89 for i, track in enumerate(listtracks):
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
90 if track[2] == "paf":
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
91 refname = track[0] + "_paf.fasta"
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
92 refdat = [x[1] for x in listtracks if x[0] == refname]
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
93 if not refdat:
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
94 jc.logging.warn(
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
95 "!! No reference file %s corresponding to paf file %s found. Not building - there must be a corresponding fasta for each paf"
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
96 % (refname, tnames[i])
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
97 )
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
98 sys.exit(3)
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
99 else:
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
100 track_conf = {
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
101 "conf": {
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
102 "options": {
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
103 "paf": {"genome": refdat, "genome_label": track[0]}
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
104 }
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
105 }
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
106 }
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
107 else:
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
108 track_conf = {}
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
109 track_conf["format"] = track[2]
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
110 track_conf["name"] = track[0]
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
111 track_conf["label"] = track[0]
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
112 track_conf["trackfiles"] = []
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
113 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
114
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
115 if keys:
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
116 for key in keys:
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
117 default_session_data["visibility"][
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
118 track.attrib.get("visibility", "default_off")
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
119 ].append(key)
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
120 # 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
121 # 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
122 # "style"
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
123 # ] # 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
124 # 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
125 # 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
126 # "style_labels", None
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
127 # )
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
128 # general_data = {
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
129 # "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
130 # "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
131 # "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
132 # "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
133 # "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
134 # "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
135 # }
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
136 # 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
137 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
138 if trackconf:
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
139 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
140 else:
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
141 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
142 jc.write_config()
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
143 defaultData = {"defaultLocation": defLoc, "session_name": sessName}
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
144 jc.add_default_session(defaultData)
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
145 # 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
146 else:
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents:
diff changeset
147 sys.stderr.write("!! empty collection supplied - nothing to process")