Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add customize x y for genelabelrotation 0; add --outputprefix for customized output #612

Merged
merged 12 commits into from
Nov 30, 2023
Merged
18 changes: 16 additions & 2 deletions jcvi/graphics/synteny.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,15 @@ def __init__(
)
gp.set_transform(tr)
if genelabelsize and (not gene_labels or gene_name in gene_labels):
if genelabelrotation == 0:
text_x = x1 if x1 > x2 else x2
text_y = y
else:
text_x = (x1 + x2) / 2
text_y = y + height / 2 + genelabelsize * vpad / 3
ax.text(
(x1 + x2) / 2,
y + height / 2 + genelabelsize * vpad / 3,
text_x,
text_y,
markup(gene_name),
size=genelabelsize,
rotation=genelabelrotation,
Expand Down Expand Up @@ -661,6 +667,11 @@ def main():
choices=Shade.Styles,
help="Style of syntenic wedges",
)
p.add_option(
"--outputprefix",
default="",
help="Prefix for the output file",
)
opts, args, iopts = p.set_image_options(figsize="8x7")

if len(args) != 3:
Expand Down Expand Up @@ -697,6 +708,9 @@ def main():
root.set_ylim(0, 1)
root.set_axis_off()

outputprefix = opts.outputprefix
if outputprefix:
pf = outputprefix
image_name = pf + "." + iopts.format
savefig(image_name, dpi=iopts.dpi, iopts=iopts)

Expand Down