User 143c71d535
19-06-2008 12:52:14
Is there a way to determine if a mol string is valid or not? Before attempting to display the molecule via MarvinView, I would like to be able to detect whether or not the mol string is valid (will actually display), and when it is not going to be displayed, display a message to our users instead of a blank box (applet with nothing displayed). Thanks!
ChemAxon 7c2d26e5cf
19-06-2008 14:00:07
To test the molecule string, I suggest to convert it into another format. If MolConverter does not indicate error, the molecule may be correct.
User 143c71d535
19-06-2008 14:57:21
I need to do the validation 'programmatically' (i.e. not interactively). Specifically, it needs to be done either via C# on the server, or maybe via Javascript on the client. This is part of a .NET, browser-based application.
ChemAxon 7c2d26e5cf
20-06-2008 16:01:08
You can use the
MolImporter API (that is part of the Marvin Beans package) to read molecule source. MolImporter will throw exception if you try to import an invalid molecule.
| Code: |
MolImporter importer;
try {
importer = new MolImporter(args[0]);
Molecule mol = importer.read();
} catch(MolFormatException mex) {
// invalid molecule format
} catch(IOException ioex) {
// invalid molecule or any other read error
} |
Via, JNBridge you can access the full Marvin Beans API. See the details in the following document: .NET support
User 870ab5b546
23-06-2008 01:08:42
You can put the above code into a JSP page, so that it runs upon compilation and display to the user; it doesn't need to be in a separate back-end file.