Mercurial > repos > fubar > plotly_blast_plot
comparison plotly_blast_tool/plotlyblast.xml @ 2:47a7eeec4a19 draft
Uploaded
| author | fubar |
|---|---|
| date | Wed, 26 Jul 2023 12:16:56 +0000 |
| parents | 6fbd48e9c950 |
| children | 82bcfcb60f97 |
comparison
equal
deleted
inserted
replaced
| 1:6fbd48e9c950 | 2:47a7eeec4a19 |
|---|---|
| 1 <tool name="plotlyblast" id="plotlyblast" version="3.0"> | 1 <tool name="plotlyblast" id="plotlyblast" version="3.0"> |
| 2 <!--Source in git at: https://github.com/fubar2/galaxy_tf_overlay--> | 2 <!--Source in git at: https://github.com/fubar2/galaxy_tf_overlay--> |
| 3 <!--Created by toolfactory@galaxy.org at 26/07/2023 15:45:12 using the Galaxy Tool Factory.--> | 3 <!--Created by toolfactory@galaxy.org at 26/07/2023 17:31:09 using the Galaxy Tool Factory.--> |
| 4 <description>Plotly plot generator</description> | 4 <description>Plotly plot generator</description> |
| 5 <requirements> | 5 <requirements> |
| 6 <requirement type="package">pandas</requirement> | 6 <requirement type="package" version="1.5.3">pandas</requirement> |
| 7 <requirement type="package">plotly</requirement> | 7 <requirement type="package" version="5.9.0">plotly</requirement> |
| 8 </requirements> | 8 </requirements> |
| 9 <stdio> | 9 <stdio> |
| 10 <exit_code range="1:" level="fatal"/> | 10 <exit_code range="1:" level="fatal"/> |
| 11 </stdio> | 11 </stdio> |
| 12 <version_command><![CDATA[echo "3.0"]]></version_command> | 12 <version_command><![CDATA[echo "3.0"]]></version_command> |
| 42 parser = argparse.ArgumentParser() | 42 parser = argparse.ArgumentParser() |
| 43 a = parser.add_argument | 43 a = parser.add_argument |
| 44 a('--input_tab',default='') | 44 a('--input_tab',default='') |
| 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') | 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') |
| 46 a('--htmlout',default="test_run.html") | 46 a('--htmlout',default="test_run.html") |
| 47 a('--xcol',default='gaps') | 47 a('--xcol',default='') |
| 48 a('--ycol',default='qseq') | 48 a('--ycol',default='') |
| 49 a('--colourcol',default='qaccver') | 49 a('--colourcol',default='') |
| 50 a('--hovercol',default='qseq') | 50 a('--hovercol',default='') |
| 51 a('--title',default='test blast plot of mismatch by bitscore coloured by qaccver ') | 51 a('--title',default='test blast plot') |
| 52 args = parser.parse_args() | 52 args = parser.parse_args() |
| 53 df = pd.read_csv(args.input_tab, sep='\t') | 53 df = pd.read_csv(args.input_tab, sep='\t') |
| 54 NCOLS = df.columns.size | 54 NCOLS = df.columns.size |
| 55 MAXLEN = 30 # tricky way to truncate long axis tickmarks | 55 MAXLEN = 30 # tricky way to truncate long axis tickmarks |
| 56 defaultcols = ['col%d' % (x+1) for x in range(NCOLS)] | 56 defaultcols = ['col%d' % (x+1) for x in range(NCOLS)] |
| 67 if len(args.colourcol.strip()) == 0: | 67 if len(args.colourcol.strip()) == 0: |
| 68 fig = px.scatter(df, x=args.xcol, y=args.ycol, hover_name=args.hovercol) | 68 fig = px.scatter(df, x=args.xcol, y=args.ycol, hover_name=args.hovercol) |
| 69 else: | 69 else: |
| 70 fig = px.scatter(df, x=args.xcol, y=args.ycol, color=args.colourcol, hover_name=args.hovercol) | 70 fig = px.scatter(df, x=args.xcol, y=args.ycol, color=args.colourcol, hover_name=args.hovercol) |
| 71 if args.title: | 71 if args.title: |
| 72 ftitle=dict(text=args.title, font=dict(size=40), automargin=True) | 72 fig.update_layout(title=dict(text=args.title, font=dict(size=40))) |
| 73 fig.update_layout(title=ftitle) | 73 |
| 74 | |
| 74 for scatter in fig.data: | 75 for scatter in fig.data: |
| 75 scatter['x'] = [str(x)[:MAXLEN] + '..' if len(str(x)) > MAXLEN else x for x in scatter['x']] | 76 scatter['x'] = [str(x)[:MAXLEN] + '..' if len(str(x)) > MAXLEN else x for x in scatter['x']] |
| 76 scatter['y'] = [str(x)[:MAXLEN] + '..' if len(str(x)) > MAXLEN else x for x in scatter['y']] | 77 scatter['y'] = [str(x)[:MAXLEN] + '..' if len(str(x)) > MAXLEN else x for x in scatter['y']] |
| 77 if len(args.colourcol.strip()) == 0: | 78 if len(args.colourcol.strip()) == 0: |
| 78 sl = str(scatter['legendgroup']) | 79 sl = str(scatter['legendgroup']) |
| 127 | 128 |
| 128 ---- | 129 ---- |
| 129 | 130 |
| 130 | 131 |
| 131 | 132 |
| 132 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. | 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. |
| 133 | 134 |
| 134 | 135 |
| 135 | 136 |
| 136 Assumes you want a hover display for an interactive plot to be informative | 137 Assumes you want a hover display for an interactive plot to be informative |
| 137 | 138 |
| 161 | 162 |
| 162 :height: 400 | 163 :height: 400 |
| 163 | 164 |
| 164 :width: 400 | 165 :width: 400 |
| 165 | 166 |
| 166 | 167 |
| 167 | 168 |
| 168 ------ | 169 ------ |
| 169 | 170 |
| 170 | 171 |
| 171 Script:: | 172 Script:: |
| 181 parser = argparse.ArgumentParser() | 182 parser = argparse.ArgumentParser() |
| 182 a = parser.add_argument | 183 a = parser.add_argument |
| 183 a('--input_tab',default='') | 184 a('--input_tab',default='') |
| 184 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') | 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') |
| 185 a('--htmlout',default="test_run.html") | 186 a('--htmlout',default="test_run.html") |
| 186 a('--xcol',default='gaps') | 187 a('--xcol',default='') |
| 187 a('--ycol',default='qseq') | 188 a('--ycol',default='') |
| 188 a('--colourcol',default='qaccver') | 189 a('--colourcol',default='') |
| 189 a('--hovercol',default='qseq') | 190 a('--hovercol',default='') |
| 190 a('--title',default='test blast plot of mismatch by bitscore coloured by qaccver ') | 191 a('--title',default='test blast plot') |
| 191 args = parser.parse_args() | 192 args = parser.parse_args() |
| 192 df = pd.read_csv(args.input_tab, sep='\t') | 193 df = pd.read_csv(args.input_tab, sep='\t') |
| 193 NCOLS = df.columns.size | 194 NCOLS = df.columns.size |
| 194 MAXLEN = 30 # tricky way to truncate long axis tickmarks | 195 MAXLEN = 30 # tricky way to truncate long axis tickmarks |
| 195 defaultcols = ['col%d' % (x+1) for x in range(NCOLS)] | 196 defaultcols = ['col%d' % (x+1) for x in range(NCOLS)] |
