Skip to content

Figure Save Option #56

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

Merged
merged 2 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/source/how-to-run.rst
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ Probability value that is used for z-score calculation. It is a determination pe

Plotting option for debugging. While enabled, DomHMM will print Hidden Markov model iterations result, prediction results, Getis-Ord statistic results and clustering result of three frame.

* ``save_plots``

Option for saving result plots in pdf format.

* ``verbose``

Verbose option for debugging. Although, DomHMM doesn't print middle values, it shows which steps are done and shows middle step plots which may give clues about succession of model.
Expand Down
4 changes: 4 additions & 0 deletions domhmm/analysis/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ class LeafletAnalysisBase(AnalysisBase):
Debug option to print step progress, warnings and errors
result_plots: bool
Plotting intermediate result option
save_plots : bool
Option for saving intermediate plots in pdf format
trained_hmms: dict
User-specific HMM (e.g., pre-trained on another simulation)

Expand Down Expand Up @@ -120,6 +122,7 @@ def __init__(
result_plots: bool = False,
trained_hmms: Dict[str, Any] = {},
n_init_hmm: int = 2,
save_plots: bool = False,
**kwargs
):
# the below line must be kept to initialize the AnalysisBase class!
Expand Down Expand Up @@ -147,6 +150,7 @@ def __init__(
self.result_plots = result_plots
self.tmd_protein = None
self.n_init_hmm = n_init_hmm
self.save_plots = save_plots

assert heads.keys() == tails.keys(), "Heads and tails don't contain same residue names"

Expand Down
16 changes: 8 additions & 8 deletions domhmm/analysis/domhmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -648,8 +648,8 @@ def plot_hmm_result(self):
plt.text(s="Tolerance 1e-4", x=1, y=1E-4 + 0.00005, color="k", fontsize=15)
plt.title("a", fontsize=20, fontweight="bold", loc="left")
plt.tight_layout()
# TODO Add plot save option to here
# plt.savefig("a.pdf")
if self.save_plots:
plt.savefig("a.pdf")
plt.show()

def predict_states(self):
Expand Down Expand Up @@ -798,8 +798,8 @@ def predict_plot(self):
plt.xlim(8, 10)
plt.title("b", fontsize=20, fontweight="bold", loc="left")
plt.tight_layout()
# TODO Add plot save option to here
# plt.savefig("b.pdf")
if self.save_plots:
plt.savefig("b.pdf")
plt.show()

# ------------------------------ GETIS-ORD STATISTIC ------------------------------------------------------------- #
Expand Down Expand Up @@ -928,8 +928,8 @@ def getis_ord_plot(self):

plt.title("c", fontsize=20, fontweight="bold", loc="left")
plt.tight_layout()
# TODO Add plot save option to here
# plt.savefig("c.pdf")
if self.save_plots:
plt.savefig("c.pdf")
plt.show()

def permut_getis_ord_stat(self, weight_matrix_all, leaflet):
Expand Down Expand Up @@ -1095,8 +1095,8 @@ def clustering_plot(self):
ax[1].text(s=f"Frame {self.start + frame_list[1]}", x=71.5, y=144, fontsize=18, ha="center", va="center")
ax[2].text(s=f"Frame {self.start + frame_list[2]}", x=71.5, y=144, fontsize=18, ha="center", va="center")
plt.tight_layout()
# TODO Add plot save option to here
# plt.savefig("d.pdf")
if self.save_plots:
plt.savefig("d.pdf")
plt.show()

def result_clustering(self):
Expand Down
Loading