@@ -7,6 +7,14 @@ The `AFPChain` data structure was designed to store pairwise structural
77alignments. The class functions as a bean, and contains many variables
88used internally by the alignment algorithms implemented in biojava.
99
10+ Some of the important stored variables are:
11+ * Algorithm Name
12+ * Optimal Alignment: described later.
13+ * Optimal RMSD: final and total RMSD value of the alignment.
14+ * TM-score
15+ * BlockRotationMatrix: rotation component of the superposition transformation.
16+ * BlockShiftVector: translation component of the superposition transformation.
17+
1018### The Optimal Alignment
1119
1220The residue equivalencies of the alignment (EQRs) are described in the optimal
@@ -22,9 +30,7 @@ division can be due to non-topological rearrangements (e.g. circular
2230permutations) or due to flexible parts (e.g. domain switch). There can
2331be any number of blocks in a structural alignment, defined by the structure
2432alignment algorithm.
25-
2633* ** chain** : in a pairwise alignment there are only two chains, or structures.
27-
2834* ** eqr** : EQR stands for equivalent residue position, i.e. the alignment
2935position. There are as many positions (EQRs) in a block as the length of
3036the alignment block, and their number is equal for any of the two chains in
@@ -35,9 +41,18 @@ is stored, which corresponds to the residue index in the specified chain, i.e.
3541the index in the Atom array of the chain. In between the same block, the stored
3642integers (residues) are always in increasing order.
3743
38- ### Example
44+ ### Examples
3945
46+ Some examples of how to get the basic properties of an ` AFPChain ` :
4047
48+ ``` java
49+ afpChain. getAlgorithmName(); // Name of the algorithm that generated the alignment
50+ afpChain. getBlockNum(); // Number of blocks
51+ afpChain. getTMScore(); // TM-score
52+ afpChain. getTotalRmsdOpt() // Optimal RMSD
53+ afpChain. getBlockRotationMatrix()[0 ] // get the rotation matrix of the first block
54+ afpChain. getBlockShiftVector()[0 ] // get the translation vector of the first block
55+ ```
4156
4257### Overview
4358
@@ -83,10 +98,11 @@ MultipleAlignmentEnsemble
8398
8499* ** MultipleAlignmentEnsemble** : the ensemble is the top level of the hierarchy.
85100As a top level, it stores information regarding creation properties (algorithm,
86- version, creation time, etc.) and the structures involved in the alignment (Atoms,
87- structure identifiers, etc.). It contains a collection of ` MultipleAlignment ` that
88- share the same properties stored in the ensemble. This construction allows the
89- storage of alternative alignments inside the same data structure.
101+ version, creation time, etc.), the structures involved in the alignment (Atoms,
102+ structure identifiers, etc.) and cached variables (atomic distance matrices).
103+ It contains a collection of ` MultipleAlignment ` that share the same properties
104+ stored in the ensemble. This construction allows the storage of alternative
105+ alignments inside the same data structure.
90106
91107* ** MultipleAlignment** : the ` MultipleAlignment ` stores the core information of a
92108multiple structure alignment. It is designed to be the return type of the multiple
@@ -118,7 +134,6 @@ The indices mean the same as in the optimal alignment of the `AFPChain`, just to
118134remember them:
119135
120136* ** chain** : chain or structure index.
121-
122137* ** eqr** : EQR stands for equivalent residue position, i.e. the alignment
123138position. There are as many positions (EQRs) in a block as the length of
124139the alignment block, and their number is equal for any of the chains in
@@ -132,17 +147,60 @@ in the List entries.
132147
133148### Alignment Scores
134149
150+ All the objects in the hierarchy levels implement the ` ScoresCache ` interface.
151+ This interface allows the storage of any number of scores as a key: value set.
152+ The key is a ` String ` that describes the score and used to recover it after,
153+ and the value is a double with the calculated score. The interface has only
154+ two methods: putScore and getScore.
155+
156+ The following lines of code are an example on how to do score manipulations
157+ on a ` MultipleAlignment ` :
135158
159+ ``` java
160+ // Put a score into the alignment and get it back
161+ alignment. putScore(' myRMSD' , 1.234 );
162+ double myRMSD = alignment. getScore(' myRMSD' );
163+
164+ BlockSet bs = alignment. getBlockSets(). get(0 );
165+ // The same can be done for BlockSets
166+ alignment. putScore(' bsRMSD' , 1.234 );
167+ double bsRMSD = alignment. getScore(' bsRMSD' );
168+ ```
136169
137- ### Example
170+ Methods and names for some frequent scores are located in a util class called
171+ ` MultipleAlignmentScorer ` .
138172
139173### Overview
140174
175+ As an overview, the ` MultipleAlignment ` data model:
176+
177+ * Supports any number of aligned structures, ** multiple structures** .
178+ * Can support ** flexible alignments** and ** non-topological alignments** ,
179+ and any of their combinatations (e.g. a flexible alignment with topological
180+ rearrangements).
181+ * Can not support ** non-sequential alignments** , or they would require a new
182+ ` Block ` for each EQR, because sequentiality of the residues is a requirement
183+ for each ` Block ` .
184+ * Can store ** any score** in any of the four object hierarchy level, making it
185+ easy to adapt to new requirements and algorithms.
186+
187+ For more examples and information about the ` MultipleAlignment ` data structure
188+ go to the Demo package on the biojava-structure module or look through the interface
189+ files, where the javadoc explanations can be found.
190+
141191## Conversion between Data Models
142192
143193The conversion from an ` AFPChain ` to a ` MultipleAlignment ` is possible trough the
144194ensemble constructor. An example on how to do it programatically is below:
145195
196+ ``` java
197+ AFPChain afpChain;
198+ Atom [] chain1;
199+ Atom [] chain2;
200+ boolean flexible = false ;
201+ MultipleAlignmentEnsemble ensemble = new MultipleAlignmentEnsemble (afpChain, chain1, chain2, false );
202+ MultipleAlignment converted = ensemble. getMultipleAlignments(). get(0 );
203+ ```
146204
147205There is no method to convert from a ` MultipleAlignment ` to an ` AFPChain ` , because
148206the first representation supports any number of structures, while the second is
0 commit comments