Skip to content

Instantly share code, notes, and snippets.

@jwintersinger
Created November 15, 2016 21:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jwintersinger/62a83af658fa9e516840cb90947b52fb to your computer and use it in GitHub Desktop.
Save jwintersinger/62a83af658fa9e516840cb90947b52fb to your computer and use it in GitHub Desktop.
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