schrodinger.application.transforms.ligprep.stereo_filter module

Apache Beam transform pruning high-energy, topologically-redundant stereoisomers.

A thin Beam adapter around the legacy ligprep3 filterstereo driver (schrodinger.application.macromodel.packages.ligprep3.filterstereo._filter_structures).

class schrodinger.application.transforms.ligprep.stereo_filter.StereoFilterConfig(*, max_stereo: int = 32)

Bases: BaseModel

Configuration for the stereoisomer filter.

The max_stereo default matches the legacy ligprep workflow’s n_stereo fallback, not the standalone CLI default of 4.

max_stereo: int
model_config: ClassVar[ConfigDict] = {}

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

class schrodinger.application.transforms.ligprep.stereo_filter.StereoFilter(*, _config: pydantic.main.BaseModel | None = None, **kwargs)

Bases: PTransformWithConfig

Prune high-energy and topologically-redundant stereoisomers of each input molecule, wrapping the legacy ligprep3 filterstereo logic.

Variants are grouped by root SourceID (so filtering is scoped to a single original input), collapsed by topology, and within each topology the lowest-energy stereoisomers are kept, up to max_stereo. Each structure must carry an energy property (r_lp_Energy or an OPLS potential energy), so this stage must run after CGX.

See StereoFilterConfig for the available parameters.

Example usage:

>>> from schrodinger import adapter
>>> import apache_beam as beam
>>> from schrodinger.seam.io.sourceid import DerivedSourceID
>>> from schrodinger.seam.io.sourceid import StructureSourceID
>>> from schrodinger.seam.io.sourceid import set_source_id
>>> root = StructureSourceID('mol1')
>>> variants = []
>>> for i in range(2):
...     st = adapter.to_structure('CCO')
...     st.property['r_lp_Energy'] = float(i)
...     set_source_id(st, DerivedSourceID(root, 'expand', variant_id=str(i)))
...     variants.append(st)
>>> with beam.Pipeline() as p:
...     kept = (p
...         | beam.Create(variants)
...         | StereoFilter())
config_class

alias of StereoFilterConfig

expand(pcoll) → OutcomePCollections