annotate plotly_blast_tool/plotlyblast.xml @ 2:47a7eeec4a19 draft

Uploaded
author fubar
date Wed, 26 Jul 2023 12:16:56 +0000
parents 6fbd48e9c950
children 82bcfcb60f97
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
1 <tool name="plotlyblast" id="plotlyblast" version="3.0">
1
6fbd48e9c950 ready for beta testing?
fubar
parents: 0
diff changeset
2 <!--Source in git at: https://github.com/fubar2/galaxy_tf_overlay-->
2
47a7eeec4a19 Uploaded
fubar
parents: 1
diff changeset
3 <!--Created by toolfactory@galaxy.org at 26/07/2023 17:31:09 using the Galaxy Tool Factory.-->
0
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
4 <description>Plotly plot generator</description>
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
5 <requirements>
2
47a7eeec4a19 Uploaded
fubar
parents: 1
diff changeset
6 <requirement type="package" version="1.5.3">pandas</requirement>
47a7eeec4a19 Uploaded
fubar
parents: 1
diff changeset
7 <requirement type="package" version="5.9.0">plotly</requirement>
0
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
8 </requirements>
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
9 <stdio>
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
10 <exit_code range="1:" level="fatal"/>
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
11 </stdio>
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
12 <version_command><![CDATA[echo "3.0"]]></version_command>
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
13 <command><![CDATA[python
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
14 $runme
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
15 --input_tab
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
16 $input_tab
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
17 --htmlout
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
18 $htmlout
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
19 --xcol
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
20 "$xcol"
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
21 --ycol
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
22 "$ycol"
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
23 --colourcol
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
24 "$colourcol"
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
25 --hovercol
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
26 "$hovercol"
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
27 --title
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
28 "$title"
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
29 --header
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
30 "$header"]]></command>
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
31 <configfiles>
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
32 <configfile name="runme"><![CDATA[#raw
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
33
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
34 import argparse
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
35 import sys
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
36 import math
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
37 import plotly.express as px
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
38 import pandas as pd
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
39 # Ross Lazarus July 2023
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
40 # based on various plotly tutorials
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
41 # Expects a blastn search result passed in as the first command line parameter.
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
42 parser = argparse.ArgumentParser()
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
43 a = parser.add_argument
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
44 a('--input_tab',default='')
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
45 a('--header',default='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')
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
46 a('--htmlout',default="test_run.html")
2
47a7eeec4a19 Uploaded
fubar
parents: 1
diff changeset
47 a('--xcol',default='')
47a7eeec4a19 Uploaded
fubar
parents: 1
diff changeset
48 a('--ycol',default='')
47a7eeec4a19 Uploaded
fubar
parents: 1
diff changeset
49 a('--colourcol',default='')
47a7eeec4a19 Uploaded
fubar
parents: 1
diff changeset
50 a('--hovercol',default='')
47a7eeec4a19 Uploaded
fubar
parents: 1
diff changeset
51 a('--title',default='test blast plot')
0
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
52 args = parser.parse_args()
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
53 df = pd.read_csv(args.input_tab, sep='\t')
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
54 NCOLS = df.columns.size
1
6fbd48e9c950 ready for beta testing?
fubar
parents: 0
diff changeset
55 MAXLEN = 30 # tricky way to truncate long axis tickmarks
0
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
56 defaultcols = ['col%d' % (x+1) for x in range(NCOLS)]
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
57 if len(args.header.strip()) > 0:
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
58 newcols = args.header.split(',')
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
59 if len(newcols) == NCOLS:
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
60 df.columns = newcols
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
61 else:
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
62 sys.stderr.write('#### Supplied header %s has %d comma delimited header names - does not match the input tabular file %d columns - using col1,...coln' % (args.header, len(newcols), NCOLS))
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
63 df.columns = defaultcols
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
64 else:
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
65 df.columns = defaultcols
1
6fbd48e9c950 ready for beta testing?
fubar
parents: 0
diff changeset
66 df['evalue'] = [-math.log(x + 1e-308) for x in df['evalue']] # convert so large values reflect statistical surprise
0
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
67 if len(args.colourcol.strip()) == 0:
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
68 fig = px.scatter(df, x=args.xcol, y=args.ycol, hover_name=args.hovercol)
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
69 else:
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
70 fig = px.scatter(df, x=args.xcol, y=args.ycol, color=args.colourcol, hover_name=args.hovercol)
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
71 if args.title:
2
47a7eeec4a19 Uploaded
fubar
parents: 1
diff changeset
72 fig.update_layout(title=dict(text=args.title, font=dict(size=40)))
47a7eeec4a19 Uploaded
fubar
parents: 1
diff changeset
73
47a7eeec4a19 Uploaded
fubar
parents: 1
diff changeset
74
0
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
75 for scatter in fig.data:
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
76 scatter['x'] = [str(x)[:MAXLEN] + '..' if len(str(x)) > MAXLEN else x for x in scatter['x']]
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
77 scatter['y'] = [str(x)[:MAXLEN] + '..' if len(str(x)) > MAXLEN else x for x in scatter['y']]
1
6fbd48e9c950 ready for beta testing?
fubar
parents: 0
diff changeset
78 if len(args.colourcol.strip()) == 0:
6fbd48e9c950 ready for beta testing?
fubar
parents: 0
diff changeset
79 sl = str(scatter['legendgroup'])
6fbd48e9c950 ready for beta testing?
fubar
parents: 0
diff changeset
80 if len(sl) > MAXLEN:
6fbd48e9c950 ready for beta testing?
fubar
parents: 0
diff changeset
81 scatter['legendgroup'] = sl[:MAXLEN]
0
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
82 fig.write_html(args.htmlout)
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
83
1
6fbd48e9c950 ready for beta testing?
fubar
parents: 0
diff changeset
84
0
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
85 #end raw]]></configfile>
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
86 </configfiles>
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
87 <inputs>
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
88 <param name="input_tab" type="data" optional="false" label="Tabular input file to plot" help="" format="tabular" multiple="false"/>
1
6fbd48e9c950 ready for beta testing?
fubar
parents: 0
diff changeset
89 <param name="xcol" type="text" value="qaccver" label="x axis for plat" help=""/>
0
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
90 <param name="ycol" type="text" value="bitscore" label="y axis for plot" help=""/>
1
6fbd48e9c950 ready for beta testing?
fubar
parents: 0
diff changeset
91 <param name="colourcol" type="text" value="piden" label="column containing a groupable variable for colour. Default none." help="Adds a legend so choose wisely "/>
0
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
92 <param name="hovercol" type="text" value="qseq" label="columname for hover string" help=""/>
1
6fbd48e9c950 ready for beta testing?
fubar
parents: 0
diff changeset
93 <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"/>
6fbd48e9c950 ready for beta testing?
fubar
parents: 0
diff changeset
94 <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."/>
0
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
95 </inputs>
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
96 <outputs>
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
97 <data name="htmlout" format="html" label="htmlout" hidden="false"/>
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
98 </outputs>
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
99 <tests>
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
100 <test>
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
101 <output name="htmlout" value="htmlout_sample" compare="sim_size" delta="5000"/>
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
102 <param name="input_tab" value="input_tab_sample"/>
1
6fbd48e9c950 ready for beta testing?
fubar
parents: 0
diff changeset
103 <param name="xcol" value="qaccver"/>
0
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
104 <param name="ycol" value="bitscore"/>
1
6fbd48e9c950 ready for beta testing?
fubar
parents: 0
diff changeset
105 <param name="colourcol" value="piden"/>
0
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
106 <param name="hovercol" value="qseq"/>
1
6fbd48e9c950 ready for beta testing?
fubar
parents: 0
diff changeset
107 <param name="title" value="Qaccver by bitscore coloured by pident. Hover shows blast match."/>
0
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
108 <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"/>
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
109 </test>
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
110 </tests>
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
111 <help><![CDATA[
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
112
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
113 This is a specialised version of a generic tabular file plotter tool plotlytabular
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
114
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
115
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
116
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
117 .. class:: warningmark
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
118
1
6fbd48e9c950 ready for beta testing?
fubar
parents: 0
diff changeset
119 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.
6fbd48e9c950 ready for beta testing?
fubar
parents: 0
diff changeset
120
0
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
121
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
122
1
6fbd48e9c950 ready for beta testing?
fubar
parents: 0
diff changeset
123 .. class:: warningmark
0
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
124
1
6fbd48e9c950 ready for beta testing?
fubar
parents: 0
diff changeset
125 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.
0
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
126
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
127
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
128
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
129 ----
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
130
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
131
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
132
2
47a7eeec4a19 Uploaded
fubar
parents: 1
diff changeset
133 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.
0
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
134
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
135
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
136
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
137 Assumes you want a hover display for an interactive plot to be informative
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
138
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
139
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
140
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
141 Column names are auto-generated as col1,...coln unless a comma separated list of column names is supplied as the header parameter.
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
142
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
143
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
144
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
145 For example, using a Galaxy blastn output with 25 columns, the following comma delimited string supplied as the "header" parameter will match the names of each column.
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
146
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
147 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
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
148
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
149
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
150
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
151 When a header is supplied, the xcol and other column names must match one of those supplied column names.
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
152
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
153 So for example, xcol = "qaccver" for the blastn header example rather than xcol = "col1" when no header is supplied.
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
154
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
155
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
156
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
157 Relies on Plotly python code released under the MIT licence: https://github.com/plotly/plotly.py/blob/master/LICENSE.txt
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
158
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
159
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
160
1
6fbd48e9c950 ready for beta testing?
fubar
parents: 0
diff changeset
161 .. image:: pbsample.png
6fbd48e9c950 ready for beta testing?
fubar
parents: 0
diff changeset
162
6fbd48e9c950 ready for beta testing?
fubar
parents: 0
diff changeset
163 :height: 400
6fbd48e9c950 ready for beta testing?
fubar
parents: 0
diff changeset
164
6fbd48e9c950 ready for beta testing?
fubar
parents: 0
diff changeset
165 :width: 400
6fbd48e9c950 ready for beta testing?
fubar
parents: 0
diff changeset
166
2
47a7eeec4a19 Uploaded
fubar
parents: 1
diff changeset
167
1
6fbd48e9c950 ready for beta testing?
fubar
parents: 0
diff changeset
168
0
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
169 ------
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
170
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
171
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
172 Script::
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
173
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
174 import argparse
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
175 import sys
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
176 import math
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
177 import plotly.express as px
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
178 import pandas as pd
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
179 # Ross Lazarus July 2023
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
180 # based on various plotly tutorials
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
181 # Expects a blastn search result passed in as the first command line parameter.
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
182 parser = argparse.ArgumentParser()
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
183 a = parser.add_argument
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
184 a('--input_tab',default='')
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
185 a('--header',default='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')
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
186 a('--htmlout',default="test_run.html")
2
47a7eeec4a19 Uploaded
fubar
parents: 1
diff changeset
187 a('--xcol',default='')
47a7eeec4a19 Uploaded
fubar
parents: 1
diff changeset
188 a('--ycol',default='')
47a7eeec4a19 Uploaded
fubar
parents: 1
diff changeset
189 a('--colourcol',default='')
47a7eeec4a19 Uploaded
fubar
parents: 1
diff changeset
190 a('--hovercol',default='')
47a7eeec4a19 Uploaded
fubar
parents: 1
diff changeset
191 a('--title',default='test blast plot')
0
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
192 args = parser.parse_args()
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
193 df = pd.read_csv(args.input_tab, sep='\t')
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
194 NCOLS = df.columns.size
1
6fbd48e9c950 ready for beta testing?
fubar
parents: 0
diff changeset
195 MAXLEN = 30 # tricky way to truncate long axis tickmarks
0
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
196 defaultcols = ['col%d' % (x+1) for x in range(NCOLS)]
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
197 if len(args.header.strip()) > 0:
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
198 newcols = args.header.split(',')
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
199 if len(newcols) == NCOLS:
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
200 df.columns = newcols
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
201 else:
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
202 sys.stderr.write('#### Supplied header %s has %d comma delimited header names - does not match the input tabular file %d columns - using col1,...coln' % (args.header, len(newcols), NCOLS))
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
203 df.columns = defaultcols
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
204 else:
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
205 df.columns = defaultcols
1
6fbd48e9c950 ready for beta testing?
fubar
parents: 0
diff changeset
206 df['evalue'] = [-math.log(x + 1e-308) for x in df['evalue']] # convert so large values reflect statistical surprise
0
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
207 if len(args.colourcol.strip()) == 0:
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
208 fig = px.scatter(df, x=args.xcol, y=args.ycol, hover_name=args.hovercol)
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
209 else:
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
210 fig = px.scatter(df, x=args.xcol, y=args.ycol, color=args.colourcol, hover_name=args.hovercol)
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
211 if args.title:
1
6fbd48e9c950 ready for beta testing?
fubar
parents: 0
diff changeset
212 ftitle=dict(text=args.title, font=dict(size=40), automargin=True)
0
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
213 fig.update_layout(title=ftitle)
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
214 for scatter in fig.data:
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
215 scatter['x'] = [str(x)[:MAXLEN] + '..' if len(str(x)) > MAXLEN else x for x in scatter['x']]
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
216 scatter['y'] = [str(x)[:MAXLEN] + '..' if len(str(x)) > MAXLEN else x for x in scatter['y']]
1
6fbd48e9c950 ready for beta testing?
fubar
parents: 0
diff changeset
217 if len(args.colourcol.strip()) == 0:
6fbd48e9c950 ready for beta testing?
fubar
parents: 0
diff changeset
218 sl = str(scatter['legendgroup'])
6fbd48e9c950 ready for beta testing?
fubar
parents: 0
diff changeset
219 if len(sl) > MAXLEN:
6fbd48e9c950 ready for beta testing?
fubar
parents: 0
diff changeset
220 scatter['legendgroup'] = sl[:MAXLEN]
0
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
221 fig.write_html(args.htmlout)
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
222
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
223 ]]></help>
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
224 <citations>
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
225 <citation type="doi">10.1093/bioinformatics/bts573</citation>
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
226 </citations>
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
227 </tool>
61cc57e069c0 Initial commit
fubar
parents:
diff changeset
228