annotate jbrowse2.py @ 57:94264fe60478 draft

planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
author fubar
date Thu, 21 Mar 2024 08:01:42 +0000
parents c0097a584a8a
children f807e219cec3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1 #!/usr/bin/env python
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
2 # change to accumulating all configuration for config.json based on the default from the clone
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
3 import argparse
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
4 import binascii
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
5 import datetime
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
6 import json
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
7 import logging
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
8 import os
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
9 import re
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
10 import shutil
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
11 import struct
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
12 import subprocess
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
13 import tempfile
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
14 import urllib.request
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
15 import xml.etree.ElementTree as ET
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
16 from collections import defaultdict
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
17
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
18 logging.basicConfig(level=logging.INFO)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
19 log = logging.getLogger("jbrowse")
7
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
20
56
c0097a584a8a planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674
fubar
parents: 55
diff changeset
21 JB2VER = "v2.10.3"
7
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
22 # version pinned for cloning
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
23
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
24 TODAY = datetime.datetime.now().strftime("%Y-%m-%d")
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
25 GALAXY_INFRASTRUCTURE_URL = None
38
07849bf248e3 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a74e469a81b38c7142f63de510ae31d3754d1767
fubar
parents: 37
diff changeset
26
3
2de9f585505b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b30d2e277cc360437a02fa812c577c0c8d997cff-dirty
fubar
parents: 0
diff changeset
27 # version pinned for cloning
2de9f585505b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit b30d2e277cc360437a02fa812c577c0c8d997cff-dirty
fubar
parents: 0
diff changeset
28
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
29 mapped_chars = {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
30 ">": "__gt__",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
31 "<": "__lt__",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
32 "'": "__sq__",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
33 '"': "__dq__",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
34 "[": "__ob__",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
35 "]": "__cb__",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
36 "{": "__oc__",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
37 "}": "__cc__",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
38 "@": "__at__",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
39 "#": "__pd__",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
40 "": "__cn__",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
41 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
42
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
43
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
44 class ColorScaling(object):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
45
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
46 COLOR_FUNCTION_TEMPLATE = """
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
47 function(feature, variableName, glyphObject, track) {{
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
48 var score = {score};
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
49 {opacity}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
50 return 'rgba({red}, {green}, {blue}, ' + opacity + ')';
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
51 }}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
52 """
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
53
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
54 COLOR_FUNCTION_TEMPLATE_QUAL = r"""
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
55 function(feature, variableName, glyphObject, track) {{
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
56 var search_up = function self(sf, attr){{
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
57 if(sf.get(attr) !== undefined){{
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
58 return sf.get(attr);
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
59 }}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
60 if(sf.parent() === undefined) {{
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
61 return;
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
62 }}else{{
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
63 return self(sf.parent(), attr);
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
64 }}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
65 }};
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
66
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
67 var search_down = function self(sf, attr){{
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
68 if(sf.get(attr) !== undefined){{
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
69 return sf.get(attr);
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
70 }}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
71 if(sf.children() === undefined) {{
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
72 return;
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
73 }}else{{
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
74 var kids = sf.children();
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
75 for(var child_idx in kids){{
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
76 var x = self(kids[child_idx], attr);
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
77 if(x !== undefined){{
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
78 return x;
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
79 }}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
80 }}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
81 return;
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
82 }}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
83 }};
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
84
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
85 var color = ({user_spec_color} || search_up(feature, 'color') || search_down(feature, 'color') || {auto_gen_color});
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
86 var score = (search_up(feature, 'score') || search_down(feature, 'score'));
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
87 {opacity}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
88 if(score === undefined){{ opacity = 1; }}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
89 var result = /^#?([a-f\d]{{2}})([a-f\d]{{2}})([a-f\d]{{2}})$/i.exec(color);
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
90 var red = parseInt(result[1], 16);
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
91 var green = parseInt(result[2], 16);
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
92 var blue = parseInt(result[3], 16);
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
93 if(isNaN(opacity) || opacity < 0){{ opacity = 0; }}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
94 return 'rgba(' + red + ',' + green + ',' + blue + ',' + opacity + ')';
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
95 }}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
96 """
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
97
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
98 OPACITY_MATH = {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
99 "linear": """
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
100 var opacity = (score - ({min})) / (({max}) - ({min}));
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
101 """,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
102 "logarithmic": """
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
103 var opacity = Math.log10(score - ({min})) / Math.log10(({max}) - ({min}));
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
104 """,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
105 "blast": """
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
106 var opacity = 0;
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
107 if(score == 0.0) {{
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
108 opacity = 1;
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
109 }} else {{
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
110 opacity = (20 - Math.log10(score)) / 180;
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
111 }}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
112 """,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
113 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
114
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
115 BREWER_COLOUR_IDX = 0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
116 BREWER_COLOUR_SCHEMES = [
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
117 (166, 206, 227),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
118 (31, 120, 180),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
119 (178, 223, 138),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
120 (51, 160, 44),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
121 (251, 154, 153),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
122 (227, 26, 28),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
123 (253, 191, 111),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
124 (255, 127, 0),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
125 (202, 178, 214),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
126 (106, 61, 154),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
127 (255, 255, 153),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
128 (177, 89, 40),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
129 (228, 26, 28),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
130 (55, 126, 184),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
131 (77, 175, 74),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
132 (152, 78, 163),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
133 (255, 127, 0),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
134 ]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
135
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
136 BREWER_DIVERGING_PALLETES = {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
137 "BrBg": ("#543005", "#003c30"),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
138 "PiYg": ("#8e0152", "#276419"),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
139 "PRGn": ("#40004b", "#00441b"),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
140 "PuOr": ("#7f3b08", "#2d004b"),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
141 "RdBu": ("#67001f", "#053061"),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
142 "RdGy": ("#67001f", "#1a1a1a"),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
143 "RdYlBu": ("#a50026", "#313695"),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
144 "RdYlGn": ("#a50026", "#006837"),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
145 "Spectral": ("#9e0142", "#5e4fa2"),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
146 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
147
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
148 def __init__(self):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
149 self.brewer_colour_idx = 0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
150
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
151 def rgb_from_hex(self, hexstr):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
152 # http://stackoverflow.com/questions/4296249/how-do-i-convert-a-hex-triplet-to-an-rgb-tuple-and-back
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
153 return struct.unpack("BBB", binascii.unhexlify(hexstr))
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
154
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
155 def min_max_gff(self, gff_file):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
156 min_val = None
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
157 max_val = None
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
158 with open(gff_file, "r") as handle:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
159 for line in handle:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
160 try:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
161 value = float(line.split("\t")[5])
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
162 min_val = min(value, (min_val or value))
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
163 max_val = max(value, (max_val or value))
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
164
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
165 if value < min_val:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
166 min_val = value
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
167
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
168 if value > max_val:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
169 max_val = value
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
170 except Exception:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
171 pass
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
172 return min_val, max_val
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
173
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
174 def hex_from_rgb(self, r, g, b):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
175 return "#%02x%02x%02x" % (r, g, b)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
176
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
177 def _get_colours(self):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
178 r, g, b = self.BREWER_COLOUR_SCHEMES[
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
179 self.brewer_colour_idx % len(self.BREWER_COLOUR_SCHEMES)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
180 ]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
181 self.brewer_colour_idx += 1
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
182 return r, g, b
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
183
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
184 def parse_menus(self, track):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
185 trackConfig = {"menuTemplate": [{}, {}, {}, {}]}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
186
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
187 if "menu" in track["menus"]:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
188 menu_list = [track["menus"]["menu"]]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
189 if isinstance(track["menus"]["menu"], list):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
190 menu_list = track["menus"]["menu"]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
191
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
192 for m in menu_list:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
193 tpl = {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
194 "action": m["action"],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
195 "label": m.get("label", "{name}"),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
196 "iconClass": m.get("iconClass", "dijitIconBookmark"),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
197 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
198 if "url" in m:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
199 tpl["url"] = m["url"]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
200 if "content" in m:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
201 tpl["content"] = m["content"]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
202 if "title" in m:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
203 tpl["title"] = m["title"]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
204
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
205 trackConfig["menuTemplate"].append(tpl)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
206
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
207 return trackConfig
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
208
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
209 def parse_colours(self, track, trackFormat, gff3=None):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
210 # Wiggle tracks have a bicolor pallete
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
211 trackConfig = {"style": {}}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
212 if trackFormat == "wiggle":
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
213
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
214 trackConfig["style"]["pos_color"] = track["wiggle"]["color_pos"]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
215 trackConfig["style"]["neg_color"] = track["wiggle"]["color_neg"]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
216
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
217 if trackConfig["style"]["pos_color"] == "__auto__":
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
218 trackConfig["style"]["neg_color"] = self.hex_from_rgb(
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
219 *self._get_colours()
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
220 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
221 trackConfig["style"]["pos_color"] = self.hex_from_rgb(
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
222 *self._get_colours()
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
223 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
224
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
225 # Wiggle tracks can change colour at a specified place
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
226 bc_pivot = track["wiggle"]["bicolor_pivot"]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
227 if bc_pivot not in ("mean", "zero"):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
228 # The values are either one of those two strings
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
229 # or a number
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
230 bc_pivot = float(bc_pivot)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
231 trackConfig["bicolor_pivot"] = bc_pivot
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
232 elif "scaling" in track:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
233 if track["scaling"]["method"] == "ignore":
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
234 if track["scaling"]["scheme"]["color"] != "__auto__":
23
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
235 trackConfig["style"]["color"] = track["scaling"]["scheme"]["color"]
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
236 else:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
237 trackConfig["style"]["color"] = self.hex_from_rgb(
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
238 *self._get_colours()
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
239 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
240 else:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
241 # Scored method
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
242 algo = track["scaling"]["algo"]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
243 # linear, logarithmic, blast
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
244 scales = track["scaling"]["scales"]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
245 # type __auto__, manual (min, max)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
246 scheme = track["scaling"]["scheme"]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
247 # scheme -> (type (opacity), color)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
248 # ==================================
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
249 # GENE CALLS OR BLAST
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
250 # ==================================
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
251 if trackFormat == "blast":
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
252 red, green, blue = self._get_colours()
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
253 color_function = self.COLOR_FUNCTION_TEMPLATE.format(
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
254 **{
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
255 "score": "feature._parent.get('score')",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
256 "opacity": self.OPACITY_MATH["blast"],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
257 "red": red,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
258 "green": green,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
259 "blue": blue,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
260 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
261 )
23
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
262 trackConfig["style"]["color"] = color_function.replace("\n", "")
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
263 elif trackFormat == "gene_calls":
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
264 # Default values, based on GFF3 spec
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
265 min_val = 0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
266 max_val = 1000
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
267 # Get min/max and build a scoring function since JBrowse doesn't
23
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
268 if scales["type"] == "automatic" or scales["type"] == "__auto__":
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
269 min_val, max_val = self.min_max_gff(gff3)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
270 else:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
271 min_val = scales.get("min", 0)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
272 max_val = scales.get("max", 1000)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
273
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
274 if scheme["color"] == "__auto__":
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
275 user_color = "undefined"
23
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
276 auto_color = "'%s'" % self.hex_from_rgb(*self._get_colours())
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
277 elif scheme["color"].startswith("#"):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
278 user_color = "'%s'" % self.hex_from_rgb(
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
279 *self.rgb_from_hex(scheme["color"][1:])
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
280 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
281 auto_color = "undefined"
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
282 else:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
283 user_color = "undefined"
23
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
284 auto_color = "'%s'" % self.hex_from_rgb(*self._get_colours())
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
285
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
286 color_function = self.COLOR_FUNCTION_TEMPLATE_QUAL.format(
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
287 **{
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
288 "opacity": self.OPACITY_MATH[algo].format(
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
289 **{"max": max_val, "min": min_val}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
290 ),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
291 "user_spec_color": user_color,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
292 "auto_gen_color": auto_color,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
293 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
294 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
295
23
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
296 trackConfig["style"]["color"] = color_function.replace("\n", "")
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
297 return trackConfig
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
298
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
299
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
300 def etree_to_dict(t):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
301 if t is None:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
302 return {}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
303
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
304 d = {t.tag: {} if t.attrib else None}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
305 children = list(t)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
306 if children:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
307 dd = defaultdict(list)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
308 for dc in map(etree_to_dict, children):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
309 for k, v in dc.items():
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
310 dd[k].append(v)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
311 d = {t.tag: {k: v[0] if len(v) == 1 else v for k, v in dd.items()}}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
312 if t.attrib:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
313 d[t.tag].update(("@" + k, v) for k, v in t.attrib.items())
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
314 if t.text:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
315 text = t.text.strip()
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
316 if children or t.attrib:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
317 if text:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
318 d[t.tag]["#text"] = text
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
319 else:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
320 d[t.tag] = text
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
321 return d
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
322
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
323
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
324 INSTALLED_TO = os.path.dirname(os.path.realpath(__file__))
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
325
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
326
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
327 def metadata_from_node(node):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
328 metadata = {}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
329 try:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
330 if len(node.findall("dataset")) != 1:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
331 # exit early
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
332 return metadata
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
333 except Exception:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
334 return {}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
335
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
336 for (key, value) in node.findall("dataset")[0].attrib.items():
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
337 metadata["dataset_%s" % key] = value
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
338
19
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
339 if node.findall("history"):
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
340 for (key, value) in node.findall("history")[0].attrib.items():
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
341 metadata["history_%s" % key] = value
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
342
19
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
343 if node.findall("metadata"):
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
344 for (key, value) in node.findall("metadata")[0].attrib.items():
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
345 metadata["metadata_%s" % key] = value
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
346 # Additional Mappings applied:
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
347 metadata[
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
348 "dataset_edam_format"
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
349 ] = '<a target="_blank" href="http://edamontology.org/{0}">{1}</a>'.format(
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
350 metadata["dataset_edam_format"], metadata["dataset_file_ext"]
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
351 )
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
352 metadata["history_user_email"] = '<a href="mailto:{0}">{0}</a>'.format(
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
353 metadata["history_user_email"]
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
354 )
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
355 metadata["hist_name"] = metadata["history_display_name"]
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
356 metadata[
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
357 "history_display_name"
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
358 ] = '<a target="_blank" href="{galaxy}/history/view/{encoded_hist_id}">{hist_name}</a>'.format(
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
359 galaxy=GALAXY_INFRASTRUCTURE_URL,
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
360 encoded_hist_id=metadata["history_id"],
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
361 hist_name=metadata["history_display_name"],
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
362 )
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
363 if node.findall("tool"):
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
364 for (key, value) in node.findall("tool")[0].attrib.items():
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
365 metadata["tool_%s" % key] = value
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
366 metadata[
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
367 "tool_tool"
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
368 ] = '<a target="_blank" href="{galaxy}/datasets/{encoded_id}/show_params">{tool_id}{tool_version}</a>'.format(
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
369 galaxy=GALAXY_INFRASTRUCTURE_URL,
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
370 encoded_id=metadata.get("dataset_id", ""),
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
371 tool_id=metadata.get("tool_tool_id", ""),
23
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
372 tool_version=metadata.get("tool_tool_version", ""),
19
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
373 )
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
374 return metadata
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
375
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
376
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
377 class JbrowseConnector(object):
38
07849bf248e3 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a74e469a81b38c7142f63de510ae31d3754d1767
fubar
parents: 37
diff changeset
378 def __init__(self, outdir, jbrowse2path, genomes):
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
379 self.giURL = GALAXY_INFRASTRUCTURE_URL
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
380 self.outdir = outdir
38
07849bf248e3 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a74e469a81b38c7142f63de510ae31d3754d1767
fubar
parents: 37
diff changeset
381 self.jbrowse2path = jbrowse2path
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
382 os.makedirs(self.outdir, exist_ok=True)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
383 self.genome_paths = genomes
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
384 self.genome_name = None
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
385 self.genome_names = []
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
386 self.trackIdlist = []
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
387 self.tracksToAdd = []
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
388 self.config_json = {}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
389 self.config_json_file = os.path.join(outdir, "config.json")
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
390 self.clone_jbrowse()
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
391
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
392 def subprocess_check_call(self, command, output=None):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
393 if output:
23
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
394 log.debug("cd %s && %s > %s", self.outdir, " ".join(command), output)
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
395 subprocess.check_call(command, cwd=self.outdir, stdout=output)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
396 else:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
397 log.debug("cd %s && %s", self.outdir, " ".join(command))
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
398 subprocess.check_call(command, cwd=self.outdir)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
399
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
400 def subprocess_popen(self, command):
7
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
401 log.debug(command)
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
402 p = subprocess.Popen(
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
403 command,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
404 cwd=self.outdir,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
405 shell=True,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
406 stdin=subprocess.PIPE,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
407 stdout=subprocess.PIPE,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
408 stderr=subprocess.PIPE,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
409 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
410 output, err = p.communicate()
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
411 retcode = p.returncode
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
412 if retcode != 0:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
413 log.error(command)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
414 log.error(output)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
415 log.error(err)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
416 raise RuntimeError("Command failed with exit code %s" % (retcode))
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
417
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
418 def subprocess_check_output(self, command):
7
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
419 log.debug(" ".join(command))
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
420 return subprocess.check_output(command, cwd=self.outdir)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
421
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
422 def symlink_or_copy(self, src, dest):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
423 if "GALAXY_JBROWSE_SYMLINKS" in os.environ and bool(
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
424 os.environ["GALAXY_JBROWSE_SYMLINKS"]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
425 ):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
426 cmd = ["ln", "-s", src, dest]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
427 else:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
428 cmd = ["cp", src, dest]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
429
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
430 return self.subprocess_check_call(cmd)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
431
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
432 def _prepare_track_style(self, trackDict):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
433
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
434 style_data = {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
435 "type": "LinearBasicDisplay",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
436 "displayId": "%s-LinearBasicDisplay" % trackDict["trackId"],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
437 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
438
5
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
439 if trackDict.get("displays", None): # use first if multiple like bed
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
440 style_data["type"] = trackDict["displays"][0]["type"]
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
441 style_data["displayId"] = trackDict["displays"][0]["displayId"]
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
442 return {
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
443 "displays": [
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
444 style_data,
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
445 ]
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
446 }
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
447
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
448 def process_genomes(self):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
449 assemblies = []
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
450 useuri = False
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
451 for i, genome_node in enumerate(self.genome_paths):
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
452 if genome_node["useuri"].strip().lower() == "yes":
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
453 useuri = True
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
454 genome_name = genome_node["meta"]["dataset_dname"].strip()
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
455 if len(genome_name.split()) > 1:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
456 genome_name = genome_name.split()[0]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
457 # spaces and cruft break scripts when substituted
34
2893ef33fba9 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd
fubar
parents: 32
diff changeset
458 if genome_name not in self.genome_names:
31
cb4b32ca9968 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919-dirty
fubar
parents: 30
diff changeset
459 # ignore dupes - can have multiple pafs with same references?
cb4b32ca9968 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919-dirty
fubar
parents: 30
diff changeset
460 fapath = genome_node["path"]
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
461 if not useuri:
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
462 fapath = os.path.realpath(fapath)
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
463 assem = self.make_assembly(fapath, genome_name, useuri)
31
cb4b32ca9968 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919-dirty
fubar
parents: 30
diff changeset
464 assemblies.append(assem)
cb4b32ca9968 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919-dirty
fubar
parents: 30
diff changeset
465 self.genome_names.append(genome_name)
cb4b32ca9968 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919-dirty
fubar
parents: 30
diff changeset
466 if self.genome_name is None:
cb4b32ca9968 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919-dirty
fubar
parents: 30
diff changeset
467 self.genome_name = (
cb4b32ca9968 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919-dirty
fubar
parents: 30
diff changeset
468 genome_name # first one for all tracks - other than paf
cb4b32ca9968 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919-dirty
fubar
parents: 30
diff changeset
469 )
53
bdfa6a7c4543 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4-dirty
fubar
parents: 50
diff changeset
470 self.genome_sequence_adapter = assem["sequence"]["adapter"]
31
cb4b32ca9968 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919-dirty
fubar
parents: 30
diff changeset
471 self.genome_firstcontig = None
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
472 if not useuri:
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
473 fl = open(fapath, "r").readline()
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
474 fls = fl.strip().split(">")
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
475 if len(fls) > 1:
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
476 fl = fls[1]
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
477 if len(fl.split()) > 1:
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
478 self.genome_firstcontig = fl.split()[0].strip()
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
479 else:
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
480 self.genome_firstcontig = fl
55
469c0f6d87d7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 0553bb75a96ae401623face516c1cf6e1cfe743f
fubar
parents: 54
diff changeset
481 else:
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
482 fl = urllib.request.urlopen(fapath + ".fai").readline()
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
483 if fl: # is first row of the text fai so the first contig name
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
484 self.genome_firstcontig = (
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
485 fl.decode("utf8").strip().split()[0]
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
486 )
15
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
487 if self.config_json.get("assemblies", None):
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
488 self.config_json["assemblies"] += assemblies
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
489 else:
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
490 self.config_json["assemblies"] = assemblies
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
491
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
492 def make_assembly(self, fapath, gname, useuri):
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
493 if useuri:
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
494 faname = fapath
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
495 adapter = {
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
496 "type": "BgzipFastaAdapter",
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
497 "fastaLocation": {
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
498 "uri": faname,
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
499 "locationType": "UriLocation",
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
500 },
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
501 "faiLocation": {
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
502 "uri": faname + ".fai",
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
503 "locationType": "UriLocation",
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
504 },
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
505 "gziLocation": {
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
506 "uri": faname + ".gzi",
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
507 "locationType": "UriLocation",
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
508 },
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
509 }
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
510 else:
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
511 faname = gname + ".fa.gz"
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
512 fadest = os.path.realpath(os.path.join(self.outdir, faname))
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
513 cmd = "bgzip -i -c %s -I %s.gzi > %s && samtools faidx %s" % (
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
514 fapath,
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
515 fadest,
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
516 fadest,
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
517 fadest,
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
518 )
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
519 self.subprocess_popen(cmd)
19
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
520
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
521 adapter = {
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
522 "type": "BgzipFastaAdapter",
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
523 "fastaLocation": {
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
524 "uri": faname,
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
525 },
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
526 "faiLocation": {
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
527 "uri": faname + ".fai",
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
528 },
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
529 "gziLocation": {
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
530 "uri": faname + ".gzi",
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
531 },
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
532 }
53
bdfa6a7c4543 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4-dirty
fubar
parents: 50
diff changeset
533
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
534 trackDict = {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
535 "name": gname,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
536 "sequence": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
537 "type": "ReferenceSequenceTrack",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
538 "trackId": gname,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
539 "adapter": adapter,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
540 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
541 "rendering": {"type": "DivSequenceRenderer"},
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
542 "displays": [
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
543 {
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
544 "type": "LinearReferenceSequenceDisplay",
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
545 "displayId": "%s-LinearReferenceSequenceDisplay" % gname,
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
546 },
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
547 {
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
548 "type": "LinearGCContentDisplay",
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
549 "displayId": "%s-LinearGCContentDisplay" % gname,
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
550 },
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
551 ],
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
552 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
553 return trackDict
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
554
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
555 def add_default_view(self):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
556 cmd = [
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
557 "jbrowse",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
558 "set-default-session",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
559 "-s",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
560 self.config_json_file,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
561 "-t",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
562 ",".join(self.trackIdlist),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
563 "-n",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
564 "JBrowse2 in Galaxy",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
565 "--target",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
566 self.config_json_file,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
567 "-v",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
568 " LinearGenomeView",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
569 ]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
570 self.subprocess_check_call(cmd)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
571
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
572 def write_config(self):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
573 with open(self.config_json_file, "w") as fp:
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
574 json.dump(self.config_json, fp, indent=2)
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
575
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
576 def text_index(self):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
577 # Index tracks
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
578 args = [
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
579 "jbrowse",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
580 "text-index",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
581 "--target",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
582 os.path.join(self.outdir, "data"),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
583 "--assemblies",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
584 self.genome_name,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
585 ]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
586
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
587 tracks = ",".join(self.trackIdlist)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
588 if tracks:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
589 args += ["--tracks", tracks]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
590
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
591 self.subprocess_check_call(args)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
592
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
593 def add_hic(self, data, trackData):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
594 """
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
595 HiC adapter.
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
596 https://github.com/aidenlab/hic-format/blob/master/HiCFormatV9.md
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
597 for testing locally, these work:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
598 HiC data is from https://s3.amazonaws.com/igv.broadinstitute.org/data/hic/intra_nofrag_30.hic
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
599 using hg19 reference track as a
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
600 'BgzipFastaAdapter'
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
601 fastaLocation:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
602 uri: 'https://s3.amazonaws.com/jbrowse.org/genomes/GRCh38/fasta/GRCh38.fa.gz',
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
603 faiLocation:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
604 uri: 'https://s3.amazonaws.com/jbrowse.org/genomes/GRCh38/fasta/GRCh38.fa.gz.fai',
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
605 gziLocation:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
606 uri: 'https://s3.amazonaws.com/jbrowse.org/genomes/GRCh38/fasta/GRCh38.fa.gz.gzi',
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
607 Cool will not be likely to be a good fit - see discussion at https://github.com/GMOD/jbrowse-components/issues/2438
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
608 """
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
609 tId = trackData["label"]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
610 # can be served - if public.
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
611 # dsId = trackData["metadata"]["dataset_id"]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
612 # url = "%s/api/datasets/%s/display?to_ext=hic " % (self.giURL, dsId)
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
613 useuri = trackData["useuri"].lower() == "yes"
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
614 if useuri:
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
615 uri = data
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
616 else:
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
617 uri = trackData["hic_url"]
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
618 categ = trackData["category"]
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
619 trackDict = {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
620 "type": "HicTrack",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
621 "trackId": tId,
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
622 "name": uri,
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
623 "assemblyNames": [self.genome_name],
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
624 "category": [
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
625 categ,
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
626 ],
50
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
627 "adapter": {
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
628 "type": "HicAdapter",
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
629 "hicLocation": uri,
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
630 },
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
631 "displays": [
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
632 {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
633 "type": "LinearHicDisplay",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
634 "displayId": "%s-LinearHicDisplay" % tId,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
635 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
636 ],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
637 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
638 self.tracksToAdd.append(trackDict)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
639 self.trackIdlist.append(tId)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
640
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
641 def add_maf(self, data, trackData):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
642 """
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
643 from https://github.com/cmdcolin/maf2bed
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
644 Note: Both formats start with a MAF as input, and note that your MAF file should contain the species name and chromosome name
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
645 e.g. hg38.chr1 in the sequence identifiers.
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
646 need the reference id - eg hg18, for maf2bed.pl as the first parameter
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
647 """
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
648 tId = trackData["label"]
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
649 mafPlugin = {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
650 "plugins": [
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
651 {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
652 "name": "MafViewer",
23
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
653 "url": "https://unpkg.com/jbrowse-plugin-mafviewer/dist/jbrowse-plugin-mafviewer.umd.production.min.js",
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
654 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
655 ]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
656 }
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
657 categ = trackData["category"]
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
658 fname = "%s.bed" % tId
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
659 dest = "%s/%s" % (self.outdir, fname)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
660 gname = self.genome_name
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
661 cmd = [
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
662 "bash",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
663 os.path.join(INSTALLED_TO, "convertMAF.sh"),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
664 data,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
665 gname,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
666 INSTALLED_TO,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
667 dest,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
668 ]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
669 self.subprocess_check_call(cmd)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
670 # Construct samples list
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
671 # We could get this from galaxy metadata, not sure how easily.
23
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
672 ps = subprocess.Popen(["grep", "^s [^ ]*", "-o", data], stdout=subprocess.PIPE)
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
673 output = subprocess.check_output(("sort", "-u"), stdin=ps.stdout)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
674 ps.wait()
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
675 outp = output.decode("ascii")
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
676 soutp = outp.split("\n")
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
677 samp = [x.split("s ")[1] for x in soutp if x.startswith("s ")]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
678 samples = [x.split(".")[0] for x in samp]
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
679 logging.warn("### maf convert cmd = %s,\nsamples=%s" % (' '.join(cmd), samples))
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
680 trackDict = {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
681 "type": "MafTrack",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
682 "trackId": tId,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
683 "name": trackData["name"],
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
684 "category": [
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
685 categ,
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
686 ],
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
687 "adapter": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
688 "type": "MafTabixAdapter",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
689 "samples": samples,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
690 "bedGzLocation": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
691 "uri": fname + ".sorted.bed.gz",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
692 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
693 "index": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
694 "location": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
695 "uri": fname + ".sorted.bed.gz.tbi",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
696 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
697 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
698 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
699 "assemblyNames": [self.genome_name],
5
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
700 "displays": [
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
701 {
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
702 "type": "LinearBasicDisplay",
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
703 "displayId": "%s-LinearBasicDisplay" % tId,
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
704 },
17
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
705 {
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
706 "type": "LinearArcDisplay",
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
707 "displayId": "%s-LinearArcDisplay" % tId,
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
708 },
5
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
709 ],
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
710 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
711 self.tracksToAdd.append(trackDict)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
712 self.trackIdlist.append(tId)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
713 if self.config_json.get("plugins", None):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
714 self.config_json["plugins"].append(mafPlugin[0])
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
715 else:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
716 self.config_json.update(mafPlugin)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
717
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
718 def _blastxml_to_gff3(self, xml, min_gap=10):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
719 gff3_unrebased = tempfile.NamedTemporaryFile(delete=False)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
720 cmd = [
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
721 "python",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
722 os.path.join(INSTALLED_TO, "blastxml_to_gapped_gff3.py"),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
723 "--trim",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
724 "--trim_end",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
725 "--include_seq",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
726 "--min_gap",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
727 str(min_gap),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
728 xml,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
729 ]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
730 subprocess.check_call(cmd, cwd=self.outdir, stdout=gff3_unrebased)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
731 gff3_unrebased.close()
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
732 logging.warn("### blastxml to gff3 cmd = %s" % ' '.join(cmd))
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
733 return gff3_unrebased.name
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
734
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
735 def add_blastxml(self, data, trackData, blastOpts, **kwargs):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
736 gff3 = self._blastxml_to_gff3(data, min_gap=blastOpts["min_gap"])
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
737 if "parent" in blastOpts and blastOpts["parent"] != "None":
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
738 gff3_rebased = tempfile.NamedTemporaryFile(delete=False)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
739 cmd = ["python", os.path.join(INSTALLED_TO, "gff3_rebase.py")]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
740 if blastOpts.get("protein", "false") == "true":
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
741 cmd.append("--protein2dna")
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
742 cmd.extend([os.path.realpath(blastOpts["parent"]), gff3])
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
743 subprocess.check_call(cmd, cwd=self.outdir, stdout=gff3_rebased)
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
744 logging.warn("### gff3rebase cmd = %s" % ' '.join(cmd))
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
745 gff3_rebased.close()
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
746 # Replace original gff3 file
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
747 shutil.copy(gff3_rebased.name, gff3)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
748 os.unlink(gff3_rebased.name)
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
749 url = "%s.gff3.gz" % trackData["label"]
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
750 dest = "%s/%s" % (self.outdir, url)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
751 self._sort_gff(gff3, dest)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
752 tId = trackData["label"]
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
753 categ = trackData["category"]
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
754 trackDict = {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
755 "type": "FeatureTrack",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
756 "trackId": tId,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
757 "name": trackData["name"],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
758 "assemblyNames": [self.genome_name],
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
759 "category": [
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
760 categ,
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
761 ],
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
762 "adapter": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
763 "type": "Gff3TabixAdapter",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
764 "gffGzLocation": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
765 "uri": url,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
766 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
767 "index": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
768 "location": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
769 "uri": url + ".tbi",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
770 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
771 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
772 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
773 "displays": [
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
774 {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
775 "type": "LinearBasicDisplay",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
776 "displayId": "%s-LinearBasicDisplay" % tId,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
777 },
17
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
778 {
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
779 "type": "LinearArcDisplay",
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
780 "displayId": "%s-LinearArcDisplay" % tId,
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
781 },
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
782 ],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
783 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
784 self.tracksToAdd.append(trackDict)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
785 self.trackIdlist.append(tId)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
786 os.unlink(gff3)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
787
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
788 def add_bigwig(self, data, trackData):
15
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
789 """ "type": "LinearWiggleDisplay",
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
790 "configuration": {},
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
791 "selectedRendering": "",
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
792 "resolution": 1,
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
793 "posColor": "rgb(228, 26, 28)",
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
794 "negColor": "rgb(255, 255, 51)",
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
795 "constraints": {}
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
796 """
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
797 useuri = trackData["useuri"].lower() == "yes"
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
798 if useuri:
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
799 url = data
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
800 else:
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
801 url = "%s.bigwig" % trackData["label"]
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
802 # slashes in names cause path trouble
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
803 dest = os.path.join(self.outdir, url)
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
804 cmd = ["cp", data, dest]
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
805 self.subprocess_check_call(cmd)
50
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
806 bwloc = {"uri": url}
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
807 tId = trackData["label"]
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
808 categ = trackData["category"]
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
809 trackDict = {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
810 "type": "QuantitativeTrack",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
811 "trackId": tId,
7
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
812 "name": trackData["name"],
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
813 "category": [
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
814 categ,
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
815 ],
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
816 "assemblyNames": [
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
817 self.genome_name,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
818 ],
50
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
819 "adapter": {
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
820 "type": "BigWigAdapter",
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
821 "bigWigLocation": bwloc,
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
822 },
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
823 "displays": [
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
824 {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
825 "type": "LinearWiggleDisplay",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
826 "displayId": "%s-LinearWiggleDisplay" % tId,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
827 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
828 ],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
829 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
830 self.tracksToAdd.append(trackDict)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
831 self.trackIdlist.append(tId)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
832
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
833 def add_bam(self, data, trackData, bam_index=None, **kwargs):
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
834 tId = trackData["label"]
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
835 useuri = trackData["useuri"].lower() == "yes"
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
836 bindex = bam_index
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
837 categ = trackData["category"]
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
838 if useuri:
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
839 url = data
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
840 else:
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
841 fname = "%s.bam" % trackData["label"]
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
842 dest = "%s/%s" % (self.outdir, fname)
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
843 url = fname
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
844 bindex = fname + ".bai"
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
845 self.subprocess_check_call(["cp", data, dest])
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
846 if bam_index is not None and os.path.exists(bam_index):
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
847 if not os.path.exists(bindex):
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
848 # bai most probably made by galaxy and stored in galaxy dirs, need to copy it to dest
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
849 self.subprocess_check_call(["cp", bam_index, bindex])
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
850 else:
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
851 # Can happen in exotic condition
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
852 # e.g. if bam imported as symlink with datatype=unsorted.bam, then datatype changed to bam
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
853 # => no index generated by galaxy, but there might be one next to the symlink target
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
854 # this trick allows to skip the bam sorting made by galaxy if already done outside
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
855 if os.path.exists(os.path.realpath(data) + ".bai"):
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
856 self.symlink_or_copy(os.path.realpath(data) + ".bai", bindex)
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
857 else:
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
858 log.warn("Could not find a bam index (.bai file) for %s", data)
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
859 trackDict = {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
860 "type": "AlignmentsTrack",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
861 "trackId": tId,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
862 "name": trackData["name"],
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
863 "category": [
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
864 categ,
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
865 ],
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
866 "assemblyNames": [self.genome_name],
50
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
867 "adapter": {
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
868 "type": "BamAdapter",
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
869 "bamLocation": {"uri": url},
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
870 "index": {
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
871 "location": {
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
872 "uri": bindex,
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
873 }
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
874 },
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
875 },
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
876 "displays": [
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
877 {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
878 "type": "LinearAlignmentsDisplay",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
879 "displayId": "%s-LinearAlignmentsDisplay" % tId,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
880 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
881 ],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
882 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
883 self.tracksToAdd.append(trackDict)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
884 self.trackIdlist.append(tId)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
885
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
886 def add_cram(self, data, trackData, cram_index=None, **kwargs):
19
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
887 tId = trackData["label"]
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
888 categ = trackData["category"]
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
889 useuri = trackData["useuri"].lower() == "yes"
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
890 if useuri:
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
891 url = data
19
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
892 else:
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
893 fname = "%s.cram" % trackData["label"]
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
894 dest = "%s/%s" % (self.outdir, fname)
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
895 url = fname
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
896 self.subprocess_check_call(["cp", data, dest])
55
469c0f6d87d7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 0553bb75a96ae401623face516c1cf6e1cfe743f
fubar
parents: 54
diff changeset
897 if cram_index is not None and os.path.exists(cram_index):
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
898 if not os.path.exists(dest + ".crai"):
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
899 # most probably made by galaxy and stored in galaxy dirs, need to copy it to dest
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
900 self.subprocess_check_call(
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
901 ["cp", os.path.realpath(cram_index), dest + ".crai"]
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
902 )
53
bdfa6a7c4543 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4-dirty
fubar
parents: 50
diff changeset
903 else:
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
904 cpath = os.path.realpath(dest) + ".crai"
53
bdfa6a7c4543 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4-dirty
fubar
parents: 50
diff changeset
905 cmd = ["samtools", "index", "-c", "-o", cpath, os.path.realpath(dest)]
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
906 logging.debug("executing cmd %s" % " ".join(cmd))
53
bdfa6a7c4543 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4-dirty
fubar
parents: 50
diff changeset
907 self.subprocess_check_call(cmd)
19
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
908 trackDict = {
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
909 "type": "AlignmentsTrack",
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
910 "trackId": tId,
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
911 "name": trackData["name"],
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
912 "category": [
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
913 categ,
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
914 ],
19
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
915 "assemblyNames": [self.genome_name],
50
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
916 "adapter": {
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
917 "type": "CramAdapter",
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
918 "cramLocation": {"uri": url},
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
919 "craiLocation": {
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
920 "uri": url + ".crai",
50
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
921 },
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
922 "sequenceAdapter": self.genome_sequence_adapter,
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
923 },
19
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
924 "displays": [
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
925 {
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
926 "type": "LinearAlignmentsDisplay",
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
927 "displayId": "%s-LinearAlignmentsDisplay" % tId,
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
928 },
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
929 ],
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
930 }
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
931 self.tracksToAdd.append(trackDict)
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
932 self.trackIdlist.append(tId)
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
933
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
934 def add_vcf(self, data, trackData):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
935 tId = trackData["label"]
19
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
936 # url = "%s/api/datasets/%s/display" % (
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
937 # self.giURL,
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
938 # trackData["metadata"]["dataset_id"],
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
939 # )
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
940 categ = trackData["category"]
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
941 useuri = trackData["useuri"].lower() == "yes"
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
942 if useuri:
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
943 url = data
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
944 else:
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
945 url = "%s.vcf.gz" % tId
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
946 dest = "%s/%s" % (self.outdir, url)
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
947 cmd = "bgzip -c %s > %s" % (data, dest)
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
948 self.subprocess_popen(cmd)
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
949 cmd = ["tabix", "-f", "-p", "vcf", dest]
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
950 self.subprocess_check_call(cmd)
50
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
951 trackDict = {
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
952 "type": "VariantTrack",
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
953 "trackId": tId,
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
954 "name": trackData["name"],
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
955 "assemblyNames": [self.genome_name],
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
956 "category": [
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
957 categ,
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
958 ],
50
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
959 "adapter": {
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
960 "type": "VcfTabixAdapter",
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
961 "vcfGzLocation": {"uri": url},
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
962 "index": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
963 "location": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
964 "uri": url + ".tbi",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
965 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
966 },
50
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
967 },
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
968 "displays": [
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
969 {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
970 "type": "LinearVariantDisplay",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
971 "displayId": "%s-LinearVariantDisplay" % tId,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
972 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
973 {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
974 "type": "ChordVariantDisplay",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
975 "displayId": "%s-ChordVariantDisplay" % tId,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
976 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
977 {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
978 "type": "LinearPairedArcDisplay",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
979 "displayId": "%s-LinearPairedArcDisplay" % tId,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
980 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
981 ],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
982 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
983 self.tracksToAdd.append(trackDict)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
984 self.trackIdlist.append(tId)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
985
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
986 def _sort_gff(self, data, dest):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
987 # Only index if not already done
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
988 if not os.path.exists(dest):
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
989 cmd = "jbrowse sort-gff '%s' | bgzip -c > '%s'" % (
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
990 data,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
991 dest,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
992 ) # "gff3sort.pl --precise '%s' | grep -v \"^$\" > '%s'"
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
993 self.subprocess_popen(cmd)
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
994 self.subprocess_check_call(["tabix", "-f", "-p", "gff", dest])
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
995
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
996 def _sort_bed(self, data, dest):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
997 # Only index if not already done
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
998 if not os.path.exists(dest):
23
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
999 cmd = "sort -k1,1 -k2,2n '%s' | bgzip -c > '%s'" % (data, dest)
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1000 self.subprocess_popen(cmd)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1001 cmd = ["tabix", "-f", "-p", "bed", dest]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1002 self.subprocess_check_call(cmd)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1003
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1004 def add_gff(self, data, ext, trackData):
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1005 useuri = trackData["useuri"].lower() == "yes"
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1006 if useuri:
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1007 url = trackData["path"]
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1008 else:
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1009 url = "%s.%s.gz" % (trackData["label"], ext)
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1010 dest = "%s/%s" % (self.outdir, url)
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1011 self._sort_gff(data, dest)
50
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
1012 tId = trackData["label"]
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1013 categ = trackData["category"]
50
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
1014 trackDict = {
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
1015 "type": "FeatureTrack",
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
1016 "trackId": tId,
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
1017 "name": trackData["name"],
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
1018 "assemblyNames": [self.genome_name],
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1019 "category": [
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1020 categ,
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1021 ],
50
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
1022 "adapter": {
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1023 "type": "Gff3TabixAdapter",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1024 "gffGzLocation": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1025 "uri": url,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1026 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1027 "index": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1028 "location": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1029 "uri": url + ".tbi",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1030 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1031 },
50
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
1032 },
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1033 "displays": [
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1034 {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1035 "type": "LinearBasicDisplay",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1036 "displayId": "%s-LinearBasicDisplay" % tId,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1037 },
17
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
1038 {
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
1039 "type": "LinearArcDisplay",
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
1040 "displayId": "%s-LinearArcDisplay" % tId,
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
1041 },
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1042 ],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1043 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1044 self.tracksToAdd.append(trackDict)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1045 self.trackIdlist.append(tId)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1046
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1047 def add_bed(self, data, ext, trackData):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1048 tId = trackData["label"]
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1049 categ = trackData["category"]
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1050 useuri = trackData["useuri"].lower() == "yes"
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1051 if useuri:
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1052 url = data
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1053 else:
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1054 url = "%s.%s.gz" % (trackData["label"], ext)
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1055 dest = "%s/%s" % (self.outdir, url)
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1056 self._sort_bed(data, dest)
50
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
1057 trackDict = {
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
1058 "type": "FeatureTrack",
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
1059 "trackId": tId,
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
1060 "name": trackData["name"],
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
1061 "assemblyNames": [self.genome_name],
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
1062 "adapter": {
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1063 "category": [
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1064 categ,
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1065 ],
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1066 "type": "BedTabixAdapter",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1067 "bedGzLocation": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1068 "uri": url,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1069 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1070 "index": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1071 "location": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1072 "uri": url + ".tbi",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1073 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1074 },
50
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
1075 },
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1076 "displays": [
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1077 {
9
a26c41e304c3 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1b7e6ba50013775621cbdfdc101152a7f5c5e15b
fubar
parents: 7
diff changeset
1078 "type": "LinearBasicDisplay",
a26c41e304c3 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1b7e6ba50013775621cbdfdc101152a7f5c5e15b
fubar
parents: 7
diff changeset
1079 "displayId": "%s-LinearBasicDisplay" % tId,
a26c41e304c3 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1b7e6ba50013775621cbdfdc101152a7f5c5e15b
fubar
parents: 7
diff changeset
1080 },
a26c41e304c3 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1b7e6ba50013775621cbdfdc101152a7f5c5e15b
fubar
parents: 7
diff changeset
1081 {
5
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
1082 "type": "LinearPileupDisplay",
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
1083 "displayId": "%s-LinearPileupDisplay" % tId,
efc64d8f4b72 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9
fubar
parents: 3
diff changeset
1084 },
17
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
1085 {
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
1086 "type": "LinearArcDisplay",
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
1087 "displayId": "%s-LinearArcDisplay" % tId,
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
1088 },
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1089 ],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1090 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1091 self.tracksToAdd.append(trackDict)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1092 self.trackIdlist.append(tId)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1093
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1094 def add_paf(self, data, trackData, pafOpts, **kwargs):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1095 tname = trackData["name"]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1096 tId = trackData["label"]
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1097 categ = trackData["category"]
34
2893ef33fba9 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd
fubar
parents: 32
diff changeset
1098 pgnames = [x.strip() for x in pafOpts["genome_label"].split(",")]
2893ef33fba9 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd
fubar
parents: 32
diff changeset
1099 pgpaths = [x.strip() for x in pafOpts["genome"].split(",")]
2893ef33fba9 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd
fubar
parents: 32
diff changeset
1100 passnames = [self.genome_name] # always first
31
cb4b32ca9968 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919-dirty
fubar
parents: 30
diff changeset
1101 for i, gname in enumerate(pgnames):
cb4b32ca9968 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919-dirty
fubar
parents: 30
diff changeset
1102 if len(gname.split()) > 1:
cb4b32ca9968 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919-dirty
fubar
parents: 30
diff changeset
1103 gname = gname.split()[0]
47
3e53204c2419 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a-dirty
fubar
parents: 46
diff changeset
1104 passnames.append(gname)
31
cb4b32ca9968 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919-dirty
fubar
parents: 30
diff changeset
1105 # trouble from spacey names in command lines avoidance
cb4b32ca9968 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919-dirty
fubar
parents: 30
diff changeset
1106 if gname not in self.genome_names:
34
2893ef33fba9 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd
fubar
parents: 32
diff changeset
1107 # ignore if already there - eg for duplicates among pafs.
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1108 useuri = pgpaths[i].startswith("http://") or pgpaths[i].startswith(
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1109 "https://"
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1110 )
54
d6b0feb22584 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 53aab6394c715dc2d7fdd9188d6c9834e0516b5c
fubar
parents: 53
diff changeset
1111 asstrack = self.make_assembly(pgpaths[i], gname, useuri)
31
cb4b32ca9968 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919-dirty
fubar
parents: 30
diff changeset
1112 self.genome_names.append(gname)
cb4b32ca9968 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919-dirty
fubar
parents: 30
diff changeset
1113 if self.config_json.get("assemblies", None):
cb4b32ca9968 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919-dirty
fubar
parents: 30
diff changeset
1114 self.config_json["assemblies"].append(asstrack)
cb4b32ca9968 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919-dirty
fubar
parents: 30
diff changeset
1115 else:
cb4b32ca9968 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919-dirty
fubar
parents: 30
diff changeset
1116 self.config_json["assemblies"] = [
cb4b32ca9968 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919-dirty
fubar
parents: 30
diff changeset
1117 asstrack,
cb4b32ca9968 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919-dirty
fubar
parents: 30
diff changeset
1118 ]
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1119 url = "%s.paf" % (trackData["label"])
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1120 dest = "%s/%s" % (self.outdir, url)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1121 self.symlink_or_copy(os.path.realpath(data), dest)
7
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1122 trackDict = {
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1123 "type": "SyntenyTrack",
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1124 "trackId": tId,
31
cb4b32ca9968 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919-dirty
fubar
parents: 30
diff changeset
1125 "assemblyNames": passnames,
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1126 "category": [
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1127 categ,
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1128 ],
7
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1129 "name": tname,
50
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
1130 "adapter": {
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
1131 "type": "PAFAdapter",
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
1132 "pafLocation": {"uri": url},
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
1133 "assemblyNames": passnames,
f350467f9433 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 44df75b3714aa9e02983e0b67ef43fc0eee4a8d4
fubar
parents: 49
diff changeset
1134 },
56
c0097a584a8a planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674
fubar
parents: 55
diff changeset
1135 "displays": [
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1136 {
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1137 "type": "LinearSyntenyDisplay",
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1138 "displayId": "%s-LinearSyntenyDisplay" % tId,
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1139 },
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1140 {
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1141 "type": "DotPlotDisplay",
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1142 "displayId": "%s-DotPlotDisplay" % tId,
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1143 },
56
c0097a584a8a planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674
fubar
parents: 55
diff changeset
1144 ],
7
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1145 }
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1146 self.tracksToAdd.append(trackDict)
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1147 self.trackIdlist.append(tId)
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1148
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1149 def process_annotations(self, track):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1150 category = track["category"].replace("__pd__date__pd__", TODAY)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1151 for i, (
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1152 dataset_path,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1153 dataset_ext,
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1154 useuri,
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1155 track_human_label,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1156 extra_metadata,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1157 ) in enumerate(track["trackfiles"]):
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1158 if not dataset_path.strip().startswith("http"):
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1159 # Unsanitize labels (element_identifiers are always sanitized by Galaxy)
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1160 for key, value in mapped_chars.items():
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1161 track_human_label = track_human_label.replace(value, key)
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1162 track_human_label = track_human_label.replace(" ", "_")
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1163 outputTrackConfig = {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1164 "category": category,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1165 "style": {},
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1166 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1167
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1168 outputTrackConfig["key"] = track_human_label
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1169 outputTrackConfig["useuri"] = useuri
48
460d5b6c5d98 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a-dirty
fubar
parents: 47
diff changeset
1170 outputTrackConfig["path"] = dataset_path
460d5b6c5d98 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a-dirty
fubar
parents: 47
diff changeset
1171 outputTrackConfig["ext"] = dataset_ext
7
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1172
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1173 outputTrackConfig["trackset"] = track.get("trackset", {})
19
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
1174 outputTrackConfig["label"] = "%s_%i_%s" % (
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
1175 dataset_ext,
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
1176 i,
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1177 track_human_label,
19
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
1178 )
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1179 outputTrackConfig["metadata"] = extra_metadata
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1180 outputTrackConfig["name"] = track_human_label
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1181
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1182 if dataset_ext in ("gff", "gff3"):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1183 self.add_gff(
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1184 dataset_path,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1185 dataset_ext,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1186 outputTrackConfig,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1187 )
34
2893ef33fba9 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd
fubar
parents: 32
diff changeset
1188 elif dataset_ext in ("hic", "juicebox_hic"):
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1189 self.add_hic(
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1190 dataset_path,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1191 outputTrackConfig,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1192 )
23
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
1193 elif dataset_ext in ("cool", "mcool", "scool"):
30
8f02a84ee278 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919
fubar
parents: 29
diff changeset
1194 hic_url = "%s_%d.juicebox_hic" % (track_human_label, i)
29
f728cf0df71d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit fe89199bded3f50aefb6958f0c4e85eede77ad81-dirty
fubar
parents: 28
diff changeset
1195 hic_path = os.path.join(self.outdir, hic_url)
23
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
1196 self.subprocess_check_call(
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
1197 [
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
1198 "hictk",
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
1199 "convert",
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
1200 "-f",
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
1201 "--output-fmt",
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
1202 "hic",
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
1203 dataset_path,
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
1204 hic_path,
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
1205 ]
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
1206 )
29
f728cf0df71d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit fe89199bded3f50aefb6958f0c4e85eede77ad81-dirty
fubar
parents: 28
diff changeset
1207 outputTrackConfig["hic_url"] = hic_url
23
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
1208 self.add_hic(
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
1209 hic_path,
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
1210 outputTrackConfig,
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
1211 )
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1212 elif dataset_ext in ("bed",):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1213 self.add_bed(
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1214 dataset_path,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1215 dataset_ext,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1216 outputTrackConfig,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1217 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1218 elif dataset_ext in ("maf",):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1219 self.add_maf(
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1220 dataset_path,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1221 outputTrackConfig,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1222 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1223 elif dataset_ext == "bigwig":
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1224 self.add_bigwig(
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1225 dataset_path,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1226 outputTrackConfig,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1227 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1228 elif dataset_ext == "bam":
37
7adde511daa1 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd-dirty
fubar
parents: 35
diff changeset
1229 real_indexes = track["conf"]["options"]["bam"]["bam_index"]
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1230 self.add_bam(
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1231 dataset_path,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1232 outputTrackConfig,
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1233 bam_index=real_indexes,
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1234 )
19
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
1235 elif dataset_ext == "cram":
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1236 real_indexes = track["conf"]["options"]["cram"]["cram_index"]
19
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
1237 self.add_cram(
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
1238 dataset_path,
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
1239 outputTrackConfig,
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1240 cram_index=real_indexes,
19
bde6b1d09f7d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 1290bf486bc55c02fecd0327de10a28655a18e81-dirty
fubar
parents: 17
diff changeset
1241 )
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1242 elif dataset_ext == "blastxml":
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1243 self.add_blastxml(
17
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
1244 dataset_path,
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
1245 outputTrackConfig,
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
1246 track["conf"]["options"]["blast"],
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1247 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1248 elif dataset_ext == "vcf":
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1249 self.add_vcf(dataset_path, outputTrackConfig)
15
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
1250 elif dataset_ext == "paf":
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
1251 self.add_paf(
17
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
1252 dataset_path,
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
1253 outputTrackConfig,
27
4ff1ed2065cc planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit d733fb18a02929c9e9959ad30bd0f1368118e924-dirty
fubar
parents: 25
diff changeset
1254 track["conf"]["options"]["paf"],
15
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
1255 )
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1256 else:
29
f728cf0df71d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit fe89199bded3f50aefb6958f0c4e85eede77ad81-dirty
fubar
parents: 28
diff changeset
1257 logging.warn("Do not know how to handle %s", dataset_ext)
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1258 # Return non-human label for use in other fields
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1259 yield outputTrackConfig["label"]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1260
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1261 def add_default_session(self, default_data):
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1262 """
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1263 Add some default session settings: set some assemblies/tracks on/off
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1264 """
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1265 tracks_data = []
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1266
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1267 # TODO using the default session for now, but check out session specs in the future https://github.com/GMOD/jbrowse-components/issues/2708
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1268
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1269 # We need to know the track type from the config.json generated just before
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1270 track_types = {}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1271 with open(self.config_json_file, "r") as config_file:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1272 config_json = json.load(config_file)
10
c60b17456297 planemo upload commit 740eeca506257070c95f4e9f1a75911c31db5a04
fubar
parents: 9
diff changeset
1273 if self.config_json:
c60b17456297 planemo upload commit 740eeca506257070c95f4e9f1a75911c31db5a04
fubar
parents: 9
diff changeset
1274 config_json.update(self.config_json)
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1275
6
79f7265f90bd planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 79e81bef99f582680d9aa4eec88980c675f3fae9-dirty
fubar
parents: 5
diff changeset
1276 for track_conf in self.tracksToAdd:
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1277 track_types[track_conf["trackId"]] = track_conf["type"]
7
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1278 tId = track_conf["trackId"]
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1279 #if tId in data["visibility"]["default_on"]:
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1280 style_data = default_data["style"].get(tId, None)
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1281 if not style_data:
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1282 logging.warn("### No style data in default data for %s" % tId)
7
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1283 style_data = {"type": "LinearBasicDisplay"}
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1284 if "displays" in track_conf:
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1285 disp = track_conf["displays"][0]["type"]
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1286 style_data["type"] = disp
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1287 style_data["configuration"] = "%s-%s" % (tId, disp)
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1288 if track_conf.get("style_labels", None):
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1289 # TODO fix this: it should probably go in a renderer block (SvgFeatureRenderer) but still does not work
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1290 # TODO move this to per track displays?
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1291 style_data["labels"] = track_conf["style_labels"]
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1292 tracks_data.append(
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1293 {
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1294 "type": track_types[tId],
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1295 "configuration": tId,
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1296 "displays": [style_data],
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1297 }
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1298 )
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1299
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1300 # The view for the assembly we're adding
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1301 view_json = {"type": "LinearGenomeView", "tracks": tracks_data}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1302
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1303 refName = None
17
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
1304 drdict = {
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
1305 "reversed": False,
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
1306 "assemblyName": self.genome_name,
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1307 "start": 1,
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1308 "end": 100000,
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1309 "refName": "x",
17
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
1310 }
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
1311
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1312 if default_data.get("defaultLocation", ""):
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1313 ddl = default_data["defaultLocation"]
23
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
1314 loc_match = re.search(r"^([^:]+):([\d,]*)\.*([\d,]*)$", ddl)
27
4ff1ed2065cc planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit d733fb18a02929c9e9959ad30bd0f1368118e924-dirty
fubar
parents: 25
diff changeset
1315 # allow commas like 100,000 but ignore as integer
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1316 if loc_match:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1317 refName = loc_match.group(1)
17
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
1318 drdict["refName"] = refName
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
1319 if loc_match.group(2) > "":
28
9a5c409f33f4 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit e65f2527a97a04173091d28b939e42101582bc56-dirty
fubar
parents: 27
diff changeset
1320 drdict["start"] = int(loc_match.group(2).replace(",", ""))
17
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
1321 if loc_match.group(3) > "":
28
9a5c409f33f4 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit e65f2527a97a04173091d28b939e42101582bc56-dirty
fubar
parents: 27
diff changeset
1322 drdict["end"] = int(loc_match.group(3).replace(",", ""))
12
247e17ce504b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4baeb144cafbb61ae0587cce731066129097c168-dirty
fubar
parents: 11
diff changeset
1323 else:
247e17ce504b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4baeb144cafbb61ae0587cce731066129097c168-dirty
fubar
parents: 11
diff changeset
1324 logging.info(
247e17ce504b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4baeb144cafbb61ae0587cce731066129097c168-dirty
fubar
parents: 11
diff changeset
1325 "@@@ regexp could not match contig:start..end in the supplied location %s - please fix"
247e17ce504b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4baeb144cafbb61ae0587cce731066129097c168-dirty
fubar
parents: 11
diff changeset
1326 % ddl
247e17ce504b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4baeb144cafbb61ae0587cce731066129097c168-dirty
fubar
parents: 11
diff changeset
1327 )
29
f728cf0df71d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit fe89199bded3f50aefb6958f0c4e85eede77ad81-dirty
fubar
parents: 28
diff changeset
1328 else:
f728cf0df71d planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit fe89199bded3f50aefb6958f0c4e85eede77ad81-dirty
fubar
parents: 28
diff changeset
1329 drdict["refName"] = self.genome_firstcontig
17
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
1330 if drdict.get("refName", None):
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1331 # TODO displayedRegions is not just zooming to the region, it hides the rest of the chromosome
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1332 view_json["displayedRegions"] = [
17
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
1333 drdict,
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1334 ]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1335
17
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
1336 logging.info("@@@ defaultlocation %s for default session" % drdict)
12
247e17ce504b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4baeb144cafbb61ae0587cce731066129097c168-dirty
fubar
parents: 11
diff changeset
1337 else:
247e17ce504b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4baeb144cafbb61ae0587cce731066129097c168-dirty
fubar
parents: 11
diff changeset
1338 logging.info(
13
1d86925dbb4c planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 873a12803692b0a84814a6dc08331d772d0e5492-dirty
fubar
parents: 12
diff changeset
1339 "@@@ no contig name found for default session - please add one!"
12
247e17ce504b planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 4baeb144cafbb61ae0587cce731066129097c168-dirty
fubar
parents: 11
diff changeset
1340 )
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1341 session_name = default_data.get("session_name", "New session")
10
c60b17456297 planemo upload commit 740eeca506257070c95f4e9f1a75911c31db5a04
fubar
parents: 9
diff changeset
1342 for key, value in mapped_chars.items():
c60b17456297 planemo upload commit 740eeca506257070c95f4e9f1a75911c31db5a04
fubar
parents: 9
diff changeset
1343 session_name = session_name.replace(value, key)
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1344 # Merge with possibly existing defaultSession (if upgrading a jbrowse instance)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1345 session_json = {}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1346 if "defaultSession" in config_json:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1347 session_json = config_json["defaultSession"]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1348
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1349 session_json["name"] = session_name
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1350
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1351 if "views" not in session_json:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1352 session_json["views"] = []
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1353
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1354 session_json["views"].append(view_json)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1355
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1356 config_json["defaultSession"] = session_json
10
c60b17456297 planemo upload commit 740eeca506257070c95f4e9f1a75911c31db5a04
fubar
parents: 9
diff changeset
1357 self.config_json.update(config_json)
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1358
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1359 with open(self.config_json_file, "w") as config_file:
10
c60b17456297 planemo upload commit 740eeca506257070c95f4e9f1a75911c31db5a04
fubar
parents: 9
diff changeset
1360 json.dump(self.config_json, config_file, indent=2)
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1361
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1362 def add_general_configuration(self, data):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1363 """
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1364 Add some general configuration to the config.json file
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1365 """
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1366
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1367 config_path = self.config_json_file
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1368 if os.path.exists(config_path):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1369 with open(config_path, "r") as config_file:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1370 config_json = json.load(config_file)
10
c60b17456297 planemo upload commit 740eeca506257070c95f4e9f1a75911c31db5a04
fubar
parents: 9
diff changeset
1371 else:
c60b17456297 planemo upload commit 740eeca506257070c95f4e9f1a75911c31db5a04
fubar
parents: 9
diff changeset
1372 config_json = {}
c60b17456297 planemo upload commit 740eeca506257070c95f4e9f1a75911c31db5a04
fubar
parents: 9
diff changeset
1373 if self.config_json:
c60b17456297 planemo upload commit 740eeca506257070c95f4e9f1a75911c31db5a04
fubar
parents: 9
diff changeset
1374 config_json.update(self.config_json)
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1375 config_data = {}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1376
23
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
1377 config_data["disableAnalytics"] = data.get("analytics", "false") == "true"
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1378
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1379 config_data["theme"] = {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1380 "palette": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1381 "primary": {"main": data.get("primary_color", "#0D233F")},
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1382 "secondary": {"main": data.get("secondary_color", "#721E63")},
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1383 "tertiary": {"main": data.get("tertiary_color", "#135560")},
23
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
1384 "quaternary": {"main": data.get("quaternary_color", "#FFB11D")},
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1385 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1386 "typography": {"fontSize": int(data.get("font_size", 10))},
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1387 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1388 if not config_json.get("configuration", None):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1389 config_json["configuration"] = {}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1390 config_json["configuration"].update(config_data)
10
c60b17456297 planemo upload commit 740eeca506257070c95f4e9f1a75911c31db5a04
fubar
parents: 9
diff changeset
1391 self.config_json.update(config_json)
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1392 with open(config_path, "w") as config_file:
10
c60b17456297 planemo upload commit 740eeca506257070c95f4e9f1a75911c31db5a04
fubar
parents: 9
diff changeset
1393 json.dump(self.config_json, config_file, indent=2)
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1394
56
c0097a584a8a planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674
fubar
parents: 55
diff changeset
1395 def clone_jbrowse(self, realclone=True):
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1396 """Clone a JBrowse directory into a destination directory. This also works in Biocontainer testing now"""
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1397 dest = self.outdir
56
c0097a584a8a planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674
fubar
parents: 55
diff changeset
1398 if realclone:
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1399 self.subprocess_check_call(
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1400 ["jbrowse", "create", dest, "-f", "--tag", f"{JB2VER}"]
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1401 )
56
c0097a584a8a planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674
fubar
parents: 55
diff changeset
1402 else:
c0097a584a8a planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674
fubar
parents: 55
diff changeset
1403 shutil.copytree(self.jbrowse2path, dest, dirs_exist_ok=True)
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1404 for fn in [
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1405 "asset-manifest.json",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1406 "favicon.ico",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1407 "robots.txt",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1408 "umd_plugin.js",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1409 "version.txt",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1410 "test_data",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1411 ]:
38
07849bf248e3 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a74e469a81b38c7142f63de510ae31d3754d1767
fubar
parents: 37
diff changeset
1412 cmd = ["rm", "-rf", os.path.join(dest, fn)]
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1413 self.subprocess_check_call(cmd)
38
07849bf248e3 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a74e469a81b38c7142f63de510ae31d3754d1767
fubar
parents: 37
diff changeset
1414 cmd = ["cp", os.path.join(INSTALLED_TO, "jb2_webserver.py"), dest]
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1415 self.subprocess_check_call(cmd)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1416
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1417
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1418 def parse_style_conf(item):
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1419 if item.text.lower() in ['false','true','yes','no']:
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1420 return item.text.lower in ("yes", "true")
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1421 else:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1422 return item.text
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1423
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1424
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1425 if __name__ == "__main__":
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1426 parser = argparse.ArgumentParser(description="", epilog="")
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1427 parser.add_argument("--xml", help="Track Configuration")
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1428 parser.add_argument(
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1429 "--jbrowse2path", help="Path to JBrowse2 directory in biocontainer or Conda"
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1430 )
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1431 parser.add_argument("--outdir", help="Output directory", default="out")
23
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
1432 parser.add_argument("--version", "-V", action="version", version="%(prog)s 2.0.1")
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1433 args = parser.parse_args()
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1434 tree = ET.parse(args.xml)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1435 root = tree.getroot()
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1436
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1437 # This should be done ASAP
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1438 GALAXY_INFRASTRUCTURE_URL = root.find("metadata/galaxyUrl").text
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1439 # Sometimes this comes as `localhost` without a protocol
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1440 if not GALAXY_INFRASTRUCTURE_URL.startswith("http"):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1441 # so we'll prepend `http://` and hope for the best. Requests *should*
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1442 # be GET and not POST so it should redirect OK
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1443 GALAXY_INFRASTRUCTURE_URL = "http://" + GALAXY_INFRASTRUCTURE_URL
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1444 jc = JbrowseConnector(
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1445 outdir=args.outdir,
38
07849bf248e3 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a74e469a81b38c7142f63de510ae31d3754d1767
fubar
parents: 37
diff changeset
1446 jbrowse2path=args.jbrowse2path,
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1447 genomes=[
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1448 {
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1449 "path": x.attrib["path"],
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1450 "label": x.attrib["label"],
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1451 "useuri": x.attrib["useuri"],
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1452 "meta": metadata_from_node(x.find("metadata")),
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1453 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1454 for x in root.findall("metadata/genomes/genome")
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1455 ],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1456 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1457 jc.process_genomes()
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1458
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1459 # .add_default_view() replace from https://github.com/abretaud/tools-iuc/blob/jbrowse2/tools/jbrowse2/jbrowse2.py
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1460 default_session_data = {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1461 "visibility": {
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1462 "default_on": [],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1463 "default_off": [],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1464 },
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1465 "style": {},
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1466 "style_labels": {},
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1467 }
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1468
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1469 for track in root.findall("tracks/track"):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1470 track_conf = {}
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1471 track_conf["trackfiles"] = []
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1472
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1473 is_multi_bigwig = False
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1474 try:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1475 if track.find("options/wiggle/multibigwig") and (
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1476 track.find("options/wiggle/multibigwig").text == "True"
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1477 ):
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1478 is_multi_bigwig = True
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1479 multi_bigwig_paths = []
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1480 except KeyError:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1481 pass
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1482
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1483 trackfiles = track.findall("files/trackFile")
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1484 if trackfiles:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1485 for x in track.findall("files/trackFile"):
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1486 track_conf["label"] = x.attrib["label"]
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1487 track_conf["useuri"] = x.attrib["useuri"]
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1488 if is_multi_bigwig:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1489 multi_bigwig_paths.append(
17
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
1490 (
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
1491 x.attrib["label"],
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1492 x.attrib["useuri"],
17
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
1493 os.path.realpath(x.attrib["path"]),
4c201a3d4755 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit a37bfdfc108501b11c7b2aa15efb1bd16f0c4b66
fubar
parents: 15
diff changeset
1494 )
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1495 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1496 else:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1497 if trackfiles:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1498 metadata = metadata_from_node(x.find("metadata"))
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1499 track_conf["dataset_id"] = metadata["dataset_id"]
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1500 if x.attrib["useuri"].lower() == "yes":
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1501 tfa = (
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1502 x.attrib["path"],
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1503 x.attrib["ext"],
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1504 x.attrib["useuri"],
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1505 x.attrib["label"],
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1506 metadata,
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1507 )
46
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1508 else:
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1509 tfa = (
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1510 os.path.realpath(x.attrib["path"]),
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1511 x.attrib["ext"],
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1512 x.attrib["useuri"],
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1513 x.attrib["label"],
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1514 metadata,
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1515 )
4181e97c70a7 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 3a43e9e0ffce0966101203102e769d1ced28618a
fubar
parents: 44
diff changeset
1516 track_conf["trackfiles"].append(tfa)
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1517
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1518 if is_multi_bigwig:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1519 metadata = metadata_from_node(x.find("metadata"))
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1520
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1521 track_conf["trackfiles"].append(
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1522 (
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1523 multi_bigwig_paths, # Passing an array of paths to represent as one track
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1524 "bigwig_multiple",
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1525 "MultiBigWig", # Giving an hardcoded name for now
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1526 {}, # No metadata for multiple bigwig
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1527 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1528 )
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1529 track_conf["category"] = track.attrib["cat"]
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1530 track_conf["format"] = track.attrib["format"]
7
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1531 if track.find("options/style"):
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1532 track_conf["style"] = {
23
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
1533 item.tag: parse_style_conf(item) for item in track.find("options/style")
7
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1534 }
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1535 else:
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1536 track_conf["style"] = {}
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1537 tst = track_conf["style"].get("type", None)
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1538 if tst:
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1539 track_conf["style"]["configuration"] = "%s-%s" % (track_conf["label"], tst)
7
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1540 if track.find("options/style_labels"):
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1541 track_conf["style_labels"] = {
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1542 item.tag: parse_style_conf(item)
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1543 for item in track.find("options/style_labels")
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1544 }
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1545
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1546 track_conf["conf"] = etree_to_dict(track.find("options"))
15
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
1547 track_conf["category"] = track.attrib["cat"]
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
1548 track_conf["format"] = track.attrib["format"]
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1549 keys = jc.process_annotations(track_conf)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1550
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1551 if keys:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1552 for key in keys:
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1553 default_session_data["visibility"][
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1554 track.attrib.get("visibility", "default_off")
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1555 ].append(key)
7
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1556 if track_conf.get("style", None):
57
94264fe60478 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 4b5df41484f6bdf316edaf95b53c92d328ec1674-dirty
fubar
parents: 56
diff changeset
1557 default_session_data["style"][key] = track_conf["style"]
7
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1558 if track_conf.get("style_lables", None):
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1559 default_session_data["style_labels"][key] = track_conf.get(
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1560 "style_labels", None
b04fd993b31e planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 53a108d8153c955044ae7eb8cb06bdcfd0036717
fubar
parents: 6
diff changeset
1561 )
15
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
1562 default_session_data["defaultLocation"] = root.find(
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
1563 "metadata/general/defaultLocation"
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
1564 ).text
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
1565 default_session_data["session_name"] = root.find(
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
1566 "metadata/general/session_name"
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
1567 ).text
34
2893ef33fba9 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd
fubar
parents: 32
diff changeset
1568 jc.zipOut = root.find("metadata/general/zipOut").text == "true"
15
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
1569 general_data = {
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
1570 "analytics": root.find("metadata/general/analytics").text,
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
1571 "primary_color": root.find("metadata/general/primary_color").text,
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
1572 "secondary_color": root.find("metadata/general/secondary_color").text,
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
1573 "tertiary_color": root.find("metadata/general/tertiary_color").text,
23
39b717d934a8 planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit be2268f4c11d54bdd44789dd88dd9017cad27887-dirty
fubar
parents: 19
diff changeset
1574 "quaternary_color": root.find("metadata/general/quaternary_color").text,
15
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
1575 "font_size": root.find("metadata/general/font_size").text,
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
1576 }
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
1577 jc.add_general_configuration(general_data)
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
1578 trackconf = jc.config_json.get("tracks", None)
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
1579 if trackconf:
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
1580 jc.config_json["tracks"].update(jc.tracksToAdd)
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
1581 else:
cce8dacb240f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1a20cf06627d429a211427753f223467188dbe7f-dirty
fubar
parents: 14
diff changeset
1582 jc.config_json["tracks"] = jc.tracksToAdd
9
a26c41e304c3 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 1b7e6ba50013775621cbdfdc101152a7f5c5e15b
fubar
parents: 7
diff changeset
1583 jc.write_config()
0
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1584 jc.add_default_session(default_session_data)
d78175596286 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit cd77dffaad652cfb75b98bde5231beaa6d63cd5b-dirty
fubar
parents:
diff changeset
1585 # jc.text_index() not sure what broke here.