def test_remove_if_redundant_with_multiple_edges_same_citations(self): net = NiceCXNetwork() adjud = RedundantEdgeAdjudicator() nid = net.create_edge(edge_source=0, edge_target=1, edge_interaction='neighbor-of') net.set_edge_attribute(nid, RedundantEdgeAdjudicator.CITATION, ['pubmed:4', 'pubmed:123'], type='list_of_string') cid = net.create_edge(edge_source=0, edge_target=1, edge_interaction='controls-state-change-of') net.set_edge_attribute(cid, RedundantEdgeAdjudicator.CITATION, ['pubmed:555', 'pubmed:4'], type='list_of_string') cidtwo = net.create_edge(edge_source=0, edge_target=1, edge_interaction='controls-state-change-of') net.set_edge_attribute(cidtwo, RedundantEdgeAdjudicator.CITATION, ['pubmed:4', 'pubmed:123'], type='list_of_string') self.assertEqual('neighbor-of', net.get_edge(nid)['i']) adjud._remove_if_redundant(net, nid, [cid, cidtwo]) self.assertEqual(None, net.get_edge(nid))
def test_remove_if_redundant_with_no_citation_on_edge(self): net = NiceCXNetwork() adjud = RedundantEdgeAdjudicator() nid = net.create_edge(edge_source=0, edge_target=1, edge_interaction='neighbor-of') cid = net.create_edge(edge_source=0, edge_target=1, edge_interaction='controls-state-change-of') self.assertEqual('neighbor-of', net.get_edge(nid)['i']) adjud._remove_if_redundant(net, nid, [cid]) self.assertEqual(None, net.get_edge(nid))
def test_remove_if_redundant_with_citation_and_other_lacks_citation(self): net = NiceCXNetwork() adjud = RedundantEdgeAdjudicator() nid = net.create_edge(edge_source=0, edge_target=1, edge_interaction='neighbor-of') net.set_edge_attribute(nid, RedundantEdgeAdjudicator.CITATION, ['pubmed:123'], type='list_of_string') cid = net.create_edge(edge_source=0, edge_target=1, edge_interaction='controls-state-change-of') self.assertEqual('neighbor-of', net.get_edge(nid)['i']) adjud._remove_if_redundant(net, nid, [cid]) self.assertEqual('neighbor-of', net.get_edge(nid)['i'])
def test_remove_if_redundant_mergecitations_true(self): net = NiceCXNetwork() adjud = RedundantEdgeAdjudicator() nid = net.create_edge(edge_source=0, edge_target=1, edge_interaction='neighbor-of') net.set_edge_attribute(nid, RedundantEdgeAdjudicator.CITATION, ['pubmed:4', 'pubmed:123'], type='list_of_string') cid = net.create_edge(edge_source=0, edge_target=1, edge_interaction='controls-state-change-of') self.assertEqual('neighbor-of', net.get_edge(nid)['i']) adjud._remove_if_redundant(net, nid, [cid], mergecitations=True) self.assertEqual(None, net.get_edge(nid)) res = net.get_edge_attribute(cid, RedundantEdgeAdjudicator.CITATION) res['v'].sort() self.assertEqual(['pubmed:123', 'pubmed:4'], res['v'])