aganezov / bg

Breakpoint graph implementation in Python programming language
MIT License
2 stars 0 forks source link

Issues with networkx 2.0 #2

Closed ANekhai closed 7 years ago

ANekhai commented 7 years ago

Hey, There are currently issues with bg caused by networkx updating to version 2.0. Things in bg are now deprecated in networkx such as node_iter and nodes() returning iterators. I have attached an error message from code trying to utilize bg:

Traceback (most recent call last):
  File "/home/anton/Desktop/ILP/median.py", line 277, in <module>
    main(graph1, graph2, graph3, result_out_file="result.txt", genome_out_file="median.txt")
  File "/home/anton/Desktop/ILP/median.py", line 174, in main
1h
    labeled_edges_for_genomes.append(enumerate_edges_in_genome(genome, vertex2ind))
  File "/home/anton/Desktop/ILP/median.py", line 39, in enumerate_edges_in_genome
2h
    edges = list(graph.edges(u, keys=True))
  File "/usr/local/lib/python2.7/dist-packages/bg/breakpoint_graph.py", line 111, in edges
    for entry in self.__edges(nbunch=nbunch, keys=keys):
  File "/usr/local/lib/python2.7/dist-packages/bg/breakpoint_graph.py", line 92, in __edges
{<bg.vertices.TaggedBlockVertex object at 0x7fd978b08c90>: 1, <bg.vertices.TaggedBlockVertex object at 0x7fd978b08c10>: 2, <bg.vertices.TaggedBlockVertex object at 0x7fd978b08d10>: 3, <bg.vertices.TaggedBlockVertex object at 0x7fd978b08d50>: 4, <bg.vertices.TaggedBlockVertex object at 0x7fd978b08c50>: 5, <bg.vertices.TaggedBlockVertex object at 0x7fd978b08cd0>: 6}
    for v1, v2, key, data in self.bg.edges_iter(nbunch=nbunch, data=True, keys=True):
['2t', '1h']
AttributeError: 'MultiGraph' object has no attribute 'edges_iter'

We have also found this link that describes how networkx has changed from 1.X to 2: https://networkx.github.io/documentation/stable/release/migration_guide_from_1.x_to_2.0.html?highlight=edges_iter

Thanks, Anton