Hi,
Yes your changes look correct. Unfortunately the API changed a lot between
1.4 and 1.5.
The true/false specifies whether to calculate aromaticity:
https://github.com/cdk/cdk/blob/master/descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/molecular/BCUTDescriptor.java#L154
It depends on the descriptor but you should either set it to true, or
preferably calculate the aromaticity your self.
Aromaticity arom = new Aromaticity(ElectronDonctation.daylight(),
> Cycles.or(Cycles.all(), Cycles.all(6)));
> while (mdl.hasNext()) {
> IAtomContainer mol = mdl.next();
> arom.apply(mol);
> }
There are lots of options for which aromaticity model to use, see:
http://cdk.github.io/cdk/2.0/docs/api/index.html
On 11 March 2017 at 09:51, 丁雷 <fatetestarossa...@gmail.com> wrote:
> Dear John
>
> Thanks for your contribution to the CDK project. I am a newcomer to the
> CDK and Java, so I have followed the guideness on the webpage of github to
> build CDK and create the JavaDoc from the source code which was downloaded
> via the webpage of sourceforge. But I failed to build CDK unless I chose to
> skip the tests, and I failed to create the JavaDoc either. So I had to
> directly download the .jar files from sourceforge. *I don't know whether
> the reason lies in the version of CDK and JDK I have used.*
>
> Then I typed the source code of calculateBCUT.java (on the webpage
> http://www.redbrick.dcu.ie/~noel/CDKJython.html) into Netbeans IDE 8.2 to
> test CDK and my Java environment. Unfortunatly, there are some errors in
> the source code which are pointed out by Netbeans, such as not
> finding Descriptor class, IteratingMDLReader class, Molecule class. So I
> modified the source code by reading the JavaDoc to make it run. Following
> is the modified code:
>
> import org.openscience.cdk.*;
> import org.openscience.cdk.qsar.*;
> import org.openscience.cdk.io.iterator.IteratingSDFReader;
> import org.openscience.cdk.exception.CDKException;
> import org.openscience.cdk.qsar.result.*;
> import org.openscience.cdk.qsar.descriptors.molecular.BCUTDescriptor;
> import java.io.*;
>
> /**
> *
> * @author NanoFate
> */
> public class CalculateBCUT {
>
> /**
> * @param args the command line arguments
> */
> public static void main(String[] args) throws CDKException {
> FileReader sdfile=null;
> try {
> sdfile=new FileReader(new File(args[0]));
> } catch (FileNotFoundException e) {
> System.err.println("File not found: "+args[0]);
> System.exit(1);
> } catch (ArrayIndexOutOfBoundsException e) {
> System.err.println("You need to give the name of an .sd
> file.");
> System.exit(1);
> }
> // Descriptor bcut=new BCUTDescriptor();
> BCUTDescriptor bcut=new BCUTDescriptor();
> // bcut.setParameters(new Object[] {1,1});
> bcut.setParameters(new Object[] {1, 1, false});
> // IteratingMDLReader myiter=new IteratingMDLReader(sdfile);
> IteratingSDFReader myiter=new IteratingSDFReader(sdfile,
> DefaultChemObjectBuilder.getInstance());
> // Molecule mol=null;
> AtomContainer mol=null;
> while (myiter.hasNext()) {
> // mol=(Molecule)myiter.next();
> mol=(AtomContainer)myiter.next();
> DoubleArrayResult BCUTvalue=(DoubleArrayResult)
> bcut.calculate(mol).getValue();
> System.out.print(BCUTvalue.get(0));
> for (int i=1; i<6; i++) {
> System.out.print("\t"+BCUTvalue.get(i));
> }
> System.out.print("\n");
> }
> }
> }
>
> The text behind the "//" symbol is the original code. *I would like to
> know whether my modification is correct.*
>
> What's more, the result of the original code shows on the webpage is
> "11.996163377263015 15.998263783541644 -0.41661438592771444
> 0.08657868420569534 5.618366876046048 11.845146625965969". The result
> generated from my modified code is "11.996163377277325 15.99826380352772
> -0.4172826456748383 0.08593815726116673 5.421561166888827
> 11.691340132916682". And if I change the statement bcut.setParameters to
> "bcut.setParameters(new Object[] {1, 1, true});", the result changes to
> "11.996163377277325 15.99826380352772 -0.4172826456748383
> 0.08593815726116673 5.03756330128007 11.421637440625194".
>
> *So I would like to know the reason of the deviation of the result and the
> difference between true and false in the statement bcut.setParameters.*
>
> Thank you very much!
>
> Your sincerely
>
> Lei Ding
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Cdk-user mailing list
Cdk-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdk-user