# HG changeset patch # User fubar # Date 1691114107 0 # Node ID 82bcfcb60f9768a12bb33007100f0415b0aa67b9 # Parent 47a7eeec4a198b351591d01b585325b2a7c185fa Updated by re-generating with latest ToolFactory so png or html outputs can be requested. Output labels are informative too. diff -r 47a7eeec4a19 -r 82bcfcb60f97 plotly_blast_tool/README.md --- a/plotly_blast_tool/README.md Wed Jul 26 12:16:56 2023 +0000 +++ b/plotly_blast_tool/README.md Fri Aug 04 01:55:07 2023 +0000 @@ -1,3 +1,25 @@ # plotly_blast_tool -Galaxy tool to plot user selected columns from a 25 column Galaxy blastn search output using plotly.express +## Install to your Galaxy server from the toolshed - search for plotly_blast_tool owned by fubar2 + +### Example interactive plots and more at https://lazarus.name/demo/ + +#### Non interactive screen grab of the tool output +![Plotly tabular non-interactive screengrab](pbsample.png) + +Specialised version of the generalised ![plotly_tabular_tool](https://github.com/fubar2/plotly_tabular_tool), but designed +for 25 column Galaxy blastn search outputs. + +It uses the same code, but adds a default header and auto-transformation of the evalue column -log10(x) to make them more like the bitscore + +Plotly.express makes a lot of clever design decisions. +Unfortunately, it gets totally confused with very small floats in scientific notation. Treats columns with 5.00e-204 as strings or something, so +strange and probably uninformative axes and plots will probably result if you try a blast evalue column without transformation. +Note that all columns used for colour (legend) and the x/y axis tickmarks are truncated because they can squish up the plot. +*..* is appended at the truncation. + +## Tool made with the Galaxy ToolFactory: https://github.com/fubar2/galaxy_tf_overlay +The current release includes this and a generic tabular version, plus a java .jar wrapper, in an "advanced example" history +where they can be rerun and changed. They are also generated by an "advanced expample workflow" +where they can be regenerated if the input data sets are available. + diff -r 47a7eeec4a19 -r 82bcfcb60f97 plotly_blast_tool/plotlyblast.xml --- a/plotly_blast_tool/plotlyblast.xml Wed Jul 26 12:16:56 2023 +0000 +++ b/plotly_blast_tool/plotlyblast.xml Fri Aug 04 01:55:07 2023 +0000 @@ -1,10 +1,11 @@ - - Plotly plot generator + + Plotly plot generator specialised for 25 column Galaxy blast search result tabular files - pandas - plotly + pandas + plotly + python-kaleido @@ -27,11 +28,14 @@ --title "$title" --header -"$header"]]> +"$header" +--image_type +"$outputimagetype"]]> MAXLEN else x for x in scatter['x']] scatter['y'] = [str(x)[:MAXLEN] + '..' if len(str(x)) > MAXLEN else x for x in scatter['y']] @@ -79,22 +83,47 @@ sl = str(scatter['legendgroup']) if len(sl) > MAXLEN: scatter['legendgroup'] = sl[:MAXLEN] -fig.write_html(args.htmlout) +if args.image_type == "short_html": + fig.write_html(args.htmlout, full_html=False, include_plotlyjs='cdn') +elif args.image_type == "long_html": + fig.write_html(args.htmlout) +elif args.image_type == "small_png": + ht = 768 + wdth = 1024 + fig.write_image('plotly.png', height=ht, width=wdth) + shutil.copyfile('plotly.png', args.htmlout) +else: + ht = 1200 + wdth = 1920 + fig.write_image('plotly.png', height=ht, width=wdth) + shutil.copyfile('plotly.png', args.htmlout) + #end raw]]> - + + + + + + + - @@ -106,12 +135,23 @@ + MAXLEN else x for x in scatter['x']] @@ -218,7 +256,20 @@ sl = str(scatter['legendgroup']) if len(sl) > MAXLEN: scatter['legendgroup'] = sl[:MAXLEN] - fig.write_html(args.htmlout) + if args.image_type == "short_html": + fig.write_html(args.htmlout, full_html=False, include_plotlyjs='cdn') + elif args.image_type == "long_html": + fig.write_html(args.htmlout) + elif args.image_type == "small_png": + ht = 768 + wdth = 1024 + fig.write_image('plotly.png', height=ht, width=wdth) + shutil.copyfile('plotly.png', args.htmlout) + else: + ht = 1200 + wdth = 1920 + fig.write_image('plotly.png', height=ht, width=wdth) + shutil.copyfile('plotly.png', args.htmlout) ]]> diff -r 47a7eeec4a19 -r 82bcfcb60f97 plotly_blast_tool/test-data/htmlout_sample --- a/plotly_blast_tool/test-data/htmlout_sample Wed Jul 26 12:16:56 2023 +0000 +++ b/plotly_blast_tool/test-data/htmlout_sample Fri Aug 04 01:55:07 2023 +0000 @@ -1,71 +1,2 @@ - - - -
-
- - \ No newline at end of file +
+
\ No newline at end of file