static void Main() { // ----- Object creation ----- Console.WriteLine("Creating some objects:"); ROMol m1 = RWMol.MolFromSmiles("c1ccccc1"); Console.WriteLine(" mol: " + m1 + " " + m1.getNumAtoms()); ROMol m2 = RWMol.MolFromSmiles("c1ccccn1"); Console.WriteLine(" smi: " + m1 + " " + m1.MolToSmiles()); Console.WriteLine(" smi2: " + m2 + " " + m2.MolToSmiles()); ExplicitBitVect fp1 = RDKFuncs.LayeredFingerprintMol(m1); ExplicitBitVect fp2 = RDKFuncs.LayeredFingerprintMol(m2); Console.WriteLine(" sim: " + RDKFuncs.TanimotoSimilarityEBV(fp1, fp2)); //rxnTest(); //smiTest(); morganTest(); Console.WriteLine("Goodbye"); }
public static UInt_Vect GetConnectivityInvariants(ROMol mol, bool includeRingMembership) { var invars = new UInt_Vect((int)mol.getNumAtoms()); RDKFuncs.getConnectivityInvariants(mol, invars, includeRingMembership); return(invars); }
public static ROMol Parse(string smarts) { if (smarts == null) { throw new ArgumentNullException(nameof(smarts)); } var pattern = SmartsCache.GetOrAdd(smarts, a_smarts => { ROMol query = Chem.MolFromSmarts(a_smarts); if (query == null) { return(nullSmarts); } query.setProp("source", "SMARTS"); return(query); }); if (object.ReferenceEquals(pattern, nullSmarts)) { return(null); } return(pattern); }
public static string MolFragmentToSmiles(ROMol mol, Int_Vect atomsToUse, Int_Vect bondsToUse = null, Str_Vect atomSymbols = null, Str_Vect bondSymbols = null, bool isomericSmiles = true, bool kekuleSmiles = false, int rootedAtAtom = -1, bool canonical = true, bool allBondsExplicit = false, bool allHsExplicit = false) { return(RDKFuncs.MolFragmentToSmiles(mol, atomsToUse, bondsToUse, atomSymbols, bondSymbols, isomericSmiles, kekuleSmiles, rootedAtAtom, canonical)); }
public static UInt_Vect GetFeatureInvariants(ROMol mol) { var invars = new UInt_Vect((int)mol.getNumAtoms()); RDKFuncs.getFeatureInvariants(mol, invars); return(invars); }
public static ROMol StripMol(ROMol mol) { foreach (var query in saltPatterns) { mol = RDKFuncs.deleteSubstructs(mol, query, true); } return(mol); }
public static Double_Vect SlogP_VSA_(ROMol mol, Double_Vect bins = null, bool force = false) { if (bins == null) { bins = new Double_Vect(0); } return(RDKFuncs.calcSlogP_VSA(mol, bins, force)); }
public static ExplicitBitVect RDKFingerprint(ROMol mol, int minPath = 1, int maxPath = 7, int fpSize = 2048, int nBitsPerHash = 2, bool useHs = true, double tgtDensity = 0, int minSize = 128, bool branchedPaths = true, bool useBondOrder = true, UInt_Vect atomInvariants = null, UInt_Vect fromAtoms = null, SWIGTYPE_p_std__vectorT_std__vectorT_uint32_t_t_t atomBits = null, SWIGTYPE_p_std__mapT_unsigned_int_std__vectorT_std__vectorT_int_t_t_std__lessT_unsigned_int_t_t bitInfo = null) { return(RDKFuncs.RDKFingerprintMol(mol, (uint)minPath, (uint)maxPath, (uint)fpSize, (uint)nBitsPerHash, useHs, tgtDensity, (uint)minSize, branchedPaths, useBondOrder, atomInvariants, fromAtoms, atomBits, bitInfo)); }
public static SparseIntVectu32 GetMorganFingerprint(ROMol mol, int radius, UInt_Vect invariants = null, UInt_Vect fromAtoms = null, bool useChirality = false, bool useBondTypes = true, bool onlyNonzeroInvariants = false, bool useCounts = true, BitInfoMap atomsSettingBits = null) { if (invariants == null) { invariants = new UInt_Vect(0); } if (fromAtoms == null) { fromAtoms = new UInt_Vect(0); } return(RDKFuncs.MorganFingerprintMol(mol, (uint)radius, invariants, fromAtoms, useChirality, useBondTypes, useCounts, onlyNonzeroInvariants, atomsSettingBits)); }
public static ExplicitBitVect GetMorganFingerprintAsBitVect(ROMol mol, int radius, int nBits = 2048, UInt_Vect invariants = null, UInt_Vect fromAtoms = null, bool useChirality = false, bool useBondTypes = true, bool onlyNonzeroInvariants = false, BitInfoMap atomsSettingBits = null) { if (invariants == null) { invariants = new UInt_Vect(0); } if (fromAtoms == null) { fromAtoms = new UInt_Vect(0); } return(RDKFuncs.getMorganFingerprintAsBitVect(mol, (uint)radius, (uint)nBits, invariants, fromAtoms, useChirality, useBondTypes, onlyNonzeroInvariants, atomsSettingBits)); }
static void BulkMemoryLeakTest() { Console.WriteLine("Bulk memory leak test"); for (uint i = 0; i < 10000; ++i) { ROMol m4 = RWMol.MolFromSmiles("Clc1cccc(N2CCN(CCC3CCC(CC3)NC(=O)c3cccs3)CC2)c1Cl"); if ((i % 1000) == 0) { Console.WriteLine(" Done: " + i); } m4.Dispose(); //GC.Collect(); } }
public static string MolToSVG(ROMol mol, int width = 300, int height = 300, Int_Vect highlightAtoms = null, bool kekulize = true, int lineWidthMult = 1, int fontSize = 12, bool includeAtomCircles = true, int confId = -1) { // See Code\GraphMol\Wrap\MolOps.cpp var drawer = new MolDraw2DSVG(width, height); drawer.setFontSize(fontSize / 24.0); drawer.setLineWidth(drawer.lineWidth() * lineWidthMult); drawer.drawOptions().circleAtoms = includeAtomCircles; drawer.drawMolecule(mol, highlightAtoms, null, null, confId); drawer.finishDrawing(); return(drawer.getDrawingText()); }
// static void rxnTest() { // Console.WriteLine( "Reaction tests" ); // var rxn = ChemicalReaction.ReactionFromSmarts("[N:1][C:2].[OH][C:3]=[O:4]>>[C:2][N:1][C:3]=[O:4]"); // var amine = RWMol.MolFromSmiles("CCCN"); // var acid = RWMol.MolFromSmiles("C1CC1CC(=O)O"); // ROMol[] rs = {amine,acid}; // ROMol_Vect rv = new ROMol_Vect(rs); // for(var i=0;i<100000;i++){ // var ps=rxn.runReactants(rv); // if(i%100 == 0) { // Console.WriteLine( "\t{0}", i ); // } // } // Console.WriteLine( "Goodbye" ); // } // static void smiTest() { // Console.WriteLine( "repeatedly from smiles" ); // for(var i=0;i<1000000;i++){ // ROMol m1=RDKFuncs.MolFromSmiles("c1ccccc1"); // if(i%1000 == 0) { // Console.WriteLine( "\t{0}", i ); // } // } // Console.WriteLine( "Goodbye" ); // } static void morganTest() { // ----- Object creation ----- Console.WriteLine("Creating some objects:"); ROMol m1 = RWMol.MolFromSmiles("c1ccccc1"); Console.WriteLine(" mol: " + m1 + " " + m1.getNumAtoms()); ROMol m2 = RWMol.MolFromSmiles("c1ccccn1"); var fp1 = RDKFuncs.MorganFingerprintMol(m1, 2); var fp2 = RDKFuncs.MorganFingerprintMol(m2, 2); Console.WriteLine(" sim: " + RDKFuncs.DiceSimilarity(fp1, fp2)); }
static void Main(string[] args) { // ----- Object creation ----- Console.WriteLine("Creating some objects:"); ROMol m1 = RWMol.MolFromSmiles("c1ccccc1"); Console.WriteLine(" mol: " + m1 + " " + m1.getNumAtoms()); ROMol m2 = RWMol.MolFromSmiles("c1ccccn1"); Console.WriteLine(" smi: " + m1 + " " + m1.MolToSmiles()); Console.WriteLine(" smi2: " + m2 + " " + m2.MolToSmiles()); ExplicitBitVect fp1 = RDKFuncs.LayeredFingerprintMol(m1); ExplicitBitVect fp2 = RDKFuncs.LayeredFingerprintMol(m2); Console.WriteLine(" sim: " + RDKFuncs.TanimotoSimilarityEBV(fp1, fp2)); //rxnTest(); //smiTest(); //morganTest(); ROMol m3 = RWMol.MolFromSmiles("c1ccccc1"); uint nAtoms = m3.getNumAtoms(true); Console.WriteLine("Bulk memory leak test"); for (uint i = 0; i < 10000; ++i) { ROMol m4 = RWMol.MolFromSmiles("Clc1cccc(N2CCN(CCC3CCC(CC3)NC(=O)c3cccs3)CC2)c1Cl"); if ((i % 1000) == 0) { Console.WriteLine(" Done: " + i); } m4.Dispose(); //GC.Collect(); } Console.WriteLine("Goodbye"); }
static void CreateSomeObjects() { // ----- Object creation ----- Console.WriteLine("Creating some objects:"); ROMol m1 = RWMol.MolFromSmiles("c1ccccc1"); Console.WriteLine(" mol: " + m1 + " " + m1.getNumAtoms()); ROMol m2 = RWMol.MolFromSmiles("c1ccccn1"); Console.WriteLine(" smi: " + m1 + " " + m1.MolToSmiles()); Console.WriteLine(" smi2: " + m2 + " " + m2.MolToSmiles()); ExplicitBitVect fp1 = RDKFuncs.LayeredFingerprintMol(m1); ExplicitBitVect fp2 = RDKFuncs.LayeredFingerprintMol(m2); Console.WriteLine(" sim: " + RDKFuncs.TanimotoSimilarityEBV(fp1, fp2)); const string SMILES_benzene = "c1ccccc1"; ROMol m3 = RWMol.MolFromSmiles(SMILES_benzene); uint nAtoms = m3.getNumAtoms(true); Console.WriteLine($"The number of atoms in {SMILES_benzene} is {nAtoms}."); }
public static int GetNumAtoms(ROMol mol, bool onlyExplicit = true) { return((int)mol.getNumAtoms(onlyExplicit)); }
public static MolSanitizeException_Vect DetectChemistryProblems(ROMol mol, SanitizeFlags sanitizeOps = SanitizeFlags.SANITIZE_ALL) { return(RDKFuncs.detectChemistryProblems(mol, (int)sanitizeOps)); }
public static void DetectBondStereochemistry(ROMol mol, int confId = -1) { RDKFuncs.detectBondStereochemistry(mol, confId); }
public static ROMol DeleteSubstructs(ROMol mol, ROMol query, bool onlyFrags = false, bool useChirality = false) { return(RDKFuncs.deleteSubstructs(mol, query, onlyFrags, useChirality)); }
public static void AssignStereochemistry(ROMol mol, bool cleanIt = false, bool force = false, bool flagPossibleStereoCenters = false) { RDKFuncs.assignStereochemistry(mol, cleanIt, force, flagPossibleStereoCenters); }
public static void AssignChiralTypesFromBondDirs(ROMol mol, int confId = -1, bool replaceExistingTags = true) { RDKFuncs.assignChiralTypesFromBondDirs(mol, confId, replaceExistingTags); }
public static void AddRecursiveQueries(ROMol mol, StringMolMap queries, string propName) { RDKFuncs.addRecursiveQueries(mol, queries, propName); }
public static int GetNumBonds(ROMol mol, bool onlyHeavy = true) { return((int)mol.getNumBonds(onlyHeavy)); }
// // rdChem // public static int GetNumHeavyAtoms(ROMol mol) { return((int)mol.getNumHeavyAtoms()); }
public static void MolToPDBFile(ROMol mol, string filename, int confId = -1, PDBFlavors flavor = 0) { RDKFuncs.MolToPDBFile(mol, filename, confId, (uint)flavor); }
public static string MolToCXSmiles(ROMol mol, bool isomericSmiles = true, bool kekuleSmiles = false, int rootedAtAtom = -1, bool canonical = true, bool allBondsExplicit = false, bool allHsExplicit = false, bool doRandom = false) { return(RDKFuncs.MolToCXSmiles(mol, isomericSmiles, kekuleSmiles, rootedAtAtom, canonical, allHsExplicit, doRandom)); }
public static void MolToXYZFile(ROMol mol, string filename, int confId = -1) { RDKFuncs.MolToXYZFile(mol, filename, confId); }
public static string MolToXYZBlock(ROMol mol, int confId = -1) { return(RDKFuncs.MolToXYZBlock(mol, confId)); }
public static string MolToInchi(ROMol mol, string options = "", ExtraInchiReturnValues ex = null) { return(RDKFuncs.MolToInchi(mol, ex ?? new ExtraInchiReturnValues(), options)); }
public static string MolToInchiKey(ROMol mol, string options = "") { return(RDKFuncs.MolToInchiKey(mol, options)); }