Reproduce the problem with:
Structure pdb = StructureIO.getStructure("BIO:5TLS:1");
Fails with exception "Comparison method violates its general contract!". The problem is in the code below, which returns 0 ("equal") if transformation IDs are not equal, which leads in this particular case to
...
JA=HA
HA=GA
JA > GA
(and probably other contradictions, but here it breaks). Comparators in Java must establish total order.
|
public int compare(BiologicalAssemblyTransformation t1, BiologicalAssemblyTransformation t2) { |
|
// set sort order only if the two ids are identical |
|
if (t1.getId().equals(t2.getId())) { |
|
return chainIds.indexOf(t1.getChainId()) - chainIds.indexOf(t2.getChainId()); |
|
} |
|
return 0; |
Reproduce the problem with:
Structure pdb = StructureIO.getStructure("BIO:5TLS:1");Fails with exception "Comparison method violates its general contract!". The problem is in the code below, which returns 0 ("equal") if transformation IDs are not equal, which leads in this particular case to
...
JA=HA
HA=GA
JA > GA
(and probably other contradictions, but here it breaks). Comparators in Java must establish total order.
biojava/biojava-structure/src/main/java/org/biojava/nbio/structure/quaternary/BiologicalAssemblyBuilder.java
Lines 143 to 148 in 8a7b651