Function _index_search

Source
pub fn _index_search(
    mol_block: &str,
    enumerate_str: &str,
    canonize_str: &str,
    parallel_str: &str,
    memoize_str: &str,
    kernel_str: &str,
    bound_strs: Vec<String>,
) -> PyResult<(u32, u32, usize)>
Expand description

Computes a molecule’s assembly index and related information using a top-down recursive search, parameterized by the specified options.

Python version of index_search.

§Python Parameters

  • mol_block: The contents of a .mol file as a str.
  • enumerate_str: An enumeration mode from ["extend", "grow-erode" (default)]. See EnumerateMode for details.
  • canonize_str: A canonization mode from ["nauty", "faulon", "tree-nauty" (default), "tree-faulon"]. See CanonizeMode for details.
  • parallel_str: A parallelization mode from ["none", "depth-one" (default), "always"]. See ParallelMode for details.
  • memoize_str: A memoization mode from [none, frags-index, canon-index (default)]. See MemoizeMode for details.
  • kernel_str: A kernelization mode from ["none" (default), "once", "depth-one", "always"]. See KernelMode for details.
  • bound_strs: A list of bounds containing zero or more of ["log", "int", "vec-simple", "vec-small-frags", "cover-sort", "cover-no-sort", "clique-budget"]. The default bounds are ["int", "vec-simple", "vec-small-frags"]. See crate::bounds::Bound for details.

§Python Returns

A 3-tuple containing:

  • The molecule’s int assembly index.
  • The molecule’s int number of non-overlapping isomorphic subgraph pairs.
  • The int number of assembly states searched.

§Python Example

import assembly_theory as at

# Load a mol block from file.
with open('data/checks/anthracene.mol') as f:
    mol_block = f.read()

# Calculate the molecule's assembly index using the specified options.
(index, num_matches, states_searched) = at.index_search(
    mol_block,
    "grow-erode",
    "tree-nauty",
    "none",
    "none",
    "none",
    ["int", "vec-simple", "vec-small-frags"])

print(f"Assembly Index: {index}")  # 6
print(f"Non-Overlapping Isomorphic Subgraph Pairs: {num_matches}")  # 466
print(f"Assembly States Searched: {states_searched}")  # 2562