From 984b52db1f79f84200462e89f254ca36ce02a8a6 Mon Sep 17 00:00:00 2001 From: Jon Agirre Date: Tue, 2 Jul 2024 18:19:29 +0100 Subject: [PATCH] Added release version to the graphics, added info text when using Tortoize --- src/iris_validation/graphics/chain.py | 23 ++++++++++++--- src/iris_validation/graphics/panel.py | 5 ++++ tests/test_core.py | 41 ++++++++++++++------------- 3 files changed, 45 insertions(+), 24 deletions(-) diff --git a/src/iris_validation/graphics/chain.py b/src/iris_validation/graphics/chain.py index 53bc591..d4c0704 100644 --- a/src/iris_validation/graphics/chain.py +++ b/src/iris_validation/graphics/chain.py @@ -5,6 +5,7 @@ from svgwrite.animate import Animate from iris_validation._defs import COLORS, CHAIN_VIEW_RINGS, CHAIN_VIEW_GAP_ANGLE +from iris_validation._version import version_tuple class ChainView: @@ -142,21 +143,35 @@ def _draw(self): # Draw center text self.dwg.add(self.dwg.text(text='Iris', - insert=(self.center[0], self.center[1]-24), - font_size=1.5*16, + insert=(self.center[0], self.center[1]-22), + font_size=1.5*18, font_family='Arial', font_weight='bold', text_anchor='middle', alignment_baseline='central')) + self.dwg.add(self.dwg.text(text='Release ' + '.'.join(map(str, version_tuple[:3])), + insert=(self.center[0], self.center[1]), + font_size=14, + font_family='Arial', + text_anchor='middle', + alignment_baseline='central')) self.dwg.add(self.dwg.text(text='Chain ' + self.data['chain_id'], - insert=(self.center[0], self.center[1]+16), + insert=(self.center[0], self.center[1]+18), font_size=16, font_family='Arial', text_anchor='middle', alignment_baseline='central')) if self.data['has_molprobity']: self.dwg.add(self.dwg.text(text='MolProbity', - insert=(self.center[0], self.center[1]+48), + insert=(self.center[0], self.center[1]+50), + font_size=16, + font_family='Arial', + text_anchor='middle', + alignment_baseline='central', + fill=COLORS['L_GREY'])) + elif self.data['has_rama_z']: + self.dwg.add(self.dwg.text(text='Tortoize', + insert=(self.center[0], self.center[1]+50), font_size=16, font_family='Arial', text_anchor='middle', diff --git a/src/iris_validation/graphics/panel.py b/src/iris_validation/graphics/panel.py index 6836edb..274a176 100644 --- a/src/iris_validation/graphics/panel.py +++ b/src/iris_validation/graphics/panel.py @@ -254,6 +254,11 @@ def _draw(self): onclick=f'toggleDropdown();')) # Version toggle switch + self.dwg.add(self.dwg.text(text='Model version', + insert=(chain_view_bounds[2]-385, chain_view_bounds[1]+20), + font_size=view_title_font, + font_family='Arial')) + self.dwg.add(self.dwg.text(text=self.custom_labels['Previous'], insert=(chain_view_bounds[2]-215, chain_view_bounds[1]+20), font_size=16, diff --git a/tests/test_core.py b/tests/test_core.py index f3c5f96..bf02293 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -10,6 +10,7 @@ DATASET1_PATH = str(os.path.join(INPUT_DIR, "3atp")) + '{suffix}' DATASET2_PATH = str(os.path.join(INPUT_DIR, "8ira")) + '{suffix}' + def test_2m2d_noCOV_noMP_noRamaZ_mpro (): import iris_validation as iris importlib.reload(iris) @@ -130,23 +131,23 @@ def test_2m2d_noCOV_MP_noRamaZ_spro (): assert path.exists(OUTPUT_DIR.format(suffix=job_name) + ".html") -@pytest.mark.slow -def test_2m2d_COV_MP_noRamaZ_spro (): - import iris_validation as iris - importlib.reload(iris) - job_name = "test_2m2d_COV_MP_noRamaZ_spro" - iris.generate_report(latest_model_path=DATASET1_PATH.format(suffix='_final.pdb'), - latest_reflections_path=DATASET1_PATH.format(suffix='_final.mtz'), - latest_sequence_path=DATASET1_PATH.format(suffix='.fasta'), - latest_distpred_path=DATASET1_PATH.format(suffix='.npz'), - previous_model_path=DATASET1_PATH.format(suffix='_0cyc.pdb'), - previous_reflections_path=DATASET1_PATH.format(suffix='_0cyc.mtz'), - previous_sequence_path=DATASET1_PATH.format(suffix='.fasta'), - previous_distpred_path=DATASET1_PATH.format(suffix='.npz'), - run_covariance=True, - run_molprobity=True, - calculate_rama_z=False, - multiprocessing=False, - output_dir=OUTPUT_DIR.format(suffix=""), - output_name_prefix=job_name) - assert path.exists(OUTPUT_DIR.format(suffix=job_name) + ".html") \ No newline at end of file +# @pytest.mark.slow +# def test_2m2d_COV_MP_noRamaZ_spro (): +# import iris_validation as iris +# importlib.reload(iris) +# job_name = "test_2m2d_COV_MP_noRamaZ_spro" +# iris.generate_report(latest_model_path=DATASET1_PATH.format(suffix='_final.pdb'), +# latest_reflections_path=DATASET1_PATH.format(suffix='_final.mtz'), +# latest_sequence_path=DATASET1_PATH.format(suffix='.fasta'), +# latest_distpred_path=DATASET1_PATH.format(suffix='.npz'), +# previous_model_path=DATASET1_PATH.format(suffix='_0cyc.pdb'), +# previous_reflections_path=DATASET1_PATH.format(suffix='_0cyc.mtz'), +# previous_sequence_path=DATASET1_PATH.format(suffix='.fasta'), +# previous_distpred_path=DATASET1_PATH.format(suffix='.npz'), +# run_covariance=True, +# run_molprobity=True, +# calculate_rama_z=False, +# multiprocessing=False, +# output_dir=OUTPUT_DIR.format(suffix=""), +# output_name_prefix=job_name) +# assert path.exists(OUTPUT_DIR.format(suffix=job_name) + ".html") \ No newline at end of file