diff --git a/modules/conop/doc/connectivity.rst b/modules/conop/doc/connectivity.rst index 636b8a7104a967b8a17d56039cdd4a4862f6bb13..8686790cc2398668466b08abc2d30cd004ba326c 100644 --- a/modules/conop/doc/connectivity.rst +++ b/modules/conop/doc/connectivity.rst @@ -40,76 +40,112 @@ Processors -------------------------------------------------------------------------------- The exact behaviour for a processor is implementation-specific. So far, two -classes implement the processor interface: A heuristic and a rule-based processor. -The processor mainly differ in the source of their connectivity information. The -Heuristicprocessor uses a hard-coded heuristic connectivity table for the 20 -standard amino acids as well as nucleotides.For other compounds such as ligands -the HeuristicProcessor runs a distance-based connectivity algorithm that connects -two atoms if they are closer than a certain threshold. The RuleBasedProcessor -uses a connectivity library containing all molecular components present in the -PDB files on PDB.org. The library can easily be extended with custom -connectivity information, if required. If a :doc:`compound library <compoundlib>` is -present, the :class:`RuleBasedProcessor` is enabled by default, otherwise the +classes implement the processor interface: A heuristic and a rule-based +processor. The processor mainly differ in the source of their connectivity +information. The Heuristicprocessor uses a hard-coded heuristic connectivity +table for the 20 standard amino acids as well as nucleotides.For other +compounds such as ligands the HeuristicProcessor runs a distance-based +connectivity algorithm that connects two atoms if they are closer than a certain +threshold. The RuleBasedProcessor uses a connectivity library containing all +molecular components present in the PDB files on PDB.org. The library can easily +be extended with custom connectivity information, if required. If a +:doc:`compound library <compoundlib>` is present, the +:class:`RuleBasedProcessor` is enabled by default, otherwise the :class:`HeuristicProcessor` is used as a fallback. -The Processor base class -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - .. class:: Processor - .. attribute:: connect + .. attribute:: check_bond_feasibility - Whether to connect atoms by bonds. Enabled by default. This also sets the - :attr:`~ost.mol.ResidueHandle.is_protein` property of residues when peptide - bonds are created. Turn this off if you would like to speed up the loading - process and do not require connectivity information to be present in your - structures. + Whether an additional bond feasibility check is performed. Disabled by + default. If turned on, atoms are only connected by bonds if they are within + a reasonable distance (as defined by :func:`IsBondFeasible`). :type: :class:`bool` - .. attribute:: zero_occ_treatment + .. attribute:: assign_torsions - Controls the behaviour of importing atoms with zero occupancy. By default, this - is set to silent. + Whether backbone torsions should be added to the backbone. Enabled by + default. If turned on, PHI, PSI and OMEGA torsions are assigned to the + peptide residues. See also :func:`AssignBackboneTorsions`. - :type: :class:`str` + :type: :class:`bool` - .. attribute:: check_bond_feasibility + .. attribute:: connect - Whether an additional bond feasibility check is performed. Disabled by default. - Turn this on, if you would like to connect atoms by bonds only if they are - within a reasonable distance. - See also :func:`IsBondFeasible`. + Whether to connect atoms by bonds. Enabled by default. Turn this off if you + would like to speed up the loading process and do not require connectivity + information to be present in your structures. Note though that + :attr:`peptide_bonds` may be ignored if this is turned off. :type: :class:`bool` - .. attribute:: assign_torsions + .. attribute:: peptide_bonds - Whether backbone torsions should be added to the backbone. Disabled by default. - Set to true, to assign PHI, PSI and OMEGA torsions to the peptide residues. - See also :func:`AssignBackboneTorsions`. + Whether to connect residues by peptide bonds. Enabled by default. This also + sets the :attr:`~ost.mol.ResidueHandle.is_protein` property of residues when + peptide bonds are created. Turn this off if you would like to create your + own peptide bonds. :type: :class:`bool` + .. attribute:: zero_occ_treatment + + Controls the behaviour of importing atoms with zero occupancy. By default, + this is set to warn. + + :type: :class:`ConopAction` .. method:: Process(ent) Processess the entity *ent* according to the current options. -The RuleBasedProcessor class -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. class:: HeuristicProcessor(check_bond_feasibility=False, \ + assign_torsions=True, connect=True, \ + peptide_bonds=True, zero_occ_treatment=CONOP_WARN) + + The :class:`HeuristicProcessor` implements the :class:`Processor` interface. + Refer to its documentation for methods and accessors common to all processor. + + :param check_bond_feasibility: Sets :attr:`~Processor.check_bond_feasibility` + :param assign_torsions: Sets :attr:`~Processor.assign_torsions` + :param connect: Sets :attr:`~Processor.connect` + :param peptide_bonds: Sets :attr:`~Processor.peptide_bonds` + :param zero_occ_treatment: Sets :attr:`~Processor.zero_occ_treatment` + + +.. class:: RuleBasedProcessor(compound_lib, fix_elements=True, \ + strict_hydrogens=False, \ + unknown_res_treatment=CONOP_WARN, \ + unknown_atom_treatment=CONOP_WARN, \ + check_bond_feasibility=False, \ + assign_torsions=True, connect=True, \ + peptide_bonds=True, zero_occ_treatment=CONOP_WARN) + + The :class:`RuleBasedProcessor` implements the :class:`Processor` interface. + Refer to its documentation for methods and accessors common to all processor. + + :param compound_lib: The compound library to use + :type compound_lib: :class:`CompoundLib` + :param fix_elements: Sets :attr:`fix_elements` + :param strict_hydrogens: Sets :attr:`strict_hydrogens` + :param unknown_res_treatment: Sets :attr:`unk_atom_treatment` + :param unknown_atom_treatment: Sets :attr:`unk_res_treatment` + :param check_bond_feasibility: Sets :attr:`~Processor.check_bond_feasibility` + :param assign_torsions: Sets :attr:`~Processor.assign_torsions` + :param connect: Sets :attr:`~Processor.connect` + :param peptide_bonds: Sets :attr:`~Processor.peptide_bonds` + :param zero_occ_treatment: Sets :attr:`~Processor.zero_occ_treatment` -.. class:: RuleBasedProcessor(compound_lib) + .. attribute:: fix_elements - :param compound_lib: The compound library - :type compound_lib: :class:`CompoundLib` - - The :class:`RuleBasedProcessor` implements the :class:`Processor` interface. - Refer to its documentation for methods and accessors common to all processor. + Whether the element of the atom should be changed to the atom defined in the + compound library. Enabled by default. + + :type: :class:`bool` - .. attribute:: strict_hydrogens Whether to use strict hydrogen naming rules outlined in the compound library. @@ -119,22 +155,21 @@ The RuleBasedProcessor class .. attribute:: unk_atom_treatment - Treatment upon encountering an unknown atom. Default: 'warn'. - + Treatment upon encountering an unknown atom. Warn by default. - :type: :class:`str` + :type: :class:`ConopAction` .. attribute:: unk_res_treatment - Treatment upon encountering an unknown residue - - :type: :class:`str` + Treatment upon encountering an unknown residue. Warn by default. - .. attribute:: fix_elements + :type: :class:`ConopAction` - Whether the element of the atom should be changed to the atom defined in the - compound library. Enabled by default. - :type: :class:`bool` +.. class:: ConopAction + Defines actions to take when certain events happen during processing. Possible + values: + ``CONOP_WARN``, ``CONOP_SILENT``, ``CONOP_REMOVE``, ``CONOP_REMOVE_ATOM``, + ``CONOP_REMOVE_RESIDUE``, ``CONOP_FATAL`` diff --git a/modules/conop/pymod/export_processor.cc b/modules/conop/pymod/export_processor.cc index 1f9a74281a7587c68d43ee32c321a7a90ef597b5..37e4d8bfcdffccfd569216b4d6085231ab9c486d 100644 --- a/modules/conop/pymod/export_processor.cc +++ b/modules/conop/pymod/export_processor.cc @@ -80,10 +80,14 @@ void export_processor() { .add_property("check_bond_feasibility", &Processor::GetCheckBondFeasibility, &Processor::SetCheckBondFeasibility) - .add_property("connect", &Processor::GetConnect, - &Processor::SetConnect) .add_property("assign_torsions", &Processor::GetAssignTorsions, - &Processor::SetAssignTorsions) + &Processor::SetAssignTorsions) + .add_property("connect", &Processor::GetConnect, + &Processor::SetConnect) + .add_property("peptide_bonds", &Processor::GetConnectAminoAcids, + &Processor::SetConnectAminoAcids) + .add_property("zero_occ_treatment", &Processor::GetZeroOccTreatment, + &Processor::SetZeroOccTreatment) .def("Process", &Processor::Process, (arg("ent"), arg("log_diags")=true)) ;