# HG changeset patch # User iuc # Date 1480434930 18000 # Node ID ad4b9d7eae6ad49ce9c89f5b730739f1cbcdcfbd # Parent 1e74f16adaa19acd83f1b296cebfbcf85e2b84af planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 9a243c616a4a3156347e38fdb5f35863ae5133f9 diff -r 1e74f16adaa1 -r ad4b9d7eae6a all_fasta.loc.sample --- a/all_fasta.loc.sample Sun Jun 26 10:50:15 2016 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -#This file lists the locations and dbkeys of all the fasta files -#under the "genome" directory (a directory that contains a directory -#for each build). The script extract_fasta.py will generate the file -#all_fasta.loc. This file has the format (white space characters are -#TAB characters): -# -# -# -#So, all_fasta.loc could look something like this: -# -#apiMel3 apiMel3 Honeybee (Apis mellifera): apiMel3 /path/to/genome/apiMel3/apiMel3.fa -#hg19canon hg19 Human (Homo sapiens): hg19 Canonical /path/to/genome/hg19/hg19canon.fa -#hg19full hg19 Human (Homo sapiens): hg19 Full /path/to/genome/hg19/hg19full.fa -# -#Your all_fasta.loc file should contain an entry for each individual -#fasta file. So there will be multiple fasta files for each build, -#such as with hg19 above. -# diff -r 1e74f16adaa1 -r ad4b9d7eae6a blastxml_to_gapped_gff3.py --- a/blastxml_to_gapped_gff3.py Sun Jun 26 10:50:15 2016 -0400 +++ b/blastxml_to_gapped_gff3.py Tue Nov 29 10:55:30 2016 -0500 @@ -1,10 +1,12 @@ #!/usr/bin/perl +import argparse +import copy +import logging import re import sys -import copy -import argparse + from BCBio import GFF -import logging + logging.basicConfig(level=logging.INFO) log = logging.getLogger(name='blastxml2gff3') @@ -218,7 +220,6 @@ else: log.warn("Bad data: \n\t%s\n\t%s\n\t%s\n" % (query, match, subject)) - if strict_m: if ret == '=' or ret == 'X': ret = 'M' diff -r 1e74f16adaa1 -r ad4b9d7eae6a gff3_rebase.py --- a/gff3_rebase.py Sun Jun 26 10:50:15 2016 -0400 +++ b/gff3_rebase.py Tue Nov 29 10:55:30 2016 -0500 @@ -1,11 +1,13 @@ #!/usr/bin/env python -import sys -import logging -logging.basicConfig(level=logging.INFO) import argparse import copy +import logging +import sys + from BCBio import GFF from Bio.SeqFeature import FeatureLocation + +logging.basicConfig(level=logging.INFO) log = logging.getLogger(__name__) __author__ = "Eric Rasche" diff -r 1e74f16adaa1 -r ad4b9d7eae6a jbrowse-fromdir.xml --- a/jbrowse-fromdir.xml Sun Jun 26 10:50:15 2016 -0400 +++ b/jbrowse-fromdir.xml Tue Nov 29 10:55:30 2016 -0500 @@ -1,11 +1,10 @@ - + upgrades the bare data directory to a full JBrowse instance macros.xml - python jbrowse.py --version + + - - - - 10.1101/gr.094607.109 - + - diff -r 1e74f16adaa1 -r ad4b9d7eae6a jbrowse.py --- a/jbrowse.py Sun Jun 26 10:50:15 2016 -0400 +++ b/jbrowse.py Tue Nov 29 10:55:30 2016 -0500 @@ -1,17 +1,19 @@ #!/usr/bin/env python -import os +import argparse import copy -import argparse -import subprocess import hashlib +import json +import logging +import os +import shutil import struct +import subprocess import tempfile -import shutil -import json +import xml.etree.ElementTree as ET +from collections import defaultdict + from Bio.Data import CodonTable -import xml.etree.ElementTree as ET -import logging -from collections import defaultdict + logging.basicConfig(level=logging.INFO) log = logging.getLogger('jbrowse') @@ -79,11 +81,11 @@ """, 'blast': """ var opacity = 0; - if(score == 0.0) {{ + if(score == 0.0) { opacity = 1; - }} else {{ + } else{ opacity = (20 - Math.log10(score)) / 180; - }} + } """ } @@ -125,7 +127,7 @@ def rgb_from_hex(self, hexstr): # http://stackoverflow.com/questions/4296249/how-do-i-convert-a-hex-triplet-to-an-rgb-tuple-and-back - return struct.unpack('BBB',hexstr.decode('hex')) + return struct.unpack('BBB', hexstr.decode('hex')) def min_max_gff(self, gff_file): min_val = None @@ -154,6 +156,31 @@ self.brewer_colour_idx += 1 return r, g, b + def parse_menus(self, track): + trackConfig = {'menuTemplate': [{}, {}, {}]} + + if 'menu' in track['menus']: + menu_list = [track['menus']['menu']] + if isinstance(track['menus']['menu'], list): + menu_list = track['menus']['menu'] + + for m in menu_list: + tpl = { + 'action': m['action'], + 'label': m.get('label', '{name}'), + 'iconClass': m.get('iconClass', 'dijitIconBookmark'), + } + if 'url' in m: + tpl['url'] = m['url'] + if 'content' in m: + tpl['content'] = m['content'] + if 'title' in m: + tpl['title'] = m['title'] + + trackConfig['menuTemplate'].append(tpl) + + return trackConfig + def parse_colours(self, track, trackFormat, gff3=None): # Wiggle tracks have a bicolor pallete trackConfig = {'style': {}} @@ -166,7 +193,6 @@ trackConfig['style']['neg_color'] = self.hex_from_rgb(*self._get_colours()) trackConfig['style']['pos_color'] = self.hex_from_rgb(*self._get_colours()) - # Wiggle tracks can change colour at a specified place bc_pivot = track['wiggle']['bicolor_pivot'] if bc_pivot not in ('mean', 'zero'): @@ -223,7 +249,7 @@ auto_color = "'%s'" % self.hex_from_rgb(*self._get_colours()) color_function = self.COLOR_FUNCTION_TEMPLATE_QUAL.format(**{ - 'opacity': self.OPACITY_MATH[algo].format(**{'max': max_val,'min': min_val}), + 'opacity': self.OPACITY_MATH[algo].format(**{'max': max_val, 'min': min_val}), 'user_spec_color': user_color, 'auto_gen_color': auto_color, }) @@ -240,14 +266,14 @@ for dc in map(etree_to_dict, children): for k, v in dc.iteritems(): dd[k].append(v) - d = {t.tag: {k:v[0] if len(v) == 1 else v for k, v in dd.iteritems()}} + d = {t.tag: {k: v[0] if len(v) == 1 else v for k, v in dd.iteritems()}} if t.attrib: d[t.tag].update(('@' + k, v) for k, v in t.attrib.iteritems()) if t.text: text = t.text.strip() if children or t.attrib: if text: - d[t.tag]['#text'] = text + d[t.tag]['#text'] = text else: d[t.tag] = text return d @@ -274,6 +300,7 @@ self.genome_paths = genomes self.standalone = standalone self.gencode = gencode + self.tracksToIndex = [] if standalone: self.clone_jbrowse(self.jbrowse, self.outdir) @@ -302,7 +329,6 @@ with open(trackList, 'w') as handle: json.dump(trackListData, handle, indent=2) - def subprocess_check_call(self, command): log.debug('cd %s && %s', self.outdir, ' '.join(command)) subprocess.check_call(command, cwd=self.outdir) @@ -316,11 +342,23 @@ 'perl', self._jbrowse_bin('prepare-refseqs.pl'), '--fasta', genome_path]) - # Generate name - # self.subprocess_check_call([ - # 'perl', self._jbrowse_bin('generate-names.pl'), - # '--hashBits', '16' - # ]) + def generate_names(self): + # Generate names + + args = [ + 'perl', self._jbrowse_bin('generate-names.pl'), + '--hashBits', '16' + ] + + tracks = ','.join(self.tracksToIndex) + + if tracks: + args += ['--tracks', tracks] + else: + # No tracks to index, index only the refseq + args += ['--tracks', 'DNA'] + + self.subprocess_check_call(args) def _add_json(self, json_data): @@ -343,7 +381,6 @@ self.subprocess_check_call(cmd) os.unlink(tmp.name) - def _blastxml_to_gff3(self, xml, min_gap=10): gff3_unrebased = tempfile.NamedTemporaryFile(delete=False) cmd = ['python', os.path.join(INSTALLED_TO, 'blastxml_to_gapped_gff3.py'), @@ -389,6 +426,9 @@ self.subprocess_check_call(cmd) os.unlink(gff3) + if blastOpts.get('index', 'false') == 'true': + self.tracksToIndex.append("%s" % trackData['label']) + def add_bigwig(self, data, trackData, wiggleOpts, **kwargs): dest = os.path.join('data', 'raw', trackData['label'] + '.bw') cmd = ['ln', data, dest] @@ -425,7 +465,6 @@ "storeClass": "JBrowse/Store/SeqFeature/BAM", }) - self._add_track_json(trackData) if bamOpts.get('auto_snp', 'false') == 'true': @@ -433,7 +472,7 @@ trackData2.update({ "type": "JBrowse/View/Track/SNPCoverage", "key": trackData['key'] + " - SNPs/Coverage", - "label": trackData['label'] + "_autosnp", + "label": trackData['label'] + "_autosnp", }) self._add_track_json(trackData2) @@ -468,7 +507,7 @@ clientConfig = trackData['style'] del config['style'] - if 'match' in gffOpts: + if 'match' in gffOpts: config['glyph'] = 'JBrowse/View/FeatureGlyph/Segments' cmd += ['--type', gffOpts['match']] @@ -488,12 +527,14 @@ self.subprocess_check_call(cmd) + if gffOpts.get('index', 'false') == 'true': + self.tracksToIndex.append("%s" % trackData['label']) def process_annotations(self, track): outputTrackConfig = { 'style': { - 'label': track['style'].get('label', 'description'), - 'className': track['style'].get('className', 'feature'), + 'label': track['style'].get('label', 'description'), + 'className': track['style'].get('className', 'feature'), 'description': track['style'].get('description', ''), }, 'category': track['category'], @@ -516,11 +557,14 @@ else: outputTrackConfig[key] = colourOptions[key] + menus = self.cs.parse_menus(track['conf']['options']) + outputTrackConfig.update(menus) + # import pprint; pprint.pprint(track) # import sys; sys.exit() if dataset_ext in ('gff', 'gff3', 'bed'): self.add_features(dataset_path, dataset_ext, outputTrackConfig, - track['conf']['options']['gff']) + track['conf']['options']['gff']) elif dataset_ext == 'bigwig': self.add_bigwig(dataset_path, outputTrackConfig, track['conf']['options']['wiggle']) @@ -645,14 +689,14 @@ try: # Only pertains to gff3 + blastxml. TODO? track_conf['style'] = {t.tag: t.text for t in track.find('options/style')} - except TypeError, te: + except TypeError: track_conf['style'] = {} pass track_conf['conf'] = etree_to_dict(track.find('options')) keys = jc.process_annotations(track_conf) - for key in keys: extra_data['visibility'][track.attrib.get('visibility', 'default_off')].append(key) jc.add_final_data(extra_data) + jc.generate_names() diff -r 1e74f16adaa1 -r ad4b9d7eae6a jbrowse.xml --- a/jbrowse.xml Sun Jun 26 10:50:15 2016 -0400 +++ b/jbrowse.xml Tue Nov 29 10:55:30 2016 -0500 @@ -1,17 +1,16 @@ - + genome browser macros.xml - python jbrowse.py --version $gencode - #if str($action.reference_genome.genome_type_select) == "indexed": - ${action.reference_genome.genomes.fields.path} - #else - #for $genome in $action.reference_genome.genomes: - $genome - #end for - #end if + #if str($reference_genome.genome_type_select) == "indexed": + ${reference_genome.genomes.fields.path} + #else + #for $genome in $reference_genome.genomes: + $genome + #end for + #end if ${jbgen.defaultLocation} @@ -145,6 +144,25 @@ #end if + + #for $menu_item in $track.data_format.jbmenu.track_menu: + + ${menu_item.menu_action} + #if str($menu_item.menu_label) != "": + + #end if + #if str($menu_item.menu_title) != "": + ${menu_item.menu_title} + #end if + #if str($menu_item.menu_url) != "": + ${menu_item.menu_url.replace("&", "&").replace("\"", """)} + #end if + #if str($menu_item.menu_icon) != "": + ${menu_item.menu_icon} + #end if + + #end for + #end if #if str($track.data_format.data_format_select) == "wiggle": @@ -194,6 +212,7 @@ #end if ${track.data_format.is_protein} ${track.data_format.min_gap} + ${track.data_format.index} #else if str($track.data_format.data_format_select) == "gene_calls": @@ -201,6 +220,7 @@ #if $track.data_format.match_part.match_part_select: ${track.data_format.match_part.name} #end if + ${track.data_format.index} ## #else if str($track.data_format.data_format_select) == "sparql": ## @@ -216,32 +236,40 @@ #end for -]]> - +]]> - - - - + + + + - - - - - - + + + + + + + + + + + @@ -263,6 +291,20 @@ + + + + + + + + + + + - + @@ -301,6 +343,8 @@ truevalue="true" falsevalue="false" /> + + + @@ -317,7 +362,7 @@ - + + + + + @@ -367,7 +416,7 @@ truevalue="true" falsevalue="false" /> - + @@ -406,97 +455,280 @@ - + + - + + - + + + + + + + + + + + + + + + +
+ + + + + + +
+
+ + + + + + + + + + + + + +
+
+
+ + + + + + + + +
+ + + + + + +
+
+
+
+ + + +
`__ for more +specification `__ for more information). If the data is match/match part, you will need to specify the top level match feature name, as it can be one of a few different SO terms, and JiG does not yet have the ability to understand SO terms. @@ -755,8 +981,5 @@ @ATTRIBUTION@ ]]> - - 10.1101/gr.094607.109 - +
- diff -r 1e74f16adaa1 -r ad4b9d7eae6a macros.xml --- a/macros.xml Sun Jun 26 10:50:15 2016 -0400 +++ b/macros.xml Tue Nov 29 10:55:30 2016 -0500 @@ -2,10 +2,8 @@ - jbrowse - bundle_jbrowse + jbrowse python - perl biopython bcbiogff samtools @@ -13,7 +11,8 @@ - 1.0 + \$GALAXY_JBROWSE_SHARED_DIR + 0.5.1 @@ -28,43 +27,6 @@ This Galaxy tool relies on the JBrowse, maintained by the GMOD Community. The Galaxy wrapper is developed by Eric Rasche ]]> - - - - - - - - - - - - - - - - - - - - - - + @@ -257,8 +219,8 @@
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + 10.1101/gr.094607.109 + + diff -r 1e74f16adaa1 -r ad4b9d7eae6a readme.rst --- a/readme.rst Sun Jun 26 10:50:15 2016 -0400 +++ b/readme.rst Tue Nov 29 10:55:30 2016 -0500 @@ -25,6 +25,9 @@ History ======= +- 0.5.1 Support for contextual menus. Conda tests. +- 0.5 Update existing instances on disk. Index names. Support HTML tracks + instead of Canvas. Support default tracks. General JBrowse optinos - 0.4 Support for dataset collections and customisation of tracks including labelling, colours, styling. Added support for genetic code selection. Fixed package installation recipe issues. diff -r 1e74f16adaa1 -r ad4b9d7eae6a test-data/frameshift/1.gff --- a/test-data/frameshift/1.gff Sun Jun 26 10:50:15 2016 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -##gff-version 3 -##sequence-region Merlin 1 172788 -Merlin GeneMark.hmm gene 10 20 . + . ID=Merlin_1;seqid=Merlin -Merlin GeneMark.hmm mRNA 10 20 . + . ID=Merlin_1_mRNA;Parent=Merlin_1 -Merlin GeneMark.hmm exon 10 20 . + . Parent=Merlin_1_mRNA -Merlin GeneMark.hmm CDS 10 20 1000 + 0 ID=Merlin_1_CDS ;Parent=Merlin_1_mRNA -Merlin GeneMark.hmm CDS 19 30 500 + 0 ID=Merlin_1_CDS ;Parent=Merlin_1_mRNA diff -r 1e74f16adaa1 -r ad4b9d7eae6a test-data/frameshift/test.xml --- a/test-data/frameshift/test.xml Sun Jun 26 10:50:15 2016 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ - - - - 11 - - test-data/merlin.fa - - - Merlin:1-50 - 40 - true - - true - true - false - true - false - - - - - - - - - - - - - ignore - - __auto__ - - - - - - diff -r 1e74f16adaa1 -r ad4b9d7eae6a test-data/gencode/test-1.xml --- a/test-data/gencode/test-1.xml Sun Jun 26 10:50:15 2016 -0400 +++ b/test-data/gencode/test-1.xml Tue Nov 29 10:55:30 2016 -0500 @@ -3,8 +3,20 @@ 1 - test-data/merlin.fa + /tmp/tmpPJZIQf/files/000/dataset_1.dat + + + 20 + + true + + true + true + true + true + false + diff -r 1e74f16adaa1 -r ad4b9d7eae6a test-data/gencode/test.xml --- a/test-data/gencode/test.xml Sun Jun 26 10:50:15 2016 -0400 +++ b/test-data/gencode/test.xml Tue Nov 29 10:55:30 2016 -0500 @@ -3,8 +3,20 @@ 11 - test-data/merlin.fa + /tmp/tmps5cL_a/files/000/dataset_3.dat + + + 20 + + true + + true + true + true + true + false + diff -r 1e74f16adaa1 -r ad4b9d7eae6a test-data/gff3/test.xml --- a/test-data/gff3/test.xml Sun Jun 26 10:50:15 2016 -0400 +++ b/test-data/gff3/test.xml Tue Nov 29 10:55:30 2016 -0500 @@ -3,226 +3,268 @@ 11 - test-data/merlin.fa + test-data/merlin.fa - 40 + 20 + true true true - false + true true false - + - - - - + + + + + + ignore + + __auto__ + + + + + + JBrowse/View/Track/CanvasFeatures + false - - ignore - - __auto__ - - - + - + + + ignore + + #ff00ff + + + + + + JBrowse/View/Track/CanvasFeatures + false - - ignore - - #ff00ff - - - + - + + + score + linear + + automatic + + + + opacity + __auto__ + + + + + + JBrowse/View/Track/CanvasFeatures + false - - score - linear - - __auto__ - - - opacity - __auto__ - - - + - + + + score + linear + + automatic + + + + opacity + #0000ff + + + + + + JBrowse/View/Track/CanvasFeatures + false - - score - linear - - __auto__ - - - opacity - #0000ff - - - + - + + + score + linear + + manual + + 0 + 1000 + + + opacity + __auto__ + + + + + + JBrowse/View/Track/CanvasFeatures + false - - score - linear - - manual - 0 - 1000 - - - opacity - __auto__ - - - + - + + + score + linear + + manual + + 0 + 1000 + + + opacity + #ff0000 + + + + + + JBrowse/View/Track/CanvasFeatures + false - - score - linear - - manual - 0 - 1000 - - - opacity - #ff0000 - - - - - + - + + + ignore + + __auto__ + + + + + + JBrowse/View/Track/CanvasFeatures + false - - ignore - - __auto__ - - - + - + + + ignore + + __auto__ + + + + + + JBrowse/View/Track/CanvasFeatures cDNA_match + false - - ignore - - opacity - __auto__ - - diff -r 1e74f16adaa1 -r ad4b9d7eae6a test-data/menus/test.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/menus/test.xml Tue Nov 29 10:55:30 2016 -0500 @@ -0,0 +1,91 @@ + + + + 11 + + /tmp/tmplFZ5li/files/000/dataset_14.dat + + + + 20 + + true + + true + true + true + true + false + + + + + + + + + + + + ignore + + __auto__ + + + + + iframeDialog + + Frame title + https://example.com/#!/?id={name}&q={type}&z="{end}" + dijitIconNewTask + + + newWindow + + Frame title 2 + https://example.com/#!/?id={name}&q={type}&z="{end}" + dijitIconBookmark + + + + + JBrowse/View/Track/CanvasFeatures + false + + + + + + + + + + + + ignore + + __auto__ + + + + + + + JBrowse/View/Track/CanvasFeatures + true + + + + + diff -r 1e74f16adaa1 -r ad4b9d7eae6a tool_data_table_conf.xml.sample --- a/tool_data_table_conf.xml.sample Sun Jun 26 10:50:15 2016 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ - - - - - value, dbkey, name, path - -
-
- diff -r 1e74f16adaa1 -r ad4b9d7eae6a tool_dependencies.xml --- a/tool_dependencies.xml Sun Jun 26 10:50:15 2016 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - -