Skip to content

Commit fc07139

Browse files
committed
Cleanup
1 parent 56b98c8 commit fc07139

2 files changed

Lines changed: 15 additions & 18 deletions

File tree

biojava-structure/src/main/java/org/biojava/nbio/structure/align/quaternary/QsAlign.java

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ public static QsAlignResult align(List<Subunit> s1, List<Subunit> s2,
9898
for (int i = 0; i < c1.size(); i++) {
9999
for (int j = 0; j < c2.size(); j++) {
100100

101-
if (clusterMap.keySet().contains(i))
101+
if (clusterMap.containsKey(i))
102102
break;
103-
if (clusterMap.values().contains(j))
103+
if (clusterMap.containsValue(j))
104104
continue;
105105

106106
// Use structural alignment to match the subunit clusters
@@ -154,9 +154,9 @@ public static QsAlignResult align(List<Subunit> s1, List<Subunit> s2,
154154
for (int i = 0; i < index2; i++) {
155155
for (int j = index2; j < clust1.size(); j++) {
156156

157-
if (subunitMap.keySet().contains(i))
157+
if (subunitMap.containsKey(i))
158158
break;
159-
if (subunitMap.values().contains(j))
159+
if (subunitMap.containsValue(j))
160160
continue;
161161

162162
// Obtain cumulative transformation matrix
@@ -294,8 +294,7 @@ public static QsAlignResult align(List<Subunit> s1, List<Subunit> s2,
294294
if (result.getAlignment() == null) {
295295
result.setSubunitMap(subunitMap);
296296
result.setAlignment(msa);
297-
} else if (msa.getScore(MultipleAlignmentScorer.RMSD) < result
298-
.getRmsd()) {
297+
} else if (msa.getScore(MultipleAlignmentScorer.RMSD) < result.getRmsd()) {
299298
result.setSubunitMap(subunitMap);
300299
result.setAlignment(msa);
301300
logger.info("Better result found: " + result.toString());
@@ -324,8 +323,8 @@ private static Pair<Atom[]> getAlignedAtomsForClusterSubunitMap(
324323
List<SubunitCluster> clusters,
325324
Map<Integer, Map<Integer, Integer>> clusterSubunitMap) {
326325

327-
List<Atom> atomArray1 = new ArrayList<Atom>();
328-
List<Atom> atomArray2 = new ArrayList<Atom>();
326+
List<Atom> atomArray1 = new ArrayList<>();
327+
List<Atom> atomArray2 = new ArrayList<>();
329328

330329
// For each cluster of subunits
331330
for (int key : clusterSubunitMap.keySet()) {
@@ -348,9 +347,9 @@ private static Pair<Atom[]> getAlignedAtomsForClusterSubunitMap(
348347
}
349348

350349
}
351-
return new Pair<Atom[]>(
352-
atomArray1.toArray(new Atom[atomArray1.size()]),
353-
atomArray2.toArray(new Atom[atomArray2.size()]));
350+
return new Pair<>(
351+
atomArray1.toArray(new Atom[0]),
352+
atomArray2.toArray(new Atom[0]));
354353
}
355354

356355
/**
@@ -364,12 +363,10 @@ private static Pair<Atom[]> getAlignedAtomsForClusterSubunitMap(
364363
* @param clusterSubunitMap
365364
* map from cluster id to subunit matching
366365
* @return transformation matrix
367-
* @throws StructureException
368366
*/
369367
private static Matrix4d getTransformForClusterSubunitMap(
370368
List<SubunitCluster> clusters,
371-
Map<Integer, Map<Integer, Integer>> clusterSubunitMap)
372-
throws StructureException {
369+
Map<Integer, Map<Integer, Integer>> clusterSubunitMap) {
373370

374371
Pair<Atom[]> pair = getAlignedAtomsForClusterSubunitMap(clusters,
375372
clusterSubunitMap);

biojava-structure/src/main/java/org/biojava/nbio/structure/align/quaternary/QsAlignResult.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ public class QsAlignResult {
4747

4848
private List<SubunitCluster> clusters;
4949

50-
private List<Subunit> subunits1;
51-
private List<Subunit> subunits2;
50+
private final List<Subunit> subunits1;
51+
private final List<Subunit> subunits2;
5252

5353
private Map<Integer, Integer> subunitMap;
5454
private MultipleAlignment alignment;
@@ -234,7 +234,7 @@ public void setAlignment(MultipleAlignment alignment) {
234234
*/
235235
public List<Subunit> getAlignedSubunits1() {
236236

237-
List<Subunit> aligned = new ArrayList<Subunit>(subunitMap.size());
237+
List<Subunit> aligned = new ArrayList<>(subunitMap.size());
238238

239239
for (Integer key : subunitMap.keySet())
240240
aligned.add(subunits1.get(key));
@@ -250,7 +250,7 @@ public List<Subunit> getAlignedSubunits1() {
250250
*/
251251
public List<Subunit> getAlignedSubunits2() {
252252

253-
List<Subunit> aligned = new ArrayList<Subunit>(subunitMap.size());
253+
List<Subunit> aligned = new ArrayList<>(subunitMap.size());
254254

255255
for (Integer key : subunitMap.keySet())
256256
aligned.add(subunits2.get(subunitMap.get(key)));

0 commit comments

Comments
 (0)