Previous changeset 4:d022577ff9cf (2016-01-29) Next changeset 6:ecbdfc775b9a (2016-06-25) |
Commit message:
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 3bbca939ca8a3298a3a2d6450abb04a96851e1ed |
modified:
jbrowse.py jbrowse.xml macros.xml test-data/gff3/test.xml tool_dependencies.xml |
added:
test-data/frameshift/1.gff test-data/frameshift/test.xml |
b |
diff -r d022577ff9cf -r ae9382cfb6ac jbrowse.py --- a/jbrowse.py Fri Jan 29 13:27:30 2016 -0500 +++ b/jbrowse.py Sat Jun 25 15:06:43 2016 -0400 |
[ |
@@ -79,11 +79,11 @@ """, 'blast': """ var opacity = 0; - if(score == 0.0) { + if(score == 0.0) {{ opacity = 1; - } else{ + }} else {{ opacity = (20 - Math.log10(score)) / 180; - } + }} """ } @@ -150,7 +150,7 @@ return '#%02x%02x%02x' % (r, g, b) def _get_colours(self): - r, g, b = self.BREWER_COLOUR_SCHEMES[self.brewer_colour_idx] + r, g, b = self.BREWER_COLOUR_SCHEMES[self.brewer_colour_idx % len(self.BREWER_COLOUR_SCHEMES)] self.brewer_colour_idx += 1 return r, g, b @@ -206,11 +206,11 @@ min_val = 0 max_val = 1000 # Get min/max and build a scoring function since JBrowse doesn't - if scales['type'] == 'automatic': + if scales['type'] == 'automatic' or scales['type'] == '__auto__': min_val, max_val = self.min_max_gff(gff3) else: - min_val = scales['min'] - max_val = scales['max'] + min_val = scales.get('min', 0) + max_val = scales.get('max', 1000) if scheme['color'] == '__auto__': user_color = 'undefined' @@ -316,17 +316,20 @@ 'perl', self._jbrowse_bin('prepare-refseqs.pl'), '--fasta', genome_path]) - def _add_json(self, json_data): - if len(json_data.keys()) == 0: - return + # Generate name + # self.subprocess_check_call([ + # 'perl', self._jbrowse_bin('generate-names.pl'), + # '--hashBits', '16' + # ]) - tmp = tempfile.NamedTemporaryFile(delete=False) - tmp.write(json.dumps(json_data)) - tmp.close() - cmd = ['perl', self._jbrowse_bin('add-track-json.pl'), tmp.name, - os.path.join('data', 'trackList.json')] + def _add_json(self, json_data): + + cmd = [ + 'perl', self._jbrowse_bin('add-json.pl'), + json.dumps(json_data), + os.path.join('data', 'trackList.json') + ] self.subprocess_check_call(cmd) - os.unlink(tmp.name) def _add_track_json(self, json_data): if len(json_data.keys()) == 0: @@ -353,7 +356,7 @@ def add_blastxml(self, data, trackData, blastOpts, **kwargs): gff3 = self._blastxml_to_gff3(data, min_gap=blastOpts['min_gap']) - if 'parent' in blastOpts: + if 'parent' in blastOpts and blastOpts['parent'] != 'None': gff3_rebased = tempfile.NamedTemporaryFile(delete=False) cmd = ['python', os.path.join(INSTALLED_TO, 'gff3_rebase.py')] if blastOpts.get('protein', 'false') == 'true': @@ -457,7 +460,7 @@ self.TN_TABLE.get(format, 'gff'), data, '--trackLabel', trackData['label'], - '--trackType', 'JBrowse/View/Track/CanvasFeatures', + # '--trackType', 'JBrowse/View/Track/CanvasFeatures', '--key', trackData['key'] ] @@ -470,8 +473,16 @@ cmd += ['--type', gffOpts['match']] cmd += ['--clientConfig', json.dumps(clientConfig), + ] + + if 'trackType' in gffOpts: + cmd += [ + '--trackType', gffOpts['trackType'] + ] + else: + cmd += [ '--trackType', 'JBrowse/View/Track/CanvasFeatures' - ] + ] cmd.extend(['--config', json.dumps(config)]) @@ -505,6 +516,8 @@ else: outputTrackConfig[key] = colourOptions[key] + # 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']) @@ -531,6 +544,37 @@ elif dataset_ext == 'vcf': self.add_vcf(dataset_path, outputTrackConfig) + # Return non-human label for use in other fields + yield outputTrackConfig['label'] + + def add_final_data(self, data): + viz_data = {} + if len(data['visibility']['default_on']) > 0: + viz_data['defaultTracks'] = ','.join(data['visibility']['default_on']) + + if len(data['visibility']['always']) > 0: + viz_data['alwaysOnTracks'] = ','.join(data['visibility']['always']) + + if len(data['visibility']['force']) > 0: + viz_data['forceTracks'] = ','.join(data['visibility']['force']) + + generalData = {} + if data['general']['aboutDescription'] is not None: + generalData['aboutThisBrowser'] = {'description': data['general']['aboutDescription'].strip()} + + generalData['view'] = { + 'trackPadding': data['general']['trackPadding'] + } + generalData['shareLink'] = (data['general']['shareLink'] == 'true') + generalData['show_tracklist'] = (data['general']['show_tracklist'] == 'true') + generalData['show_nav'] = (data['general']['show_nav'] == 'true') + generalData['show_overview'] = (data['general']['show_overview'] == 'true') + generalData['show_menu'] = (data['general']['show_menu'] == 'true') + generalData['hideGenomeOptions'] = (data['general']['hideGenomeOptions'] == 'true') + + viz_data.update(generalData) + self._add_json(viz_data) + def clone_jbrowse(self, jbrowse_dir, destination): """Clone a JBrowse directory into a destination directory. """ @@ -570,6 +614,25 @@ gencode=root.find('metadata/gencode').text ) + extra_data = { + 'visibility': { + 'default_on': [], + 'default_off': [], + 'force': [], + 'always': [], + }, + 'general': { + 'defaultLocation': root.find('metadata/general/defaultLocation').text, + 'trackPadding': int(root.find('metadata/general/trackPadding').text), + 'shareLink': root.find('metadata/general/shareLink').text, + 'aboutDescription': root.find('metadata/general/aboutDescription').text, + 'show_tracklist': root.find('metadata/general/show_tracklist').text, + 'show_nav': root.find('metadata/general/show_nav').text, + 'show_overview': root.find('metadata/general/show_overview').text, + 'show_menu': root.find('metadata/general/show_menu').text, + 'hideGenomeOptions': root.find('metadata/general/hideGenomeOptions').text, + } + } for track in root.findall('tracks/track'): track_conf = {} track_conf['trackfiles'] = [ @@ -586,4 +649,10 @@ track_conf['style'] = {} pass track_conf['conf'] = etree_to_dict(track.find('options')) - jc.process_annotations(track_conf) + 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) |
b |
diff -r d022577ff9cf -r ae9382cfb6ac jbrowse.xml --- a/jbrowse.xml Fri Jan 29 13:27:30 2016 -0500 +++ b/jbrowse.xml Sat Jun 25 15:06:43 2016 -0400 |
[ |
b'@@ -1,4 +1,4 @@\n-<tool id="jbrowse" name="JBrowse" version="0.4">\n+<tool id="jbrowse" name="JBrowse" version="0.5">\n <description>genome browser</description>\n <macros>\n <import>macros.xml</import>\n@@ -7,20 +7,27 @@\n <expand macro="stdio"/>\n <version_command>python jbrowse.py --version</version_command>\n <command><![CDATA[\n-mkdir -p $output.files_path &&\n+\n+#if $action.action_select == "create":\n+ mkdir -p $output.files_path;\n+#else:\n+ cp -R $action.update_jbrowse.extra_files_path $output.files_path;\n+#end if\n+\n ## Copy the XML file into the directory, mostly for debugging\n ## but nice if users want to reproduce locally\n cp $trackxml $output.files_path/galaxy.xml &&\n \n ## Once that\'s done, we run the python script to handle the real work\n python $__tool_directory__/jbrowse.py\n-$trackxml\n \n --jbrowse \\${JBROWSE_SOURCE_DIR}\n #if str($standalone) == "Complete":\n --standalone\n #end if\n---outdir $output.files_path;\n+\n+--outdir $output.files_path\n+$trackxml;\n \n #if str($standalone) == "Complete":\n mv $output.files_path/index.html $output;\n@@ -65,15 +72,29 @@\n <metadata>\n <gencode>$gencode</gencode>\n <genomes>\n- #for $genome in $genomes:\n+ #if str($action.genomes) != "None":\n+ #for $genome in $action.genomes:\n <genome>$genome</genome>\n #end for\n+ #end if\n </genomes>\n+ <general>\n+ <defaultLocation>${jbgen.defaultLocation}</defaultLocation>\n+ <trackPadding>${jbgen.trackPadding}</trackPadding>\n+\n+ <shareLink>${jbgen.shareLink}</shareLink>\n+ <aboutDescription>${jbgen.aboutDescription}</aboutDescription>\n+ <show_tracklist>${jbgen.show_tracklist}</show_tracklist>\n+ <show_nav>${jbgen.show_nav}</show_nav>\n+ <show_overview>${jbgen.show_overview}</show_overview>\n+ <show_menu>${jbgen.show_menu}</show_menu>\n+ <hideGenomeOptions>${jbgen.hideGenomeOptions}</hideGenomeOptions>\n+ </general>\n </metadata>\n <tracks>\n #for $tg in $track_groups:\n #for $track in $tg.data_tracks:\n- <track cat="${tg.category}" format="${track.data_format.data_format_select}">\n+ <track cat="${tg.category}" format="${track.data_format.data_format_select}" visibility="${track.data_format.track_visibility}">\n <files>\n #for $dataset in $track.data_format.annotation:\n <trackFile path="${dataset}" ext="${dataset.ext}" label="${dataset.element_identifier}" />\n@@ -174,10 +195,18 @@\n </blast>\n #else if str($track.data_format.data_format_select) == "gene_calls":\n <gff>\n+ <trackType>${track.data_format.track_class}</trackType>\n #if $track.data_format.match_part.match_part_select:\n <match>${track.data_format.match_part.name}</match>\n #end if\n </gff>\n+## #else if str($track.data_format.data_format_select) == "sparql":\n+## <sparql>\n+## <url>${track.data_format.url}</url>\n+## <label>${track.data_format.label}</label>\n+## <!-- This is going to be an absolutey nightmare -->\n+## <query>${track.data_format.query}</query>\n+## </sparql>\n #end if\n </options>\n </track>\n@@ -189,11 +218,33 @@\n </configfile>\n </configfiles>\n <inputs>\n- <param label="Fasta Sequence(s)"\n- name="genomes"\n- type="data"\n- format="fasta"\n- multiple="True"/>\n+ <conditional name="action" label="Action">\n+ <param type="select" label="JBrowse-in-Galaxy Action" name="action_select">\n+ <option value="create">New JBrowse Instance</option>\n+ <option value="update">Update exising JBrowse Instance</option>\n+ </param>\n+ <when value="create">\n+ '..b' format="fasta"\n+ optional="True"\n+ multiple="True"/>\n+ <param label="Previous JBrowse Instance"\n+ name="update_jbrowse"\n+ type="data"\n+ format="html" />\n+ </when>\n+ </conditional>\n+\n <param name="standalone" label="Produce Standalone Instance" type="boolean" truevalue="Complete" falsevalue="Data Directory" help="Produce a full, working JBrowse instance or just the data directory. Data dir mode is experimental and intended to be used with Apollo" checked="True"/>\n \n <param label="Genetic Code" name="gencode" type="select">\n@@ -231,6 +282,7 @@\n <option value="blast">Blast XML</option>\n <option value="wiggle">BigWig XY</option>\n <option value="vcf">VCF SNPs</option>\n+ <!--<option value="sparql">SPARQL</option>-->\n </param>\n <when value="blast">\n <expand macro="input_conditional" label="BlastXML Track Data" format="blastxml" />\n@@ -262,9 +314,11 @@\n <expand macro="color_selection"\n token_scaling_lin_select="false"\n token_scaling_log_select="true" />\n+ <expand macro="track_display" />\n </when>\n <when value="vcf">\n <expand macro="input_conditional" label="SNP Track Data" format="vcf" />\n+ <expand macro="track_display" />\n </when>\n <when value="gene_calls">\n <expand macro="input_conditional" label="GFF/GFF3/BED Track Data" format="gff,gff3,bed" />\n@@ -284,8 +338,13 @@\n </when>\n <when value="false" />\n </conditional>\n+ <param type="select" label="JBrowse Track Type [Advanced]" name="track_class">\n+ <option value="JBrowse/View/Track/HTMLFeatures">HTML Features</option>\n+ <option value="JBrowse/View/Track/CanvasFeatures" selected="true">Canvas Features</option>\n+ </param>\n <expand macro="track_styling" />\n <expand macro="color_selection" />\n+ <expand macro="track_display" />\n </when>\n <when value="pileup">\n <expand macro="input_conditional" label="BAM Track Data" format="bam" />\n@@ -295,6 +354,7 @@\n name="auto_snp"\n truevalue="true"\n falsevalue="false" />\n+ <expand macro="track_display" />\n </when>\n <when value="wiggle">\n <expand macro="input_conditional" label="BigWig Track Data" format="bigwig" />\n@@ -328,11 +388,21 @@\n </when>\n </conditional>\n <expand macro="color_selection_minmax" />\n+ <expand macro="track_display" />\n </when>\n+ <!--\n+ <when value="sparql">\n+ <param type="text" label="SPARQL Server URL" name="url" />\n+ <param type="text" label="Track Label" name="key" value="SPARQL Genes" />\n+ <param type="text" label="SPARQL Query" name="query" area="true" />\n+ <expand macro="track_display" />\n+ </when>\n+ -->\n </conditional>\n </repeat>\n </repeat>\n \n+ <expand macro="general_options" />\n <param type="hidden" name="uglyTestingHack" value="" />\n </inputs>\n <outputs>\n@@ -440,6 +510,12 @@\n JBrowse-in-Galaxy offers a highly configurable, workflow-compatible\n alternative to Trackster.\n \n+Overview\n+--------\n+\n+JBrowse is a fast, embeddable genome browser built completely with\n+JavaScript and HTML5.\n+\n The JBrowse-in-Galaxy (JiG) tool was written to help build complex\n JBrowse installations straight from Galaxy, taking advantage of the\n latest Galaxy features such as dataset collections, sections, and colour\n' |
b |
diff -r d022577ff9cf -r ae9382cfb6ac macros.xml --- a/macros.xml Fri Jan 29 13:27:30 2016 -0500 +++ b/macros.xml Sat Jun 25 15:06:43 2016 -0400 |
[ |
@@ -48,6 +48,15 @@ </conditional> </xml> + <xml name="track_display"> + <param type="select" label="Track Visibility" name="track_visibility"> + <option value="default_off">Off for new users</option> + <option value="default_on">On for new users</option> + <option value="force">Force On</option> + <option value="always">Always On (ignores URL parameters)</option> + </param> + </xml> + <xml name="jb_color" token_label="JBrowse style.color" token_name="style_color" @@ -97,6 +106,22 @@ <option value="Spectral">Spectral</option> </param> </xml> + <xml name="general_options"> + <section name="jbgen" title="General JBrowse Options [Advanced]" expanded="false"> + <param label="Default Location" type="text" name="defaultLocation" value="" help="Initial location to be shown for users who have never visited the browser before. Example: 'ctgA:1234..5678'"/> + <param label="Track Padding" type="integer" value="20" name="trackPadding" help="Spacing between tracks in the genome view, in pixels." /> + + <param label="Enable Share Link" name="shareLink" type="boolean" checked="true" truevalue="true" falsevalue="false" /> + <param label="About the Browser" type="text" name="aboutDescription" value="" help="Description of the browser to be used in the 'About' popup" /> + + <param label="Show Track List" name="show_tracklist" type="boolean" checked="true" truevalue="true" falsevalue="false" help="Optionally hide the track list"/> + <param label="Show Navigation" name="show_nav" type="boolean" checked="true" truevalue="true" falsevalue="false" help="Optionally hide the navigation menu"/> + <param label="Show Overview" name="show_overview" type="boolean" checked="true" truevalue="true" falsevalue="false" help="Optionally hide the overview bar"/> + <param label="Show Menu" name="show_menu" type="boolean" checked="true" truevalue="true" falsevalue="false" help="Optionally hide the menu bar"/> + + <param label="Hide Genome Options" name="hideGenomeOptions" type="boolean" truevalue="true" falsevalue="false" help="Hide options for opening a sequence file"/> + </section> + </xml> <xml name="color_selection_minmax"> <section name="jbcolor" title="JBrowse Color Options [Advanced]" expanded="false"> <!-- Abuse auto/manual for bicolor pivot. Means we'll have to handle the |
b |
diff -r d022577ff9cf -r ae9382cfb6ac test-data/frameshift/1.gff --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/frameshift/1.gff Sat Jun 25 15:06:43 2016 -0400 |
b |
@@ -0,0 +1,7 @@ +##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 |
b |
diff -r d022577ff9cf -r ae9382cfb6ac test-data/frameshift/test.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/frameshift/test.xml Sat Jun 25 15:06:43 2016 -0400 |
b |
@@ -0,0 +1,43 @@ +<?xml version="1.0"?> +<root> + <metadata> + <gencode>11</gencode> + <genomes> + <genome>test-data/merlin.fa</genome> + </genomes> + <general> + <defaultLocation>Merlin:1-50</defaultLocation> + <trackPadding>40</trackPadding> + <shareLink>true</shareLink> + <aboutDescription></aboutDescription> + <show_tracklist>true</show_tracklist> + <show_nav>true</show_nav> + <show_overview>false</show_overview> + <show_menu>true</show_menu> + <hideGenomeOptions>false</hideGenomeOptions> + </general> + </metadata> + <tracks> + <track cat="Auto Coloured" format="gene_calls" visibility="default_on"> + <files> + <trackFile path="test-data/frameshift/1.gff" ext="gff3" label="Test Track"/> + </files> + <options> + <style> + <className>feature</className> + <description>feature</description> + <label>name,id</label> + <height>100px</height> + </style> + <gff> + </gff> + <scaling> + <method>ignore</method> + <scheme> + <color>__auto__</color> + </scheme> + </scaling> + </options> + </track> + </tracks> +</root> |
b |
diff -r d022577ff9cf -r ae9382cfb6ac test-data/gff3/test.xml --- a/test-data/gff3/test.xml Fri Jan 29 13:27:30 2016 -0500 +++ b/test-data/gff3/test.xml Sat Jun 25 15:06:43 2016 -0400 |
b |
@@ -5,9 +5,20 @@ <genomes> <genome>test-data/merlin.fa</genome> </genomes> + <general> + <defaultLocation></defaultLocation> + <trackPadding>40</trackPadding> + <shareLink>true</shareLink> + <aboutDescription></aboutDescription> + <show_tracklist>true</show_tracklist> + <show_nav>true</show_nav> + <show_overview>false</show_overview> + <show_menu>true</show_menu> + <hideGenomeOptions>false</hideGenomeOptions> + </general> </metadata> <tracks> - <track cat="Auto Coloured" format="gene_calls"> + <track cat="Auto Coloured" format="gene_calls" visibility="default_on"> <files> <trackFile path="test-data/gff3/1.gff" ext="gff3" label="A"/> <trackFile path="test-data/gff3/1.gff" ext="gff3" label="B"/> |
b |
diff -r d022577ff9cf -r ae9382cfb6ac tool_dependencies.xml --- a/tool_dependencies.xml Fri Jan 29 13:27:30 2016 -0500 +++ b/tool_dependencies.xml Sat Jun 25 15:06:43 2016 -0400 |
b |
@@ -1,7 +1,7 @@ <?xml version="1.0"?> <tool_dependency> <package name="jbrowse" version="1.12.0"> - <repository changeset_revision="22be3ae5599d" name="package_jbrowse_1_12_0" owner="iuc" toolshed="https://toolshed.g2.bx.psu.edu" /> + <repository changeset_revision="d65f12198038" name="package_jbrowse_1_12_0" owner="iuc" toolshed="https://toolshed.g2.bx.psu.edu" /> </package> <package name="bundle_jbrowse" version="1.12.0"> <repository changeset_revision="52153ec17769" name="package_perl_bundle_jbrowse_1_12_0" owner="iuc" toolshed="https://toolshed.g2.bx.psu.edu" /> @@ -16,7 +16,7 @@ <repository changeset_revision="8ee2210f6074" name="package_python_2_7_bcbiogff_0_6_2" owner="iuc" toolshed="https://toolshed.g2.bx.psu.edu" /> </package> <package name="perl" version="5.18.1"> - <repository changeset_revision="8b3509930a44" name="package_perl_5_18" owner="iuc" toolshed="https://toolshed.g2.bx.psu.edu" /> + <repository changeset_revision="35f117d7396b" name="package_perl_5_18" owner="iuc" toolshed="https://toolshed.g2.bx.psu.edu" /> </package> <package name="samtools" version="1.2"> <repository changeset_revision="f6ae3ba3f3c1" name="package_samtools_1_2" owner="iuc" toolshed="https://toolshed.g2.bx.psu.edu" /> |