pestifer.tasks.merge module

Definition of the MergeTask class for combining two or more pre-built PSF/PDB systems into a single PSF/PDB system.

Usage is described in the merge documentation.

The task uses a two-step VMD/psfgen approach executed in a single script:

  1. Segment renaming (VMD mol load + atomselect): any systems whose segment names collide with earlier systems get their conflicting segments renamed in a temporary copy.

  2. Topology merge (psfgen readpsf): the (possibly renamed) PSF/PDB files are merged by loading them sequentially into psfgen, which handles serial-number renumbering and topology-table reconstruction automatically.

Segment-name collisions are resolved according to collision_strategy:

  • 'enumerate' (default): strip the last character of the conflicting name and append a digit (09, then fall back to two digits) until a unique name is found. E.g. PROAPRO0, PRO1, …

  • 'error': raise ValueError immediately on the first unresolved collision. Use when every rename must be explicit.

Explicit renames take priority over the automatic strategy and are specified per-system via segname_map.

class pestifer.tasks.merge.MergeTask(specs: dict = None, **kwargs)[source]

Bases: PsfgenTask

Merge two or more pre-built PSF/PDB systems into a single PSF/PDB system.

Each system is specified by a psf file plus either a pdb or coor coordinate file. Segment name collisions are detected automatically and resolved according to the collision_strategy.

Parameters (from YAML specs)

pipeline_systemdict, optional

Rename options applied to the pipeline state when it is automatically prepended. Accepted keys: segname_map and chainID_map. Ignored when there is no prior pipeline state.

systemslist of dict

Each entry must contain psf and either pdb or coor. An optional segname_map dict provides explicit renames for that system’s PSF segment names ({old_segname: new_segname}). An optional chainID_map dict renames PDB chain IDs for that system ({old_chainID: new_chainID}).

collision_strategystr, optional

'enumerate' (default) or 'error'.

do() int[source]

Execute the psfgen task. This method initializes the task, ingests the base molecule, and runs the psfgen process. It also handles any necessary coormods and declashing of loops and glycans based on the task specifications. The results of the psfgen process are saved as a PSF/PDB fileset, and the state is updated accordingly.