marrink-lab / bentopy

Packs stuff in boxes
4 stars 0 forks source link

Voxelization problem #28

Open jan-stevens opened 5 months ago

jan-stevens commented 5 months ago

Voxelization fails for structures that contain integer value position coordinates. (outlier bug)

You can download the pdb file reproducing the bug here: https://drive.google.com/file/d/1BsVeHqA6jDyDZC51Ft5jONQdI7FBCG2I/view?usp=sharing

ma3ke commented 5 months ago

I went through the file and all of the pdb ATOM records appear to be fine. Or at least, the position coordinates are all floating point values afaict, no integers.

Would you mind sharing the traceback in a comment here, if you can easily produce it again?

jan-stevens commented 5 months ago

The error that was thrown is:

  File "/home/jan/VirtualEnvs/bentopy/lib/python3.10/site-packages/bentopy/pack/segment.py", line 175, in voxelize
    voxels[int(x), int(y), int(z)] = 1
IndexError: index 7 is out of bounds for axis 0 with size 7

I now realise that you center the segment coordinates before voxelisation. Afte doing this, on of the bead coordinates becomes:

[7.0, 1.611799955368042, 2.050399899482727]

The voxel mask for this segment is a Numpy array of 7yz, so 7 is out of bounds for this specific segment.