schrodinger.seam.coders module¶
- exception schrodinger.seam.coders.UnserializableMolError¶
Bases:
Exception
- class schrodinger.seam.coders.MolToSmilesCoder¶
Bases:
apache_beam.coders.coders.Coder
- encode(mol: rdkit.Chem.rdchem.Mol) bytes ¶
Encodes the given object into a byte string.
- decode(smiles_bytes: bytes) rdkit.Chem.rdchem.Mol ¶
Decodes the given byte string into the corresponding object.
- is_deterministic()¶
Whether this coder is guaranteed to encode values deterministically.
A deterministic coder is required for key coders in GroupByKey operations to produce consistent results.
For example, note that the default coder, the PickleCoder, is not deterministic: the ordering of picked entries in maps may vary across executions since there is no defined order, and such a coder is not in general suitable for usage as a key coder in GroupByKey operations, since each instance of the same key may be encoded differently.
- Returns:
Whether coder is deterministic.
- estimate_size(mol: rdkit.Chem.rdchem.Mol) int ¶
Estimates the encoded size of the given value, in bytes.
Dataflow estimates the encoded size of a PCollection processed in a pipeline step by using the estimated size of a random sample of elements in that PCollection.
The default implementation encodes the given value and returns its byte size. If a coder can provide a fast estimate of the encoded size of a value (e.g., if the encoding has a fixed size), it can provide its estimate here to improve performance.
- Arguments:
value: the value whose encoded size is to be estimated.
- Returns:
The estimated encoded size of the given value.
- to_type_hint() type ¶
- class schrodinger.seam.coders.SafeMolToSmilesCoder¶
Bases:
schrodinger.seam.coders.MolToSmilesCoder
Encodes and decodes Mol’s to and from SMILES strings similar to
MolToSmilesCoder
. However, this coder will raise an exception if the molecule is not sanitizable.“Sanitizable” in this context is defined as a smiles that will return
None
when passed toChem.MolFromSmiles
(which by default attempts to sanitize the molecule). This is not as fast asMolToSmilesCoder
because of the additional check, but will- encode(mol: rdkit.Chem.rdchem.Mol) bytes ¶
Encodes the given object into a byte string.
- class schrodinger.seam.coders.StructureCoder¶
Bases:
apache_beam.coders.coders.Coder
- encode(st: schrodinger.structure._structure.Structure) bytes ¶
Encodes the given object into a byte string.
- decode(mae_bytes: bytes) schrodinger.structure._structure.Structure ¶
Decodes the given byte string into the corresponding object.
- is_deterministic()¶
Whether this coder is guaranteed to encode values deterministically.
A deterministic coder is required for key coders in GroupByKey operations to produce consistent results.
For example, note that the default coder, the PickleCoder, is not deterministic: the ordering of picked entries in maps may vary across executions since there is no defined order, and such a coder is not in general suitable for usage as a key coder in GroupByKey operations, since each instance of the same key may be encoded differently.
- Returns:
Whether coder is deterministic.
- to_type_hint() type ¶
- class schrodinger.seam.coders.RouteNodeCoder¶
Bases:
apache_beam.coders.coders.Coder
- encode(route_node: schrodinger.application.pathfinder.route.RouteNode) bytes ¶
Encodes the given object into a byte string.
- decode(route_node_bytes: bytes) schrodinger.application.pathfinder.route.RouteNode ¶
Decodes the given byte string into the corresponding object.
- is_deterministic()¶
Whether this coder is guaranteed to encode values deterministically.
A deterministic coder is required for key coders in GroupByKey operations to produce consistent results.
For example, note that the default coder, the PickleCoder, is not deterministic: the ordering of picked entries in maps may vary across executions since there is no defined order, and such a coder is not in general suitable for usage as a key coder in GroupByKey operations, since each instance of the same key may be encoded differently.
- Returns:
Whether coder is deterministic.
- to_type_hint() type ¶