File: Indigo.cs

package info (click to toggle)
indigo 1.4.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 48,936 kB
  • sloc: ansic: 332,816; cpp: 169,470; python: 20,033; java: 13,701; cs: 9,979; asm: 8,475; sql: 6,743; xml: 6,354; javascript: 1,245; sh: 555; php: 506; makefile: 54
file content (937 lines) | stat: -rw-r--r-- 28,559 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
using System;
using System.Collections;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Text;

namespace com.epam.indigo
{
    [Flags]
    public enum ReactingCenter
    {
        NOT_CENTER = -1,
        UNMARKED = 0,
        CENTER = 1,
        UNCHANGED = 2,
        MADE_OR_BROKEN = 4,
        ORDER_CHANGED = 8
    }

    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
    public unsafe class Indigo : IDisposable
    {
        public const int ABS = 1;
        public const int OR = 2;
        public const int AND = 3;
        public const int EITHER = 4;
        public const int UP = 5;
        public const int DOWN = 6;
        public const int CIS = 7;
        public const int TRANS = 8;
        public const int CHAIN = 9;
        public const int RING = 10;
        public const int ALLENE = 11;
        public const int SINGLET = 101;
        public const int DOUBLET = 102;
        public const int TRIPLET = 103;

        public const int RC_NOT_CENTER = -1;
        public const int RC_UNMARKED = 0;
        public const int RC_CENTER = 1;
        public const int RC_UNCHANGED = 2;
        public const int RC_MADE_OR_BROKEN = 4;
        public const int RC_ORDER_CHANGED = 8;

        public const int SG_TYPE_GEN = 0;
        public const int SG_TYPE_DAT = 1;
        public const int SG_TYPE_SUP = 2;
        public const int SG_TYPE_SRU = 3;
        public const int SG_TYPE_MUL = 4;
        public const int SG_TYPE_MON = 5;
        public const int SG_TYPE_MER = 6;
        public const int SG_TYPE_COP = 7;
        public const int SG_TYPE_CRO = 8;
        public const int SG_TYPE_MOD = 9;
        public const int SG_TYPE_GRA = 10;
        public const int SG_TYPE_COM = 11;
        public const int SG_TYPE_MIX = 12;
        public const int SG_TYPE_FOR = 13;
        public const int SG_TYPE_ANY = 14;

        public const uint MAX_SIZE = 1000000000;


        private long _sid = -1;
        private readonly string _dllpath;
        private readonly int _dll_loader_id;

        ~Indigo()
        {
            Dispose();
        }

        public void Dispose()
        {
            if (_sid >= 0)
            {
                IndigoLib.indigoReleaseSessionId(_sid);
                _sid = -1;
            }
        }

        public void setSessionID()
        {
            IndigoLib.indigoSetSessionId(_sid);
        }

        public void dbgBreakpoint()
        {
            setSessionID();
            IndigoLib.indigoDbgBreakpoint();
        }


        public void free(int id)
        {
            setSessionID();
            checkResult(IndigoLib.indigoFree(id));
        }

        public string getDllPath()
        {
            return _dllpath;
        }

        public string dbgProfiling(bool whole_session)
        {
            setSessionID();
            return checkResult(IndigoLib.indigoDbgProfiling(whole_session ? 1 : 0));
        }

        public void dbgResetProfiling(bool whole_session)
        {
            setSessionID();
            checkResult(IndigoLib.indigoDbgResetProfiling(whole_session ? 1 : 0));
        }

        private static int strLen(sbyte* input)
        {
            int res = 0;
            do
            {
                if (input[res] == 0)
                {
                    break;
                }
                res++;
            } while (res < MAX_SIZE);
            return res;
        }

        private static string _sbyteToStringUTF8(sbyte* input)
        {
            return new string(input, 0, strLen(input), Encoding.UTF8);
        }

        private static void _handleError(sbyte* message, Indigo self)
        {
            throw new IndigoException(_sbyteToStringUTF8(message));
        }

        private void init(string lib_path)
        {
            _sid = IndigoLib.indigoAllocSessionId();
            setSessionID();
        }

        public float checkResult(float result)
        {
            if (result < 0)
            {
                throw new IndigoException(_sbyteToStringUTF8(IndigoLib.indigoGetLastError()));
            }

            return result;
        }

        public double checkResult(double result)
        {
            if (result < 0)
            {
                throw new IndigoException(_sbyteToStringUTF8(IndigoLib.indigoGetLastError()));
            }

            return result;
        }

        public int checkResult(int result)
        {
            if (result < 0)
            {
                throw new IndigoException(_sbyteToStringUTF8(IndigoLib.indigoGetLastError()));
            }

            return result;
        }

        public string checkResult(sbyte* result)
        {
            if (result == null)
            {
                throw new IndigoException(_sbyteToStringUTF8(IndigoLib.indigoGetLastError()));
            }

            return _sbyteToStringUTF8(result);
        }

        public float* checkResult(float* result)
        {
            if (result == null)
            {
                throw new IndigoException(_sbyteToStringUTF8(IndigoLib.indigoGetLastError()));
            }

            return result;
        }

        public int* checkResult(int* result)
        {
            if (result == null)
            {
                throw new IndigoException(_sbyteToStringUTF8(IndigoLib.indigoGetLastError()));
            }

            return result;
        }

        public long getSID()
        {
            return _sid;
        }

        public string version()
        {
            return checkResult(IndigoLib.indigoVersion());
        }

        public Indigo(string lib_path)
        {
            init(lib_path);
        }

        public Indigo()
            : this(null)
        {
        }

        public int countReferences()
        {
            setSessionID();
            return checkResult(IndigoLib.indigoCountReferences());
        }

        public void setOption(string name, string value)
        {
            setSessionID();
            checkResult(IndigoLib.indigoSetOption(name, value));
        }

        public void setOption(string name, int x, int y)
        {
            setSessionID();
            checkResult(IndigoLib.indigoSetOptionXY(name, x, y));
        }

        public void setOption(string name, bool value)
        {
            setSessionID();
            checkResult(IndigoLib.indigoSetOptionBool(name, value ? 1 : 0));
        }

        public void setOption(string name, float value)
        {
            setSessionID();
            checkResult(IndigoLib.indigoSetOptionFloat(name, value));
        }

        public void setOption(string name, int value)
        {
            setSessionID();
            checkResult(IndigoLib.indigoSetOptionInt(name, value));
        }

        public void setOption(string name, float valuer, float valueg, float valueb)
        {
            setSessionID();
            checkResult(IndigoLib.indigoSetOptionColor(name, valuer / 255.0f, valueg / 255.0f, valueb / 255.0f));
        }

        public void setOption(string name, Color value)
        {
            setSessionID();
            checkResult(IndigoLib.indigoSetOptionColor(name, value.R / 255.0f, value.G / 255.0f, value.B / 255.0f));
        }


        public string getOption(string option)
        {
            setSessionID();
            return checkResult(IndigoLib.indigoGetOption(option));
        }

        public int? getOptionInt(string option)
        {
            setSessionID();
            int res;
            if (checkResult(IndigoLib.indigoGetOptionInt(option, &res)) == 1)
            {
                return res;
            }
            return null;
        }

        public bool getOptionBool(string option)
        {
            setSessionID();
            int res;
            checkResult(IndigoLib.indigoGetOptionBool(option, &res));
            return res > 0;
        }

        public float? getOptionFloat(string option)
        {
            setSessionID();
            float res;
            if (checkResult(IndigoLib.indigoGetOptionFloat(option, &res)) == 1)
            {
                return res;
            }
            return null;
        }

        public string getOptionType(string option)
        {
            setSessionID();
            return checkResult(IndigoLib.indigoGetOptionType(option));
        }

        public void resetOptions()
        {
            setSessionID();
            checkResult(IndigoLib.indigoResetOptions());
        }

        public IndigoObject writeFile(string filename)
        {
            setSessionID();
            return new IndigoObject(this, checkResult(IndigoLib.indigoWriteFile(filename)));
        }

        public IndigoObject writeBuffer()
        {
            setSessionID();
            return new IndigoObject(this, checkResult(IndigoLib.indigoWriteBuffer()));
        }

        public IndigoObject createMolecule()
        {
            setSessionID();
            return new IndigoObject(this, checkResult(IndigoLib.indigoCreateMolecule()));
        }

        public IndigoObject createQueryMolecule()
        {
            setSessionID();
            return new IndigoObject(this, checkResult(IndigoLib.indigoCreateQueryMolecule()));
        }

        public IndigoObject loadMolecule(string str)
        {
            setSessionID();
            return new IndigoObject(this, checkResult(IndigoLib.indigoLoadMoleculeFromString(str)));
        }

        public IndigoObject loadMolecule(byte[] buf)
        {
            setSessionID();
            return new IndigoObject(this, checkResult(IndigoLib.indigoLoadMoleculeFromBuffer(buf, buf.Length)));
        }

        public IndigoObject loadMoleculeFromFile(string path)
        {
            setSessionID();
            return new IndigoObject(this, checkResult(IndigoLib.indigoLoadMoleculeFromFile(path)));
        }

        public IndigoObject loadMoleculeFromBuffer(byte[] buf)
        {
            setSessionID();
            return new IndigoObject(this, checkResult(IndigoLib.indigoLoadMoleculeFromBuffer(buf, buf.Length)));
        }

        public IndigoObject loadQueryMolecule(string str)
        {
            setSessionID();
            return new IndigoObject(this, checkResult(IndigoLib.indigoLoadQueryMoleculeFromString(str)));
        }

        public IndigoObject loadQueryMolecule(byte[] buf)
        {
            setSessionID();
            return new IndigoObject(this, checkResult(IndigoLib.indigoLoadQueryMoleculeFromBuffer(buf, buf.Length)));
        }

        public IndigoObject loadQueryMoleculeFromFile(string path)
        {
            setSessionID();
            return new IndigoObject(this, checkResult(IndigoLib.indigoLoadQueryMoleculeFromFile(path)));
        }

        public IndigoObject loadSmarts(string str)
        {
            setSessionID();
            return new IndigoObject(this, checkResult(IndigoLib.indigoLoadSmartsFromString(str)));
        }

        public IndigoObject loadSmarts(byte[] buf)
        {
            setSessionID();
            return new IndigoObject(this, checkResult(IndigoLib.indigoLoadSmartsFromBuffer(buf, buf.Length)));
        }

        public IndigoObject loadSmartsFromFile(string path)
        {
            setSessionID();
            return new IndigoObject(this, checkResult(IndigoLib.indigoLoadSmartsFromFile(path)));
        }

        public IndigoObject loadReaction(string str)
        {
            setSessionID();
            return new IndigoObject(this, checkResult(IndigoLib.indigoLoadReactionFromString(str)));
        }

        public IndigoObject loadReaction(byte[] buf)
        {
            setSessionID();
            return new IndigoObject(this, checkResult(IndigoLib.indigoLoadReactionFromBuffer(buf, buf.Length)));
        }

        public IndigoObject loadReactionFromFile(string path)
        {
            setSessionID();
            return new IndigoObject(this, checkResult(IndigoLib.indigoLoadReactionFromFile(path)));
        }

        public IndigoObject loadQueryReaction(string str)
        {
            setSessionID();
            return new IndigoObject(this, checkResult(IndigoLib.indigoLoadQueryReactionFromString(str)));
        }

        public IndigoObject loadQueryReaction(byte[] buf)
        {
            setSessionID();
            return new IndigoObject(this, checkResult(IndigoLib.indigoLoadQueryReactionFromBuffer(buf, buf.Length)));
        }

        public IndigoObject loadQueryReactionFromFile(string path)
        {
            setSessionID();
            return new IndigoObject(this, checkResult(IndigoLib.indigoLoadQueryReactionFromFile(path)));
        }

        public IndigoObject loadReactionSmarts(string str)
        {
            setSessionID();
            return new IndigoObject(this, checkResult(IndigoLib.indigoLoadReactionSmartsFromString(str)));
        }

        public IndigoObject loadReactionSmarts(byte[] buf)
        {
            setSessionID();
            return new IndigoObject(this, checkResult(IndigoLib.indigoLoadReactionSmartsFromBuffer(buf, buf.Length)));
        }

        public IndigoObject loadReactionSmartsFromFile(string path)
        {
            setSessionID();
            return new IndigoObject(this, checkResult(IndigoLib.indigoLoadReactionSmartsFromFile(path)));
        }

        public string checkStructure(string str)
        {
            return checkStructure(str, "");
        }

        public string checkStructure(string str, string options)
        {
            setSessionID();
            return checkResult(IndigoLib.indigoCheckStructure(str, options));
        }

        public IndigoObject loadStructure(string str)
        {
            return loadStructure(str, "");
        }

        public IndigoObject loadStructure(string str, string options)
        {
            setSessionID();
            return new IndigoObject(this, checkResult(IndigoLib.indigoLoadStructureFromString(str, options)));
        }

        public IndigoObject loadStructure(byte[] buf)
        {
            return loadStructure(buf, "");
        }

        public IndigoObject loadStructure(byte[] buf, string options)
        {
            setSessionID();
            return new IndigoObject(this, checkResult(IndigoLib.indigoLoadStructureFromBuffer(buf, buf.Length, options)));
        }

        public IndigoObject loadStructureFromFile(string path)
        {
            return loadStructureFromFile(path, "");
        }

        public IndigoObject loadStructureFromFile(string path, string options)
        {
            setSessionID();
            return new IndigoObject(this, checkResult(IndigoLib.indigoLoadStructureFromFile(path, options)));
        }

        public IndigoObject loadStructureFromBuffer(byte[] buf)
        {
            return loadStructureFromBuffer(buf, "");
        }

        public IndigoObject loadStructureFromBuffer(byte[] buf, string options)
        {
            setSessionID();
            return new IndigoObject(this, checkResult(IndigoLib.indigoLoadStructureFromBuffer(buf, buf.Length, options)));
        }

        public IndigoObject loadFingerprintFromBuffer(byte[] buf)
        {
            setSessionID();
            return new IndigoObject(this, checkResult(IndigoLib.indigoLoadFingerprintFromBuffer(buf, buf.Length)));
        }

        public IndigoObject loadFingerprintFromDescriptors(double[] descriptors, int size, double density)
        {
            setSessionID();
            int result = IndigoLib.indigoLoadFingerprintFromDescriptors(descriptors, descriptors.Length, size, density);
            return new IndigoObject(this, checkResult(result));
        }

        public IndigoObject createReaction()
        {
            setSessionID();
            return new IndigoObject(this, checkResult(IndigoLib.indigoCreateReaction()));
        }

        public IndigoObject createQueryReaction()
        {
            setSessionID();
            return new IndigoObject(this, checkResult(IndigoLib.indigoCreateQueryReaction()));
        }

        public IndigoObject exactMatch(IndigoObject obj1, IndigoObject obj2, string flags)
        {
            if (flags == null)
            {
                flags = "";
            }

            setSessionID();
            int match = checkResult(IndigoLib.indigoExactMatch(obj1.self, obj2.self, flags));

            if (match == 0)
            {
                return null;
            }

            return new IndigoObject(this, match, new IndigoObject[] { obj1, obj2 });
        }

        public IndigoObject exactMatch(IndigoObject obj1, IndigoObject obj2)
        {
            return exactMatch(obj1, obj2, "");
        }

        public void setTautomerRule(int id, string beg, string end)
        {
            setSessionID();
            checkResult(IndigoLib.indigoSetTautomerRule(id, beg, end));
        }

        public void removeTautomerRule(int id)
        {
            setSessionID();
            checkResult(IndigoLib.indigoRemoveTautomerRule(id));
        }

        public void clearTautomerRules()
        {
            setSessionID();
            checkResult(IndigoLib.indigoClearTautomerRules());
        }
        
        public IndigoObject deserialize(byte[] buf)
        {
            return new IndigoObject(this, checkResult(IndigoLib.indigoUnserialize(buf, buf.Length)));
        }
        
        [Obsolete("unserialize() is deprecated, please use deserialize() instead.")] 
        public IndigoObject unserialize(byte[] buf)
        {
            return deserialize(buf);
        }

        public IndigoObject createArray()
        {
            setSessionID();
            return new IndigoObject(this, checkResult(IndigoLib.indigoCreateArray()));
        }

        public float similarity(IndigoObject obj1, IndigoObject obj2)
        {
            return similarity(obj1, obj2, "");
        }

        public float similarity(IndigoObject obj1, IndigoObject obj2, string metrics)
        {
            setSessionID();
            if (metrics == null)
            {
                metrics = "";
            }

            return checkResult(IndigoLib.indigoSimilarity(obj1.self, obj2.self, metrics));
        }

        public int commonBits(IndigoObject obj1, IndigoObject obj2)
        {
            setSessionID();
            return checkResult(IndigoLib.indigoCommonBits(obj1.self, obj2.self));
        }

        public IndigoObject iterateSDFile(string filename)
        {
            setSessionID();
            return new IndigoObject(this, checkResult(IndigoLib.indigoIterateSDFile(filename)));
        }

        public IndigoObject iterateRDFile(string filename)
        {
            setSessionID();
            return new IndigoObject(this, checkResult(IndigoLib.indigoIterateRDFile(filename)));
        }

        public IndigoObject iterateSmilesFile(string filename)
        {
            setSessionID();
            return new IndigoObject(this, checkResult(IndigoLib.indigoIterateSmilesFile(filename)));
        }

        public IndigoObject iterateCMLFile(string filename)
        {
            setSessionID();
            return new IndigoObject(this, checkResult(IndigoLib.indigoIterateCMLFile(filename)));
        }

        public IndigoObject iterateCDXFile(string filename)
        {
            setSessionID();
            return new IndigoObject(this, checkResult(IndigoLib.indigoIterateCDXFile(filename)));
        }

        public IndigoObject substructureMatcher(IndigoObject target, string mode)
        {
            setSessionID();
            return new IndigoObject(this, checkResult(IndigoLib.indigoSubstructureMatcher(target.self, mode)), target);
        }

        public IndigoObject substructureMatcher(IndigoObject target)
        {
            return substructureMatcher(target, "");
        }

        public IndigoObject extractCommonScaffold(IndigoObject structures, string options)
        {
            setSessionID();
            int res = checkResult(IndigoLib.indigoExtractCommonScaffold(structures.self, options));
            if (res == 0)
            {
                return null;
            }

            return new IndigoObject(this, res);
        }

        public IndigoObject rgroupComposition(IndigoObject structures, string options)
        {
            setSessionID();
            int res = checkResult(IndigoLib.indigoRGroupComposition(structures.self, options));
            if (res == 0)
            {
                return null;
            }

            return new IndigoObject(this, res);
        }

        public IndigoObject getFragmentedMolecule(IndigoObject structures, string options)
        {
            setSessionID();
            int res = checkResult(IndigoLib.indigoGetFragmentedMolecule(structures.self, options));
            if (res == 0)
            {
                return null;
            }

            return new IndigoObject(this, res);
        }

        public IndigoObject toIndigoArray(IEnumerable collection)
        {
            setSessionID();

            IndigoObject arr = createArray();
            foreach (IndigoObject obj in collection)
            {
                arr.arrayAdd(obj);
            }

            return arr;
        }

        public static int[] toIntArray(ICollection collection)
        {
            if (collection == null)
            {
                return new int[0];
            }

            int[] res = new int[collection.Count];
            int i = 0;

            foreach (object x in collection)
            {
                res[i++] = Convert.ToInt32(x);
            }

            return res;
        }

        public static float[] toFloatArray(ICollection collection)
        {
            if (collection == null)
            {
                return new float[0];
            }

            float[] res = new float[collection.Count];
            int i = 0;

            foreach (object x in collection)
            {
                res[i++] = Convert.ToSingle(x);
            }

            return res;
        }

        public IndigoObject extractCommonScaffold(IEnumerable structures, string options)
        {
            return extractCommonScaffold(toIndigoArray(structures), options);
        }

        public IndigoObject decomposeMolecules(IndigoObject scaffold, IndigoObject structures)
        {
            setSessionID();
            return new IndigoObject(this, checkResult(IndigoLib.indigoDecomposeMolecules(scaffold.self, structures.self)));
        }

        public IndigoObject decomposeMolecules(IndigoObject scaffold, IEnumerable structures)
        {
            return decomposeMolecules(scaffold, toIndigoArray(structures));
        }

        public IndigoObject createDecomposer(IndigoObject scaffold)
        {
            setSessionID();
            return new IndigoObject(this, checkResult(IndigoLib.indigoCreateDecomposer(scaffold.self)));
        }

        public IndigoObject reactionProductEnumerate(IndigoObject reaction, IndigoObject monomers)
        {
            setSessionID();
            return new IndigoObject(this, checkResult(IndigoLib.indigoReactionProductEnumerate(reaction.self, monomers.self)));
        }

        public IndigoObject reactionProductEnumerate(IndigoObject reaction, IEnumerable monomers)
        {
            IndigoObject indigoArrayArray = createArray();
            foreach (IEnumerable iter in monomers)
            {
                IndigoObject indigoArray = createArray();
                foreach (IndigoObject monomer in iter)
                {
                    indigoArray.arrayAdd(monomer);
                }
                indigoArrayArray.arrayAdd(indigoArray);
            }
            setSessionID();
            return new IndigoObject(this, checkResult(IndigoLib.indigoReactionProductEnumerate(reaction.self, indigoArrayArray.self)));
        }

        public IndigoObject createSaver(IndigoObject output, string format)
        {
            setSessionID();
            return new IndigoObject(this, checkResult(IndigoLib.indigoCreateSaver(output.self, format)), output);
        }

        public IndigoObject createFileSaver(string filename, string format)
        {
            setSessionID();
            return new IndigoObject(this, checkResult(checkResult(IndigoLib.indigoCreateFileSaver(filename, format))));
        }

        public void transform(IndigoObject reaction, IndigoObject monomer)
        {
            setSessionID();
            checkResult(IndigoLib.indigoTransform(reaction.self, monomer.self));
        }

        public IndigoObject loadBuffer(byte[] buf)
        {
            setSessionID();
            return new IndigoObject(this, checkResult(IndigoLib.indigoLoadBuffer(buf, buf.Length)));
        }

        public IndigoObject loadString(string s)
        {
            setSessionID();
            return new IndigoObject(this, checkResult(IndigoLib.indigoLoadString(s)));
        }

        public IndigoObject iterateSDF(IndigoObject reader)
        {
            setSessionID();
            int result = checkResult(IndigoLib.indigoIterateSDF(reader.self));
            if (result == 0)
            {
                return null;
            }
            return new IndigoObject(this, result, reader);
        }

        public IndigoObject iterateRDF(IndigoObject reader)
        {
            setSessionID();
            int result = checkResult(IndigoLib.indigoIterateRDF(reader.self));
            if (result == 0)
            {
                return null;
            }
            return new IndigoObject(this, result, reader);
        }

        public IndigoObject iterateCML(IndigoObject reader)
        {
            setSessionID();
            int result = checkResult(IndigoLib.indigoIterateCML(reader.self));
            if (result == 0)
            {
                return null;
            }
            return new IndigoObject(this, result, reader);
        }

        public IndigoObject iterateCDX(IndigoObject reader)
        {
            setSessionID();
            int result = checkResult(IndigoLib.indigoIterateCDX(reader.self));
            if (result == 0)
            {
                return null;
            }
            return new IndigoObject(this, result, reader);
        }

        public IndigoObject iterateSmiles(IndigoObject reader)
        {
            setSessionID();
            int result = checkResult(IndigoLib.indigoIterateSmiles(reader.self));
            if (result == 0)
            {
                return null;
            }
            return new IndigoObject(this, result, reader);
        }
        public IndigoObject tautomerEnumerate(IndigoObject molecule, string parameters)
        {
            setSessionID();
            int result = checkResult(IndigoLib.indigoIterateTautomers(molecule.self, parameters));
            if (result == 0)
            {
                return null;
            }
            return new IndigoObject(this, result, molecule);
        }

        public IndigoObject transformHELMtoSCSR(IndigoObject item)
        {
            setSessionID();
            int result = checkResult(IndigoLib.indigoTransformHELMtoSCSR(item.self));
            if (result == 0)
            {
                return null;
            }
            return new IndigoObject(this, result);
        }

        public IndigoObject iterateTautomers(IndigoObject molecule, string parameters)
        {
            setSessionID();
            int result = checkResult(IndigoLib.indigoIterateTautomers(molecule.self, parameters));
            if (result == 0)
            {
                return null;
            }

            return new IndigoObject(this, result, molecule);
        }

        public int buildPkaModel(int level, float threshold, string filename)
        {
            setSessionID();
            return checkResult(IndigoLib.indigoBuildPkaModel(level, threshold, filename));
        }

        public IndigoObject nameToStructure(string name, string parameters)
        {
            if (parameters == null)
            {
                parameters = "";
            }
            setSessionID();
            int result = checkResult(IndigoLib.indigoNameToStructure(name, parameters));
            if (result == 0)
            {
                return null;
            }

            return new IndigoObject(this, result);
        }

        public IndigoObject nameToStructure(string name)
        {
            return nameToStructure(name, "");
        }
    }
}