Exemple #1
0
        public IndigoInchi(Indigo indigo)
        {
            String          dllpath = indigo.getDllPath();
            string          libraryName;
            IndigoDllLoader dll_loader = IndigoDllLoader.Instance;

            switch (Environment.OSVersion.Platform)
            {
            case PlatformID.Win32NT:
                libraryName = "indigo-inchi.dll";
                dll_loader.loadLibrary(dllpath, libraryName, "com.ggasoftware.indigo.Properties.ResourcesWin", false);
                break;

            case PlatformID.Unix:
                if (IndigoDllLoader.isMac())
                {
                    libraryName = "libindigo-inchi.dylib";
                    dll_loader.loadLibrary(dllpath, libraryName, "com.ggasoftware.indigo.Properties.ResourcesMac", false);
                }
                else
                {
                    libraryName = "libindigo-inchi.so";
                    dll_loader.loadLibrary(dllpath, libraryName, "com.ggasoftware.indigo.Properties.ResourcesLinux", false);
                }
                break;

            default:
                throw new PlatformNotSupportedException(String.Format("Unsupported platform: {0}", Environment.OSVersion.Platform));
            }

            _inchi_lib = dll_loader.getInterface <IndigoInchiLib> (libraryName);

            _indigo = indigo;
        }
Exemple #2
0
 internal BingoObject(int id, Indigo indigo, BingoLib bingo_lib)
 {
     this._id        = id;
     this._indigo    = indigo;
     this._bingoLib  = bingo_lib;
     this._dllLoader = IndigoDllLoader.Instance;
 }
Exemple #3
0
 private Bingo(Indigo indigo, int id, BingoLib lib)
 {
     _indigo = indigo;
     _lib = lib;
     _id = id;
     _dllLoader = IndigoDllLoader.Instance;
 }
Exemple #4
0
 public IndigoObject(Indigo dispatcher, object parent, int id)
 {
     this.dispatcher = dispatcher;
     this.self       = id;
     this.parent     = parent;
     _indigo_lib     = dispatcher._indigo_lib;
 }
        public IndigoRenderer(Indigo indigo)
        {
            String dllpath = indigo.getDllPath ();
            string libraryName;
            IndigoDllLoader dll_loader = IndigoDllLoader.Instance;
            switch (Environment.OSVersion.Platform) {
            case PlatformID.Win32NT:
                libraryName = "indigo-renderer.dll";
                dll_loader.loadLibrary (dllpath, libraryName, "com.ggasoftware.indigo.Properties.ResourcesWin", false);
                break;
            case PlatformID.Unix:
                if (IndigoDllLoader.isMac()) {
                    libraryName = "libindigo-renderer.dylib";
                    dll_loader.loadLibrary (dllpath, libraryName, "com.ggasoftware.indigo.Properties.ResourcesMac", false);
                } else {
                    libraryName = "libindigo-renderer.so";
                    dll_loader.loadLibrary (dllpath, libraryName, "com.ggasoftware.indigo.Properties.ResourcesLinux", false);
                }
                break;
            default:
                throw new PlatformNotSupportedException (String.Format ("Unsupported platform: {0}", Environment.OSVersion.Platform));
            }

            _renderer_lib = dll_loader.getInterface<IndigoRendererLib> (libraryName);

            _indigo = indigo;
        }
Exemple #6
0
 private Bingo(Indigo indigo, int id, BingoLib lib)
 {
     _indigo    = indigo;
     _lib       = lib;
     _id        = id;
     _dllLoader = IndigoDllLoader.Instance;
 }
Exemple #7
0
		internal BingoObject(int id, Indigo indigo, BingoLib bingo_lib)
		{
			this._id = id;
			this._indigo = indigo;
			this._bingoLib = bingo_lib;
			this._dllLoader = IndigoDllLoader.Instance;
		}
Exemple #8
0
 public IndigoObject(Indigo dispatcher, object parent, int id)
 {
     this.dispatcher = dispatcher;
      this.self = id;
      this.parent = parent;
      _indigo_lib = dispatcher._indigo_lib;
 }
Exemple #9
0
 public IndigoObject(Indigo dispatcher, int id, object parent)
 {
     this.dispatcher = dispatcher;
     this.self = id;
     this.parent = parent;
     _indigo_lib = dispatcher._indigo_lib;
     dll_loader = IndigoDllLoader.Instance;
 }
Exemple #10
0
        internal static string checkResult(Indigo indigo, string result)
        {
            if (result == null)
            {
                throw new BingoException(new String(indigo._indigo_lib.indigoGetLastError()));
            }

            return result;
        }
Exemple #11
0
        internal static float checkResult(Indigo indigo, float result)
        {
            if (result < 0.0)
            {
                throw new BingoException(new String(indigo._indigo_lib.indigoGetLastError()));
            }

            return result;
        }
Exemple #12
0
        internal static float checkResult(Indigo indigo, float result)
        {
            if (result < 0.0)
            {
                throw new BingoException(new String(indigo._indigo_lib.indigoGetLastError()));
            }

            return(result);
        }
Exemple #13
0
        internal static string checkResult(Indigo indigo, string result)
        {
            if (result == null)
            {
                throw new BingoException(new String(indigo._indigo_lib.indigoGetLastError()));
            }

            return(result);
        }
Exemple #14
0
        public IndigoRenderer(Indigo indigo)
        {
            String dllpath = indigo.getDllPath();

             IndigoDllLoader dll_loader = IndigoDllLoader.Instance;
             dll_loader.loadLibrary(dllpath, "indigo-renderer.dll",
            "com.ggasoftware.indigo.Properties.Resources", false);
             _renderer_lib = dll_loader.getInterface<IndigoRendererLib>("indigo-renderer.dll");

             _indigo = indigo;
        }
Exemple #15
0
        public IndigoInchi(Indigo indigo)
        {
            String dllpath = indigo.getDllPath();

            IndigoDllLoader dll_loader = IndigoDllLoader.Instance;

            dll_loader.loadLibrary(dllpath, "indigo-inchi.dll",
                                   "com.ggasoftware.indigo.Properties.Resources", false);
            _inchi_lib = dll_loader.getInterface <IndigoInchiLib>("indigo-inchi.dll");

            _indigo = indigo;
        }
Exemple #16
0
        /// <summary>
        /// Creates a chemical storage of a specifed type in a specified location
        /// </summary>
        /// <param name="indigo">Indigo instance</param>
        /// <param name="location">Directory with the files location</param>
        /// <param name="type">"molecule" or "reaction"</param>
        /// <param name="options">Additional options separated with a semicolon. See the Bingo documentation for more details.</param>
        /// <returns>Bingo database instance</returns>
        public static Bingo createDatabaseFile(Indigo indigo, string location, string type, string options)
        {
            indigo.setSessionID();
            if (options == null)
            {
                options = "";
            }
            BingoLib lib        = Bingo.getLib(indigo);
            int      databaseID = Bingo.checkResult(indigo, lib.bingoCreateDatabaseFile(location, type, options));

            return(new Bingo(indigo, databaseID, lib));
        }
Exemple #17
0
 public void removeAtoms(ICollection vertices)
 {
     removeAtoms(Indigo.toIntArray(vertices));
 }
 public IndigoChemistryDepiction(Indigo _indigo)
 {
     indigo = _indigo;
     renderer = new IndigoRenderer(indigo);
 }
Exemple #19
0
 private static void _handleError(sbyte* message, Indigo self)
 {
     throw new IndigoException(new String(message));
 }
Exemple #20
0
 /// <summary>
 /// Creates a chemical storage of a specifed type in a specified location
 /// </summary>
 /// <param name="indigo">Indigo instance</param>
 /// <param name="location">Directory with the files location</param>
 /// <param name="type">"molecule" or "reaction"</param>
 /// <returns>Bingo database instance</returns>
 public static Bingo createDatabaseFile(Indigo indigo, string location, string type)
 {
     return createDatabaseFile(indigo, location, type, null);
 }
Exemple #21
0
 /// <summary>
 /// Loads a chemical storage of a specifed type from a specified location
 /// </summary>
 /// <param name="indigo">Indigo instance</param>
 /// <param name="location">Directory with the files location</param>
 /// <param name="options">Additional options separated with a semicolon. See the Bingo documentation for more details.</param>
 /// <returns>Bingo database instance</returns>
 public static Bingo loadDatabaseFile(Indigo indigo, string location, string options)
 {
     if (options == null)
     {
         options = "";
     }
     BingoLib lib = Bingo.getLib(indigo);
     indigo.setSessionID();
     int databaseID = Bingo.checkResult(indigo, lib.bingoLoadDatabaseFile(location, options));
     return new Bingo(indigo, databaseID, lib);
 }
Exemple #22
0
 /// <summary>
 /// Loads a chemical storage of a specifed type from a specified location
 /// </summary>
 /// <param name="indigo">Indigo instance</param>
 /// <param name="location">Directory with the files location</param>
 /// <returns>Bingo database instance</returns>
 public static Bingo loadDatabaseFile(Indigo indigo, string location)
 {
     return loadDatabaseFile(indigo, location, null);
 }
Exemple #23
0
 /// <summary>
 /// Loads a chemical storage of a specifed type from a specified location
 /// </summary>
 /// <param name="indigo">Indigo instance</param>
 /// <param name="location">Directory with the files location</param>
 /// <returns>Bingo database instance</returns>
 public static Bingo loadDatabaseFile(Indigo indigo, string location)
 {
     return(loadDatabaseFile(indigo, location, null));
 }
Exemple #24
0
 /// <summary>
 /// Creates a chemical storage of a specifed type in a specified location
 /// </summary>
 /// <param name="indigo">Indigo instance</param>
 /// <param name="location">Directory with the files location</param>
 /// <param name="type">"molecule" or "reaction"</param>
 /// <returns>Bingo database instance</returns>
 public static Bingo createDatabaseFile(Indigo indigo, string location, string type)
 {
     return(createDatabaseFile(indigo, location, type, null));
 }
Exemple #25
0
 public IndigoObject addDataSGroup(ICollection atoms, ICollection bonds, String description, String data)
 {
     return(addDataSGroup(Indigo.toIntArray(atoms), Indigo.toIntArray(bonds), description, data));
 }
Exemple #26
0
 public IndigoObject addSuperatom(ICollection atoms, String name)
 {
     return(addSuperatom(Indigo.toIntArray(atoms), name));
 }
Exemple #27
0
 public IndigoObject(Indigo dispatcher, int id) : this(dispatcher, id, null)
 {
     dll_loader = IndigoDllLoader.Instance;
 }
Exemple #28
0
 private static void _handleError(sbyte *message, Indigo self)
 {
     throw new IndigoException(new String(message));
 }
 public ChemHasseFingerprint(Indigo _indigo, BitArray _fp)
 {
     indigo = _indigo;
     fp = _fp;
     base.bitCount = base.CountBits();
 }
Exemple #30
0
        static void Main(string[] args)
        {
            Indigo indigo = new Indigo();

            // By default Bingo loads a database and stores all the data in RAM for faster operations
            // But if the application is limited in the memory usage Bingo can work
            // in a file mode with loading only minor parts of data into the memory
            Bingo database = Bingo.createDatabaseFile(indigo, "db1", "molecule", "storage:file");

            // Insert structures from the file
            using (IndigoObject input = indigo.iterateSmilesFile("input.smi"))
                foreach (IndigoObject obj in input)
                {
                    Console.WriteLine("  Object: {0}", obj.name());

                    // When loading from SMILES the only information that we have is an object name
                    // that is stored on the same line with the SMILES in the file
                    int id = int.Parse(obj.name());

                    // Insert loaded object into the database
                    database.insert(obj, id);

                    // Dispose native Indigo object as .NET object is much smaller than native object
                    // and GC can postpone disposing of this object resulting in a large memory
                    // consumption
                    obj.Dispose();
                }

            // Bingo can also assign structure ID automatically
            int autoId1 = database.insert(indigo.loadMolecule("OC1C(C(=O)O)=CC=CC1O"));
            Console.WriteLine("Automatic id = {0}", autoId1);

            int autoId2 = database.insert(indigo.loadMolecule("OC1C(C(=O)O)=CC=CC1O"));
            Console.WriteLine("Automatic id = {0}", autoId2);

            // Search over the database
            Console.WriteLine("Search Benzene:");
            IndigoObject query = indigo.loadQueryMolecule("C1=CC=CC=C1");
            BingoObject search = database.searchSub(query);
            while (search.next())
                Console.WriteLine("  Found id = {0}", search.getCurrentId());

            // You can close and reopen database at any moment
            database.close();
            // Load Bingo in a RAM mode with caching all data into the memory
            // Search operations works faster in this mode
            database = Bingo.loadDatabaseFile(indigo, "db1", "molecule", "storage:ram");

            // Search the same query but in the aromatic form
            // Results are the same
            Console.WriteLine("Search Benzene in the aromatic form:");
            query = indigo.loadQueryMolecule("c1ccccc1");
            search = database.searchSub(query);
            while (search.next())
                Console.WriteLine("  Found id = {0}", search.getCurrentId());

            Console.WriteLine("Search C=O");
            query = indigo.loadQueryMolecule("C=O");
            // Using block will automatically call search.Dispose() that calls search.close()
            // to terminate further search
            using (search = database.searchSub(query))
            {
                int count = 0;
                while (search.next())
                {
                    Console.WriteLine("  Found id = {0}", search.getCurrentId());
                    count++;
                    if (count == 4)
                        break;
                }
            }

            // Similarity search
            Console.WriteLine("Similarity search:");
            query = indigo.loadMolecule("NC1C=CC=C(C1O)C(O)=O");
            search = database.searchSim(query, 0.7f, 1.0f);
            while (search.next())
                Console.WriteLine("  Found id = {0}", search.getCurrentId());

            // Database will be closed automatically in the object destructor
            // but we can close it manually to dispose memory
            database.close();
        }
Exemple #31
0
 public IndigoObject getSubmolecule(ICollection vertices)
 {
     return(getSubmolecule(Indigo.toIntArray(vertices)));
 }
 public ChemHasseFingerprint(Indigo _indigo)
 {
     indigo = _indigo;
 }
Exemple #33
0
 public IndigoObject(Indigo dispatcher, int id) : this(dispatcher, null, id)
 {
 }
Exemple #34
0
 public float alignAtoms(ICollection atom_ids, ICollection desired_xyz)
 {
     return(alignAtoms(Indigo.toIntArray(atom_ids), Indigo.toFloatArray(desired_xyz)));
 }
Exemple #35
0
 public IndigoObject(Indigo dispatcher, int id)
     : this(dispatcher, null, id)
 {
 }