MDAnalysis / mdahole2

An MDAKit implementing a Python interface for the HOLE program.
https://www.mdanalysis.org/mdahole2/
GNU General Public License v3.0
5 stars 2 forks source link

hole2 analysis should pipe bash error messages #28

Open prateekbansal97 opened 3 years ago

prateekbansal97 commented 3 years ago

Expected behavior

create_vmd_surface works and outputs hole.vmd

Actual behavior

Hello, I have been trying to create a vmd_surface for my membrane protein using a trajectory. I define the universe, create and run the hole2.holeanalysis() object. It runs and successfully outputs .out and .sph files. The next step I do is to create_vmd_surface, which fails, with the following error:

Traceback (most recent call last): File "mdanalysis_trial.py", line 14, in ha.create_vmd_surface() File "\~/anaconda3/lib/python3.8/site-packages/MDAnalysis/analysis/hole2/hole.py", line 800, in create_vmd_surface tmp_tri = create_vmd_surface(sphpdb=sphpdb, File "\~/anaconda3/lib/python3.8/site-packages/MDAnalysis/analysis/hole2/utils.py", line 558, in create_vmd_surface six.raise_from(OSError(err.returncode, "sos_triangle failed"), None) File "\<string>", line 3, in raise_from PermissionError: [Errno 1] sos_triangle failed

Code to reproduce the behavior

import MDAnalysis as mda
from MDAnalysis.analysis import hole2
import matplotlib.pyplot as plt
import numpy as np
import os
dcd = '../../dcd/dcdfile.dcd'
pdb = './pdbs/pdbfile.pdb'
print(dcd,pdb)
cp = np.array([-3.94, 2.159, 14.393])
cv = np.array([0,0,1])
u = mda.Universe(pdb,dcd)
ha = hole2.HoleAnalysis(u, cpoint=cp, verbose=True, cvect=cv, executable='~/hole2/exe/hole')
ha.run(random_seed=56348)
ha.create_vmd_surface()

I thought it might be a path length error (since HOLE has a limitation on the path length. But I tried the same run with moving all files to a directory inside the home directory (i.e. Shortening the path string size), but to no avail. The hole, sos_triangle and sph_process executables are all present in the ~/hole2/exe/hole directory. Any help would be appreciated. Thank you!

Current version of MDAnalysis

lilyminium commented 3 years ago

Hi @prateekbansal97, this looks like a permissions error. Could you check that you have permission to execute sos_triangle? You can view with ls -l sos_triangle and make it executable with chmod +x sos_triangle. Otherwise, can you check that sos_triangle works when you execute it directly from terminal?

prateekbansal97 commented 3 years ago

Output for ls -l ~/hole2/exe/sos_triangle:

-rwxrwxrwx 1 pdb3 pdb3 31085 Nov 12 2020 ~/hole2/exe/sos_triangle So, it has all the permissions. When I sos_triangle from the terminal, this is the output -

sos_triangle: A Hole surface generation program
Copyright 1997-9 Guy M.P. Coates
Copyright 2000, 2004 Oliver S. Smart
Copyright 2014-2015 SmartSci Limited, All rights reserved.
For help on HOLE suite see  http://www.smartsci.uk/hole/

Producing Faceted surface.
Waiting for  coordinates:

So, it runs from the terminal. I thought that it was a permissions issue too, but the executable has all the permissions and it runs from the terminal.

orbeckst commented 3 years ago

It might not be a real permission error but sos_triangle just returning the code that happens to map to Permission Error.

prateekbansal97 commented 3 years ago

Thanks for the comment. I realized that the system I was using has a large number of triangles to be rendered, causing sos_triangle to fail with the error 'ERROR: Maximum number of polygons exceeded!'. This happened when I did the rendering manually for each separate frame (pdb) using hole directly, than MDAnalysis. I guess this is a shortcoming of hole.

I'm not completely sure, but my best guess would be that something similar is happening when I try to render the hole in an entire trajectory (instead of separate pdbs) using MDAnalysis. But since any failed execution in sos_triangle maps to 'sos_triangle_failed', it gives out the aforementioned error making it hard to interpret.

I tried changing the dot_density parameter (reduced it to 10 instead of 15), reducing the number of triangles to be rendered, and successfully got the output file. Thank you everyone for your time and inputs.

lilyminium commented 3 years ago

Thanks for coming back and letting us know the issue, @prateekbansal97. I think this speaks to an overall issue of MDAnalysis not piping the original error message through, though -- would you mind if I change the issue title to that?

prateekbansal97 commented 3 years ago

Sure, go ahead!