keitaroyam / servalcat

Structure refinement and validation for crystallography and single particle analysis
Mozilla Public License 2.0
24 stars 3 forks source link

Fix a log message in fofc #20

Closed Guillawme closed 3 days ago

Guillawme commented 1 month ago

Hello,

This commit fixes a log message from servalcat fofc that suggests a non-existing map file for the command to search for peaks when the option --omit_h_electron is used.

There is no code change otherwise.

I hope this helps!

keitaroyam commented 1 month ago

Thank you for this. I implemented --omit_h_electron for an experiment and didn't expect it to be used. Are you using this option?

Guillawme commented 1 month ago

Well, I am not sure if I need this option actually.

From the documentation I can't figure out whether I need it or not. What made me think that I need it are the fact that there is an option to specify which scattering factors to use (--source {electron,xray,neutron}), and these sentences from your paper:

An electron in an H atom is usually shifted towards the parent atom from the nucleus position. In EM, both the electrons and the nucleus contribute to scattering, and this offset results in a shift of hydrogen density peaks beyond the position of the hydrogen nucleus

Hydrogen electrons are usually shifted towards the parent atoms by 0.1–0.2 Å (Williams et al., 2018). This must be accounted for when calculating structure factors from the atomic model (Fc). REFMAC5 and Servalcat (GEMMI) use the Mott–Bethe formula (Mott & Bragg, 1930; Bethe, 1930; Murshudov, 2016), which can conveniently take this fact into account.

Good to know if only --omit_proton is needed to calculate an H-omit diffmap from a cryoEM map. But in this case, it would be helpful to clarify the documentation and help messages.

Either way, I think it would be good to fix the log message since this option is already exposed, and when using it and trying to use the suggested command from the log there is a mismatch between what the log suggests and the actual file name.

keitaroyam commented 1 month ago

Let me just quickly clarify one thing. --omit_proton is not intended for creating an H-omit diffmap. It solely omits the proton (hydrogen nucleus) while retaining the electron density of hydrogen. This is the opposite of --omit_h_electron. Both of these keywords are experimental.

Yes, these things should be clarified in the help message and documentation. I will work on this, and address other points later.

Guillawme commented 1 month ago

So what is the correct way to calculate an H-omit diffmap from a cryoEM map, if not by passing both of these options? Using an input model without hydrogen atoms at all?

My current understanding is that I need --source electron --omit_proton --omit_h_electron if using an input model with hydrogens. But this is clearly not correct according to your answers here.

keitaroyam commented 1 month ago

Using an input model without hydrogen atoms at all?

Yes. Specifying both --omit_proton --omit_h_electron also seems to work, but this is not a recommended way.

Guillawme commented 2 weeks ago

I wanted to post this earlier, only found time now.

It seems like these two ways of calculating an H-omit difference map don't produce identical results. So, it's probably a good idea to clearly explain in the documentation which way is correct and supported, and to mark the options as experimental for the unsupported way.

The runs shown below used the same input half maps, same input mask, same input atomic model (in one case with H atoms coming from a run of servalcat with --hydrogen all --hout, in the other case after having deleted these H atoms in ChimeraX; coordinates are otherwise identical), sharpened maps and difference maps all shown at contour level 15 rmsd in Coot. The FSC=0.143 resolution is ~1.45, which is why it seems justified to me to compute H-omit diffmaps (according to your paper).

Both used servalcat version 0.4.88 installed from PyPI.

First run

Atomic model containing H atoms and following command:

servalcat fofc \
    --halfmaps $HALF_MAPS \
    --model $MODEL \
    --resolution $RESOLUTION \
    --mask $MASK \
    --omit_proton \
    --omit_h_electron \
    --source electron

Result:

run-03

Second run

Same atomic model as first run, but after deleting H atoms, and following command:

servalcat fofc \
    --halfmaps $HALF_MAPS \
    --model $MODEL \
    --resolution $RESOLUTION \
    --mask $MASK \
    --source electron

Result:

run-04

When playing with the contour level, this method shows the charge delocalization at the guanidinium group (the two positive peaks at the top N atoms merge into a wider blob at lower contour level), while the method of the first run keeps these two peaks clearly separated even at lower contour level. There are other places with differing diffmap peaks, some can be noticed in these pictures.

keitaroyam commented 3 days ago

Thank you for the analysis! I looked into the code, and found the difference:

This wasn't intended; at some point I decided to apply mask to Fc map, and just didn't care about these omit options. Anyway this is how it is. For now, I merged your change and hide these experimental options.

keitaroyam commented 3 days ago

I manually merged this and github does not seem to recognise it. Please see https://github.com/keitaroyam/servalcat/commit/343c6bc25f9468661d7ba223a19f96cf7e0a9d4f. Thanks again!

Guillawme commented 2 days ago

Glad that it helped!