Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
from __future__ import print_function
import sys
from collections import defaultdict
def parse(fn):
loci = set()
with open(fn) as F:
for L in F:
L = L.strip()
if L.startswith('#'):
continue
fields = L.split()
chrom, pos = fields[0:2]
if not chrom.startswith('chr'):
chrom = 'chr%s' % chrom
loci.add((chrom, pos))
return loci
def main():
l1, l2 = parse(sys.argv[1]), parse(sys.argv[2])
print('Counts', len(l1), len(l2))
print('Common', len(l1 & l2))
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.