Assemblies

Structures can be arranged in assemblies (class Assembly). Within an assembly, Structures can be manipulated and their properties assessed either together or individually.

Assembly has a subclass, Polyhedron, providing a methodology to arrange structures on a polyhedral scaffold. In turn, Polyhedron has a Multimer subclass, handling the case where assembles Structures are instances of the Molecule class.

Assembly

class Assembly[source]

Construct and manipulate assemblies of multiple Structure instances.

An Assembly is composed of several building blocks (instances of Structure class) referred to as “unit”, and stored in the self.unit list. User-friendly names for these unites are stored in the self.unit_labels list. If no name is provided, a number will be assigned (as a string, starting from 0).

add_conformation(new_assembly)[source]

append a new Assembly instance into an existing assembly, as alternate conformation

Parameters

new_assemblyAssembly object to be appended as alternative conformation

append(structure, label='')[source]

append a new Structure instance into an existing assembly

Parameters
  • structureStructure object to be appended to assembly

  • label – name to give to the assembly. If not provided a default value equal to the rank of the new Structure in the assembly will be assigned.

Returns

label assigned to the new Structure in the assembly

center_assembly()[source]

center whole assembly to origin.

center_subunit(unit=- 1)[source]

center individual subunit to origin.

Parameters

unit – label of unit to center. If undefined, all units will be individually centered.

clear()[source]

remove all elements loaded in the assembly.

contact_ratio(unit1, unit2)[source]

count the number of surface points in contact between two Structures part of the assembly.

Returns

number of contacts

get_all_xyz()[source]

extract all structures coordinates in a unique array.

Returns

collapsed version of assembly’s atoms coordinates.

get_buried()[source]

compute buried surface (assembly sum of components asa minus assembly asa).

Returns

buried_surface in A^2

get_size()[source]

compute dimensions of the structure along the x,y and z axes.

Note

points VdW radii are not kept into account

get_uxyz()[source]

extract all structures coordinates in a a list, where every element contains an array of coordinates of a unit.

Returns

list of units coordinates.

load(struct, n)[source]

load a list of identical structures (homo assembly).

Parameters
  • n – number of units

  • struct – object of class Structure (or subclasses)

load_list(struct_list, labels=[])[source]

load a list of Structure objects with their associated labels list (typically for hetero assemblies).

Parameters
  • struct_listStructure objects (or subclasses of it)

  • labels – user-friendly names used to identify every structure. If empty, simple incremental integers are used.

make_circular_symmetry(radius, displacement=0)[source]

assemble the loaded units in a circular symmetry. Supposes that all units are centered at the origin and oriented in the same way.

Parameters
  • radius – radial displacement with respect of the origin (along x axis)

  • displacement – tangential displacement

make_curved_chain(angle, dist, groups=[])[source]

move loaded units so that they arrange in a bent chain.

Parameters
  • angle – chain curvature

  • dist – distance between centers of mass

  • groups – if set, a chain is formed by considering groups of loaded structures as unique objects. If unset, every object is independently moved.

make_fiber(vx, Lpx, Lpy, vy=None, gamma=1.5707963267948966, v=0, min_height=2, fibertype='p1oblique')[source]

create a fiber, seen as the rolling of a plane with (vx, vy) tiling such that the repeating unit in position (Lpx, Lpy) will be overlapped to the origin.

Parameters
  • vx – distance between two first neighbors along x in a 2D tiling.

  • Lpx – distance of the partner (point that will be superimposed to the origin) along x as number of steps in a 2D tiling.

  • Lpy – distance of the partner (point that will be superimposed to the origin) along y as number of steps in a 2D tiling.

  • vy – optional, distance between two first neighbors along y in a 2D tiling (needed for ‘p1oblique’, ‘p1rectangular’, ‘pm’, ‘pg’, ‘p2’, … fiber types).

  • gamma – optional, angle between vx and vy in rad, needed for ‘p1oblique’ fiber type and ignored for other fiber types (default is pi/2 - equivalent to p1rectangular).

  • min_height – optional, minimal height (number of repeting units along y) of the fiber (if min_height < Lpy, Lpy will be used as height of the fiber). Default is 2.

  • fibertype – optional, can be ‘p1rectangular’, ‘p1hexagonal’, ‘p1oblique’, pm’, ‘pg’, ‘cm’, … (default is ‘p1oblique’).

  • v – optional, additional parameter needed for ‘pm’, ‘pg’, ‘cm’, ‘p2’, … fiber types (default is None). List for composite fibertypes.

make_prism(radius, z, a, b, c, t=0)[source]

construct a prism (bases only). For a perfect stacking, units should be first aligned along their principal axes.

Parameters
  • radius – radial displacement with respect of the origin (along x axis)

  • z – vertical displacement

  • a – rotation along x axis

  • b – rotation along y axis

  • c – rotation along z axis

  • t – tangential displacement after radial displacement (along y axis)

make_stacked_rings(radius, z, t=0)[source]

construct a prism (two superimposed discs)

Parameters
  • radius – radial displacement with respect of the origin (along x axis)

  • z – vertical displacement

  • t – tangential displacement after radial displacement (along y axis)

make_structure()[source]

returns a Structure object containing all the points of the assembly.

Returns

Structure object

merge(assembly, n=1)[source]

add the structures contained in another assembly in the current one.

Parameters
  • assembly – object of class Assembly

  • n – number if instances of assembly to merge (only one by default)

static num_units_fiber(Lpx, Lpy, min_height=10, fibertype=None)[source]

calculate number of repeting units to be used to form a fiber.

Parameters
  • Lpx – distance of the partner (point that will be superimposed to the origin) along x as number of steps in a 2D tiling.

  • Lpy – distance of the partner (point that will be superimposed to the origin) along y as number of steps in a 2D tiling.

  • min_height – optional, minimal height (number of repeting units along y) of the fiber (if min_height < Lpy, Lpy will be used as height of the fiber). Default is 10.

rotate(x, y, z, unit=[])[source]

rotate desired units in the assembly.

Parameters
  • x – rotation around x

  • y – rotation around y

  • z – rotation around z

  • unit – list of labels indicating which units to rotate (string or integer also accepted, for a single subunit). If undefind, all units will be rotated.

translate(x, y, z, unit=[])[source]

translate desired units in the assembly.

Parameters
  • x – translation along x

  • y – translation along y

  • z – translation along z

  • unit – list of labels indicating which units to translate (string or integer also accepted, for a single subunit). If undefind, all units will be translated.

write_pdb(filename)[source]

write a PDB file where every atom is a bid. VdW radius is written into beta factor.

Parameters

filename – name of pdb file to be produced

Polyhedron

class Polyhedron[source]

Bases: biobox.classes.assembly.Assembly

Subclass of Assembly, allowing the assembly of polyhedral symmetries. After instantiation, the first method to be called is setup_polyhedron

An Assembly is composed of several building blocks (instances of Structure class) referred to as “unit”, and stored in the self.unit list. User-friendly names for these unites are stored in the self.unit_labels list. If no name is provided, a number will be assigned (as a string, starting from 0).

add_deformation(edges, vector=[])[source]

Add entry in deformation database. Can be called only after the setup_polyhedron method.

Parameters
  • edges – integer or list of integers, defining edges indices that should be subjected to deformation.

  • vector – axis along which deformation should take place. If not given, radial deformation will be assumed.

delete_xyz(index)[source]

Delete one conformation in the conformational database. the new current conformation will be the previous one

Parameters

index – alternative coordinates set to remove (starting from zero)

generate_polyhedron(S, phone, fag, pen, deformation=[], add_conformation=False)[source]

Given polyhedron information previously loaded (using setup_polyhedron), generate an appropriate symmetry figure.

Parameters
  • S – polyhedron size (radius of mean sphere).

  • phone – rotation on molecule’s first principal axis.

  • fag – rotation on molecule’s second principal axis.

  • pen – rotation on molecule’s third principal axis.

  • deformation

    if list is provided, deformations will be applied according to self.deformation database.

    deformation list length should be equal to the amount of deformation classes)

  • add_conformation

    if True, the coordinates of the new poyhedron will be added to the conformational database as a new alternative conformation.

    If False, old polyhedron coordianates will be substituted.

get_neighbors(return_chain_names=False)[source]

create dictionary defining neighborhood relationships, i.e. edges having a vertex in common (key=edge chain name, value: numpy array of neighboring chains)

Parameters

return_chain_names – if False, neighbors indices are returned, if True indices will be converted in chain names (as assigned when a pdb is written)

Returns

dictionary containing neighborhood information

get_polyhedron_properties(S)[source]

retrieve polyhedron properties

rmsd_distance_matrix(points_indices=[])[source]

Calculate the RMSD between all structures with respect of a reference structure. uses Kabsch alignement algorithm.

Parameters

points_indices – indices of points of interest. This must be a list of indices of atoms in unites, i.e. [[unit1_indices],[unit2_indices],…]

Returns

RMSD of all structures with respect of reference structure (in a numpy array)

set_current(index)[source]

Select current polyhedral conformation from ensemble of previously generated alternatives. This places the frame pointer at the same desired position in all polyhedron subunits.

Parameters

index – number of alternative conformation (starting from 0)

setup_polyhedron(polyname, M, dbfilename='')[source]

load information for the generation of a polyhedral assembly.

It loads the desired Structure to be used as building block (it automatically centers and alignes it). it also loads and geometric information about the desired polyhedron from database. database contains this information: [polymer_name number_of_vertices numbe_of_edges vertices_coordinates vertices_connectivity connectivity_type]

  • Vertices_coordinates contains a list of 3D positions, formatted as x1 y1 z1 x2 y2 z2,…

  • Connectivity lists couples of vertices ID being connected, formatted as conn1_1 conn1_2 conn2_1 conn2_2…

  • conn_type allows to group edges, so that rotation angles can be applied to subgroups of those. This is a list of numbers, that should include zero as lowest number.

A default conn_type is provided by database, the user can however regroup the edges at will.

Note

This method has to be called first.

Parameters
  • polyname – name of the polyhedron to be assembled. The name should be located in the polyhedra database.

  • M – monomer to be used as building block. Should be an instance of Structure class.

  • dbfilename – polyhedra database file.

write_poly_architecture(output='', scale=10, deformation=[], colors=[])[source]

dump PDB file and tcl script loadable in VMD showing the loaded polyhedral scaffold.

pseudoatoms are placed in vertices, cylinders connect them. Cylinder color code matches connection type.

Parameters
  • scale – vertices scaling factor (i.e. how much you want to blow up your architecture)

  • colors – list of colors to be used when coloring the cylinders in VMD session. By default, the following 25 VMD colors are available (in this order): blue, red, gray, orange, yellow, tan ,silver, green, white, pink, cyan, purple, lime, mauve, ochre, iceblue, black, yellow2, green2, cyan2, blue2, violet, magenta, red2, orange2.

  • deformation – if provided, deformations will be applied as described in deformation database

  • output – name of output files (without extension. .pdb and .tcl will be automatically added). By default, the name will be the polyhedron name.

Multimer

class Multimer[source]

Bases: biobox.classes.polyhedron.Polyhedron

Construct and manipulate a protein assembly composed of several Molecule instances. Subclass of Polyhedron.

An Assembly is composed of several building blocks (instances of Structure class) referred to as “unit”, and stored in the self.unit list. User-friendly names for these unites are stored in the self.unit_labels list. If no name is provided, a number will be assigned (as a string, starting from 0).

atomselect(u, chain, resid, atom, get_index=False, use_resname=False)[source]

## select specific atoms in a multimer providing unit, chain, residue ID and atom name.

Parameters
  • u – number of desired unit to select in the multimer

  • chain – selection of a specific chain name (accepts ‘*’ as wildcard). Can also be a list or numpy array of strings.

  • resid – residue ID of desired atoms (accepts ‘*’ as wildcard). Can also be a list or numpy array of of int.

  • atom – name of desired atom (accepts ‘*’ as wildcard). Can also be a list or numpy array of strings.

  • get_index – if set to True, returns the indices of selected atoms in self.points array (and self.data)

  • use_resname – if set to True, consider information in “res” variable as resnames, and not resids

Returns

coordinates of the selected points (in a unique array) and, if get_index is set to true, a list of their indices in subunits’ self.points array.

get_data(indices, columns)[source]

Return information about atom of interest (i.e., slice the data DataFrame)

Parameters
  • indices – list of indices

  • columns – list of columns (e.g. [“resname”, “resid”, “chain”])

Returns

slice of molecule’s data DataFrame

make_molecule()[source]

Return a Molecule object containing all the points of the assembly. Chain will indicate different units, original chain value is pushed in segment entry.

Returns

Molecule object

query(query_text, get_index=False)[source]

## select specific atoms in a multimer un the basis of a text query.

Parameters
  • query_text – string selecting atoms of interest. Uses the pandas query syntax, can access all columns in the dataframe self.data.

  • get_index – if set to True, returns the indices of selected atoms in self.points array (and self.data)

Returns

coordinates of the selected points (in a unique array) and, if get_index is set to true, a list of their indices in subunits’ self.points array.

write_pdb(outname)[source]

Write a pdb of the multimeric assembly.

Parameters

outname – name of PDB file to generate