title: Getting errors when converting a text file to VCF format
body: <p>I have a python code where I am trying to convert a text file containing variant information in the rows to a variant call format file (vcf) for my downstream analysis. </p>
  
  <p>I am getting everything correct but when I am trying to run the code I miss out the first two entries , I mean the first two rows. The code is below, The line which is not reading the entire file is highlighted. I would like some expert advice. </p>
  
  <p>I just started coding in python so I am not well versed entirely with it.</p>
  
  <pre><code>##fileformat=VCFv4.0
  ##fileDate=20140901
  ##source=dbSNP
  ##dbSNP_BUILD_ID=137
  ##reference=hg19
  #CHROM  POS     ID      REF     ALT     QUAL    FILTER  INFO
  
  import sys
  
  text=open(sys.argv[1]).readlines()
  print text
  print "First print"
  text=filter(lambda x:x.split('\t')[31].strip()=='KEEP',text[2:])
  print text
  print "################################################"
  text=map(lambda x:x.split('\t')[0]+'\t'+x.split('\t')[1]+'\t.\t'+x.split('\t')[2]+'\t'+x.split('\t')[3]+'\t.\tPASS\t.\n',text)
  print text
  file=open(sys.argv[1].replace('.txt','.vcf'),'w')
  
  file.write('##fileformat=VCFv4.0\n')
  file.write('##source=dbSNP')
  file.write('##dbSNP_BUILD_ID=137')
  file.write('##reference=hg19\n')
  file.write('#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\n')
  
  for i in text:
          file.write(i)
          file.close()
  </code></pre>
  
  <p><strong>INPUT:</strong></p>
  
  <pre><code>chrM    152 T   C   T_S7998 N_S8980 0   DBSNP   COVERED 1   1   1   282 36  0   163.60287   0.214008    0.02    11.666081   202 55  7221    1953    0   0   TT  14.748595   49  0   1786    0   KEEP
  chr9    311 T   C   T_S7998 N_S8980 0   NOVEL   COVERED 0.993882    0.999919    0.993962    299 0   0   207.697923  1   0.02    1.854431    0   56  0   1810    1   116 CC  -44.649001  0   12  0   390 KEEP
  chr13   440 C   T   T_S7998 N_S8980 0   NOVEL   COVERED 1   1   1   503 7   0   4.130339    0.006696    0.02    4.124606    445 3   16048   135 0   0   CC  12.942762   40  0   1684    0   KEEP
  </code></pre>
  
  <p><strong>OUTPUT desired:</strong></p>
  
  <pre><code>##fileformat=VCFv4.0
  ##source=dbSNP##dbSNP_BUILD_ID=137##reference=hg19
  #CHROM  POS ID  REF ALT QUAL    FILTER  INFO
  chrM    152 .   T   C   .   PASS    .
  chr9    311 .   T   C   .   PASS    .
  chr13   440 .   C   T   .   PASS    .
  </code></pre>
  
  <p><strong>OUTPUT obtained:</strong></p>
  
  <pre><code>##fileformat=VCFv4.0
  ##source=dbSNP##dbSNP_BUILD_ID=137##reference=hg19
  #CHROM  POS ID  REF ALT QUAL    FILTER  INFO
  chr13   440 .   C   T   .   PASS    .
  </code></pre>
  
  <p>I would like to have some help regarding how this error can be rectified.</p>