Skip to content

Commit 1f37fb2

Browse files
committed
applied Ruff formatting
1 parent eb0e87b commit 1f37fb2

2 files changed

Lines changed: 45 additions & 16 deletions

File tree

src/flexidot/plotting.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1543,7 +1543,13 @@ def polydotplot(
15431543
html_suffix += '_wobbles'
15441544
if substitution_count != 0:
15451545
html_suffix += '_S%d' % substitution_count
1546-
fig_name = '%s%s%s%s.%s' % (prefix, name_graph, wordsize_suffix, html_suffix, filetype)
1546+
fig_name = '%s%s%s%s.%s' % (
1547+
prefix,
1548+
name_graph,
1549+
wordsize_suffix,
1550+
html_suffix,
1551+
filetype,
1552+
)
15471553
save_polydotplot_html(
15481554
sequences=sequences,
15491555
seq_dict=seq_dict,

src/flexidot/utils/plotly_export.py

Lines changed: 38 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,7 @@ def _click_seq_postscript(unit='bp', div_id=_DIV_ID, show_goto_buttons=False):
129129
publishes ``window.__flexidotLastClick`` for the host app (e.g. TEviewer) to
130130
poll. Standalone/browser use never shows these buttons or touches that global."""
131131
if show_goto_buttons:
132-
make_button_fn = (
133-
"""
132+
make_button_fn = """
134133
function makeGoToButton(label, axis, seq, start, end) {
135134
var btn = document.createElement('button');
136135
btn.textContent = label;
@@ -157,9 +156,7 @@ def _click_seq_postscript(unit='bp', div_id=_DIV_ID, show_goto_buttons=False):
157156
});
158157
return btn;
159158
}
160-
"""
161-
% json.dumps(unit)
162-
)
159+
""" % json.dumps(unit)
163160
buttons_js = """
164161
var buttons = document.createElement('div');
165162
buttons.appendChild(
@@ -408,16 +405,24 @@ def save_pairdotplot_html(
408405
if gff_features_one or gff_features_two:
409406
fig.update_layout(
410407
shapes=_pair_gff_shapes(
411-
gff_features_one or [], gff_features_two or [], gff_color_dict, len_one, len_two
408+
gff_features_one or [],
409+
gff_features_two or [],
410+
gff_color_dict,
411+
len_one,
412+
len_two,
412413
)
413414
)
414415

415416
x_title = (
416-
unicode_name(shorten_name(name_one, max_len=title_length, title_clip_pos=title_clip_pos))
417+
unicode_name(
418+
shorten_name(name_one, max_len=title_length, title_clip_pos=title_clip_pos)
419+
)
417420
+ ' [%s]' % aa_bp_unit
418421
)
419422
y_title = (
420-
unicode_name(shorten_name(name_two, max_len=title_length, title_clip_pos=title_clip_pos))
423+
unicode_name(
424+
shorten_name(name_two, max_len=title_length, title_clip_pos=title_clip_pos)
425+
)
421426
+ ' [%s]' % aa_bp_unit
422427
)
423428
fig.update_layout(
@@ -438,7 +443,11 @@ def save_pairdotplot_html(
438443
**_AXIS_BOX_STYLE,
439444
)
440445
fig.update_yaxes(
441-
range=y_range, constrain='domain', scaleanchor='x', scaleratio=1, **_AXIS_BOX_STYLE
446+
range=y_range,
447+
constrain='domain',
448+
scaleanchor='x',
449+
scaleratio=1,
450+
**_AXIS_BOX_STYLE,
442451
)
443452

444453
fig.write_html(
@@ -473,7 +482,9 @@ def save_polydotplot_html(
473482
n = len(sequences)
474483
names = [
475484
unicode_name(
476-
shorten_name(seq_dict[s].id, max_len=title_length, title_clip_pos=title_clip_pos)
485+
shorten_name(
486+
seq_dict[s].id, max_len=title_length, title_clip_pos=title_clip_pos
487+
)
477488
)
478489
for s in sequences
479490
]
@@ -508,11 +519,17 @@ def save_polydotplot_html(
508519
name_y=record_ids[idx],
509520
):
510521
fig.add_trace(trace, row=row, col=col)
511-
fig.update_xaxes(range=[0, lengths[jdx] + 1], row=row, col=col, **_AXIS_BOX_STYLE)
522+
fig.update_xaxes(
523+
range=[0, lengths[jdx] + 1], row=row, col=col, **_AXIS_BOX_STYLE
524+
)
512525
if mirror_y_axis:
513-
fig.update_yaxes(range=[0, lengths[idx] + 1], row=row, col=col, **_AXIS_BOX_STYLE)
526+
fig.update_yaxes(
527+
range=[0, lengths[idx] + 1], row=row, col=col, **_AXIS_BOX_STYLE
528+
)
514529
else:
515-
fig.update_yaxes(range=[lengths[idx] + 1, 0], row=row, col=col, **_AXIS_BOX_STYLE)
530+
fig.update_yaxes(
531+
range=[lengths[idx] + 1, 0], row=row, col=col, **_AXIS_BOX_STYLE
532+
)
516533

517534
if idx != jdx:
518535
# mirrored cell (swap x/y so the grid is symmetric)
@@ -537,11 +554,17 @@ def save_polydotplot_html(
537554
)
538555
if mirror_y_axis:
539556
fig.update_yaxes(
540-
range=[0, lengths[jdx] + 1], row=row_m, col=col_m, **_AXIS_BOX_STYLE
557+
range=[0, lengths[jdx] + 1],
558+
row=row_m,
559+
col=col_m,
560+
**_AXIS_BOX_STYLE,
541561
)
542562
else:
543563
fig.update_yaxes(
544-
range=[lengths[jdx] + 1, 0], row=row_m, col=col_m, **_AXIS_BOX_STYLE
564+
range=[lengths[jdx] + 1, 0],
565+
row=row_m,
566+
col=col_m,
567+
**_AXIS_BOX_STYLE,
545568
)
546569

547570
# sequence name labels along the bottom row and left column

0 commit comments

Comments
 (0)