Reading Molecules From a File¶
IJC can read a variety of molecule file types, handled via MolImporter. MolImporter automatically recognizes file structures, making import a very simple process. The scriptlet below sets up a while loop, one of the most common uses of MolImporter in scripts. This cycles through a SD file, echoing the raw molecule. While it is not echoed, the grabbed molecule (String molStr) is a marvin structure, which is the format to use when inserting into a structures table.
Files can be specified in the code themselves (as above), or you can use JFileChooser to prompt the user for a file.