Amber-MD / pytraj

Python interface of cpptraj
https://amber-md.github.io/pytraj
170 stars 38 forks source link

Segmentation fault on pytra.dssp_allresidues #1443

Closed hectormartinezdev closed 4 years ago

hectormartinezdev commented 6 years ago

Issue type

Useful info

>>> pytraj.show_versions()
2.7.12 (default, Dec  4 2017, 14:50:18) 
[GCC 5.4.0 20160609]

('pytraj version = ', '2.0.0')
('cpptraj version = ', u'V17.00')
('cpptraj internal version = ', u'V4.3.3')
('cpptraj compiled flag = ', u' -DHASBZ2 -DHASGZ -DBINTRAJ')

Actual behaviour

Hey! I'm using pytraj to calculate the DSSP of a pocket.

import pytraj as pt

traj = pt.load("bad_pocket.pdb")
print(pt.dssp_allresidues(traj, simplified=True))

When I use this the code crashes with a Segmentation fault (core dumped)

Any insights?

Note: I've uploaded the pocket in PDB format with txt extension.

Thank you!

bad_pocket.txt

hainm commented 6 years ago

hi,

your pdb does not have H atom to determine h-bond (and I don't think that is a legit pdb format). Can you add H and try again?

hectormartinezdev commented 6 years ago

I've added H's with pymol, but fail anyway.

As you say, I think that isn't a legit PDB format. Here there is only one chain, but actually there are two chains. I get NA's using mdtraj with the same pocket, so... my bad.

I will compute the DSSP of the structure and then map these with the pocket residues.

Sorry for bothering! Thank you :)

drroe commented 6 years ago

@hainm I think that even though this isn't a "good" PDB, pytraj should still not segfault. CPPTRAJ will process this but just complains that not all backbone atoms were found for all residues. It's a low priority fix however.

hainm commented 6 years ago

@drroe: I've tried cpptraj

parm x.pdb trajin x.pdb dssp

will show the segmentation fault.

Hai

On Tue, Jan 30, 2018 at 12:33 PM, Daniel R. Roe notifications@github.com wrote:

@hainm https://github.com/hainm I think that even though this isn't a "good" PDB, pytraj should still not segfault. CPPTRAJ will process this but just complains that not all backbone atoms were found for all residues. It's a low priority fix however.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Amber-MD/pytraj/issues/1443#issuecomment-361671122, or mute the thread https://github.com/notifications/unsubscribe-auth/AEPudclnZL9ua__7oXK7CeVXDhjbKnlyks5tP1JdgaJpZM4RwimG .

drroe commented 6 years ago

@hainm try with the latest version. It runs. I suspect that pytraj with latest libcpptraj.so will run as well. I had assumed that all of this was being done with all components up to date.

hainm commented 6 years ago

thanks. I will try tonight.

hainm commented 6 years ago

uhm, cpptraj is fine and pytraj is not.

hectormartinezdev commented 6 years ago

I'm compiling right now AmberTools17 from source. I was using it, but I compiled it months ago. I will edit when I test the new compiled version.

Edit:

$cpptraj

CPPTRAJ: Trajectory Analysis. V17.00
    ___  ___  ___  ___
     | \/ | \/ | \/ | 
    _|_/\_|_/\_|_/\_|_

| Date/time: 01/31/18 08:58:08
| Available memory: 611.389 MB

        Loading previous history from log 'cpptraj.log'
> parm bad_pocket.pdb 
        Reading 'bad_pocket.pdb' as PDB File
        Determining bond info from distances.
Warning: bad_pocket.pdb: Determining default bond distances from element types.
Error: Atom 4 was assigned a lower molecule # than previous atom.
Error:   This can happen if bond information is incorrect or missing, or if the
Error:   atom numbering in molecules is not sequential. Try one of the
Error:   following:
Error: - If this is a PDB file, try using the 'noconect' keyword.
Error: - If this topology did not have bond info, try increasing the bond
Error:   search cutoff above 0.2 Ang. ('bondsearch <cutoff>').
Error: - Use the 'fixatomorder' command to reorder the topology and any
Error:   associated coordinates.
Error: - Use the 'setMolecules' command in parmed to reorder only the
Error:   topology.
Error: Could not determine molecule information for bad_pocket.pdb.
Error: SetSolventInfo: No molecule information.
Error: Could not determine solvent information for bad_pocket.pdb.
> trajin bad_pocket.pdb 
        Reading 'bad_pocket.pdb' as PDB
> dssp
    SECSTRUCT: Calculating secondary structure using mask [*]
        SS data for each residue will be stored as integers.
                0 = None
                1 = Para
                2 = Anti
                3 = 3-10
                4 = Alpha
                5 = Pi
                6 = Turn
                7 = Bend
        Backbone Atom Names: N=[N   ]  H=[H   ]  C=[C   ]  O=[O   ]  CA=[CA  ]
# Citation: Kabsch, W.; Sander, C.; "Dictionary of Protein Secondary Structure:
#           Pattern Recognition of Hydrogen-Bonded and Geometrical Features."
#           Biopolymers (1983), V.22, pp.2577-2637.

On pytraj:

Python 2.7.12 (default, Dec  4 2017, 14:50:18) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pytraj
>>> pytraj.dssp_allresidues(pytraj.load("bad_pocket.pdb"))
Segmentation fault (core dumped)

@hainm our results are similar? cpptraj is working but pytraj is not?

hainm commented 6 years ago

yeah, as we mentioned above, pytraj is not working properly.

hainm commented 4 years ago

@drroe I've opened a new issue in cpptraj here: https://github.com/Amber-MD/cpptraj/issues/819

drroe commented 4 years ago

Will be addressed by https://github.com/Amber-MD/cpptraj/pull/820.

@hectormartinezdev note that cpptraj (and hence pytraj) isn't set up to handle PDB files where the ATOM serial #s are out of order (like in bad_pocket.txt). You should sort by ATOM serial # (via e.g. sort -g -k 2) before using that with cpptraj/pytraj.

drroe commented 4 years ago

Behavior should be corrected now.

hainm commented 4 years ago

I confirm the issue is fixed with cpptraj (and pytraj) in master branch. I can close this issue now. Thanks @drroe.