Class PharmacophoreTree


  • public class PharmacophoreTree
    extends java.lang.Object
    A PharmacophoreTree closely follows the concepts of FeatureTrees as described by Rarey and Dixon (DOI:10.1023/a:1008068904628). A PharmacophoreTree consists of connected nodes and it's data structure is an undirected tree. No cycles are allowed which distinguishes it from a molecular graph. PharmacophoreTrees facilitates the comparison of chemical structures with respect to their features in 2D.
    Author:
    joel
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  PharmacophoreTree.BiGramInt
      container of an undirected edge
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int CUT_LEFT  
      static int CUT_NONE  
      static int CUT_RIGHT  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void enumerateExtensionCutFast​(int head, int[] cut, java.util.List<java.lang.Integer> subTreeEdgeIndeces, java.util.Set<java.lang.Integer> extensionNodes, java.util.Set<java.lang.Integer> sourceNodes)
      retrieve nodes that are part of extension match ("extension nodes") as well as the nodes that are part of a cut subtree (source nodes) from a cut-string
      void enumerateExtensionCutFull​(int head, int[] cut, java.util.List<java.lang.Integer> subTreeEdgeIndeces, java.util.List<java.lang.Integer> subTreeParentEdgeIndeces, java.util.List<java.util.List<java.lang.Integer>> sourceTreeEdgeIndeces, java.util.List<java.util.List<java.lang.Integer>> sourceTreeEdgeParentIndeces, java.util.List<java.lang.Integer> sourceTreeHeadNodes, java.util.Set<java.lang.Integer> extensionNodes, java.util.List<java.lang.Integer> cutEdges, java.util.List<java.lang.Integer> cutDirections)
      retrieves nodes that are part of extension match ("extension nodes") as well as the different subtrees resulting from the cuts with a list of their edges (in bfs order) as well as the parents of the edges
      java.util.List<java.util.Set<java.lang.Integer>> getAllSubtrees()  
      double getDirectSim​(PharmacophoreTree pTree2)  
      java.util.List<int[]> getEdges()  
      java.util.List<int[]> getExtensionCuts​(java.util.List<java.lang.Integer> subtreeEdgeIndeces, java.util.List<java.lang.Integer> subtreeEdgeParentIndeces)
      get a list of int[] arrays that define an extension cut: Given a subtree with a designated head-node, an extension cut separates an extension match from the remaining subtrees.
      int getLinkNodes()  
      java.util.List<PharmacophoreNode> getNodes()  
      java.util.List<PharmacophoreNode> getNodes​(java.util.Collection<java.lang.Integer> indeces)  
      java.util.Set<java.lang.Integer> getNodesFromEdges​(java.util.List<java.lang.Integer> edgeIndeces)  
      void getPathsFromHeadNode​(int headNode, java.util.List<java.util.Set<java.lang.Integer>> paths, java.util.Set<java.lang.Integer> visitedEdges)  
      double getSize()  
      double getSubTreeSize​(java.util.List<java.lang.Integer> edges, int headNode)  
      int[] initialCut​(int cut, int edge, java.util.List<java.lang.Integer> sourceTreeEdges, java.util.List<java.lang.Integer> sourceTreeEdgeParents, java.util.List<java.lang.Integer> targetTreeEdges, java.util.List<java.lang.Integer> targetTreeEdgeParents)
      a cut divides a edge into a target node and a source node: an edge is defined as a tuple of two nodes (a,b), a left cut results in node a being the source node and b being the target node: a-->--b a right cut results in the right node being the source node: a--<--b returns int array with source node as 0th element and target node as 1st element
      void removeNode​(PharmacophoreNode node)  
      void treeWalkBFS​(int headNode, int deletedEdgeIndex, java.util.List<java.lang.Integer> treeEdgesBFS, java.util.List<java.lang.Integer> edgeParentsBFS)
      Walks a subtree of the PharmacophoreTree in breadth-first manner starting from a deleted edge and a designated head node.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PharmacophoreTree

        public PharmacophoreTree​(java.util.List<PharmacophoreNode> nodes,
                                 java.util.List<int[]> edges)
    • Method Detail

      • initialCut

        public int[] initialCut​(int cut,
                                int edge,
                                java.util.List<java.lang.Integer> sourceTreeEdges,
                                java.util.List<java.lang.Integer> sourceTreeEdgeParents,
                                java.util.List<java.lang.Integer> targetTreeEdges,
                                java.util.List<java.lang.Integer> targetTreeEdgeParents)
        a cut divides a edge into a target node and a source node: an edge is defined as a tuple of two nodes (a,b), a left cut results in node a being the source node and b being the target node: a-->--b a right cut results in the right node being the source node: a--<--b returns int array with source node as 0th element and target node as 1st element
        Parameters:
        cut -
        edge -
        sourceTreeEdges -
        sourceTreeEdgeParents -
        targetTreeEdges -
        targetTreeEdgeParents -
        Returns:
      • treeWalkBFS

        public void treeWalkBFS​(int headNode,
                                int deletedEdgeIndex,
                                java.util.List<java.lang.Integer> treeEdgesBFS,
                                java.util.List<java.lang.Integer> edgeParentsBFS)
        Walks a subtree of the PharmacophoreTree in breadth-first manner starting from a deleted edge and a designated head node. Returns a list of edge indeces and the parents of the edges.
        Parameters:
        headNode -
        deletedEdgeIndex -
        treeEdgesBFS -
        edgeParentsBFS -
      • enumerateExtensionCutFast

        public void enumerateExtensionCutFast​(int head,
                                              int[] cut,
                                              java.util.List<java.lang.Integer> subTreeEdgeIndeces,
                                              java.util.Set<java.lang.Integer> extensionNodes,
                                              java.util.Set<java.lang.Integer> sourceNodes)
        retrieve nodes that are part of extension match ("extension nodes") as well as the nodes that are part of a cut subtree (source nodes) from a cut-string
        Parameters:
        head -
        cut -
        subTreeEdgeIndeces -
        extensionNodes -
        sourceNodes -
      • enumerateExtensionCutFull

        public void enumerateExtensionCutFull​(int head,
                                              int[] cut,
                                              java.util.List<java.lang.Integer> subTreeEdgeIndeces,
                                              java.util.List<java.lang.Integer> subTreeParentEdgeIndeces,
                                              java.util.List<java.util.List<java.lang.Integer>> sourceTreeEdgeIndeces,
                                              java.util.List<java.util.List<java.lang.Integer>> sourceTreeEdgeParentIndeces,
                                              java.util.List<java.lang.Integer> sourceTreeHeadNodes,
                                              java.util.Set<java.lang.Integer> extensionNodes,
                                              java.util.List<java.lang.Integer> cutEdges,
                                              java.util.List<java.lang.Integer> cutDirections)
        retrieves nodes that are part of extension match ("extension nodes") as well as the different subtrees resulting from the cuts with a list of their edges (in bfs order) as well as the parents of the edges
        Parameters:
        head -
        cut -
        subTreeEdgeIndeces -
        subTreeParentEdgeIndeces -
        sourceTreeEdgeIndeces -
        sourceTreeEdgeParentIndeces -
        sourceTreeHeadNodes -
        extensionNodes -
        cutEdges -
        cutDirections -
      • getExtensionCuts

        public java.util.List<int[]> getExtensionCuts​(java.util.List<java.lang.Integer> subtreeEdgeIndeces,
                                                      java.util.List<java.lang.Integer> subtreeEdgeParentIndeces)
        get a list of int[] arrays that define an extension cut: Given a subtree with a designated head-node, an extension cut separates an extension match from the remaining subtrees. The extension cut defines for every edge of the input subtrees their status: 0 -> edge contained in extension match 1 -> edge is cut -1 -> edge is part of a cut subtree
        Parameters:
        subtreeEdgeIndeces -
        subtreeEdgeParentIndeces -
        Returns:
      • getNodesFromEdges

        public java.util.Set<java.lang.Integer> getNodesFromEdges​(java.util.List<java.lang.Integer> edgeIndeces)
      • getNodes

        public java.util.List<PharmacophoreNode> getNodes​(java.util.Collection<java.lang.Integer> indeces)
      • getEdges

        public java.util.List<int[]> getEdges()
      • getLinkNodes

        public int getLinkNodes()
      • getSize

        public double getSize()
      • getSubTreeSize

        public double getSubTreeSize​(java.util.List<java.lang.Integer> edges,
                                     int headNode)
      • getAllSubtrees

        public java.util.List<java.util.Set<java.lang.Integer>> getAllSubtrees()
      • getPathsFromHeadNode

        public void getPathsFromHeadNode​(int headNode,
                                         java.util.List<java.util.Set<java.lang.Integer>> paths,
                                         java.util.Set<java.lang.Integer> visitedEdges)