diff --git a/CAT/attachment/ligand_anchoring.py b/CAT/attachment/ligand_anchoring.py index b627a5ae..4698adb7 100644 --- a/CAT/attachment/ligand_anchoring.py +++ b/CAT/attachment/ligand_anchoring.py @@ -59,7 +59,7 @@ def init_ligand_anchoring(ligand_df: SettingsDataFrame) -> SettingsDataFrame: # Unpack arguments settings = ligand_df.settings.optional split = settings.ligand.split - functional_groups = settings.ligand.functional_groups + functional_groups = settings.ligand.anchor # Find all functional groups; return a copy of each mol for each functional group mol_list = [] diff --git a/CAT/base.py b/CAT/base.py index b1143b96..7d2db9f8 100644 --- a/CAT/base.py +++ b/CAT/base.py @@ -114,7 +114,7 @@ def prep(arg: Settings, return_mol: bool = True ligand_df, core_df, qd_df = prep_input(arg) if qd_df is None: - # Adds the indices of the core dummy atoms to core.properties.core + # Adds the indices of the core anchor atoms to core.properties.core core_df = prep_core(core_df) # Optimize the ligands, find functional groups, calculate properties @@ -194,7 +194,7 @@ def prep_input(arg: Settings) -> Tuple[SettingsDataFrame, SettingsDataFrame, Set # TODO: Move this function to its own module; this is a workflow and NOT a workflow manager def prep_core(core_df: SettingsDataFrame) -> SettingsDataFrame: - """Function that handles the identification and marking of all core dummy atoms. + """Function that handles the identification and marking of all core anchor atoms. Parameters ---------- @@ -204,21 +204,21 @@ def prep_core(core_df: SettingsDataFrame) -> SettingsDataFrame: Returns ------- |CAT.SettingsDataFrame|_ - A dataframe of cores with all dummy/anchor atoms removed. + A dataframe of cores with all anchor atoms removed. """ # Unpack arguments - dummy = core_df.settings.optional.core.dummy + anchor = core_df.settings.optional.core.anchor subset = core_df.settings.optional.core.subset idx_tuples = [] for core in core_df[MOL]: - # Checks the if the dummy is a string (atomic symbol) or integer (atomic number) + # Checks the if the anchor is a string (atomic symbol) or integer (atomic number) formula = core.get_formula() - # Returns the indices of all dummy atom ligand placeholders in the core + # Returns the indices of all anchor atom ligand placeholders in the core if not core.properties.dummies: - at_idx = np.array([i for i, atom in enumerate(core) if atom.atnum == dummy]) + at_idx = np.array([i for i, atom in enumerate(core) if atom.atnum == anchor]) else: dummies = core.properties.dummies at_idx = np.fromiter(dummies, count=len(dummies), dtype=int) @@ -231,13 +231,13 @@ def prep_core(core_df: SettingsDataFrame) -> SettingsDataFrame: at_idx.sort() core.properties.dummies = dummies = [core[i] for i in at_idx] - # Returns an error if no dummy atoms were found + # Returns an error if no anchor atoms were found if not dummies: - raise MoleculeError(f"{repr(to_symbol(dummy))} was specified as core dummy atom, yet " + raise MoleculeError(f"{repr(to_symbol(anchor))} was specified as core anchor atom, yet " f"no matching atoms were found in {core.properties.name} " f"(formula: {formula})") - # Delete all core dummy atoms + # Delete all core anchor atoms for at in dummies: core.delete_atom(at) idx_tuples.append( diff --git a/CAT/data_handling/validate_input.py b/CAT/data_handling/validate_input.py index 7005c76d..57bee9f4 100644 --- a/CAT/data_handling/validate_input.py +++ b/CAT/data_handling/validate_input.py @@ -51,17 +51,22 @@ def _validate_multi_lig(s: Settings) -> None: """Check that one (and only one!) of ``'f'`` and ``'dummy'`` is specified.""" f = s.optional.qd.multi_ligand.f - dummy = s.optional.qd.multi_ligand.dummy - if f is dummy is None: - raise ValueError("'.multi_ligand.f' and '.multi_ligand.dummy' cannot be " + anchor = s.optional.qd.multi_ligand.anchor + if anchor is None: + anchor = s.optional.qd.multi_ligand.dummy + s.optional.qd.multi_ligand.anchor = anchor + del s.optional.qd.multi_ligand.dummy + + if f is anchor is None: + raise ValueError("'.multi_ligand.f' and '.multi_ligand.anchor' cannot be " "both unspecified or set to 'None'") - elif None not in (f, dummy): - raise ValueError("Only one of '.multi_ligand.f' and '.multi_ligand.dummy' " + elif None not in (f, anchor): + raise ValueError("Only one of '.multi_ligand.f' and '.multi_ligand.anchor' " "should be specified") - if dummy is not None: - assert len(dummy) == len(s.optional.qd.multi_ligand.ligands) + if anchor is not None: + assert len(anchor) == len(s.optional.qd.multi_ligand.ligands) else: assert len(f) == len(s.optional.qd.multi_ligand.ligands) - 1 @@ -97,6 +102,7 @@ def validate_input(s: Settings) -> None: # Validate some of the more complex optionala rguments if s.optional.database.mongodb: s.optional.database.mongodb = mongodb_schema.validate(s.optional.database.mongodb) + if s.optional.core.subset: s.optional.core.subset = subset_schema.validate(s.optional.core.subset) if 'p' in s.optional.core.subset: @@ -105,6 +111,11 @@ def validate_input(s: Settings) -> None: logger.warn("The 'subset.p' parameter is deprecated; see 'subset.weight'") p = s.optional.core.subset.pop('p') s.optional.core.subset.weight = lambda x: -(x**p) + if s.optional.core.anchor is not None: + s.optional.core.anchor = 17 + elif s.optional.core.dummy is not None: + s.optional.core.anchor = s.optional.core.dummy + del s.optional.core.dummy if s.optional.ligand.optimize: s.optional.ligand.optimize = ligand_opt_schema.validate(s.optional.ligand.optimize) @@ -143,8 +154,14 @@ def validate_input(s: Settings) -> None: s.optional.database.db = False # Create RDKit molecules representing functional groups - func_groups, split = s.optional.ligand.functional_groups, s.optional.ligand.split - if not func_groups: - s.optional.ligand.functional_groups = get_functional_groups(None, split) + if s.optional.ligand.anchor is not None: + func_groups = s.optional.ligand.anchor + else: + func_groups = s.optional.ligand.functional_groups + del s.optional.ligand.functional_groups + + split = s.optional.ligand.split + if func_groups is None: + s.optional.ligand.anchor = get_functional_groups(None, split) else: - s.optional.ligand.functional_groups = get_functional_groups(func_groups) + s.optional.ligand.anchor = get_functional_groups(func_groups) diff --git a/CAT/data_handling/validation_schemas.py b/CAT/data_handling/validation_schemas.py index 5d8c0731..497f3e21 100644 --- a/CAT/data_handling/validation_schemas.py +++ b/CAT/data_handling/validation_schemas.py @@ -285,13 +285,23 @@ def _get_crsjob() -> type: 'dirname': And(str, error='optional.core.dirname expects a string'), - Optional_('dummy', default=17): # Return a tuple of atomic numbers + # Alias for `optional.core.anchor` + Optional_('dummy', default=None): # Return a tuple of atomic numbers Or( + None, And(val_int, Use(lambda n: to_atnum(int(n)))), And(str, Use(to_atnum)), error='optional.core.dummy expects a valid atomic number (int) or symbol (string)' ), + Optional_('anchor', default=None): # Return a tuple of atomic numbers + Or( + None, + And(val_int, Use(lambda n: to_atnum(int(n)))), + And(str, Use(to_atnum)), + error='optional.core.anchor expects a valid atomic number (int) or symbol (string)' + ), + Optional_('subset', default=None): Or(None, dict, error="optional.core.subset epected 'None' or a dictionary"), @@ -445,6 +455,22 @@ def _get_crsjob() -> type: 'dirname': And(str, error='optional.ligand.dirname expects a string'), + Optional_('anchor', default=None): + Or( + None, + And(str, Use(lambda n: (n,))), + And( + abc.Collection, + lambda n: all(isinstance(i, str) for i in n), + lambda n: len(n) == len(set(n)), + Use(to_tuple), + error='optional.ligand.anchor expects a list of unique SMILES strings' + ), + error=('optional.ligand.anchor expects None (NoneType), a SMILES string, ' + 'or a list of unique SMILES string') + ), + + # Alias for `optional.ligand.anchor` Optional_('functional_groups', default=None): Or( None, @@ -913,6 +939,16 @@ def _get_crsjob() -> type: Use(tuple) ), + Optional_('anchor', default=None): + Or( + None, + And(abc.Collection, + lambda n: not isinstance(n, str), + lambda n: len(set(n)) == len(n), + Use(lambda n: to_tuple(n, func=to_atnum))) + ), + + # Alias for `optional.qd.multi_ligand.anchor` Optional_('dummy', default=None): Or( None, diff --git a/CAT/multi_ligand.py b/CAT/multi_ligand.py index 17c99fbe..5ac5a456 100755 --- a/CAT/multi_ligand.py +++ b/CAT/multi_ligand.py @@ -26,12 +26,12 @@ def init_multi_ligand(qd_df): """Initialize the multi-ligand attachment procedure.""" workflow = WorkFlow.from_template(qd_df, name='multi_ligand') - if workflow.dummy is not None: - sequence = [to_symbol(i) for i in workflow.dummy] + if workflow.anchor is not None: + sequence = [to_symbol(i) for i in workflow.anchor] elif workflow.f is not None: sequence = [str(i) for i in workflow.f] else: - raise TypeError("'workflow.f' and 'workflow.dummy' cannot be both 'None'") + raise TypeError("'workflow.f' and 'workflow.anchor' cannot be both 'None'") columns_iter1 = ('/'.join(item for item in sequence[:i]) for i in range(1, 1+len(sequence))) columns_iter2 = (('multi ligand', i) for i in columns_iter1) @@ -50,15 +50,15 @@ def init_multi_ligand(qd_df): @overload def multi_lig(qd_series: pd.Series, ligands: Iterable[str], - dummy: Sequence[Union[str, int]], f: None, + anchor: Sequence[Union[str, int]], f: None, **kwargs: Any) -> pd.DataFrame: ... @overload # noqa: E302 def multi_lig(qd_series: pd.Series, ligands: Iterable[str], - dummy: None, f: Sequence[float], + anchor: None, f: Sequence[float], **kwargs: Any) -> pd.DataFrame: ... -def multi_lig(qd_series, ligands, dummy=None, f=None, **kwargs): # noqa: E302 +def multi_lig(qd_series, ligands, anchor=None, f=None, **kwargs): # noqa: E302 """Attach multiple non-unique **ligands** to each qd in **qd_series**.""" # Read and parse the SMILES strings ligands = smiles_to_lig(list(ligands), @@ -75,21 +75,21 @@ def multi_lig(qd_series, ligands, dummy=None, f=None, **kwargs): # noqa: E302 if f is not None: raise NotImplementedError("'f != None' is not yet implemented") - if dummy is not None: - return _multi_lig_dummy(qd_series, ligands, kwargs['path'], dummy, kwargs['allignment']) + if anchor is not None: + return _multi_lig_anchor(qd_series, ligands, kwargs['path'], anchor, kwargs['allignment']) elif f is not None: return [[NotImplemented]] else: - raise TypeError("'f' and 'dummy' cannot be both 'None'") + raise TypeError("'f' and 'anchor' cannot be both 'None'") -def _multi_lig_dummy(qd_series, ligands, path, dummy, allignment) -> np.ndarray: +def _multi_lig_anchor(qd_series, ligands, path, anchor, allignment) -> np.ndarray: """Gogogo.""" ret = np.empty((len(ligands), len(qd_series)), dtype=object) for i, qd in enumerate(qd_series): qd = qd.copy() - for j, (ligand, atnum) in enumerate(zip(ligands, dummy)): + for j, (ligand, atnum) in enumerate(zip(ligands, anchor)): try: atoms = [at for at in qd if at.atnum == atnum] assert atoms diff --git a/CAT/workflows/workflow_yaml.yaml b/CAT/workflows/workflow_yaml.yaml index 6569317b..992f13bf 100644 --- a/CAT/workflows/workflow_yaml.yaml +++ b/CAT/workflows/workflow_yaml.yaml @@ -149,10 +149,10 @@ multi_ligand: allignment: [optional, core, allignment] opt: [optional, ligand, optimize] split: [optional, ligand, split] - functional_groups: [optional, ligand, functional_groups] + functional_groups: [optional, ligand, anchor] ligands: [optional, qd, multi_ligand, ligands] - dummy: [optional, qd, multi_ligand, dummy] + anchor: [optional, qd, multi_ligand, anchor] f: [optional, qd, multi_ligand, f] mode: [optional, qd, multi_ligand, uniform] start: [optional, qd, multi_ligand, start] diff --git a/docs/13_multi_ligand.rst b/docs/13_multi_ligand.rst index 39740eae..5356d326 100644 --- a/docs/13_multi_ligand.rst +++ b/docs/13_multi_ligand.rst @@ -19,7 +19,7 @@ Multi-ligand attachment - OCCC - OCCCCCCC - OCCCCCCCCCCCC - dummy: + anchor: - F - Br - I @@ -39,19 +39,21 @@ Multi-ligand attachment This argument has no value be default and must thus be provided by the user. - .. attribute:: optional.qd.multi_ligand.dummy + .. attribute:: optional.qd.multi_ligand.anchor :Parameter: * **Type** - :class:`list` [:class:`str` or :class:`int`] - Atomic number of symbol of the core dummy atoms. + Atomic number of symbol of the core anchor atoms. - The first dummy atom will be assigned to the first ligand in - :attr:`multi_ligand.ligands`, the second dummy atom + The first anchor atom will be assigned to the first ligand in + :attr:`multi_ligand.ligands`, the second anchor atom to the second ligand, *etc.*. The list's length should consequently be of the same length as :attr:`multi_ligand.ligands`. - Works analogous to :attr:`optional.core.dummy`. + Works analogous to :attr:`optional.core.anchor`. + + This optiona can alternatively be provided as ``optional.qd.multi_ligand.dummy``. .. note:: This argument has no value be default and must thus be provided by the user. diff --git a/docs/1_get_started.rst b/docs/1_get_started.rst index b72eb01c..d68bf47f 100644 --- a/docs/1_get_started.rst +++ b/docs/1_get_started.rst @@ -67,14 +67,14 @@ Verbose default Settings core: dirname: core - dummy: Cl + anchor: Cl subset: null ligand: dirname: ligand optimize: True split: True - functional_groups: null + anchor: null cosmo-rs: False qd: @@ -112,13 +112,13 @@ Maximum verbose default Settings core: dirname: core - dummy: Cl + anchor: Cl subset: null ligand: dirname: ligand split: True - functional_groups: null + anchor: null cosmo-rs: False optimize: use_ff: False diff --git a/docs/4_optional.rst b/docs/4_optional.rst index 3dea640e..89cbdff7 100644 --- a/docs/4_optional.rst +++ b/docs/4_optional.rst @@ -25,13 +25,13 @@ Option Description :attr:`optional.database.mongodb` Options related to the MongoDB format. :attr:`optional.core.dirname` The name of the directory where all cores will be stored. -:attr:`optional.core.dummy` Atomic number of symbol of the core dummy atoms. +:attr:`optional.core.anchor` Atomic number of symbol of the core anchor atoms. :attr:`optional.core.allignment` How the to-be attached ligands should be alligned with the core. -:attr:`optional.core.subset` Settings related to the partial replacement of core dummy atoms. +:attr:`optional.core.subset` Settings related to the partial replacement of core anchor atoms. :attr:`optional.ligand.dirname` The name of the directory where all ligands will be stored. :attr:`optional.ligand.optimize` Optimize the geometry of the to-be attached ligands. -:attr:`optional.ligand.functional_groups` Manually specify SMILES strings representing functional groups. +:attr:`optional.ligand.anchor` Manually specify SMILES strings representing functional groups. :attr:`optional.ligand.split` If the ligand should be attached in its entirety to the core or not. :attr:`optional.ligand.cosmo-rs` Perform a property calculation with COSMO-RS on the ligand. :attr:`optional.ligand.cdft` Perform a conceptual DFT calculation with ADF on the ligand. @@ -62,14 +62,14 @@ Default Settings core: dirname: core - dummy: Cl + anchor: Cl allignment: sphere subset: null ligand: dirname: ligand optimize: True - functional_groups: null + anchor: null split: True cosmo-rs: False cdft: False @@ -236,7 +236,7 @@ Core optional: core: dirname: core - dummy: Cl + anchor: Cl allignment: sphere subset: null @@ -253,17 +253,19 @@ Core at the path specified in :ref:`Path`. - .. attribute:: optional.core.dummy + .. attribute:: optional.core.anchor :Parameter: * **Type** - :class:`str` or :class:`int` * **Default value** – ``17`` - Atomic number of symbol of the core dummy atoms. + Atomic number of symbol of the core anchor atoms. The atomic number or atomic symbol of the atoms in the core which are to be - replaced with ligands. Alternatively, dummy atoms can be manually specified + replaced with ligands. Alternatively, anchor atoms can be manually specified with the core_indices variable. + This optiona can alternatively be provided as ``optional.core.dummy``. + .. attribute:: optional.core.allignment @@ -296,7 +298,7 @@ Core :Parameter: * **Type** - :class:`dict`, optional * **Default value** – ``None`` - Settings related to the partial replacement of core dummy atoms with ligands. + Settings related to the partial replacement of core anchor atoms with ligands. If not ``None``, has access to six further keywords, the first two being the most important: @@ -313,7 +315,7 @@ Core :Parameter: * **Type** - :class:`float` - The fraction of core dummy atoms that will actually be exchanged for ligands. + The fraction of core anchor atoms that will actually be exchanged for ligands. The provided value should satisfy the following condition: :math:`0 < f \le 1`. @@ -326,24 +328,24 @@ Core :Parameter: * **Type** - :class:`str` * **Default value** – ``"uniform"`` - Defines how the dummy atom subset, whose size is defined by the fraction :math:`f`, will be generated. + Defines how the anchor atom subset, whose size is defined by the fraction :math:`f`, will be generated. Accepts one of the following values: * ``"uniform"``: A uniform distribution; the nearest-neighbor distances between each - successive dummy atom and all previous dummy atoms is maximized. + successive anchor atom and all previous anchor atoms is maximized. can be combined with :attr:`subset.cluster_size` to create a uniform distribution of clusters of a user-specified size. * ``"cluster"``: A clustered distribution; the nearest-neighbor distances between each - successive dummy atom and all previous dummy atoms is minimized. + successive anchor atom and all previous anchor atoms is minimized. * ``"random"``: A random distribution. It should be noted that all three methods converge towards the same set as :math:`f` approaches :math:`1.0`. If :math:`\boldsymbol{D} \in \mathbb{R}_{+}^{n,n}` is the (symmetric) distance matrix constructed - from the dummy atom superset and :math:`\boldsymbol{a} \in \mathbb{N}^{m}` is the vector - of indices which yields the dummy atom subset. The definition of element :math:`a_{i}` + from the anchor atom superset and :math:`\boldsymbol{a} \in \mathbb{N}^{m}` is the vector + of indices which yields the anchor atom subset. The definition of element :math:`a_{i}` is defined below for the ``"uniform"`` distribution. All elements of :math:`\boldsymbol{a}` are furthermore constrained to be unique. @@ -396,7 +398,7 @@ Core :Parameter: * **Type** - :class:`bool` * **Default value** – ``False`` - Construct the dummy atom distance matrix by following the shortest path along the + Construct the anchor atom distance matrix by following the shortest path along the edges of a (triangular-faced) polyhedral approximation of the core rather than the shortest path through space. @@ -519,7 +521,7 @@ Core :Parameter: * **Type** - :class:`float`, optional * **Default value** – ``None`` - The probability that each new core dummy atom will be picked at random. + The probability that each new core anchor atom will be picked at random. Can be used in combination with ``"uniform"`` and ``"cluster"`` to introduce a certain degree of randomness (*i.e.* entropy). @@ -557,7 +559,7 @@ Ligand ligand: dirname: ligand optimize: True - functional_groups: null + anchor: null split: True cosmo-rs: False cdft: False @@ -603,14 +605,14 @@ Ligand job2: ADFJob - .. attribute:: optional.ligand.functional_groups + .. attribute:: optional.ligand.anchor :Parameter: * **Type** - :class:`str` or :class:`tuple` [:class:`str`] * **Default value** – ``None`` Manually specify SMILES strings representing functional groups. - For example, with :attr:`optional.ligand.functional_groups` = ``("O[H]", "[N+].[Cl-]")`` all + For example, with :attr:`optional.ligand.anchor` = ``("O[H]", "[N+].[Cl-]")`` all ligands will be searched for the presence of hydroxides and ammonium chlorides. The first atom in each SMILES string (*i.e.* the "anchor") will be used for attaching the ligand @@ -619,6 +621,8 @@ Ligand If not specified, the default functional groups of **CAT** are used. + This optiona can alternatively be provided as ``optional.ligand.functional_groups``. + .. note:: This argument has no value be default and will thus default to SMILES strings of the default functional groups supported by **CAT**. diff --git a/tests/test_files/CAT.yaml b/tests/test_files/CAT.yaml index a9dca14d..bd8fac3e 100644 --- a/tests/test_files/CAT.yaml +++ b/tests/test_files/CAT.yaml @@ -18,7 +18,7 @@ optional: core: dirname: core - dummy: Cl + anchor: Cl ligand: dirname: ligand diff --git a/tests/test_files/CAT_indices.yaml b/tests/test_files/CAT_indices.yaml index 68e4b34b..f624bbbf 100644 --- a/tests/test_files/CAT_indices.yaml +++ b/tests/test_files/CAT_indices.yaml @@ -14,7 +14,7 @@ input_ligands: optional: core: dirname: core - dummy: Cl + anchor: Cl ligand: dirname: ligand diff --git a/tests/test_files/input2.yaml b/tests/test_files/input2.yaml index 59575243..ce4aad91 100644 --- a/tests/test_files/input2.yaml +++ b/tests/test_files/input2.yaml @@ -29,14 +29,14 @@ optional: core: dirname: core - dummy: Cl + anchor: Cl ligand: dirname: ligand optimize: True split: False cosmo-rs: False - functional_groups: [N, P, O, S] + anchor: [N, P, O, S] qd: dirname: QD diff --git a/tests/test_files/input3.yaml b/tests/test_files/input3.yaml index fb7ce1d3..bd5f0f90 100644 --- a/tests/test_files/input3.yaml +++ b/tests/test_files/input3.yaml @@ -14,7 +14,7 @@ optional: mol_format: [pdb] core: - dummy: Cl + anchor: Cl ligand: optimize: True @@ -26,6 +26,6 @@ optional: ligands: - OCCCCCCCCCCCCC - OC - dummy: + anchor: - Br - I diff --git a/tests/test_files/input4.yaml b/tests/test_files/input4.yaml index 3b7450c6..4d653c73 100644 --- a/tests/test_files/input4.yaml +++ b/tests/test_files/input4.yaml @@ -20,7 +20,7 @@ optional: core: dirname: core - dummy: Cl + anchor: Cl ligand: dirname: ligand diff --git a/tests/test_schemas.py b/tests/test_schemas.py index 4b16a3aa..196c13e2 100644 --- a/tests/test_schemas.py +++ b/tests/test_schemas.py @@ -121,6 +121,7 @@ def test_ligand_schema() -> None: lig_dict = {'dirname': '.'} ref = { 'dirname': '.', + 'anchor': None, 'functional_groups': None, 'optimize': {'job1': None}, 'split': True, @@ -147,13 +148,13 @@ def test_ligand_schema() -> None: lig_dict['cosmo-rs'] = True assertion.eq(ligand_schema.validate(lig_dict)['cosmo-rs'], {'job1': 'AMSJob'}) - lig_dict['functional_groups'] = 1 # Exception: incorrect type + lig_dict['anchor'] = 1 # Exception: incorrect type assertion.assert_(ligand_schema.validate, lig_dict, exception=SchemaError) - lig_dict['functional_groups'] = 'CO' - assertion.eq(ligand_schema.validate(lig_dict)['functional_groups'], ('CO',)) - lig_dict['functional_groups'] = ['CO'] - assertion.eq(ligand_schema.validate(lig_dict)['functional_groups'], ('CO',)) - lig_dict['functional_groups'] = ['CO', 'CO'] # Exception: duplicate elements + lig_dict['anchor'] = 'CO' + assertion.eq(ligand_schema.validate(lig_dict)['anchor'], ('CO',)) + lig_dict['anchor'] = ['CO'] + assertion.eq(ligand_schema.validate(lig_dict)['anchor'], ('CO',)) + lig_dict['anchor'] = ['CO', 'CO'] # Exception: duplicate elements assertion.assert_(ligand_schema.validate, lig_dict, exception=SchemaError) @@ -162,21 +163,22 @@ def test_core_schema() -> None: core_dict = {'dirname': '.'} ref = { 'dirname': '.', - 'dummy': 17, + 'anchor': None, + 'dummy': None, 'allignment': 'sphere', 'subset': None } assertion.eq(core_schema.validate(core_dict), ref) - core_dict['dummy'] = 1.1 # Exception: incorrect value + core_dict['anchor'] = 1.1 # Exception: incorrect value assertion.assert_(core_schema.validate, core_dict, exception=SchemaError) - core_dict['dummy'] = 'H' - assertion.eq(core_schema.validate(core_dict)['dummy'], 1) - core_dict['dummy'] = 1 - assertion.eq(core_schema.validate(core_dict)['dummy'], 1) - core_dict['dummy'] = 1.0 - assertion.eq(core_schema.validate(core_dict)['dummy'], 1) + core_dict['anchor'] = 'H' + assertion.eq(core_schema.validate(core_dict)['anchor'], 1) + core_dict['anchor'] = 1 + assertion.eq(core_schema.validate(core_dict)['anchor'], 1) + core_dict['anchor'] = 1.0 + assertion.eq(core_schema.validate(core_dict)['anchor'], 1) core_dict['allignment'] = 1.1 # Exception: incorrect type assertion.assert_(core_schema.validate, core_dict, exception=SchemaError) diff --git a/tests/test_validate_input.py b/tests/test_validate_input.py index 7f15c1f5..44f7a91b 100644 --- a/tests/test_validate_input.py +++ b/tests/test_validate_input.py @@ -34,7 +34,7 @@ def test_validate_input() -> None: ref = Settings() ref.core.dirname = join(PATH, 'core') - ref.core.dummy = 17 + ref.core.anchor = 17 ref.core.allignment = 'sphere' ref.core.subset = None @@ -64,7 +64,7 @@ def test_validate_input() -> None: ref.forcefield = Settings() - func_groups = s.optional.ligand.pop('functional_groups') + func_groups = s.optional.ligand.pop('anchor') try: for mol in func_groups: