chemaxon.search.molsearch

class SearchType(enum.Enum):
SUBSTRUCTURE = <SearchType.SUBSTRUCTURE: 2>
DUPLICATE = <SearchType.DUPLICATE: 5>
mol_search_constant
class SearchHit:

Search hit result object.

Attributes

hit_indexes: list[int] List of atom indexes in the target molecule that were matched by the query molecule. colored_mol: Molecule | None Colored target molecule showing the matched atoms and bonds. None if return_colored_hit was False

SearchHit( cresult: chemaxon.search.molsearch._CSearchHitWithExceptionData, return_colored_hit: bool)
hit_indexes: list[int]
colored_mol: chemaxon.molecule.Molecule | None
@dataclass()
class MoleculeSearch:

Search object to perform molecule searches.

Attributes

search_type: SearchType The type of search to be performed. Default is SearchType.SUBSTRUCTURE. standardizer: str The configuration string of the standardizer to be applied before the search, or the Standardizer object. Default is general aromatization, if None or empty string is provided, no standardization will be applied.

MoleculeSearch( search_type: SearchType = <SearchType.SUBSTRUCTURE: 2>, standardizer: str | chemaxon.standardizer.standardizer.Standardizer = 'aromatize:g')
search_type: SearchType
def find_hit( self, query_mol: chemaxon.molecule.Molecule, target_mol: chemaxon.molecule.Molecule, return_colored_hit=False) -> SearchHit | None:

Molecule searching.

Returns search hit object containing data about the query target match.

Parameters

query_mol: Molecule The Molecule to match target_mol: Molecule The target Molecule to witch the query_mol is being matched return_colored_hit: bool If true, hit atoms and bonds are colored in the target molecule. Default is False. Returns

Search hit, or None if there was no match.

def find_hits_in_list( self, query_mol: chemaxon.molecule.Molecule, target_mol_list: list[chemaxon.molecule.Molecule], return_colored_hit: bool = False) -> list[SearchHit]:

Molecule searching in list.

Get a list of SearchHits or None(s).

Parameters
  • query_mol: Molecule - The Molecule to search with
  • target_mol_list: list[Molecule] - The list of Molecules to match against (find hits in these molecules)
  • return_colored_hit: bool - If true, hit atoms and bonds are colored in the target molecule. Default is False.
Raises
  • RuntimeError: - In case of exception (unrecoverable errors) the function will exit and stop the searching.
Returns

list[Molecule] - List of SearchHit (s) in the same order as the input list of targets (target_mol_list). if no hit was found on a given target, None is returned on the corresponding index.