We have some measures that take coordinates in a model and compare them to the experimental measurements or something you can calculate from the experimental measurements.
That is the basis of what we mean when we talk about refinement.
So a few slides now on the issue of refinement, making things better.
Let me give you two definitions of the word refinement.
The first one is very easy or relatively specific.
The idea of refinement is to move coordinates in your model around so that they agree with something you have measured or something you have calculated.
So moving coordinates around to agree better with structure factors or density that you have calculated.
And with this first definition, I'm nearly always talking about using a program, an optimization program that does this relatively automatically.
So a program that takes the XYZs and moves them around and tries to get the protein coordinates to agree with the measured data.
Second definition is a little bit more vague, and that will be refinement might mean more than just moving coordinates around because you could also try to optimize things like B-factors.
And also the presence or absence of ions, ligands, water molecules.
I will come back to that right at the end of this session.
So broadly, what we're saying is we have a cost function, and that's a term you will meet often.
So cost Vtoyo. So this cost function is a function of the set.
So here are squiggly brackets for a set.
The cost function is a function of a set of XYZ coordinates.
Usually, I will not write XYZ explicitly. I would just write a collection of vectors. So with a vector sign on top.
If you want to be very formal, you could say that our cost function does not only depend on the coordinates in the protein.
If we're doing crystallography, it might also depend on B-factors, for example.
If we get really formal and even a little bit more correct, we would say that our cost function C here is a function of a set of coordinates and a set of perhaps electron densities.
To calculate the cost function, we also need our maps of densities.
If we're talking about NMR, our cost function here depends on the coordinates and on some set of distances.
Or I might say if I'm talking about calculating out an R-factor, our cost function depends on the coordinates and our set of original structure factors.
Remember, FCs would be calculated from the R's.
And when I talk about an optimizer, I'm usually talking about something that has to calculate out the gradient of the function.
So when we're trying to optimise with respect to coordinates, we want the derivative here of our cost function, either x, y, z, or the derivative with respect to this vector.
As to oblige with respect to our set of coordinates here.
And this is written down correctly. I'm usually not talking about a complete derivative, so I use the symbol here for a partial derivative.
That is truly a detail, just so I'm correct.
So we're talking we have a cost function, and we are trying to go down the function in terms of coordinates and find the minimum of our cost function.
I'm not going to give a lecture on how that works in detail in the methods, but let's compare how we can use this idea in the context of NMR or cryo-EM or X-ray crystallography.
So when I talk about refinement, let's start with NMR.
Remember with NMR, I measure spectra, NOEs, I get distances, and I might use the metric matrix method to generate coordinates.
I'm sure everybody has forgotten, but that's this process where I build distances to the centre of mass squared matrix, and then I get out the eigenvectors corresponding to the three largest eigenvalues and so on.
And then I get out a set of coordinates for all of the atoms, but they're not very good coordinates.
Remember I said this kind of distance geometry has got an interesting property.
It distributes the error equally overall distances or coordinates, which means that measured distances might be wrong, and even bond lengths are wrong in the coordinates that you generate.
So the initial coordinates in the metric matrix method are extremely bad. They don't look like chemical coordinates.
So you make a refinement function, which fixes the chemistry, and talking about experimental data, includes a term where we look at all of the distances we have measured, and we compare the distance in the model to the distance that we expect from the experimental data.
So this would be the kind of function you would be minimizing.
The second distance geometry method I spoke about was called the variable target function method.
This thing is an optimization process from start to finish. So it is a kind of, for me, it is a kind of, the whole thing is a refinement process.
There is no separate generation and refinement.
Okay, what about cryo-electron microscopy? We do not have any comparison with the raw data, but what a cryo-EM person does is they move x, y, and z, and probably b factors around,
so that the calculated electrostatic potential here is similar to the electrostatic potential that they calculated from their half a million pictures.
So you would be optimizing a function that looks like this one here by moving the coordinates of atoms around, and you definitely can take the s to uplight on the derivative of this function with respect to coordinates.
Okay, the crystallographers, when they are refining, they sometimes do a fit into the map, actually they do that all the time, and that would be the same kind of function.
So moving coordinates around so that the calculated density is as close as possible to the density that they expect from their measurements.
But they also do a fit to reflections, and that is essentially something like the R-value. So looking at all of the reflections here, how is the calculated structure factor different to the measured structure factor?
So we have refinement, the word refinement, in all of these contexts. The function that they use is going to be different in every context.
When I talk about refinement of a structure, it's a straightforward optimization calculation.
How many variables do I have, or how many adjustable parameters do I have?
The first thing you would say is I've got, let's call it, NA atoms. So I've got at least NA variables. But I've got more, of course, because think about what coordinates mean.
If I've got one coordinate, that's x, y, and z's, which have to be adjusted separately. So one atom is at least three parameters. If I'm talking about NMR data, the number of parameters I've got is going to be roughly three times the number of atoms.
If I'm talking about cryo-EM or x-ray crystallography, these will be the same. I have x, y, and z coordinates, but I also have this idea of the B factor. So is my data better modeled by a pointy thin Gaussian or by this smeared out Gaussian over there?
And it's the B factor that controls this. Remember, a big B factor means you think the atom is mobile, so it's more smeared out. And the consequence is that you can make your data, you can make your model better fit the data, also by adjusting these B factors here.
So for cryo-EM and x-ray crystallography, I've got not just x, y, z, but I've also got beta. So if I am optimizing the B factors, I've got four times the number of atoms, adjustable parameters.
And now, a 30-second detour on a Kleiner Unveg. There is one thing you should remember when you talk about atomic optimization problems. You will normally not see 3N, this here, as the number of things to optimize.
Because imagine I'm talking about one particle, the x, y, z. Where I put this particle depends on my frame of reference. If I've got a protein here, this is one protein just rotated or translated.
It's all the same protein here, but the x, y, z's are different, which means that the number of interesting degrees of freedom is not 3 times the number of atoms. We normally talk about it as 3 times N minus 3 translational degrees of freedom
and 3 rotational degrees of freedom. So if I have a molecule with 100 atoms, I don't have 300 parameters to optimize. I've actually got 294 parameters. That's a detail, but it can be confusing if you look in the literature, if you are not used to this.
Right, so basically we've got, for NMR, 3N parameters. For cryo-EM or x-ray, it might be 3N or 4N. Let us make the story a little bit more interesting and realistic. Still the question is, how many variables or parameters do I have to be refined?
And I say I have about NA atoms, but now what if I say the bonds are actually fixed? They have known distances. That means the number of variables is going to get smaller.
Roughly how many bond lengths do I have in a molecule? If I've got 100 atoms, I've got a bit more than 100 bonds. At least it grows linearly, but let's call it N atoms, N bonds. It's more than that.
That sounds reasonable, and it is chemically okay because mostly the measurements on proteins and nucleotides are just not accurate enough to notice any differences in bond lengths. So I might as well look them up in a textbook and treat them as fixed distances.
What about bond angles? So that's something different. They do vary a little bit, but also not very much. The number of angles certainly grows linearly with the number of atoms. Let's say the number of angles is also approximately the number of atoms.
So now, using this gross approximation, I've said there is an NK here, which is about the number of atoms times 2. So it's the number of known lengths and angles.
So how many parameters do I now have to be adjusted or refined? For NMR, I've got my 3N, but now it's 3N minus 2N, so I've got about NA parameters to adjust. It would be a bit smaller.
For cryo-EM, I've got AND X-ray. I've got my 4N, because I have XYZ and B factors, minus adjusting for known lengths and bond angles.
So for cryo-EM and X-ray, I'd say I've got about twice as many parameters here, so 2 times the number of atoms. It's going to be smaller than that.
Is this a good thing to do? Is this a reasonable way to look at it? It's a very reasonable way to look at the problem.
Let's answer the question. Should you treat bond lengths and angles as fixed? We want to do this, because then we can reduce the number of adjustable parameters.
So our number of parameters started as 3N minus 6. Maybe it's 3N minus 6 minus this NK, the number of known distances.
Should we fix the bond lengths and angles? With NMR, the answer is yes. There's going to be so little data, and it's not that accurate, so you really want to reduce the number of adjustable parameters.
With X-ray, it's a little bit more interesting. For proteins and nucleotides, you probably want to treat the bond lengths as fixed, at least at the start of a calculation.
The data is not really accurate enough to justify those extra variables. It might be sometimes.
Small molecule crystallographers look at the problem quite differently. So small molecule crystallography means the kind of thing they do in organic chemistry all the time.
They actually would probably treat their bond lengths and angles as completely free parameters. So if they've got N atoms, they probably have 3 or 4 times N adjustable parameters.
So X-ray crystallography of small molecules does not fix bond lengths or angles in general.
Cryo-EM, their data is also not so accurate, so they would probably be working with fixed bond lengths and bond angles, I would say.
What is the consequence of all of this argumentation?
Whenever you do an optimization problem, one major concern is the number of parameters you have and the number of observations you have.
Do you have enough observations to define your parameters? So let's summarize it here. You've got NP adjustable parameters and NO observations.
Obviously, you want to have this ratio, the number of observations divided by the number of parameters. You want this to be as large as possible.
So in NMR, you've got 100 maximum 10,000 NOEs. I've never seen that many.
Your ratio of number of observations to parameters is pretty bad. You do not have any information to spare in NMR spectroscopy.
Crystallography, number of observations might be 10,000, 100,000. Your data are reflections, and your ratio of observations to parameters is usually not too bad.
So we won't say it's bad. We'll say it goes from good to bad. And by cryo-electron microscopy, it's really hard to quantify the number of observations.
Is one photo, one picture, an observation? Then you could say in typical cryo-electron microscopy, they've got 10,000 to a million pictures would be typical numbers.
So that raises the question, is a picture, one picture, one observation? The answer is no, it's more than one observation because it actually has a lot of information inside it. It has a lot of pixels.
So it's hard to quantify the amount of information they've got. The pictures are not independent of each other. So the number of independent observations is very hard to quantify.
And what you would say is that in a modern cryo-EM structure, reasonable quality, the ratio of observations to parameters is probably better than NMR, probably.
Actually, not always, and not as good as X-ray crystallography. So those are very broad classes, but they're probably pretty much correct.
There is still more to consider when we talk about the number of parameters, especially in X-ray crystallography and cryo-EM.
Remember, the danger of having too many parameters in a fitting problem is the question of overfitting or fitting to noise.
In other lectures, this might seem a tiny bit abstract when I talk about the difference fitting to a straight line or fitting to a low order polynomial or functions which have got more and more parameters.
Here, however, it's a really fun and clear example of the danger of overfitting, fitting to the noise.
For this example, consider some density here. This density does actually correspond to this protein over here.
Look closely at the density here, and you can see some lonely looking spots like here and here and here and so on.
You may well reasonably say, are these the ends of side chains or are they just noise? Real experimental noise.
But then don't ask yourself that question. Are they noise? Imagine you are fitting atoms into this density.
You see a spot like that and say, OK, I will put a water molecule exactly into this spot here or perhaps an ion, sodium ion or chloride ion, something like that.
You just put something into that noise and suddenly the agreement between your coordinates and the map is much better.
It has to be. This spot was empty before, but now it has got something filling it.
If you look on the right hand side, you can actually see lots of loose water molecules, these red dots, where somebody said, oh, I think I will put a water molecule there.
When you add a water molecule like that, you remove some disagreement.
Initially, we did not have an explanation for this bit of density here, but now we put a water molecule in there.
The agreement between calculated density and whatever is in this map, this disagreement gets smaller.
So adding ions and water and little ligands, those are secret parameters. They really are adjustable parameters. How many water molecules do I have?
They do not fit well into classic analysis of the number of parameters.
So it is not easy to quantify this in terms of parameter and observation ratios, but that is a real, not danger, but it is a real property of X-ray crystallography and cryo-ion.