besmarts.core.chem module¶
besmarts.core.chem
The standard definition of a binary encoded SMARTS component of a graph. All nodes and edges have a bechem object embedded within. These define the molecular information contained in the graph.
- class besmarts.core.chem.bechem(primitives, select)[source]¶
Bases:
objectRepresents a group of atom or bond SMARTS primitives in a graph
- primitives: Dict[primitive_key, bitvec]¶
- select: Sequence[primitive_key]¶
- besmarts.core.chem.bechem_align_score(bc: bechem, o: bechem) int[source]¶
Return the number of overlapping bits
- besmarts.core.chem.bechem_bits(bc: bechem, maxbits=False, return_all=False) int[source]¶
Return the number of bits across all selected primitives
- besmarts.core.chem.bechem_bits_max(bc: bechem, return_all=False) int[source]¶
Return the number of bits across all selected primitives
- besmarts.core.chem.bechem_check_sane_compare(bc: bechem, o: bechem) bool[source]¶
Check if it is sane to perform an operation against another object
- Raises:
Exception –
- besmarts.core.chem.bechem_copy(bc: bechem) bechem[source]¶
Return a copy of bc. :returns: cls – The new chem_type object :rtype: type(cls)
- besmarts.core.chem.bechem_disable(bc: bechem, field: primitive_key) bool[source]¶
Deselect a currently enabled primitive
- Parameters:
field (primitive_key)
The primitive to disable
- Returns:
Whether the operation was successful
- Return type:
bool
- besmarts.core.chem.bechem_dispatch_op(bc: bechem, o: bechem, fn) bechem[source]¶
Broadcast an operation across primitives.
- besmarts.core.chem.bechem_enable(bc: bechem, field: primitive_key) bool[source]¶
Select a currently disabled primitive
- Parameters:
field (primitive_key)
The primitive to enable
- Returns:
Whether the primitive was successfully enabled and the selection has been modified
- Return type:
bool
- besmarts.core.chem.bechem_is_fragment(bc: bechem) bool[source]¶
Returns whether the SMARTS has exclusively single values per primitive.
- besmarts.core.chem.bechem_is_null(bc: bechem) bool[source]¶
Returns whether any primitive has no values set.
- Return type:
bool
- besmarts.core.chem.bechem_is_valid(bc: bechem) bool[source]¶
Returns whether all primitives have at least one value set, i.e. it can be encoded into valid SMARTS
- Return type:
bool
- besmarts.core.chem.bechem_iter(bc: bechem, skip_ones=False, iter_inverse=False, primitives=None) Generator[bechem, None, None][source]¶
Generate a copy for every bit across all selected primitives
- besmarts.core.chem.bechem_recurse_fields(bc: bechem, fields: dict, pos=None) Generator[Dict, None, None][source]¶
Generate all fragments given the set primitives
- besmarts.core.chem.bechem_reduce(bc: bechem) int[source]¶
Get the sum/number of bits across all selected primitives
- besmarts.core.chem.bechem_reduce_longest(bc: bechem, o: bechem) Tuple[int, int][source]¶
Get the number of bits using another instance to pad if necessary