Re: [Cdk-user] Reg: Reading Jmol generated SDF file using Iterating SDF reader cdk 1.5.8

2019-11-17 Thread John Mayfield
IIRC JMol was generating them incorrectly, Bob (JMol dev) patched it and we
also updated our code to be more tolerant. Please try CDK 2.3 and if there
is still an issue report via GitHub Issues.

On Sun, 17 Nov 2019 at 09:50, Vinothkumar Mohanakrishnan 
wrote:

> Dear Users,
>
> I would like to read a SDF file using IteratingSDFReader. The SDF file is 
> generated by jmol (see below).
>
> U:/research/project_opas/Code/MVC_OPAS/build/check.sdf
> __Jmol-14_11161922023D 1   1.0 0.0 0
> Jmol version 14.9.1  2017-02-18 13:47 EXTRACT: ({0:43})
>  22 22  0  0  0  0  1 V2000
>  -10.26842  21.30587  -2.02430 N   0  0  0  0  0  0
>  -11.14109  20.23272  -2.39821 C   0  0  0  0  0  0
>  -10.84018  18.85777  -1.92734 C   0  0  0  0  0  0
>  -11.60011  17.94142  -2.23013 O   0  0  0  0  0  0
>  -12.38167  20.49262  -3.21797 C   0  0  0  0  0  0
>  -12.66761  21.93940  -3.49472 C   0  0  0  0  0  0
>  -13.73838  22.56509  -3.02287 C   0  0  0  0  0  0
>  -11.88128  22.81522  -4.30956 N   0  0  0  0  0  0
>  -12.65747  24.01784  -4.21934 C   0  0  0  0  0  0
>  -13.70560  23.88527  -3.49217 N   0  0  0  0  0  0
>   -9.64144  18.61510  -1.15438 N   0  0  0  0  0  0
>   -6.47461  15.46647   0.53840 C   0  0  0  0  0  0
>   -5.16207  15.52031  -0.21484 C   0  0  0  0  0  0
>   -4.06313  15.41673   0.72449 N   0  0  0  0  0  0
>   -9.80464  17.44463  -0.29800 C   0  0  0  0  0  0
>   -8.64600  16.48725  -0.41087 C   0  0  0  0  0  0
>   -8.90795  15.33022  -1.01563 C   0  0  0  0  0  0
>   -7.33993  16.68411   0.28862 C   0  0  0  0  0  0
>   -7.04245  17.86578   0.93854 O   0  0  0  0  0  0
>   -6.07225  18.51085   0.19546 C   0  0  0  0  0  0
>   -6.39116  19.21376  -0.74531 O   0  0  0  0  0  0
>   -4.69541  18.41611   0.56612 N   0  0  0  0  0  0
>   2  1  1  0  0  0
>   2  3  1  0  0  0
>   3 11  1  0  0  0
>   4  3  2  0  0  0
>   5  2  1  0  0  0
>   6  5  1  0  0  0
>   6  7  2  0  0  0
>   8  9  1  0  0  0
>   8  6  1  0  0  0
>   9 10  2  0  0  0
>  10  7  1  0  0  0
>  13 12  1  0  0  0
>  13 14  1  0  0  0
>  15 16  1  0  0  0
>  16 17  2  0  0  0
>  16 18  1  0  0  0
>  18 19  1  0  0  0
>  19 20  1  0  0  0
>  20 21  2  0  0  0
>  20 22  1  0  0  0
>  11 15  1  0  0  0
>  12 18  1  0  0  0
> M  END
> 
> U:/research/project_opas/Code/MVC_OPAS/build/check.sdf
> __Jmol-14_11161922023D 1   1.0 0.0 0
> Jmol version 14.9.1  2017-02-18 13:47 EXTRACT: ({0:43})
>  22 22  0  0  0  0  1 V2000
>  -10.34994  21.23775  -2.14993 N   0  0  0  0  0  0
>  -11.34250  20.30777  -2.59501 C   0  0  0  0  0  0
>  -11.13198  18.85018  -2.50356 C   0  0  0  0  0  0
>  -12.03183  18.12532  -2.90109 O   0  0  0  0  0  0
>  -12.62336  20.72709  -3.26233 C   0  0  0  0  0  0
>  -12.81469  22.18660  -3.49445 C   0  0  0  0  0  0
>  -13.85760  22.84610  -3.01911 C   0  0  0  0  0  0
>  -11.99766  23.01098  -4.32672 N   0  0  0  0  0  0
>  -12.72729  24.24473  -4.23861 C   0  0  0  0  0  0
>  -13.77078  24.16132  -3.50354 N   0  0  0  0  0  0
>   -9.86955  18.26965  -2.15583 N   0  0  0  0  0  0
>   -7.30122  16.52601   0.75455 C   0  0  0  0  0  0
>   -5.96259  17.25681   0.80966 C   0  0  0  0  0  0
>   -4.87734  16.30636   0.66950 N   0  0  0  0  0  0
>  -12.83689  15.52634  -0.85527 C   0  0  0  0  0  0
>  -11.62686  16.04439  -1.46833 N   0  0  0  0  0  0
>  -11.00919  14.97258  -2.22952 C   0  0  0  0  0  0
>  -10.70605  16.47306  -0.42756 C   0  0  0  0  0  0
>   -9.83868  17.64207  -0.85262 C   0  0  0  0  0  0
>   -8.72671  18.07421   0.02162 C   0  0  0  0  0  0
>   -8.09045  19.06942  -0.28779 O   0  0  0  0  0  0
>   -8.35385  17.36976   1.15010 O   0  0  0  0  0  0
>   2  1  1  0  0  0
>   2  3  1  0  0  0
>   3 11  1  0  0  0
>   4  3  2  0  0  0
>   5  2  1  0  0  0
>   6  5  1  0  0  0
>   6  7  2  0  0  0
>   8  9  1  0  0  0
>   8  6  1  0  0  0
>   9 10  2  0  0  0
>  10  7  1  0  0  0
>  13 12  1  0  0  0
>  13 14  1  0  0  0
>  15 16  1  0  0  0
>  16 17  1  0  0  0
>  16 18  1  0  0  0
>  18 19  1  0  0  0
>  19 20  1  0  0  0
>  20 21  2  0  0  0
>  20 22  1  0  0  0
>  11 19  1  0  0  0
>  12 22  1  0  0  0
> M  END
> 
>
> I am using CDK 1.5.8 (I have to stick to this version for compatibility 
> issues). I am trying to read the SDF file using the below snippet
>
> public static List readFragments(String fileName) throws 
> IOException, CDKException {
>
> List frags = new ArrayList<>();
>
> File sdfFile = new File(fileName);
>   
>IteratingSDFReader sdfReader = new IteratingSDFReader(new 
> FileInputStream(sdfFile),DefaultChemObjectBuilder.getInstance());
>
> while (sdfReader.hasNext()) {
>
> IAtomContainer molecule = 
> (IAtomContainer)sdfReader.next();
>
> frags.add(molecule);
>
> }
> sdfReader.close();
>
> return frags;
> }
>
> The function works perfectly fine for sdf files genrated by CDK and Openbabel 
> and returns null for Jmol generated 

[Cdk-user] Reg: Reading Jmol generated SDF file using Iterating SDF reader cdk 1.5.8

2019-11-17 Thread Vinothkumar Mohanakrishnan
Dear Users,

I would like to read a SDF file using IteratingSDFReader. The SDF file
is generated by jmol (see below).

U:/research/project_opas/Code/MVC_OPAS/build/check.sdf
__Jmol-14_11161922023D 1   1.0 0.0 0
Jmol version 14.9.1  2017-02-18 13:47 EXTRACT: ({0:43})
 22 22  0  0  0  0  1 V2000
 -10.26842  21.30587  -2.02430 N   0  0  0  0  0  0
 -11.14109  20.23272  -2.39821 C   0  0  0  0  0  0
 -10.84018  18.85777  -1.92734 C   0  0  0  0  0  0
 -11.60011  17.94142  -2.23013 O   0  0  0  0  0  0
 -12.38167  20.49262  -3.21797 C   0  0  0  0  0  0
 -12.66761  21.93940  -3.49472 C   0  0  0  0  0  0
 -13.73838  22.56509  -3.02287 C   0  0  0  0  0  0
 -11.88128  22.81522  -4.30956 N   0  0  0  0  0  0
 -12.65747  24.01784  -4.21934 C   0  0  0  0  0  0
 -13.70560  23.88527  -3.49217 N   0  0  0  0  0  0
  -9.64144  18.61510  -1.15438 N   0  0  0  0  0  0
  -6.47461  15.46647   0.53840 C   0  0  0  0  0  0
  -5.16207  15.52031  -0.21484 C   0  0  0  0  0  0
  -4.06313  15.41673   0.72449 N   0  0  0  0  0  0
  -9.80464  17.44463  -0.29800 C   0  0  0  0  0  0
  -8.64600  16.48725  -0.41087 C   0  0  0  0  0  0
  -8.90795  15.33022  -1.01563 C   0  0  0  0  0  0
  -7.33993  16.68411   0.28862 C   0  0  0  0  0  0
  -7.04245  17.86578   0.93854 O   0  0  0  0  0  0
  -6.07225  18.51085   0.19546 C   0  0  0  0  0  0
  -6.39116  19.21376  -0.74531 O   0  0  0  0  0  0
  -4.69541  18.41611   0.56612 N   0  0  0  0  0  0
  2  1  1  0  0  0
  2  3  1  0  0  0
  3 11  1  0  0  0
  4  3  2  0  0  0
  5  2  1  0  0  0
  6  5  1  0  0  0
  6  7  2  0  0  0
  8  9  1  0  0  0
  8  6  1  0  0  0
  9 10  2  0  0  0
 10  7  1  0  0  0
 13 12  1  0  0  0
 13 14  1  0  0  0
 15 16  1  0  0  0
 16 17  2  0  0  0
 16 18  1  0  0  0
 18 19  1  0  0  0
 19 20  1  0  0  0
 20 21  2  0  0  0
 20 22  1  0  0  0
 11 15  1  0  0  0
 12 18  1  0  0  0
M  END

U:/research/project_opas/Code/MVC_OPAS/build/check.sdf
__Jmol-14_11161922023D 1   1.0 0.0 0
Jmol version 14.9.1  2017-02-18 13:47 EXTRACT: ({0:43})
 22 22  0  0  0  0  1 V2000
 -10.34994  21.23775  -2.14993 N   0  0  0  0  0  0
 -11.34250  20.30777  -2.59501 C   0  0  0  0  0  0
 -11.13198  18.85018  -2.50356 C   0  0  0  0  0  0
 -12.03183  18.12532  -2.90109 O   0  0  0  0  0  0
 -12.62336  20.72709  -3.26233 C   0  0  0  0  0  0
 -12.81469  22.18660  -3.49445 C   0  0  0  0  0  0
 -13.85760  22.84610  -3.01911 C   0  0  0  0  0  0
 -11.99766  23.01098  -4.32672 N   0  0  0  0  0  0
 -12.72729  24.24473  -4.23861 C   0  0  0  0  0  0
 -13.77078  24.16132  -3.50354 N   0  0  0  0  0  0
  -9.86955  18.26965  -2.15583 N   0  0  0  0  0  0
  -7.30122  16.52601   0.75455 C   0  0  0  0  0  0
  -5.96259  17.25681   0.80966 C   0  0  0  0  0  0
  -4.87734  16.30636   0.66950 N   0  0  0  0  0  0
 -12.83689  15.52634  -0.85527 C   0  0  0  0  0  0
 -11.62686  16.04439  -1.46833 N   0  0  0  0  0  0
 -11.00919  14.97258  -2.22952 C   0  0  0  0  0  0
 -10.70605  16.47306  -0.42756 C   0  0  0  0  0  0
  -9.83868  17.64207  -0.85262 C   0  0  0  0  0  0
  -8.72671  18.07421   0.02162 C   0  0  0  0  0  0
  -8.09045  19.06942  -0.28779 O   0  0  0  0  0  0
  -8.35385  17.36976   1.15010 O   0  0  0  0  0  0
  2  1  1  0  0  0
  2  3  1  0  0  0
  3 11  1  0  0  0
  4  3  2  0  0  0
  5  2  1  0  0  0
  6  5  1  0  0  0
  6  7  2  0  0  0
  8  9  1  0  0  0
  8  6  1  0  0  0
  9 10  2  0  0  0
 10  7  1  0  0  0
 13 12  1  0  0  0
 13 14  1  0  0  0
 15 16  1  0  0  0
 16 17  1  0  0  0
 16 18  1  0  0  0
 18 19  1  0  0  0
 19 20  1  0  0  0
 20 21  2  0  0  0
 20 22  1  0  0  0
 11 19  1  0  0  0
 12 22  1  0  0  0
M  END


I am using CDK 1.5.8 (I have to stick to this version for
compatibility issues). I am trying to read the SDF file using the
below snippet

public static List readFragments(String fileName)
throws IOException, CDKException {

List frags = new ArrayList<>();

File sdfFile = new File(fileName);

   IteratingSDFReader sdfReader = new IteratingSDFReader(new
FileInputStream(sdfFile),DefaultChemObjectBuilder.getInstance());

while (sdfReader.hasNext()) {

IAtomContainer molecule = (IAtomContainer)sdfReader.next();

frags.add(molecule);

}
sdfReader.close();

return frags;
}

The function works perfectly fine for sdf files genrated by CDK and
Openbabel and returns null for Jmol generated sdf file. I am pretty
sure it is the problem with the sdf file generated by Jmol. But I am
able to open the sdf file in the molecule viewer (Jmol, Discovery
Studio) without any errors.  I tried all variations by manually
editing the file like the headers and the end of the file, but to no
avail. I tried to read it using MDLV2000 reader but no improvements.
Is there any other reader I can use or which part of the sdf file (is
problematic) I have to edit, so that I can read it using
IteratingSDFReader? Any insights in