Skip to content

BiologicalAssemblyBuilder: transformations ordering is non-transitiveΒ #791

@biocryst

Description

@biocryst

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;

Metadata

Metadata

Assignees

Labels

bugBugs and bugfixes

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions