Skip to content

Commit dc365d7

Browse files
committed
Fix Bugs in MultipleAlignment DS
A bug when the reference in the ReferenceSuperimposer was not the first structure and a bug when trying to get the scores and they were null.
1 parent d3f3cd6 commit dc365d7

File tree

7 files changed

+12
-18
lines changed

7 files changed

+12
-18
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
import org.biojava.nbio.structure.align.util.AtomCache;
1515

1616
/**
17-
* Demo for running a CEMC Multiple Structure Alignment and visualizing the results.
17+
* Demo for running the CEMC Algorithm on a protein family and visualizing the results.
18+
* Choose the family by commenting out the protein family names.
1819
*
1920
* @author Aleix Lafita
2021
*
@@ -43,11 +44,15 @@ public static void main(String[] args) throws IOException, StructureException, I
4344
//GPCRs
4445
//List<String> names = Arrays.asList("2z73.A", "1u19.A", "4ug2.A", "4xt3", "4or2.A", "3odu.A");
4546
//Immunoglobulins (MAMMOTH paper)
46-
List<String> names = Arrays.asList("2hla.B", "3hla.B", "1cd8", "2rhe", "1tlk", "1ten", "1ttf");
47+
//List<String> names = Arrays.asList("2hla.B", "3hla.B", "1cd8", "2rhe", "1tlk", "1ten", "1ttf");
4748
//Globins (MAMMOTH and MUSTA papers)
4849
//List<String> names = Arrays.asList("1mbc", "1hlb", "1thb.A", "1ith.A", "1idr.A", "1dlw", "1kr7.A", "1ew6.A", "1it2.A", "1eco", "3sdh.A", "1cg5.B", "1fhj.B", "1ird.A", "1mba", "2gdm", "1b0b", "1h97.A", "1ash.A", "1jl7.A");
4950
//Rossman-Fold (POSA paper)
5051
//List<String> names = Arrays.asList("d1heta2", "d1ek6a_", "d1obfo1", "2cmd", "d1np3a2", "d1bgva1", "d1id1a_", "d1id1a_", "d1oi7a1");
52+
//Circular Permutations (Bliven CECP paper) - dynamin GTP-ase with CP G-domain
53+
//List<String> names = Arrays.asList("d1u0la2", "d1jwyb_");
54+
//Circular Permutations: SAND and MFPT domains
55+
List<String> names = Arrays.asList("d2bjqa1", "d1h5pa_", "d1ufna_"); //"d1oqja"
5156

5257
//Load the CA atoms of the structures
5358
AtomCache cache = new AtomCache();

biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/AbstractScoresCache.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public Double getScore(String property) {
4848
*/
4949
@Override
5050
public Set<String> getScores() {
51+
if(scores == null) return Collections.emptySet();
5152
return Collections.unmodifiableSet(scores.keySet());
5253
}
5354

biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/Block.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ public interface Block extends ScoresCache {
4444
/**
4545
* Returns the double List containing the aligned residues for each structure.
4646
* alignRes.get(structure).get(residue) = alignRes.get(size).get(length).
47-
* <p>
48-
* Initializes the variable if it is null.
4947
* @return List a double List of aligned residues for each structure.
5048
* @see #setAlignRes()
5149
*/

biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/BlockImpl.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ public BlockSet getBlockSet() {
8585

8686
@Override
8787
public List<List<Integer>> getAlignRes() {
88-
if (alignRes == null) alignRes = new ArrayList<List<Integer>>();
8988
return alignRes;
9089
}
9190

biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/MultipleAlignmentEnsemble.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ public interface MultipleAlignmentEnsemble extends ScoresCache {
131131
public void setMultipleAlignments(List<MultipleAlignment> multipleAlignments);
132132

133133
/**
134-
* Add a new multiple alignment to the end of the ensemble and set its
135-
* ensemble to this.
134+
* Add a new MultipleAlignment to the end of the ensemble and set its
135+
* parent ensemble to this.
136136
* @param alignment
137137
*/
138138
public void addMultipleAlignment( MultipleAlignment alignment);

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

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,6 @@ public int getAlignmentNum() {
251251

252252
@Override
253253
public List<Matrix> getDistanceMatrix() {
254-
if (distanceMatrix == null) updateDistanceMatrix();
255254
return distanceMatrix;
256255
}
257256

@@ -289,28 +288,20 @@ public void setMultipleAlignments(List<MultipleAlignment> multipleAlignments) {
289288
this.multipleAlignments = multipleAlignments;
290289
}
291290

292-
/**
293-
* Add a new multiple alignment to the end of the ensemble and set its
294-
* ensemble to this.
295-
* @param alignment
296-
*/
297291
@Override
298292
public void addMultipleAlignment( MultipleAlignment alignment) {
293+
if (multipleAlignments == null) multipleAlignments = new ArrayList<MultipleAlignment>();
299294
multipleAlignments.add(alignment);
300295
alignment.setEnsemble(this);
301296
}
302297

303-
304298
@Override
305299
public int size() {
306300
if (structureNames != null) return structureNames.size();
307301
else if (atomArrays != null) return atomArrays.size();
308302
else throw new IndexOutOfBoundsException("Empty MultipleAlignmentEnsemble: structureNames == null && atomArrays == null");
309303
}
310304

311-
/**
312-
* Clear scores and distance matrix. Recursively clears member alignments.
313-
*/
314305
@Override
315306
public void clear() {
316307
super.clear();

biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/ReferenceSuperimposer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public void superimpose(MultipleAlignment alignment) throws StructureException {
104104
}
105105
//Loop through all the columns of each Block (aligned residues)
106106
for (int j=0; j<blk.length(); j++){
107-
Integer pos1 = blk.getAlignRes().get(0).get(j);
107+
Integer pos1 = blk.getAlignRes().get(reference).get(j);
108108
Integer pos2 = blk.getAlignRes().get(i).get(j);
109109

110110
if (pos1==null || pos2==null) continue;

0 commit comments

Comments
 (0)