channotation / chap

CHAP is a tool for the functional annotation of ion channel structures:
http://www.channotation.org
Other
18 stars 10 forks source link

Standard library logic error (bug): (exception type: St12out_of_range) vector::_M_range_check: __n (which is 2) >= this->size() (which is 2) #36

Open cgseitz opened 3 years ago

cgseitz commented 3 years ago

Hello,

I have tried running CHAP with this command:

chap -f ../../solvated_pores.trr -s ../../solvated_pores.pdb -sel-pathway 1 -sel-solvent 'Water' -pf-cutoff 0 -pf-init-probe-pos 133 112 70

If I set the initial probe position as I do above, it reads all the frames but does not produce a correct output.

trr version: GMX_trn_file (single precision)
Reading frame    1900 time  190.000   
Analyzed 2000 frames, last time 199.900

Forming time averages, 100% completee

-------------------------------------------------------
Program:     chap, version 2016.6

Standard library logic error (bug):
(exception type: St12out_of_range)
vector::_M_range_check: __n (which is 2) >= this->size() (which is 2)

By this, I mean that it produces an output.pdb and output.json but not output.obj or output.mtl. However, if I run the same command but do not specify the initial probe position, it runs properly. I need some way of annotating different ion channels in my system, which I am currently trying to do by starting the probe in different positions. I cannot find much information online about this error, do you know how to fix it? Thanks!

Best regards, Christian

Inniag commented 3 years ago

Hi Christian, are you sure the position you specified lies within then protein? CHAP uses nanometers as units of distance, as is the standard for Gromacs, but many other tools especially in the Structural Biology community report angstroms. Just asking because the values you report are quite large. If the initial probe position lies outside the protein, this could cause an issue such as the one you describe. Also, have you looked at the output.json file? Does it report sensible values, i.e. does it find a miningful pathway?

cgseitz commented 3 years ago

Hi Gianni, I am not a regular user of Gromacs and forgot it uses nm as distance units, thanks for reminding me. When I convert these values to appropriate units, I get one of two errors. If I leave the pf-cutoff 0 then the "Time averaged free energy profile" looks suspicious (a straight line around -3.3, with perfectly even error shading from 0 to ~-6.8) and the "Time averaged radius profile" is clearly flawed (an enormous error shading that reaches up to ~500 nm and washes out all of the pore residues in the plot). When I set the pf-cutoff to 10, 15 or 20, it quits halfway through my trajectory, saying that the pore radius at initial probe position is infinite. Do you know what may be wrong?

Inniag commented 3 years ago

Have you tried visualising the pore it finds in e.g. VMD or PyMol? Might give some indication where it goes wrong.

From your description, it sounds to me like CHAP does not find the correct pore, with the probe just jumping out sideways at some point?

Also, are you sure those cutoff values are sensible? Is your pore really going to be up to 20nm wide?

cgseitz commented 3 years ago

In VMD, the pore found from the pf-cutoff 0 looks more or less normal. Adjusting the cutoff values to 20 or 30 angstroms still gives the same error, that the pore radius at initial probe position is infinite.

If I set the pf-max-free-diff instead of the pf-cutoff to be 1, 1.5, 2 or 3, it says the initial probe position is infinite. If I set the pf-max-free-diff to be 4 or 5, it says it could not converge error bound without exceeding maximum truncation number p=500.

cgseitz commented 2 years ago

Hello,

I am still finding this error:

(exception type: St13runtime_error) Could not converge error bound without exceeding maximum truncation number p = 500.

Normally, when I use syntax like this:

chap -f ../../solvated_pores.xtc -s ../../solvated_pores.pdb -sel-pathway 1 -sel-solvent 'Ion' -pf-cutoff 0

and don't set the initial probe position, there are no errors. However, I did get that same error on a long trajectory. Is chap deterministic, i.e. if I run the same command again is there a chance it will finish successfully without errors? I am trying to include chap in an upcoming manuscript but am finding it difficult to get analyses to finish successfully.

Inniag commented 2 years ago

The pathway finding uses simulated annealing, which is not deterministic in principle. However, you can fix the random seed, in which case results should be reproducible for identical input. Take a look at the -sa-seed command line flag.

cgseitz commented 2 years ago

Thanks for explaining that. I have started rerunning the analysis, in the off chance that it will finish successfully this time. In case it doesn't, have you seen that error before? Do you know what it means, and how to prevent it?

(exception type: St13runtime_error) Could not converge error bound without exceeding maximum truncation number p = 500.
Inniag commented 2 years ago

I have not seen this issue before. I suspect it comes from you using CHAP in a way we did not have in mind when writing it. Also, does this mean the original issue (out of range) is solved now?

cgseitz commented 2 years ago

Unfortunately not, neither issue is solved. I didn't want to mention all the errors I've seen as I thought it would be overwhelming, but maybe it would help you to see them. Here is what I have seen so far:

chap -f ../solvated_pores.trr -s ../solvated_pores.pdb -sel-pathway 1 -sel-solvent 'Water'

This gives an error, saying the initial probe size is infinite, and recommends setting either -pf-max-free-dist or -pf-cutoff

chap -f ../solvated_pores.xtc -s ../solvated_pores.pdb -sel-pathway 1 -sel-solvent 'Water' -pf-cutoff 0

This sometimes works (only for short simulations so far) but is very slow - I have been running one for ~2 weeks now and it hasn't finished. This simulation is 1.3 microseconds. One of my full length trials exited after about 10 days with this error:

 Standard library runtime error (possible bug):
(exception type: St13runtime_error) Could not converge error bound without exceeding maximum truncation number p = 500.

To try to speed this up, I tried setting the initial probe position, like so:

chap -f ../../solvated_pores.trr -s ../../solvated_pores.pdb -sel-pathway 1 -sel-solvent 'Water' -pf-cutoff 0 -pf-init-probe-pos 10.5 23.1 6.5

which runs much faster but every time exits with this error:

Standard library logic error (bug): 
(exception type: St12out_of_range) vector::_M_range_check: __n (which is 2) >= this->size() (which is 2)

To try to fix this, I started setting -pf-max-free-diff. Here is what I tried:

chap -f ../../../solvated_pores.trr -s ../../../solvated_pores.pdb -sel-pathway 1 -sel-solvent 'Ion' -pf-cutoff 10 -pf-init-probe-pos 10.5 23.1 6.5 -pf-max-free-dist 1

which says that the pore radius at initial probe position is infinite. When I set -pf-max-free-dist to something a bit higher, say 4 or 5, I get the error that

Standard library runtime error (possible bug):
(exception type: St13runtime_error) Could not converge error bound without exceeding maximum truncation number p = 500.

This is a simulation of proteins in a standard water and ion box. There are traditional pores in the middle of the proteins, and more unusual pores in between the proteins. The system itself is quite big (~1.7 mil atoms). Apart from that, there are no non-protein components in the system, and the water and ions are nondescript. When I have gotten chap to finish normally, it finds the pore at the center of mass of the whole system, and can properly analyze that pore for short simulations (200 ns) but has not successfully finished for a full length trajectory (1.3 microseconds).

cgseitz commented 2 years ago

Considering the analysis will successfully finish on shorter trajectories, is there a way to just run a series of shorter trajectories and then combine the outputs afterwards?

Inniag commented 2 years ago

You would have to write your own Python/R/Matlab code to average the profiles from the trajectory chunks. For confidence intervals, you'd need to decide on how to propagate errors. For the 3D visualisations, this may be significantly more complex, you'd have to write your own rendering code (or appropriate the code from CHAP, if you are familiar with C++).

One other approach could be to skip trajectory frames, i.e. take only every 100th or so frame. This should give you a statistically meaningful estimate as well, provided there are no large conformational changes.

cgseitz commented 2 years ago

Thanks! I ended up using every 10th frame and eliminating a few troublesome frames. In these, it appeared that the pore closed. Using every frame resulted in too many troublesome frames to readily detect and eliminate. I ended up averaging analyses since my trajectories were all the same length, and just used representatives for the 3D visualizations.