restraintmaker.interface_Pymol.pymol_utilities package

Submodules

restraintmaker.interface_Pymol.pymol_utilities.program_states module

class restraintmaker.interface_Pymol.pymol_utilities.program_states.ActionState[source]

Bases: object

ActionState defines the different states the possible actions (filter, optimize etc.) can be in

ALWAYS_DISABLED = 4
ALWAYS_ENABLED = 2
CURRENTLY_DISABLED = 1
CURRENTLY_ENABLED = 3
class restraintmaker.interface_Pymol.pymol_utilities.program_states.EventType(value)[source]

Bases: enum.Enum

EventType defines the different events that a selection can deal with

CONFIRM = 'confirm'
MOVE = 'move'
SELECT = 'select'
SIZE = 'size'

restraintmaker.interface_Pymol.pymol_utilities.pymol_utitlities module

contains functions that are useful to the restraintmaker_PyMOL module, but do not need to be within the Distance_restraints class This also includes functions that are only usefull for debugging and testing

restraintmaker.interface_Pymol.pymol_utilities.pymol_utitlities._atom_list_to_pymol_selection(atom_list: List[restraintmaker.utils.Utilities.Atom]) str[source]

atom_list_to_pymol_selection converts a List of Atoms to a string that pymool can understand. @warning Pymol can only handle a string with a length of ca 1000. (ca 200 atoms.) Consider using help_pymol_with_big_atoms_List

Parameters

atom_list (t.List[u.Atom]) – A List of Atoms

Returns

A interface_Pymol selection expression, containing all those Atoms

Return type

str

restraintmaker.interface_Pymol.pymol_utilities.pymol_utitlities._convert_molecules_to_pdb() List[str][source]
convert_molecules_to_pdb gives a list containing one pdb string for each molecule

@Warnings atoms willbeassigned different IDS than they currently have in interface_Pymol!!!!!

Returns

List of pdb string for each molecule in interface_Pymol

Return type

t.List[str]

restraintmaker.interface_Pymol.pymol_utilities.pymol_utitlities.colorize(atoms)[source]

sets the pymol colors - FOOLING AROUND :) colorize_atoms: Some tests for different ways of colouring atoms.

When using the predefinied names (e.g. “gray”) PyMol raises a Quiet Error. With this method I can test, that Pymol does accept the different colour numbering schemes (s for spectrum, c for complementary etc.) :Parameters: atoms (Atoms)

restraintmaker.interface_Pymol.pymol_utilities.pymol_utitlities.create_pymol_objects_for_molecules(exclude: List[str] = [])[source]

creates separate selecetions for all molecules in interface_Pymol

TODO; WRITE THE NAME OF THE MOLECULE IN TO THE ATOM SOMEHOW TODO: make more stable if protein is present!

Parameters

exclude (t.List[str]) – A list of molecules that should not be considered, e.g. ‘solv;, ‘protein’, etc

Returns

The list of the molecule object names

Return type

t.List[u.Atom]

restraintmaker.interface_Pymol.pymol_utilities.pymol_utitlities.help_pymol_with_big_atom_list(pymol_function: Callable, atom_list: List[restraintmaker.utils.Utilities.Atom], *args, **kw_args)[source]

help_pymol_with_big_atom_list can be wrapped around any interface_Pymol function, that takes ‘selection’ as an argument.

help_pymol_with_big_atom_list will call pymol_function several times with small enough parts of the list

Parameters
  • pymol_function (t.Callable) – Any funciton from one of the interface_Pymol modules, who takes ‘selection’ as an argument

  • atom_list (t.List[u.Atom]) – A list of atoms

  • args (list) – arguments for the interface_Pymol function

  • kw_args (dict) – keyword argument for the interface_Pymol functiom

Returns

a list of all return values of the seperate calls

Return type

t.List

Raises

ValueError – if interface_Pymol function is not passed the correct arguments

restraintmaker.interface_Pymol.pymol_utilities.pymol_utitlities.pymol_selection_to_atom_list(sele: str) List[restraintmaker.utils.Utilities.Atom][source]

converts a interface_Pymol selection and returns a list of restraintmaker_Logic.utilities.Atom

Parameters

sele (str) – pymol selection string

Returns

A list of Atoms

Return type

t.List[u.Atom]

restraintmaker.interface_Pymol.pymol_utilities.pymol_utitlities.try_to_get_args(my_x, input_function) bool[source]

wrapper function for get_args. Takes care of the error handling

Parameters
  • my_x (_Importer,_Restraint,_Selection,_Filter,_Optimzer or _Exporter) – An Object that should call get args

  • input_function (t.Callable[str]) – The input_function argument of get_args

Returns

Could get_args be executed without errors?

Return type

bool

restraintmaker.interface_Pymol.pymol_utilities.qt_dialogs module

restraintmaker.interface_Pymol.pymol_utilities.qt_dialogs.create_file_open_dialog()[source]

create_file_dialog returns a function which: Opens a pyQt5 file Dialog with the speciefed message. In this format it can be provided to the get_args functions

Returns

Returns a function, that opens an input dialog, with the specified title, and is centered at the interface_Pymol window.

Return type

t.Callable[str,[str])

restraintmaker.interface_Pymol.pymol_utilities.qt_dialogs.create_file_save_dialog()[source]

create_file_dialog returns a function which: Opens a pyQt5 file Dialog with the speciefed message. In this format it can be provided to the get_args functions

Returns

Returns a function, that opens an input dialog, with the specified title, and is centered at the interface_Pymol window.

Return type

t.Callable[str,[str]]

restraintmaker.interface_Pymol.pymol_utilities.qt_dialogs.create_input_dialog(parent_window, title: str) Callable[[str], str][source]

create_input_dialog returns a function which:

Opens a pyQt5 input Dialog with the speciefed message. In this format it can be provided to the get_args functions

Parameters
  • parent_window – parent QT window of the sub dialog

  • title (str) – dialog title

Returns

Returns a function, that opens an input dialog, with the specified title, and is centered at the interface_Pymol window.

Return type

t.Callable[str,[str])

restraintmaker.interface_Pymol.pymol_utilities.qt_dialogs.create_multi_dialog(title, inputs: List[str], options: Dict[str, List[str]] = {}, default: Dict = {}) Callable[[str], List[str]][source]

create_multi_dialog return

TODO get_args: I am not happpy with the create_multi_dialog solution: Now we have to ‘prepare’ the input function in set_x_type by checking what x(optimizer, filter…) type we want to create.

The initial idea was that input_function is passed to get_args, which can then call it as needed, without having to know the format of its arguments We have to choose either:1) input function returns exactly one str. if more inputs are required, input fkt is called several times. => Does not allow to ask for all in one dialog

or :2) Abolish get_args. Each type has a list required_args. the logic handler will read that list and then get them all from the user. The Optimizer?Filter… then only has to check the type

Warning

Do not call before the constructor o f the Pymol module has finished, or pyumol will hate you.

Warning

Will not throw an error if close button is pressed. Just return an enmpty list

Parameters

title (str) – Title of theDialog

:param inputs; all inputs that should be asked for :type inputs: t.List[str] :param options: optional, specifies the options an input can have. (input as key, list of acceptable values as values) :type options: t.dict[str,t.List[str]] :param default: Specifies the options an input can have. (input as key, list of acceptable values as value0 :type default: t.dict[str,t.Any] :return: A function which will open a dialog, asking for the inputs specified in inputs :rtype: t.Callable[[str],t.List[str or t.List[str]]]

Module contents