Commits

Anonymous committed 7fc872f

Removed "ignore aromaticity" options because it doesn't work.
Matches must be transitive. Otherwise, an aromatic can match a
single and can match a double, even if a single can't match a
double. This makes the MCS dependent on what is used as the
reference structure.

  • Participants
  • Parent commits 9f39b23

Comments (0)

Files changed (2)

     return ["~"] * len(bonds)
 
 
-# Match atoms based on element (not aromaticity)
-# Match bonds with the following rules:
-#   - single bonds can match single or aromatic bonds
-#   : aromatic bonds can match single, aromatic, or double bonds
-#   = double bonds can match aromatic or double bonds
-#   # triple bonds only ever match triple bonds
-
-def bond_typer_ignore_aromaticity(bonds):
-    bond_smarts_types = []
-    for bond in bonds:
-        bond_term = bond.GetSmarts()
-        if bond_term == "#":
-            # Triple bonds are unaffected by aromaticity
-            pass
-        else:
-            if not bond_term:
-                # The SMILES "", means "single or aromatic" as SMARTS.
-                # Figure out which one.
-                if bond.GetIsAromatic():
-                    # Aromatic can match single, aromatic, or double
-                    bond_term = '-,:,='
-                else:
-                    # Single can match single or aromatic
-                    bond_term = '-,:'
-            elif bond_term == '-':
-                # Single can match single or aromatic
-                bond_term = '-,:'
-            elif bond_term == '=':
-                # Double bond can match aromatic or double
-                bond_term = ':,='
-            else:
-                raise AssertionError("Unknown bond term %r" % (bond_term,))
-
-        bond_smarts_types.append(bond_term)
-    return bond_smarts_types
-    
-    
-
 # Match bonds based on bond type, including aromaticity
 
 def bond_typer_bondtypes(bonds):
 
 bond_typers = {
     "any": bond_typer_any,
-    "ignore-aromaticity": bond_typer_ignore_aromaticity,
     "bondtypes": bond_typer_bondtypes,
     }
 default_atom_typer = atom_typers[Default.atom_compare]
                         "implement user-defined atom typing. "
                         "(Default: elements)"))
 
-parser.add_argument("--bond-compare", choices=["any", "ignore-aromaticity", "bondtypes"],
+parser.add_argument("--bond-compare", choices=["any", "bondtypes"],
                     default="bondtypes", help=(
                         "Specify the bond comparison method. With 'any', every bond matches every "
-                        "other bond. With 'ignore-aromaticity', aromatic bonds match single, aromatic, "
-                        "and double bonds, but no other types match each other. With 'bondtypes', bonds "
-                        "are the same only if their bond type is the same. (Default: bondtypes)"))
+                        "other bond. With 'bondtypes', bonds are the same only if their bond types "
+                        "are the same. (Default: bondtypes)"))
 
 compare_shortcuts = {
     "topology": ("any", "any"),
     "elements": ("elements", "any"),
-    "ignore-aromaticity": ("elements", "ignore-aromaticity"),
     "types": ("elements", "bondtypes"),
     }
 class CompareAction(argparse.Action):
         namespace.atom_compare = atom_compare_name
         namespace.bond_compare = bond_compare_name
 
-parser.add_argument("--compare", choices = ["topology", "elements", "ignore-aromaticity", "types"],
+parser.add_argument("--compare", choices = ["topology", "elements", "types"],
                     default=None, action=CompareAction, help=
                     "Use 'topology' as a shorthand for '--atom-compare any --bond-compare any', "
                     "'elements' is '--atom-compare elements --bond-compare any', "
-                    "'ignore-aromaticity' is '--atom-compare elements --bond-compare ignore-aromaticity', "
                     "and 'types' is '--atom-compare elements --bond-compare bondtypes' "
                     "(Default: types)")
 

File tests/test_commandline.py

     def test_bond_compare_bondtypes(self):
         # Repeat of the previous
         confirm("bondtypes.smi --bond-compare bondtypes", 6, 5) 
-    def test_bond_compare_ignore_aromaticity(self):
-        # Match the phenol-like 6-atom carbon ring + oxygen
-        confirm("bondtypes.smi --bond-compare ignore-aromaticity", 7, 7) 
-    def test_atom_compare_any_bond_compare_ignore_aromaticity(self):
-        # Match the phenol-like 6-atom carbon ring + oxygen
-        confirm("bondtypes.smi --atom-compare any --bond-compare ignore-aromaticity", 8, 8) 
     def test_bond_compare_any(self):
         # the CC#CC chain matches the CCCC tail
         confirm("bondtypes.smi --bond-compare any", 10, 9)
         confirm("bondtypes.smi --compare topology", 18, 18)
     def test_compare_elements(self):
         confirm("bondtypes.smi --compare elements", 10, 9)
-    def test_compare_ignore_aromaticity(self):
-        confirm("bondtypes.smi --compare ignore-aromaticity", 7, 7)
     def test_compare_types(self):
         confirm("bondtypes.smi --compare types", 6, 5)