annotate jbrowse2.py.apr17 @ 93:4c517a0041a8 draft

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