Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -507,27 +507,24 @@ public boolean mergeStructure(SubunitCluster other, SubunitClustererParameters p
}
}

AFPChain afp = aligner.align(this.subunits.get(this.representative)
.getRepresentativeAtoms(),
other.subunits.get(other.representative)
.getRepresentativeAtoms());
AFPChain afp = aligner.align(this.subunits.get(this.representative).getRepresentativeAtoms(),
other.subunits.get(other.representative).getRepresentativeAtoms());

String pairName = this.subunits.get(this.representative).getName() + "-" + other.subunits.get(other.representative).getName();
if (afp.getOptLength() < 1) {
// alignment failed (eg if chains were too short)
throw new StructureException(
String.format("Subunits failed to align using %s", params.getSuperpositionAlgorithm()));
String.format("Subunits %s failed to align using %s", pairName, params.getSuperpositionAlgorithm()));
}

// Convert AFPChain to MultipleAlignment for convenience
MultipleAlignment msa = new MultipleAlignmentEnsembleImpl(
afp,
this.subunits.get(this.representative).getRepresentativeAtoms(),
other.subunits.get(other.representative)
.getRepresentativeAtoms(), false)
.getMultipleAlignment(0);
other.subunits.get(other.representative).getRepresentativeAtoms(),
false).getMultipleAlignment(0);

double structureCoverage = Math.min(msa.getCoverages().get(0), msa
.getCoverages().get(1));
double structureCoverage = Math.min(msa.getCoverages().get(0), msa.getCoverages().get(1));

if(params.isUseStructureCoverage() && structureCoverage < params.getStructureCoverageThreshold()) {
return false;
Expand All @@ -543,8 +540,7 @@ public boolean mergeStructure(SubunitCluster other, SubunitClustererParameters p
return false;
}

logger.info(String.format("SubunitClusters are structurally similar with "
+ "%.2f RMSD %.2f coverage", rmsd, structureCoverage));
logger.info("SubunitClusters {} are structurally similar with [ {} ] RMSD and [ {} ] coverage", pairName, String.format("%.2f", rmsd), String.format("%.2f", structureCoverage));

// Merge clusters
List<List<Integer>> alignedRes = msa.getBlock(0).getAlignRes();
Expand All @@ -565,13 +561,18 @@ public boolean mergeStructure(SubunitCluster other, SubunitClustererParameters p

// Only consider residues that are part of the SubunitCluster
if (this.subunitEQR.get(this.representative).contains(thisIndex)
&& other.subunitEQR.get(other.representative).contains(
otherIndex)) {
&& other.subunitEQR.get(other.representative).contains(otherIndex)) {
thisAligned.add(thisIndex);
otherAligned.add(otherIndex);
}
}

// this can happen in very rare cases, e.g. 9y9z when merging E_1 into the cluster D_1, OM_1, Y_1
if (thisAligned.isEmpty() && otherAligned.isEmpty()) {
logger.warn("No equivalent aligned atoms found between SubunitClusters {} via structure alignment. Will not merge the second one into the first.", pairName);
return false;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the fix. The rest are formatting and logging improvements.


updateEquivResidues(other, thisAligned, otherAligned);

this.method = SubunitClustererMethod.STRUCTURE;
Expand Down Expand Up @@ -602,18 +603,12 @@ private void updateEquivResidues(SubunitCluster other, List<Integer> thisAligned
Collections.sort(otherRemove);
Collections.reverse(otherRemove);

for (int t = 0; t < thisRemove.size(); t++) {
for (List<Integer> eqr : this.subunitEQR) {
int column = thisRemove.get(t);
eqr.remove(column);
}
for (int column : thisRemove) {
this.subunitEQR.forEach(eqr -> eqr.remove(column));
}

for (int t = 0; t < otherRemove.size(); t++) {
for (List<Integer> eqr : other.subunitEQR) {
int column = otherRemove.get(t);
eqr.remove(column);
}
for (int column : otherRemove) {
other.subunitEQR.forEach(eqr -> eqr.remove(column));
}

// The representative is the longest sequence
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ public static Stoichiometry cluster(List<Subunit> subunits, SubunitClustererPara
}

} catch (CompoundNotFoundException e) {
logger.warn("Could not merge by Sequence. {}",
e.getMessage());
logger.info("Could not merge by Sequence. {}", e.getMessage());
}
}
}
Expand All @@ -100,7 +99,7 @@ public static Stoichiometry cluster(List<Subunit> subunits, SubunitClustererPara
clusters.remove(c2);
}
} catch (StructureException e) {
logger.warn("Could not merge by Structure. {}", e.getMessage());
logger.info("Could not merge by Structure. {}", e.getMessage());
}
}
}
Expand All @@ -112,8 +111,7 @@ public static Stoichiometry cluster(List<Subunit> subunits, SubunitClustererPara
try {
clusters.get(c).divideInternally(params);
} catch (StructureException e) {
logger.warn("Error analyzing internal symmetry. {}",
e.getMessage());
logger.info("Error analyzing internal symmetry. {}", e.getMessage());
}
}

Expand All @@ -125,8 +123,7 @@ public static Stoichiometry cluster(List<Subunit> subunits, SubunitClustererPara
if (clusters.get(c1).mergeStructure(clusters.get(c2), params))
clusters.remove(c2);
} catch (StructureException e) {
logger.warn("Could not merge by Structure. {}",
e.getMessage());
logger.info("Could not merge by Structure. {}", e.getMessage());
}
}
}
Expand Down