Skip to content

Commit

Permalink
Update arrow options.
Browse files Browse the repository at this point in the history
  • Loading branch information
emunozdc committed Jun 14, 2024
1 parent 07b7e0b commit 1763101
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 76 deletions.
2 changes: 0 additions & 2 deletions src/pyranges_plot/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,6 @@ def format_row(key, value):
"arrow_line_width",
"arrow_color",
"arrow_size",
"arrow_size_min",
"arrow_intron_threshold",
]
)
].copy()
Expand Down
33 changes: 16 additions & 17 deletions src/pyranges_plot/matplotlib_base/data2plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def apply_gene_bridge(
showinfo,
exon_height,
transcript_utr_width,
arrow_size_min,
arrow_size,
arrow_color,
arrow_style,
arrow_width,
Expand All @@ -129,7 +129,7 @@ def apply_gene_bridge(
genename,
showinfo,
exon_height,
arrow_size_min,
arrow_size,
arrow_color,
arrow_style,
arrow_width,
Expand Down Expand Up @@ -223,7 +223,7 @@ def apply_gene_bridge(
genename,
showinfo,
exon_height,
arrow_size_min,
arrow_size,
arrow_color,
arrow_style,
arrow_width,
Expand Down Expand Up @@ -252,7 +252,7 @@ def apply_gene_bridge(
genename,
showinfo,
transcript_utr_width,
arrow_size_min,
arrow_size,
arrow_color,
arrow_style,
arrow_width,
Expand Down Expand Up @@ -280,7 +280,7 @@ def apply_gene_bridge(
genename,
showinfo,
exon_height,
arrow_size_min,
arrow_size,
arrow_color,
arrow_style,
arrow_width,
Expand All @@ -307,7 +307,7 @@ def plot_row(
genename,
showinfo,
exon_height,
arrow_size_min,
arrow_size,
arrow_color,
arrow_style,
arrow_width,
Expand Down Expand Up @@ -372,16 +372,16 @@ def plot_row(

# Plot DIRECTION ARROW in EXON
# decide about placing a direction arrow
arrow_size = coord2percent(ax, 0.05 * start, 0.05 * stop)
incl = percent2coord(ax, arrow_size / 2) # how long in the plot (OX)
# arrow_size = coord2percent(ax, 0.05 * start, 0.05 * stop)
incl = percent2coord(ax, arrow_size / 2) # how long is the arrow in the plot (OX)

# create and plot lines
if not dir_flag:
plot_direction(
ax,
strand,
arrow_size,
arrow_size_min,
stop - start,
arrow_size, # itself as threshold
start,
stop,
incl,
Expand All @@ -401,9 +401,8 @@ def plot_introns(
geneinfo,
tag_background,
gene_ix,
exon_color,
color,
strand,
intron_threshold,
exon_height,
arrow_color,
arrow_style,
Expand Down Expand Up @@ -436,7 +435,7 @@ def plot_introns(
intron_line = ax.plot(
[start, stop],
[gene_ix, gene_ix],
color=exon_color,
color=color,
linewidth=1,
zorder=1,
)
Expand All @@ -459,7 +458,7 @@ def plot_introns(
intron_line = ax.plot(
[prev_tsend, row[ADJSTART_COL]],
[gene_ix, gene_ix],
color=exon_color,
color=color,
linewidth=1,
zorder=1,
)
Expand All @@ -470,7 +469,7 @@ def plot_introns(
intron_line = ax.plot(
[row[ADJSTART_COL], row[ADJEND_COL]],
[gene_ix, gene_ix],
color=exon_color,
color=color,
linewidth=0.5,
linestyle="--",
zorder=1,
Expand All @@ -485,7 +484,7 @@ def plot_introns(
intron_line = ax.plot(
[row[ADJEND_COL], stop],
[gene_ix, gene_ix],
color=exon_color,
color=color,
linewidth=1,
zorder=1,
)
Expand All @@ -506,7 +505,7 @@ def plot_introns(
ax,
strand,
intron_size,
intron_threshold,
arrow_size, # size of arrow as thresholdarrow_size, # size of arrow as threshold
start,
stop,
incl,
Expand Down
13 changes: 2 additions & 11 deletions src/pyranges_plot/matplotlib_base/plot_exons_plt.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ def plot_exons_plt(
text_size = feat_dict["text_size"]
arrow_line_width = feat_dict["arrow_line_width"]
arrow_color = feat_dict["arrow_color"]
arrow_size_min = feat_dict["arrow_size_min"]
arrow_size = feat_dict["arrow_size"]
arrow_intron_threshold = feat_dict["arrow_intron_threshold"]
shrinked_bkg = feat_dict["shrinked_bkg"]
shrinked_alpha = feat_dict["shrinked_alpha"]

Expand Down Expand Up @@ -111,10 +109,8 @@ def plot_exons_plt(
exon_height,
exon_border,
transcript_utr_width,
arrow_intron_threshold,
arrow_line_width,
arrow_color,
arrow_size_min,
arrow_size,
)
)
Expand Down Expand Up @@ -160,10 +156,8 @@ def gby_plot_exons(
exon_height,
exon_border,
transcript_utr_width,
arrow_intron_threshold,
arrow_line_width,
arrow_color,
arrow_size_min,
arrow_size,
):
"""Plot elements corresponding to the df rows of one gene."""
Expand Down Expand Up @@ -206,8 +200,6 @@ def gby_plot_exons(
else:
ts_chrom = pd.DataFrame()

if isinstance(arrow_intron_threshold, int):
arrow_intron_threshold = coord2percent(ax, 0, arrow_intron_threshold)
if isinstance(arrow_size, int):
arrow_size = coord2percent(ax, 0, arrow_size)

Expand All @@ -221,7 +213,6 @@ def gby_plot_exons(
gene_ix,
exon_border,
strand,
arrow_intron_threshold,
exon_height,
arrow_color,
arrow_style,
Expand All @@ -239,15 +230,15 @@ def gby_plot_exons(
ax,
strand,
gene_ix,
exon_border, # this works as "exon_color" used for utr (not interval)
exon_border, # this works as "color" used for utr (not interval)
exon_border,
tag_bkg,
plot_border,
genename,
showinfo,
exon_height,
transcript_utr_width,
arrow_size_min,
arrow_size,
arrow_color,
arrow_style,
arrow_line_width,
Expand Down
10 changes: 0 additions & 10 deletions src/pyranges_plot/plot_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@

plot_features_dict = {
"arrow_color": ("grey", "Color of the arrow indicating strand.", " "),
"arrow_intron_threshold": (
0.04,
"Minimum size of the intron to plot a direction arrow in it. Provided as a float corresponding to the fraction of the plot or as int corresponding to the number of positions.",
" ",
),
"arrow_line_width": (
1,
"Line width of the arrow lines",
Expand All @@ -18,11 +13,6 @@
"Float corresponding to the fraction of the plot or int corresponding to the number of positions occupied by a direction arrow.",
" ",
),
"arrow_size_min": (
0.002,
"Minimum size of the arrow to plot direction in exons if necessary. Provided as a float corresponding to the plot fraction.",
" ",
),
"colormap": (
"Alphabet",
"Sequence of colors to assign to every group of intervals sharing the same “color_col” value. It can be provided as a Matplotlib colormap, a Plotly color sequence (built as lists), a string naming the previously mentioned color objects from Matplotlib and Plotly, or a dictionary with the following structure {color_column_value1: color1, color_column_value2: color2, ...}. When a specific color_col value is not specified in the dictionary it will be colored in black.",
Expand Down
2 changes: 0 additions & 2 deletions src/pyranges_plot/plot_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,7 @@ def getvalue(key):
"plotly_port": getvalue("plotly_port"),
"arrow_line_width": float(getvalue("arrow_line_width")),
"arrow_color": getvalue("arrow_color"),
"arrow_size_min": float(getvalue("arrow_size_min")),
"arrow_size": float(getvalue("arrow_size")),
"arrow_intron_threshold": getvalue("arrow_intron_threshold"),
"shrink_threshold": getvalue("shrink_threshold"),
"shrinked_bkg": getvalue("shrinked_bkg"),
"shrinked_alpha": float(getvalue("shrinked_alpha")),
Expand Down
Loading

0 comments on commit 1763101

Please sign in to comment.