FreeSAS Package

class freesas.model.SASModel(molecule=None)

Tools for Dummy Atoms Model manipulation

Dmax
Rg
calc_invariants(use_cython=True)
Calculate the invariants of the structure:
  • fineness, ie. average distance between an atoms and its nearest neighbor
  • radius of gyration of the model
  • diameter of the model
Return invariants:
 3-tuple containing (fineness, Rg, Dmax)
canonical_parameters()

Save the 6 canonical parameters of the initial molecule: x0, y0, z0, the position of the center of mass phi, theta, psi, the three Euler angles of the canonical rotation (axis:x,y’,z’‘)

canonical_rotate()

Calculate the rotation matrix to align inertia momentum of the molecule on principal axis.

Return rot:rotation matrix det==1
canonical_translate()

Calculate the translation matrix to translate the center of mass of the molecule on the origin of the base.

Return trans:translation matrix
centroid()

Calculate the position of the center of mass of the molecule.

Return self.com:
 1d array, coordinates of the center of mass of the molecule
dist(other, molecule1, molecule2, use_cython=True)

Calculate the distance with another model.

Parameters:
  • self,other – two SASModel
  • molecule1 – 2d array of the position of each atom of the first molecule
  • molecule2 – 2d array of the position of each atom of the second molecule
Return D:

NSD between the 2 molecules, in their position molecule1 and molecule2

dist_after_movement(param, other, symmetry)

The first molecule, molref, is put on its canonical position. The second one, mol2, is moved following the transformation selected

Parameters:
  • param – list of 6 parameters for the transformation, 3 coordinates of translation and 3 Euler angles
  • symmetry – list of three constants which define a symmetry to apply
Return distance:
 

the NSD between the first molecule and the second one after its movement

fineness
inertiatensor()

calculate the inertia tensor of the protein

Return self.inertensor:
 inertia tensor of the molecule
read(filename)

Read the PDB file, extract coordinates of each dummy atom, extract the R-factor of the model, coordinates of each dummy atom and pdb file header.

Parameters:filename – name of the pdb file to read
save(filename)

Save the position of each dummy atom in a PDB file.

Parameters:filename – name of the pdb file to write
transform(param, symmetry, reverse=None)

Calculate the new coordinates of each dummy atoms of the molecule after a transformation defined by six parameters and a symmetry

Parameters:
  • param – 6 parameters of transformation (3 coordinates of translation, 3 Euler angles)
  • symmetry – list of three constants which define a symmetry to apply
Return mol:

2d array, coordinates after transformation

freesas.model.delta_expand(vec1, vec2)

Create a 2d array with the difference vec1[i]-vec2[j]

Parameters:vec2 (vec1,) – 1d-array
Return v1 - v2:difference for any element of v1 and v2 (i.e a 2D array)
class freesas.align.AlignModels(files, slow=True, enantiomorphs=True)

Used to align DAM from pdb files

alignment_2models(save=True)

Align two models using the first one as reference. The aligned models are save in pdb files.

Return dist:NSD after alignment
alignment_reference(ref_number=None)

Align all models in self.models with the reference one. The aligned models are saved in pdb files (names in list self.outputfiles)

alignment_sym(reference, molecule)

Apply 8 combinations to the molecule and select the one which minimize the distance between it and the reference.

Parameters:
  • reference – SASModel, the one which do not move
  • molecule – SASModel, the one wich has to be aligned
Return combinaison:
 

best symmetry to minimize NSD

Return p:

transformation parameters optimized if slow is true, unoptimized else

assign_models()

Create SASModels from pdb files saved in self.inputfiles and saved them in self.models. Center of mass, inertia tensor and canonical parameters are computed for each SASModel.

Return self.models:
 list of SASModel
find_reference()

Find the reference model among the models aligned. The reference model is the one with lower average NSD with other models.

Return ref_number:
 position of the reference model in the list self.models
makeNSDarray()

Calculate the NSD correlation table and save it in self.arrayNSD

Return self.arrayNSD:
 2d array, NSD correlation table
optimize(reference, molecule, symmetry)

Use scipy.optimize to optimize transformation parameters to minimize NSD

Parameters:
  • reference – SASmodel
  • molecule – SASmodel
  • symmetry – 3-list of +/-1
Return p:

transformation parameters optimized

Return dist:

NSD after optimization

plotNSDarray(rmax=None, filename=None, save=False)

Create a png file with the table of NSD and the average NSD for each model. A threshold is computed to segregate good models and the ones to exclude.

Parameters:
  • rmax – threshold of R factor for the validity of a model
  • filename – filename for the figure, default to nsd.png
  • save – save automatically the figure if True, else show it
Return fig:

the wanted figures

class freesas.align.InputModels
assign_models(molecule=None)

Create SASModels from pdb files saved in self.inputfiles and saved them in self.models. Center of mass, inertia tensor and canonical parameters are computed for each SASModel.

Parameters:molecule – optional 2d array, coordinates of the atoms for the model to create
Return self.models:
 list of SASModel
models_selection()

Check if each model respect the limit for the R-factor

Return self.validmodels:
 1d array, 0 for a non valid model, else 1
rcalculation()

Calculation the maximal value for the R-factors, which is the mean of all the R-factors of inputs plus 2 times the standard deviation. R-factors are saved in the attribute self.rfactors, 1d array, and in percentage.

Return rmax:maximal value for the R-factor
rfactorplot(filename=None, save=False)

Create a png file with the table of R factor for each model. A threshold is computed to discarded models with Rfactor>Rmax.

Parameters:
  • filename – filename for the figure, default to Rfactor.png
  • save – save automatically the figure if True, else show it
Return fig:

the wanted figures

This Page