Skip to content

taps.run.apps.docking

DockingConfig

Bases: AppConfig

Docking application configuration.

add_argument_group() classmethod

add_argument_group(
    parser: ArgumentParser,
    *,
    argv: Sequence[str] | None = None,
    required: bool = True
) -> None

Add model fields as arguments of an argument group on the parser.

Parameters:

  • parser (ArgumentParser) –

    Parser to add a new argument group to.

  • argv (Sequence[str] | None, default: None ) –

    Optional sequence of string arguments.

  • required (bool, default: True ) –

    Mark arguments without defaults as required.

Source code in taps/config.py
@classmethod
def add_argument_group(
    cls,
    parser: argparse.ArgumentParser,
    *,
    argv: Sequence[str] | None = None,
    required: bool = True,
) -> None:
    """Add model fields as arguments of an argument group on the parser.

    Args:
        parser: Parser to add a new argument group to.
        argv: Optional sequence of string arguments.
        required: Mark arguments without defaults as required.
    """
    group = parser.add_argument_group(cls.__name__)
    for field_name, field_info in cls.model_fields.items():
        arg_name = field_name.replace('_', '-').lower()
        group.add_argument(
            f'--{arg_name}',
            dest=field_name,
            # type=field_info.annotation,
            default=field_info.get_default(),
            required=field_info.is_required() and required,
            help=field_info.description,
        )

create_app()

create_app() -> App

Create an application instance from the config.

Source code in taps/run/apps/docking.py
def create_app(self) -> App:
    """Create an application instance from the config."""
    from taps.apps.docking.app import DockingApp

    return DockingApp(
        smi_file_name_ligand_path=pathlib.Path(self.smi_file_name_ligand),
        receptor_path=pathlib.Path(self.receptor),
        tcl_path=pathlib.Path(self.tcl_path),
        initial_simulations=self.initial_simulations,
        num_iterations=self.num_iterations,
        batch_size=self.batch_size,
        seed=self.seed,
    )