| 1 |
Bead model alignment |
| 2 |
.................... |
| 3 |
|
| 4 |
Here are presented some basics way to use beed-model alignment in FreeSAS as a library. |
| 5 |
Some abbreviations: |
| 6 |
|
| 7 |
- DA = Dummy Atom |
| 8 |
- DAM = Dummy Atoms Model |
| 9 |
- NSD = Normalized Spatial Discrepancy |
| 10 |
|
| 11 |
|
| 12 |
The SASModel class |
| 13 |
"""""""""""""""""" |
| 14 |
|
| 15 |
This class allows to manipulate a DAM and to do some operations on it as |
| 16 |
it is presented here. |
| 17 |
|
| 18 |
First, the method SASModel.read() can be used to read a pdb file |
| 19 |
containing data of a DAM : |
| 20 |
|
| 21 |
.. code-block:: python |
| 22 |
|
| 23 |
from freesas.model import SASModel |
| 24 |
model1 = SASModel() #create SASModel class object |
| 25 |
model1.read("dammif-01.pdb") #read the pdb file |
| 26 |
#these 2 lines can be replaced by model1 = SASModel("dammif-01.pdb") |
| 27 |
print(model1.header) #print pdb file content |
| 28 |
print(model1.atoms) #print dummy atoms coordinates |
| 29 |
print(model1.rfactor) #print R-factor of the DAM |
| 30 |
|
| 31 |
Some informations are extracted of the model atoms coordinates: |
| 32 |
|
| 33 |
- fineness : average distance between a DA and its first neighbours |
| 34 |
- radius of gyration |
| 35 |
- Dmax : DAM diameter, maximal distance between 2 DA of the DAM |
| 36 |
- center of mass |
| 37 |
- inertia tensor |
| 38 |
- canonical parameters : 3 parameters of translation and 3 euler |
| 39 |
angles, define the transformation to applied to the DAM to put it |
| 40 |
on its canonical position (center of mass at the origin, inertia axis |
| 41 |
aligned with coordinates axis) |
| 42 |
|
| 43 |
.. code-block:: python |
| 44 |
|
| 45 |
print(model1.fineness) #print the DAM fineness |
| 46 |
print(model1.Rg) #print the DAM radius of gyration |
| 47 |
print(model1.Dmax) #print the DAM diameter |
| 48 |
model1.centroid() #calculate the DAM center of mass |
| 49 |
print(model1.com) |
| 50 |
model1.inertiatensor() #calculate the DAM inertiatensor |
| 51 |
print(model1.inertensor) |
| 52 |
model1.canonical_parameters() #calculate the DAM canonical_parameters |
| 53 |
print(model1.can_param) |
| 54 |
|
| 55 |
Other methods of the class for transformations and NSD calculation: |
| 56 |
|
| 57 |
.. code-block:: python |
| 58 |
|
| 59 |
param1 = model1.can_param #parameters for the transformation |
| 60 |
symmetry = [1,1,1] #symmetry for the transformation |
| 61 |
model1.transform(param1, symmetry) |
| 62 |
#return DAM coordinates after the transformation |
| 63 |
|
| 64 |
model2 = SASModel("dammif-02.pdb") #create a second SASModel |
| 65 |
model2.canonical_parameters() |
| 66 |
atoms1 = model1.atoms |
| 67 |
atoms2 = model2.atoms |
| 68 |
model1.dist(model2, atoms1, atoms2)#calculate the NSD between models |
| 69 |
|
| 70 |
param2 = model2.can_param |
| 71 |
symmetry = [1,1,1] |
| 72 |
model1.dist_after_movement(param2, model2, symmetry) |
| 73 |
#calculate the NSD, first model on its canonical position, second |
| 74 |
#model after a transformation with param2 and symmetry |
| 75 |
|
| 76 |
|
| 77 |
The AlignModels class |
| 78 |
""""""""""""""""""""" |
| 79 |
|
| 80 |
This other class contains lot of tools to align several DAMs, using the |
| 81 |
SASModel class presented before. |
| 82 |
|
| 83 |
The first thing to do is to select the pdb files you are interested in |
| 84 |
and to create SASModels corresponding using the method of the class like |
| 85 |
following : |
| 86 |
|
| 87 |
.. code-block:: python |
| 88 |
|
| 89 |
from freesas.align import AlignModels |
| 90 |
inputfiles = ["dammif-01.pdb", "dammif-02.pdb", "dammif-03.pdb", ...] |
| 91 |
align = AlignModels(inputfiles) #create the class |
| 92 |
align.assign_models() #create the SASModels |
| 93 |
print(align.models) #SASModels ready to be aligned |
| 94 |
|
| 95 |
Next, the different NSD between each computed models can be calculated |
| 96 |
and save as a 2d-array. But first it is necessary to give which models are |
| 97 |
valid and which ones are not and need to be discarded : |
| 98 |
|
| 99 |
.. code-block:: python |
| 100 |
|
| 101 |
align.validmodels = numpy.ones((len(align.inputfiles))) |
| 102 |
#here we keep all models as valid ones |
| 103 |
align.makeNSDarray() #create the NSD table |
| 104 |
align.plotNSDarray() #display the table as png file |
| 105 |
align.find_reference() #select the reference model |
| 106 |
align.alignment_reference() #align models with the reference |
| 107 |
|
| 108 |
|
| 109 |
SuPyComb script |
| 110 |
............... |
| 111 |
|
| 112 |
| FreeSAS can also be used directly using command lines. Here is |
| 113 |
presented the way to use the program supycomb, the re-implementation |
| 114 |
of the supcomb of the |
| 115 |
`Atsas package <http://dx.doi.org/10.1107/S0021889800014126>`_. |
| 116 |
|
| 117 |
| Supycomb has two different process, the first one is called when only |
| 118 |
two pdb files are put as arguments and a second one for more than two |
| 119 |
files. |
| 120 |
|
| 121 |
| With the first process, the program creates the two DAM provided by pdb |
| 122 |
files and align the second one on the first one (reference, do not move). |
| 123 |
The coordinates of the atoms of the aligned model are saved in a pdb file |
| 124 |
and the program return the final NSD between the two DAM. The name of the |
| 125 |
output can be modified. |
| 126 |
|
| 127 |
| The second one creates a model for each file put as argument. Models are |
| 128 |
first selected as valid or not using its R-factor value. The maximum |
| 129 |
value is the mean of R-factors plus twice the standard deviation. The |
| 130 |
figure of the R-factors is then displayed or saved automatically in png |
| 131 |
format. |
| 132 |
| Next, NSD between each valid DAM are computed to select best models |
| 133 |
using the mean of NSD with other models for each DAM. A maximal value |
| 134 |
for the NSD mean is create as the mean of the ND mean plus a standard |
| 135 |
deviation to discarded the to different models. The model with the lower |
| 136 |
NSD mean is the reference one. A second figure with the NSD table and the |
| 137 |
graphic with the NSD means is displayed or saved. |
| 138 |
| Finally, the valid models are aligned on the reference one and final |
| 139 |
positions are saved in pdb files called model-01.pdb, model-02.pdb, etc... |
| 140 |
|
| 141 |
|
| 142 |
| Several options are available for the supycomb program: |
| 143 |
|
| 144 |
.. command-output:: supycomb --help |
| 145 |
|
| 146 |
| Slow mode / fast mode: |
| 147 |
| For the slow mode, the optimization of the NSD is done for each symmetry |
| 148 |
(ie. 8 times) whereas for the fast mode, the best symmetry is first |
| 149 |
chosen without optimization and only the NSD for this symmetry is |
| 150 |
optimized. |
| 151 |
The result is that the slow mode is nearly 8 times slower than the fast |
| 152 |
one. The NSD values thought are a few lower using the slow mode. |
| 153 |
|
| 154 |
| Enantiomorphs option: |
| 155 |
| This option can be used to authorize or not the program to look for |
| 156 |
enantiomorphs. If not, the program will not test 8 symmetries but only 4. |
| 157 |
The execution time will be nearly twice lower without enantiomorphs but |
| 158 |
only if you are using the slow mode, the gain is negligible for the fast |
| 159 |
mode. Moreover, it will not be able to recognize two enantiomorphs of the |
| 160 |
same protein. |
| 161 |
|
| 162 |
| GUI option: |
| 163 |
| If you choose to display the computed figures during the execution of |
| 164 |
the program to save it or not, so to use the Graphical User Interface, |
| 165 |
you have to select this option as "YES" (set by default). It is also |
| 166 |
possible to save it automatically as png files by setting the option as |
| 167 |
"NO". |
| 168 |
|
| 169 |
| Output option: |
| 170 |
| This option allow to change the default filename of the output for the |
| 171 |
two models alignment process. It has to be a .pdb file ! |