schrodinger.application.transforms.ligprep module

class schrodinger.application.transforms.ligprep.LigPrepResult(*, source_id: ~schrodinger.seam.io.sourceid.SourceID, input_structure: ~schrodinger.structure._structure.Structure, prepared_structures: list[schrodinger.structure._structure.Structure] = <factory>)

Bases: BaseModel

Result of running LigPrep on a single input structure.

Parameters:
  • source_id – Source ID of the input structure.

  • input_structure – The input structure that was processed.

  • prepared_structures – List of prepared output structures.

source_id: SourceID
input_structure: Structure
prepared_structures: list[Structure]
model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class schrodinger.application.transforms.ligprep.LigPrepConfig(*, use_epik: bool = False, use_epikx: bool = False, epik_metal_binding: bool = False, ionization_level: int | None = None, ph: float | None = None, pht: float | None = None, disable_tautomerizer: bool = False, max_tautomers: int = 8, max_stereo: int = 32, generate_all_stereo: bool = False, use_geometry_stereo: bool = False, force_field: Literal[14, 16] = 14, disable_desalter: bool = False, filter_string: str = '', filter_path: Optional[Path] = None, legacy_infile_path: Optional[Path] = None, legacy_arg_string: str | None = None, error_handling: ErrorHandling | None = None)

Bases: BaseModel

Configuration for LigPrep transforms.

There are two ways to configure this:

  1. Use named fields directly (preferred for new code):

    config = LigPrepConfig(
        use_epik=True,
        max_stereo=32,
        ph=7.4
    )
    
  2. Use legacy_arg_string for backwards compatibility with CLI args:

    config = LigPrepConfig(legacy_arg_string="-epik -s 32 -ph 7.4")
    
  3. Use legacy_infile_path for backwards compatibility with .inp files:

    config = LigPrepConfig(legacy_infile_path=Path("ligprep.inp"))
    

These modes are mutually exclusive - you cannot combine legacy_infile_path, legacy_arg_string, or explicit config fields.

Parameters:
  • use_epik – Use Epik Classic for ionization/tautomerization.

  • use_epikx – Use EpikX for ionization/tautomerization.

  • epik_metal_binding – Generate metal-binding states.

  • ionization_level – Ionization level (0=none, 1=neutralize, 2=neutralize+ionize).

  • ph – Target pH (default 7.0 for Epik, 7.4 for EpikX).

  • pht – pH tolerance.

  • disable_tautomerizer – Disable tautomer generation.

  • max_tautomers – Max tautomers per structure.

  • max_stereo – Max stereoisomers per input.

  • generate_all_stereo – Generate all stereoisomer combinations.

  • use_geometry_stereo – Respect chiralities from input geometry.

  • force_field – OPLS version (14 or 16).

  • disable_desalter – Disable desalter.

  • filter_string – Optional filter string.

  • filter_path – Optional filter file path.

  • legacy_arg_string – Legacy CLI args (mutually exclusive with other fields).

use_epik: bool
use_epikx: bool
epik_metal_binding: bool
ionization_level: int | None
ph: float | None
pht: float | None
disable_tautomerizer: bool
max_tautomers: int
max_stereo: int
generate_all_stereo: bool
use_geometry_stereo: bool
force_field: Literal[14, 16]
disable_desalter: bool
filter_string: str
filter_path: Optional[Path]
legacy_infile_path: Optional[Path]
legacy_arg_string: str | None
error_handling: ErrorHandling | None
model_config: ClassVar[ConfigDict] = {'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

classmethod parseLegacyInfile(data: Any) Any

Parse a LigPrep .inp file into explicit config fields.

If legacy_infile_path is provided, it is read and the resulting values are used to populate the explicit fields. This is mutually exclusive with legacy_arg_string and explicit config fields.

classmethod parseLegacyArgString(data: Any) Any

Parse legacy_arg_string into explicit config fields.

If legacy_arg_string is provided, it is parsed and the resulting values are used to populate the explicit fields. This is mutually exclusive with specifying those fields directly.

validateConfig() Self

Validate mutual exclusivity constraints.

toArgString() str

Convert explicit config fields to CLI argument string.

Returns:

CLI argument string for LigPrep.

class schrodinger.application.transforms.ligprep.RunLigPrepDoFn(config: LigPrepConfig)

Bases: _GetProductsHintsMixin, RunLigPrepDoFn

A DoFn that runs LigPrep on structures and yields LigPrepResult or DroppedRecord.

When used with OutcomeParDo, structures that produce no outputs yield DroppedRecord that is automatically routed to the dropped output. Each prepared structure gets a DerivedSourceID tracking its origin.

Parameters:

config – An instance of LigPrepConfig containing LigPrep settings.

class schrodinger.application.transforms.ligprep.RunLigPrep(**kwargs)

Bases: PTransformWithConfig

A PTransform that runs LigPrep using the OutcomeParDo pattern.

Returns an OutcomePCollections with: - main: PCollection[LigPrepResult] containing prepared structures - dropped: PCollection[DroppedRecord] of structures that produced no output

Example usage:

>>> from schrodinger import adapter
>>> st = adapter.to_structure('c1ccccc1')
>>> st.title = "benzene"
>>> with beam.Pipeline() as p:
...     result = (p
...         | beam.Create([st])
...         | RunLigPrep())
...     # Get LigPrepResults (each contains input + all prepared structures)
...     ligprep_results = result.main
...     # Flatten to individual structures if needed
...     structures = ligprep_results | beam.FlatMap(
...         lambda r: r.prepared_structures)
Parameters:
  • use_epik – Use Epik Classic for ionization/tautomerization.

  • use_epikx – Use EpikX for ionization/tautomerization.

  • max_stereo – Max stereoisomers per input (default 32).

  • filter_string – Optional filter string to pass to ligprep.

  • legacy_arg_string – Legacy CLI args (mutually exclusive with other options).

  • error_handling – Optional error handling configuration.

See LigPrepConfig for all available configuration options.

config_class

alias of LigPrepConfig

class schrodinger.application.transforms.ligprep.PrepareLigands(**kwargs)

Bases: PTransformWithConfig

A PTransform that prepares ligands using LigPrep.

Returns an OutcomePCollections with: - main: PCollection[Structure] of prepared structures (with DerivedSourceIDs) - dropped: PCollection[DroppedRecord] of structures that produced no output

Example usage with explicit fields:

>>> from rdkit import Chem
>>> benzene = Chem.MolFromSmiles('c1ccccc1')
>>> with beam.Pipeline() as p:
...     ligprepped_benzene = (p
...         | beam.Create([benzene])
...         | PrepareLigands(max_stereo=32)
...         | beam.Map(adapter.to_smiles)
...         | beam.LogElements())
c1ccccc1

Example usage with legacy arg string:

>>> from rdkit import Chem
>>> benzene = Chem.MolFromSmiles('c1ccccc1')
>>> with beam.Pipeline() as p:
...     ligprepped_benzene = (p
...         | beam.Create([benzene])
...         | PrepareLigands(legacy_arg_string='-s 32')
...         | beam.Map(adapter.to_smiles)
...         | beam.LogElements())
c1ccccc1
Parameters:
  • use_epik – Use Epik Classic for ionization/tautomerization.

  • use_epikx – Use EpikX for ionization/tautomerization.

  • epik_metal_binding – Generate metal-binding states.

  • ionization_level – Ionization level (0=none, 1=neutralize, 2=neutralize+ionize).

  • ph – Target pH (default 7.0 for Epik, 7.4 for EpikX).

  • pht – pH tolerance.

  • disable_tautomerizer – Disable tautomer generation.

  • max_tautomers – Max tautomers per structure.

  • max_stereo – Max stereoisomers per input.

  • generate_all_stereo – Generate all stereoisomer combinations.

  • use_geometry_stereo – Respect chiralities from input geometry.

  • force_field – OPLS version (14 or 16).

  • disable_desalter – Disable desalter.

  • filter_string – Optional filter string.

  • filter_path – Optional filter file path.

  • legacy_arg_string – Legacy CLI args (mutually exclusive with other fields).

  • error_handling – Optional error handling configuration.

config_class

alias of LigPrepConfig

schrodinger.application.transforms.ligprep.LigPrep

alias of PrepareLigands

schrodinger.application.transforms.ligprep.LigPrepDoFn

alias of RunLigPrepDoFn

schrodinger.application.transforms.ligprep.validate_opls_license(arg_string: str) None

Check if the FFLD_OPLS_MAIN license is available if a opls version > 14 is specified in the command line arguments.

Parameters:

arg_string – command line arguments to pass to ligprep,

schrodinger.application.transforms.ligprep.remove_bff(arg_string: str) str

Remove the -bff argument from the command line arguments.

Parameters:

arg_string – command line arguments to pass to ligprep,

Returns:

the command line arguments without the -bff argument.

schrodinger.application.transforms.ligprep.validate_arg_string(arg_string: str)