Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
josemduarte committed Jun 2, 2023
1 parent 56b98c8 commit fc07139
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 18 deletions.
Expand Up @@ -98,9 +98,9 @@ public static QsAlignResult align(List<Subunit> s1, List<Subunit> s2,
for (int i = 0; i < c1.size(); i++) {
for (int j = 0; j < c2.size(); j++) {

if (clusterMap.keySet().contains(i))
if (clusterMap.containsKey(i))
break;
if (clusterMap.values().contains(j))
if (clusterMap.containsValue(j))
continue;

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

if (subunitMap.keySet().contains(i))
if (subunitMap.containsKey(i))
break;
if (subunitMap.values().contains(j))
if (subunitMap.containsValue(j))
continue;

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

List<Atom> atomArray1 = new ArrayList<Atom>();
List<Atom> atomArray2 = new ArrayList<Atom>();
List<Atom> atomArray1 = new ArrayList<>();
List<Atom> atomArray2 = new ArrayList<>();

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

}
return new Pair<Atom[]>(
atomArray1.toArray(new Atom[atomArray1.size()]),
atomArray2.toArray(new Atom[atomArray2.size()]));
return new Pair<>(
atomArray1.toArray(new Atom[0]),
atomArray2.toArray(new Atom[0]));
}

/**
Expand All @@ -364,12 +363,10 @@ private static Pair<Atom[]> getAlignedAtomsForClusterSubunitMap(
* @param clusterSubunitMap
* map from cluster id to subunit matching
* @return transformation matrix
* @throws StructureException
*/
private static Matrix4d getTransformForClusterSubunitMap(
List<SubunitCluster> clusters,
Map<Integer, Map<Integer, Integer>> clusterSubunitMap)
throws StructureException {
Map<Integer, Map<Integer, Integer>> clusterSubunitMap) {

Pair<Atom[]> pair = getAlignedAtomsForClusterSubunitMap(clusters,
clusterSubunitMap);
Expand Down
Expand Up @@ -47,8 +47,8 @@ public class QsAlignResult {

private List<SubunitCluster> clusters;

private List<Subunit> subunits1;
private List<Subunit> subunits2;
private final List<Subunit> subunits1;
private final List<Subunit> subunits2;

private Map<Integer, Integer> subunitMap;
private MultipleAlignment alignment;
Expand Down Expand Up @@ -234,7 +234,7 @@ public void setAlignment(MultipleAlignment alignment) {
*/
public List<Subunit> getAlignedSubunits1() {

List<Subunit> aligned = new ArrayList<Subunit>(subunitMap.size());
List<Subunit> aligned = new ArrayList<>(subunitMap.size());

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

List<Subunit> aligned = new ArrayList<Subunit>(subunitMap.size());
List<Subunit> aligned = new ArrayList<>(subunitMap.size());

for (Integer key : subunitMap.keySet())
aligned.add(subunits2.get(subunitMap.get(key)));
Expand Down

0 comments on commit fc07139

Please sign in to comment.