Skip to content

Commit 8dd272f

Browse files
committed
Merge branch 'master' of ssh://github.com/biojava/biojava
# By lafita (4) and others # Via Andreas Prlic (1) and others * 'master' of ssh://github.com/biojava/biojava: Use homologous structure derived matrix HSDM for msa tree building Fix typo symmetry group determination for internal symmetry Change group calculation for internal symmetry Correct significance criteria for internal symmetry Another small memory improvement for AtomImpl biojava#391 updating javadoc plugin to latest version
2 parents 594f7cf + e80f5a4 commit 8dd272f

File tree

15 files changed

+121
-120
lines changed

15 files changed

+121
-120
lines changed

biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/jmol/MultipleAlignmentJmol.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ public void actionPerformed(ActionEvent ae) {
415415
Phylogeny kimura = MultipleAlignmentTools
416416
.getKimuraTree(multAln);
417417
Phylogeny sdm = MultipleAlignmentTools
418-
.getSDMTree(multAln);
418+
.getHSDMTree(multAln);
419419
// Phylogeny structural = MultipleAlignmentTools
420420
// .getStructuralTree(multAln);
421421

biojava-structure-gui/src/main/java/org/biojava/nbio/structure/symmetry/gui/SymmetryDisplay.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public static MultipleAlignmentJmol displayFull(CeSymmResult symm)
102102
public static AbstractAlignmentJmol display(CeSymmResult symmResult)
103103
throws StructureException {
104104

105-
if (symmResult.isSignificant()) {
105+
if (symmResult.isRefined()) {
106106
MultipleAlignment msa = symmResult.getMultipleAlignment();
107107
List<Atom[]> atoms = msa.getAtomArrays();
108108
MultipleAlignmentJmol jmol = new MultipleAlignmentJmol(msa, atoms);
@@ -211,10 +211,11 @@ public static String printSymmetryAxes(CeSymmResult symm, boolean elementary) {
211211
* @param symm
212212
* CeSymmResult
213213
* @return
214+
* @throws StructureException
214215
*/
215-
public static String printSymmetryGroup(CeSymmResult symm) {
216+
public static String printSymmetryGroup(CeSymmResult symm) throws StructureException {
216217

217-
QuatSymmetryResults gSymmetry = symm.getSymmGroup();
218+
QuatSymmetryResults gSymmetry = SymmetryTools.getQuaternarySymmetry(symm);
218219

219220
AxisAligner axes = AxisAligner.getInstance(gSymmetry);
220221

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,16 @@ public interface Atom extends Cloneable, PDBRecord {
215215
/**
216216
* Get all {@link Bond}s this atom is part of.
217217
*
218-
* @return a list of {@link Bond}s.
218+
* @return a list of {@link Bond}s or null if no bonds exist for this Atom
219219
*/
220220
public List<Bond> getBonds();
221221

222+
/**
223+
* Sets the bonds
224+
* @param bonds
225+
*/
226+
public void setBonds(List<Bond> bonds);
227+
222228
/**
223229
* Get the charge of this atom
224230
*

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

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727

2828
import java.io.Serializable;
2929
import java.util.ArrayList;
30-
import java.util.Collections;
3130
import java.util.List;
3231

3332

@@ -42,6 +41,12 @@ public class AtomImpl implements Atom, Serializable, PDBRecord {
4241

4342
private static final long serialVersionUID = -2258364127420562883L;
4443

44+
/**
45+
* The inital capacity of the bonds list.
46+
* Most atoms have a maximum of 3 heavy atom neighbors.
47+
*/
48+
public static final int BONDS_INITIAL_CAPACITY = 3;
49+
4550
private String name ;
4651
private Element element;
4752
private double[] coords ;
@@ -64,7 +69,7 @@ public AtomImpl () {
6469
tempfactor = 0.0f ;
6570
altLoc = 0;
6671
parent = null;
67-
bonds = Collections.emptyList();
72+
bonds = null; // let's save some memory and let's not initialise this until it's needed - JD 2016-03-02
6873
charge = 0 ;
6974
}
7075

@@ -202,8 +207,8 @@ public Object clone() {
202207
n.setPDBserial(getPDBserial());
203208
n.setName(getName());
204209
n.setElement(getElement());
205-
206-
// TODO bonds are not cloned here, do we need to clone them? - JD 2016-01-27
210+
// NOTE bonds can't be cloned here, they would need to be cloned at the
211+
// chain or group level (depending if they are intra or inter group bonds) -- JD 2016-03-02
207212

208213
return n ;
209214
}
@@ -253,16 +258,26 @@ public void toPDB(StringBuffer buf) {
253258

254259
}
255260

261+
/**
262+
* {@inheritDoc}
263+
*/
256264
@Override
257265
public List<Bond> getBonds() {
258266
return bonds;
259267
}
268+
269+
/**
270+
* {@inheritDoc}
271+
*/
272+
@Override
273+
public void setBonds(List<Bond> bonds) {
274+
this.bonds = bonds;
275+
}
260276

261277
@Override
262278
public void addBond(Bond bond) {
263-
if (bonds.isEmpty()) {
264-
// most atoms have a maximum of 3 heavy atom neighbors, so use this as the default size
265-
bonds = new ArrayList<Bond>(3);
279+
if (bonds==null) {
280+
bonds = new ArrayList<Bond>(BONDS_INITIAL_CAPACITY);
266281
}
267282
bonds.add(bond);
268283
}

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

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,7 @@
2828
* @author Ulysse Carion
2929
*/
3030
public interface Bond {
31-
/**
32-
* Adds this Bond to its atoms bond lists. If this method is not called,
33-
* then the list returned from calling {@link Atom#getBonds()} will not
34-
* include this bond.
35-
* <p>
36-
* If you created your Bond with the constructor
37-
* {@link #Bond(Atom, Atom, int)}, this method has already been called for
38-
* you and should not be called again.
39-
*/
40-
public void addSelfToAtoms();
41-
31+
4232
/**
4333
* Gets atom 'A' of this bond. There is no meaning to which atom is 'A' and
4434
* which is 'B'; the atoms are labeled 'A' or 'B' based on the order in

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
package org.biojava.nbio.structure;
2222

2323
import java.io.Serializable;
24+
import java.util.ArrayList;
2425
import java.util.List;
2526

2627
/**
@@ -87,11 +88,16 @@ public BondImpl(Atom atomA, Atom atomB, int bondOrder, boolean addSelfToAtoms) {
8788
* you and should not be called again.
8889
*/
8990
// TODO first check if those bonds haven't been made already
90-
@Override
91-
public void addSelfToAtoms() {
91+
private void addSelfToAtoms() {
9292
List<Bond> bonds = atomA.getBonds();
93+
if (bonds==null) {
94+
bonds = new ArrayList<Bond>(AtomImpl.BONDS_INITIAL_CAPACITY);
95+
atomA.setBonds(bonds);
96+
}
97+
9398
boolean exists = false;
9499
for (Bond bond : bonds) {
100+
// TODO is it equals() what we want here, or is it == ? - JD 2016-03-02
95101
if (bond.getOther(atomA).equals(atomB)) {
96102
exists = true;
97103
break;
@@ -188,4 +194,6 @@ public String toString() {
188194
return "Bond [atomA=" + atomA + ", atomB=" + atomB + ", bondOrder="
189195
+ bondOrder + "]";
190196
}
197+
198+
191199
}

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -308,16 +308,14 @@ public void setStructureIdentifier(StructureIdentifier structureIdentifier) {
308308
this.structureIdentifier = structureIdentifier;
309309
}
310310

311-
/** {@inheritDoc} */
311+
/**
312+
* {@inheritDoc}
313+
*/
312314
@Override
313315
public void setConnections(List<Map<String,Integer>> conns) { connections = conns ; }
314316

315317
/**
316-
* Return the connections value.
317-
*
318-
* @return a List object representing the connections value
319-
* @see Structure interface
320-
* @see #setConnections
318+
* {@inheritDoc}
321319
*/
322320
@Override
323321
public List<Map<String,Integer>> getConnections() { return connections ;}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -877,15 +877,15 @@ public static Phylogeny getKimuraTree(MultipleAlignment msta)
877877
* @throws CompoundNotFoundException
878878
* @throws IOException
879879
*/
880-
public static Phylogeny getSDMTree(MultipleAlignment msta)
880+
public static Phylogeny getHSDMTree(MultipleAlignment msta)
881881
throws CompoundNotFoundException, IOException {
882882
MultipleSequenceAlignment<ProteinSequence, AminoAcidCompound> msa = MultipleAlignmentTools
883883
.toProteinMSA(msta);
884884
BasicSymmetricalDistanceMatrix distmat = (BasicSymmetricalDistanceMatrix) DistanceMatrixCalculator
885-
.dissimilarityScore(msa, SubstitutionMatrixHelper.getAminoAcidSubstitutionMatrix("PRLA000101"));
885+
.dissimilarityScore(msa, SubstitutionMatrixHelper.getAminoAcidSubstitutionMatrix("PRLA000102"));
886886
Phylogeny tree = TreeConstructor.distanceTree(distmat,
887887
TreeConstructorType.NJ);
888-
tree.setName("SDM Tree");
888+
tree.setName("HSDM Tree");
889889
return tree;
890890
}
891891

biojava-structure/src/main/java/org/biojava/nbio/structure/io/BondMaker.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ private void trimBondLists() {
188188
for (Chain chain : structure.getChains()) {
189189
for (Group group : chain.getAtomGroups()) {
190190
for (Atom atom : group.getAtoms()) {
191-
if (atom.getBonds().size() > 0) {
191+
if (atom.getBonds()!=null && atom.getBonds().size() > 0) {
192192
((ArrayList<Bond>) atom.getBonds()).trimToSize();
193193
}
194194
}

biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/CeSymm.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,12 @@ protected static CeSymmResult align(Atom[] atoms, CESymmParameters params)
248248
// Store the optimal self-alignment
249249
result.setSelfAlignment(optimalAFP);
250250
result.setStructureId(id);
251+
252+
// Do not try the refinement if the self-alignment is not significant
253+
if (optimalAFP.getTMScore() < params.getScoreThreshold()){
254+
result.setSymmOrder(1);
255+
return result;
256+
}
251257

252258
// Determine the symmetry Type or get the one in params
253259
if (params.getSymmType() == SymmetryType.AUTO) {
@@ -407,7 +413,7 @@ public static CeSymmResult analyze(Atom[] atoms, CESymmParameters params)
407413
CeSymmIterative iter = new CeSymmIterative(params);
408414
CeSymmResult result = iter.execute(atoms);
409415

410-
if (result.isSignificant()) {
416+
if (result.isRefined()) {
411417
// Optimize the global alignment freely once more (final step)
412418
if (params.getOptimization() && result.getSymmLevels() > 1) {
413419
// Remove the axes to do free superposition optimization TODO

0 commit comments

Comments
 (0)