pwem.convert.atom_struct module
- class pwem.convert.atom_struct.AtomicStructHandler(fileName=None, permissive=1)[source]
Bases:
object
Class that contain utilities to handle pdb/cif files
- CIF = 1
- PDB = 0
- addStruct(secondPDBfileName, outPDBfileName=None, useModel=False)[source]
Join the second structure to the first one. If cheon numes are the same rename them. if outPDBfileName id provided then new struct is saved to a file
- centerOfMass(geometric=False)[source]
Returns gravity [default] or geometric center of mass of an Entity (anything with a get_atoms function in biopython. Geometric assumes all masses are equal (geometric=True)
- extractChain(chainID, start=0, end=-1, modelID='0', filename='output.mmcif')[source]
Code for chopping a structure. This module is used internally by the Bio.PDB.extract() function.
- getBoundingBox(expand=3)[source]
Get bounding box (angstroms) for atom struct. Only alpha carbons are taken into account. parameter: expand.- make box larger addind this factor
- getFullID(model_id='0', chain_id=None)[source]
assign a label to a sequence obtained from a PDB file :parameter model_id chain_id :return: string with label
- getModelsChains()[source]
- given an atomic structure returns two dictionaries:
for all models and respective chains (chainID and length of residues)
for each chain list of residues
- getStructureBFactorValues()[source]
Using an atomic structure as input, this method returns two list: * List 1: B-factor field values for each atom of the structure. * List 2 is a list of lists. For each residue of the structure a list with the model, chain, order number of residue, name of residue and average of B-factor field values (atoms) is returned. An example of each list item is: [0, ‘A’, 103, ‘PHE’, 96.01]
- getTransformMatrix(atomStructFn, startId=-1, endId=-1, outFn=None)[source]
find matrix that Superimposes two atom structures. this matrix moves atomStructFn to self
- readFromPDBDatabase(pdbID, dir=None, type='mmCif')[source]
Retrieve structure from PDB :param pdbID: :param dir: save structure in this directory :param type: mmCif or pdb :return: filename with pdb file
- readLowLevel(fileName)[source]
Return a dictionary with all mmcif fields. you should parse them Example: get the list of the y coordinates of all atoms
dict = readLowLevel(“kk.pdb”) y_list = dict[‘_atom_site.Cartn_y’]
- renameChains(structure)[source]
Renames chains to be one-letter chains
Existing one-letter chains will be kept. Multi-letter chains will be truncated or renamed to the next available letter of the alphabet.
If more than 62 chains are present in the structure, raises an OutOfChainsError
Returns a map between new and old chain IDs, as well as modifying the input structure
- transform(transformation_matrix, sampling=1.0)[source]
Geometrical transformation of a PDB structure
- Parameters
entity – PDB biopython structure
:param transformation_matrix -> 4x4 scipion matrix :param sampling: scipion transform matrix is applied to voxels so
length must be multiplied by samplingRate
- internal variables:
- rotation matrix -> numpy.array(
- [[ 0.5, -0.809017, 0.309017],
[ 0.809017, 0.30917, -0.5 ], [ 0.309017, 0.5, 0.809017]])
translation: translation vector -> numpy.array([1., 0., 0.], ‘d’)
- Returns
no return, new data overwrites entity
- pwem.convert.atom_struct.addScipionAttribute(cifDic, attributeScoresDic, attrName, recipient='residues')[source]
Add a scipion attribute in a section of the CIF dictionary “cifDic”: must be a cif dictionary parsed by Biopython “attributeScoresDic” a dictionary of the form {spec: value}”