B-factor analysis in nanobodies I am doing my research on nanobodies. Currently, I am trying to do a comparison study of the flexibility of CDR loops using B-factor values. I would like to know if there is any statistical analysis tool for this or if anyone has done anything similar.
So B-factors, for &quot;blur factors&quot;, are how much movement an atom has in the crystal structure. They are not reliable. B-factor putty in PyMOL is the most you should push them.
B-factors bad
This is partly a result of flexibility, but it is highly influenced by crystal packing, which is not natural. Many enzymes, for example, are seen with an active site entrance way that is closed up in a crystal structure whereas in an MD run there is a gate loop that flops around.
Additionally, a B-factor is a single value that masks lots of forms of movement. Partial occupancy after all is at the discretion of the experimenter, so you might even have a residue in two or three low energy states that result nevertheless in B-factor disorder.
Furthermore, incorrectly fitted residues will have a higher B-factor.
Also, the meaning of B-factor are mighty cryptic, and depend on the refinement —the units are Å^2 as opposed to say Å, like a standard deviation.
MD RMSF good
The best way to determine the movement of a residue is to do an MD run. Gromacs has very nice tutorial and is the most accessible.
The metric in that case is the RMSF, which is the RMSD relative to the average. Gromacs has a utility for it called rmsf. Alternatively RMSD relative to your original structure is fine —but less of a metric of movement.
MD is complained about for three reasons, none are valid here:

Tricky to set up: this is a straightforward case
Lengthy: You would not be after large scale conformational changes so a limited amount of steps would suffice —possibly even on a laptop on a single core for a couple of hours (cluster is always better though!). Running at different temperatures and switching the intermediate steps (replica exchange) is often done to speed things up, but would just confuse the results.
Small molecules: A nanobody has no cofactors or small molecule ligands so you'd avoid the topology parameterisation issues. If Eukaryotic made, your nanobodies may be glycosylated — play it safe and ignore.

B-factor extraction
If you want to extract the B-factors, you can use pymol as a python module —installed with conda and not the binary/exe installer. And use python as follows:
pdb_filename = &quot;&quot;
selector = &quot;name CA&quot;
import pymol2
with pymol2.PyMOL() as pymol:
     pymol.cmd.load(pdb_filename)
     bfactors = {atom.resi: atom.b for atom in pymol.cmd.get_model(selector).atom}

From there do whatever you fancy with the b-factors. For alternative selector strings see Pymol selection algebra. One operation is to divide the values by 8 pi^2 and take the square root of that, which is the amplitude of oscillation (U) of the atom around its equilibrium position —ie. that stated in the coordinates.