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