You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
20:22:57 [main] ERROR org.biojava.nbio.structure.io.mmcif.SimpleMMcifParser - This does not look like a valid mmCIF file! The first line should start with 'data_', but is: 'null'
Exception in thread "main" java.lang.NullPointerException
at org.biojava.nbio.structure.io.ChargeAdder.addCharges(ChargeAdder.java:55)
at org.biojava.nbio.structure.io.PDBFileParser.addCharges(PDBFileParser.java:2772)
at org.biojava.nbio.structure.io.PDBFileParser.parsePDBFile(PDBFileParser.java:2760)
at org.biojava.nbio.structure.io.PDBFileParser.parsePDBFile(PDBFileParser.java:2622)
at org.biojava.nbio.structure.io.PDBFileReader.getStructure(PDBFileReader.java:307)
at org.biojava.nbio.structure.io.LocalPDBDirectory.getStructure(LocalPDBDirectory.java:337)
at org.biojava.nbio.structure.io.LocalPDBDirectory.getStructure(LocalPDBDirectory.java:321)
at hello.HelloWorld.main(HelloWorld.java:22)
Weird thing is that it didn't fail before. How is that possible? Also we do I get so many ERROR from MMcifParser when I am parsing PDB and not mmCIF?
I've just tried with 4.2.8 and everything works fine too. It works fine with either true or false in setCreateAtomCharges() (or even with the line commented out).
Is your file exactly like the original provided by PDB? Can you try downloading it again in case the latest remediations have changed it?
As a note, the best and most reliable way to get structure information in biojava is to use the mmCIF files. In fact if all you want is reading deposited PDB structures you can use the AtomCache feature:
One more hint: the parser also downloads (and caches locally) cif files for each ligand. Could you try to remove all of those cached locally (set in PDB_DIR or PDB_CACHE_DIR) and try again? That could explain why you see a problem in the cif parser in your stack trace.
I don't have any of these set, but I removed chemcomp from /tmp. Unfortunately it didn't help. Any ideas why I am getting so many ERROR logs from SimpleMMcifParser? It shouldn't use the class at all right?
why I am getting so many ERROR logs from SimpleMMcifParser? It shouldn't use the class at all right?
It does to parse the chemical component dictionary files (for each ligand or aminoacid).
Also be sure you are using 4.2.8, the location of the chemical component files changed in the RCSB servers and 4.2.8 was patched accordingly to point to the new location.
It seems you do get the same problem in all tests: the chemical component <ligand 3 letter code>.cif files are not getting parsed. Could you check 2 things:
Do you have something under the chemcomp directory in /tmp (or wherever set with PDB_CACHE_DIR env variable)?
The dir contents look quite alright and it seems to indicate that you can download the chem comp files. This is very weird. Could you try to run your example through a debugger to get some better idea on why the files can't be parsed? It seems that the parser can't even go through the first line (should contain data_...), instead the parser is getting a null for some reason.
By the way I've tried downloading and running your code (maven version) and it all works fine. So definitely this has to do with the environment and not with the code.
$ java -version [7:59:42]
java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)
I agree that it is something with the Environment because it worked and I didn't do any code changes.
I will try to run it on Windows. I will also try to set the PDB_CACHE_DIR. Is there any other environment settings?
The problem is that you have a bunch of empty chemical compound files in your chemcomp directory. For instance, ALA.cif.gz is only 20 bytes (just the gzip header).
The work around is easy: just delete the chemcomp folder and you should be good.
I also had a bunch of these empty gz files. I think they probably happen if you try to use a version of biojava with the old RCSB urls (e.g. 4.2.7; anything missing dc7f3ea). The faulty URL gets cached and then fails even with recent code.
Although the work around is easy, we could also handle this case in BioJava by re-downloading files with size 20B (I think this already happens for size 0 files, but we didn't consider the gzip header).
As a separate issue, I dislike that errors in fetching chemical compounds break parsing. It means we require an internet connection even for local files unless you do the unusual step of specifically switching to a ReducedChemCompProvider.
Yes, clearing the cache dir and updating to version 4.2.8 solved the issue for me. As for the fixes, I totally agree. Shall I close the issue or will you close when the fixes are implemented?
Activity
josemduarte commentedon Aug 30, 2017
This works for me with latest HEAD:
With output:
That's using the official 2src.pdb as downloaded from RCSB. How's your environment? are you using maven? what version of biojava?
jendelel commentedon Aug 30, 2017
I used gradle and version 4.2.8, I also tried 4.2.6 and 4.2.4.
However, you setCreateAtomCharges(false). If it's true, it doesn't work. Why?
josemduarte commentedon Aug 30, 2017
I've just tried with 4.2.8 and everything works fine too. It works fine with either
trueorfalseinsetCreateAtomCharges()(or even with the line commented out).Is your file exactly like the original provided by PDB? Can you try downloading it again in case the latest remediations have changed it?
As a note, the best and most reliable way to get structure information in biojava is to use the mmCIF files. In fact if all you want is reading deposited PDB structures you can use the AtomCache feature:
See https://github.com/biojava/biojava-tutorial/blob/master/structure/caching.md for more info
jendelel commentedon Aug 30, 2017
I don't know what I am doing wrong then. Are you using gradle or maven?
Can you send me zipped directory with your test in it please. I will try to run it on my PC. It that one works, I will look for difference.
It must be something stupid because it worked for my until now.
Thank you for your help,
Lukas
jendelel commentedon Aug 30, 2017
And yes, I used the latest pdb file from rcsb.
josemduarte commentedon Aug 30, 2017
One more hint: the parser also downloads (and caches locally) cif files for each ligand. Could you try to remove all of those cached locally (set in
PDB_DIRorPDB_CACHE_DIR) and try again? That could explain why you see a problem in the cif parser in your stack trace.jendelel commentedon Aug 30, 2017
I don't have any of these set, but I removed chemcomp from /tmp. Unfortunately it didn't help. Any ideas why I am getting so many ERROR logs from SimpleMMcifParser? It shouldn't use the class at all right?
josemduarte commentedon Aug 30, 2017
It does to parse the chemical component dictionary files (for each ligand or aminoacid).
Also be sure you are using 4.2.8, the location of the chemical component files changed in the RCSB servers and 4.2.8 was patched accordingly to point to the new location.
jendelel commentedon Aug 31, 2017
Can you please take a look at these to small examples?
maven
gradle
This is the file I tried 2src
They both the same way for me and I have no idea why...
Thank you so much,
Lukas
Lukas
jendelel commentedon Aug 31, 2017
I also tried these commands and the tests failed:
git clone https://github.com/biojava/biojava.git cd biojava/ mvn packageAny ideas why is that happening?
Thank you,
Lukas
josemduarte commentedon Aug 31, 2017
Can you be more specific, what tests fail? maven should give quite specific reports about which tests fail
jendelel commentedon Aug 31, 2017
Here is a complete log of stdout and stderr from the mvn package commnad.
jendelel commentedon Aug 31, 2017
Excerpt from the logs:
josemduarte commentedon Aug 31, 2017
It seems you do get the same problem in all tests: the chemical component
<ligand 3 letter code>.ciffiles are not getting parsed. Could you check 2 things:PDB_CACHE_DIRenv variable)?jendelel commentedon Aug 31, 2017
This is my chemcomp directory in /tmp:
http://www.ms.mff.cuni.cz/~jendelel/chemcomp.zip
josemduarte commentedon Aug 31, 2017
The dir contents look quite alright and it seems to indicate that you can download the chem comp files. This is very weird. Could you try to run your example through a debugger to get some better idea on why the files can't be parsed? It seems that the parser can't even go through the first line (should contain
data_...), instead the parser is getting anullfor some reason.What's your Operating System? and java version?
josemduarte commentedon Aug 31, 2017
By the way I've tried downloading and running your code (maven version) and it all works fine. So definitely this has to do with the environment and not with the code.
jendelel commentedon Sep 1, 2017
I run it on Linux, some kind of Debian system.
$ java -version [7:59:42] java version "1.8.0_144" Java(TM) SE Runtime Environment (build 1.8.0_144-b01) Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)I agree that it is something with the Environment because it worked and I didn't do any code changes.
I will try to run it on Windows. I will also try to set the PDB_CACHE_DIR. Is there any other environment settings?
Thanks for your help.
Lukas
sbliven commentedon Sep 2, 2017
The problem is that you have a bunch of empty chemical compound files in your chemcomp directory. For instance, ALA.cif.gz is only 20 bytes (just the gzip header).
The work around is easy: just delete the chemcomp folder and you should be good.
I also had a bunch of these empty gz files. I think they probably happen if you try to use a version of biojava with the old RCSB urls (e.g. 4.2.7; anything missing dc7f3ea). The faulty URL gets cached and then fails even with recent code.
Although the work around is easy, we could also handle this case in BioJava by re-downloading files with size 20B (I think this already happens for size 0 files, but we didn't consider the gzip header).
As a separate issue, I dislike that errors in fetching chemical compounds break parsing. It means we require an internet connection even for local files unless you do the unusual step of specifically switching to a ReducedChemCompProvider.
sbliven commentedon Sep 2, 2017
I confirmed that using old tools, e.g. the current CE-Symm 2.0.0-RC2, will download empty chemical compounds.
josemduarte commentedon Sep 2, 2017
There's a couple of fixes to implement:
jendelel commentedon Sep 2, 2017
Yes, clearing the cache dir and updating to version 4.2.8 solved the issue for me. As for the fixes, I totally agree. Shall I close the issue or will you close when the fixes are implemented?
Thank you guys for your help.
josemduarte commentedon Sep 2, 2017
I've added a new issue. Will close this one, thanks for reporting!