Menu

Error running simple_example

Wesley
2019-04-01
2019-09-13
  • Wesley

    Wesley - 2019-04-01

    I am attempting to run the simple_example for the lastest version of wisp, but I am getting the following error:

    # Calculating paths...
    #       Calculating the shortest path between any of the specified sources and any of the specified sinks...
    Traceback (most recent call last):
      File "../wisp.py", line 1464, in <module>
        paths = GetPaths(correlation_matrix, sources, sinks, parameters, correlation_matrix_object.average_pdb.residue_identifiers_in_order)
      File "../wisp.py", line 1006, in __init__
        shortest_length, shortest_path = self.get_shortest_path_length(correlation_matrix, sources, sinks, G)
      File "../wisp.py", line 1109, in get_shortest_path_length
        short_path = networkx.dijkstra_path(G, source, sink, weight='weight')
      File "/cm/shared/apps/miniconda/lib/python2.7/site-packages/networkx/algorithms/shortest_paths/weighted.py", line 163, in dijkstra_path
        weight=weight)
      File "/cm/shared/apps/miniconda/lib/python2.7/site-packages/networkx/algorithms/shortest_paths/weighted.py", line 472, in single_source_dijkstra
        weight=weight)
      File "/cm/shared/apps/miniconda/lib/python2.7/site-packages/networkx/algorithms/shortest_paths/weighted.py", line 732, in multi_source_dijkstra
        cutoff=cutoff, target=target)
      File "/cm/shared/apps/miniconda/lib/python2.7/site-packages/networkx/algorithms/shortest_paths/weighted.py", line 817, in _dijkstra_multisource
        raise nx.NodeNotFound("Source {} not in G".format(source))
     networkx.exception.NodeNotFound: Source 10 not in G
    

    I am using the version of wisp downloaded from http://sourceforge.net/projects/wisp-pathways/files/1.0/wisp-1.0.zip/download

    extracted into ~/bin/wisp

    I am running on CentOs version 6.9
    with python 2.7.15
    numpy 1.15.0
    scipy 1.2.0
    networkx 2.2
    cPickle 1.71
    multiprocessing 0.70a1

    I have tried fiddling around a bit and setting the source and sink nodes to other values and I get the same 'networkx.exception.NodeNotFound: Source ### not in G' for any choice of source node

     

    Last edit: Wesley 2019-04-01
  • Wesley

    Wesley - 2019-04-02

    I think I may have tracked part of the error.
    It looks like wisp.py is using

    G=networkx.Graph(data=correlation_matrix

    However, under networkx 2.2, the signature for networkx.Graph
    is:

    'networkx.Graph(self, incoming_graph_data=None, **attr)'

    rather than 'networkx.Graph(self,data=None, **attr)'
    as it is in some versions...

    I am checking to see if updating this line will fix the bug

     
  • Wesley

    Wesley - 2019-04-02

    The bug fix seems to work and the shortest path is computed, however, a new error is coming up after 'Starting serial portion of path-finding algorithm':

    # Calculating paths...
    #       Calculating the shortest path between any of the specified sources and any of the specified sinks...
    #           The shortest path has length 1.136358953726239
    #      Identifying the cutoff required to produce 15 paths...
    #          Testing the cutoff 1.136358953726239...
    #                Starting serial portion of path-finding algorithm (will run for 5.0 seconds)...
    Traceback (most recent call last):
      File "../wisp.py", line 1464, in <module>
        paths = GetPaths(correlation_matrix, sources, sinks, parameters, correlation_matrix_object.average_pdb.residue_identifiers_in_order)
      File "../wisp.py", line 1025, in __init__
        paths = self.remove_redundant_paths(self.get_paths_between_multiple_endpoints(cutoff_in_array, correlation_matrix, sources, sinks, G, parameters))
      File "../wisp.py", line 1149, in get_paths_between_multiple_endpoints
        paths.extend(self.get_paths_fixed_endpoints(cutoff, correlation_matrix, source, sink, G, parameters))
      File "../wisp.py", line 1235, in get_paths_fixed_endpoints
        find_paths_object.expand_growing_paths_one_step(paths_growing_out_from_source, full_paths_from_start_to_sink, cutoff, sink, G)
      File "../wisp.py", line 761, in expand_growing_paths_one_step
        node_neighbors=G.neighbors(paths_growing_out_from_source[i][-1])
      File "/cm/shared/apps/miniconda/lib/python2.7/site-packages/networkx/classes/graph.py", line 1251, in neighbors
        raise NetworkXError("The node %s is not in the graph." % (n,))
    networkx.exception.NetworkXError: The node 10 is not in the graph.
    

    Anyone have any ideas what is going on?

     
  • Wesley

    Wesley - 2019-04-02

    It seems that the error is again do to a different signature.
    Some searching reveals that this was written for networkx versions below 2.0. New versions of networkx (2.0 and up) have had several major changes, such as the signature of the 'Graph' constructor.

    There are 2 uses of this constructor in 'wisp.py'
    line 1216 and line 1001
    in both cases, 'Graph(data=' needs to be replaced with 'Graph(incoming_graph_data=' when using networkx >= 2.0

    Fixing these issues leads to a new bug, however:
    On line 762, 'for j in range(len(node_neighbors)):' causes an error because new versions of networkx are using dictionary-keyiterator objects to track node_neighbors. This leads to the error:
    TypeError: object of type 'dictionary-keyiterator' has no len()
    The solution is to wrap 'node_neighbors' in 'list()' so

    for j in range(len(node_neighbors)):
    is replaced by
    for j in range(len(list(node_neighbors))):

     
  • Wesley

    Wesley - 2019-04-02

    The above fix seems to just open up a related problem...
    it seems that previous versions of networkx use 'list' objects as return values for the 'neighbors' function, but newer versions use 'dictionary-keyiterator' objects.
    So the solution is to wrap the result being fed into 'node_neighbors' in 'list()'
    e.g.
    line 761
    node_neighbors=G.neighbors(paths_growing_out_from_source[i][-1])
    becomes
    node_neighbors=list(G.neighbors(paths_growing_out_from_source[i][-1]))

     
  • Wesley

    Wesley - 2019-04-02

    After the above fix, another quirk of newer networkx versions was found.
    Line 766:
    temp[0]=temp[0]+G.edge[temp[-2]][temp[-1]]['weight']
    needs to be changed to
    temp[0]=temp[0]+G.edges[temp[-2],temp[-1]]['weight']
    in order to accomadate the new syntax for edge (or edges in v>2.0) access

     
  • Wesley

    Wesley - 2019-04-02

    SUCCESS!
    After the above bug fixes, wisp.py is now sufficiently compatible with networkx >= 2.0 such that it can successfully run the 'simple-example' that comes with the installation.

    Can anyone point me to who to contact to construct a patch / update / bug fix/ etc?

     
  • jdurrant

    jdurrant - 2019-07-23

    Wesley, please forgive me for my delay in getting back to you! My sourceforge emails were going to my old UCSD email address, but I'm now at the University of Pittsburgh. Wonderful that you were able to patch the code to work with the latest version of networkx. Would you mind emailing your updated code to me at durrantj at pitt dot edu? All the best.

     
    • Wesley

      Wesley - 2019-07-25

      Hi, I tried sending the code you, but I got a reply that the message was not delivered:

      Delivery has failed to these recipients or groups:
      
      Your message wasn't delivered due to a permission or security issue. It may have been rejected by a moderator, the address may only accept email from certain senders, or another restriction may be preventing delivery.
      

      i am going to attache the code here.

      I have just tested it on a new iMac workstation working with a fresh install of conda (4.6.14, via anaconda), python 2.7 (2.7.16), pip (19.0.3), and networkx (2.2)

      let me know if you need anything else.

       
      • jdurrant

        jdurrant - 2019-07-31

        Hi Wesley. Just wanted to let you know that I got your code. Much thanks for this contribution! I've gotten this version running on Python 3 as well. We're going to test it intnerally for a bit and then publish it for others to use. Can I include you in the CONTRIBUTORS.md file? All the best.

         
        • Wesley

          Wesley - 2019-08-01

          Yes, feel free to include me in the CONTRIBUTORS file if the patch checks
          out. That would be great! Hopefully it will help others. It's always
          frustrating when api changes in dependencies break previously functional
          packages and libraries.
          All the best,
          -Dr. Wesley Botello-Smith

          On Tue, Jul 30, 2019 at 5:06 PM jdurrant jdurrant@users.sourceforge.net
          wrote:

          Hi Wesley. Just wanted to let you know that I got your code. Much thanks
          for this contribution! I've gotten this version running on Python 3 as
          well. We're going to test it intnerally for a bit and then publish it for
          others to use. Can I include you in the CONTRIBUTORS.md file? All the best.


          Error running simple_example
          https://sourceforge.net/p/wisp-pathways/discussion/general/thread/55d7445d45/?limit=25#59d2/4e21/a9ef


          Sent from sourceforge.net because you indicated interest in
          https://sourceforge.net/p/wisp-pathways/discussion/general/

          To unsubscribe from further messages, please visit
          https://sourceforge.net/auth/subscriptions/

           
          • jdurrant

            jdurrant - 2019-09-13

            Hi Wesley. Wanted to let you know that the latest version is posted here: https://git.durrantlab.pitt.edu/jdurrant/wisp

            All the best.

             
  • Douglas Houston

    Douglas Houston - 2019-08-20

    That's great! I'd be very interested in trying out this new version ...

     
    • jdurrant

      jdurrant - 2019-09-13

      Hi Douglas. Wanted to let you know that the latest version is posted here: https://git.durrantlab.pitt.edu/jdurrant/wisp

      All the best.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.