Structure Alignment Data Model === ## AFPChain Data Model The `AFPChain` data structure was designed to store pairwise structural alignments. The class functions as a bean, and contains many variables used internally by the alignment algorithms implemented in biojava. Some of the important stored variables are: * Algorithm Name * Optimal Alignment: described later. * Optimal RMSD: final and total RMSD value of the alignment. * TM-score * BlockRotationMatrix: rotation component of the superposition transformation. * BlockShiftVector: translation component of the superposition transformation. BioJava class: [org.biojava.bio.structure.align.model.AFPChain](http://www.biojava.org/docs/api/org/biojava/nbio/structure/align/model/AFPChain.html) ### The Optimal Alignment The residue equivalencies of the alignment (EQRs) are described in the optimal alignment variable, a triple array of integers, where the indices stand for: ```java int[][][] optAln = afpChain.getOptAln(); int residue = optAln[block][chain][eqr]; ``` * **block**: the blocks divide the alignment into different parts. The division can be due to non-topological rearrangements (e.g. circular permutations) or due to flexible parts (e.g. domain switch). There can be any number of blocks in a structural alignment, defined by the structure alignment algorithm. * **chain**: in a pairwise alignment there are only two chains, or structures. * **eqr**: EQR stands for equivalent residue position, i.e. the alignment position. There are as many positions (EQRs) in a block as the length of the alignment block, and their number is equal for any of the two chains in the same block. In each entry (combination of the three indices described above) an integer is stored, which corresponds to the residue index in the specified chain, i.e. the index in the Atom array of the chain. In between the same block, the stored integers (residues) are always in increasing order. ### Examples Some examples of how to get the basic properties of an `AFPChain`: ```java afpChain.getAlgorithmName(); //Name of the algorithm that generated the alignment afpChain.getBlockNum(); //Number of blocks afpChain.getTMScore(); //TM-score afpChain.getTotalRmsdOpt() //Optimal RMSD afpChain.getBlockRotationMatrix()[0] //get the rotation matrix of the first block afpChain.getBlockShiftVector()[0] //get the translation vector of the first block ``` ### Overview As an overview, the `AFPChain` data model: * Only supports **pairwise alignments**, i.e. two chains or structures aligned. * Can support **flexible alignments** and **non-topological alignments**. However, their combinatation (a flexible alignment with topological rearrangements) can not be represented, because the blocks mean either one or the other. * Can not support **non-sequential alignments**, or they would require a new block for each EQR, because sequentiality of the residues is assumed inside each block. ## MultipleAlignment Data Model Since BioJava 4.1.0, a new data model is available to store structure alignments. The `MultipleAlignment` data structure is a general model that supports any of the following properties, and any combination: * **Multiple structures**: the model is no longer restricted to pairwise alignments. * **Non-topological alignments**: such as circular permutations or domain rearrangements. * **Flexible alignments**: parts of the alignment with different superposition transformation. In addtition, the data structure is not limited in the number and types of scores it can store, because the scores are stored in a key:value fashion, as it will be described later. BioJava class: [org.biojava.bio.structure.align.multiple.MultipleAlignment](http://www.biojava.org/docs/api/org/biojava/nbio/structure/align/multiple/MultipleAlignment.html) ### Object Hierarchy The biggest difference with `AFPChain` is that the `MultipleAlignment` data structure is object oriented. The hierarchy of sub-objects is represented below:
MultipleAlignmentEnsemble
|
MultipleAlignment(s)
|
BlockSet(s)
|
Block(s)
* **MultipleAlignmentEnsemble**: the ensemble is the top level of the hierarchy.
As a top level, it stores information regarding creation properties (algorithm,
version, creation time, etc.), the structures involved in the alignment (Atoms,
structure identifiers, etc.) and cached variables (atomic distance matrices).
It contains a collection of `MultipleAlignment` that share the same properties
stored in the ensemble. This construction allows the storage of alternative
alignments inside the same data structure.
* **MultipleAlignment**: the `MultipleAlignment` stores the core information of a
multiple structure alignment. It is designed to be the return type of the multiple
structure alignment algorithms. The object contains a collection of `BlockSet` and
it is linked to its parent `MultipleAlignmentEnsemble`.
* **BlockSet**: the `BlockSet` stores a flexible part of a multiple structure
alignment. A flexible part needs the residue equivalencies involved, contained in
a collection of `Block`, and a transformation matrix for every structure that
describes the 3D superposition of all structures. It is linked to its parent
`MultipleAlignment`.
* **Block**: the `Block` stores the aligned positions (equivalent residues) of a
`BlockSet` that are in sequentially increasing order. Each `Block` represents a
sequential part of a non-topological alignment, if more than one `Block` is present.
It is linked to its parent `BlockSet`.
### The Optimal Alignment
In the `MultipleAlignment` data structure the aligned residues are stored in a
double List for every `Block`. The indices of the double List are the following:
```java
List