void _handleInputFile (const char *path, int structures) { if ((strlen(path) > 4 && strcmp(path + strlen(path) - 4, ".sdf") == 0) || (strlen(path) > 7 && strcmp(path + strlen(path) - 7, ".sdf.gz") == 0)) { int item, iter = indigoIterateSDFile(path); while ((item = indigoNext(iter))) { indigoArrayAdd(structures, item); indigoFree(item); } indigoFree(iter); } else if ((strlen(path) > 4 && strcmp(path + strlen(path) - 4, ".rdf") == 0) || (strlen(path) > 7 && strcmp(path + strlen(path) - 7, ".rdf.gz") == 0)) { int item, iter = indigoIterateRDFile(path); while ((item = indigoNext(iter))) { indigoArrayAdd(structures, item); indigoFree(item); } indigoFree(iter); } else if ((strlen(path) > 4 && strcmp(path + strlen(path) - 4, ".smi") == 0) || (strlen(path) > 7 && strcmp(path + strlen(path) - 7, ".smi.gz") == 0)) { int item, iter = indigoIterateSmilesFile(path); while ((item = indigoNext(iter))) { indigoArrayAdd(structures, item); indigoFree(item); } indigoFree(iter); } else if ((strlen(path) > 4 && strcmp(path + strlen(path) - 4, ".cml") == 0)) { int item, iter = indigoIterateCMLFile(path); while ((item = indigoNext(iter))) { indigoArrayAdd(structures, item); indigoFree(item); } indigoFree(iter); } else { int item = indigoLoadMoleculeFromFile(path); indigoArrayAdd(structures, item); indigoFree(item); } }
void renderPair(int s1, int s2, const char* folder, const char* file, int number, const char* title) { int collection = indigoCreateArray(); indigoArrayAdd(collection, s1); indigoArrayAdd(collection, s2); indigoSetOption("render-output-format", "png"); indigoSetOption("render-comment", title); indigoSetOption("render-comment-position", "top"); indigoSetOptionXY("render-image-size", 800, 1000); indigoSetOptionColor("render-background-color", 1.0, 1.0, 1.0); char str[256]; if(number != -1) { sprintf(str, "./%s/%d%s%s%s", folder, number, "_", file, ".png"); } else { sprintf(str, "%s%s", file, ".png"); } indigoRenderGridToFile(collection, NULL, 2, str); indigoFree(collection); }