Skip to content

Commit d6be054

Browse files
committed
Fix bug with 4D Transformation Calc
Packing by columns is needed instead of by rows.
1 parent 8ff345c commit d6be054

5 files changed

Lines changed: 11 additions & 6 deletions

File tree

biojava-structure-gui/src/main/java/demo/DemoMultipleAlignmentJmol.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ public static void main(String[] args) throws IOException, StructureException, S
4343
for (String name:names) atomArrays.add(cache.getAtoms(name));
4444

4545
//Here the multiple structural alignment algorithm comes in place to generate the alignment object
46-
MultipleAlignment fakeMultAln = fakeMultipleAlignment("globins",atomArrays);
46+
MultipleAlignment fakeMultAln = fakeMultipleAlignment("globins", atomArrays);
47+
fakeMultAln.getEnsemble().setStructureNames(names);
4748

4849
//Generate a pairwise alignment and convert it to a MultipleAlignment
4950
FatCat fatcat = new FatCat();

biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1057,7 +1057,7 @@ public static void shift(Atom[] ca, Atom b) {
10571057
* @return 4x4 transformation matrix
10581058
*/
10591059
public static Matrix4d getTransformation(Matrix rot, Matrix trans) {
1060-
return new Matrix4d( new Matrix3d(rot.getRowPackedCopy()),
1060+
return new Matrix4d( new Matrix3d(rot.getColumnPackedCopy()),
10611061
new Vector3d(trans.getColumnPackedCopy()),
10621062
1.0);
10631063
}

biojava-structure/src/main/java/org/biojava/nbio/structure/align/cemc/CeMcMain.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ public CeMcMain(){
6262
* of the structures. The alignments are generated in parallel using the Java API for concurrency management.
6363
* The closest structure to all others is chosen as the reference and all the alignments to it are taken to generate
6464
* an ungapped seed MultipleAlignment.
65+
*
6566
* This method is static because can be used outside this alignment class.
67+
*
6668
* @param atomArrays List of Atoms to align of the structures
6769
* @return MultipleAlignment seed alignment
6870
* @throws ExecutionException
@@ -129,6 +131,7 @@ public MultipleAlignment generateSeed(List<Atom[]> atomArrays) throws Interrupte
129131
* This method takes a list of pairwise alignments to the reference structure and calculates the
130132
* MultipleAlignment resulting from them. It ignores blocks in AFPChain (flexible parts) and builds
131133
* the Blocks as the definition of MultipleAlignment dictates {@link Block}. Gaps are not included.
134+
*
132135
* @param afpList the list of pairwise alignments to the reference
133136
* @param atomArrays List of Atoms of the structures
134137
* @param ref index of the reference structure

biojava-structure/src/main/java/org/biojava/nbio/structure/align/model/BlockSetImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public class BlockSetImpl extends AbstractScoresCache implements Serializable, B
2222
private List<Block> blocks; //aligned positions as a list of Blocks
2323

2424
//Cache variables (can be updated)
25-
private List<Matrix4d> pose; //3D superimposition information Pose
25+
private List<Matrix4d> pose; //3D superimposition information pose
2626
private int length; //total number of aligned positions, including gaps = sum of blocks lengths (cache)
2727
private int coreLength; //number of aligned positions without gaps (cache)
2828

@@ -32,7 +32,7 @@ public class BlockSetImpl extends AbstractScoresCache implements Serializable, B
3232
* @return BlockSetImpl a BlockSetImpl instance linked to its parent MultipleAlignment.
3333
* @throws StructureAlignmentException
3434
*/
35-
public BlockSetImpl(MultipleAlignment multipleAlignment) throws StructureAlignmentException{
35+
public BlockSetImpl(MultipleAlignment multipleAlignment) {
3636

3737
parent = multipleAlignment;
3838
if (parent!=null) parent.getBlockSets().add(this);

biojava-structure/src/main/java/org/biojava/nbio/structure/align/model/MultipleAlignmentEnsembleImpl.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,8 +305,9 @@ public void addMultipleAlignment( MultipleAlignment alignment) {
305305

306306
@Override
307307
public int size() throws StructureAlignmentException {
308-
if (structureNames == null) throw new StructureAlignmentException("Empty MultipleAlignmentEnsemble: structureNames == null");
309-
else return structureNames.size();
308+
if (structureNames != null) return structureNames.size();
309+
else if (atomArrays != null) return atomArrays.size();
310+
else throw new StructureAlignmentException("Empty MultipleAlignmentEnsemble: structureNames == null");
310311
}
311312

312313
/**

0 commit comments

Comments
 (0)