@@ -583,7 +583,8 @@ public void setCluster(StructureInterfaceCluster cluster) {
583583
584584 /**
585585 * Calculates the contact overlap score between this StructureInterface and
586- * the given one.
586+ * the given one. The calculation assumes that both interfaces come from the same structure. The ouput
587+ * will not necessarily make sense if the two interfaces come from different structures.
587588 * The two sides of the given StructureInterface need to match this StructureInterface
588589 * in the sense that they must come from the same Entity, i.e.
589590 * their residue numbers need to align with 100% identity, except for unobserved
@@ -597,17 +598,6 @@ public void setCluster(StructureInterfaceCluster cluster) {
597598 */
598599 public double getContactOverlapScore (StructureInterface other , boolean invert ) {
599600
600- Structure thisStruct = getParentStructure ();
601- Structure otherStruct = other .getParentStructure ();
602-
603- if (thisStruct !=otherStruct ) {
604- // in the current implementation, comparison between different structure doesn't make much sense
605- // and won't even work since the compounds of both will never match. We warn because it
606- // really is not what this is intended for at the moment
607- logger .warn ("Comparing interfaces from different structures, contact overlap score will be 0" );
608- return 0 ;
609- }
610-
611601 Pair <Chain > thisChains = getParentChains ();
612602 Pair <Chain > otherChains = other .getParentChains ();
613603
@@ -622,19 +612,19 @@ public double getContactOverlapScore(StructureInterface other, boolean invert) {
622612 Pair <EntityInfo > thisCompounds = new Pair <EntityInfo >(thisChains .getFirst ().getEntityInfo (), thisChains .getSecond ().getEntityInfo ());
623613 Pair <EntityInfo > otherCompounds = new Pair <EntityInfo >(otherChains .getFirst ().getEntityInfo (), otherChains .getSecond ().getEntityInfo ());
624614
625- if ( ( (thisCompounds .getFirst () == otherCompounds .getFirst ()) &&
626- (thisCompounds .getSecond () == otherCompounds .getSecond ()) ) ||
627- ( (thisCompounds .getFirst () == otherCompounds .getSecond ()) &&
628- (thisCompounds .getSecond () == otherCompounds .getFirst ()) ) ) {
615+ if ( ( (thisCompounds .getFirst (). getMolId () == otherCompounds .getFirst (). getMolId ()) &&
616+ (thisCompounds .getSecond (). getMolId () == otherCompounds .getSecond (). getMolId ()) ) ||
617+ ( (thisCompounds .getFirst (). getMolId () == otherCompounds .getSecond (). getMolId ()) &&
618+ (thisCompounds .getSecond (). getMolId () == otherCompounds .getFirst (). getMolId ()) ) ) {
629619
630620 int common = 0 ;
631621 GroupContactSet thisContacts = getGroupContacts ();
632622 GroupContactSet otherContacts = other .getGroupContacts ();
633623
634624 for (GroupContact thisContact :thisContacts ) {
635625
636- ResidueIdentifier first = null ;
637- ResidueIdentifier second = null ;
626+ ResidueIdentifier first ;
627+ ResidueIdentifier second ;
638628
639629 if (!invert ) {
640630 first = new ResidueIdentifier (thisContact .getPair ().getFirst ());
0 commit comments