LBC-LNBio / pyKVFinder

pyKVFinder: Python-C parallel KVFinder
https://lbc-lnbio.github.io/pyKVFinder/
GNU General Public License v3.0
19 stars 10 forks source link

Segmentation error when running the workflow #11

Closed AJVelezRueda closed 1 year ago

AJVelezRueda commented 1 year ago

Hello! I am trying to integrate the package in a pipeline, and when running multiple times with the same file, same commands many times, sometimes I get segmentation error, while sometimes I get results: Screenshot from 2022-12-06 16-31-43

This is the code to reproduce the error: import pyKVFinder pyKVFinder.run_workflow('./tests/resources/1H6J_B.pdb', include_depth=True, include_hydropathy=True, hydrophobicity_scale='EisenbergWeiss').residues

And this is the error I get: File "/home/ana/.anaconda3/envs/cavidb/lib/python3.8/site-packages/pyKVFinder/grid.py", line 1556 in constitutional

I am currently working in Ubuntu 22.04 but also occurs when using Ubuntu 20. Same bug when I am inside a conda envvironment, and also outside it.

I attach the pdb file used. Thanks 1H6J_B.zip

jvsguerra commented 1 year ago

Hi @AJVelezRueda,

Thank you for reporting this error.

We are working on a solution. The problem seems to be with the order in which we perform the characterization. It seems that if we run constitutional characterization after depth characterization, a memory issue appears, generating the "Segmentation fault" message.

Until we fix it completely, here is a workaround to perform the analysis you shared with us:

import pyKVFinder

# PARAMETERS
path = "1H6J_B.pdb"
probe_out = 4.0
hydrophobicity_scale='EisenbergWeiss'

# Run 100 times pyKVFinder for 1H6J_B
for i in range(100):
    # Atomic information
    atomic = pyKVFinder.read_pdb("1H6J_B.pdb")

    # Grid
    vertices = pyKVFinder.get_vertices(atomic, probe_out=probe_out)

    # Cavity detection
    ncav, cavities = pyKVFinder.detect(atomic, vertices, probe_out=probe_out)

    # Constitutional
    residues = pyKVFinder.constitutional(cavities, atomic, vertices)

    # Depth characterization
    depth, avg_depth, max_depth = pyKVFinder.depth(cavities)

    # Hydropathy characterization
    surface, volume, area = pyKVFinder.spatial(cavities)
    hydropathy, avg_hydropathy = pyKVFinder.hydropathy(surface, atomic, vertices, hydrophobicity_scale=hydrophobicity_scale)

    # Export cavities
    # NOTE: Uncomment to export cavities to PDB file
    # pyKVFinder.export(f"cavity_{i:02d}.pdb", cavities, surface, vertices, B=depth, output_hydropathy=f"hydropathy_{i:02d}.pdb", scales=hydropathy)

Please let me know if this workaround solved your problem.