Hi Matt, yes, I wrote all of the stochastic code - the deterministic generator by Junfeng Hao has been deprecated and removed in the last CDK. The RandomGenerator should do what you need. The VicinitySampler really is supposed to look at the complete Faulon Neighborhood, which means it exhaustively takes all combinations of four atoms in the molecule and creates performs a Faulon Mutation to create a neighbor. The mutation is described in Faulons Simulated Annealing paper (year 1996, I think).
Cheers, Chris Ketterer, Matthew James wrote: > Sorry I had missed pasteing in the first blank line of output. When i > do structures.size(), I get zero as the output of the first blank > line(added below). > > Also, did you create the other structgen module classes as well? I > don't necessarily need to create every constitutional isomer there is, > if that is what the Faulon vicinity is (I need to read up on this), but > I'm trying to simply get more complex structures from strings so I can > use them for doing some genetic algorithm, such as trying to select them > based on good pharmacaphore properties( such as M.W., # of rotatable > bonds, etc.) to create a library of compounds to screen. > So I was wondering if RandomGenerator would work or if I should try to > write a simpler code that would give a random arrangement and then check > to see if it is unique. > > Thanks, > > Matt > > Quoting Christoph Steinbeck <steinb...@ebi.ac.uk>: > >> Hi Matthew, >> >> the VicinitySampler is a crime that I committed a long time ago. >> It has not been tested through at least four years of CDK development >> and is therefore quite unlikeyl to work out of the box. >> >> The sampler will not need hydrogens attached but assigned as implicit. >> >> What exactly do you mean by "not working"? :-) >> It seems that the sampler produces "something". >> >> Cheers, >> >> Chris >> >> Ketterer, Matthew James wrote: >>> Hello, >>> I am an undergraduate trying to write some code to generate some >>> molecules from random smiles strings. I want to use the >>> VicinitySampler or other constitutional isomer generator, but I >>> tried to input some code based on the VicinitySamplertest and it >>> isn't working. I am using the CDK by importing the jar files into >>> Eclipse. I'm not sure if I need to add hydrogens after creating the >>> molecule. I also tried using a simple smiles string from the test >>> rather than the one created below but the molecule seems to be >>> built. Thanks for any help. Here is my code: >>> >>> import org.openscience.cdk.exception.InvalidSmilesException; >>> import org.openscience.cdk.graph.ConnectivityChecker; >>> import org.openscience.cdk.interfaces.IMolecule; >>> import org.openscience.cdk.smiles.*; >>> import org.openscience.cdk.structgen.*; >>> >>> import org.openscience.cdk.DefaultChemObjectBuilder; >>> import java.util.List; >>> import java.util.Random; >>> >>> >>> public class RandomString { >>> >>> static final char[] _chars = >>> { 'C','C','C','O','O','N','N','C', }; >>> >>> static Random _r = new Random(); >>> >>> static void randomStr(char[] buf, int len) { >>> for (int i = 0; i < len; i++) { >>> buf[i] = _chars[_r.nextInt(8)]; >>> } >>> } >>> >>> >>> >>> public static void main(String[] args) throws >>> InvalidSmilesException { >>> char[] buf = new char[5]; >>> String s; >>> randomStr(buf, 5); >>> s = new String(buf); >>> SmilesParser sp = new >>> SmilesParser(DefaultChemObjectBuilder.getInstance()); >>> IMolecule mol = sp.parseSmiles(s); >>> >>> List structures = VicinitySampler.sample(mol); >>> System.out.print(structures.size() + "\n"); >>> System.out.print(mol.getAtomCount()+ "\n"); >>> System.out.print(mol.getFirstAtom() + " \n"); >>> System.out.print(ConnectivityChecker.isConnected(mol)); >>> >>> >>> } >>> } >>> ## And here is the output >>> >>> 5 >>> 4 >>> Atom(9532399, C, H:3, SP:0, 2D:[null], 3D:[null], Fract3D:[null], >>> C:0.0, FC:0, AtomType(null, MBO:0.0, BOS:0.0, FC:0, H:0, NC:0, >>> CR:0.0, VDWR:0.0, EV:0, Isotope(0, EM:-1.0, AB:-1.0, Element(C, >>> ID:null, AN:0)))) >>> true >>> >>> >>> ------------------------------------------------------------------------------ >>> >>> >>> Check out the new SourceForge.net Marketplace. >>> It is the best place to buy or sell services for >>> just about anything Open Source. >>> http://p.sf.net/sfu/Xq1LFB >>> _______________________________________________ >>> Cdk-user mailing list >>> Cdk-user@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/cdk-user >> >> >> -- >> Dr. Christoph Steinbeck >> Head of Chemoinformatics and Metabolism >> European Bioinformatics Institute (EBI) >> Wellcome Trust Genome Campus >> Hinxton, Cambridge CB10 1SD UK >> Phone +44 1223 49 2640 >> >> What is man but that lofty spirit - that sense of enterprise. >> ... Kirk, "I, Mudd," stardate 4513.3.. >> >> > > -- Dr. Christoph Steinbeck Head of Chemoinformatics and Metabolism European Bioinformatics Institute (EBI) Wellcome Trust Genome Campus Hinxton, Cambridge CB10 1SD UK Phone +44 1223 49 2640 What is man but that lofty spirit - that sense of enterprise. ... Kirk, "I, Mudd," stardate 4513.3.. ------------------------------------------------------------------------------ Check out the new SourceForge.net Marketplace. It is the best place to buy or sell services for just about anything Open Source. http://p.sf.net/sfu/Xq1LFB _______________________________________________ Cdk-user mailing list Cdk-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/cdk-user