/* (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. */ using System; using OpenEye.OEChem; using OpenEye.OEShape; using OpenEye.OEGrid; public class Excludevolume { public static void Main(string[] args) { OEInterface itf = new OEInterface(InterfaceData, "ExcludeVolume", args); // Set up best overlay to the query molecule; oemolistream qfs = new oemolistream(); if (!qfs.open(itf.GetString("-q"))) OEChem.OEThrow.Fatal("Unable to open query " + itf.GetString("-q")); OEMol qmol = new OEMol(); OEChem.OEReadMolecule(qfs, qmol); // Set up overlap to protein exclusion volume; oemolistream efs = new oemolistream(); if (!efs.open(itf.GetString("-e"))) OEChem.OEThrow.Fatal("Unable to open protein " + itf.GetString("-e")); OEMol emol = new OEMol(); OEChem.OEReadMolecule(efs, emol); OEExactShapeFunc evol = new OEExactShapeFunc(); evol.SetupRef(emol); // open database and output streams; oemolistream ifs = new oemolistream(); if (!ifs.open(itf.GetString("-d"))) OEChem.OEThrow.Fatal("Unable to open database " + itf.GetString("-d")); oemolostream ofs = new oemolostream(); if (!ofs.open(itf.GetString("-o"))) OEChem.OEThrow.Fatal("Unable to open output " + itf.GetString("-o")); Console.WriteLine("Title Combo Rescore"); foreach (OEMol mol in ifs.GetOEMols()) { OEROCSResult res = new OEROCSResult(); OEShape.OEROCSOverlay(res, qmol, mol); OEGraphMol outmol = new OEGraphMol(res.GetOverlayConf()); // calculate overlap with protein; OEOverlapResults eres = new OEOverlapResults(); evol.Overlap(outmol, eres); float frac = eres.overlap / eres.fitSelfOverlap; float rescore = res.GetTanimotoCombo() - frac; // attach data to molecule and write it; OEChem.OESetSDData(outmol, "TanimotoCombo", String.Format("{0:F3}", res.GetTanimotoCombo())); OEChem.OESetSDData(outmol, "Exclusion Volume", String.Format("{0:F3}", eres.overlap)); OEChem.OESetSDData(outmol, "Fraction Overlap", String.Format("{0:F3}", frac)); OEChem.OESetSDData(outmol, "Rescore", String.Format("{0:F3}", rescore)); OEChem.OEWriteMolecule(ofs, outmol); Console.WriteLine("{0,-20} {1,-5:F3} {2,-5:F3}", outmol.GetTitle(), res.GetTanimotoCombo(), rescore); } } private static String InterfaceData = @" !CATEGORY ExcludeVolume !BRIEF [-q] [-e] [-d] [-o] !PARAMETER -q 1 !TYPE string !REQUIRED true !BRIEF Query file name !KEYLESS 1 !END !PARAMETER -e 2 !TYPE string !REQUIRED true !BRIEF Protein to use as exclusion volume !KEYLESS 2 !END !PARAMETER -d 3 !TYPE string !REQUIRED true !BRIEF Database file name !KEYLESS 3 !END !PARAMETER -o 4 !TYPE string !REQUIRED true !BRIEF Output file name !KEYLESS 4 !END !END"; }