Created
September 6, 2015 11:08
-
-
Save armanbilge/12ef3cfeb7ed5a3ffe05 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import itertools as it | |
from collections import Counter | |
fn = sys.argv[1] | |
with open(fn) as f: | |
N = sum(1 for _ in f) | |
counts = {} | |
for i in range(N): | |
with open(fn) as f: | |
for _ in range(i): | |
next(f) | |
_, A, T, G, C, x = next(f).strip().split(',') | |
for j in range(i+1, N): | |
_, _, _, _, _, y = next(f).strip().split(',') | |
counter = Counter(zip(x,y)) | |
counter[('A', 'A')] += int(A) | |
counter[('T', 'T')] += int(T) | |
counter[('G', 'G')] += int(G) | |
counter[('C', 'C')] += int(C) | |
counts[(i,j)] = counter | |
print("Finished processing", i, j) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment