Mercurial > repos > fubar > plotly_blast_plot
diff plotly_blast_tool/plotlyblast.xml @ 1:6fbd48e9c950 draft
ready for beta testing?
author | fubar |
---|---|
date | Wed, 26 Jul 2023 06:35:18 +0000 |
parents | 61cc57e069c0 |
children | 47a7eeec4a19 |
line wrap: on
line diff
--- a/plotly_blast_tool/plotlyblast.xml Tue Jul 25 05:36:54 2023 +0000 +++ b/plotly_blast_tool/plotlyblast.xml Wed Jul 26 06:35:18 2023 +0000 @@ -1,10 +1,10 @@ <tool name="plotlyblast" id="plotlyblast" version="3.0"> - <!--Source in git at: https://github.com/fubar2/galaxy--> - <!--Created by toolfactory@galaxy.org at 25/07/2023 14:13:15 using the Galaxy Tool Factory.--> + <!--Source in git at: https://github.com/fubar2/galaxy_tf_overlay--> + <!--Created by toolfactory@galaxy.org at 26/07/2023 15:45:12 using the Galaxy Tool Factory.--> <description>Plotly plot generator</description> <requirements> - <requirement type="package" version="1.5.3">pandas</requirement> - <requirement type="package" version="5.9.0">plotly</requirement> + <requirement type="package">pandas</requirement> + <requirement type="package">plotly</requirement> </requirements> <stdio> <exit_code range="1:" level="fatal"/> @@ -52,7 +52,7 @@ args = parser.parse_args() df = pd.read_csv(args.input_tab, sep='\t') NCOLS = df.columns.size -MAXLEN = 40 # tricky way to truncate long axis tickmarks +MAXLEN = 30 # tricky way to truncate long axis tickmarks defaultcols = ['col%d' % (x+1) for x in range(NCOLS)] if len(args.header.strip()) > 0: newcols = args.header.split(',') @@ -63,29 +63,34 @@ df.columns = defaultcols else: df.columns = defaultcols -df['evalue'] = [-math.log(x) for x in df['evalue']] # convert so large values reflect statistical surprise +df['evalue'] = [-math.log(x + 1e-308) for x in df['evalue']] # convert so large values reflect statistical surprise if len(args.colourcol.strip()) == 0: fig = px.scatter(df, x=args.xcol, y=args.ycol, hover_name=args.hovercol) else: fig = px.scatter(df, x=args.xcol, y=args.ycol, color=args.colourcol, hover_name=args.hovercol) if args.title: - ftitle=dict(text=args.title, font=dict(size=50)) + ftitle=dict(text=args.title, font=dict(size=40), automargin=True) fig.update_layout(title=ftitle) for scatter in fig.data: scatter['x'] = [str(x)[:MAXLEN] + '..' if len(str(x)) > 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']] + if len(args.colourcol.strip()) == 0: + sl = str(scatter['legendgroup']) + if len(sl) > MAXLEN: + scatter['legendgroup'] = sl[:MAXLEN] fig.write_html(args.htmlout) + #end raw]]></configfile> </configfiles> <inputs> <param name="input_tab" type="data" optional="false" label="Tabular input file to plot" help="" format="tabular" multiple="false"/> - <param name="xcol" type="text" value="mismatch" label="x axis for plat" help=""/> + <param name="xcol" type="text" value="qaccver" label="x axis for plat" help=""/> <param name="ycol" type="text" value="bitscore" label="y axis for plot" help=""/> - <param name="colourcol" type="text" value="qaccver" label="column containing a groupable variable for colour. Default none." help="Adds a legend so choose wisely "/> + <param name="colourcol" type="text" value="piden" label="column containing a groupable variable for colour. Default none." help="Adds a legend so choose wisely "/> <param name="hovercol" type="text" value="qseq" label="columname for hover string" help=""/> - <param name="title" type="text" value="Test title default" label="Title for the plot" help=""/> - <param name="header" type="text" value="qaccver,saccver,piden,length,mismatch,gapopen,qstart,qend,sstart,send,evalue,bitscore,sallseqid,score,nident,positive,gaps,ppos,qframe,sframe,qseq,sseq,qlen,slen,salltitles" label="Use this comma delimited list of column header names for this tabular file__sq__s columns" help="Default for Galaxy blast outputs with 25 columns."/> + <param name="title" type="text" value="Qaccver by bitscore coloured by pident. Hover shows blast match." label="Title for the plot" help="Special characters will probably be escaped so do not use them"/> + <param name="header" type="text" value="qaccver,saccver,piden,length,mismatch,gapopen,qstart,qend,sstart,send,evalue,bitscore,sallseqid,score,nident,positive,gaps,ppos,qframe,sframe,qseq,sseq,qlen,slen,salltitles" label="Use this comma delimited list of column header names for this tabular file. Default is None when col1...coln will be used" help="Default for Galaxy blast outputs with 25 columns. The column names supplied for xcol, ycol, hover and colour MUST match either the supplied list, or if none, col1...coln."/> </inputs> <outputs> <data name="htmlout" format="html" label="htmlout" hidden="false"/> @@ -94,11 +99,11 @@ <test> <output name="htmlout" value="htmlout_sample" compare="sim_size" delta="5000"/> <param name="input_tab" value="input_tab_sample"/> - <param name="xcol" value="mismatch"/> + <param name="xcol" value="qaccver"/> <param name="ycol" value="bitscore"/> - <param name="colourcol" value="qaccver"/> + <param name="colourcol" value="piden"/> <param name="hovercol" value="qseq"/> - <param name="title" value="Test title default"/> + <param name="title" value="Qaccver by bitscore coloured by pident. Hover shows blast match."/> <param name="header" value="qaccver,saccver,piden,length,mismatch,gapopen,qstart,qend,sstart,send,evalue,bitscore,sallseqid,score,nident,positive,gaps,ppos,qframe,sframe,qseq,sseq,qlen,slen,salltitles"/> </test> </tests> @@ -110,11 +115,13 @@ .. class:: warningmark +NOTE: Long strings in x and y tickmarks WILL BE TRUNCATED if they are too long - ".." is added to indicate truncation - otherwise some plots are squished. + -Long strings in x and y tickmarks WILL BE TRUNCATED if they are too long - ".." is added to indicate truncation - otherwise some plots are squished. +.. class:: warningmark -The evalues WILL BE CONVERTED as -log10(evalue) so they are scaled in a way that doesn't confuse plotly.express with the tiny values. +NOTE: Blast evalues WILL BE TRANSFORMED using -log10(evalue), so they are scaled in a way that doesn't confuse plotly.express with the tiny values. @@ -122,7 +129,7 @@ -The main reason to run this tool is to have an interactive hover text specified so it appears when hovering over each data point to supply useful information. +The main reason to run this tool is to have an interactive hover text specified so it appears when hovering over each data point to supply useful information. @@ -150,6 +157,14 @@ +.. image:: pbsample.png + + :height: 400 + + :width: 400 + + + ------ @@ -176,7 +191,7 @@ args = parser.parse_args() df = pd.read_csv(args.input_tab, sep='\t') NCOLS = df.columns.size - MAXLEN = 40 # tricky way to truncate long axis tickmarks + MAXLEN = 30 # tricky way to truncate long axis tickmarks defaultcols = ['col%d' % (x+1) for x in range(NCOLS)] if len(args.header.strip()) > 0: newcols = args.header.split(',') @@ -187,19 +202,22 @@ df.columns = defaultcols else: df.columns = defaultcols - df['evalue'] = [-math.log(x) for x in df['evalue']] # convert so large values reflect statistical surprise + df['evalue'] = [-math.log(x + 1e-308) for x in df['evalue']] # convert so large values reflect statistical surprise if len(args.colourcol.strip()) == 0: fig = px.scatter(df, x=args.xcol, y=args.ycol, hover_name=args.hovercol) else: fig = px.scatter(df, x=args.xcol, y=args.ycol, color=args.colourcol, hover_name=args.hovercol) if args.title: - ftitle=dict(text=args.title, font=dict(size=50), automargin=True) + ftitle=dict(text=args.title, font=dict(size=40), automargin=True) fig.update_layout(title=ftitle) for scatter in fig.data: scatter['x'] = [str(x)[:MAXLEN] + '..' if len(str(x)) > 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']] + if len(args.colourcol.strip()) == 0: + sl = str(scatter['legendgroup']) + if len(sl) > MAXLEN: + scatter['legendgroup'] = sl[:MAXLEN] fig.write_html(args.htmlout) - fig.show() ]]></help> <citations>