summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHui Lan <lanhui@zjnu.edu.cn>2020-02-14 17:27:31 +0800
committerHui Lan <lanhui@zjnu.edu.cn>2020-02-14 17:28:24 +0800
commita172ac560fd3c8b11f0ab1370bd015203c134de9 (patch)
treef198b8802798bae1b60d392957a67a14a5233b5b
parent86a521351b4834cb9e00e0979e84cb3ffedfda55 (diff)
merge_edges.py: write edge file names to network.log
When merging many big edge files, the computer may run out of memory. Save the edge files that have been considered thus far and figure out where merging stopped.
-rw-r--r--Code/merge_edges.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Code/merge_edges.py b/Code/merge_edges.py
index d07447a..a2da07f 100644
--- a/Code/merge_edges.py
+++ b/Code/merge_edges.py
@@ -151,14 +151,16 @@ def make_new_edge(lst_tuple):
best_edge[9] = ','.join(sorted(list(set(method_or_tissue)))) # unique methods or tissues, in string format
return best_edge
-
+
##main
+
d = {} # d will contain all edges computed so far, where the key is TargetGeneID_TFGeneID, and the value is a list of tuples. Each tuple is a historical edge.
file_count = 0
for fname in sorted(glob.glob(os.path.join(EDGE_POOL_DIR, 'edges*.*'))):
file_count += 1
print('[merge_edges.py]: including %s.' % (fname))
+ write_log_file('[merge_edges.py] including file %s.' % (fname) , UPDATE_NETWORK_LOG_FILE)
f = open(fname)
for line in f: