Skip to content

Commit

Permalink
add customize x y for genelabelrotation 0; add --outputprefix for cus…
Browse files Browse the repository at this point in the history
…tomized output (#612)

* add ignore zero anchor parameter for skip no matches in batch search

* ignore blank line in bed

* set label/chr size in layout file

* add genelabel rotation (customize x and y for rotation with angle 0)

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

* Reverting some changes when I messed up the "Resolving Conflicts" step

---------

Co-authored-by: Haibao Tang <[email protected]>
  • Loading branch information
Tong-Chen and tanghaibao authored Nov 30, 2023
1 parent 2215984 commit ab3f79c
Showing 1 changed file with 16 additions and 2 deletions.
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

0 comments on commit ab3f79c

Please sign in to comment.