libcns: creating CNS files
CNS scripts util functions.
- haddock.libs.libcns.filter_empty_vars(v: Any) bool [source]
Filter empty variables.
See: https://github.com/haddocking/haddock3/issues/162
- Returns:
bool – Returns True if the variable is not empty, and False if the variable is empty. That is, False reflects those variables that should not be written in CNS.
- Raises:
TypeError – If the type of value is not supported by CNS.
- haddock.libs.libcns.generate_default_header(path: str | Path | None = None) tuple[str, str, str, str, str, str] [source]
Generate CNS default header.
- haddock.libs.libcns.load_ambig(value: Any, eval_line: str = 'eval (${}={})') str
Write the CNS eval line depending on the type of value.
- haddock.libs.libcns.load_axis(*, param_header: str = '\n! Axis\n', **params: Any) str
Write the values at the header section.
“Empty variables” are ignored. These are defined accoring to
filter_empty_vars()
.- Parameters:
params (dict) – Dictionary containing the key:value pairs for the parameters to be written to CNS. Values cannot be of dictionary type.
- Returns:
str – The string with the CNS parameters defined.
- haddock.libs.libcns.load_dihe(value: Any, eval_line: str = 'eval (${}={})') str
Write the CNS eval line depending on the type of value.
- haddock.libs.libcns.load_hbond(value: Any, eval_line: str = 'eval (${}={})') str
Write the CNS eval line depending on the type of value.
- haddock.libs.libcns.load_tensor(*, param_header: str = '\n! Tensors\n', **params: Any) str
Write the values at the header section.
“Empty variables” are ignored. These are defined accoring to
filter_empty_vars()
.- Parameters:
params (dict) – Dictionary containing the key:value pairs for the parameters to be written to CNS. Values cannot be of dictionary type.
- Returns:
str – The string with the CNS parameters defined.
- haddock.libs.libcns.load_tensor_tbl(value: Any, eval_line: str = 'eval (${}={})') str
Write the CNS eval line depending on the type of value.
- haddock.libs.libcns.load_trans_vectors(*, param_header: str = '\n! Translation vectors\n', **params: Any) str
Write the values at the header section.
“Empty variables” are ignored. These are defined accoring to
filter_empty_vars()
.- Parameters:
params (dict) – Dictionary containing the key:value pairs for the parameters to be written to CNS. Values cannot be of dictionary type.
- Returns:
str – The string with the CNS parameters defined.
- haddock.libs.libcns.load_unambig(value: Any, eval_line: str = 'eval (${}={})') str
Write the CNS eval line depending on the type of value.
- haddock.libs.libcns.load_workflow_params(param_header: str = '\n! Parameters\n', **params: Any) str [source]
Write the values at the header section.
“Empty variables” are ignored. These are defined accoring to
filter_empty_vars()
.- Parameters:
params (dict) – Dictionary containing the key:value pairs for the parameters to be written to CNS. Values cannot be of dictionary type.
- Returns:
str – The string with the CNS parameters defined.
- haddock.libs.libcns.prepare_cns_input(model_number: int, input_element: PDBFile | list[PDBFile], step_path: str | Path, recipe_str: str, defaults: Any, identifier: str, ambig_fname: str | Path = '', native_segid: bool = False, default_params_path: Path | None = None, debug: bool | None = False, seed: int | None = None) Path | str [source]
Generate the .inp file needed by the CNS engine.
- Parameters:
model_number (int) – The number of the model. Will be used as file name suffix.
input_element (libs.libontology.Persisten, list of those)
- haddock.libs.libcns.prepare_expected_pdb(model_obj: PDBFile | tuple[PDBFile, ...], model_nb: int, path: str | Path, identifier: str) PDBFile [source]
Prepare a PDBobject.
- haddock.libs.libcns.prepare_multiple_input(pdb_input_list: list[str], psf_input_list: list[str]) str [source]
Prepare multiple input files.
- haddock.libs.libcns.prepare_output(*, param_header: str = '\n! Output structure\n', **params: Any) str
Write the values at the header section.
“Empty variables” are ignored. These are defined accoring to
filter_empty_vars()
.- Parameters:
params (dict) – Dictionary containing the key:value pairs for the parameters to be written to CNS. Values cannot be of dictionary type.
- Returns:
str – The string with the CNS parameters defined.