Created
February 14, 2017 09:50
-
-
Save johnmay/4dca331011c6b04fc29c0c53eed862fe to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SmilesParser smipar = new SmilesParser(SilentChemObjectBuilder.getInstance()); | |
String smi = "*CCO*"; | |
IAtomContainer mol = smipar.parseSmiles(smi); | |
Sgroup sgrp = new Sgroup(); | |
sgrp.addAtom(mol.getAtom(1)); | |
sgrp.addAtom(mol.getAtom(2)); | |
sgrp.addAtom(mol.getAtom(3)); | |
sgrp.addBond(mol.getBond(0)); // bond crossing bracket (xbond) | |
sgrp.addBond(mol.getBond(3)); // bond crossing bracket (xbond) | |
sgrp.setType(SgroupType.CtabStructureRepeatUnit); | |
sgrp.setSubscript("n"); | |
sgrp.putValue(SgroupKey.CtabConnectivity, "ht"); | |
mol.setProperty(CDKConstants.CTAB_SGROUPS, Collections.singletonList(sgrp)); | |
SmilesGenerator smigen = new SmilesGenerator(SmiFlavor.CxSmiles); | |
String cxsmi = smigen.create(mol); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment