/* (C) 2022 Cadence Design Systems, Inc. (Cadence) All rights reserved. TERMS FOR USE OF SAMPLE CODE The software below ("Sample Code") is provided to current licensees or subscribers of Cadence products or SaaS offerings (each a "Customer"). Customer is hereby permitted to use, copy, and modify the Sample Code, subject to these terms. Cadence claims no rights to Customer's modifications. Modification of Sample Code is at Customer's sole and exclusive risk. Sample Code may require Customer to have a then current license or subscription to the applicable Cadence offering. THE SAMPLE CODE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. OPENEYE DISCLAIMS ALL WARRANTIES, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. In no event shall Cadence be liable for any damages or liability in connection with the Sample Code or its use. */ /*********************************************************************** * Generates 2D coordinates ***********************************************************************/ using System; using OpenEye.OEChem; using OpenEye.OEDepict; public class Depict { public static int Main(string[] args) { OEInterface itf = new OEInterface(interfaceData); OEDepict.OEConfigurePrepareDepictionOptions(itf, OEPrepareDepictionSetup.SuppressHydrogens | OEPrepareDepictionSetup.DepictOrientation); if (!OEChem.OEParseCommandLine(itf, args, "Depict")) { OEChem.OEThrow.Fatal("Unable to interpret command line"); } oemolistream ifs = new oemolistream(); if (!ifs.open(itf.GetString("-in"))) { OEChem.OEThrow.Fatal("Cannot open input file!"); } oemolostream ofs = new oemolostream(".sdf"); if (itf.HasString("-out")) { string oname = itf.GetString("-out"); if (!ofs.open(oname)) { OEChem.OEThrow.Fatal("Cannot open output file!"); } if (!OEChem.OEIs2DFormat(ofs.GetFormat())) { OEChem.OEThrow.Fatal("Invalid output format for 2D coordinates"); } } if (itf.HasString("-ringdict")) { string rdfname = itf.GetString("-ringdict"); if (!OEChem.OEInit2DRingDictionary(rdfname)) { OEChem.OEThrow.Warning("Cannot use user-defined ring dictionary!"); } } OEPrepareDepictionOptions popts = new OEPrepareDepictionOptions(); OEDepict.OESetupPrepareDepictionOptions(popts, itf); popts.SetClearCoords(true); OEGraphMol mol = new OEGraphMol(); while (OEChem.OEReadMolecule(ifs, mol)) { OEDepict.OEPrepareDepiction(mol, popts); OEChem.OEWriteMolecule(ofs, mol); } return 0; } private static string interfaceData = @" !BRIEF [-in] [-out] [-ringdict] !CATEGORY ""input/output options :"" !PARAMETER -in !ALIAS -i !TYPE string !REQUIRED true !KEYLESS 1 !VISIBILITY simple !BRIEF Input filename !END !PARAMETER -out !ALIAS -o !TYPE string !REQUIRED false !KEYLESS 2 !VISIBILITY simple !BRIEF Output filename !END !PARAMETER -ringdict !ALIAS -rd !TYPE string !REQUIRED false !VISIBILITY simple !BRIEF User-defined 2D ring dictionary !DETAIL 2D ring dictionaries can be generated by the following OEChem examples: C++ - createringdict.cpp Python - createringdict.py Java - CreateRingDict.java C# - CreateRingDict.cs !END !END "; }