Skip to content

Instantly share code, notes, and snippets.

@johnmay
Last active January 27, 2017 13:54
Show Gist options
  • Select an option

  • Save johnmay/f46d739cb5f0e1868e52e0a70052cf8f to your computer and use it in GitHub Desktop.

Select an option

Save johnmay/f46d739cb5f0e1868e52e0a70052cf8f to your computer and use it in GitHub Desktop.
public static void main(String[] args) throws CDKException, IOException {
String rxnfile = "$RXN\n"
+ "\n"
+ "\n"
+ "\n"
+ " 2 1 0\n"
+ "$MOL\n"
+ "\n"
+ " Ketcher 01271718382D 1 1.00000 0.00000 0\n"
+ "\n"
+ " 1 0 0 0 0 999 V2000\n"
+ " 0.0000 0.0000 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0\n"
+ "M END\n"
+ "$MOL\n"
+ "\n"
+ " Ketcher 01271718382D 1 1.00000 0.00000 0\n"
+ "\n"
+ " 1 0 0 0 0 999 V2000\n"
+ " 2.0000 0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n"
+ "M STY 1 1 DAT\n"
+ "M SLB 1 1 1\n"
+ "M SAL 1 1 1\n"
+ "M SDT 1 reaction sample filed name F \n"
+ "M SDD 1 3.2750 -1.1625 DA ALL 1 1 \n"
+ "M SED 1 reaction sample field value\n"
+ "M END\n"
+ "$MOL\n"
+ "\n"
+ " Ketcher 01271718382D 1 1.00000 0.00000 0\n"
+ "\n"
+ " 1 0 0 0 0 999 V2000\n"
+ " 8.0000 0.0000 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0\n"
+ "M END\n";
MDLRXNV2000Reader rxnr = new MDLRXNV2000Reader(new StringReader(rxnfile));
IReaction rxn = rxnr.read(new Reaction());
rxn.setProperty("cdk:ReactionConditions", "Reaction Text");
DepictionGenerator dg = new DepictionGenerator();
dg = dg.withSize(128*3, 128); // png = px, svg = mm
dg.depict(rxn).writeTo("~/rxn.png");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment