Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions scripts/network_compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def log(msg):
parser.add_argument('--dst-spf', help="Dest SimplePathwayFile")
parser.add_argument('--src-xgmml', help="Source XGMML File")
parser.add_argument('--dst-xgmml', help="Dest XGMML File")
parser.add_argument('--common',help="Print common nodes")

args = parser.parse_args()

Expand Down Expand Up @@ -47,6 +48,14 @@ def log(msg):
log("Node Counts %d %d" % (len(gr1.nodes()), len(gr2.nodes())))
log("Edge Counts %d %d" % (len(gr1.edges()), len(gr2.edges())))


if args.common:
common_count = 0
for n in gr1.node:
if n in gr2.node:
common_count+=1
log("Common " +n)
log( "Nodes in both networks: %d %4.1f %% of first network and %4.1f %% of second " % (common_count, (float)(100*common_count/len(gr1.nodes())), (float)(100*common_count/len(gr2.nodes() ))))
for n in gr1.node:
if n not in gr2.node:
log( "Graph2 Missing Node:" + n )
Expand Down