Function Repository Resource:

MoleculeRingPattern

Source Notebook

Provide a molecule pattern for a ring of a given size or composition

Contributed by: Jason Biggs

ResourceFunction["MoleculeRingPattern"][n]

returns a molecule pattern representing an n-membered ring.

ResourceFunction["MoleculeRingPattern"][{a1,a2,}]

returns a molecule pattern with the atoms ai arranged in a ring.

Details and Options

ResourceFunction["MoleculeRingPattern"] will return a MoleculePattern object with explicit atoms and bonds listed.

Examples

Basic Examples (2) 

Find the positions of all 5-membered rings in adenosine:

In[1]:=
FindMoleculeSubstructure[Molecule["adenosine"], ResourceFunction["MoleculeRingPattern"][5], All]
Out[1]=

Find and highlight 5-membered and 6-membered rings together:

In[2]:=
MoleculePlot[Molecule["adenosine"],
 <|"5\[Dash]membered rings" -> ResourceFunction["MoleculeRingPattern"][5], "6\[Dash]membered rings" -> ResourceFunction["MoleculeRingPattern"][6]|>]
Out[2]=

Create a pattern for a 6-membered ring containing at least one oxygen atom:

In[3]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/621ad086-ea1d-4660-83a3-5aee578a535a"]
Out[3]=

Scope (3) 

Test for the existence of a pattern with MoleculeContainsQ:

In[4]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/b5644aac-ae7d-4ec2-9218-4ad03169ce0c"]
Out[4]=

Use FindMoleculeSubstructure to find the indices for a pattern inside a molecule:

In[5]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/a8762655-cfb0-46dc-bc0d-bb7e8b72c853"]
Out[5]=

Use a ring pattern in a substructure replacement:

In[6]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/a4fbe79b-1692-48a0-aa4d-467c9507ed6d"]
Out[6]=
In[7]:=
MoleculePlot@%
Out[7]=

Applications (1) 

Search through a list for molecules matching a particular pattern. Start with a list of 25 molecules:

In[8]:=
Select[Molecule /@ {"O=C1ON=NN2N1C(=O)N=CC2=O", "o1cnc2ncoc12", "O=C1OC(=O)N2SC(=O)C(=O)OC2=N1", "O=C1SN=Cc2nnccc12", "O=C1OC2=NC=NC(=O)N2S1", "O=C1SC=CN2NN=NNN12", "O=C1SC2=C(SC1=O)C(=O)C=CN2", "N1C=CSC2=NSN=NN12", "o1nc2nc[nH]c2n1", "O=C1NN2N(SC1=O)C=NC(=O)C2=O", "O=C1SN2N=CC(=O)C(=O)N2C=N1", "O=C1OC(=O)N2C(=O)SC=C2S1", "O1C=COC2=NSC=NN12", "O=C1NC2=C(S1)C=NNC2=O", "O=C1SC=C2SC=CC(=O)C2=N1", "O=C1OC=NN2SC=NSN12", "O=C1ON2N(NC(=O)C(=O)C2=O)N=C1", "O=C1SN=C2C=CC=CN12", "O=C1C=NNN2N1C(=O)C=NC2=O", "c1nncc2nnnnc12", "O=C1C=CSc2scnc12", "O=C1N=NN2C=CC=NN2C1=O", "O=C1C=NSc2c[nH]nc12", "O=C1OC(=O)C(=O)N2NC(=O)C(=O)ON12", "O=C1NC2=C(N1)N=NC(=O)O2"}, MoleculeContainsQ[
  pattern = ResourceFunction[
    "MoleculeRingPattern"][{"N", Except["N" | "O"], "O", Except["N" | "O"], Except["N" | "O"]}]]
 ]
Out[8]=
In[9]:=
MoleculePlot[#, pattern] & /@ %
Out[9]=

Publisher

JasonB

Version History

  • 2.0.0 – 29 April 2020
  • 1.0.0 – 08 April 2020

License Information