marbl/MetagenomeScope

Need to set up decomposed graph as a MultiDiGraph

fedarko opened this issue · 1 comments

Checklist for getting this working

  • Update all pattern validation functions: if there are any duplicate edges (?) within the patterns, for now just completely disallow these patterns from being created. Arguably, we could try to support bubbles that are constructed this way, but I don't think that is worth doing at this time.
  • Update layout (within Patterns and overall): ensure that duplicate edges are properly used in the layout and retrieved (I'm guessing somewhere around here / in JSON export is where the bug happens)
  • Update JSON export: ensure that duplicate edges are properly retrieved
  • Ensure that "bubble chain test" passes

I'm just noticing this now -- this is a weird bug that seems to be impacting one of the test datasets. It's getting visualized as

mgsc-2020-12-08T12_22_15

... these patterns are identified as expected (ideally this would be a chain of bubbles, but the "outer" chains and #201 mean that for now this isn't possible), but -- in any case -- there should be edges from 1 -> 2 and from 5 -> 7. It's very concerning that these edges seem to be getting removed.

I'm going to go through and try to figure out where the problem is...

I believe this is caused by #187. NetworkX DiGraphs can't handle duplicate edges between nodes, and it turns out they will just kinda... fail silently if you try to add duplicate edges. This happens when we collapse a pattern in the decomposed digraph, as is shown above -- the two edges get smooshed into a single one.

The solution is making the decomposed graph a nx.MultiDiGraph rather than a nx.DiGraph. Hopefully making this change won't be too horrible...