Commits

Andrew Dalke committed 153388b

Support fragment output even during threshold code. In that case, skip those input records.

Comments (0)

Files changed (1)

             pat = Chem.MolFromSmarts(mcs.smarts)
         for structure in structures:
             atom_indices = structure.GetSubstructMatch(pat)
+            if not atom_indices:
+                # The only time that a SMARTS shouldn't match an input
+                # structure is if there's a threshold cutoff and this
+                # structure didn't make it.
+                assert args.threshold < 1, "No indices but should have matched everything!"
+                continue
             assert atom_indices
             bond_indices = _get_match_bond_indices(pat, structure, atom_indices)
             subgraph = Subgraph(atom_indices, bond_indices)