diff --git a/examples/docking-protein-glycan/docking-flexref-protein-glycan-full.cfg b/examples/docking-protein-glycan/docking-flexref-protein-glycan-full.cfg index 446b65d7e..5787521ad 100644 --- a/examples/docking-protein-glycan/docking-flexref-protein-glycan-full.cfg +++ b/examples/docking-protein-glycan/docking-flexref-protein-glycan-full.cfg @@ -42,8 +42,7 @@ mdsteps_cool1 = 5000 mdsteps_cool2 = 10000 mdsteps_cool3 = 10000 ambig_fname = "data/ambig.tbl" -# give full flexibilit to the glycan -nfle = 1 +# give full flexibility to the glycan fle_sta_1 = 1 fle_end_1 = 4 fle_seg_1 = "B" diff --git a/examples/docking-protein-glycan/docking-flexref-protein-glycan-test.cfg b/examples/docking-protein-glycan/docking-flexref-protein-glycan-test.cfg index 7fc02c3ff..86d062148 100644 --- a/examples/docking-protein-glycan/docking-flexref-protein-glycan-test.cfg +++ b/examples/docking-protein-glycan/docking-flexref-protein-glycan-test.cfg @@ -38,8 +38,7 @@ mdsteps_cool1 = 5000 mdsteps_cool2 = 10000 mdsteps_cool3 = 10000 ambig_fname = "data/ambig.tbl" -# give full flexibilit to the glycan -nfle = 1 +# give full flexibility to the glycan fle_sta_1 = 1 fle_end_1 = 4 fle_seg_1 = "B" diff --git a/examples/docking-protein-homotrimer/docking-protein-homotrimer-full.cfg b/examples/docking-protein-homotrimer/docking-protein-homotrimer-full.cfg index cb519bef4..511f316cb 100644 --- a/examples/docking-protein-homotrimer/docking-protein-homotrimer-full.cfg +++ b/examples/docking-protein-homotrimer/docking-protein-homotrimer-full.cfg @@ -41,7 +41,6 @@ ambig_fname = "data/1qu9_whiscy_air.tbl" sampling = 2000 # Define CNS restraints between molecules ncs_on = true -numncs = 2 ncs_sta1_1=2 ncs_end1_1=128 ncs_seg1_1="A" @@ -56,7 +55,6 @@ ncs_end2_2=128 ncs_seg2_2="C" # Define C3 symmetry restraints sym_on = true -numc3sym = 1 c3sym_sta1_1=2 c3sym_end1_1=128 c3sym_seg1_1="A" @@ -79,7 +77,6 @@ tolerance = 5 ambig_fname = "data/1qu9_whiscy_air.tbl" # Define NCS restraints between molecules ncs_on = true -numncs = 2 ncs_sta1_1=2 ncs_end1_1=128 ncs_seg1_1="A" @@ -94,7 +91,6 @@ ncs_end2_2=128 ncs_seg2_2="C" # Define C3 symmetry restraints sym_on = true -numc3sym = 1 c3sym_sta1_1=2 c3sym_end1_1=128 c3sym_seg1_1="A" @@ -113,7 +109,6 @@ tolerance = 5 ambig_fname = "data/1qu9_whiscy_air.tbl" # Define NCS restraints between molecules ncs_on = true -numncs = 2 ncs_sta1_1=2 ncs_end1_1=128 ncs_seg1_1="A" @@ -128,7 +123,6 @@ ncs_end2_2=128 ncs_seg2_2="C" # Define C3 symmetry restraints sym_on = true -numc3sym = 1 c3sym_sta1_1=2 c3sym_end1_1=128 c3sym_seg1_1="A" diff --git a/examples/docking-protein-homotrimer/docking-protein-homotrimer-test.cfg b/examples/docking-protein-homotrimer/docking-protein-homotrimer-test.cfg index 2be4416c8..c8dca6e3a 100644 --- a/examples/docking-protein-homotrimer/docking-protein-homotrimer-test.cfg +++ b/examples/docking-protein-homotrimer/docking-protein-homotrimer-test.cfg @@ -36,7 +36,6 @@ ambig_fname = "data/1qu9_whiscy_air.tbl" sampling = 20 # Define NCS restraints between molecules ncs_on = true -numncs = 2 ncs_sta1_1=2 ncs_end1_1=128 ncs_seg1_1="A" @@ -51,7 +50,6 @@ ncs_end2_2=128 ncs_seg2_2="C" # Define C3 symmetry restraints sym_on = true -numc3sym = 1 c3sym_sta1_1=2 c3sym_end1_1=128 c3sym_seg1_1="A" @@ -74,7 +72,6 @@ tolerance = 20 ambig_fname = "data/1qu9_whiscy_air.tbl" # Define NCS restraints between molecules ncs_on = true -numncs = 2 ncs_sta1_1=2 ncs_end1_1=128 ncs_seg1_1="A" @@ -89,7 +86,6 @@ ncs_end2_2=128 ncs_seg2_2="C" # Define C3 symmetry restraints sym_on = true -numc3sym = 1 c3sym_sta1_1=2 c3sym_end1_1=128 c3sym_seg1_1="A" @@ -108,7 +104,6 @@ tolerance = 20 ambig_fname = "data/1qu9_whiscy_air.tbl" # Define NCS restraints between molecules ncs_on = true -numncs = 2 ncs_sta1_1=2 ncs_end1_1=128 ncs_seg1_1="A" @@ -123,7 +118,6 @@ ncs_end2_2=128 ncs_seg2_2="C" # Define C3 symmetry restraints sym_on = true -numc3sym = 1 c3sym_sta1_1=2 c3sym_end1_1=128 c3sym_seg1_1="A" diff --git a/examples/docking-protein-peptide/docking-protein-peptide-cltsel-full.cfg b/examples/docking-protein-peptide/docking-protein-peptide-cltsel-full.cfg index 3e6f2e3f6..0fe0e8f6d 100644 --- a/examples/docking-protein-peptide/docking-protein-peptide-cltsel-full.cfg +++ b/examples/docking-protein-peptide/docking-protein-peptide-cltsel-full.cfg @@ -51,7 +51,6 @@ reference_fname = "data/1nx1_refe.pdb" tolerance = 5 ambig_fname = "data/ambig.tbl" # Define peptide as fully flexible -nfle = 1 fle_sta_1 = 1 fle_end_1 = 11 fle_seg_1 = "B" @@ -72,7 +71,6 @@ reference_fname = "data/1nx1_refe.pdb" tolerance = 5 ambig_fname = "data/ambig.tbl" # Define peptide as fully flexible -nfle = 1 fle_sta_1 = 1 fle_end_1 = 11 fle_seg_1 = "B" diff --git a/examples/docking-protein-peptide/docking-protein-peptide-full.cfg b/examples/docking-protein-peptide/docking-protein-peptide-full.cfg index 08e0c49de..45b23459a 100644 --- a/examples/docking-protein-peptide/docking-protein-peptide-full.cfg +++ b/examples/docking-protein-peptide/docking-protein-peptide-full.cfg @@ -45,7 +45,6 @@ select = 400 tolerance = 5 ambig_fname = "data/ambig.tbl" # Define peptide as fully flexible -nfle = 1 fle_sta_1 = 1 fle_end_1 = 11 fle_seg_1 = "B" @@ -65,7 +64,6 @@ reference_fname = "data/1nx1_refe.pdb" tolerance = 5 ambig_fname = "data/ambig.tbl" # Define peptide as fully flexible -nfle = 1 fle_sta_1 = 1 fle_end_1 = 11 fle_seg_1 = "B" diff --git a/examples/docking-protein-peptide/docking-protein-peptide-mdref-full.cfg b/examples/docking-protein-peptide/docking-protein-peptide-mdref-full.cfg index ce095acbe..064d8363f 100644 --- a/examples/docking-protein-peptide/docking-protein-peptide-mdref-full.cfg +++ b/examples/docking-protein-peptide/docking-protein-peptide-mdref-full.cfg @@ -45,7 +45,6 @@ select = 400 tolerance = 5 ambig_fname = "data/ambig.tbl" # Define peptide as fully flexible -nfle = 1 fle_sta_1 = 1 fle_end_1 = 11 fle_seg_1 = "B" @@ -65,7 +64,6 @@ reference_fname = "data/1nx1_refe.pdb" tolerance = 5 ambig_fname = "data/ambig.tbl" # Define peptide as fully flexible -nfle = 1 fle_sta_1 = 1 fle_end_1 = 11 fle_seg_1 = "B" diff --git a/examples/docking-protein-peptide/docking-protein-peptide-mdref-test.cfg b/examples/docking-protein-peptide/docking-protein-peptide-mdref-test.cfg index 4da16060b..7571f8fb5 100644 --- a/examples/docking-protein-peptide/docking-protein-peptide-mdref-test.cfg +++ b/examples/docking-protein-peptide/docking-protein-peptide-mdref-test.cfg @@ -39,7 +39,6 @@ select = 5 tolerance = 20 ambig_fname = "data/ambig.tbl" # Define peptide as fully flexible -nfle = 1 fle_sta_1 = 1 fle_end_1 = 11 fle_seg_1 = "B" @@ -60,7 +59,6 @@ reference_fname = "data/1nx1_refe.pdb" tolerance = 20 ambig_fname = "data/ambig.tbl" # Define peptide as fully flexible -nfle = 1 fle_sta_1 = 1 fle_end_1 = 11 fle_seg_1 = "B" diff --git a/examples/docking-protein-peptide/docking-protein-peptide-test.cfg b/examples/docking-protein-peptide/docking-protein-peptide-test.cfg index 6c819ee2e..672ae43ba 100644 --- a/examples/docking-protein-peptide/docking-protein-peptide-test.cfg +++ b/examples/docking-protein-peptide/docking-protein-peptide-test.cfg @@ -39,7 +39,6 @@ select = 5 tolerance = 20 ambig_fname = "data/ambig.tbl" # Define peptide as fully flexible -nfle = 2 fle_sta_1 = 1 fle_end_1 = 5 fle_seg_1 = "B" @@ -63,7 +62,6 @@ reference_fname = "data/1nx1_refe.pdb" tolerance = 20 ambig_fname = "data/ambig.tbl" # Define peptide as fully flexible -nfle = 1 fle_sta_1 = 1 fle_end_1 = 11 fle_seg_1 = "B" diff --git a/src/haddock/gear/expandable_parameters.py b/src/haddock/gear/expandable_parameters.py index 71d6e9765..1676843b1 100644 --- a/src/haddock/gear/expandable_parameters.py +++ b/src/haddock/gear/expandable_parameters.py @@ -109,8 +109,9 @@ # common error messages _emsg_num_differ = ( "The parameter block {!r} expects " - "{} parameters, but {} are present " - "in the user configuration file: {}." + "{} parameters ({}), but {} are present " + "in the user configuration file: {}. " + "Parameter(s) {} are missing." ) @@ -249,7 +250,7 @@ def _read_groups_in_user_config( extract_params: Callable[..., set[str]], _emsg_no_group: str = "Parameter block is not a valid expandable group", _emsg_unexpected_params: str = "Unexpected params for group", -) -> set[str]: +) -> tuple[set[str], dict[str, int]]: """ Read groups in user config. @@ -279,15 +280,18 @@ def _read_groups_in_user_config( Returns ------- - set + new : set[str] A set with the new parameters in the user configuration file that are acceptable according to the expandable rules. + param_name_counts : dict[str, int] + Count of expendable parameter parameter names """ # minimum=1 is used to capture groups with missing parameters user_groups = get_user_groups(user_config, minimum=1, reference=False) default_group_names = set(group[0] for group in default_groups) new: set[str] = set() + param_name_counts: dict[str, int] = {} for (param_name, group_idx), params in user_groups.items(): if param_name not in default_group_names: emsg = _emsg_no_group.format(param_name, group_idx) @@ -311,35 +315,40 @@ def _read_groups_in_user_config( # when num_found > num_expected the error about in `diff` is # triggered instead if num_found != num_expected: + expected_missings = set(expected_params).difference(params) emsg = _emsg_num_differ.format( param_name, num_expected, + ", ".join(expected_params), num_found, ", ".join(params), + ", ".join([f"`{p}`" for p in expected_missings]), ) raise ConfigurationError(emsg) related_params = extract_params(user_config, param_name, group_idx) + # Increment counts for this parameter + if related_params: + param_name_counts.setdefault(param_name, 0) + param_name_counts[param_name] += 1 new.update(related_params) - - return new + return new, param_name_counts def read_simplest_expandable( - expparams: Iterable[str], config: Iterable[str] + config: Iterable[str], expparams: Iterable[str], ) -> set[str]: """ Read expandable parameters from config file of the type `param_1`. Parameters ---------- + config : dict, dict.keys, set, or alike + The user configuration file. expparams : dict, dict.keys, set, or alike The parameter names that should be considered as expandable. Usually, this is a module subdictionary of `type_simplest_ep`. - config : dict, dict.keys, set, or alike - The user configuration file. - Returns ------- set of str diff --git a/src/haddock/gear/prepare_run.py b/src/haddock/gear/prepare_run.py index 93840c6d3..7c4e6a745 100644 --- a/src/haddock/gear/prepare_run.py +++ b/src/haddock/gear/prepare_run.py @@ -799,18 +799,18 @@ def validate_ncs_params(params: dict) -> None: # Validate value of `numncs` ncs_suffixes = list(groupped_ncs.keys()) # Case when number of definition do not match - if params["numncs"] != len(ncs_suffixes): + if params["nncs"] != len(ncs_suffixes): msg = ( - f'Number of NCS restraints (`numncs = {params["numncs"]}`) ' + f'Number of NCS restraints (`nncs = {params["nncs"]}`) ' " do not match with the number of defined NCS restraints " f"({len(ncs_suffixes)})" ) error_list.append(msg) else: # Case when numbers do not match - if max(ncs_suffixes) != params["numncs"]: + if max(ncs_suffixes) != params["nncs"]: msg = ( - f'Number of NCS restraints (`numncs = {params["numncs"]}`) ' + f'Number of NCS restraints (`nncs = {params["nncs"]}`) ' " do not match with the number of defined NCS restraints " f"({', '.join([str(s) for s in ncs_suffixes])})" ) @@ -1162,25 +1162,44 @@ def get_expandable_parameters( def _get_expandable( user_config: ParamMap, defaults: ParamMap, module_name: str, max_mols: int ) -> set[str]: - type_1 = get_single_index_groups(defaults) - type_2 = get_multiple_index_groups(defaults) - type_4 = get_mol_parameters(defaults) - + # Set parsing vars allowed_params: set[str] = set() - allowed_params.update( - read_single_idx_groups_user_config(user_config, type_1) - ) # noqa: E501 - allowed_params.update( - read_multiple_idx_groups_user_config(user_config, type_2) - ) # noqa: E501 + all_counts: dict[str, int] = {} + # Read single indexed groups (terminating by `_X`) + news_t1, counts_t1 = read_single_idx_groups_user_config( + user_config, + get_single_index_groups(defaults), + ) + allowed_params.update(news_t1) + all_counts.update(counts_t1) + # Read multiple indexed groups (terminating by `_X_Y`) + news_t2, counts_t2 = read_multiple_idx_groups_user_config( + user_config, + get_multiple_index_groups(defaults), + ) + allowed_params.update(news_t2) + all_counts.update(counts_t2) with suppress(KeyError): - type_3 = type_simplest_ep[get_module_name(module_name)] - allowed_params.update(read_simplest_expandable(type_3, user_config)) - - _ = read_mol_parameters(user_config, type_4, max_mols=max_mols) + news_t3 = read_simplest_expandable( + user_config, + type_simplest_ep[get_module_name(module_name)], + ) + allowed_params.update(news_t3) + # Read molecule paramters (starting by `mol_`) + _ = read_mol_parameters( + user_config, + get_mol_parameters(defaults), + max_mols=max_mols, + ) allowed_params.update(_) + # Add counted parameters to hidden user parameters + for param, count in all_counts.items(): + count_param_name = f"n{param}" + if count_param_name in defaults.keys(): + user_config[count_param_name] = count + # Return new set of allowed parameters return allowed_params diff --git a/src/haddock/modules/refinement/emref/cns/emref.cns b/src/haddock/modules/refinement/emref/cns/emref.cns index 60f72c296..a048bc1d1 100644 --- a/src/haddock/modules/refinement/emref/cns/emref.cns +++ b/src/haddock/modules/refinement/emref/cns/emref.cns @@ -59,17 +59,17 @@ evaluate ($data.kcont=$kcont) ! NCS restraints evaluate ($data.kncs = $kncs) evaluate ($Data.flags.ncs = $ncs_on) -evaluate ($data.numncs = $numncs) +evaluate ($data.nncs = $nncs) ! Symmetry restraints evaluate ($data.ksym = $ksym) evaluate ($Data.flags.sym = $sym_on) -evaluate ($data.numc2sym = $numc2sym) -evaluate ($data.numc3sym = $numc3sym) -evaluate ($data.nums3sym = $nums3sym) -evaluate ($data.numc4sym = $numc4sym) -evaluate ($data.numc5sym = $numc5sym) -evaluate ($data.numc6sym = $numc6sym) +evaluate ($data.nc2sym = $nc2sym) +evaluate ($data.nc3sym = $nc3sym) +evaluate ($data.ns3sym = $ns3sym) +evaluate ($data.nc4sym = $nc4sym) +evaluate ($data.nc5sym = $nc5sym) +evaluate ($data.nc6sym = $nc6sym) !Dihedral angle energy term: evaluate ($data.flags.dihed = true) diff --git a/src/haddock/modules/refinement/emref/cns/symmultimer.cns b/src/haddock/modules/refinement/emref/cns/symmultimer.cns index db05bb49d..3b4f731e9 100644 --- a/src/haddock/modules/refinement/emref/cns/symmultimer.cns +++ b/src/haddock/modules/refinement/emref/cns/symmultimer.cns @@ -18,7 +18,7 @@ if ($Data.flags.sym eq true) then ! Define C2 symmetry restraints for symmetrical multimers ! eval ($ncount = 0) - while ($ncount < $data.numc2sym) loop c2symloop + while ($ncount < $data.nc2sym) loop c2symloop eval ($ncount = $ncount + 1) evaluate ($i1start = $c2sym_sta1_$ncount) @@ -65,7 +65,7 @@ if ($Data.flags.sym eq true) then ! Define C3 symmetry restraints for symmetrical multimers ! eval ($ncount = 0) - while ($ncount < $data.numc3sym) loop c3symloop + while ($ncount < $data.nc3sym) loop c3symloop eval ($ncount = $ncount + 1) evaluate ($i1start = $c3sym_sta1_$ncount) @@ -142,7 +142,7 @@ if ($Data.flags.sym eq true) then ! Define S3 symmetry restraints for symmetrical multimers ! eval ($ncount = 0) - while ($ncount < $data.nums3sym) loop s3symloop + while ($ncount < $data.ns3sym) loop s3symloop eval ($ncount = $ncount + 1) evaluate ($i1start = $s3sym_sta1_$ncount) @@ -218,7 +218,7 @@ if ($Data.flags.sym eq true) then ! eval ($istep = 10) eval ($ncount = 0) - while ($ncount < $data.numc4sym) loop c4symloop + while ($ncount < $data.nc4sym) loop c4symloop eval ($ncount = $ncount + 1) evaluate ($i1start = $c4sym_sta1_$ncount) @@ -369,7 +369,7 @@ if ($Data.flags.sym eq true) then ! eval ($istep = 4) eval ($ncount = 0) - while ($ncount < $data.numc5sym) loop c5symloop + while ($ncount < $data.nc5sym) loop c5symloop eval ($ncount = $ncount + 1) evaluate ($i1start = $c5sym_sta1_$ncount) @@ -482,7 +482,7 @@ if ($Data.flags.sym eq true) then ! eval ($istep = 10) eval ($ncount = 0) - while ($ncount < $data.numc6sym) loop c6symloop + while ($ncount < $data.nc6sym) loop c6symloop eval ($ncount = $ncount + 1) evaluate ($i1start = $c6sym_sta1_$ncount) diff --git a/src/haddock/modules/refinement/emref/defaults.yaml b/src/haddock/modules/refinement/emref/defaults.yaml index 45a21022b..2b191a935 100644 --- a/src/haddock/modules/refinement/emref/defaults.yaml +++ b/src/haddock/modules/refinement/emref/defaults.yaml @@ -237,7 +237,7 @@ symtbl_fname: long: Filename of the custom symmetry restraints file. group: 'symmetry' explevel: expert -numc2sym: +nc2sym: default: 0 type: integer min: 0 @@ -248,7 +248,7 @@ numc2sym: For each, a pair of segments on which the symmetry restraint is applied will have to be defined. Those must all have the same length. group: 'symmetry' - explevel: expert + explevel: hidden c2sym_sta1_1: default: .nan type: integer @@ -309,7 +309,7 @@ c2sym_seg2_1: long: Segment ID of second C2 segment group: 'symmetry' explevel: expert -numc3sym: +nc3sym: default: 0 type: integer min: 0 @@ -320,7 +320,7 @@ numc3sym: For each, three segments on which the symmetry restraint is applied will have to be defined. Those must all have the same length. group: 'symmetry' - explevel: expert + explevel: hidden c3sym_sta1_1: default: .nan type: integer @@ -411,7 +411,7 @@ c3sym_seg3_1: long: Segment ID of third C3 segment group: 'symmetry' explevel: expert -numc4sym: +nc4sym: default: 0 type: integer min: 0 @@ -422,7 +422,7 @@ numc4sym: For each, four segments on which the symmetry restraint is applied will have to be defined. Those must all have the same length. group: 'symmetry' - explevel: expert + explevel: hidden c4sym_sta1_1: default: .nan type: integer @@ -543,7 +543,7 @@ c4sym_seg4_1: long: Segment ID of fourth C4 segment group: 'symmetry' explevel: expert -numc5sym: +nc5sym: default: 0 type: integer min: 0 @@ -554,7 +554,7 @@ numc5sym: For each, five segments on which the symmetry restraint is applied will have to be defined. Those must all have the same length. group: 'symmetry' - explevel: expert + explevel: hidden c5sym_sta1_1: default: .nan type: integer @@ -705,7 +705,7 @@ c5sym_seg5_1: long: Segment ID of fifth C5 segment group: 'symmetry' explevel: expert -numc6sym: +nc6sym: default: 0 type: integer min: 0 @@ -716,7 +716,7 @@ numc6sym: For each, six segments on which the symmetry restraint is applied will have to be defined. Those must all have the same length. group: 'symmetry' - explevel: expert + explevel: hidden c6sym_sta1_1: default: .nan type: integer @@ -897,7 +897,7 @@ c6sym_seg6_1: long: Segment ID of sixth C6 segment group: 'symmetry' explevel: expert -nums3sym: +ns3sym: default: 0 type: integer min: 0 @@ -908,7 +908,7 @@ nums3sym: For each, three segments on which the symmetry restraint is applied will have to be defined. Those must all have the same length. group: 'symmetry' - explevel: expert + explevel: hidden s3sym_sta1_1: default: .nan type: integer @@ -1019,7 +1019,7 @@ kncs: long: Force constant for non-crystallographic restraints group: 'symmetry' explevel: expert -numncs: +nncs: default: 0 type: integer min: 0 @@ -1029,7 +1029,7 @@ numncs: long: Number of non-crystallographic symmetry restraints. For each pairs of segments will have to be defined. Note that those must contain exactly the same residues/atom combinations. group: 'symmetry' - explevel: expert + explevel: hidden ncs_sta1_1: default: .nan type: integer @@ -2096,7 +2096,7 @@ nfle: If >=1 then those must be defined manually with segment ID (segid) in the fle_seg_* variable, followed by the starting and ending residue numbers in the fle_sta_* and fle_end_* variables. group: 'flexibility' - explevel: expert + explevel: hidden fle_sta_1: default: .nan type: integer diff --git a/src/haddock/modules/refinement/flexref/cns/check-homomers.cns b/src/haddock/modules/refinement/flexref/cns/check-homomers.cns index 00a359955..7faf7a4c9 100644 --- a/src/haddock/modules/refinement/flexref/cns/check-homomers.cns +++ b/src/haddock/modules/refinement/flexref/cns/check-homomers.cns @@ -22,32 +22,32 @@ while ($ncount < $data.ncomponents) loop checkmol end loop checkmol if ($data.flags.sym eq true) then - if ($data.numc2sym > 0) then + if ($data.nc2sym > 0) then if ($n_moving_mol = 2) then evaluate ($homosymmetry = true) end if end if - if ($data.numc2sym = 6) then + if ($data.nc2sym = 6) then if ($n_moving_mol = 4) then evaluate ($homosymmetry = true) end if end if - if ($data.numc3sym > 0) then + if ($data.nc3sym > 0) then if ($n_moving_mol = 3) then evaluate ($homosymmetry = true) end if end if - if ($data.numc4sym > 0) then + if ($data.nc4sym > 0) then if ($n_moving_mol = 4) then evaluate ($homosymmetry = true) end if end if - if ($data.numc5sym > 0) then + if ($data.nc5sym > 0) then if ($n_moving_mol = 5) then evaluate ($homosymmetry = true) end if end if - if ($data.numc6sym > 0) then + if ($data.nc6sym > 0) then if ($n_moving_mol = 6) then evaluate ($homosymmetry = true) end if diff --git a/src/haddock/modules/refinement/flexref/cns/flexref.cns b/src/haddock/modules/refinement/flexref/cns/flexref.cns index f5959d7c9..4ca0f0c3a 100644 --- a/src/haddock/modules/refinement/flexref/cns/flexref.cns +++ b/src/haddock/modules/refinement/flexref/cns/flexref.cns @@ -118,17 +118,17 @@ end if ! NCS restraints evaluate ($data.kncs = $kncs) evaluate ($Data.flags.ncs = $ncs_on) -evaluate ($data.numncs = $numncs) +evaluate ($data.nncs = $nncs) ! Symmetry restraints evaluate ($data.ksym = $ksym) evaluate ($Data.flags.sym = $sym_on) -evaluate ($data.numc2sym = $numc2sym) -evaluate ($data.numc3sym = $numc3sym) -evaluate ($data.nums3sym = $nums3sym) -evaluate ($data.numc4sym = $numc4sym) -evaluate ($data.numc5sym = $numc5sym) -evaluate ($data.numc6sym = $numc6sym) +evaluate ($data.nc2sym = $nc2sym) +evaluate ($data.nc3sym = $nc3sym) +evaluate ($data.ns3sym = $ns3sym) +evaluate ($data.nc4sym = $nc4sym) +evaluate ($data.nc5sym = $nc5sym) +evaluate ($data.nc6sym = $nc6sym) !Electrostatics: evaluate ($Data.flags.dihed =$dihedflag) diff --git a/src/haddock/modules/refinement/flexref/cns/symmultimer.cns b/src/haddock/modules/refinement/flexref/cns/symmultimer.cns index db05bb49d..3b4f731e9 100644 --- a/src/haddock/modules/refinement/flexref/cns/symmultimer.cns +++ b/src/haddock/modules/refinement/flexref/cns/symmultimer.cns @@ -18,7 +18,7 @@ if ($Data.flags.sym eq true) then ! Define C2 symmetry restraints for symmetrical multimers ! eval ($ncount = 0) - while ($ncount < $data.numc2sym) loop c2symloop + while ($ncount < $data.nc2sym) loop c2symloop eval ($ncount = $ncount + 1) evaluate ($i1start = $c2sym_sta1_$ncount) @@ -65,7 +65,7 @@ if ($Data.flags.sym eq true) then ! Define C3 symmetry restraints for symmetrical multimers ! eval ($ncount = 0) - while ($ncount < $data.numc3sym) loop c3symloop + while ($ncount < $data.nc3sym) loop c3symloop eval ($ncount = $ncount + 1) evaluate ($i1start = $c3sym_sta1_$ncount) @@ -142,7 +142,7 @@ if ($Data.flags.sym eq true) then ! Define S3 symmetry restraints for symmetrical multimers ! eval ($ncount = 0) - while ($ncount < $data.nums3sym) loop s3symloop + while ($ncount < $data.ns3sym) loop s3symloop eval ($ncount = $ncount + 1) evaluate ($i1start = $s3sym_sta1_$ncount) @@ -218,7 +218,7 @@ if ($Data.flags.sym eq true) then ! eval ($istep = 10) eval ($ncount = 0) - while ($ncount < $data.numc4sym) loop c4symloop + while ($ncount < $data.nc4sym) loop c4symloop eval ($ncount = $ncount + 1) evaluate ($i1start = $c4sym_sta1_$ncount) @@ -369,7 +369,7 @@ if ($Data.flags.sym eq true) then ! eval ($istep = 4) eval ($ncount = 0) - while ($ncount < $data.numc5sym) loop c5symloop + while ($ncount < $data.nc5sym) loop c5symloop eval ($ncount = $ncount + 1) evaluate ($i1start = $c5sym_sta1_$ncount) @@ -482,7 +482,7 @@ if ($Data.flags.sym eq true) then ! eval ($istep = 10) eval ($ncount = 0) - while ($ncount < $data.numc6sym) loop c6symloop + while ($ncount < $data.nc6sym) loop c6symloop eval ($ncount = $ncount + 1) evaluate ($i1start = $c6sym_sta1_$ncount) diff --git a/src/haddock/modules/refinement/flexref/defaults.yaml b/src/haddock/modules/refinement/flexref/defaults.yaml index ec252da6a..a4a2fbbf5 100644 --- a/src/haddock/modules/refinement/flexref/defaults.yaml +++ b/src/haddock/modules/refinement/flexref/defaults.yaml @@ -574,7 +574,7 @@ symtbl_fname: long: Filename of the custom symmetry restraints file. group: 'symmetry' explevel: expert -numc2sym: +nc2sym: default: 0 type: integer min: 0 @@ -585,7 +585,7 @@ numc2sym: For each, a pair of segments on which the symmetry restraint is applied will have to be defined. Those must all have the same length. group: 'symmetry' - explevel: expert + explevel: hidden c2sym_sta1_1: default: .nan type: integer @@ -646,7 +646,7 @@ c2sym_seg2_1: long: Segment ID of second C2 segment group: 'symmetry' explevel: expert -numc3sym: +nc3sym: default: 0 type: integer min: 0 @@ -657,7 +657,7 @@ numc3sym: For each, three segments on which the symmetry restraint is applied will have to be defined. Those must all have the same length. group: 'symmetry' - explevel: expert + explevel: hidden c3sym_sta1_1: default: .nan type: integer @@ -748,7 +748,7 @@ c3sym_seg3_1: long: Segment ID of third C3 segment group: 'symmetry' explevel: expert -numc4sym: +nc4sym: default: 0 type: integer min: 0 @@ -759,7 +759,7 @@ numc4sym: For each, four segments on which the symmetry restraint is applied will have to be defined. Those must all have the same length. group: 'symmetry' - explevel: expert + explevel: hidden c4sym_sta1_1: default: .nan type: integer @@ -880,7 +880,7 @@ c4sym_seg4_1: long: Segment ID of fourth C4 segment group: 'symmetry' explevel: expert -numc5sym: +nc5sym: default: 0 type: integer min: 0 @@ -891,7 +891,7 @@ numc5sym: For each, five segments on which the symmetry restraint is applied will have to be defined. Those must all have the same length. group: 'symmetry' - explevel: expert + explevel: hidden c5sym_sta1_1: default: .nan type: integer @@ -1042,7 +1042,7 @@ c5sym_seg5_1: long: Segment ID of fifth C5 segment group: 'symmetry' explevel: expert -numc6sym: +nc6sym: default: 0 type: integer min: 0 @@ -1053,7 +1053,7 @@ numc6sym: For each, six segments on which the symmetry restraint is applied will have to be defined. Those must all have the same length. group: 'symmetry' - explevel: expert + explevel: hidden c6sym_sta1_1: default: .nan type: integer @@ -1234,7 +1234,7 @@ c6sym_seg6_1: long: Segment ID of sixth C6 segment group: 'symmetry' explevel: expert -nums3sym: +ns3sym: default: 0 type: integer min: 0 @@ -1245,7 +1245,7 @@ nums3sym: For each, three segments on which the symmetry restraint is applied will have to be defined. Those must all have the same length. group: 'symmetry' - explevel: expert + explevel: hidden s3sym_sta1_1: default: .nan type: integer @@ -1356,7 +1356,7 @@ kncs: long: Force constant for non-crystallographic restraints group: 'symmetry' explevel: expert -numncs: +nncs: default: 0 type: integer min: 0 @@ -1366,7 +1366,7 @@ numncs: long: Number of non-crystallographic symmetry restraints. For each pairs of segments will have to be defined. Note that those must contain exactly the same residues/atom combinations. group: 'symmetry' - explevel: expert + explevel: hidden ncs_sta1_1: default: .nan type: integer @@ -2639,7 +2639,7 @@ nfle: If >=1 then those must be defined manually with segment ID (segid) in the fle_seg_* variable, followed by the starting and ending residue numbers in the fle_sta_* and fle_end_* variables. group: 'flexibility' - explevel: expert + explevel: hidden fle_sta_1: default: .nan type: integer diff --git a/src/haddock/modules/refinement/mdref/cns/mdref.cns b/src/haddock/modules/refinement/mdref/cns/mdref.cns index 0419ac3cf..4c206f484 100644 --- a/src/haddock/modules/refinement/mdref/cns/mdref.cns +++ b/src/haddock/modules/refinement/mdref/cns/mdref.cns @@ -67,17 +67,17 @@ end if ! NCS restraints evaluate ($data.kncs = $kncs) evaluate ($Data.flags.ncs = $ncs_on) -evaluate ($data.numncs = $numncs) +evaluate ($data.nncs = $nncs) ! Symmetry restraints evaluate ($data.ksym = $ksym) evaluate ($Data.flags.sym = $sym_on) -evaluate ($data.numc2sym = $numc2sym) -evaluate ($data.numc3sym = $numc3sym) -evaluate ($data.nums3sym = $nums3sym) -evaluate ($data.numc4sym = $numc4sym) -evaluate ($data.numc5sym = $numc5sym) -evaluate ($data.numc6sym = $numc6sym) +evaluate ($data.nc2sym = $nc2sym) +evaluate ($data.nc3sym = $nc3sym) +evaluate ($data.ns3sym = $ns3sym) +evaluate ($data.nc4sym = $nc4sym) +evaluate ($data.nc5sym = $nc5sym) +evaluate ($data.nc6sym = $nc6sym) !Electrostatics: evaluate ($Data.flags.dihed =$dihedflag) diff --git a/src/haddock/modules/refinement/mdref/cns/symmultimer.cns b/src/haddock/modules/refinement/mdref/cns/symmultimer.cns index db05bb49d..3b4f731e9 100644 --- a/src/haddock/modules/refinement/mdref/cns/symmultimer.cns +++ b/src/haddock/modules/refinement/mdref/cns/symmultimer.cns @@ -18,7 +18,7 @@ if ($Data.flags.sym eq true) then ! Define C2 symmetry restraints for symmetrical multimers ! eval ($ncount = 0) - while ($ncount < $data.numc2sym) loop c2symloop + while ($ncount < $data.nc2sym) loop c2symloop eval ($ncount = $ncount + 1) evaluate ($i1start = $c2sym_sta1_$ncount) @@ -65,7 +65,7 @@ if ($Data.flags.sym eq true) then ! Define C3 symmetry restraints for symmetrical multimers ! eval ($ncount = 0) - while ($ncount < $data.numc3sym) loop c3symloop + while ($ncount < $data.nc3sym) loop c3symloop eval ($ncount = $ncount + 1) evaluate ($i1start = $c3sym_sta1_$ncount) @@ -142,7 +142,7 @@ if ($Data.flags.sym eq true) then ! Define S3 symmetry restraints for symmetrical multimers ! eval ($ncount = 0) - while ($ncount < $data.nums3sym) loop s3symloop + while ($ncount < $data.ns3sym) loop s3symloop eval ($ncount = $ncount + 1) evaluate ($i1start = $s3sym_sta1_$ncount) @@ -218,7 +218,7 @@ if ($Data.flags.sym eq true) then ! eval ($istep = 10) eval ($ncount = 0) - while ($ncount < $data.numc4sym) loop c4symloop + while ($ncount < $data.nc4sym) loop c4symloop eval ($ncount = $ncount + 1) evaluate ($i1start = $c4sym_sta1_$ncount) @@ -369,7 +369,7 @@ if ($Data.flags.sym eq true) then ! eval ($istep = 4) eval ($ncount = 0) - while ($ncount < $data.numc5sym) loop c5symloop + while ($ncount < $data.nc5sym) loop c5symloop eval ($ncount = $ncount + 1) evaluate ($i1start = $c5sym_sta1_$ncount) @@ -482,7 +482,7 @@ if ($Data.flags.sym eq true) then ! eval ($istep = 10) eval ($ncount = 0) - while ($ncount < $data.numc6sym) loop c6symloop + while ($ncount < $data.nc6sym) loop c6symloop eval ($ncount = $ncount + 1) evaluate ($i1start = $c6sym_sta1_$ncount) diff --git a/src/haddock/modules/refinement/mdref/defaults.yaml b/src/haddock/modules/refinement/mdref/defaults.yaml index d431e3d2a..2cb795de7 100644 --- a/src/haddock/modules/refinement/mdref/defaults.yaml +++ b/src/haddock/modules/refinement/mdref/defaults.yaml @@ -276,7 +276,7 @@ symtbl_fname: long: Filename of the custom symmetry restraints file. group: 'symmetry' explevel: expert -numc2sym: +nc2sym: default: 0 type: integer min: 0 @@ -287,7 +287,7 @@ numc2sym: For each, a pair of segments on which the symmetry restraint is applied will have to be defined. Those must all have the same length. group: 'symmetry' - explevel: expert + explevel: hidden c2sym_sta1_1: default: .nan type: integer @@ -348,7 +348,7 @@ c2sym_seg2_1: long: Segment ID of second C2 segment group: 'symmetry' explevel: expert -numc3sym: +nc3sym: default: 0 type: integer min: 0 @@ -359,7 +359,7 @@ numc3sym: For each, three segments on which the symmetry restraint is applied will have to be defined. Those must all have the same length. group: 'symmetry' - explevel: expert + explevel: hidden c3sym_sta1_1: default: .nan type: integer @@ -450,7 +450,7 @@ c3sym_seg3_1: long: Segment ID of third C3 segment group: 'symmetry' explevel: expert -numc4sym: +nc4sym: default: 0 type: integer min: 0 @@ -461,7 +461,7 @@ numc4sym: For each, four segments on which the symmetry restraint is applied will have to be defined. Those must all have the same length. group: 'symmetry' - explevel: expert + explevel: hidden c4sym_sta1_1: default: .nan type: integer @@ -582,7 +582,7 @@ c4sym_seg4_1: long: Segment ID of fourth C4 segment group: 'symmetry' explevel: expert -numc5sym: +nc5sym: default: 0 type: integer min: 0 @@ -593,7 +593,7 @@ numc5sym: For each, five segments on which the symmetry restraint is applied will have to be defined. Those must all have the same length. group: 'symmetry' - explevel: expert + explevel: hidden c5sym_sta1_1: default: .nan type: integer @@ -744,7 +744,7 @@ c5sym_seg5_1: long: Segment ID of fifth C5 segment group: 'symmetry' explevel: expert -numc6sym: +nc6sym: default: 0 type: integer min: 0 @@ -755,7 +755,7 @@ numc6sym: For each, six segments on which the symmetry restraint is applied will have to be defined. Those must all have the same length. group: 'symmetry' - explevel: expert + explevel: hidden c6sym_sta1_1: default: .nan type: integer @@ -936,7 +936,7 @@ c6sym_seg6_1: long: Segment ID of sixth C6 segment group: 'symmetry' explevel: expert -nums3sym: +ns3sym: default: 0 type: integer min: 0 @@ -947,7 +947,7 @@ nums3sym: For each, three segments on which the symmetry restraint is applied will have to be defined. Those must all have the same length. group: 'symmetry' - explevel: expert + explevel: hidden s3sym_sta1_1: default: .nan type: integer @@ -1058,7 +1058,7 @@ kncs: long: Force constant for non-crystallographic restraints group: 'symmetry' explevel: expert -numncs: +nncs: default: 0 type: integer min: 0 @@ -1068,7 +1068,7 @@ numncs: long: Number of non-crystallographic symmetry restraints. For each pairs of segments will have to be defined. Note that those must contain exactly the same residues/atom combinations. group: 'symmetry' - explevel: expert + explevel: hidden ncs_sta1_1: default: .nan type: integer @@ -2195,7 +2195,7 @@ nfle: If >=1 then those must be defined manually with segment ID (segid) in the fle_seg_* variable, followed by the starting and ending residue numbers in the fle_sta_* and fle_end_* variables. group: 'flexibility' - explevel: expert + explevel: hidden fle_sta_1: default: .nan type: integer diff --git a/src/haddock/modules/sampling/rigidbody/cns/check-homomers.cns b/src/haddock/modules/sampling/rigidbody/cns/check-homomers.cns index 00a359955..7faf7a4c9 100644 --- a/src/haddock/modules/sampling/rigidbody/cns/check-homomers.cns +++ b/src/haddock/modules/sampling/rigidbody/cns/check-homomers.cns @@ -22,32 +22,32 @@ while ($ncount < $data.ncomponents) loop checkmol end loop checkmol if ($data.flags.sym eq true) then - if ($data.numc2sym > 0) then + if ($data.nc2sym > 0) then if ($n_moving_mol = 2) then evaluate ($homosymmetry = true) end if end if - if ($data.numc2sym = 6) then + if ($data.nc2sym = 6) then if ($n_moving_mol = 4) then evaluate ($homosymmetry = true) end if end if - if ($data.numc3sym > 0) then + if ($data.nc3sym > 0) then if ($n_moving_mol = 3) then evaluate ($homosymmetry = true) end if end if - if ($data.numc4sym > 0) then + if ($data.nc4sym > 0) then if ($n_moving_mol = 4) then evaluate ($homosymmetry = true) end if end if - if ($data.numc5sym > 0) then + if ($data.nc5sym > 0) then if ($n_moving_mol = 5) then evaluate ($homosymmetry = true) end if end if - if ($data.numc6sym > 0) then + if ($data.nc6sym > 0) then if ($n_moving_mol = 6) then evaluate ($homosymmetry = true) end if diff --git a/src/haddock/modules/sampling/rigidbody/cns/rigidbody.cns b/src/haddock/modules/sampling/rigidbody/cns/rigidbody.cns index 1da4ab5e9..c3ffc1ed3 100644 --- a/src/haddock/modules/sampling/rigidbody/cns/rigidbody.cns +++ b/src/haddock/modules/sampling/rigidbody/cns/rigidbody.cns @@ -58,26 +58,26 @@ evaluate ($toppar.par_nonbonded = "OPLSX") ! Symmetry restraints evaluate ($data.ksym = $ksym) evaluate ($Data.flags.sym = $sym_on) -evaluate ($data.numc2sym = $numc2sym) -evaluate ($data.numc3sym = $numc3sym) -evaluate ($data.nums3sym= $nums3sym) -evaluate ($data.numc4sym = $numc4sym) -evaluate ($data.numc5sym = $numc5sym) -evaluate ($data.numc6sym = $numc6sym) - -if ( $data.numc2sym eq 6) then +evaluate ($data.nc2sym = $nc2sym) +evaluate ($data.nc3sym = $nc3sym) +evaluate ($data.ns3sym = $ns3sym) +evaluate ($data.nc4sym = $nc4sym) +evaluate ($data.nc5sym = $nc5sym) +evaluate ($data.nc6sym = $nc6sym) + +if ( $data.nc2sym eq 6) then evaluate ($saprotocol.rotate180 = false) end if -if ( $data.numc3sym ne 0) then +if ( $data.nc3sym ne 0) then evaluate ($saprotocol.rotate180 = false) end if -if ( $data.numc4sym ne 0) then +if ( $data.nc4sym ne 0) then evaluate ($saprotocol.rotate180 = false) end if -if ( $data.numc5sym ne 0) then +if ( $data.nc5sym ne 0) then evaluate ($saprotocol.rotate180 = false) end if -if ( $data.numc6sym ne 0) then +if ( $data.nc6sym ne 0) then evaluate ($saprotocol.rotate180 = false) end if diff --git a/src/haddock/modules/sampling/rigidbody/cns/symmultimer.cns b/src/haddock/modules/sampling/rigidbody/cns/symmultimer.cns index db05bb49d..3b4f731e9 100644 --- a/src/haddock/modules/sampling/rigidbody/cns/symmultimer.cns +++ b/src/haddock/modules/sampling/rigidbody/cns/symmultimer.cns @@ -18,7 +18,7 @@ if ($Data.flags.sym eq true) then ! Define C2 symmetry restraints for symmetrical multimers ! eval ($ncount = 0) - while ($ncount < $data.numc2sym) loop c2symloop + while ($ncount < $data.nc2sym) loop c2symloop eval ($ncount = $ncount + 1) evaluate ($i1start = $c2sym_sta1_$ncount) @@ -65,7 +65,7 @@ if ($Data.flags.sym eq true) then ! Define C3 symmetry restraints for symmetrical multimers ! eval ($ncount = 0) - while ($ncount < $data.numc3sym) loop c3symloop + while ($ncount < $data.nc3sym) loop c3symloop eval ($ncount = $ncount + 1) evaluate ($i1start = $c3sym_sta1_$ncount) @@ -142,7 +142,7 @@ if ($Data.flags.sym eq true) then ! Define S3 symmetry restraints for symmetrical multimers ! eval ($ncount = 0) - while ($ncount < $data.nums3sym) loop s3symloop + while ($ncount < $data.ns3sym) loop s3symloop eval ($ncount = $ncount + 1) evaluate ($i1start = $s3sym_sta1_$ncount) @@ -218,7 +218,7 @@ if ($Data.flags.sym eq true) then ! eval ($istep = 10) eval ($ncount = 0) - while ($ncount < $data.numc4sym) loop c4symloop + while ($ncount < $data.nc4sym) loop c4symloop eval ($ncount = $ncount + 1) evaluate ($i1start = $c4sym_sta1_$ncount) @@ -369,7 +369,7 @@ if ($Data.flags.sym eq true) then ! eval ($istep = 4) eval ($ncount = 0) - while ($ncount < $data.numc5sym) loop c5symloop + while ($ncount < $data.nc5sym) loop c5symloop eval ($ncount = $ncount + 1) evaluate ($i1start = $c5sym_sta1_$ncount) @@ -482,7 +482,7 @@ if ($Data.flags.sym eq true) then ! eval ($istep = 10) eval ($ncount = 0) - while ($ncount < $data.numc6sym) loop c6symloop + while ($ncount < $data.nc6sym) loop c6symloop eval ($ncount = $ncount + 1) evaluate ($i1start = $c6sym_sta1_$ncount) diff --git a/src/haddock/modules/sampling/rigidbody/defaults.yaml b/src/haddock/modules/sampling/rigidbody/defaults.yaml index ff3a35dd9..c909b6b41 100644 --- a/src/haddock/modules/sampling/rigidbody/defaults.yaml +++ b/src/haddock/modules/sampling/rigidbody/defaults.yaml @@ -956,7 +956,7 @@ symtbl_fname: long: Filename of the custom symmetry restraints file. group: 'symmetry' explevel: expert -numc2sym: +nc2sym: default: 0 type: integer min: 0 @@ -1028,7 +1028,7 @@ c2sym_seg2_1: long: Segment ID of second C2 segment group: 'symmetry' explevel: expert -numc3sym: +nc3sym: default: 0 type: integer min: 0 @@ -1130,7 +1130,7 @@ c3sym_seg3_1: long: Segment ID of third C3 segment group: 'symmetry' explevel: expert -numc4sym: +nc4sym: default: 0 type: integer min: 0 @@ -1262,7 +1262,7 @@ c4sym_seg4_1: long: Segment ID of fourth C4 segment group: 'symmetry' explevel: expert -numc5sym: +nc5sym: default: 0 type: integer min: 0 @@ -1424,7 +1424,7 @@ c5sym_seg5_1: long: Segment ID of fifth C5 segment group: 'symmetry' explevel: expert -numc6sym: +nc6sym: default: 0 type: integer min: 0 @@ -1616,7 +1616,7 @@ c6sym_seg6_1: long: Segment ID of sixth C6 segment group: 'symmetry' explevel: expert -nums3sym: +ns3sym: default: 0 type: integer min: 0 @@ -1738,7 +1738,7 @@ kncs: long: Force constant for non-crystallographic restraints group: 'symmetry' explevel: expert -numncs: +nncs: default: 0 type: integer min: 0 @@ -1748,7 +1748,7 @@ numncs: long: Number of non-crystallographic symmetry restraints. For each pairs of segments will have to be defined. Note that those must contain exactly the same residues/atom combinations. group: 'symmetry' - explevel: expert + explevel: hidden ncs_sta1_1: default: .nan type: integer diff --git a/tests/test_examples_general.py b/tests/test_examples_general.py index 1a4fd8fdc..975fc0cb3 100644 --- a/tests/test_examples_general.py +++ b/tests/test_examples_general.py @@ -73,9 +73,26 @@ def test_integration_examples(): def test_validate_cfg_files(): """Test all the examples configuration files are valid.""" for cfg_file in examples_cfg_files: + assert validate_cfg_file(cfg_file), f"Error detected in {cfg_file}!" + + +def validate_cfg_file(cfg_file: Path) -> bool: + """Handeler to validate a configuration file. + + Parameters + ---------- + cfg_file : Path + Path to the configuration file to check. + + Returns + ------- + bool + True if config file is OK else False + """ + try: if cfg_file.name == "params.cfg": # skip the params.cfg files as they might be part of old runs - continue + return True config_files = read_config(cfg_file) # update default non-mandatory parameters with user params params = recursive_dict_update( @@ -99,4 +116,9 @@ def test_validate_cfg_files(): reference_parameters=ALL_POSSIBLE_GENERAL_PARAMETERS, ) - validate_modules_params(modules_params, 20) \ No newline at end of file + validate_modules_params(modules_params, 20) + except Exception as e: + print(e) + return False + else: + return True diff --git a/tests/test_gear_expandable_parameters.py b/tests/test_gear_expandable_parameters.py index 559f83c77..be3173ca9 100644 --- a/tests/test_gear_expandable_parameters.py +++ b/tests/test_gear_expandable_parameters.py @@ -1,6 +1,6 @@ """Test expandable parameter modules.""" -import importlib +import importlib import pytest from haddock.core.exceptions import ConfigurationError @@ -423,7 +423,7 @@ def test_read_single_idx_groups_user_config( expected, ): """Test read single index groups in user config.""" - result = read_single_idx_groups_user_config(user_config, default_groups) + result, _ = read_single_idx_groups_user_config(user_config, default_groups) assert result == expected @@ -431,32 +431,115 @@ def test_read_single_idx_groups_user_config( "user_config,default_groups,expected", [ ( - {"param_other_1", "param_else_1", - "param_other_2", "param_else_2", - "param_1", - "param_sam_1_1", "param_frodo_1_1", - "param_sam_1_2", "param_frodo_1_2", - "param_sam_2_1", "param_frodo_2_1", - }, - {("param1", "1"): {"sam", "frodo"}, - ("param2", "1"): {"sam", "frodo"}}, - {"param_frodo_1_1", "param_sam_1_1", - "param_frodo_1_2", "param_sam_1_2", - "param_sam_2_1", "param_frodo_2_1", - }, + # user_config + { + "param_other_1", "param_else_1", # param 1 + "param_other_2", "param_else_2", # param 2 + "param_1", # not a single index group + "param_other_1_1", # multiple index group + }, + # default_groups + { + ("param", "1"): {"other", "else"}, + }, + # expected + { + "param": 2, + }, ), ] ) -def test_read_multiple_idx_groups_user_config( +def test_read_single_idx_groups_user_config_count( user_config, default_groups, expected, ): """Test read single index groups in user config.""" - result = read_multiple_idx_groups_user_config(user_config, default_groups) + _, counts = read_single_idx_groups_user_config(user_config, default_groups) + assert counts == expected + + +@pytest.mark.parametrize( + "user_config,default_groups,expected", + [ + ( + # user_config + { + # single index ones should NOT be considered + "param_other_1", "param_else_1", + "param_other_2", "param_else_2", + "param_1", + # multiple index ones should be considered + "param_sam_1_1", "param_frodo_1_1", + "param_sam_1_2", "param_frodo_1_2", + "param_sam_2_1", "param_frodo_2_1", + }, + # default_groups + { + ("param1", "1"): {"sam", "frodo"}, + ("param2", "1"): {"sam", "frodo"}, + }, + # expected + { + "param_frodo_1_1", "param_sam_1_1", + "param_frodo_1_2", "param_sam_1_2", + "param_sam_2_1", "param_frodo_2_1", + }, + ), + ] + ) +def test_read_multiple_idx_groups_user_config( + user_config, + default_groups, + expected, + ): + """Test read multiple index groups in user config.""" + result, _ = read_multiple_idx_groups_user_config( + user_config, default_groups, + ) assert result == expected +@pytest.mark.parametrize( + "user_config,default_groups,expected", + [ + ( + # user_config + { + # single index ones should NOT be considered + "param_other_1", "param_else_1", + "param_other_2", "param_else_2", + "param_1", + # multiple index ones should be considered + "param_sam_1_1", "param_frodo_1_1", # param1 1 + "param_sam_1_2", "param_frodo_1_2", # param1 2 + "param_sam_2_1", "param_frodo_2_1", # param2 1 + }, + # default_groups + { + ("param1", "1"): {"sam", "frodo"}, + ("param2", "1"): {"sam", "frodo"}, + }, + # expected counts + { + "param1": 2, + "param2": 1, + }, + ), + ] + ) +def test_read_multiple_idx_groups_user_config_counts( + user_config, + default_groups, + expected, + ): + """Test counts multiple index groups in user config.""" + _, counts = read_multiple_idx_groups_user_config( + user_config, default_groups, + ) + assert counts == expected + + @pytest.mark.parametrize( "user_config,default_groups", [ diff --git a/tests/test_gear_prepare_run.py b/tests/test_gear_prepare_run.py index 3e0a74b6f..92bf59f57 100644 --- a/tests/test_gear_prepare_run.py +++ b/tests/test_gear_prepare_run.py @@ -38,7 +38,7 @@ def fixture_proper_ncs_params() -> dict[str, Union[str, int]]: return { "ncs_on": True, - "numncs": 2, + "nncs": 2, "ncs_sta1_1": 1, "ncs_sta2_1": 1, "ncs_end1_1": 10, @@ -469,7 +469,7 @@ def test_validate_ncs_params_different_end(proper_ncs_params): def test_validate_ncs_params_wrong_count(proper_ncs_params): """Test NCS param error when missmatch in number of ncs defined.""" # Set wrong number of ncs definition - proper_ncs_params["numncs"] = 1 + proper_ncs_params["nncs"] = 1 with pytest.raises(ConfigurationError): assert validate_ncs_params(proper_ncs_params) is None @@ -486,6 +486,6 @@ def test_validate_ncs_params_wrong_suffix_value(proper_ncs_params): proper_ncs_params[k3] = proper_ncs_params[k2] # Delete key2 del proper_ncs_params[k2] - # Except error as _3 != (numncs = 2) + # Except error as _3 != (nncs = 2) with pytest.raises(ConfigurationError): assert validate_ncs_params(proper_ncs_params) is None