##################################
#                                #
# Last modified 05/19/2014       # 
#                                #
# Georgi Marinov                 #
#                                # 
##################################

import sys
import string
from sets import Set
import os

def run():

    if len(sys.argv) < 3:
        print 'usage: python %s vcf field1 field1' % sys.argv[0]
        print '\tthe script can read from stdin with - instead of an input vcf'
        print '\tthe script will print to stdout by default'
        sys.exit(1)

    vcf = sys.argv[1]
    fieldID1 = int(sys.argv[2])
    fieldID2 = int(sys.argv[3])

    if vcf == '-':
        linelist = sys.stdin
    else:
        linelist = open(vcf)
    for line in linelist:
        if line.startswith('#'):
            print line.strip()
            continue
        fields = line.strip().split('\t')
        GTfield = fields[8].split(':').index('GT')
        GT1 = fields[fieldID1].split(':')[GTfield]
        GT2 = fields[fieldID2].split(':')[GTfield]
        if GT1 == GT2:
            print line.strip()

run()