schrodinger.application.transforms.ligprep.duplicate_filter module

Apache Beam transform removing stereochemically-redundant ligprep variants.

A thin Beam adapter around the legacy ligprep3 lp_noredund driver (schrodinger.application.macromodel.packages.ligprep3.lp_noredund._run). Unlike the per-structure ligprep stages, deduplication is a filter over a group: structures are grouped by their root SourceID (all variants derived from the same original input molecule) before the legacy pairwise comparison runs.

class schrodinger.application.transforms.ligprep.duplicate_filter.DuplicateFilter(label: Optional[str] = None)

Bases: PTransform

Remove stereochemically-redundant variants of each input molecule, wrapping the legacy ligprep3 lp_noredund logic.

Variants are grouped by root SourceID (so deduplication is scoped to a single original input, never across distinct molecules), then compared pairwise with mmstereo_cts_equivalent; equivalent structures are collapsed, keeping those marked original (i_lp_orig_ion_str) in preference to generated ones.

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')
...     set_source_id(st, DerivedSourceID(root, 'expand', variant_id=str(i)))
...     variants.append(st)
>>> with beam.Pipeline() as p:
...     kept = (p
...         | beam.Create(variants)
...         | DuplicateFilter())
expand(pcoll) → OutcomePCollections