4.9. ligandparam.stages.abstractstage

class ligandparam.stages.abstractstage.AbstractStage(stage_name: str, main_input: Path | str, cwd: Path | str, *args, **kwargs)[source]

Bases: object

Abstract base class for all stages.

Parameters:
  • stage_name (str) – The name of the stage.

  • main_input (Union[Path, str]) – The main input file for the stage.

  • cwd (Union[Path, str]) – The current working directory for the stage.

stage_name

The name of the stage.

Type:

str

main_input

The main input file for the stage.

Type:

Path

cwd

The current working directory for the stage.

Type:

Path

required

A list of required files for the stage.

Type:

list

logger

The logger instance for the stage.

Type:

logging.Logger

nproc

The number of processors to use.

Type:

int

mem

The amount of memory to use (in GB).

Type:

int

dry_run

Whether to execute the stage in dry-run mode.

Type:

bool

Methods

add_required(filename)

Add a required file to the stage.

append_stage(stage)

Append a stage to the current stage.

clean()

Clean up the stage.

execute([dry_run, nproc, mem])

Execute the stage.

list_files_in_directory(directory)

List all the files in a directory.

Initialize the AbstractStage.

Parameters:
  • stage_name (str) – The name of the stage.

  • main_input (Union[Path, str]) – The main input file for the stage.

  • cwd (Union[Path, str]) – The current working directory for the stage.

Methods

add_required(filename)

Add a required file to the stage.

append_stage(stage)

Append a stage to the current stage.

clean()

Clean up the stage.

execute([dry_run, nproc, mem])

Execute the stage.

list_files_in_directory(directory)

List all the files in a directory.

add_required(filename: Path | str)[source]

Add a required file to the stage.

Parameters:

filename (str) – The file to add to the required list.

append_stage(stage: AbstractStage) AbstractStage[source]

Append a stage to the current stage.

Parameters:

stage (AbstractStage) – The stage to append.

Returns:

The appended stage.

Return type:

AbstractStage

clean() None[source]

Clean up the stage.

This method performs any necessary cleanup after the stage has been executed.

execute(dry_run=False, nproc: int | None = None, mem: int | None = None) Any[source]

Execute the stage.

Parameters:
  • dry_run (bool, optional) – Whether to execute in dry-run mode (default is False).

  • nproc (int, optional) – The number of processors to use (default is None).

  • mem (int, optional) – The amount of memory to use (in GB, default is None).

Returns:

The result of the execution.

Return type:

Any

list_files_in_directory(directory)[source]

List all the files in a directory.

Parameters:

directory (str) – The directory to list the files from.

Returns:

A list of file names in the directory.

Return type:

list of str