douweschulte / pdbtbx

A library to open/edit/save (crystallographic) Protein Data Bank (PDB) and mmCIF files in Rust.
https://crates.io/crates/pdbtbx
MIT License
49 stars 12 forks source link

Panic in `save/pdb.rs:517:29` at `Option::unwrap()` on a `None` value #102

Closed OWissett closed 1 year ago

OWissett commented 1 year ago

Background:

I am developing a high throughput PDB file processing tool which generates new PDB files based on some calculations. I am not sure which PDB file has caused this (as logging all PDB files being writen will produce an extremely large file, as I am producing tens of millions of PDBs). I check that the PDB file is correct before sending it to the writer, however, it is panicking!

Here is the output:

thread 'I/O Thread' panicked at 'called `Option::unwrap()` on a `None` value', /home/XXX/.cargo/git/checkouts/pdbtbx-a196e7c164e23eeb/fae1994/src/save/pdb.rs:517:29
douweschulte commented 1 year ago

Hmm you seem to be wanting to save a pdb file which has a chain with no atoms in it. That sounds like an easy fix.

douweschulte commented 1 year ago

Okay in saving it now disregards any chains without any atoms. This should prevent the crash. If it still remains feel free top open an the issue again.

OWissett commented 1 year ago

Haha, perfect, I literally just made the same changes in my program. As I had a look at the source and thought that was what might be happening.

This is happening because I am doing some PDB mangling.

I will let you know if it persists.