Skip to content

Commit

Permalink
Removed unwanted plotly elements
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisgKent committed Sep 22, 2024
1 parent 9ed6268 commit 49f1aa1
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
23 changes: 20 additions & 3 deletions primalscheme3/core/create_reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def generate_plot_html(
col=1,
)

# Add all posible Fkmers
# Add all possible Fkmers
fkmer_data = [
(end, num_seqs) for end, num_seqs in msa_data["thermo_pass"]["F"].items()
]
Expand All @@ -234,11 +234,12 @@ def generate_plot_html(
hovertext=[f"Number Seqs: {x[1]}" for x in fkmer_data],
marker=dict(symbol="triangle-right", size=10),
mode="markers",
name="Passing Forward Primers",
),
row=4,
col=1,
)
# Add all posible Rkmers
# Add all possible Rkmers
rkmer_data = [
(start, num_seqs) for start, num_seqs in msa_data["thermo_pass"]["R"].items()
]
Expand All @@ -249,6 +250,7 @@ def generate_plot_html(
hovertext=[f"Number Seqs: {x[1]}" for x in rkmer_data],
marker=dict(symbol="triangle-left", size=10),
mode="markers",
name="Passing Reverse Primers",
),
row=4,
col=1,
Expand Down Expand Up @@ -292,7 +294,7 @@ def generate_plot_html(
tickformat=",d",
title_font=dict(size=18, family="Arial", color="Black"),
range=[0, length],
title="Position",
title="", # Blank title for all x-axes
)
fig.update_yaxes(
showline=True,
Expand Down Expand Up @@ -350,11 +352,26 @@ def generate_plot_html(
col=1,
secondary_y=False,
)
fig.update_xaxes(
title="Position", row=4, col=1
) # Add the x-axis title to the bottom plot

# fig.update_layout(paper_bgcolor="#000000")
fig.update_layout(height=900, title_text=chromname, showlegend=False)
# plot_bgcolor="rgba(246, 237, 202, 0.5)",

# Remove unnecessary plot elements
fig.update_layout(
modebar_remove=[
"select2d",
"lasso2d",
"select",
"autoScale2d",
"zoom",
"toImage",
]
)

# Write a png version of the plot
fig.write_image(
str(outdir.absolute() / (chromname + ".png")),
Expand Down
13 changes: 13 additions & 0 deletions primalscheme3/core/primer_visual.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ def primer_mismatch_heatmap(
hovertemplate=hovertemplatestr,
xgap=0.1,
ygap=0.1,
name="Primer Mismatches",
)
)
fig.update_layout(
Expand All @@ -276,6 +277,18 @@ def primer_mismatch_heatmap(
)
fig.update_yaxes(autorange="reversed")

# Remove unnecessary plot elements
fig.update_layout(
modebar_remove=[
"select2d",
"lasso2d",
"select",
"autoScale2d",
"zoom",
"toImage",
]
)

return fig.to_html(
include_plotlyjs=True if offline_plots else "cdn", full_html=False
)

0 comments on commit 49f1aa1

Please sign in to comment.