Class Similarity


  • public class Similarity
    extends java.lang.Object
    Collection of methods for measuring structural similarity
    • Constructor Detail

      • Similarity

        public Similarity()
    • Method Detail

      • getRMSD

        public static double getRMSD​(PointList A,
                                     PointList B)
        Calculates RMSD similarity between two point lists
        Parameters:
        A - first point list
        B - second point list
        Returns:
        RMSD
      • getRMSD

        public static double getRMSD​(Structure A,
                                     Structure B)
        Calculates RMSD similarity between two structures
        Parameters:
        A - first structure
        B - second structure
        Returns:
        RMSD
      • getRMSD

        public static double getRMSD​(Structure A,
                                     IndexSet indicesA,
                                     Structure B,
                                     IndexSet indicesB)
        Calculates RMSD similarity between two groups of atoms
        Parameters:
        A - first structure
        indicesA - index set of atoms in the first structure
        B - second structure
        indicesB - index set of atoms in the second structure
        Returns:
        RMSD
      • getRMSDiProfile

        public static java.util.ArrayList<java.lang.Double> getRMSDiProfile​(PointList A,
                                                                            PointList B)
        Calculates the RMSDi profile between two point lists
        Parameters:
        A - first point list
        B - second point list
        Returns:
        RMSDi profile
      • getRMSDiProfile

        public static java.util.ArrayList<java.lang.Double> getRMSDiProfile​(Structure A,
                                                                            Structure B)
        Calculates the RMSDi profile between two structures
        Parameters:
        A - first structure
        B - second structure
        Returns:
        RMSDi profile
      • getRMSDiProfile

        public static java.util.ArrayList<java.lang.Double> getRMSDiProfile​(Structure A,
                                                                            IndexSet indicesA,
                                                                            Structure B,
                                                                            IndexSet indicesB)
        Calculates the RMSDi profile between two groups of atoms
        Parameters:
        A - first structure
        indicesA - index set of atoms in the first structure
        B - second structure
        indicesB - index set of atoms in the second structure
        Returns:
        RMSDi profile
      • getRMSDnoSuperposition

        public static double getRMSDnoSuperposition​(PointList A,
                                                    PointList B)
        Calculates RMSD similarity between two point lists without doing superposition
        Parameters:
        A - first point list
        B - second point list
        Returns:
        RMSD without superposition
      • getRMSDnoSuperposition

        public static double getRMSDnoSuperposition​(Structure A,
                                                    Structure B)
        Calculates RMSD similarity between two structures without doing superposition
        Parameters:
        A - first structure
        B - second structure
        Returns:
        RMSD without superposition
      • getRMSDnoSuperposition

        public static double getRMSDnoSuperposition​(Structure A,
                                                    IndexSet indicesA,
                                                    Structure B,
                                                    IndexSet indicesB)
        Calculates RMSD similarity between two groups of atoms without superposition
        Parameters:
        A - first structure
        indicesA - index set of atoms in the first structure
        B - second structure
        indicesB - index set of atoms in the second structure
        Returns:
        RMSD without superposition
      • getRMSDiProfileNoSuperposition

        public static java.util.ArrayList<java.lang.Double> getRMSDiProfileNoSuperposition​(PointList A,
                                                                                           PointList B)
        Calculates the RMSDi profile between two point lists without superposition
        Parameters:
        A - first point list
        B - second point list
        Returns:
        RMSDi profile without superposition
      • getRMSDiProfileNoSuperposition

        public static java.util.ArrayList<java.lang.Double> getRMSDiProfileNoSuperposition​(Structure A,
                                                                                           Structure B)
        Calculates the RMSDi profile between two structures without superposition
        Parameters:
        A - first structure
        B - second structure
        Returns:
        RMSDi profile without superposition
      • getRMSDiProfileNoSuperposition

        public static java.util.ArrayList<java.lang.Double> getRMSDiProfileNoSuperposition​(Structure A,
                                                                                           IndexSet indicesA,
                                                                                           Structure B,
                                                                                           IndexSet indicesB)
        Calculates the RMSDi profile between two groups of atoms without superposition
        Parameters:
        A - first structure
        indicesA - index set of atoms in the first structure
        B - second structure
        indicesB - index set of atoms in the second structure
        Returns:
        RMSDi profile without superposition
      • getDRMSD

        public static double getDRMSD​(Jama.Matrix A,
                                      Jama.Matrix B)
        Calculates dRMSD similarity between two distance matrices
        Parameters:
        A - first distance matrix
        B - second distance matrix
        Returns:
        dRMSD
      • getDRMSD

        public static double getDRMSD​(PointList A,
                                      PointList B)
        Calculates dRMSD similarity between two point lists
        Parameters:
        A - first point list
        B - second point list
        Returns:
        dRMSD
      • getDRMSD

        public static double getDRMSD​(Structure A,
                                      Structure B)
        Calculates dRMSD similarity between two structures
        Parameters:
        A - first structure
        B - second structure
        Returns:
        dRMSD
      • getDRMSD

        public static double getDRMSD​(Structure A,
                                      IndexSet indicesA,
                                      Structure B,
                                      IndexSet indicesB)
        Calculates dRMSD similarity between two groups of atoms
        Parameters:
        A - first structure
        indicesA - index set of atoms in the first structure
        B - second structure
        indicesB - index set of atoms in the second structure
        Returns:
        dRMSD
      • getDRMSDiProfile

        public static java.util.ArrayList<java.lang.Double> getDRMSDiProfile​(Jama.Matrix A,
                                                                             Jama.Matrix B)
        Calculates the dRMSDi profile between two distance matrices
        Parameters:
        A - first distance matrix
        B - second distance matrix
        Returns:
        dRMSDi profile
      • getDRMSDiProfile

        public static java.util.ArrayList<java.lang.Double> getDRMSDiProfile​(PointList A,
                                                                             PointList B)
        Calculates the dRMSDi profile between two point lists
        Parameters:
        A - first point list
        B - second point list
        Returns:
        dRMSDi profile
      • getDRMSDiProfile

        public static java.util.ArrayList<java.lang.Double> getDRMSDiProfile​(Structure A,
                                                                             Structure B)
        Calculates the dRMSDi profile between two structures
        Parameters:
        A - first structure
        B - second structure
        Returns:
        dRMSDi profile
      • getDRMSDiProfile

        public static java.util.ArrayList<java.lang.Double> getDRMSDiProfile​(Structure A,
                                                                             IndexSet indicesA,
                                                                             Structure B,
                                                                             IndexSet indicesB)
        Calculates the dRMSDi profile between two groups of atoms
        Parameters:
        A - first structure
        indicesA - index set of atoms in the first structure
        B - second structure
        indicesB - index set of atoms in the second structure
        Returns:
        dRMSDi profile
      • getWDRMSD

        public static double getWDRMSD​(PointList A,
                                       PointList B,
                                       Jama.Matrix W)
        Calculates the wdRMSD (weighted dRMSD) similarity of two point lists
        Parameters:
        A - first point list
        B - second point list
        W - weight matrix
        Returns:
        wdRMSD
      • getWDRMSD

        public static double getWDRMSD​(Structure A,
                                       Structure B,
                                       Jama.Matrix W)
        Calculates the wdRMSD (weighted dRMSD) similarity of two structures
        Parameters:
        A - first structure
        B - second structure
        W - weight matrix
        Returns:
        wdRMSD
      • getWDRMSD

        public static double getWDRMSD​(Structure A,
                                       IndexSet indicesA,
                                       Structure B,
                                       IndexSet indicesB,
                                       Jama.Matrix W)
        Calculates wdRMSD (weighted dRMSD) similarity between two groups of atoms
        Parameters:
        A - first structure
        indicesA - index set of atoms in the first structure
        B - second structure
        indicesB - index set of atoms in the second structure
        W - weight matrix
        Returns:
        wdRMSD
      • getWDRMSDiProfile

        public static java.util.ArrayList<java.lang.Double> getWDRMSDiProfile​(PointList A,
                                                                              PointList B,
                                                                              Jama.Matrix W)
        Calculates the wdRMSDi (weighted dRMSDi) profile between two point lists
        Parameters:
        A - first point list
        B - second point list
        W - weight matrix
        Returns:
        wdRMSDi profile
      • getWDRMSDiProfile

        public static java.util.ArrayList<java.lang.Double> getWDRMSDiProfile​(Structure A,
                                                                              Structure B,
                                                                              Jama.Matrix W)
        Calculates the wdRMSDi (weighted dRMSDi) profile between two structures
        Parameters:
        A - first structure
        B - second structure
        W - weight matrix
        Returns:
        wdRMSDi profile
      • getWDRMSDiProfile

        public static java.util.ArrayList<java.lang.Double> getWDRMSDiProfile​(Structure A,
                                                                              IndexSet indicesA,
                                                                              Structure B,
                                                                              IndexSet indicesB,
                                                                              Jama.Matrix W)
        Calculates the wdRMSDi (weighted dRMSDi) profile between two groups of atoms
        Parameters:
        A - first structure
        indicesA - index set of atoms in the first structure
        B - second structure
        indicesB - index set of atoms in the second structure
        W - weight matrix
        Returns:
        wdRMSDi profile
      • getSimilarityMatrixRMSD

        public static Jama.Matrix getSimilarityMatrixRMSD​(Trajectory t)
        Calculates the similarity matrix of all frames in a trajectory using the RMSD measure
        Parameters:
        t - trajectory
        Returns:
        similarity matrix
      • getSimilarityMatrixRMSD

        public static Jama.Matrix getSimilarityMatrixRMSD​(Trajectory t,
                                                          IndexSet indices)
        Calculates the similarity matrix of all frames in a trajectory using the RMSD measure taking into account only a subset of atoms
        Parameters:
        t - trajectory
        indices - index set of atoms
        Returns:
        similarity matrix
      • getSimilarityMatrixDRMSD

        public static Jama.Matrix getSimilarityMatrixDRMSD​(Trajectory t)
        Calculates the similarity matrix of all frames in a trajectory using the dRMSD measure
        Parameters:
        t - trajectory
        Returns:
        similarity matrix
      • getSimilarityMatrixDRMSD

        public static Jama.Matrix getSimilarityMatrixDRMSD​(Trajectory t,
                                                           IndexSet indices)
        Calculates the similarity matrix of all frames in a trajectory using the dRMSD measure taking into account only a subset of atoms
        Parameters:
        t - trajectory
        indices - index set of atoms
        Returns:
        similarity matrix
      • getSimilarityMatrixWDRMSD

        public static Jama.Matrix getSimilarityMatrixWDRMSD​(Trajectory t,
                                                            Jama.Matrix W)
        Calculates the similarity matrix of all frames in a trajectory using the wdRMSD (weighted dRMSD) measure
        Parameters:
        t - trajectory
        W - weight matrix
        Returns:
        similarity matrix
      • getSimilarityMatrixWDRMSD

        public static Jama.Matrix getSimilarityMatrixWDRMSD​(Trajectory t,
                                                            IndexSet indices,
                                                            Jama.Matrix W)
        Calculates the similarity matrix of all frames in a trajectory using the wdRMSD (weighted dRMSD) measure taking into account only a subset of atoms
        Parameters:
        t - trajectory
        indices - index set of atoms
        W - weight matrix
        Returns:
        similarity matrix
      • getSimilarityTimeSeriesRMSD

        public static java.util.ArrayList<java.lang.Double> getSimilarityTimeSeriesRMSD​(Trajectory t,
                                                                                        PointList R)
        Returns the time series of RMSD in a trajectory with regards to a reference point list
        Parameters:
        t - trajectory
        R - reference point list
        Returns:
        time series of RMSD
      • getSimilarityTimeSeriesRMSD

        public static java.util.ArrayList<java.lang.Double> getSimilarityTimeSeriesRMSD​(Trajectory t,
                                                                                        Structure R)
        Returns the time series of RMSD in a trajectory with regards to a reference structure
        Parameters:
        t - trajectory
        R - reference structure
        Returns:
        time series of RMSD
      • getSimilarityTimeSeriesRMSD

        public static java.util.ArrayList<java.lang.Double> getSimilarityTimeSeriesRMSD​(Trajectory t,
                                                                                        IndexSet indicesT,
                                                                                        Structure R,
                                                                                        IndexSet indicesR)
        Returns the time series of RMSD in a trajectory with regards to a reference structure taking into account only a subset of atoms
        Parameters:
        t - trajectory
        indicesT - index set of atoms in the trajectory
        R - reference structure
        indicesR - index set of atoms in the reference structure
        Returns:
        time series of RMSD
      • getSimilarityTimeSeriesDRMSD

        public static java.util.ArrayList<java.lang.Double> getSimilarityTimeSeriesDRMSD​(Trajectory t,
                                                                                         PointList R)
        Returns the time series of dRMSD in a trajectory with regards to a reference point list
        Parameters:
        t - trajectory
        R - reference point list
        Returns:
        time series of dRMSD
      • getSimilarityTimeSeriesDRMSD

        public static java.util.ArrayList<java.lang.Double> getSimilarityTimeSeriesDRMSD​(Trajectory t,
                                                                                         Structure R)
        Returns the time series of dRMSD in a trajectory with regards to a reference structure
        Parameters:
        t - trajectory
        R - reference structure
        Returns:
        time series of dRMSD
      • getSimilarityTimeSeriesDRMSD

        public static java.util.ArrayList<java.lang.Double> getSimilarityTimeSeriesDRMSD​(Trajectory t,
                                                                                         IndexSet indicesT,
                                                                                         Structure R,
                                                                                         IndexSet indicesR)
        Returns the time series of dRMSD in a trajectory with regards to a reference structure taking into account only a subset of atoms
        Parameters:
        t - trajectory
        indicesT - index set of atoms in the trajectory
        R - reference structure
        indicesR - index set of atoms in the reference structure
        Returns:
        time series of dRMSD
      • getSimilarityTimeSeriesWDRMSD

        public static java.util.ArrayList<java.lang.Double> getSimilarityTimeSeriesWDRMSD​(Trajectory t,
                                                                                          PointList R,
                                                                                          Jama.Matrix W)
        Returns the time series of wdRMSD (weighted dRMSD) in a trajectory with regards to a reference point list
        Parameters:
        t - trajectory
        R - reference point list
        W - weight matrix
        Returns:
        time series of wdRMSD
      • getSimilarityTimeSeriesWDRMSD

        public static java.util.ArrayList<java.lang.Double> getSimilarityTimeSeriesWDRMSD​(Trajectory t,
                                                                                          Structure R,
                                                                                          Jama.Matrix W)
        Returns the time series of wdRMSD (weighted dRMSD) in a trajectory with regards to a reference structure
        Parameters:
        t - trajectory
        R - reference structure
        W - weight matrix
        Returns:
        time series of wdRMSD
      • getSimilarityTimeSeriesWDRMSD

        public static java.util.ArrayList<java.lang.Double> getSimilarityTimeSeriesWDRMSD​(Trajectory t,
                                                                                          IndexSet indicesT,
                                                                                          Structure R,
                                                                                          IndexSet indicesR,
                                                                                          Jama.Matrix W)
        Returns the time series of wdRMSD (weighted dRMSD) in a trajectory with regards to a reference structure taking into account only a subset of atoms
        Parameters:
        t - trajectory
        indicesT - index set of atoms in the trajectory
        R - reference structure
        indicesR - index set of atoms in the reference structure
        W - weight matrix
        Returns:
        time series of wdRMSD
      • getDifferenceDistanceMatrix

        public static Jama.Matrix getDifferenceDistanceMatrix​(PointList points1,
                                                              PointList points2)
        Calculates the difference distance matrix between two point lists
        Parameters:
        points1 - first point list
        points2 - second point list
        Returns:
        difference distance matrix
      • getDifferenceDistanceMatrix

        public static Jama.Matrix getDifferenceDistanceMatrix​(Structure s1,
                                                              Structure s2)
        Calculates the atomic difference distance matrix between two structures
        Parameters:
        s1 - first structure
        s2 - second structure
        Returns:
        difference distance matrix
      • getDifferenceDistanceMatrix

        public static Jama.Matrix getDifferenceDistanceMatrix​(Structure s1,
                                                              IndexSet indices1,
                                                              Structure s2,
                                                              IndexSet indices2)
        Calculates the atomic difference distance matrix between two sets of atoms defined by two index sets in two structures
        Parameters:
        s1 - first structure
        indices1 - first index set
        s2 - second structure
        indices2 - second index set
        Returns:
        difference distance matrix
      • findSimilarFramesRMSD

        public static FrameIndexSet findSimilarFramesRMSD​(Trajectory t,
                                                          PointList reference,
                                                          double cutoff)
        Returns the set of frames in a trajectory that are more similar to a reference frame (based on the RMSD similarity measure) than a cutoff value
        Parameters:
        t - trajectory
        reference - reference frame
        cutoff - similarity cutoff
        Returns:
        frame index set
      • findSimilarFramesDRMSD

        public static FrameIndexSet findSimilarFramesDRMSD​(Trajectory t,
                                                           PointList reference,
                                                           double cutoff)
        Returns the list of frames in a trajectory that are more similar to a reference frame (based on the dRMSD similarity measure) than a cutoff value
        Parameters:
        t - trajectory
        reference - reference frame
        cutoff - similarity cutoff
        Returns:
        frame list
      • findSimilarFramesDRMSD

        public static FrameIndexSet findSimilarFramesDRMSD​(Trajectory t,
                                                           Jama.Matrix reference,
                                                           double cutoff)
        Returns the list of frames in a trajectory that are more similar to a reference distance matrix (based on the dRMSD similarity measure) than a cutoff value
        Parameters:
        t - trajectory
        reference - reference distance matrix
        cutoff - similarity cutoff
        Returns:
        frame list
      • getMedoidRMSD

        public static PointList getMedoidRMSD​(Trajectory t)
        Calculates the medoid frame of a trajectory using the RMSD measure
        Parameters:
        t - trajectory
        Returns:
        medoid frame
      • getMedoidDRMSD

        public static PointList getMedoidDRMSD​(Trajectory t)
        Calculates the medoid frame of a trajectory using the dRMSD measure
        Parameters:
        t - trajectory
        Returns:
        medoid frame