annotate jbrowse2.py @ 0:61add3f58f26 draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
author iuc
date Thu, 02 Oct 2025 10:19:44 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1 #!/usr/bin/env python
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
2 import argparse
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
3 import csv
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
4 import datetime
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
5 import hashlib
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
6 import json
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
7 import logging
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
8 import os
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
9 import re
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
10 import shutil
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
11 import subprocess
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
12 import xml.etree.ElementTree as ET
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
13 from collections import defaultdict
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
14
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
15 import requests
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
16
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
17
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
18 logging.basicConfig(level=logging.DEBUG)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
19 log = logging.getLogger("jbrowse")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
20 TODAY = datetime.datetime.now().strftime("%Y-%m-%d")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
21 SELF_LOCATION = os.path.dirname(os.path.realpath(__file__))
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
22 GALAXY_INFRASTRUCTURE_URL = None
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
23 mapped_chars = {
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
24 ">": "__gt__",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
25 "<": "__lt__",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
26 "'": "__sq__",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
27 '"': "__dq__",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
28 "[": "__ob__",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
29 "]": "__cb__",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
30 "{": "__oc__",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
31 "}": "__cc__",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
32 "@": "__at__",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
33 "#": "__pd__",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
34 "": "__cn__",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
35 }
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
36
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
37
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
38 def etree_to_dict(t):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
39 if t is None:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
40 return {}
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
41
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
42 d = {t.tag: {} if t.attrib else None}
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
43 children = list(t)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
44 if children:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
45 dd = defaultdict(list)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
46 for dc in map(etree_to_dict, children):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
47 for k, v in dc.items():
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
48 dd[k].append(v)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
49 d = {t.tag: {k: v[0] if len(v) == 1 else v for k, v in dd.items()}}
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
50 if t.attrib:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
51 d[t.tag].update(("@" + k, v) for k, v in t.attrib.items())
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
52 if t.text:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
53 text = t.text.strip()
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
54 if children or t.attrib:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
55 if text:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
56 d[t.tag]["#text"] = text
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
57 else:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
58 d[t.tag] = text
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
59 return d
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
60
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
61
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
62 INSTALLED_TO = os.path.dirname(os.path.realpath(__file__))
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
63
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
64
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
65 def metadata_from_node(node):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
66 metadata = {}
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
67
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
68 if len(node.findall("dataset")) == 1:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
69
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
70 for key, value in node.findall("dataset")[0].attrib.items():
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
71 metadata[f"dataset_{key}"] = value
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
72
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
73 for key, value in node.findall("history")[0].attrib.items():
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
74 metadata[f"history_{key}"] = value
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
75
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
76 for key, value in node.findall("metadata")[0].attrib.items():
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
77 metadata[f"metadata_{key}"] = value
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
78
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
79 for key, value in node.findall("tool")[0].attrib.items():
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
80 metadata[f"tool_{key}"] = value
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
81
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
82 # Additional Mappings applied:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
83 metadata[
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
84 "dataset_edam_format"
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
85 ] = '<a target="_blank" href="http://edamontology.org/{0}">{1}</a>'.format(
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
86 metadata["dataset_edam_format"], metadata["dataset_file_ext"]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
87 )
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
88 metadata["history_user_email"] = '<a href="mailto:{0}">{0}</a>'.format(
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
89 metadata["history_user_email"]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
90 )
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
91 metadata[
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
92 "history_display_name"
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
93 ] = '<a target="_blank" href="{galaxy}/history/view/{encoded_hist_id}">{hist_name}</a>'.format(
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
94 galaxy=GALAXY_INFRASTRUCTURE_URL,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
95 encoded_hist_id=metadata["history_id"],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
96 hist_name=metadata["history_display_name"],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
97 )
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
98 metadata[
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
99 "tool_tool"
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
100 ] = '<a target="_blank" href="{galaxy}/datasets/{encoded_id}/show_params">{tool_id}</a>'.format(
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
101 galaxy=GALAXY_INFRASTRUCTURE_URL,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
102 encoded_id=metadata["dataset_id"],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
103 tool_id=metadata["tool_tool_id"],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
104 # tool_version=metadata['tool_tool_version'],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
105 )
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
106
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
107 # Load additional metadata from a TSV file if any given by user
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
108 bonus = node.findall("bonus")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
109 if bonus and "src" in bonus[0].attrib and bonus[0].attrib["src"]:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
110 with open(bonus[0].attrib["src"], "r") as bonus_tsv:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
111 bonus_content = csv.reader(bonus_tsv, delimiter="\t", quotechar='"')
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
112 for row in bonus_content:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
113 if len(row) == 2:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
114 if row[0] in metadata:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
115 log.warning(f"Overwriting existing metadata {row[0]} with value from bonus file {row[1]}")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
116 metadata[row[0]] = row[1]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
117 else:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
118 log.warning(f"Skipping invalid bonus metadata line: {row}")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
119
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
120 return metadata
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
121
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
122
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
123 class JbrowseConnector(object):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
124 def __init__(self, jbrowse, outdir, update):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
125 self.jbrowse = jbrowse
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
126 self.outdir = outdir
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
127 self.update = update
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
128
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
129 self.tracksToIndex = {}
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
130
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
131 # This is the id of the current assembly
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
132 self.assembly_ids = {}
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
133
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
134 self.default_views = {}
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
135
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
136 self.plugins = []
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
137
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
138 self.use_synteny_viewer = False
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
139
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
140 self.synteny_tracks = []
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
141
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
142 self.clone_jbrowse(self.jbrowse, self.outdir)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
143
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
144 # If upgrading, look at the existing data
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
145 self.check_existing(self.outdir)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
146
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
147 def get_cwd(self, cwd):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
148 if cwd:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
149 return self.outdir
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
150 else:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
151 return subprocess.check_output(['pwd']).decode('utf-8').strip()
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
152 # return None
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
153
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
154 def subprocess_check_call(self, command, output=None, cwd=True):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
155 if output:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
156 log.debug(f"cd {self.get_cwd(cwd)} && {' '.join(command)} > {output.name}")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
157 subprocess.check_call(command, cwd=self.get_cwd(cwd), stdout=output)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
158 else:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
159 log.debug(f"cd {self.get_cwd(cwd)} && {' '.join(command)}")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
160 subprocess.check_call(command, cwd=self.get_cwd(cwd))
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
161
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
162 def subprocess_popen(self, command, cwd=True):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
163 log.debug(f"cd {self.get_cwd(cwd)} && {command}")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
164 p = subprocess.Popen(
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
165 command,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
166 cwd=self.get_cwd(cwd),
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
167 shell=True,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
168 stdin=subprocess.PIPE,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
169 stdout=subprocess.PIPE,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
170 stderr=subprocess.PIPE,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
171 )
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
172 output, err = p.communicate()
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
173 retcode = p.returncode
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
174 if retcode != 0:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
175 log.error(f"cd {self.get_cwd(cwd)} && {command}")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
176 log.error(output)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
177 log.error(err)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
178 raise RuntimeError(f"Command failed with exit code {retcode}")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
179
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
180 def subprocess_check_output(self, command, cwd=True):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
181 log.debug(f"cd {self.get_cwd(cwd)} && {' '.join(command)}")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
182 return subprocess.check_output(command, cwd=self.get_cwd(cwd))
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
183
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
184 def symlink_or_copy(self, src, dest):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
185 # Use to support symlinking in jbrowse1, in jbrowse2 prefer to use remote uri
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
186 cmd = ["cp", src, dest]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
187
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
188 return self.subprocess_check_call(cmd)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
189
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
190 def _prepare_track_style(self, xml_conf):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
191 style_data = {
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
192 "type": "LinearBasicDisplay", # No ideal default, but should be overwritten anyway
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
193 }
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
194
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
195 if "display" in xml_conf["style"]:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
196 style_data["type"] = xml_conf["style"]["display"]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
197
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
198 style_data["displayId"] = f"{xml_conf['label']}_{style_data['type']}"
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
199
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
200 style_data.update(self._prepare_renderer_config(style_data["type"], xml_conf["style"]))
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
201
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
202 return {"displays": [style_data]}
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
203
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
204 def _prepare_renderer_config(self, display_type, xml_conf):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
205
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
206 style_data = {}
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
207
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
208 # if display_type in ("LinearBasicDisplay", "LinearVariantDisplay"):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
209 # TODO LinearVariantDisplay does not understand these options when written in config.json
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
210 if display_type in ("LinearBasicDisplay"):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
211
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
212 # Doc: https://jbrowse.org/jb2/docs/config/svgfeaturerenderer/
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
213 style_data["renderer"] = {
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
214 "type": "SvgFeatureRenderer",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
215 "showLabels": xml_conf.get("show_labels", True),
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
216 "showDescriptions": xml_conf.get("show_descriptions", True),
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
217 "labels": {
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
218 "name": xml_conf.get("labels_name", "jexl:get(feature,'name') || get(feature,'id')"),
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
219 "description": xml_conf.get("descriptions_name", "jexl:get(feature,'note') || get(feature,'description')")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
220 },
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
221 "displayMode": xml_conf.get("display_mode", "normal"),
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
222 "maxHeight": xml_conf.get("max_height", 1200),
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
223 }
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
224
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
225 elif display_type == "LinearArcDisplay":
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
226
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
227 # Doc: https://jbrowse.org/jb2/docs/config/arcrenderer/
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
228 style_data["renderer"] = {
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
229 "type": "ArcRenderer",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
230 "label": xml_conf.get("labels_name", "jexl:get(feature,'score')"),
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
231 "displayMode": xml_conf.get("display_mode", "arcs"),
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
232 }
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
233
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
234 elif display_type == "LinearWiggleDisplay":
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
235
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
236 wig_renderer = xml_conf.get("renderer", "xyplot")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
237 style_data["defaultRendering"] = wig_renderer
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
238
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
239 elif display_type == "MultiLinearWiggleDisplay":
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
240
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
241 wig_renderer = xml_conf.get("renderer", "multirowxy")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
242 style_data["defaultRendering"] = wig_renderer
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
243
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
244 elif display_type == "LinearSNPCoverageDisplay":
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
245
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
246 # Does not work
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
247 # style_data["renderer"] = {
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
248 # "type": "SNPCoverageRenderer",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
249 # "displayCrossHatches": xml_conf.get("display_cross_hatches", True),
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
250 # }
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
251
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
252 style_data["scaleType"] = xml_conf.get("scale_type", "linear")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
253 if "min_score" in xml_conf:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
254 style_data["minScore"] = xml_conf["min_score"]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
255
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
256 if "max_score" in xml_conf:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
257 style_data["maxScore"] = xml_conf["max_score"]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
258
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
259 # Doc: https://jbrowse.org/jb2/docs/config/snpcoveragerenderer/
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
260
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
261 return style_data
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
262
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
263 def _prepare_format_details(self, xml_conf):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
264 formatDetails = {
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
265 }
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
266
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
267 if "feature" in xml_conf["formatdetails"]:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
268 feat_jexl = xml_conf["formatdetails"]["feature"]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
269 for key, value in mapped_chars.items():
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
270 feat_jexl = feat_jexl.replace(value, key)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
271 formatDetails["feature"] = feat_jexl
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
272
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
273 if "subfeature" in xml_conf["formatdetails"]:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
274 sfeat_jexl = xml_conf["formatdetails"]["subfeature"]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
275 for key, value in mapped_chars.items():
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
276 sfeat_jexl = sfeat_jexl.replace(value, key)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
277 formatDetails["subfeatures"] = sfeat_jexl
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
278
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
279 if "depth" in xml_conf["formatdetails"]:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
280 formatDetails["depth"] = int(xml_conf["formatdetails"]["depth"])
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
281
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
282 return {"formatDetails": formatDetails}
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
283
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
284 def _prepare_track_metadata(self, xml_conf):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
285 metadata = {
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
286 }
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
287
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
288 metadata = xml_conf["metadata"]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
289
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
290 return {"metadata": metadata}
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
291
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
292 def check_existing(self, destination):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
293 existing = os.path.join(destination, "config.json")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
294 if os.path.exists(existing):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
295 with open(existing, "r") as existing_conf:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
296 conf = json.load(existing_conf)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
297 if "assemblies" in conf:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
298 for assembly in conf["assemblies"]:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
299 if "name" in assembly:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
300
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
301 # Look for a default scaffold
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
302 default_seq = None
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
303 if 'defaultSession' in conf and 'views' in conf['defaultSession']:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
304 for view in conf['defaultSession']['views']:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
305 if 'init' in view and 'assembly' in view['init'] and 'loc' in view['init']:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
306 if view['init']['assembly'] == assembly["name"]:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
307 default_seq = view['init']['loc'].split(":")[0]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
308 if "views" in view:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
309 subviews = view["views"]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
310 for subview in subviews:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
311 if 'init' in subview and 'assembly' in subview['init'] and 'loc' in subview['init']:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
312 if subview['init']['assembly'] == assembly["name"]:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
313 default_seq = subview['init']['loc'].split(":")[0]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
314
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
315 self.assembly_ids[assembly["name"]] = default_seq
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
316
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
317 def _load_old_genome_views(self):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
318
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
319 views = {}
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
320
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
321 config_path = os.path.join(self.outdir, "config.json")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
322 with open(config_path, "r") as config_file:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
323 config_json = json.load(config_file)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
324
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
325 # Find default synteny views existing from a previous jbrowse dataset
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
326 if 'defaultSession' in config_json and 'views' in config_json['defaultSession']:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
327 for view in config_json['defaultSession']['views']:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
328 if view['type'] != "LinearSyntenyView":
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
329 if 'init' in view and 'assembly' in view['init']:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
330 views[view['init']['assembly']] = view
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
331
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
332 return views
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
333
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
334 def _load_old_synteny_views(self):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
335
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
336 views = []
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
337
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
338 config_path = os.path.join(self.outdir, "config.json")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
339 with open(config_path, "r") as config_file:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
340 config_json = json.load(config_file)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
341
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
342 # Find default synteny views existing from a previous jbrowse dataset
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
343 if 'defaultSession' in config_json and 'views' in config_json['defaultSession']:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
344 for view in config_json['defaultSession']['views']:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
345 if view['type'] == "LinearSyntenyView":
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
346 views.append(view)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
347
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
348 return views
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
349
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
350 def add_assembly(self, path, label, is_remote=False, cytobands=None, ref_name_aliases=None):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
351
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
352 if not is_remote:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
353 # Find a non-existing filename for the new genome
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
354 # (to avoid colision when upgrading an existing instance)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
355 rel_seq_path = os.path.join("data", label)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
356 seq_path = os.path.join(self.outdir, rel_seq_path)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
357 fn_try = 1
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
358 while (
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
359 os.path.exists(seq_path + ".fasta")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
360 or os.path.exists(seq_path + ".fasta.gz")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
361 or os.path.exists(seq_path + ".fasta.gz.fai")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
362 or os.path.exists(seq_path + ".fasta.gz.gzi")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
363 ):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
364 rel_seq_path = os.path.join("data", f"{label}{fn_try}")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
365 seq_path = os.path.join(self.outdir, rel_seq_path)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
366 fn_try += 1
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
367
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
368 # Check if the assembly already exists from a previous run (--update mode)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
369 if self.update:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
370
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
371 config_path = os.path.join(self.outdir, "config.json")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
372 with open(config_path, "r") as config_file:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
373 config_json = json.load(config_file)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
374
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
375 for asby in config_json['assemblies']:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
376 if asby['name'] == label:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
377
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
378 # Find default views existing for this assembly
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
379 if 'defaultSession' in config_json and 'views' in config_json['defaultSession']:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
380 for view in config_json['defaultSession']['views']:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
381 if 'init' in view and 'assembly' in view['init']:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
382 if view['init']['assembly'] == label:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
383
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
384 log.info("Found existing assembly from existing JBrowse2 instance, preserving it")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
385
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
386 self.default_views[view['init']['assembly']] = view
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
387
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
388 return label
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
389
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
390 # Copy ref alias file if any
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
391 if ref_name_aliases:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
392 copied_ref_name_aliases = seq_path + ".aliases"
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
393 shutil.copy(ref_name_aliases, copied_ref_name_aliases)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
394 copied_ref_name_aliases = rel_seq_path + ".aliases"
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
395
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
396 # Copy cytobands file if any
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
397 if cytobands:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
398 copied_cytobands = seq_path + ".cytobands"
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
399 shutil.copy(cytobands, copied_cytobands)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
400 copied_cytobands = rel_seq_path + ".cytobands"
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
401
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
402 # Find a non-existing label for the new genome
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
403 # (to avoid colision when upgrading an existing instance)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
404 lab_try = 1
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
405 uniq_label = label
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
406 while uniq_label in self.assembly_ids:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
407 uniq_label = label + str(lab_try)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
408 lab_try += 1
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
409
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
410 if is_remote:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
411
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
412 # Find a default scaffold to display
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
413 with requests.get(path + ".fai", stream=True) as response:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
414 response.raise_for_status()
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
415 first_seq = next(response.iter_lines())
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
416 first_seq = first_seq.decode("utf-8").split('\t')[0]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
417
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
418 self.assembly_ids[uniq_label] = first_seq
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
419
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
420 # We assume we just need to suffix url with .fai and .gzi for indexes.
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
421 cmd_jb = [
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
422 "jbrowse",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
423 "add-assembly",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
424 "--name",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
425 uniq_label,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
426 "--type",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
427 "bgzipFasta",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
428 "--out",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
429 self.outdir,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
430 "--skipCheck",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
431 ]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
432
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
433 if ref_name_aliases:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
434 cmd_jb.extend([
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
435 "--refNameAliases",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
436 copied_ref_name_aliases,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
437 ])
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
438
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
439 cmd_jb.append(path) # Path is an url in remote mode
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
440
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
441 self.subprocess_check_call(cmd_jb)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
442 else:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
443 # Find a default scaffold to display
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
444 with open(path, "r") as fa_handle:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
445 fa_header = fa_handle.readline()[1:].strip().split(" ")[0]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
446
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
447 self.assembly_ids[uniq_label] = fa_header
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
448
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
449 copied_genome = seq_path + ".fasta"
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
450 shutil.copy(path, copied_genome)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
451
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
452 # Compress with bgzip
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
453 cmd = ["bgzip", copied_genome]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
454 self.subprocess_check_call(cmd)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
455
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
456 # FAI Index
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
457 cmd = ["samtools", "faidx", copied_genome + ".gz"]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
458 self.subprocess_check_call(cmd)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
459
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
460 cmd_jb = [
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
461 "jbrowse",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
462 "add-assembly",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
463 "--load",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
464 "inPlace",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
465 "--name",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
466 uniq_label,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
467 "--type",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
468 "bgzipFasta",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
469 "--out",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
470 self.outdir,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
471 "--skipCheck",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
472 ]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
473
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
474 if ref_name_aliases:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
475 cmd_jb.extend([
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
476 "--refNameAliases",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
477 copied_ref_name_aliases,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
478 ])
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
479
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
480 cmd_jb.append(rel_seq_path + ".fasta.gz")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
481
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
482 self.subprocess_check_call(cmd_jb)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
483
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
484 if cytobands:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
485 self.add_cytobands(uniq_label, copied_cytobands)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
486
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
487 return uniq_label
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
488
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
489 def add_cytobands(self, assembly_name, cytobands_path):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
490
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
491 config_path = os.path.join(self.outdir, "config.json")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
492 with open(config_path, "r") as config_file:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
493 config_json = json.load(config_file)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
494
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
495 config_data = {}
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
496
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
497 config_data["cytobands"] = {
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
498 "adapter": {
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
499 "type": "CytobandAdapter",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
500 "cytobandLocation": {
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
501 "uri": cytobands_path
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
502 }
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
503 }
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
504 }
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
505
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
506 filled_assemblies = []
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
507 for assembly in config_json["assemblies"]:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
508 if assembly["name"] == assembly_name:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
509 assembly.update(config_data)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
510 filled_assemblies.append(assembly)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
511 config_json["assemblies"] = filled_assemblies
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
512
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
513 with open(config_path, "w") as config_file:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
514 json.dump(config_json, config_file, indent=2)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
515
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
516 def text_index(self):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
517
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
518 for ass in self.tracksToIndex:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
519 tracks = self.tracksToIndex[ass]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
520 args = [
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
521 "jbrowse",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
522 "text-index",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
523 "--target",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
524 self.outdir,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
525 "--assemblies",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
526 ass,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
527 ]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
528
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
529 tracks = ",".join(tracks)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
530 if tracks:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
531 args += ["--tracks", tracks]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
532
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
533 log.info(f"-----> Running text-index on assembly {ass} and tracks {tracks}")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
534
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
535 # Only run index if we want to index at least one
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
536 # If --tracks is not specified, it will index everything
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
537 self.subprocess_check_call(args)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
538
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
539 def add_gc_content(self, parent, trackData, **kwargs):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
540
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
541 adapter = {}
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
542 existing = os.path.join(self.outdir, "config.json")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
543 if os.path.exists(existing):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
544 with open(existing, "r") as existing_conf:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
545 conf = json.load(existing_conf)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
546 if "assemblies" in conf:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
547 for assembly in conf["assemblies"]:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
548 if assembly.get('name', "") == parent['uniq_id']:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
549 adapter = assembly.get('sequence', {}).get('adapter', {})
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
550
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
551 json_track_data = {
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
552 "type": "GCContentTrack",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
553 "trackId": trackData["label"],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
554 "name": trackData["key"],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
555 "adapter": adapter,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
556 "category": [trackData["category"]],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
557 "assemblyNames": [parent['uniq_id']],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
558 }
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
559
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
560 style_json = self._prepare_track_style(trackData)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
561
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
562 json_track_data.update(style_json)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
563
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
564 self.subprocess_check_call(
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
565 [
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
566 "jbrowse",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
567 "add-track-json",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
568 "--target",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
569 self.outdir,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
570 json.dumps(json_track_data),
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
571 ]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
572 )
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
573
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
574 def add_bigwig(self, parent, data, trackData, wiggleOpts, **kwargs):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
575
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
576 if trackData['remote']:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
577 rel_dest = data
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
578 else:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
579 rel_dest = os.path.join("data", trackData["label"] + ".bw")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
580 dest = os.path.join(self.outdir, rel_dest)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
581 self.symlink_or_copy(os.path.realpath(data), dest)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
582
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
583 style_json = self._prepare_track_style(trackData)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
584
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
585 track_metadata = self._prepare_track_metadata(trackData)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
586
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
587 style_json.update(track_metadata)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
588
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
589 self._add_track(
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
590 trackData["label"],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
591 trackData["key"],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
592 trackData["category"],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
593 rel_dest,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
594 parent,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
595 config=style_json,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
596 remote=trackData['remote']
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
597 )
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
598
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
599 def add_bigwig_multi(self, parent, data_files, trackData, wiggleOpts, **kwargs):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
600
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
601 subadapters = []
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
602
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
603 sub_num = 0
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
604 for data in data_files:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
605 if trackData['remote']:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
606 rel_dest = data[1]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
607 else:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
608 rel_dest = os.path.join("data", f"{trackData['label']}_sub{sub_num}.bw")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
609 dest = os.path.join(self.outdir, rel_dest)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
610 self.symlink_or_copy(os.path.realpath(data[1]), dest)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
611
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
612 subadapters.append({
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
613 "type": "BigWigAdapter",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
614 "name": data[0],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
615 "bigWigLocation": {
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
616 "uri": rel_dest,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
617 "locationType": "UriLocation"
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
618 }
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
619 })
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
620 sub_num += 1
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
621
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
622 json_track_data = {
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
623 "type": "MultiQuantitativeTrack",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
624 "trackId": trackData["label"],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
625 "name": trackData["key"],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
626 "adapter": {
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
627 "type": "MultiWiggleAdapter",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
628 "subadapters": subadapters
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
629 },
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
630 "category": [trackData["category"]],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
631 "assemblyNames": [parent['uniq_id']],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
632 }
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
633
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
634 style_json = self._prepare_track_style(trackData)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
635
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
636 json_track_data.update(style_json)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
637
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
638 track_metadata = self._prepare_track_metadata(trackData)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
639
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
640 json_track_data.update(track_metadata)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
641
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
642 self.subprocess_check_call(
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
643 [
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
644 "jbrowse",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
645 "add-track-json",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
646 "--target",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
647 self.outdir,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
648 json.dumps(json_track_data),
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
649 ]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
650 )
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
651
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
652 # Anything ending in "am" (Bam or Cram)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
653 def add_xam(self, parent, data, trackData, xamOpts, index=None, ext="bam", **kwargs):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
654 index_ext = "bai"
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
655 if ext == "cram":
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
656 index_ext = "crai"
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
657
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
658 if trackData['remote']:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
659 rel_dest = data
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
660 # Index will be set automatically as xam url + xai .suffix by add-track cmd
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
661 else:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
662 rel_dest = os.path.join("data", trackData["label"] + f".{ext}")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
663 dest = os.path.join(self.outdir, rel_dest)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
664 self.symlink_or_copy(os.path.realpath(data), dest)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
665
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
666 if index is not None and os.path.exists(os.path.realpath(index)):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
667 # xai most probably made by galaxy and stored in galaxy dirs, need to copy it to dest
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
668 self.subprocess_check_call(
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
669 ["cp", os.path.realpath(index), dest + f".{index_ext}"]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
670 )
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
671 else:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
672 # Can happen in exotic condition
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
673 # e.g. if bam imported as symlink with datatype=unsorted.bam, then datatype changed to bam
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
674 # => no index generated by galaxy, but there might be one next to the symlink target
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
675 # this trick allows to skip the bam sorting made by galaxy if already done outside
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
676 if os.path.exists(os.path.realpath(data) + f".{index_ext}"):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
677 self.symlink_or_copy(
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
678 os.path.realpath(data) + f".{index_ext}", dest + f".{index_ext}"
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
679 )
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
680 else:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
681 log.warn(
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
682 f"Could not find a bam index (.{index_ext} file) for {data}"
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
683 )
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
684
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
685 style_json = self._prepare_track_style(trackData)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
686
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
687 track_metadata = self._prepare_track_metadata(trackData)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
688
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
689 style_json.update(track_metadata)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
690
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
691 self._add_track(
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
692 trackData["label"],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
693 trackData["key"],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
694 trackData["category"],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
695 rel_dest,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
696 parent,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
697 config=style_json,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
698 remote=trackData['remote']
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
699 )
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
700
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
701 def add_vcf(self, parent, data, trackData, vcfOpts={}, zipped=False, **kwargs):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
702 if trackData['remote']:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
703 rel_dest = data
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
704 else:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
705 if zipped:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
706 rel_dest = os.path.join("data", trackData["label"] + ".vcf.gz")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
707 dest = os.path.join(self.outdir, rel_dest)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
708 shutil.copy(os.path.realpath(data), dest)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
709 else:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
710 rel_dest = os.path.join("data", trackData["label"] + ".vcf")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
711 dest = os.path.join(self.outdir, rel_dest)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
712 shutil.copy(os.path.realpath(data), dest)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
713
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
714 cmd = ["bgzip", dest]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
715 self.subprocess_check_call(cmd)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
716 cmd = ["tabix", dest + ".gz"]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
717 self.subprocess_check_call(cmd)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
718
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
719 rel_dest = os.path.join("data", trackData["label"] + ".vcf.gz")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
720
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
721 style_json = self._prepare_track_style(trackData)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
722
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
723 formatdetails = self._prepare_format_details(trackData)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
724
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
725 style_json.update(formatdetails)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
726
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
727 track_metadata = self._prepare_track_metadata(trackData)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
728
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
729 style_json.update(track_metadata)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
730
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
731 self._add_track(
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
732 trackData["label"],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
733 trackData["key"],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
734 trackData["category"],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
735 rel_dest,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
736 parent,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
737 config=style_json,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
738 remote=trackData['remote']
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
739 )
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
740
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
741 def add_gff(self, parent, data, format, trackData, gffOpts, **kwargs):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
742 if trackData['remote']:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
743 rel_dest = data
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
744 else:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
745 rel_dest = os.path.join("data", trackData["label"] + ".gff")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
746 dest = os.path.join(self.outdir, rel_dest)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
747 rel_dest = rel_dest + ".gz"
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
748
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
749 self._sort_gff(data, dest)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
750
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
751 style_json = self._prepare_track_style(trackData)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
752
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
753 formatdetails = self._prepare_format_details(trackData)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
754
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
755 style_json.update(formatdetails)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
756
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
757 track_metadata = self._prepare_track_metadata(trackData)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
758
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
759 style_json.update(track_metadata)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
760
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
761 if gffOpts.get('index', 'false') in ("yes", "true", "True"):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
762 if parent['uniq_id'] not in self.tracksToIndex:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
763 self.tracksToIndex[parent['uniq_id']] = []
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
764 self.tracksToIndex[parent['uniq_id']].append(trackData["label"])
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
765
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
766 self._add_track(
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
767 trackData["label"],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
768 trackData["key"],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
769 trackData["category"],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
770 rel_dest,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
771 parent,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
772 config=style_json,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
773 remote=trackData['remote']
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
774 )
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
775
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
776 def add_bed(self, parent, data, format, trackData, gffOpts, **kwargs):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
777 if trackData['remote']:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
778 rel_dest = data
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
779 else:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
780 rel_dest = os.path.join("data", trackData["label"] + ".bed")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
781 dest = os.path.join(self.outdir, rel_dest)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
782 rel_dest = rel_dest + ".gz"
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
783
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
784 self._sort_bed(data, dest)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
785
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
786 style_json = self._prepare_track_style(trackData)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
787
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
788 formatdetails = self._prepare_format_details(trackData)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
789
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
790 style_json.update(formatdetails)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
791
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
792 track_metadata = self._prepare_track_metadata(trackData)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
793
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
794 style_json.update(track_metadata)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
795
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
796 if gffOpts.get('index', 'false') in ("yes", "true", "True"):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
797 if parent['uniq_id'] not in self.tracksToIndex:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
798 self.tracksToIndex[parent['uniq_id']] = []
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
799 self.tracksToIndex[parent['uniq_id']].append(trackData["label"])
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
800
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
801 self._add_track(
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
802 trackData["label"],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
803 trackData["key"],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
804 trackData["category"],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
805 rel_dest,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
806 parent,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
807 config=style_json,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
808 remote=trackData['remote']
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
809 )
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
810
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
811 def add_paf(self, parent, data, trackData, pafOpts, **kwargs):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
812
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
813 if trackData['remote']:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
814 rel_dest = data
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
815
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
816 if rel_dest.endswith('pif') or rel_dest.endswith('pif.gz'):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
817 adapter = "pif"
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
818 else:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
819 adapter = "paf"
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
820 else:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
821 rel_dest = os.path.join("data", trackData["label"] + ".pif.gz")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
822 dest = os.path.join(self.outdir, rel_dest)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
823
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
824 cmd = ["jbrowse", "make-pif", "--out", dest, os.path.realpath(data)]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
825 self.subprocess_check_call(cmd)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
826
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
827 adapter = "pif"
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
828
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
829 if trackData["style"]["display"] == "LinearBasicDisplay":
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
830 # Normal style track
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
831
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
832 json_track_data = {
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
833 "type": "SyntenyTrack",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
834 "trackId": trackData["label"],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
835 "name": trackData["key"],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
836 "adapter": {
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
837 "type": "PairwiseIndexedPAFAdapter",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
838 "pifGzLocation": {
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
839 "uri": rel_dest,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
840 },
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
841 "index": {
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
842 "location": {
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
843 "uri": rel_dest + ".tbi",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
844 }
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
845 },
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
846 },
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
847 "category": [trackData["category"]],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
848 "assemblyNames": [parent['uniq_id']],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
849 }
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
850 else:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
851 # Synteny viewer
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
852
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
853 json_track_data = {
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
854 "type": "SyntenyTrack",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
855 "trackId": trackData["label"],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
856 "name": trackData["key"],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
857 "adapter": {
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
858 "assemblyNames": [
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
859 parent['uniq_id'],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
860 "", # Placeholder until we know the next genome id
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
861 ],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
862 },
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
863 "category": [trackData["category"]],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
864 "assemblyNames": [
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
865 parent['uniq_id'],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
866 "", # Placeholder until we know the next genome id
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
867 ]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
868 }
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
869
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
870 if adapter == "pif":
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
871 json_track_data["adapter"].update({
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
872 "type": "PairwiseIndexedPAFAdapter",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
873 "pifGzLocation": {
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
874 "uri": rel_dest,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
875 },
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
876 "index": {
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
877 "location": {
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
878 "uri": rel_dest + ".tbi",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
879 }
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
880 },
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
881 })
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
882 else:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
883 json_track_data["adapter"].update({
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
884 "type": "PAFAdapter",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
885 "pafLocation": {
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
886 "uri": rel_dest,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
887 },
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
888 })
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
889
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
890 style_json = self._prepare_track_style(trackData)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
891
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
892 json_track_data.update(style_json)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
893
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
894 track_metadata = self._prepare_track_metadata(trackData)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
895
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
896 json_track_data.update(track_metadata)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
897
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
898 if trackData["style"]["display"] == "LinearBasicDisplay":
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
899 self.subprocess_check_call(
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
900 [
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
901 "jbrowse",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
902 "add-track-json",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
903 "--target",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
904 self.outdir,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
905 json.dumps(json_track_data),
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
906 ]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
907 )
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
908 else:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
909 self.synteny_tracks.append(json_track_data)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
910
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
911 def add_hic(self, parent, data, trackData, hicOpts, **kwargs):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
912 if trackData['remote']:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
913 rel_dest = data
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
914 else:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
915 rel_dest = os.path.join("data", trackData["label"] + ".hic")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
916 dest = os.path.join(self.outdir, rel_dest)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
917 self.symlink_or_copy(os.path.realpath(data), dest)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
918
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
919 style_json = self._prepare_track_style(trackData)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
920
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
921 track_metadata = self._prepare_track_metadata(trackData)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
922
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
923 style_json.update(track_metadata)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
924
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
925 self._add_track(
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
926 trackData["label"],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
927 trackData["key"],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
928 trackData["category"],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
929 rel_dest,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
930 parent,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
931 config=style_json,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
932 remote=trackData['remote']
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
933 )
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
934
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
935 def add_maf(self, parent, data, trackData, mafOpts, **kwargs):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
936
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
937 # Add needed plugin
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
938 plugin_def = {
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
939 "name": "MafViewer",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
940 "url": "https://unpkg.com/jbrowse-plugin-mafviewer/dist/jbrowse-plugin-mafviewer.umd.production.min.js"
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
941 }
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
942 self.plugins.append(plugin_def)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
943
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
944 rel_dest = os.path.join("data", trackData["label"] + ".maf")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
945 dest = os.path.join(self.outdir, rel_dest)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
946
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
947 assembly_name = mafOpts.get("assembly_name", "")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
948 if not assembly_name:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
949 # Guess from assembly
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
950 assembly_name = parent['uniq_id']
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
951
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
952 self._convert_maf(data, dest, assembly_name)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
953
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
954 # Extract samples list
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
955 mafs = open(data, "r").readlines()
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
956 mafss = [x for x in mafs if (x.startswith("s\t") or x.startswith("s "))]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
957 samp = [x.split()[1] for x in mafss if len(x.split()) > 0]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
958 sampu = list(dict.fromkeys(samp))
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
959 samples = [x.split(".")[0] for x in sampu]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
960 samples.sort()
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
961
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
962 json_track_data = {
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
963 "type": "MafTrack",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
964 "trackId": trackData["label"],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
965 "name": trackData["key"],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
966 "adapter": {
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
967 "type": "MafTabixAdapter",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
968 "samples": samples,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
969 "bedGzLocation": {
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
970 "uri": rel_dest + ".gz",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
971 },
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
972 "index": {
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
973 "location": {
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
974 "uri": rel_dest + ".gz.tbi",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
975 },
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
976 },
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
977 },
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
978 "category": [trackData["category"]],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
979 "assemblyNames": [parent['uniq_id']],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
980 }
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
981
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
982 style_json = self._prepare_track_style(trackData)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
983
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
984 json_track_data.update(style_json)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
985
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
986 track_metadata = self._prepare_track_metadata(trackData)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
987
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
988 json_track_data.update(track_metadata)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
989
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
990 self.subprocess_check_call(
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
991 [
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
992 "jbrowse",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
993 "add-track-json",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
994 "--target",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
995 self.outdir,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
996 json.dumps(json_track_data),
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
997 ]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
998 )
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
999
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1000 def add_sparql(self, parent, url, query, query_refnames, trackData):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1001 json_track_data = {
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1002 "type": "FeatureTrack",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1003 "trackId": trackData["label"],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1004 "name": trackData["key"],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1005 "adapter": {
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1006 "type": "SPARQLAdapter",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1007 "endpoint": {"uri": url, "locationType": "UriLocation"},
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1008 "queryTemplate": query,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1009 },
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1010 "category": [trackData["category"]],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1011 "assemblyNames": [parent['uniq_id']],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1012 }
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1013
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1014 if query_refnames:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1015 json_track_data["adapter"]["refNamesQueryTemplate"]: query_refnames
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1016
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1017 # TODO handle metadata somehow for sparql too
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1018
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1019 self.subprocess_check_call(
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1020 [
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1021 "jbrowse",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1022 "add-track-json",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1023 "--target",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1024 self.outdir,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1025 json.dumps(json_track_data),
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1026 ]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1027 )
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1028
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1029 def _add_track(self, track_id, label, category, path, assembly, config=None, trackType=None, load_action="inPlace", assemblies=None, remote=False):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1030 """
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1031 Adds a track to config.json using Jbrowse add-track cli
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1032
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1033 By default, using `--load inPlace`: the file is supposed to be already placed at the `path` relative to
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1034 the outdir, `jbrowse add-track` will not touch it and trust us that the file is there and ready to use.
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1035
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1036 With `load_action` parameter, you can ask `jbrowse add-track` to copy/move/symlink the file for you.
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1037 Not done by default because we often need more control on file copying/symlink for specific cases (indexes, symlinks of symlinks, ...)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1038 """
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1039
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1040 cmd = [
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1041 "jbrowse",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1042 "add-track",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1043 "--name",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1044 label,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1045 "--category",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1046 category,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1047 "--target",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1048 self.outdir,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1049 "--trackId",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1050 track_id,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1051 "--assemblyNames",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1052 assemblies if assemblies else assembly['uniq_id'],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1053 ]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1054
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1055 if not remote:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1056 cmd.append("--load")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1057 cmd.append(load_action)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1058
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1059 if config:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1060 cmd.append("--config")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1061 cmd.append(json.dumps(config))
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1062
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1063 if trackType:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1064 cmd.append("--trackType")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1065 cmd.append(trackType)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1066
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1067 cmd.append(path)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1068
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1069 self.subprocess_check_call(cmd)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1070
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1071 def _sort_gff(self, data, dest):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1072 # Only index if not already done
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1073 if not os.path.exists(dest):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1074 # Not using jbrowse sort-gff because it uses sort and has the problem exposed on https://github.com/tao-bioinfo/gff3sort
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1075 cmd = f"gff3sort.pl --precise '{data}' | grep -v \"^$\" > '{dest}'"
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1076 self.subprocess_popen(cmd, cwd=False)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1077
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1078 self.subprocess_check_call(["bgzip", "-f", dest], cwd=False)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1079 self.subprocess_check_call(["tabix", "-f", "-p", "gff", dest + ".gz"], cwd=False)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1080
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1081 def _sort_bed(self, data, dest):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1082 # Only index if not already done
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1083 if not os.path.exists(dest):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1084 cmd = ["sort", "-k1,1", "-k2,2n", data]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1085 with open(dest, "w") as handle:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1086 self.subprocess_check_call(cmd, output=handle)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1087
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1088 self.subprocess_check_call(["bgzip", "-f", dest])
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1089 self.subprocess_check_call(["tabix", "-f", "-p", "bed", dest + ".gz"])
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1090
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1091 def _convert_maf(self, data, dest, assembly_name):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1092 # Only convert if not already done
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1093 if not os.path.exists(dest):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1094
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1095 dest_bed = dest + ".bed"
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1096 cmd = ["python", os.path.join(SELF_LOCATION, "maf2bed.py"), assembly_name, data, dest_bed]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1097 self.subprocess_check_call(cmd, cwd=False)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1098
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1099 cmd = ["sort", "-k1,1", "-k2,2n", dest_bed]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1100 with open(dest, "w") as handle:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1101 self.subprocess_check_call(cmd, output=handle)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1102
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1103 self.subprocess_check_call(["bgzip", "-f", dest], cwd=False)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1104 self.subprocess_check_call(["tabix", "-f", "-p", "bed", dest + ".gz"], cwd=False)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1105
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1106 def process_annotations(self, track, parent):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1107 category = track["category"].replace("__pd__date__pd__", TODAY)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1108
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1109 track_labels = []
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1110
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1111 for i, (
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1112 dataset_path,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1113 dataset_ext,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1114 track_human_label,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1115 extra_metadata,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1116 ) in enumerate(track["trackfiles"]):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1117 # Unsanitize labels (element_identifiers are always sanitized by Galaxy)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1118 for key, value in mapped_chars.items():
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1119 track_human_label = track_human_label.replace(value, key)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1120
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1121 is_multi = type(dataset_path) is list
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1122
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1123 log.info(
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1124 f"-----> Processing track {category} / {track_human_label} ({dataset_ext}, {len(dataset_path) if is_multi else 1} files)"
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1125 )
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1126
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1127 outputTrackConfig = {
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1128 "category": category,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1129 }
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1130
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1131 outputTrackConfig["key"] = track_human_label
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1132 # We add extra data to hash for the case of non-file tracks
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1133 if (
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1134 "conf" in track
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1135 and "options" in track["conf"]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1136 and "url" in track["conf"]["options"]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1137 ):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1138 non_file_info = track["conf"]["options"]["url"]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1139 else:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1140 non_file_info = ""
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1141
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1142 # I chose to use track['category'] instead of 'category' here. This
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1143 # is intentional. This way re-running the tool on a different date
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1144 # will not generate different hashes and make comparison of outputs
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1145 # much simpler.
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1146 hashData = [
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1147 str(dataset_path),
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1148 track_human_label,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1149 track["category"],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1150 non_file_info,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1151 parent["uniq_id"],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1152 ]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1153 hashData = "|".join(hashData).encode("utf-8")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1154 outputTrackConfig["label"] = hashlib.md5(hashData).hexdigest() + f"_{track['track_num']}_{i}"
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1155 outputTrackConfig["metadata"] = extra_metadata
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1156
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1157 outputTrackConfig["style"] = track["style"]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1158
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1159 outputTrackConfig["formatdetails"] = track["formatdetails"]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1160
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1161 outputTrackConfig["remote"] = track["remote"]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1162
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1163 # Guess extension for remote data
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1164 if dataset_ext == "gff,gff3,bed":
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1165 if dataset_path.endswith(".bed") or dataset_path.endswith(".bed.gz"):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1166 dataset_ext = "bed"
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1167 else:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1168 dataset_ext = "gff"
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1169 elif dataset_ext == "vcf,vcf_bgzip":
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1170 if dataset_path.endswith(".vcf.gz"):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1171 dataset_ext = "vcf_bgzip"
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1172 else:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1173 dataset_ext = "vcf"
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1174
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1175 if dataset_ext in ("gff", "gff3"):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1176 self.add_gff(
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1177 parent,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1178 dataset_path,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1179 dataset_ext,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1180 outputTrackConfig,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1181 track["conf"]["options"]["gff"],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1182 )
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1183 elif dataset_ext == "bed":
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1184 self.add_bed(
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1185 parent,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1186 dataset_path,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1187 dataset_ext,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1188 outputTrackConfig,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1189 track["conf"]["options"]["gff"],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1190 )
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1191 elif dataset_ext == "bigwig":
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1192 if is_multi:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1193 self.add_bigwig_multi(
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1194 parent,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1195 dataset_path, outputTrackConfig, track["conf"]["options"]["wiggle"]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1196 )
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1197 else:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1198 self.add_bigwig(
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1199 parent,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1200 dataset_path, outputTrackConfig, track["conf"]["options"]["wiggle"]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1201 )
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1202 elif dataset_ext == "maf":
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1203 self.add_maf(
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1204 parent,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1205 dataset_path, outputTrackConfig, track["conf"]["options"]["maf"]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1206 )
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1207 elif dataset_ext == "bam":
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1208
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1209 if track["remote"]:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1210 bam_index = dataset_path + '.bai'
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1211 else:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1212 real_indexes = track["conf"]["options"]["pileup"]["bam_indices"][
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1213 "bam_index"
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1214 ]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1215 if not isinstance(real_indexes, list):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1216 # <bam_indices>
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1217 # <bam_index>/path/to/a.bam.bai</bam_index>
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1218 # </bam_indices>
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1219 #
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1220 # The above will result in the 'bam_index' key containing a
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1221 # string. If there are two or more indices, the container
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1222 # becomes a list. Fun!
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1223 real_indexes = [real_indexes]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1224
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1225 bam_index = real_indexes[i]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1226
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1227 self.add_xam(
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1228 parent,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1229 dataset_path,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1230 outputTrackConfig,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1231 track["conf"]["options"]["pileup"],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1232 index=bam_index,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1233 ext="bam",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1234 )
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1235 elif dataset_ext == "cram":
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1236
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1237 if track["remote"]:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1238 cram_index = dataset_path + '.crai'
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1239 else:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1240 real_indexes = track["conf"]["options"]["cram"]["cram_indices"][
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1241 "cram_index"
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1242 ]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1243 if not isinstance(real_indexes, list):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1244 # <bam_indices>
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1245 # <bam_index>/path/to/a.bam.bai</bam_index>
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1246 # </bam_indices>
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1247 #
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1248 # The above will result in the 'bam_index' key containing a
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1249 # string. If there are two or more indices, the container
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1250 # becomes a list. Fun!
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1251 real_indexes = [real_indexes]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1252
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1253 cram_index = real_indexes[i]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1254
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1255 self.add_xam(
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1256 parent,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1257 dataset_path,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1258 outputTrackConfig,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1259 track["conf"]["options"]["cram"],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1260 index=cram_index,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1261 ext="cram",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1262 )
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1263 elif dataset_ext == "vcf":
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1264 self.add_vcf(
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1265 parent,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1266 dataset_path,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1267 outputTrackConfig
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1268 )
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1269 elif dataset_ext == "vcf_bgzip":
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1270 self.add_vcf(
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1271 parent,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1272 dataset_path,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1273 outputTrackConfig,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1274 zipped=True
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1275 )
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1276 elif dataset_ext == "paf": # https://fr.wikipedia.org/wiki/Paf_le_chien
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1277 self.add_paf(
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1278 parent,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1279 dataset_path,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1280 outputTrackConfig,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1281 track["conf"]["options"]["synteny"]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1282 )
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1283 elif dataset_ext in ("hic"):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1284 self.add_hic(
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1285 parent,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1286 dataset_path,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1287 outputTrackConfig,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1288 track["conf"]["options"]["hic"]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1289 )
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1290 elif dataset_ext == "sparql":
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1291 sparql_query = track["conf"]["options"]["sparql"]["query"]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1292 for key, value in mapped_chars.items():
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1293 sparql_query = sparql_query.replace(value, key)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1294 sparql_query_refnames = track["conf"]["options"]["sparql"].get("query_refnames", "")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1295 if sparql_query_refnames:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1296 for key, value in mapped_chars.items():
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1297 sparql_query_refnames = sparql_query_refnames.replace(value, key)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1298 self.add_sparql(
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1299 parent,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1300 track["conf"]["options"]["sparql"]["url"],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1301 sparql_query,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1302 sparql_query_refnames,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1303 outputTrackConfig,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1304 )
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1305 elif dataset_ext == "gc":
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1306 self.add_gc_content(
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1307 parent,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1308 outputTrackConfig,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1309 )
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1310 else:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1311 log.error(f"Do not know how to handle {dataset_ext}")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1312
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1313 track_labels.append(outputTrackConfig["label"])
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1314
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1315 # Return non-human label for use in other fields
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1316 return track_labels
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1317
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1318 def add_default_view_genome(self, genome, default_loc, tracks_on):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1319
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1320 refName = ""
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1321 start = end = None
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1322 if default_loc:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1323 loc_match = re.search(r"^(\w+):(\d+)\.+(\d+)$", default_loc)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1324 if loc_match:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1325 refName = loc_match.group(1)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1326 start = int(loc_match.group(2))
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1327 end = int(loc_match.group(3))
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1328
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1329 if not refName and self.assembly_ids[genome['uniq_id']]:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1330 refName = self.assembly_ids[genome['uniq_id']]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1331
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1332 if start and end:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1333 loc_str = f"{refName}:{start}-{end}"
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1334 else:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1335 loc_str = refName
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1336
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1337 # Updating an existing jbrowse instance, merge with pre-existing view
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1338 view_specs = None
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1339 if self.update:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1340 for existing in self.default_views.values():
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1341 if len(existing) and existing["type"] == "LinearGenomeView":
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1342 if existing['init']['assembly'] == genome['uniq_id']:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1343 view_specs = existing
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1344 if loc_str:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1345 view_specs['init']['loc'] = loc_str
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1346 view_specs['init']['tracks'].extend(tracks_on)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1347
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1348 if view_specs is None: # Not updating, or updating from synteny
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1349 view_specs = {
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1350 "type": "LinearGenomeView",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1351 "init": {
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1352 "assembly": genome['uniq_id'],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1353 "loc": loc_str,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1354 "tracks": tracks_on
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1355 }
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1356 }
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1357
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1358 return view_specs
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1359
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1360 def add_default_view_synteny(self, genome_views, synteny_tracks):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1361
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1362 # Add json for cached synteny tracks
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1363 # We cache them because we need to know the target genome uniq_id
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1364 for strack in synteny_tracks:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1365
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1366 # Target assembly is the next genome, find its uniq_id
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1367 query_assembly = strack["assemblyNames"][0]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1368 ass_uniq_ids = list(self.assembly_ids.keys())
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1369 query_index = ass_uniq_ids.index(query_assembly)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1370 target_assembly = ass_uniq_ids[query_index + 1]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1371
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1372 strack["assemblyNames"][1] = target_assembly
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1373 strack["adapter"]["assemblyNames"][1] = target_assembly
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1374
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1375 self.subprocess_check_call(
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1376 [
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1377 "jbrowse",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1378 "add-track-json",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1379 "--target",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1380 self.outdir,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1381 json.dumps(strack),
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1382 ]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1383 )
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1384
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1385 # Configure the synteny view
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1386 levels = []
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1387
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1388 for strack in synteny_tracks:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1389 lev = {
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1390 "type": "LinearSyntenyViewHelper",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1391 "tracks": [
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1392 {
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1393 "type": "SyntenyTrack",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1394 "configuration": strack["trackId"],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1395 "displays": [
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1396 {
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1397 "type": "LinearSyntenyDisplay",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1398 "configuration": strack["trackId"] + "_LinearSyntenyDisplay"
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1399 }
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1400 ]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1401 }
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1402 ],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1403 "height": 100,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1404 "level": len(levels)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1405 }
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1406 levels.append(lev)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1407
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1408 view_specs = {
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1409 "type": "LinearSyntenyView",
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1410 "views": genome_views,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1411 "levels": levels
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1412 }
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1413
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1414 return view_specs
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1415
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1416 def add_default_session(self, default_views):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1417 """
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1418 Add some default session settings: set some assemblies/tracks on/off
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1419
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1420 This allows to select a default view:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1421 - jb type (Linear, Circular, etc)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1422 - default location on an assembly
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1423 - default tracks
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1424 - ...
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1425
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1426 Now using this method:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1427 https://github.com/GMOD/jbrowse-components/pull/4907
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1428
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1429 Different methods that were tested/discussed earlier:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1430 - using a defaultSession item in config.json before PR 4970: this proved to be difficult:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1431 forced to write a full session block, including hard-coded/hard-to-guess items,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1432 no good way to let Jbrowse2 display a scaffold without knowing its size
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1433 - using JBrowse2 as an embedded React component in a tool-generated html file:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1434 it works but it requires generating js code to actually do what we want = chosing default view, assembly, tracks, ...
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1435 - writing a session-spec inside the config.json file: this is not yet supported as of 2.10.2 (see PR 4148 below)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1436 a session-spec is a kind of simplified defaultSession where you don't need to specify every aspect of the session
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1437 - passing a session-spec through URL params by embedding the JBrowse2 index.html inside an iframe
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1438
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1439 Xrefs to understand the choices:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1440 https://github.com/GMOD/jbrowse-components/issues/2708
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1441 https://github.com/GMOD/jbrowse-components/discussions/3568
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1442 https://github.com/GMOD/jbrowse-components/pull/4148
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1443 """
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1444
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1445 if self.use_synteny_viewer:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1446 session_name = "Synteny"
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1447 else:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1448 session_name = ', '.join(x['init']['assembly'] for x in default_views)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1449
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1450 session_spec = {
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1451 "name": session_name,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1452 "views": default_views
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1453 }
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1454
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1455 config_path = os.path.join(self.outdir, "config.json")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1456 with open(config_path, "r") as config_file:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1457 config_json = json.load(config_file)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1458
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1459 config_json["defaultSession"].update(session_spec)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1460
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1461 with open(config_path, "w") as config_file:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1462 json.dump(config_json, config_file, indent=2)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1463
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1464 def add_general_configuration(self, data):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1465 """
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1466 Add some general configuration to the config.json file
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1467 """
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1468
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1469 config_path = os.path.join(self.outdir, "config.json")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1470 with open(config_path, "r") as config_file:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1471 config_json = json.load(config_file)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1472
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1473 config_data = {}
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1474
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1475 config_data["disableAnalytics"] = data.get("analytics", "false") == "true"
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1476
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1477 config_data["theme"] = {
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1478 "palette": {
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1479 "primary": {"main": data.get("primary_color", "#0D233F")},
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1480 "secondary": {"main": data.get("secondary_color", "#721E63")},
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1481 "tertiary": {"main": data.get("tertiary_color", "#135560")},
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1482 "quaternary": {"main": data.get("quaternary_color", "#FFB11D")},
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1483 },
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1484 "typography": {"fontSize": int(data.get("font_size", 10))},
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1485 }
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1486
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1487 config_json["configuration"].update(config_data)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1488
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1489 with open(config_path, "w") as config_file:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1490 json.dump(config_json, config_file, indent=2)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1491
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1492 def add_plugins(self, data):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1493 """
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1494 Add plugins to the config.json file
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1495 """
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1496
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1497 config_path = os.path.join(self.outdir, "config.json")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1498 with open(config_path, "r") as config_file:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1499 config_json = json.load(config_file)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1500
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1501 if "plugins" not in config_json:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1502 config_json["plugins"] = []
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1503
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1504 config_json["plugins"].extend(data)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1505
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1506 with open(config_path, "w") as config_file:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1507 json.dump(config_json, config_file, indent=2)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1508
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1509 def clone_jbrowse(self, jbrowse_dir, destination):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1510 """
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1511 Clone a JBrowse directory into a destination directory.
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1512
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1513 Not using `jbrowse create` command to allow running on internet-less compute + to make sure code is frozen
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1514 """
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1515
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1516 copytree(jbrowse_dir, destination)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1517 try:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1518 shutil.rmtree(os.path.join(destination, "test_data"))
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1519 except OSError as e:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1520 log.error(f"Error: {e.filename} - {e.strerror}.")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1521
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1522 if not os.path.exists(os.path.join(destination, "data")):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1523 # It can already exist if upgrading an instance
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1524 os.makedirs(os.path.join(destination, "data"))
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1525 log.info(f"makedir {os.path.join(destination, 'data')}")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1526
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1527 os.symlink("./data/config.json", os.path.join(destination, "config.json"))
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1528
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1529
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1530 def copytree(src, dst, symlinks=False, ignore=None):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1531 for item in os.listdir(src):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1532 s = os.path.join(src, item)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1533 d = os.path.join(dst, item)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1534 if os.path.isdir(s):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1535 shutil.copytree(s, d, symlinks, ignore)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1536 else:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1537 shutil.copy2(s, d)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1538
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1539
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1540 def parse_style_conf(item):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1541 if "type" in item.attrib and item.attrib["type"] in ["boolean", "integer"]:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1542 if item.attrib["type"] == "boolean":
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1543 return item.text in ("yes", "true", "True")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1544 elif item.attrib["type"] == "integer":
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1545 return int(item.text)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1546 else:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1547 return item.text
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1548
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1549
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1550 def validate_synteny(real_root):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1551
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1552 if len(real_root.findall('assembly/tracks/track[@format="synteny"]')) == 0:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1553 # No synteny data, all good
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1554 return False
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1555
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1556 assemblies = real_root.findall("assembly")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1557
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1558 if len(assemblies[-1].findall('tracks/track[@format="synteny"]')) > 0 and \
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1559 assemblies[-1].find('tracks/track[@format="synteny"]/options/style/display').text == "LinearSyntenyDisplay":
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1560 raise RuntimeError("You should not set a synteny track on the last genome.")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1561
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1562 for assembly in assemblies[1:0]:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1563 if len(assembly.findall('tracks/track[@format="synteny"]')) != 1 and \
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1564 assembly.find('tracks/track[@format="synteny"]/options/style/display').text == "LinearSyntenyDisplay":
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1565 raise RuntimeError("To use the synteny viewer, you should add a synteny track to each assembly, except the last one.")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1566
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1567 return True
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1568
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1569
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1570 if __name__ == "__main__":
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1571 parser = argparse.ArgumentParser(description="", epilog="")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1572 parser.add_argument("xml", type=argparse.FileType("r"), help="Track Configuration")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1573
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1574 parser.add_argument('--jbrowse', help='Folder containing a jbrowse release')
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1575 parser.add_argument("--update", help="Update an existing JBrowse2 instance", action="store_true")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1576 parser.add_argument("--outdir", help="Output directory", default="out")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1577 args = parser.parse_args()
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1578
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1579 tree = ET.parse(args.xml.name)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1580 real_root = tree.getroot()
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1581
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1582 # This should be done ASAP
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1583 # Sometimes this comes as `localhost` without a protocol
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1584 GALAXY_INFRASTRUCTURE_URL = real_root.find("metadata/galaxyUrl").text
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1585 if not GALAXY_INFRASTRUCTURE_URL.startswith("http"):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1586 # so we'll prepend `http://` and hope for the best. Requests *should*
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1587 # be GET and not POST so it should redirect OK
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1588 GALAXY_INFRASTRUCTURE_URL = "http://" + GALAXY_INFRASTRUCTURE_URL
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1589
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1590 jc = JbrowseConnector(
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1591 jbrowse=args.jbrowse,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1592 outdir=args.outdir,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1593 update=args.update,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1594 )
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1595
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1596 # Synteny options are special, check them first
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1597 jc.use_synteny_viewer = validate_synteny(real_root)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1598
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1599 for assembly in real_root.findall("assembly"):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1600 genome_el = assembly.find('genome')
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1601
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1602 is_remote = genome_el.attrib.get("remote", "false") == "true"
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1603
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1604 genome = {
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1605 "path": genome_el.attrib["path"] if is_remote else os.path.realpath(genome_el.attrib["path"]),
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1606 "meta": metadata_from_node(genome_el.find("metadata")),
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1607 "label": genome_el.attrib["label"],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1608 }
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1609
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1610 cytobands = None
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1611 cytobands_el = genome_el.find("cytobands")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1612 if cytobands_el is not None and "path" in cytobands_el.attrib:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1613 cytobands = cytobands_el.attrib["path"]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1614
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1615 ref_name_aliases = None
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1616 ref_name_aliases_el = genome_el.find("ref_name_aliases")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1617 if ref_name_aliases_el is not None and "path" in ref_name_aliases_el.attrib:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1618 ref_name_aliases = ref_name_aliases_el.attrib["path"]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1619
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1620 log.debug("Processing genome", genome)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1621 genome["uniq_id"] = jc.add_assembly(genome["path"], genome["label"], is_remote, cytobands, ref_name_aliases)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1622
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1623 default_tracks_on = []
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1624
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1625 track_num = 0
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1626 for track in assembly.findall("tracks/track"):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1627 track_conf = {}
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1628 track_conf["trackfiles"] = []
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1629 track_conf["track_num"] = track_num
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1630
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1631 trackfiles = track.findall("files/trackFile") or []
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1632
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1633 is_multi = False
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1634 multi_paths = []
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1635 multi_type = None
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1636 multi_metadata = {}
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1637 try:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1638 multi_in_xml = track.find("options/multitrack")
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1639 if multi_in_xml is not None and parse_style_conf(multi_in_xml):
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1640 is_multi = True
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1641 multi_paths = []
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1642 multi_type = trackfiles[0].attrib["ext"]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1643 except KeyError:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1644 pass
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1645
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1646 is_remote = False
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1647 if trackfiles:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1648 for x in trackfiles:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1649 if is_multi:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1650 is_remote = x.attrib.get("remote", "false") == "true"
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1651 multi_paths.append(
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1652 (x.attrib["label"], x.attrib["path"] if is_remote else os.path.realpath(x.attrib["path"]))
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1653 )
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1654 multi_metadata.update(metadata_from_node(x.find("metadata")))
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1655 else:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1656 metadata = metadata_from_node(x.find("metadata"))
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1657 is_remote = x.attrib.get("remote", "false") == "true"
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1658 track_conf["trackfiles"].append(
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1659 (
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1660 x.attrib["path"] if is_remote else os.path.realpath(x.attrib["path"]),
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1661 x.attrib["ext"],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1662 x.attrib["label"],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1663 metadata,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1664 )
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1665 )
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1666 else:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1667 # For tracks without files (sparql, gc)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1668 track_conf["trackfiles"].append(
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1669 (
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1670 "", # N/A, no path for sparql or gc
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1671 track.attrib["format"],
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1672 track.find("options/label").text,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1673 {},
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1674 )
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1675 )
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1676
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1677 if is_multi:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1678 etal_tracks_nb = len(multi_paths[1:])
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1679 multi_label = f"{multi_paths[0][0]} + {etal_tracks_nb} other track{'s' if etal_tracks_nb > 1 else ''}"
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1680
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1681 track_conf["trackfiles"].append(
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1682 (
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1683 multi_paths, # Passing an array of paths to represent as one track
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1684 multi_type, # First file type
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1685 multi_label, # First file label
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1686 multi_metadata, # Mix of all metadata for multiple bigwig => only last file metadata coming from galaxy + custom oness
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1687 )
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1688 )
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1689 track_conf["category"] = track.attrib["cat"]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1690 track_conf["format"] = track.attrib["format"]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1691 track_conf["style"] = {
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1692 item.tag: parse_style_conf(item) for item in (track.find("options/style") or [])
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1693 }
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1694
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1695 track_conf["style"] = {
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1696 item.tag: parse_style_conf(item) for item in (track.find("options/style") or [])
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1697 }
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1698
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1699 track_conf["style_labels"] = {
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1700 item.tag: parse_style_conf(item)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1701 for item in (track.find("options/style_labels") or [])
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1702 }
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1703 track_conf["formatdetails"] = {
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1704 item.tag: parse_style_conf(item) for item in (track.find("options/formatdetails") or [])
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1705 }
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1706
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1707 track_conf["conf"] = etree_to_dict(track.find("options"))
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1708
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1709 track_conf["remote"] = is_remote
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1710
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1711 track_labels = jc.process_annotations(track_conf, genome)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1712
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1713 if track.attrib["visibility"] == "default_on":
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1714 for tlabel in track_labels:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1715 default_tracks_on.append(tlabel)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1716
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1717 track_num += 1
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1718
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1719 default_loc = assembly.find("defaultLocation").text
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1720
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1721 jc.default_views[genome['uniq_id']] = jc.add_default_view_genome(genome, default_loc, default_tracks_on)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1722
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1723 if jc.use_synteny_viewer:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1724 synteny_view = jc.add_default_view_synteny(list(jc.default_views.values()), jc.synteny_tracks)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1725
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1726 views_for_session = jc._load_old_synteny_views()
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1727
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1728 views_for_session.append(synteny_view)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1729 else:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1730 old_views = jc._load_old_genome_views()
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1731
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1732 for old_view in old_views:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1733 if old_view not in jc.default_views:
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1734 jc.default_views[old_view] = old_views[old_view]
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1735
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1736 views_for_session = list(jc.default_views.values())
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1737
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1738 general_data = {
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1739 "analytics": real_root.find("metadata/general/analytics").text,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1740 "primary_color": real_root.find("metadata/general/primary_color").text,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1741 "secondary_color": real_root.find("metadata/general/secondary_color").text,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1742 "tertiary_color": real_root.find("metadata/general/tertiary_color").text,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1743 "quaternary_color": real_root.find("metadata/general/quaternary_color").text,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1744 "font_size": real_root.find("metadata/general/font_size").text,
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1745 }
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1746
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1747 jc.add_default_session(views_for_session)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1748 jc.add_general_configuration(general_data)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1749 jc.add_plugins(jc.plugins)
61add3f58f26 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4fa86613193c985e0cb9a8fc795c56b8bc7b8532
iuc
parents:
diff changeset
1750 jc.text_index()