schrodinger.seam.yaml.decorators module¶
- class schrodinger.seam.yaml.decorators.SchemadStructureWrapper(ptransform_instance, input_field='structure', output_field='structure')¶
Bases:
PTransformWrapper PTransform for applying non-Schemad PTransforms to Structure objects present in Beam Rows. Expects each input Row to have a
structurefield and yields a new Row with the same fields, withstructurefield containing the modified Structure object.Example usage:
>>> from schrodinger import adapter >>> from schrodinger.application.transforms import filters >>> key = 'i_user_value' >>> structs = [adapter.to_structure(smiles) for smiles in ['C'] * 5] >>> for idx, st in enumerate(structs, start=0): ... st.property[key] = idx >>> rows = [beam.Row(test_str='test', test_int=1, structure=st) for st in structs] >>> with beam.Pipeline() as p: ... filtered = (p ... | beam.Create(rows) ... | SchemadStructureWrapper(filters.StructurePropertyFilter({key: [-5, 2]})) ... | beam.Map(lambda row: row.structure.property[key]))
- ROW_METADATA_FIELD = 's_seam_row_metadata'¶
- __init__(ptransform_instance, input_field='structure', output_field='structure')¶
- expand(pcoll: PCollection)¶