From 847e41b76fa314c3921271540f4ee5b2ee45eb4d Mon Sep 17 00:00:00 2001 From: Arthur Zalevsky Date: Wed, 20 Mar 2024 08:06:04 -0700 Subject: [PATCH] limit maximum number of sequential plots to 256 --- ihm_validation/get_plots.py | 9 ++++++--- ihm_validation/report.py | 1 + templates/full_validation_pdf.html | 4 ++-- templates/main.html | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/ihm_validation/get_plots.py b/ihm_validation/get_plots.py index 2b4d83f5..728c4c5d 100644 --- a/ihm_validation/get_plots.py +++ b/ihm_validation/get_plots.py @@ -26,6 +26,7 @@ silence(MISSING_RENDERERS, True) silence(EMPTY_LAYOUT, True) +MAXPLOTS = 256 class Plots(GetInputInformation): def __init__(self, mmcif, imageDirName, driver): @@ -118,14 +119,16 @@ def plot_quality_at_glance(self, molprobity_data: dict, exv_data: dict, # if there isn't molprobity data, we plot exc vol data elif exv_data: - model = exv_data['Models'] - satisfaction = exv_data['Number of violations'] + numplots = min(len(exv_data['Models']), MAXPLOTS) + + model = exv_data['Models'][:numplots] + satisfaction = exv_data['Number of violations'][:numplots] # make sure data is plot-able try: counts = [float(i) for i in satisfaction] except (ValueError): return - violations = exv_data['Excluded Volume Satisfaction (%)'] + violations = exv_data['Excluded Volume Satisfaction (%)'][:numplots] Scores = ['Model ' + str(i+1) for i, j in enumerate(model)] legends = ['Model ' + str(i+1) + ': ' + str(int(j)) + '('+str(violations[i])+' %)' for i, j in enumerate(counts)] diff --git a/ihm_validation/report.py b/ihm_validation/report.py index b3962d20..fb2e6b60 100644 --- a/ihm_validation/report.py +++ b/ihm_validation/report.py @@ -99,6 +99,7 @@ def run_entry_composition(self, Template_Dict: dict) -> dict: Template_Dict['ChainL'] = self.input.get_composition()['Chain ID [auth]'] Template_Dict['ChainLMap'] = self.input.get_auth_label_map() Template_Dict['number_of_fits'] = 0 + Template_Dict['MAXPLOTS'] = get_plots.MAXPLOTS return Template_Dict def check_mmcif(self, Template_Dict: dict) -> None: diff --git a/templates/full_validation_pdf.html b/templates/full_validation_pdf.html index 8ba26618..879ab607 100644 --- a/templates/full_validation_pdf.html +++ b/templates/full_validation_pdf.html @@ -217,7 +217,7 @@

Overall quality ?

- This validation report contains model quality assessments for all structures, data quality assessment for SAS datasets and fit to model assessments for SAS datasets. Data quality and fit to model assessments for other datasets and model uncertainty are under development. + This validation report contains model quality assessments for all structures, data quality assessment for SAS datasets and fit to model assessments for SAS datasets. Data quality and fit to model assessments for other datasets and model uncertainty are under development. Number of plots is limited to {{MAXPLOTS}}.

@@ -233,7 +233,7 @@
{% endif %} - {% for i in range(NumModels) %} + {% for i in range([NumModels, MAXPLOTS] | min) %}
diff --git a/templates/main.html b/templates/main.html index 0f631fd6..03130406 100644 --- a/templates/main.html +++ b/templates/main.html @@ -81,7 +81,7 @@

?

- This validation report contains model quality assessments for all structures. For more detail for each assessment, use the dropdown menus at the top of this page. + This validation report contains model quality assessments for all structures. For more detail for each assessment, use the dropdown menus at the top of this page. Number of plots is limited to {{MAXPLOTS}}.

{% if 'SAS DATA' in Data and sasdb_sascif|length > 0 %}