On 31.05.2011 21:00, Egon Willighagen wrote: > Yes, the SDG does not handle disconnected structures.
Clear. > The proper way of doing is, is to check first of the IAtomContainer > you got from the getInChIToStructure() method is connected (using the > ConnectivityCehcker) and to partition is if not. Thanks. That is new to me... Have anybody come across the problem of rendering a IMoleculeSet? What about rendering reactions in CML format? > I do not understand this question. And IAtomContainer and IMolecule to > be the same by implementation is just because we do not want the > IMolecule to check if an edit results in a disconnected structure > (computationally expensive). But the semantics are there. OK, I got the point: IAtomContainer may contain disconnected structures and IMolecule may not (but only semantically; programmer may still mess things). On the other hand InChI at the moment do not support mixtures, at least I am not aware of any InChI, that encodes 2 molecules in one string. But in general you are right: potentially (in the nearest future) InChI may be able to encode several molecules. Thanks also for code snippet below. Hopefully I'll do some effort to improve this peace of API. >> And second is that getInChIToStructure() needs to be passed a >> IChemObjectBuilder instance, which most cases is a CDK default one. > > Yeah, I'm wondering why, because the nonotify classes are in fact faster. > I guess performance is not so important after all :) > >> Perhaps the API should include the set of methods without >> IChemObjectBuilder argument. > > Yes, I have been thinking about that. We could instantiate a > ChemObjectBuilderFactory, which will try to load one of the two main > implementations. This will most certainly not work for all situations > (e.g. not in Bioclipse or any other place with custom class loaders, > unless we start making the Factory instantiated with that custom > ClassLoader...)... > > Something like: > > /** > * @cdk.module core > */ > public class ChemObjectFactory { > > public abstract IChemObjectBuilder getBuilder(ClassLoader loader) > throws ClassNotFoundException, InstantiationException { > String[] knownBuilders = new String[ > "org.openscience.cdk.nonotify.NoNotificationChemObjectBuilder", > "org.openscience.cdk.nonotify.DefaultChemObjectBuilder" > ]; > for (int i=0; i<knownBuilders.length; i++) { > IChemObjectBuilder builder = > loader.loadClass(knownBuilders[i]).getInstance(); > return builder; > } > } > return new SomeAppropriateException(); > } > > Finish the patch (full JavaDoc, unit testsing, etc, etc), two people > to approve of the patch, and I'll apply it to cdk-1.4.x. > > Egon -- With best regards, Dmitry ------------------------------------------------------------------------------ Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Data protection magic? Nope - It's vRanger. Get your free trial download today. http://p.sf.net/sfu/quest-sfdev2dev _______________________________________________ Cdk-user mailing list Cdk-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/cdk-user