Created
November 15, 2016 21:37
-
-
Save jwintersinger/62a83af658fa9e516840cb90947b52fb to your computer and use it in GitHub Desktop.
This file contains 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
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