Skip to content

Commit 4452bdc

Browse files
authored
Merge pull request biojava#709 from valasatava/master
several fixes for biological assemblies calculations
2 parents 8856006 + b81c37d commit 4452bdc

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,9 @@ public Object clone() {
187187

188188
for (Group seqResGroup : seqResGroups) {
189189

190+
if (seqResGroup==null)
191+
continue;
192+
190193
int i = groups.indexOf(seqResGroup);
191194

192195
Group g ;

biojava-structure/src/main/java/org/biojava/nbio/structure/cluster/SubunitExtractor.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,15 @@ public static List<Subunit> extractSubunits(Structure structure,
6868
// The extracted subunit container
6969
List<Subunit> subunits = new ArrayList<Subunit>();
7070

71-
72-
for (Chain c : structure.getChains()) {
73-
71+
for (Chain c : structure.getPolyChains()) {
7472
// Only take protein chains
7573
if (c.isProtein()) {
7674
Atom[] ca = StructureTools.getRepresentativeAtomArray(c);
7775
logger.debug("Chain " + c.getId() + "; CA Atoms: "
7876
+ ca.length + "; SEQRES: " + c.getSeqResSequence());
7977
subunits.add(new Subunit(ca, c.getName(), null, structure));
80-
8178
}
8279
}
83-
8480

8581
// Calculate the minimum length of a Subunit
8682
int adjustedMinLen = calcAdjustedMinimumSequenceLength(subunits,

biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/QuatSymmetryResults.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@
2222
*/
2323
package org.biojava.nbio.structure.symmetry.core;
2424

25-
import java.util.ArrayList;
26-
import java.util.Collections;
27-
import java.util.List;
28-
2925
import org.biojava.nbio.structure.Structure;
3026
import org.biojava.nbio.structure.cluster.Subunit;
3127
import org.biojava.nbio.structure.cluster.SubunitCluster;
3228
import org.biojava.nbio.structure.cluster.SubunitClusterUtils;
3329

30+
import java.util.ArrayList;
31+
import java.util.Collections;
32+
import java.util.List;
33+
3434
/**
3535
* Holds the results of quaternary symmetry perception obtained with
3636
* {@link QuatSymmetryDetector}.
@@ -111,14 +111,17 @@ public QuatSymmetryResults(List<SubunitCluster> clusters,
111111
public List<SubunitCluster> getSubunitClusters() {
112112
return Collections.unmodifiableList(clusters);
113113
}
114-
114+
115115
/**
116116
* Returns the List of Subunits used to calculate symmetry.
117117
*
118118
* @return an unmodifiable view of the List
119119
*/
120120
public List<Subunit> getSubunits() {
121-
return Collections.unmodifiableList(subunits);
121+
if (subunits != null)
122+
return Collections.unmodifiableList(subunits);
123+
else
124+
return Collections.unmodifiableList(new ArrayList<>());
122125
}
123126

124127
/**

0 commit comments

Comments
 (0)