Hi Gilleain: Thanks for your reply, the st2d.java now works fine with your suggestions. A couple of things I would like to do is to include some text in each cell of the output table, for example include the SMILES strings for each molecule, could you please tell me how can I do that?. Also the picture looks ok but the molecules are drawn with a light grey color instead of black (or blue), how can I change the line color, I have tried "r2dm.setColorAtomsByType(true)" but it doesn't work.
Thanks, Angela -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of [email protected] Sent: Wednesday, April 29, 2009 11:05 PM To: [email protected] Subject: Cdk-user Digest, Vol 35, Issue 16 Send Cdk-user mailing list submissions to [email protected] To subscribe or unsubscribe via the World Wide Web, visit https://lists.sourceforge.net/lists/listinfo/cdk-user or, via email, send a message with subject or body 'help' to [email protected] You can reach the person managing the list at [email protected] When replying, please edit your Subject line so it is more specific than "Re: Contents of Cdk-user digest..." Today's Topics: 1. Question on Tabular Display of 2D Structures (Beesley, Angela) 2. Re: Question on Tabular Display of 2D Structures (gilleain torrance) 3. Re: Question on Tabular Display of 2D Structures (Rajarshi Guha) 4. Re: substructure searching (Loren Lenzen) ---------------------------------------------------------------------- Message: 1 Date: Wed, 29 Apr 2009 17:54:07 +0100 From: "Beesley, Angela" <[email protected]> Subject: [Cdk-user] Question on Tabular Display of 2D Structures To: <[email protected]> Message-ID: <228e7457ea797c40937ee70569b189c5027c0...@brbsevs20008.s2.ms.unilever.co M> Content-Type: text/plain; charset="us-ascii" Dear Rajarshi: Thanks for your prompt reply to my previous question, I managed to calculate AlogP correctly and to run the DescriptorEngine fine. As I said I am starting with cdk and with java in general, hence my struggling. I was trying to compile and run the example that you have in your web page regarding tabular display of 2D structures, I downloaded the jgrapht library and it is in my classpath. I also have the StructureDiagramGenerator class. However there are a few things that I don't understand from the program, here are the questions: 1. The program requires to import org.openscience.cdk.renderer.Renderer2D, I don't seem to have this but instead I have "org.penscience.cdk.renderer.Java2DRenderer" is this the same? 2. If so, I need to change line 121 to "Java2Drender renderer;" and line 130 to "renderer=new Java2DRenderer;", don't I? 3. On line 123 it appears "getAtomAt(i)", is this "getAtom(i)"? 4. On line 170 it appears: renderer.paintMolecule(this.mol,(Graphics2D)g,true); ... this shows an error, can I change it to: renderer.paintMolecule(this.mol,(Graphics2D)g); ...this seems to be ok. 5. On line 292, where st2d is declared, the error message shows "class st2d is public should be declared in a file name st2d.java". Do I need to download st2d.java? 6. Problems on line 321 and 322. It appears: IAtomContainer [] c = ChemFileManipulator......., this generates and error, can I chage it to: List<IAtomContainer> c = ChemFileManipulator......, this seems to be ok. Sorry if these questions are too basic! I am picking up more and more everyday. Cheers, Angela -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of [email protected] Sent: Wednesday, April 29, 2009 1:02 PM To: [email protected] Subject: Cdk-user Digest, Vol 35, Issue 15 Send Cdk-user mailing list submissions to [email protected] To subscribe or unsubscribe via the World Wide Web, visit https://lists.sourceforge.net/lists/listinfo/cdk-user or, via email, send a message with subject or body 'help' to [email protected] You can reach the person managing the list at [email protected] When replying, please edit your Subject line so it is more specific than "Re: Contents of Cdk-user digest..." Today's Topics: 1. Re: Question on descriptors (Rajarshi Guha) ---------------------------------------------------------------------- Message: 1 Date: Tue, 28 Apr 2009 09:26:33 -0400 From: Rajarshi Guha <[email protected]> Subject: Re: [Cdk-user] Question on descriptors To: "Beesley, Angela" <[email protected]> Cc: [email protected] Message-ID: <[email protected]> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes On Apr 27, 2009, at 12:25 PM, Beesley, Angela wrote: > Hi, > > I am very new on cdk and on java in general so I am struggling a bit > with the syntaxis and construction of commands. I managed to read a > .sdf file and calculate smiles, now I am trying to calculate AlogP > values, however all values return 0.0, I think that I have a problem > with explicit hydrogens. The descriptor will add explicit H's > This is what i've done: > > IChemObjectBuilder builder = > NoNotificationChemObjectBuilder.getInstance(); > IMolecule molecule = builder.newMolecule(); > molecule.addAtom(builder.newAtom("C")); > molecule.addAtom(builder.newAtom("C")); > molecule.addAtom(builder.newAtom("O")); > molecule.addAtom(builder.newAtom("C")); You don't seem to be adding any bonds between these atoms and hence the atom typing will not be correct > CDKAtomTypeMatcher matcher = > CDKAtomTypeMatcher.getInstance(molecule.getBuilder()); > for (IAtom atom : molecule.atoms()) { > IAtomType type = matcher.findMatchingAtomType(molecule, atom); > AtomTypeManipulator.configure(atom, type); } Consider using AtomContainerManipulator.perceiveAtomTypesAndConfigureAtoms to do it all at one go > Also, on using the calculation of Individual Descriptors I have no > problems (except the AlogP) but when using DescriptorEngine how can I > get the numerical values of each descriptor?, so far I have used: If you're not adding the bonds, I wonder about the validity of those descriptor values > DescriptorEngine engine = new > DescriptorEngine(DescriptorEngine.MOLECULAR); > engine.process(molecule); > but from then I don't know how to get each descriptor separately with > their corresponding names. For a given decsriptor get its DescriptorSpecification object and then use that as the key in the getProperty method of IAtomContainer. You can get the list of available specification objects via DescriptorEngine.getDescriptorSpecifications() ------------------------------------------------------------------- Rajarshi Guha <[email protected]> GPG Fingerprint: D070 5427 CC5B 7938 929C DD13 66A1 922C 51E7 9E84 ------------------------------------------------------------------- Q: What's polite and works for the phone company? A: A deferential operator. ------------------------------ ------------------------------------------------------------------------ ------ Register Now & Save for Velocity, the Web Performance & Operations Conference from O'Reilly Media. Velocity features a full day of expert-led, hands-on workshops and two days of sessions from industry leaders in dedicated Performance & Operations tracks. Use code vel09scf and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf ------------------------------ _______________________________________________ Cdk-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/cdk-user End of Cdk-user Digest, Vol 35, Issue 15 **************************************** ------------------------------ Message: 2 Date: Wed, 29 Apr 2009 19:35:22 +0100 From: gilleain torrance <[email protected]> Subject: Re: [Cdk-user] Question on Tabular Display of 2D Structures To: [email protected] Message-ID: <[email protected]> Content-Type: text/plain; charset=ISO-8859-1 hi, I would recommend using the method: renderer.paintMolecule(this.mol, (Graphics2D)g, this.getBounds()); as the Java2DRenderer needs to know what size the canvas is (actually, only the first time it paints, but no matter). I couldn't get the lines after 323 to work properly, so I used this instead: IteratingMDLReader reader = new IteratingMDLReader(new FileReader(input), DefaultChemObjectBuilder.getInstance()); while (reader.hasNext()) { StructureDiagramGenerator sdg = new StructureDiagramGenerator(); sdg.setMolecule((IMolecule)reader.next()); sdg.generateCoordinates(); v.add((Object)sdg.getMolecule()); } which works for sdf files, anyway. It may not be the ideal way to do it, but anyway. gilleain torrance On Wed, Apr 29, 2009 at 5:54 PM, Beesley, Angela <[email protected]> wrote: > Dear Rajarshi: > > Thanks for your prompt reply to my previous question, I managed to > calculate AlogP correctly and to run the DescriptorEngine fine. As I > said I am starting with cdk and with java in general, hence my > struggling. I was trying to compile and run the example that you have > in your web page regarding tabular display of 2D structures, I > downloaded the jgrapht library and it is in my classpath. I also have > the StructureDiagramGenerator class. However there are a few things > that I don't understand from the program, here are the questions: > > 1. The program requires to import > org.openscience.cdk.renderer.Renderer2D, I don't seem to have this but > instead I have "org.penscience.cdk.renderer.Java2DRenderer" is this > the same? > 2. If so, I need to change line 121 to "Java2Drender renderer;" and > line 130 to "renderer=new Java2DRenderer;", don't I? > 3. On line 123 it appears "getAtomAt(i)", is this "getAtom(i)"? > 4. On line 170 it appears: > > renderer.paintMolecule(this.mol,(Graphics2D)g,true); ... this shows an > error, can I change it to: > renderer.paintMolecule(this.mol,(Graphics2D)g); ...this seems to be ok. > > 5. On line 292, where st2d is declared, the error message shows "class > st2d is public should be declared in a file name st2d.java". Do I need > to download st2d.java? > 6. Problems on line 321 and 322. It appears: > > IAtomContainer [] c = ChemFileManipulator......., this generates and > error, can I chage it to: > List<IAtomContainer> c = ChemFileManipulator......, this seems to be ok. > > Sorry if these questions are too basic! I am picking up more and more > everyday. > > Cheers, > > Angela > > > > -----Original Message----- > From: [email protected] > [mailto:[email protected]] On Behalf Of > [email protected] > Sent: Wednesday, April 29, 2009 1:02 PM > To: [email protected] > Subject: Cdk-user Digest, Vol 35, Issue 15 > > Send Cdk-user mailing list submissions to ? ? ? > [email protected] > > To subscribe or unsubscribe via the World Wide Web, visit ? ? ? > ?https://lists.sourceforge.net/lists/listinfo/cdk-user > or, via email, send a message with subject or body 'help' to ? ? ? > [email protected] > > You can reach the person managing the list at ? ? ? > [email protected] > > When replying, please edit your Subject line so it is more specific > than > "Re: Contents of Cdk-user digest..." > > > Today's Topics: > > ? 1. Re: Question on descriptors (Rajarshi Guha) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Tue, 28 Apr 2009 09:26:33 -0400 > From: Rajarshi Guha <[email protected]> > Subject: Re: [Cdk-user] Question on descriptors > To: "Beesley, Angela" <[email protected]> > Cc: [email protected] > Message-ID: <[email protected]> > Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes > > > On Apr 27, 2009, at 12:25 PM, Beesley, Angela wrote: > >> Hi, >> >> I am very new on cdk and on java in general so I am struggling a bit >> with the syntaxis and construction of commands. I managed to read a >> .sdf file and calculate smiles, now I am trying to calculate AlogP >> values, however all values return 0.0, I think that I have a problem >> with explicit hydrogens. > > The descriptor will add explicit H's > >> This is what i've done: >> >> IChemObjectBuilder builder = >> NoNotificationChemObjectBuilder.getInstance(); >> IMolecule molecule = builder.newMolecule(); >> molecule.addAtom(builder.newAtom("C")); >> molecule.addAtom(builder.newAtom("C")); >> molecule.addAtom(builder.newAtom("O")); >> molecule.addAtom(builder.newAtom("C")); > > You don't seem to be adding any bonds between these atoms and hence > the atom typing will not be correct > >> CDKAtomTypeMatcher matcher = >> CDKAtomTypeMatcher.getInstance(molecule.getBuilder()); >> for (IAtom atom : molecule.atoms()) { ? ? ?IAtomType type = >> matcher.findMatchingAtomType(molecule, atom); ? ? >> ?AtomTypeManipulator.configure(atom, type); } > > Consider using > AtomContainerManipulator.perceiveAtomTypesAndConfigureAtoms to do it > all at one go > >> Also, on using the calculation of Individual Descriptors I have no >> problems (except the AlogP) but when using DescriptorEngine how can I >> get the numerical values of each descriptor?, so far I have used: > > If you're not adding the bonds, I wonder about the validity of those > descriptor values > >> ?DescriptorEngine engine = new >> DescriptorEngine(DescriptorEngine.MOLECULAR); >> engine.process(molecule); >> but from then I don't know how to get each descriptor separately with >> their corresponding names. > > For a given decsriptor get its DescriptorSpecification object and then > use that as the key in the getProperty method of IAtomContainer. You > can get the list of available specification objects via > DescriptorEngine.getDescriptorSpecifications() > > ------------------------------------------------------------------- > Rajarshi Guha ?<[email protected]> > GPG Fingerprint: D070 5427 CC5B 7938 929C ?DD13 66A1 922C 51E7 9E84 > ------------------------------------------------------------------- > Q: ?What's polite and works for the phone company? > A: ?A deferential operator. > > > > > > ------------------------------ > > ---------------------------------------------------------------------- > -- > ------ > Register Now & Save for Velocity, the Web Performance & Operations > Conference from O'Reilly Media. Velocity features a full day of > expert-led, hands-on workshops and two days of sessions from industry > leaders in dedicated Performance & Operations tracks. Use code > vel09scf and Save an extra 15% before 5/3. > http://p.sf.net/sfu/velocityconf > > ------------------------------ > > _______________________________________________ > Cdk-user mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/cdk-user > > > End of Cdk-user Digest, Vol 35, Issue 15 > **************************************** > > ---------------------------------------------------------------------- > -------- Register Now & Save for Velocity, the Web Performance & > Operations Conference from O'Reilly Media. Velocity features a full > day of expert-led, hands-on workshops and two days of sessions from > industry leaders in dedicated Performance & Operations tracks. Use > code vel09scf and Save an extra 15% before 5/3. > http://p.sf.net/sfu/velocityconf > _______________________________________________ > Cdk-user mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/cdk-user > ------------------------------ Message: 3 Date: Wed, 29 Apr 2009 16:26:38 -0400 From: Rajarshi Guha <[email protected]> Subject: Re: [Cdk-user] Question on Tabular Display of 2D Structures To: "Beesley, Angela" <[email protected]> Cc: [email protected] Message-ID: <[email protected]> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes I haven't touched that code is some time and I think the code is old enough, that the renderer API has totally changed. Gilleain should be better able to help out. PS. Another issue is that CDK 1.2.x (and master) don't contain the latest renderer code, AFAIK, which is a pain. On Apr 29, 2009, at 12:54 PM, Beesley, Angela wrote: > Dear Rajarshi: > > Thanks for your prompt reply to my previous question, I managed to > calculate AlogP correctly and to run the DescriptorEngine fine. As I > said I am starting with cdk and with java in general, hence my > struggling. I was trying to compile and run the example that you have > in your web page regarding tabular display of 2D structures, I > downloaded the jgrapht library and it is in my classpath. I also have > the StructureDiagramGenerator class. However there are a few things > that I don't understand from the program, here are the questions: > > 1. The program requires to import > org.openscience.cdk.renderer.Renderer2D, I don't seem to have this but > instead I have "org.penscience.cdk.renderer.Java2DRenderer" is this > the same? > 2. If so, I need to change line 121 to "Java2Drender renderer;" and > line 130 to "renderer=new Java2DRenderer;", don't I? > 3. On line 123 it appears "getAtomAt(i)", is this "getAtom(i)"? > 4. On line 170 it appears: > > renderer.paintMolecule(this.mol,(Graphics2D)g,true); ... this shows an > error, can I change it to: > renderer.paintMolecule(this.mol,(Graphics2D)g); ...this seems to be > ok. > > 5. On line 292, where st2d is declared, the error message shows "class > st2d is public should be declared in a file name st2d.java". Do I need > to download st2d.java? > 6. Problems on line 321 and 322. It appears: > > IAtomContainer [] c = ChemFileManipulator......., this generates and > error, can I chage it to: > List<IAtomContainer> c = ChemFileManipulator......, this seems to be > ok. > > Sorry if these questions are too basic! I am picking up more and more > everyday. > > Cheers, > > Angela > > > > -----Original Message----- > From: [email protected] > [mailto:[email protected]] On Behalf Of > [email protected] > Sent: Wednesday, April 29, 2009 1:02 PM > To: [email protected] > Subject: Cdk-user Digest, Vol 35, Issue 15 > > Send Cdk-user mailing list submissions to > [email protected] > > To subscribe or unsubscribe via the World Wide Web, visit > https://lists.sourceforge.net/lists/listinfo/cdk-user > or, via email, send a message with subject or body 'help' to > [email protected] > > You can reach the person managing the list at > [email protected] > > When replying, please edit your Subject line so it is more specific > than > "Re: Contents of Cdk-user digest..." > > > Today's Topics: > > 1. Re: Question on descriptors (Rajarshi Guha) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Tue, 28 Apr 2009 09:26:33 -0400 > From: Rajarshi Guha <[email protected]> > Subject: Re: [Cdk-user] Question on descriptors > To: "Beesley, Angela" <[email protected]> > Cc: [email protected] > Message-ID: <[email protected]> > Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes > > > On Apr 27, 2009, at 12:25 PM, Beesley, Angela wrote: > >> Hi, >> >> I am very new on cdk and on java in general so I am struggling a bit >> with the syntaxis and construction of commands. I managed to read a >> .sdf file and calculate smiles, now I am trying to calculate AlogP >> values, however all values return 0.0, I think that I have a problem >> with explicit hydrogens. > > The descriptor will add explicit H's > >> This is what i've done: >> >> IChemObjectBuilder builder = >> NoNotificationChemObjectBuilder.getInstance(); >> IMolecule molecule = builder.newMolecule(); >> molecule.addAtom(builder.newAtom("C")); >> molecule.addAtom(builder.newAtom("C")); >> molecule.addAtom(builder.newAtom("O")); >> molecule.addAtom(builder.newAtom("C")); > > You don't seem to be adding any bonds between these atoms and hence > the atom typing will not be correct > >> CDKAtomTypeMatcher matcher = >> CDKAtomTypeMatcher.getInstance(molecule.getBuilder()); >> for (IAtom atom : molecule.atoms()) { >> IAtomType type = matcher.findMatchingAtomType(molecule, atom); >> AtomTypeManipulator.configure(atom, type); } > > Consider using > AtomContainerManipulator.perceiveAtomTypesAndConfigureAtoms to do it > all at one go > >> Also, on using the calculation of Individual Descriptors I have no >> problems (except the AlogP) but when using DescriptorEngine how can I >> get the numerical values of each descriptor?, so far I have used: > > If you're not adding the bonds, I wonder about the validity of those > descriptor values > >> DescriptorEngine engine = new >> DescriptorEngine(DescriptorEngine.MOLECULAR); >> engine.process(molecule); >> but from then I don't know how to get each descriptor separately with >> their corresponding names. > > For a given decsriptor get its DescriptorSpecification object and then > use that as the key in the getProperty method of IAtomContainer. You > can get the list of available specification objects via > DescriptorEngine.getDescriptorSpecifications() > > ------------------------------------------------------------------- > Rajarshi Guha <[email protected]> > GPG Fingerprint: D070 5427 CC5B 7938 929C DD13 66A1 922C 51E7 9E84 > ------------------------------------------------------------------- > Q: What's polite and works for the phone company? > A: A deferential operator. > > > > > > ------------------------------ > > ---------------------------------------------------------------------- > -- > ------ > Register Now & Save for Velocity, the Web Performance & Operations > Conference from O'Reilly Media. Velocity features a full day of > expert-led, hands-on workshops and two days of sessions from industry > leaders in dedicated Performance & Operations tracks. Use code > vel09scf and Save an extra 15% before 5/3. > http://p.sf.net/sfu/velocityconf > > ------------------------------ > > _______________________________________________ > Cdk-user mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/cdk-user > > > End of Cdk-user Digest, Vol 35, Issue 15 > **************************************** > > ---------------------------------------------------------------------- > -------- Register Now & Save for Velocity, the Web Performance & > Operations Conference from O'Reilly Media. Velocity features a full > day of expert-led, hands-on workshops and two days of sessions from > industry leaders in dedicated Performance & Operations tracks. Use > code vel09scf and Save an extra 15% before 5/3. > http://p.sf.net/sfu/velocityconf > _______________________________________________ > Cdk-user mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/cdk-user ------------------------------------------------------------------- Rajarshi Guha <[email protected]> GPG Fingerprint: D070 5427 CC5B 7938 929C DD13 66A1 922C 51E7 9E84 ------------------------------------------------------------------- Q: What's polite and works for the phone company? A: A deferential operator. ------------------------------ Message: 4 Date: Wed, 29 Apr 2009 17:05:37 -0500 From: Loren Lenzen <[email protected]> Subject: Re: [Cdk-user] substructure searching To: [email protected] Message-ID: <of0acff119.ea2620e9-on862575a7.00793b6f-862575a7.00794...@sial.com> Content-Type: text/plain; charset="us-ascii" Rajarshi, thanks for your help on the SMARTSQueryTool. I tried to look back at the history of the SQT and UIT, but am unclear on the algorithm used. Is it Ullman, VF2, Hanser, or a mishmash? The description of UIT in the Javadoc says Hanser, but based on recent blog postings, it seems as though SQT might use Ullman, and I was under the impression that SQT is a wrapper of UIT. Does SQT.matches(IAtomContainer atomContainer) return after a single match or does it find all matches first? If the latter, would there be any problems extending the method to a type like SQT.matches(IAtomContainer atomContainer, boolean forceInitialization, boolean singleMatch) where the method would immediately return True on finding a single match if set to True? Obviously, one would have to be careful to not use countMatches, etc. This message and any files transmitted with it are the property of Sigma-Aldrich Corporation, are confidential, and are intended solely for the use of the person or entity to whom this e-mail is addressed. If you are not one of the named recipient(s) or otherwise have reason to believe that you have received this message in error, please contact the sender and delete this message immediately from your computer. Any other use, retention, dissemination, forwarding, printing, or copying of this e-mail is strictly prohibited. -------------- next part -------------- An HTML attachment was scrubbed... ------------------------------ ------------------------------------------------------------------------ ------ Register Now & Save for Velocity, the Web Performance & Operations Conference from O'Reilly Media. Velocity features a full day of expert-led, hands-on workshops and two days of sessions from industry leaders in dedicated Performance & Operations tracks. Use code vel09scf and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf ------------------------------ _______________________________________________ Cdk-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/cdk-user End of Cdk-user Digest, Vol 35, Issue 16 **************************************** ------------------------------------------------------------------------------ Register Now & Save for Velocity, the Web Performance & Operations Conference from O'Reilly Media. Velocity features a full day of expert-led, hands-on workshops and two days of sessions from industry leaders in dedicated Performance & Operations tracks. Use code vel09scf and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf _______________________________________________ Cdk-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/cdk-user

