Skip to content

Instantly share code, notes, and snippets.

@bkamapantula
Created December 1, 2011 03:28
Show Gist options
  • Save bkamapantula/1413276 to your computer and use it in GitHub Desktop.
Save bkamapantula/1413276 to your computer and use it in GitHub Desktop.
Delete line with three columns by ID
from numpy import*
import networkx as nx
line_count = 0
G = nx.Graph()
f = open("deleted_motif_edges.txt", "w")
for row in file('100ecoliadjusted.txt'):
row.split()
s = int(row[0])
d = int(row[1])
G.add_edge(s, d)
for line in file('100_Motif_Line_Count.txt'):
line = line.split()
g1 = int(line[0])
g2 = int(line[1])
g3 = int(line[2])
line_count = int(line[3])
if line_count < max_motif_count:
G.remove_edge(g1, g2)
G.remove_edge(g1, g3)
G.remove_edge(g2, g3)
if G.is_connected():
f.write(str(g1))
f.write(' ')
f.write(str(g2))
f.write(str('\n')
f.write(str(g1))
f.write(' ')
f.write(str(g3))
f.write(str('\n')
f.write(str(g2))
f.write(' ')
f.write(str(g3))
f.write(str('\n')
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment