Class StructureInterfaceList

java.lang.Object
org.biojava.nbio.structure.contact.StructureInterfaceList
All Implemented Interfaces:
Serializable, Iterable<StructureInterface>

public class StructureInterfaceList extends Object implements Serializable, Iterable<StructureInterface>
A list of interfaces between 2 molecules (2 sets of atoms)
Author:
Jose Duarte
See Also:
  • Field Details

  • Constructor Details

    • StructureInterfaceList

      public StructureInterfaceList()
  • Method Details

    • add

      public void add(StructureInterface interf)
    • size

      public int size()
    • getList

      public List<StructureInterface> getList()
    • get

      public StructureInterface get(int id)
      Gets the interface corresponding to given id. The ids go from 1 to n If sort() was called then the order is descendent by area.
      Parameters:
      id -
      Returns:
    • calcAsas

      public void calcAsas()
      Calculates ASAs for all interfaces in list, both for the unbound chains and for the complex of the two chains together. Also sorts the interfaces based on calculated BSA areas (descending).

      Uses default parameters

    • calcAsas

      public void calcAsas(int nSpherePoints, int nThreads, int cofactorSizeToUse)
      Calculates ASAs for all interfaces in list, both for the unbound chains and for the complex of the two chains together. Also sorts the interfaces based on calculated BSA areas (descending)
      Parameters:
      nSpherePoints -
      nThreads -
      cofactorSizeToUse - the minimum size of cofactor molecule (non-chain HET atoms) that will be used
    • sort

      public void sort()
      Sorts the interface list and reassigns ids based on new sorting
    • getClustersNcs

      public List<StructureInterfaceCluster> getClustersNcs()
      Get the interface clusters for this StructureInterfaceList grouped by NCS-equivalence. This means that for any two interfaces in the same cluster: 1. The chains forming the first interface are NCS-copies of the chains forming the second interface, in any order. 2. Relative orientation of the chains is preserved, i.e. the contacts are identical.
      Returns:
      list of StructureInterfaceCluster objects.
      Since:
      5.0.0
    • addNcsEquivalent

      public void addNcsEquivalent(StructureInterface interfaceNew, StructureInterface interfaceRef)
      Add an interface to the list, possibly defining it as NCS-equivalent to an interface already in the list. Used to build up the NCS clustering.
      Parameters:
      interfaceNew - an interface to be added to the list.
      interfaceRef - interfaceNew will be added to the cluster which contains interfaceRef. If interfaceRef is null, new cluster will be created for interfaceNew.
      Since:
      5.0.0
    • setChainOrigNamesMap

      public void setChainOrigNamesMap(Map<String,String> chainOrigNamesMap)
      Sets a map with mapping from NCS chain names to original chain names. Necessary when addNcsEquivalent(StructureInterface, StructureInterface) is used and NCS equivalent interfaces exist in this list and their names need mapping when setting ASAs.
      Parameters:
      chainOrigNamesMap - a map of NCS chain name to original chain name
    • removeInterfacesBelowArea

      public void removeInterfacesBelowArea()
      Removes from this interface list all interfaces with areas below the default cutoff area. Note that this must be called after calcAsas(int, int, int), otherwise all areas would be 0 and thus all removed.
      See Also:
    • removeInterfacesBelowArea

      public void removeInterfacesBelowArea(double area)
      Removes from this interface list all interfaces with areas below the given cutoff area. Note that this must be called after calcAsas(int, int, int), otherwise all areas would be 0 and thus all removed.
      Parameters:
      area - the minimum interface buried surface area to keep. Interfaces below this value will be removed.
    • getClusters

      public List<StructureInterfaceCluster> getClusters()
      Calculate the interface clusters for this StructureInterfaceList using a contact overlap score to measure the similarity of interfaces. Subsequent calls will use the cached value without recomputing the clusters. The contact overlap score cutoff to consider a pair in the same cluster is the value DEFAULT_CONTACT_OVERLAP_SCORE_CLUSTER_CUTOFF
      Returns:
    • getClusters

      public List<StructureInterfaceCluster> getClusters(double contactOverlapScoreClusterCutoff)
      Calculate the interface clusters for this StructureInterfaceList using Jaccard contact set scores to measure the similarity of interfaces. Subsequent calls will use the cached value without recomputing the clusters, until removeInterfacesBelowArea(double) is called. The clusters will be assigned ids by sorting descending by StructureInterfaceCluster.getTotalArea()

      Interfaces are compared by entity pairs (see ENTITY_ID_PAIR) and grouped with the leader algorithm described in clusterInterfaces(List, Function, double). The interfaces with most residue contacts are taken first as representatives, so that the result doesn't depend on the order of the list or on whether ASAs have been calculated. Ties keep the order of the list.

      Parameters:
      contactOverlapScoreClusterCutoff - the contact overlap score above which a pair will be clustered
      Returns:
    • clusterInterfaces

      public static <T> List<StructureInterfaceCluster> clusterInterfaces(List<StructureInterfaceCluster> initialClusters, Function<StructureInterface,Pair<T>> idPairFunction, double contactOverlapScoreClusterCutoff)
      Groups interface clusters further, merging any two whose representatives (first members) have a contact overlap score above the given cutoff.

      This is the leader algorithm: the representative of the first cluster is compared to the representatives of all subsequent clusters, merging those above cutoff into it; then the same is repeated for the next remaining cluster. It performs at most n(n-1)/2 score calculations, and about n*k for n input and k output clusters. Unlike single linkage clustering, similarity is not transitive through non-representative members and the result depends on the input order: placing larger interfaces first makes them the representatives.

      Two interfaces are only compared if their identifier pairs match, in the same or inverted order. The score is then StructureInterface.getContactOverlapScore(StructureInterface, boolean) non-inverted or inverted respectively, or the maximum of both if all 4 identifiers are equal.

      The input clusters are not modified. The output clusters are new objects whose members are the representative's cluster members followed by the members of the clusters merged into it, and whose average score is the average of the scores that caused merges (1.0 if no merges). The cluster back-references of all members are set to the output clusters. Ids are not assigned.

      Parameters:
      initialClusters - the starting clusters, e.g. one singleton cluster per interface. Must not be empty: the first member of each is its representative
      idPairFunction - gives the pair of identifiers for the 2 sides of an interface, e.g. ENTITY_ID_PAIR. If it returns null the interface is not merged with any other
      contactOverlapScoreClusterCutoff - the contact overlap score above which a pair of clusters is merged
      Returns:
      the merged clusters, in the order of their representatives in the input
      Since:
      7.3.0
    • iterator

      public Iterator<StructureInterface> iterator()
      Specified by:
      iterator in interface Iterable<StructureInterface>
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • calculateInterfaces

      public static StructureInterfaceList calculateInterfaces(Structure struc)
      Calculates the interfaces for a structure using default parameters
      Parameters:
      struc -
      Returns: