Closed OWissett closed 1 year ago
I also get this error:
thread 'structure::tests::from_pdbtbx' panicked at 'index out of bounds: the len is 67 but the index is 67', /home/sasa/.cargo/registry/src/github.com-1ecc6299db9ec823/pdbtbx-0.10.1/src/read/pdb/lexer.rs:723:31
After investigating the source code, the DBREF sections appear to be causing this problem.
Please let me know if I am doing something wrong? or is this an issue with the crate?
To me it seems like an issue with the crate, since I am using regular PDB files and following the documentation on how to load them
Interim fix - DELETE the entire header
Any crash is an issue with the crate. I will look into what is causing the issues and see if I can get a fix in. Thanks for opening the issue!
It is a bit of an ugly fix but I lowered the level of the MASTER
record mismatch so that ErrorLevel::Loose
will not panic anymore on these errors. Because that was ultimately all that kept the file from running when I took the original PDB file. I can see you had more reported issues in your first crash, I could not replicate those. If these issues persist please send me the file you run so I can debug what is happening.
A bit of backstory, there are 2207 atoms (1931 ATOM + 276 HETATM of which 244 HOH) in the file but the MASTER record claims there are 2187. I have not yet found the definition which determines the MASTER record number.
As a side project I restructured the whole lexing code so that errors like the second crash are pretty much impossible (there are a handful of cases left out of the hundreds before). So thanks for the push I needed to clean up this code!
Side note: if you want to run the version of pdbtbx with this patch you will have to run it directly from git until a new release is made: pdbtbx = {git = "https://github.com/douweschulte/pdbtbx"}
.
I have just had a look at the updated version of the lexer compared to one crates.io, looks much better since we should not get index errors causing panics! which is much better :)
Perfect! If any of the issues pops up again or you find any new ones, please open an issue again. Thanks again for sending it in!
I am attempting to load a PDB file (5XH3) to do some testing.
On loading, I get:
I have tried deleting the SEQRES sections, but I then get some other errors about the number of Atom and the number listed in the MASTER record don't match.
Surely this is a common state for PDB files, particularly ones from XRC since it is often hard to resolve densities, so ATOM records are not used.
The code I am running is: