# HG changeset patch # User fubar # Date 1690353318 0 # Node ID 6fbd48e9c95024741763e025ea049489931328f9 # Parent 61cc57e069c03ad4329ad244177a9e440763b6a9 ready for beta testing? diff -r 61cc57e069c0 -r 6fbd48e9c950 plotly_blast_tool/plotlyblast.xml --- 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 @@ - - + + Plotly plot generator - pandas - plotly + pandas + plotly @@ -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]]> - + - + - - + +