[med-svn] [bcftools] 01/04: Imported Upstream version 1.2

Afif Elghraoui afif-guest at moszumanska.debian.org
Wed Nov 4 08:34:23 UTC 2015


This is an automated email from the git hooks/post-receive script.

afif-guest pushed a commit to branch master
in repository bcftools.

commit 9a27f719b68ab89af950442178d83737a1eff47b
Author: Afif Elghraoui <afif at ghraoui.name>
Date:   Tue Nov 3 17:53:33 2015 -0800

    Imported Upstream version 1.2
---
 AUTHORS                                        |   14 +
 HMM.c                                          |  376 +++
 HMM.h                                          |  110 +
 INSTALL                                        |   51 +
 LICENSE                                        |  725 +++++
 Makefile                                       |  193 ++
 README                                         |    5 +
 bcftools.h                                     |   63 +
 call.h                                         |  138 +
 ccall.c                                        |  344 ++
 consensus.c                                    |  651 ++++
 convert.c                                      |  976 ++++++
 convert.h                                      |   38 +
 doc/bcftools.1                                 | 3242 +++++++++++++++++++
 doc/bcftools.html                              | 1634 ++++++++++
 doc/bcftools.txt                               | 1773 ++++++++++
 doc/docbook-xsl.css                            |  355 ++
 em.c                                           |  259 ++
 filter.c                                       | 1677 ++++++++++
 filter.h                                       |   51 +
 gvcf.c                                         |   89 +
 khash_str2str.h                                |   89 +
 kmin.c                                         |  209 ++
 kmin.h                                         |   46 +
 main.c                                         |  264 ++
 mcall.c                                        | 1491 +++++++++
 ploidy.c                                       |  223 ++
 ploidy.h                                       |  133 +
 plot-vcfstats                                  | 2128 ++++++++++++
 plugins/counts.c                               |   82 +
 plugins/dosage.c                               |  283 ++
 plugins/fill-AN-AC.c                           |   67 +
 plugins/fixploidy.c                            |  226 ++
 plugins/fixploidy.mk                           |    2 +
 plugins/frameshifts.c                          |  157 +
 plugins/missing2ref.c                          |  144 +
 plugins/tag2tag.c                              |  128 +
 plugins/vcf2sex.c                              |  311 ++
 plugins/vcf2sex.mk                             |    2 +
 polysomy.c                                     |  672 ++++
 prob1.c                                        |  529 +++
 prob1.h                                        |   93 +
 rbuf.h                                         |  196 ++
 reheader.c                                     |  505 +++
 tabix.c                                        |  129 +
 test/23andme.fa                                |   14 +
 test/23andme.fa.fai                            |    3 +
 test/annotate.hdr                              |    4 +
 test/annotate.out                              |   43 +
 test/annotate.tab                              |   18 +
 test/annotate.vcf                              |   39 +
 test/annotate2.out                             |   43 +
 test/annotate2.tab                             |    2 +
 test/annotate2.vcf                             |   17 +
 test/annotate3.out                             |   40 +
 test/annotate3.vcf                             |   21 +
 test/annotate4.hdr                             |    2 +
 test/annotate4.out                             |   19 +
 test/annotate4.vcf                             |   13 +
 test/annotate5.out                             |   19 +
 test/annotate6.out                             |   14 +
 test/annotate7.out                             |   17 +
 test/annotate8.out                             |   14 +
 test/annots.vcf                                |   37 +
 test/annots2.vcf                               |   17 +
 test/annots4.tab                               |    3 +
 test/annots4.vcf                               |   13 +
 test/check.chk                                 |   80 +
 test/check.gs.chrom.gen                        |   10 +
 test/check.gs.chrom.samples                    |    4 +
 test/check.gs.vcfids.gen                       |   10 +
 test/check.gs.vcfids.samples                   |    4 +
 test/check.gs.vcfids_chrom.gen                 |   10 +
 test/check.gs.vcfids_chrom.samples             |    4 +
 test/check.vcf                                 |   37 +
 test/concat.1.a.vcf                            |   32 +
 test/concat.1.b.vcf                            |   19 +
 test/concat.1.bcf.out                          |   38 +
 test/concat.1.vcf.out                          |   38 +
 test/concat.2.a.vcf                            |   15 +
 test/concat.2.b.vcf                            |   24 +
 test/concat.2.bcf.out                          |   32 +
 test/concat.2.vcf.out                          |   32 +
 test/concat.3.0.vcf                            |    8 +
 test/concat.3.a.vcf                            |   27 +
 test/concat.3.b.vcf                            |  223 ++
 test/concat.3.bcf.out                          |  269 ++
 test/concat.3.c.vcf                            |   22 +
 test/concat.3.d.vcf                            |   20 +
 test/concat.3.e.vcf                            |   20 +
 test/concat.3.f.vcf                            |   20 +
 test/concat.3.vcf.out                          |  269 ++
 test/concat.4.bcf.out                          |   29 +
 test/concat.4.vcf.out                          |   29 +
 test/consensus.1.chain                         |   12 +
 test/consensus.1.out                           |   20 +
 test/consensus.2.chain                         |    8 +
 test/consensus.2.out                           |   20 +
 test/consensus.3.chain                         |   12 +
 test/consensus.3.out                           |   20 +
 test/consensus.4.chain                         |    8 +
 test/consensus.4.out                           |   20 +
 test/consensus.fa                              |   20 +
 test/consensus.tab                             |    3 +
 test/consensus.vcf                             |   18 +
 test/convert.23andme                           |   28 +
 test/convert.23andme.vcf                       |   34 +
 test/convert.gs.gt.gen                         |   32 +
 test/convert.gs.gt.samples                     |   12 +
 test/convert.gs.pl.gen                         |   32 +
 test/convert.gs.pl.samples                     |   12 +
 test/convert.gvcf.out                          |  414 +++
 test/convert.gvcf.vcf                          |  107 +
 test/convert.hls.haps                          |   32 +
 test/convert.hls.legend                        |   33 +
 test/convert.hls.samples                       |   11 +
 test/convert.hs.hap                            |   32 +
 test/convert.hs.sample                         |   12 +
 test/convert.vcf                               |   40 +
 test/dosage.out                                |   15 +
 test/empty.idx.out                             |    0
 test/empty.idx_count.out                       |    1 +
 test/empty.vcf                                 |    6 +
 test/ex1.gtf.gz                                |  Bin 0 -> 3778 bytes
 test/ex2.vcf                                   |   23 +
 test/ex3.sam                                   |   14 +
 test/fill-AN-AC.out                            |   38 +
 test/filter.1.out                              |   30 +
 test/filter.1.vcf                              |   33 +
 test/filter.2.out                              |   38 +
 test/filter.2.vcf                              |   36 +
 test/filter.3.out                              |    1 +
 test/filter.3.vcf                              |   42 +
 test/filter.4.out                              |    2 +
 test/filter.5.out                              |    2 +
 test/filter.6.out                              |    2 +
 test/filter.7.out                              |    2 +
 test/filter.8.out                              |    1 +
 test/fixploidy.out                             |   18 +
 test/fixploidy.ploidy                          |    9 +
 test/fixploidy.samples                         |    3 +
 test/fixploidy.vcf                             |   17 +
 test/idx.out                                   |    4 +
 test/idx.vcf                                   |   22 +
 test/idx_count.out                             |    1 +
 test/isec.a.vcf                                |   27 +
 test/isec.ab.C.out                             |    3 +
 test/isec.ab.any.out                           |    7 +
 test/isec.ab.both.out                          |    8 +
 test/isec.ab.flt.out                           |    2 +
 test/isec.ab.out                               |    3 +
 test/isec.b.vcf                                |   27 +
 test/isec.tab                                  |    5 +
 test/isec.tab.out                              |   28 +
 test/large_chrom.20.1.2147483647.out           |    9 +
 test/large_chrom_csi_limit.20.1.2147483647.out |    9 +
 test/large_chrom_csi_limit.vcf                 |   18 +
 test/large_chrom_tbi_limit.20.1.536870912.out  |    3 +
 test/large_chrom_tbi_limit.vcf                 |   20 +
 test/merge.2.a.vcf                             |   30 +
 test/merge.2.all.out                           |   31 +
 test/merge.2.b.vcf                             |   30 +
 test/merge.2.both.out                          |   32 +
 test/merge.2.none.out                          |   36 +
 test/merge.3.a.vcf                             |   26 +
 test/merge.3.b.vcf                             |   26 +
 test/merge.3.out                               |   27 +
 test/merge.4.a.vcf                             |   33 +
 test/merge.4.b.vcf                             |   33 +
 test/merge.4.out                               |   34 +
 test/merge.a.chk                               |   58 +
 test/merge.a.vcf                               |   36 +
 test/merge.abc.out                             |   59 +
 test/merge.b.vcf                               |   42 +
 test/merge.c.vcf                               |   43 +
 test/missing2ref.out                           |   36 +
 test/mpileup.1.out                             |   40 +
 test/mpileup.2.out                             |   53 +
 test/mpileup.cAls.out                          |   33 +
 test/mpileup.tab                               |    4 +
 test/mpileup.vcf                               | 4127 ++++++++++++++++++++++++
 test/norm.fa                                   |   24 +
 test/norm.fa.fai                               |    6 +
 test/norm.merge.out                            |   52 +
 test/norm.merge.strict.out                     |   52 +
 test/norm.merge.vcf                            |   61 +
 test/norm.out                                  |   57 +
 test/norm.split.out                            |   59 +
 test/norm.split.vcf                            |   51 +
 test/norm.vcf                                  |   57 +
 test/plugin-missing2ref.out.vcf                |   30 +
 test/plugin-missing2ref.vcf                    |   29 +
 test/plugin1.vcf                               |   36 +
 test/query.10.out                              |    1 +
 test/query.11.out                              |    2 +
 test/query.12.out                              |    5 +
 test/query.13.out                              |    3 +
 test/query.14.out                              |    3 +
 test/query.15.out                              |    1 +
 test/query.16.out                              |    1 +
 test/query.17.out                              |    1 +
 test/query.2.out                               |    1 +
 test/query.2.vcf                               |   11 +
 test/query.3.out                               |    1 +
 test/query.4.out                               |    1 +
 test/query.5.out                               |    2 +
 test/query.6.out                               |    4 +
 test/query.7.out                               |    1 +
 test/query.8.out                               |    3 +
 test/query.9.out                               |    1 +
 test/query.filter.vcf                          |   20 +
 test/query.out                                 |   13 +
 test/query.vcf                                 |   33 +
 test/regions.out                               |   10 +
 test/regions.tab                               |    8 +
 test/regions.vcf                               |   29 +
 test/reheader.1.out                            |   38 +
 test/reheader.1.out.bcf                        |   38 +
 test/reheader.2.out                            |   55 +
 test/reheader.hdr                              |   19 +
 test/reheader.samples                          |    2 +
 test/reheader.samples2                         |    2 +
 test/reheader.vcf                              |   54 +
 test/stats.a.vcf                               |    8 +
 test/stats.b.vcf                               |    8 +
 test/stats.chk                                 |   87 +
 test/tabix.1.3000151.out                       |    1 +
 test/tabix.2.3199812.out                       |    1 +
 test/test-rbuf.c                               |   73 +
 test/test.pl                                   |  769 +++++
 test/vcf2sex.out                               |    2 +
 test/vcf2sex.vcf                               |   24 +
 test/view.1.out                                |   39 +
 test/view.10.out                               |   36 +
 test/view.2.out                                |   35 +
 test/view.3.out                                |   34 +
 test/view.4.out                                |   34 +
 test/view.5.out                                |   36 +
 test/view.6.out                                |   43 +
 test/view.7.out                                |   32 +
 test/view.8.out                                |    1 +
 test/view.9.out                                |   36 +
 test/view.chrs.out                             |   81 +
 test/view.chrs.tab                             |   74 +
 test/view.chrs.vcf                             |   90 +
 test/view.exclude.out                          |   47 +
 test/view.filter.1.out                         |    1 +
 test/view.filter.10.out                        |   43 +
 test/view.filter.11.out                        |   43 +
 test/view.filter.2.out                         |    1 +
 test/view.filter.3.out                         |    1 +
 test/view.filter.4.out                         |    1 +
 test/view.filter.5.out                         |    1 +
 test/view.filter.6.out                         |   43 +
 test/view.filter.7.out                         |   43 +
 test/view.filter.8.out                         |   43 +
 test/view.filter.9.out                         |   43 +
 test/view.filter.vcf                           |   42 +
 test/view.minmaxac.1.out                       |    1 +
 test/view.minmaxac.2.out                       |    1 +
 test/view.minmaxac.vcf                         |   13 +
 test/view.omitgenotypes.out                    |   17 +
 test/view.omitgenotypes.vcf                    |   16 +
 test/view.vcf                                  |   46 +
 test/view.vectors.A.out                        |   56 +
 test/view.vectors.B.out                        |   56 +
 test/view.vectors.vcf                          |   55 +
 tsv2vcf.c                                      |  121 +
 tsv2vcf.h                                      |   85 +
 vcfannotate.c                                  | 1704 ++++++++++
 vcfcall.c                                      |  710 ++++
 vcfcnv.c                                       |  942 ++++++
 vcfconcat.c                                    |  608 ++++
 vcfconvert.c                                   | 1369 ++++++++
 vcffilter.c                                    |  563 ++++
 vcfgtcheck.c                                   |  790 +++++
 vcfindex.c                                     |  246 ++
 vcfisec.c                                      |  579 ++++
 vcfmerge.c                                     | 2063 ++++++++++++
 vcfnorm.c                                      | 1965 +++++++++++
 vcfplugin.c                                    |  562 ++++
 vcfquery.c                                     |  364 +++
 vcfroh.c                                       |  775 +++++
 vcfsom.c                                       |  715 ++++
 vcfstats.c                                     | 1474 +++++++++
 vcfutils.pl                                    |  588 ++++
 vcfview.c                                      |  737 +++++
 vcmp.c                                         |  130 +
 vcmp.h                                         |   62 +
 version.c                                      |   47 +
 290 files changed, 49233 insertions(+)

diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 0000000..412efef
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,14 @@
+BCFtools package is currently maintained by
+Petr Danecek, Shane McCarthy and John Marshall.
+
+Alphabetical list of people who have made contributions:
+
+    Nicholas Clarke
+    Petr Danecek <petr.danecek at sanger.ac.uk>
+    Warren Kretzschmar <winni at well.ox.ac.uk>
+    Heng Li
+    Shane McCarthy <sm15 at sanger.ac.uk>
+    John Marshall <jm18 at sanger.ac.uk>
+    Joel Martin
+    Stephan Schiffels
+
diff --git a/HMM.c b/HMM.c
new file mode 100644
index 0000000..2d2a402
--- /dev/null
+++ b/HMM.c
@@ -0,0 +1,376 @@
+/* The MIT License
+
+   Copyright (c) 2014 Genome Research Ltd.
+
+   Author: Petr Danecek <pd3 at sanger.ac.uk>
+
+   Permission is hereby granted, free of charge, to any person obtaining a copy
+   of this software and associated documentation files (the "Software"), to deal
+   in the Software without restriction, including without limitation the rights
+   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+   copies of the Software, and to permit persons to whom the Software is
+   furnished to do so, subject to the following conditions:
+
+   The above copyright notice and this permission notice shall be included in
+   all copies or substantial portions of the Software.
+
+   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+   THE SOFTWARE.
+
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+#include <htslib/hts.h>
+#include "HMM.h"
+
+static inline void multiply_matrix(int n, double *a, double *b, double *dst, double *tmp)
+{
+    double *out = dst;
+    if ( a==dst || b==dst )
+        out = tmp;
+
+    int i,j,k;
+    for (i=0; i<n; i++)
+    {
+        for (j=0; j<n; j++)
+        {
+            double val = 0;
+            for (k=0; k<n; k++) val += MAT(a,n,i,k)*MAT(b,n,k,j);
+            MAT(out,n,i,j) = val;
+        }
+    }
+    if ( out!=dst )
+        memcpy(dst,out,sizeof(double)*n*n);
+}
+
+hmm_t *hmm_init(int nstates, double *tprob, int ntprob)
+{
+    hmm_t *hmm = (hmm_t*) calloc(1,sizeof(hmm_t));
+    hmm->nstates = nstates;
+    hmm->curr_tprob = (double*) malloc(sizeof(double)*nstates*nstates);
+    hmm->tmp = (double*) malloc(sizeof(double)*nstates*nstates);
+
+    hmm_set_tprob(hmm, tprob, ntprob);
+
+    return hmm;
+}
+
+void hmm_set_tprob(hmm_t *hmm, double *tprob, int ntprob)
+{
+    hmm->ntprob_arr = ntprob;
+    if ( ntprob<=0 ) ntprob = 1;
+
+    if ( !hmm->tprob_arr )
+        hmm->tprob_arr  = (double*) malloc(sizeof(double)*hmm->nstates*hmm->nstates*ntprob);
+
+    memcpy(hmm->tprob_arr,tprob,sizeof(double)*hmm->nstates*hmm->nstates);
+
+    int i;
+    for (i=1; i<ntprob; i++)
+        multiply_matrix(hmm->nstates, hmm->tprob_arr, hmm->tprob_arr+(i-1)*hmm->nstates*hmm->nstates, hmm->tprob_arr+i*hmm->nstates*hmm->nstates, hmm->tmp);
+}
+
+void hmm_set_tprob_func(hmm_t *hmm, set_tprob_f set_tprob, void *data)
+{
+    hmm->set_tprob = set_tprob;
+    hmm->set_tprob_data = data;
+}
+
+static void _set_tprob(hmm_t *hmm, int pos_diff)
+{
+    assert( pos_diff>=0 );
+
+    int i, n;
+
+    n = hmm->ntprob_arr ? pos_diff % hmm->ntprob_arr : 0;  // n-th precalculated matrix
+    memcpy(hmm->curr_tprob, hmm->tprob_arr+n*hmm->nstates*hmm->nstates, sizeof(*hmm->curr_tprob)*hmm->nstates*hmm->nstates);
+
+    if ( hmm->ntprob_arr > 0  )
+    {
+        n = pos_diff / hmm->ntprob_arr;  // number of full blocks to jump
+        for (i=0; i<n; i++)
+            multiply_matrix(hmm->nstates, hmm->tprob_arr+(hmm->ntprob_arr-1)*hmm->nstates*hmm->nstates, hmm->curr_tprob, hmm->curr_tprob, hmm->tmp);
+    }
+}
+
+void hmm_run_viterbi(hmm_t *hmm, int n, double *eprobs, uint32_t *sites)
+{
+    // Init arrays when run for the first time
+    if ( hmm->nvpath < n )
+    {
+        hmm->nvpath = n;
+        hmm->vpath  = (uint8_t*) realloc(hmm->vpath, sizeof(uint8_t)*hmm->nvpath*hmm->nstates);
+    }
+    if ( !hmm->vprob )
+    {
+        hmm->vprob     = (double*) malloc(sizeof(double)*hmm->nstates);
+        hmm->vprob_tmp = (double*) malloc(sizeof(double)*hmm->nstates);
+    }
+
+
+    // Init all states with equal likelihood
+    int i,j, nstates = hmm->nstates;
+    for (i=0; i<nstates; i++) hmm->vprob[i] = 1./nstates;
+
+    // Run Viterbi
+    uint32_t prev_pos = sites[0];
+    for (i=0; i<n; i++)
+    {
+        uint8_t *vpath = &hmm->vpath[i*nstates];
+        double *eprob  = &eprobs[i*nstates];
+
+        int pos_diff = sites[i] == prev_pos ? 0 : sites[i] - prev_pos - 1;
+
+        _set_tprob(hmm, pos_diff);
+        if ( hmm->set_tprob ) hmm->set_tprob(hmm, prev_pos, sites[i], hmm->set_tprob_data);
+        prev_pos = sites[i];
+
+        double vnorm = 0;
+        for (j=0; j<nstates; j++)
+        {
+            double vmax = 0;
+            int k, k_vmax = 0;
+            for (k=0; k<nstates; k++)
+            {
+                double pval = hmm->vprob[k] * MAT(hmm->curr_tprob,hmm->nstates,j,k);
+                if ( vmax < pval ) { vmax = pval; k_vmax = k; }
+            }
+            vpath[j] = k_vmax;
+            hmm->vprob_tmp[j] = vmax * eprob[j];
+            vnorm += hmm->vprob_tmp[j];
+        }
+        for (j=0; j<nstates; j++) hmm->vprob_tmp[j] /= vnorm;
+        double *tmp = hmm->vprob; hmm->vprob = hmm->vprob_tmp; hmm->vprob_tmp = tmp;
+    }
+
+    // Find the most likely state
+    int iptr = 0;
+    for (i=1; i<nstates; i++) 
+        if ( hmm->vprob[iptr] < hmm->vprob[i] ) iptr = i;
+
+    // Trace back the Viterbi path, we are reusing vpath for storing the states (vpath[i*nstates])
+    for (i=n-1; i>=0; i--)
+    {
+        assert( iptr<nstates && hmm->vpath[i*nstates + iptr]<nstates );
+        iptr = hmm->vpath[i*nstates + iptr];
+        hmm->vpath[i*nstates] = iptr;     // reusing the array for different purpose here
+    }
+}
+
+void hmm_run_fwd_bwd(hmm_t *hmm, int n, double *eprobs, uint32_t *sites)
+{
+    // Init arrays when run for the first time
+    if ( hmm->nfwd < n )
+    {
+        hmm->nfwd = n;
+        hmm->fwd  = (double*) realloc(hmm->fwd, sizeof(double)*(hmm->nfwd+1)*hmm->nstates);
+    }
+    if ( !hmm->bwd )
+    {
+        hmm->bwd     = (double*) malloc(sizeof(double)*hmm->nstates);
+        hmm->bwd_tmp = (double*) malloc(sizeof(double)*hmm->nstates);
+    }
+
+
+    // Init all states with equal likelihood
+    int i,j,k, nstates = hmm->nstates;
+    for (i=0; i<nstates; i++) hmm->fwd[i] = 1./hmm->nstates;
+    for (i=0; i<nstates; i++) hmm->bwd[i] = 1./hmm->nstates;
+
+    // Run fwd 
+    uint32_t prev_pos = sites[0];
+    for (i=0; i<n; i++)
+    {
+        double *fwd_prev = &hmm->fwd[i*nstates];
+        double *fwd      = &hmm->fwd[(i+1)*nstates];
+        double *eprob    = &eprobs[i*nstates];
+
+        int pos_diff = sites[i] == prev_pos ? 0 : sites[i] - prev_pos - 1;
+
+        _set_tprob(hmm, pos_diff);
+        if ( hmm->set_tprob ) hmm->set_tprob(hmm, prev_pos, sites[i], hmm->set_tprob_data);
+        prev_pos = sites[i];
+
+        double norm = 0;
+        for (j=0; j<nstates; j++)
+        {
+            double pval = 0;
+            for (k=0; k<nstates; k++)
+                pval += fwd_prev[k] * MAT(hmm->curr_tprob,hmm->nstates,j,k);
+            fwd[j] = pval * eprob[j];
+            norm += fwd[j];
+        }
+        for (j=0; j<nstates; j++) fwd[j] /= norm;
+    }
+
+    // Run bwd
+    double *bwd = hmm->bwd, *bwd_tmp = hmm->bwd_tmp;
+    prev_pos = sites[n-1];
+    for (i=0; i<n; i++)
+    {
+        double *fwd   = &hmm->fwd[(n-i)*nstates];
+        double *eprob = &eprobs[(n-i-1)*nstates];
+        
+        int pos_diff = sites[n-i-1] == prev_pos ? 0 : prev_pos - sites[n-i-1] - 1;
+
+        _set_tprob(hmm, pos_diff);
+        if ( hmm->set_tprob ) hmm->set_tprob(hmm, sites[n-i-1], prev_pos, hmm->set_tprob_data);
+        prev_pos = sites[n-i-1];
+
+        double bwd_norm = 0;
+        for (j=0; j<nstates; j++)
+        {
+            double pval = 0;
+            for (k=0; k<nstates; k++)
+                pval += bwd[k] * eprob[k] * MAT(hmm->curr_tprob,hmm->nstates,k,j);
+            bwd_tmp[j] = pval;
+            bwd_norm += pval;
+        }
+        double norm = 0;
+        for (j=0; j<nstates; j++)
+        {
+            bwd_tmp[j] /= bwd_norm;
+            fwd[j] *= bwd_tmp[j];   // fwd now stores fwd*bwd
+            norm += fwd[j];
+        }
+        for (j=0; j<nstates; j++) fwd[j] /= norm;
+        double *tmp = bwd_tmp; bwd_tmp = bwd; bwd = tmp;
+    }
+}
+
+void hmm_run_baum_welch(hmm_t *hmm, int n, double *eprobs, uint32_t *sites)
+{
+    // Init arrays when run for the first time
+    if ( hmm->nfwd < n )
+    {
+        hmm->nfwd = n;
+        hmm->fwd  = (double*) realloc(hmm->fwd, sizeof(double)*(hmm->nfwd+1)*hmm->nstates);
+    }
+    if ( !hmm->bwd )
+    {
+        hmm->bwd     = (double*) malloc(sizeof(double)*hmm->nstates);
+        hmm->bwd_tmp = (double*) malloc(sizeof(double)*hmm->nstates);
+    }
+
+    // Init all states with equal likelihood
+    int i,j,k, nstates = hmm->nstates;
+    for (i=0; i<nstates; i++) hmm->fwd[i] = 1./hmm->nstates;
+    for (i=0; i<nstates; i++) hmm->bwd[i] = 1./hmm->nstates;
+
+    // New transition matrix: temporary values
+    double *tmp_xi = (double*) calloc(nstates*nstates,sizeof(double));
+    double *tmp_gamma = (double*) calloc(nstates,sizeof(double));
+    double *fwd_bwd = (double*) malloc(sizeof(double)*nstates);
+
+    // Run fwd 
+    uint32_t prev_pos = sites[0];
+    for (i=0; i<n; i++)
+    {
+        double *fwd_prev = &hmm->fwd[i*nstates];
+        double *fwd      = &hmm->fwd[(i+1)*nstates];
+        double *eprob    = &eprobs[i*nstates];
+
+        int pos_diff = sites[i] == prev_pos ? 0 : sites[i] - prev_pos - 1;
+
+        _set_tprob(hmm, pos_diff);
+        if ( hmm->set_tprob ) hmm->set_tprob(hmm, prev_pos, sites[i], hmm->set_tprob_data);
+        prev_pos = sites[i];
+
+        double norm = 0;
+        for (j=0; j<nstates; j++)
+        {
+            double pval = 0;
+            for (k=0; k<nstates; k++)
+                pval += fwd_prev[k] * MAT(hmm->curr_tprob,hmm->nstates,j,k);
+            fwd[j] = pval * eprob[j];
+            norm += fwd[j];
+        }
+        for (j=0; j<nstates; j++) fwd[j] /= norm;
+    }
+
+    // Run bwd
+    double *bwd = hmm->bwd, *bwd_tmp = hmm->bwd_tmp;
+    prev_pos = sites[n-1];
+    for (i=0; i<n; i++)
+    {
+        double *fwd   = &hmm->fwd[(n-i)*nstates];
+        double *eprob = &eprobs[(n-i-1)*nstates];
+        
+        int pos_diff = sites[n-i-1] == prev_pos ? 0 : prev_pos - sites[n-i-1] - 1;
+
+        _set_tprob(hmm, pos_diff);
+        if ( hmm->set_tprob ) hmm->set_tprob(hmm, sites[n-i-1], prev_pos, hmm->set_tprob_data);
+        prev_pos = sites[n-i-1];
+
+        double bwd_norm = 0;
+        for (j=0; j<nstates; j++)
+        {
+            double pval = 0;
+            for (k=0; k<nstates; k++)
+                pval += bwd[k] * eprob[k] * MAT(hmm->curr_tprob,hmm->nstates,k,j);
+            bwd_tmp[j] = pval;
+            bwd_norm += pval;
+        }
+        double norm = 0;
+        for (j=0; j<nstates; j++)
+        {
+            bwd_tmp[j] /= bwd_norm;
+            fwd_bwd[j] = fwd[j]*bwd_tmp[j];
+            norm += fwd_bwd[j];
+        }
+        for (j=0; j<nstates; j++) 
+        {
+            fwd_bwd[j] /= norm;
+            tmp_gamma[j] += fwd_bwd[j];
+        }
+
+        for (j=0; j<nstates; j++)
+        {
+            for (k=0; k<nstates; k++)
+            {
+                MAT(tmp_xi,nstates,k,j) += fwd[j]*bwd[k]*MAT(hmm->tprob_arr,hmm->nstates,k,j)*eprob[k] / norm;
+            }
+        }
+
+        for (j=0; j<nstates; j++) fwd[j] = fwd_bwd[j];    // fwd now stores fwd*bwd
+
+        double *tmp = bwd_tmp; bwd_tmp = bwd; bwd = tmp;
+    }
+    for (j=0; j<nstates; j++)
+    {
+        double norm = 0;
+        for (k=0; k<nstates; k++)
+        {
+            MAT(hmm->curr_tprob,nstates,k,j) = MAT(tmp_xi,nstates,k,j) / tmp_gamma[j];
+            norm += MAT(hmm->curr_tprob,nstates,k,j);
+        }
+        for (k=0; k<nstates; k++)
+            MAT(hmm->curr_tprob,nstates,k,j) /= norm;
+    }
+    free(tmp_gamma);
+    free(tmp_xi);
+    free(fwd_bwd);
+}
+
+void hmm_destroy(hmm_t *hmm)
+{
+    free(hmm->vprob);
+    free(hmm->vprob_tmp);
+    free(hmm->vpath);
+    free(hmm->curr_tprob);
+    free(hmm->tmp);
+    free(hmm->tprob_arr);
+    free(hmm->fwd);
+    free(hmm->bwd);
+    free(hmm->bwd_tmp);
+    free(hmm);
+}
+
diff --git a/HMM.h b/HMM.h
new file mode 100644
index 0000000..2fb1412
--- /dev/null
+++ b/HMM.h
@@ -0,0 +1,110 @@
+/* The MIT License
+
+   Copyright (c) 2014 Genome Research Ltd.
+
+   Author: Petr Danecek <pd3 at sanger.ac.uk>
+
+   Permission is hereby granted, free of charge, to any person obtaining a copy
+   of this software and associated documentation files (the "Software"), to deal
+   in the Software without restriction, including without limitation the rights
+   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+   copies of the Software, and to permit persons to whom the Software is
+   furnished to do so, subject to the following conditions:
+
+   The above copyright notice and this permission notice shall be included in
+   all copies or substantial portions of the Software.
+
+   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+   THE SOFTWARE.
+
+ */
+
+#ifndef __HMM_H__
+#define __HMM_H__
+
+#define MAT(matrix,ndim,i,j) (matrix)[(ndim)*(i)+(j)]       // P(i|j), that is, transition j->i
+
+typedef struct _hmm_t hmm_t;
+
+typedef void (*set_tprob_f) (hmm_t *hmm, uint32_t prev_pos, uint32_t pos, void *data);
+
+struct _hmm_t
+{
+    int nstates;    // number of states
+
+    double *vprob, *vprob_tmp;  // viterbi probs [nstates]
+    uint8_t *vpath;             // viterbi path [nstates*nvpath]
+    double *bwd, *bwd_tmp;      // bwd probs [nstates]
+    double *fwd;                // fwd probs [nstates*(nfwd+1)]
+    int nvpath, nfwd;
+
+    int ntprob_arr;             // number of pre-calculated tprob matrices
+    double *curr_tprob, *tmp;   // Temporary arrays; curr_tprob is short lived, valid only for
+                                //  one site (that is, one step of Viterbi algorithm)
+    double *tprob_arr;          // Array of transition matrices, precalculated to ntprob_arr
+                                //  positions. The first matrix is the initial tprob matrix
+                                //  set by hmm_init() or hmm_set_tprob()
+    set_tprob_f set_tprob;      // Optional user function to set / modify transition probabilities
+                                //  at each site (one step of Viterbi algorithm)
+    void *set_tprob_data;
+};
+
+/**
+ *   hmm_init() - initialize HMM
+ *   @nstates:  number of states
+ *   @tprob:    transition probabilities matrix (nstates x nstates), for elements ordering
+ *              see the MAT macro above.
+ *   @ntprob:   number of precalculated tprob matrices or 0 for constant probs, independent
+ *              of distance
+ */
+hmm_t *hmm_init(int nstates, double *tprob, int ntprob);
+void hmm_set_tprob(hmm_t *hmm, double *tprob, int ntprob);
+
+/**
+ *   hmm_set_tprob_func() - custom setter of transition probabilities
+ */
+void hmm_set_tprob_func(hmm_t *hmm, set_tprob_f set_tprob, void *data);
+
+/**
+ *   hmm_run_viterbi() - run Viterbi algorithm
+ *   @nsites:   number of sites 
+ *   @eprob:    emission probabilities for each site and state (nsites x nstates)
+ *   @sites:    list of positions
+ *
+ *   When done, hmm->vpath[] contains the calculated Viterbi path. The states
+ *   are indexed starting from 0, a state at i-th site can be accessed as
+ *   vpath[nstates*i].
+ */
+void hmm_run_viterbi(hmm_t *hmm, int nsites, double *eprob, uint32_t *sites);
+
+/**
+ *   hmm_run_fwd_bwd() - run the forward-backward algorithm
+ *   @nsites:   number of sites 
+ *   @eprob:    emission probabilities for each site and state (nsites x nstates)
+ *   @sites:    list of positions
+ *
+ *   When done, hmm->fwd[] contains the calculated fwd*bwd probabilities. The
+ *   probability of i-th state at j-th site can be accessed as fwd[j*nstates+i].
+ */
+void hmm_run_fwd_bwd(hmm_t *hmm, int nsites, double *eprob, uint32_t *sites);
+
+/**
+ *   hmm_run_baum_welch() - run one iteration of Baum-Welch algorithm
+ *   @nsites:   number of sites 
+ *   @eprob:    emission probabilities for each site and state (nsites x nstates)
+ *   @sites:    list of positions
+ *
+ *   Same as hmm_run_fwd_bwd, in addition curr_tprob contains the new
+ *   transition probabilities. In this verison, emission probabilities
+ *   are not updated.
+ */
+void hmm_run_baum_welch(hmm_t *hmm, int nsites, double *eprob, uint32_t *sites);
+void hmm_destroy(hmm_t *hmm);
+
+#endif
+
diff --git a/INSTALL b/INSTALL
new file mode 100644
index 0000000..2d68eb0
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,51 @@
+System Requirements
+===================
+
+BCFtools and HTSlib depend on the zlib library <http://zlib.net>.  Building
+them requires zlib development files to be installed on the build machine;
+you may need to ensure a package such as zlib1g-dev (on Debian or Ubuntu Linux)
+or zlib-devel (on RPM/yum-based distributions) is installed.
+
+
+Compilation
+===========
+
+'cd' to the bcftools-1.x directory containing the package's source and type
+'make' to compile BCFtools.
+
+This BCFtools release contains a copy of HTSlib which will be used to build
+BCFtools.  If you already have a system-installed HTSlib or another HTSlib
+that you would prefer to build against, you can arrange this by overriding
+$(HTSDIR) by typing 'make HTSDIR=/path/to/htslib-source' -- see the makefile
+for details.
+
+
+Optional Compilation with GSL
+=============================
+
+The 'polysomy' command depends on the GNU Scientific Library (GSL) and is not
+enabled by default. In order to compile it, type 'make clean && make USE_GPL=1'.
+
+Note that GSL is distributed under a GPL license, so when USE_GPL=1 is used to
+compile bcftools, the resulting program must only be distributed under terms
+compatible with that license. 
+
+In the default compilation mode the program is dual licensed and you may
+choose to be licensed under the terms of the MIT/Expat license or the
+GNU General Public License (GPL).
+
+
+Installation
+============
+
+Type 'make install' to install the bcftools executable and associated scripts
+and a manual page to /usr/local.
+
+Type 'make prefix=/path/to/dir install' to install everything under your
+choice of installation directory.  The install target also understands
+DESTDIR and the other usual installation directory variables.
+
+The bgzip and tabix utilities are provided by HTSlib.  If you have not also
+installed HTSlib separately, you may wish to install these utilities by hand
+by copying bcftools-1.x/htslib-1.x/{bgzip,tabix} to the same bin directory
+to which you have installed bcftools et al.
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..26fbc68
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,725 @@
+This software is available to you under a choice of one of two licenses. You
+may chose to be licensed under the terms of the MIT/Expat license or the GNU
+General Public License (GPL), both included below. If compiled with the GNU
+Scientific Library (which is optional and disabled by default as explained in
+the INSTALL document), the use of this software is governed by the GPL license.
+
+
+-----------------------------------------------------------------------------
+
+The MIT/Expat License
+
+Copyright (C) 2012-2014 Genome Research Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+
+
+[The use of a range of years within a copyright notice in this distribution
+should be interpreted as being equivalent to a list of years including the
+first and last year specified and all consecutive years between them.
+
+For example, a copyright notice that reads "Copyright (C) 2005, 2007-2009,
+2011-2012" should be interpreted as being identical to a notice that reads
+"Copyright (C) 2005, 2007, 2008, 2009, 2011, 2012" and a copyright notice
+that reads "Copyright (C) 2005-2012" should be interpreted as being identical
+to a notice that reads "Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010,
+2011, 2012".]
+
+
+-----------------------------------------------------------------------------
+
+
+GNU GENERAL PUBLIC LICENSE
+Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+  The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works.  By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.  We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors.  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+  To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights.  Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received.  You must make sure that they, too, receive
+or can get the source code.  And you must show them these terms so they
+know their rights.
+
+  Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+  For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software.  For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+  Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so.  This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software.  The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable.  Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products.  If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+  Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary.  To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                       TERMS AND CONDITIONS
+
+  0. Definitions.
+
+  "This License" refers to version 3 of the GNU General Public License.
+
+  "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+  "The Program" refers to any copyrightable work licensed under this
+License.  Each licensee is addressed as "you".  "Licensees" and
+"recipients" may be individuals or organizations.
+
+  To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy.  The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+  A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+  To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy.  Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+  To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies.  Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+  An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License.  If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+  1. Source Code.
+
+  The "source code" for a work means the preferred form of the work
+for making modifications to it.  "Object code" means any non-source
+form of a work.
+
+  A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+  The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form.  A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+  The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities.  However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work.  For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+  The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+  The Corresponding Source for a work in source code form is that
+same work.
+
+  2. Basic Permissions.
+
+  All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met.  This License explicitly affirms your unlimited
+permission to run the unmodified Program.  The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work.  This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+  You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force.  You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright.  Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+  Conveying under any other circumstances is permitted solely under
+the conditions stated below.  Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+  No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+  When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+  4. Conveying Verbatim Copies.
+
+  You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+  You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+  5. Conveying Modified Source Versions.
+
+  You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+    a) The work must carry prominent notices stating that you modified
+    it, and giving a relevant date.
+
+    b) The work must carry prominent notices stating that it is
+    released under this License and any conditions added under section
+    7.  This requirement modifies the requirement in section 4 to
+    "keep intact all notices".
+
+    c) You must license the entire work, as a whole, under this
+    License to anyone who comes into possession of a copy.  This
+    License will therefore apply, along with any applicable section 7
+    additional terms, to the whole of the work, and all its parts,
+    regardless of how they are packaged.  This License gives no
+    permission to license the work in any other way, but it does not
+    invalidate such permission if you have separately received it.
+
+    d) If the work has interactive user interfaces, each must display
+    Appropriate Legal Notices; however, if the Program has interactive
+    interfaces that do not display Appropriate Legal Notices, your
+    work need not make them do so.
+
+  A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit.  Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+  6. Conveying Non-Source Forms.
+
+  You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+    a) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by the
+    Corresponding Source fixed on a durable physical medium
+    customarily used for software interchange.
+
+    b) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by a
+    written offer, valid for at least three years and valid for as
+    long as you offer spare parts or customer support for that product
+    model, to give anyone who possesses the object code either (1) a
+    copy of the Corresponding Source for all the software in the
+    product that is covered by this License, on a durable physical
+    medium customarily used for software interchange, for a price no
+    more than your reasonable cost of physically performing this
+    conveying of source, or (2) access to copy the
+    Corresponding Source from a network server at no charge.
+
+    c) Convey individual copies of the object code with a copy of the
+    written offer to provide the Corresponding Source.  This
+    alternative is allowed only occasionally and noncommercially, and
+    only if you received the object code with such an offer, in accord
+    with subsection 6b.
+
+    d) Convey the object code by offering access from a designated
+    place (gratis or for a charge), and offer equivalent access to the
+    Corresponding Source in the same way through the same place at no
+    further charge.  You need not require recipients to copy the
+    Corresponding Source along with the object code.  If the place to
+    copy the object code is a network server, the Corresponding Source
+    may be on a different server (operated by you or a third party)
+    that supports equivalent copying facilities, provided you maintain
+    clear directions next to the object code saying where to find the
+    Corresponding Source.  Regardless of what server hosts the
+    Corresponding Source, you remain obligated to ensure that it is
+    available for as long as needed to satisfy these requirements.
+
+    e) Convey the object code using peer-to-peer transmission, provided
+    you inform other peers where the object code and Corresponding
+    Source of the work are being offered to the general public at no
+    charge under subsection 6d.
+
+  A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+  A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling.  In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage.  For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product.  A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+  "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source.  The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+  If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information.  But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+  The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed.  Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+  Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+  7. Additional Terms.
+
+  "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law.  If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+  When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it.  (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.)  You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+  Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+    a) Disclaiming warranty or limiting liability differently from the
+    terms of sections 15 and 16 of this License; or
+
+    b) Requiring preservation of specified reasonable legal notices or
+    author attributions in that material or in the Appropriate Legal
+    Notices displayed by works containing it; or
+
+    c) Prohibiting misrepresentation of the origin of that material, or
+    requiring that modified versions of such material be marked in
+    reasonable ways as different from the original version; or
+
+    d) Limiting the use for publicity purposes of names of licensors or
+    authors of the material; or
+
+    e) Declining to grant rights under trademark law for use of some
+    trade names, trademarks, or service marks; or
+
+    f) Requiring indemnification of licensors and authors of that
+    material by anyone who conveys the material (or modified versions of
+    it) with contractual assumptions of liability to the recipient, for
+    any liability that these contractual assumptions directly impose on
+    those licensors and authors.
+
+  All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10.  If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term.  If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+  If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+  Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+  8. Termination.
+
+  You may not propagate or modify a covered work except as expressly
+provided under this License.  Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+  However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+  Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+  Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License.  If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+  9. Acceptance Not Required for Having Copies.
+
+  You are not required to accept this License in order to receive or
+run a copy of the Program.  Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance.  However,
+nothing other than this License grants you permission to propagate or
+modify any covered work.  These actions infringe copyright if you do
+not accept this License.  Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+  10. Automatic Licensing of Downstream Recipients.
+
+  Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License.  You are not responsible
+for enforcing compliance by third parties with this License.
+
+  An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations.  If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+  You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License.  For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+  11. Patents.
+
+  A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based.  The
+work thus licensed is called the contributor's "contributor version".
+
+  A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version.  For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+  Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+  In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement).  To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+  If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients.  "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+  If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+  A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License.  You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+  Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+  12. No Surrender of Others' Freedom.
+
+  If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all.  For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+  13. Use with the GNU Affero General Public License.
+
+  Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work.  The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+  14. Revised Versions of this License.
+
+  The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+  Each version is given a distinguishing version number.  If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation.  If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+  If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+  Later license versions may give you additional or different
+permissions.  However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+  15. Disclaimer of Warranty.
+
+  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. Limitation of Liability.
+
+  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+  17. Interpretation of Sections 15 and 16.
+
+  If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+  If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+    <program>  Copyright (C) <year>  <name of author>
+    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+  You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+  The GNU General Public License does not permit incorporating your program
+into proprietary programs.  If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.  But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
+
+
+-----------------------------------------------------------------------------
+
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..6d525eb
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,193 @@
+# Makefile for bcftools, utilities for Variant Call Format VCF/BCF files.
+#
+#   Copyright (C) 2012-2014 Genome Research Ltd.
+#
+#   Author: Petr Danecek <pd3 at sanger.ac.uk>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+
+PROG=       bcftools
+TEST_PROG=  test/test-rbuf
+
+
+all: $(PROG) $(TEST_PROG)
+
+# Adjust $(HTSDIR) to point to your top-level htslib directory
+HTSDIR = ../htslib
+include $(HTSDIR)/htslib.mk
+HTSLIB = $(HTSDIR)/libhts.a
+BGZIP  = $(HTSDIR)/bgzip
+TABIX  = $(HTSDIR)/tabix
+
+CC       = gcc
+CFLAGS   = -g -Wall -Wc++-compat -O2
+DFLAGS   =
+OBJS     = main.o vcfindex.o tabix.o \
+           vcfstats.o vcfisec.o vcfmerge.o vcfquery.o vcffilter.o filter.o vcfsom.o \
+           vcfnorm.o vcfgtcheck.o vcfview.o vcfannotate.o vcfroh.o vcfconcat.o \
+           vcfcall.o mcall.o vcmp.o gvcf.o reheader.o convert.o vcfconvert.o tsv2vcf.o \
+           vcfcnv.o HMM.o vcfplugin.o consensus.o ploidy.o version.o \
+           ccall.o em.o prob1.o kmin.o # the original samtools calling
+INCLUDES = -I. -I$(HTSDIR)
+
+# The polysomy command is not compiled by default because it brings dependency
+# on libgsl. The command can be compiled wth `make USE_GPL=1`. See the INSTALL
+# and LICENSE documents to understand license implications.
+ifdef USE_GPL
+    CFLAGS += -DUSE_GPL
+    OBJS   += polysomy.o
+    LDLIBS  = -lgsl -lcblas
+endif
+
+prefix      = /usr/local
+exec_prefix = $(prefix)
+bindir      = $(exec_prefix)/bin
+mandir      = $(prefix)/share/man
+man1dir     = $(mandir)/man1
+
+MKDIR_P = mkdir -p
+INSTALL = install -p
+INSTALL_PROGRAM = $(INSTALL)
+INSTALL_DATA    = $(INSTALL) -m 644
+INSTALL_DIR     = $(MKDIR_P) -m 755
+
+
+all:$(PROG) plugins
+
+# See htslib/Makefile
+PACKAGE_VERSION = 1.2
+ifneq "$(wildcard .git)" ""
+PACKAGE_VERSION := $(shell git describe --always --dirty)
+DOC_VERSION :=  $(shell git describe --always)+
+DOC_DATE := $(shell date +'%Y-%m-%d %R %Z')
+version.h: $(if $(wildcard version.h),$(if $(findstring "$(PACKAGE_VERSION)",$(shell cat version.h)),,force))
+endif
+version.h:
+	echo '#define BCFTOOLS_VERSION "$(PACKAGE_VERSION)"' > $@
+
+
+.SUFFIXES:.c .o
+.PHONY:all clean clean-all clean-plugins distclean install lib tags test testclean force plugins docs
+
+force:
+
+.c.o:
+	$(CC) -c $(CFLAGS) $(DFLAGS) $(INCLUDES) $< -o $@
+
+test: $(PROG) plugins test/test-rbuf $(BGZIP) $(TABIX)
+	./test/test.pl --exec bgzip=$(BGZIP) --exec tabix=$(TABIX)
+
+test-plugins: $(PROG) plugins test/test-rbuf $(BGZIP) $(TABIX)
+	./test/test.pl --plugins --exec bgzip=$(BGZIP) --exec tabix=$(TABIX)
+
+
+# Plugin rules
+PLUGINC = $(foreach dir, plugins, $(wildcard $(dir)/*.c))
+PLUGINS = $(PLUGINC:.c=.so)
+PLUGINM = $(PLUGINC:.c=.mk)
+
+%.so: %.c version.h version.c $(HTSDIR)/libhts.so
+	$(CC) $(CFLAGS) $(INCLUDES) -fPIC -shared -o $@ version.c $< -L$(HTSDIR) -lhts
+
+-include $(PLUGINM)
+
+plugins: $(PLUGINS)
+
+
+bcftools_h = bcftools.h $(htslib_vcf_h)
+call_h = call.h $(htslib_vcf_h) $(htslib_synced_bcf_reader_h) vcmp.h
+convert_h = convert.h $(htslib_vcf_h)
+tsv2vcf_h = tsv2vcf.h $(htslib_vcf_h)
+filter_h = filter.h $(htslib_vcf_h)
+prob1_h = prob1.h $(htslib_vcf_h) $(call_h)
+roh_h = HMM.h $(htslib_vcf_h) $(htslib_synced_bcf_reader_h) $(HTSDIR)/htslib/kstring.h $(HTSDIR)/htslib/kseq.h $(bcftools_h)
+cnv_h = HMM.h $(htslib_vcf_h) $(htslib_synced_bcf_reader_h)
+
+main.o: main.c $(htslib_hts_h) version.h $(bcftools_h)
+vcfannotate.o: vcfannotate.c $(htslib_vcf_h) $(htslib_synced_bcf_reader_h) $(HTSDIR)/htslib/kseq.h $(bcftools_h) vcmp.h $(filter_h)
+vcfplugin.o: vcfplugin.c $(htslib_vcf_h) $(htslib_synced_bcf_reader_h) $(HTSDIR)/htslib/kseq.h $(bcftools_h) vcmp.h $(filter_h)
+vcfcall.o: vcfcall.c $(htslib_vcf_h) $(HTSDIR)/htslib/kfunc.h $(htslib_synced_bcf_reader_h) $(bcftools_h) $(call_h) $(prob1_h)
+vcfconcat.o: vcfconcat.c $(htslib_vcf_h) $(htslib_synced_bcf_reader_h) $(HTSDIR)/htslib/kseq.h $(bcftools_h)
+vcfconvert.o: vcfconvert.c $(htslib_vcf_h) $(htslib_bgzf_h) $(htslib_synced_bcf_reader_h) $(htslib_vcfutils_h) $(bcftools_h) $(filter_h) $(convert_h) $(tsv2vcf_h)
+vcffilter.o: vcffilter.c $(htslib_vcf_h) $(htslib_synced_bcf_reader_h) $(htslib_vcfutils_h) $(bcftools_h) $(filter_h) rbuf.h
+vcfgtcheck.o: vcfgtcheck.c $(htslib_vcf_h) $(htslib_synced_bcf_reader_h) $(htslib_vcfutils_h) $(bcftools_h)
+vcfindex.o: vcfindex.c $(htslib_vcf_h) $(htslib_tbx_h)
+vcfisec.o: vcfisec.c $(htslib_vcf_h) $(htslib_synced_bcf_reader_h) $(htslib_vcfutils_h) $(bcftools_h) $(filter_h)
+vcfmerge.o: vcfmerge.c $(htslib_vcf_h) $(htslib_synced_bcf_reader_h) $(htslib_vcfutils_h) $(bcftools_h) vcmp.h $(HTSDIR)/htslib/khash.h
+vcfnorm.o: vcfnorm.c $(htslib_vcf_h) $(htslib_synced_bcf_reader_h) $(htslib_faidx_h) $(bcftools_h) rbuf.h
+vcfquery.o: vcfquery.c $(htslib_vcf_h) $(htslib_synced_bcf_reader_h) $(htslib_vcfutils_h) $(bcftools_h) $(filter_h) $(convert_h)
+vcfroh.o: vcfroh.c $(roh_h)
+vcfcnv.o: vcfcnv.c $(cnv_h)
+vcfsom.o: vcfsom.c $(htslib_vcf_h) $(htslib_synced_bcf_reader_h) $(htslib_vcfutils_h) $(bcftools_h)
+vcfstats.o: vcfstats.c $(htslib_vcf_h) $(htslib_synced_bcf_reader_h) $(htslib_vcfutils_h) $(htslib_faidx_h) $(bcftools_h)
+vcfview.o: vcfview.c $(htslib_vcf_h) $(htslib_synced_bcf_reader_h) $(htslib_vcfutils_h) $(bcftools_h) $(filter_h)
+reheader.o: reheader.c $(htslib_vcf_h) $(htslib_bgzf_h) $(HTSDIR)/htslib/kseq.h $(bcftools_h)
+tabix.o: tabix.c $(htslib_bgzf_h) $(htslib_tbx_h)
+ccall.o: ccall.c $(HTSDIR)/htslib/kfunc.h $(call_h) kmin.h $(prob1_h)
+convert.o: convert.c $(htslib_vcf_h) $(htslib_synced_bcf_reader_h) $(htslib_vcfutils_h) $(bcftools_h) $(convert_h)
+tsv2vcf.o: tsv2vcf.c $(tsv2vcf_h)
+em.o: em.c $(htslib_vcf_h) kmin.h $(call_h)
+filter.o: filter.c $(HTSDIR)/htslib/khash_str2int.h $(filter_h) $(bcftools_h) $(htslib_hts_defs_h) $(htslib_vcfutils_h)
+gvcf.o: gvcf.c $(call_h)
+kmin.o: kmin.c kmin.h
+mcall.o: mcall.c $(HTSDIR)/htslib/kfunc.h $(call_h)
+prob1.o: prob1.c $(prob1_h)
+vcmp.o: vcmp.c $(htslib_hts_h) vcmp.h
+polysomy.o: polysomy.c $(htslib_hts_h)
+consensus.o: consensus.c $(htslib_hts_h) $(HTSDIR)/htslib/kseq.h rbuf.h $(bcftools_h) $(HTSDIR)/htslib/regidx.h
+version.o: version.h version.c
+
+test/test-rbuf.o: test/test-rbuf.c rbuf.h
+
+test/test-rbuf: test/test-rbuf.o
+	$(CC) $(CFLAGS) -o $@ -lm -ldl $<
+
+bcftools: $(HTSLIB) $(OBJS)
+	$(CC) $(CFLAGS) -o $@ $(OBJS) $(HTSLIB) -lpthread -lz -lm -ldl $(LDLIBS)
+
+doc/bcftools.1: doc/bcftools.txt
+	cd doc && a2x -adate="$(DOC_DATE)" -aversion=$(DOC_VERSION) --doctype manpage --format manpage bcftools.txt
+
+doc/bcftools.html: doc/bcftools.txt
+	cd doc && a2x -adate="$(DOC_DATE)" -aversion=$(DOC_VERSION) --doctype manpage --format xhtml bcftools.txt
+
+docs: doc/bcftools.1 doc/bcftools.html
+
+install: $(PROG) doc/bcftools.1
+	$(INSTALL_DIR) $(DESTDIR)$(bindir) $(DESTDIR)$(man1dir)
+	$(INSTALL_PROGRAM) $(PROG) plot-vcfstats vcfutils.pl $(DESTDIR)$(bindir)
+	$(INSTALL_DATA) doc/bcftools.1 $(DESTDIR)$(man1dir)
+
+clean: testclean clean-plugins
+	-rm -f gmon.out *.o *~ $(PROG) version.h plugins/*.so plugins/*.P
+	-rm -rf *.dSYM plugins/*.dSYM test/*.dSYM
+
+clean-plugins:
+	-rm -f plugins/*.so plugins/*.P plugins/*.dSYM
+
+testclean:
+	-rm -f test/*.o test/*~ $(TEST_PROG)
+
+distclean: clean
+	-rm -f TAGS
+
+clean-all: clean clean-htslib
+
+tags:
+	ctags -f TAGS *.[ch] plugins/*.[ch]
diff --git a/README b/README
new file mode 100644
index 0000000..5cb1bbd
--- /dev/null
+++ b/README
@@ -0,0 +1,5 @@
+BCFtools implements utilities for variant calling (in conjunction with
+SAMtools) and manipulating VCF and BCF files.  The program is intended
+to replace the Perl-based tools from vcftools.
+
+See INSTALL for building and installation instructions.
diff --git a/bcftools.h b/bcftools.h
new file mode 100644
index 0000000..7d3936a
--- /dev/null
+++ b/bcftools.h
@@ -0,0 +1,63 @@
+/*  bcftools.h -- utility function declarations.
+
+    Copyright (C) 2013 Genome Research Ltd.
+
+    Author: Petr Danecek <pd3 at sanger.ac.uk>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.  */
+
+#ifndef BCFTOOLS_H
+#define BCFTOOLS_H
+
+#include <stdarg.h>
+#include <htslib/vcf.h>
+
+#define FT_GZ 1
+#define FT_VCF 2
+#define FT_VCF_GZ (FT_GZ|FT_VCF)
+#define FT_BCF (1<<2)
+#define FT_BCF_GZ (FT_GZ|FT_BCF)
+#define FT_STDIN (1<<3)
+
+char *bcftools_version(void);
+void error(const char *format, ...);
+void bcf_hdr_append_version(bcf_hdr_t *hdr, int argc, char **argv, const char *cmd);
+const char *hts_bcf_wmode(int file_type);
+
+void *smalloc(size_t size);     // safe malloc
+
+static inline char gt2iupac(char a, char b)
+{
+    static const char iupac[4][4] = { {'A','M','R','W'},{'M','C','S','Y'},{'R','S','G','K'},{'W','Y','K','T'} };
+    if ( a>='a' ) a -= 'a' - 'A';
+    if ( b>='a' ) b -= 'a' - 'A';
+    if ( a=='A' ) a = 0;
+    else if ( a=='C' ) a = 1;
+    else if ( a=='G' ) a = 2;
+    else if ( a=='T' ) a = 3;
+    else return 'N';
+    if ( b=='A' ) b = 0;
+    else if ( b=='C' ) b = 1;
+    else if ( b=='G' ) b = 2;
+    else if ( b=='T' ) b = 3;
+    else return 'N';
+    return iupac[(int)a][(int)b];
+}
+
+#endif
diff --git a/call.h b/call.h
new file mode 100644
index 0000000..72f6fd8
--- /dev/null
+++ b/call.h
@@ -0,0 +1,138 @@
+/*  call.h -- variant calling declarations.
+
+    Copyright (C) 2013-2014 Genome Research Ltd.
+
+    Author: Petr Danecek <pd3 at sanger.ac.uk>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.  */
+
+#ifndef __CALL_H__
+#define __CALL_H__
+
+#include <htslib/vcf.h>
+#include <htslib/synced_bcf_reader.h>
+#include "vcmp.h"
+
+#define CALL_KEEPALT        1
+#define CALL_VARONLY        (1<<1)
+#define CALL_CONSTR_TRIO    (1<<2)
+#define CALL_CONSTR_ALLELES (1<<3)
+#define CALL_CHR_X          (1<<4)
+#define CALL_CHR_Y          (1<<5)
+#define CALL_FMT_GQ         (1<<6)
+#define CALL_FMT_GP         (1<<7)
+
+#define FATHER 0
+#define MOTHER 1
+#define CHILD  2
+typedef struct
+{
+    char *name;
+    int sample[3];  // father, mother, child
+    int type;       // see FTYPE_* definitions in mcall.c
+}
+family_t;
+
+typedef struct
+{
+    int min_dp, mdp;    // minimum per-sample depth of a gVCF block
+    int32_t rid, start, end, *gt, *dp;
+    char ref[2];        // reference base at start position
+    bcf1_t *line;
+}
+gvcf_t;
+
+typedef struct _ccall_t ccall_t;
+typedef struct
+{
+    // mcall only
+    float *qsum;            // QS(sum) values
+    int nqsum, npdg;
+    int *als_map, nals_map; // mapping from full set of alleles to trimmed set of alleles (old -> new)
+    int *pl_map, npl_map;   // same as above for PLs, but reverse (new -> old)
+    char **als;             // array to hold the trimmed set of alleles to appear on output
+    int nals;               // size of the als array
+    family_t *fams;         // list of families and samples for trio calling
+    int nfams, mfams;
+    int ntrio[5][5];        // possible trio genotype combinations and their counts; first idx:
+    uint16_t *trio[5][5];   //  family type, second index: allele count (2-4, first two are unused)
+    double *GLs;
+    float *GPs;             // FORMAT/GP: posterior probabilities
+    int32_t *GQs;           // FORMAT/GQ: genotype qualities
+    int32_t *itmp;          // temporary int array, used for new PLs with CALL_CONSTR_ALLELES
+    int n_itmp, nGPs;
+    vcmp_t *vcmp;
+    double trio_Pm_SNPs, trio_Pm_del, trio_Pm_ins;      // P(mendelian) for trio calling, see mcall_call_trio_genotypes()
+    int32_t *ugts, *cgts;   // unconstraind and constrained GTs
+    uint32_t output_tags;
+
+    // ccall only
+    double indel_frac, min_perm_p, min_lrt;
+    double prior_type, pref;
+    double ref_lk, lk_sum;
+    int ngrp1_samples, n_perm;
+    int nhets, ndiploid;
+    char *prior_file;
+    ccall_t *cdat;
+
+    // shared
+    bcf_srs_t *srs;         // BCF synced readers holding target alleles for CALL_CONSTR_ALLELES
+    bcf1_t *rec;
+    bcf_hdr_t *hdr;
+    uint32_t flag;          // One or more of the CALL_* flags defined above
+    uint8_t *ploidy, all_diploid;
+
+    double pl2p[256];       // PL to 10^(-PL/10) table
+    int32_t *PLs;           // VCF PL likelihoods (rw)
+    int nPLs, mPLs;
+    int32_t *gts, ac[4];    // GTs and AC (w)
+    double *pdg;            // PLs converted to P(D|G)
+    float *anno16; int n16; // see anno[16] in bam2bcf.h
+    double theta;           // prior
+}
+call_t;
+
+void error(const char *format, ...);
+
+/*
+ *  *call() - return negative value on error or the number of non-reference
+ *            alleles on success.
+ */
+int mcall(call_t *call, bcf1_t *rec);    // multiallic and rare-variant calling model
+int ccall(call_t *call, bcf1_t *rec);    // the default consensus calling model
+int qcall(call_t *call, bcf1_t *rec);    // QCall output
+
+void mcall_init(call_t *call);
+void ccall_init(call_t *call);
+void qcall_init(call_t *call);
+
+void mcall_destroy(call_t *call);
+void ccall_destroy(call_t *call);
+void qcall_destroy(call_t *call);
+
+void call_init_pl2p(call_t *call);
+uint32_t *call_trio_prep(int is_x, int is_son);
+
+/** gVCF */
+void gvcf_write(htsFile *fh, gvcf_t *gvcf, bcf_hdr_t *hdr, bcf1_t *rec, int is_ref);
+
+void init_allele_trimming_maps(call_t *call, int als, int nals);
+void mcall_trim_numberR(call_t *call, bcf1_t *rec, int nals, int nout_als, int out_als);
+
+#endif
diff --git a/ccall.c b/ccall.c
new file mode 100644
index 0000000..561b2e4
--- /dev/null
+++ b/ccall.c
@@ -0,0 +1,344 @@
+/*  ccall.c -- consensus variant calling.
+
+    Copyright (C) 2013-2014 Genome Research Ltd.
+    Portions copyright (C) 2010 Broad Institute.
+
+    Author: Petr Danecek <pd3 at sanger.ac.uk>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.  */
+
+#include <math.h>
+#include <htslib/kfunc.h>
+#include "call.h"
+#include "kmin.h"
+#include "prob1.h"
+
+// Most of the original -c calling was moved to bcftools as it was
+// and its data structures were wrapped into the ccal_t to make it
+// functional quickly. This is not the desired state.
+struct _ccall_t
+{
+    bcf_p1aux_t *p1;
+};
+
+void ccall_init(call_t *call)
+{
+    call->cdat = (ccall_t*) calloc(1,sizeof(ccall_t));
+    call_init_pl2p(call);
+    call->cdat->p1 = bcf_p1_init(bcf_hdr_nsamples(call->hdr), call->ploidy);
+    call->gts = (int*) calloc(bcf_hdr_nsamples(call->hdr)*2,sizeof(int));   // assuming at most diploid everywhere
+    call->nals_map = 5;
+    call->als_map  = (int*) malloc(sizeof(int)*call->nals_map);
+
+    bcf_hdr_append(call->hdr,"##FORMAT=<ID=GT,Number=1,Type=String,Description=\"Genotype\">");
+    if ( call->output_tags & CALL_FMT_GQ )
+    {
+        bcf_hdr_append(call->hdr,"##FORMAT=<ID=GQ,Number=1,Type=Integer,Description=\"Genotype Quality\">");
+        call->GQs = (int32_t*) malloc(sizeof(int32_t)*bcf_hdr_nsamples(call->hdr));
+    }
+    if ( call->output_tags & CALL_FMT_GP )
+        error("Sorry, -f GP is not supported with -c\n");
+    bcf_hdr_append(call->hdr,"##INFO=<ID=AF1,Number=1,Type=Float,Description=\"Max-likelihood estimate of the first ALT allele frequency (assuming HWE)\">");
+    // Todo: groups not migrated to 'bcftools call' yet
+    bcf_hdr_append(call->hdr,"##INFO=<ID=AF2,Number=1,Type=Float,Description=\"Max-likelihood estimate of the first and second group ALT allele frequency (assuming HWE)\">");
+    bcf_hdr_append(call->hdr,"##INFO=<ID=AC1,Number=1,Type=Float,Description=\"Max-likelihood estimate of the first ALT allele count (no HWE assumption)\">");
+    bcf_hdr_append(call->hdr,"##INFO=<ID=MQ,Number=1,Type=Integer,Description=\"Root-mean-square mapping quality of covering reads\">\n");
+    bcf_hdr_append(call->hdr,"##INFO=<ID=FQ,Number=1,Type=Float,Description=\"Phred probability of all samples being the same\">\n");
+    bcf_hdr_append(call->hdr,"##INFO=<ID=PV4,Number=4,Type=Float,Description=\"P-values for strand bias, baseQ bias, mapQ bias and tail distance bias\">\n");
+    bcf_hdr_append(call->hdr,"##INFO=<ID=G3,Number=3,Type=Float,Description=\"ML estimate of genotype frequencies\">\n");
+    bcf_hdr_append(call->hdr,"##INFO=<ID=HWE,Number=1,Type=Float,Description=\"Chi^2 based HWE test P-value based on G3\">\n");
+    // bcf_hdr_append(call->hdr,);
+    // bcf_hdr_append(call->hdr,);
+    bcf_hdr_append(call->hdr,"##INFO=<ID=DP4,Number=4,Type=Integer,Description=\"Number of high-quality ref-forward , ref-reverse, alt-forward and alt-reverse bases\">");
+
+    return;
+}
+void ccall_destroy(call_t *call)
+{
+    free(call->itmp);
+    free(call->als_map);
+    free(call->gts);
+    free(call->anno16);
+    free(call->PLs);
+    free(call->GQs);
+    free(call->pdg);
+    bcf_p1_destroy(call->cdat->p1);
+    free(call->cdat);
+    return;
+}
+
+// Inits P(D|G): convert PLs from log space, only two alleles (three PLs) are used.
+// NB: The original samtools calling code uses pdgs in reverse order (AA comes
+// first, RR last), while the -m calling model uses the canonical order.
+static void set_pdg3(double *pl2p, int *PLs, double *pdg, int n_smpl, int n_gt)
+{
+    int i;
+    for (i=0; i<n_smpl; i++)
+    {
+        pdg[2] = pl2p[ PLs[0] ];
+        pdg[1] = pl2p[ PLs[1] ];
+        pdg[0] = pl2p[ PLs[2] ];
+        PLs += n_gt;
+        pdg += 3;
+    }
+}
+
+static double ttest(int n1, int n2, float a[4])
+{
+    extern double kf_betai(double a, double b, double x);
+    double t, v, u1, u2;
+    if (n1 == 0 || n2 == 0 || n1 + n2 < 3) return 1.0;
+    u1 = (double)a[0] / n1; u2 = (double)a[2] / n2;
+    if (u1 <= u2) return 1.;
+    t = (u1 - u2) / sqrt(((a[1] - n1 * u1 * u1) + (a[3] - n2 * u2 * u2)) / (n1 + n2 - 2) * (1./n1 + 1./n2));
+    v = n1 + n2 - 2;
+    return t < 0.? 1. : .5 * kf_betai(.5*v, .5, v/(v+t*t));
+}
+
+static int test16_core(float anno[16], anno16_t *a)
+{
+    extern double kt_fisher_exact(int n11, int n12, int n21, int n22, double *_left, double *_right, double *two);
+    double left, right;
+    int i;
+    a->p[0] = a->p[1] = a->p[2] = a->p[3] = 1.;
+    for (i=0; i<4; i++) a->d[i] = anno[i];
+    a->depth = anno[0] + anno[1] + anno[2] + anno[3];
+    a->is_tested = (anno[0] + anno[1] > 0 && anno[2] + anno[3] > 0);
+    if (a->depth == 0) return -1;
+    a->mq = (int)(sqrt((anno[9] + anno[11]) / a->depth) + .499);
+    kt_fisher_exact(anno[0], anno[1], anno[2], anno[3], &left, &right, &a->p[0]);
+    for (i = 1; i < 4; ++i)
+        a->p[i] = ttest(anno[0] + anno[1], anno[2] + anno[3], anno+4*i);
+    return 0;
+}
+
+int test16(float *anno16, anno16_t *a)
+{
+    a->p[0] = a->p[1] = a->p[2] = a->p[3] = 1.;
+    a->d[0] = a->d[1] = a->d[2] = a->d[3] = 0.;
+    a->mq = a->depth = a->is_tested = 0;
+    return test16_core(anno16, a);
+}
+static int update_bcf1(call_t *call, bcf1_t *rec, const bcf_p1rst_t *pr, double em[10])
+{
+    int has_I16, is_var;
+    float fq, r;
+    anno16_t a;
+    float tmpf[4], tmpi;
+
+    bcf_get_info_float(call->hdr, rec, "I16", &call->anno16, &call->n16);
+
+    has_I16 = test16(call->anno16, &a) >= 0? 1 : 0;
+
+    // print EM
+    if (em[0] >= 0)
+    {
+        tmpf[0] = 1 - em[0];
+        bcf_update_info_float(call->hdr, rec, "AF1", tmpf, 1);
+    }
+    if (em[4] >= 0 && em[4] <= 0.05)
+    {
+        tmpf[0] = em[3]; tmpf[1] = em[2]; tmpf[2] = em[1]; tmpf[3] = em[4];
+        bcf_update_info_float(call->hdr, rec, "G3", tmpf, 3);
+        bcf_update_info_float(call->hdr, rec, "HWE", &tmpf[3], 1);
+    }
+    if (em[5] >= 0 && em[6] >= 0)
+    {
+        tmpf[0] = 1 - em[5]; tmpf[1] = 1 - em[6];
+        bcf_update_info_float(call->hdr, rec, "AF2", tmpf, 2);
+    }
+    if (em[7] >= 0)
+    {
+        tmpf[0] = em[7];
+        bcf_update_info_float(call->hdr, rec, "LRT", tmpf, 1);
+    }
+    if (em[8] >= 0)
+    {
+        tmpf[0] = em[8];
+        bcf_update_info_float(call->hdr, rec, "LRT2", tmpf, 1);
+    }
+
+    bcf_p1aux_t *p1 = call->cdat->p1;
+    if (p1->cons_llr > 0)
+    {
+        tmpi = p1->cons_llr;
+        bcf_update_info_int32(call->hdr, rec, "CLR", &tmpi, 1);
+        // todo: trio calling with -c
+        if (p1->cons_gt > 0)
+        {
+            char tmp[4];
+            tmp[0] = p1->cons_gt&0xff; tmp[1] = p1->cons_gt>>8&0xff; tmp[2] = p1->cons_gt>>16&0xff; tmp[3] = 0;
+            bcf_update_info_string(call->hdr, rec, "UGT", tmp);
+            tmp[0] = p1->cons_gt>>32&0xff; tmp[1] = p1->cons_gt>>40&0xff; tmp[2] = p1->cons_gt>>48&0xff;
+            bcf_update_info_string(call->hdr, rec, "CGT", tmp);
+        }
+    }
+    if (pr == 0) return 1;
+
+    is_var = (pr->p_ref < call->pref);
+    r = is_var? pr->p_ref : pr->p_var;
+
+    bcf_update_info_int32(call->hdr, rec, "AC1", &pr->ac, 1);
+    int32_t dp[4]; dp[0] = call->anno16[0]; dp[1] = call->anno16[1]; dp[2] = call->anno16[2]; dp[3] = call->anno16[3];
+    bcf_update_info_int32(call->hdr, rec, "DP4", dp, 4);
+    bcf_update_info_int32(call->hdr, rec, "MQ", &a.mq, 1);
+
+    fq = pr->p_ref_folded < 0.5? -4.343 * log(pr->p_ref_folded) : 4.343 * log(pr->p_var_folded);
+    if (fq < -999) fq = -999;
+    if (fq > 999) fq = 999;
+    bcf_update_info_float(call->hdr, rec, "FQ", &fq, 1);
+
+    assert( pr->cmp[0]<0 );
+    // todo
+    //  if (pr->cmp[0] >= 0.) { // two sample groups
+    //      int i, q[3];
+    //      for (i = 1; i < 3; ++i) {
+    //          double x = pr->cmp[i] + pr->cmp[0]/2.;
+    //          q[i] = x == 0? 255 : (int)(-4.343 * log(x) + .499);
+    //          if (q[i] > 255) q[i] = 255;
+    //      }
+    //      if (pr->perm_rank >= 0) ksprintf(&s, "PR=%d;", pr->perm_rank);
+    //
+    //      ksprintf(&s, "PCHI2=%.3g;PC2=%d,%d;", q[1], q[2], pr->p_chi2);
+    //  }
+
+    if (has_I16 && a.is_tested)
+    {
+        int i;
+        for (i=0; i<4; i++) tmpf[i] = a.p[i];
+        bcf_update_info_float(call->hdr, rec, "PV4", tmpf, 4);
+    }
+    bcf_update_info_int32(call->hdr, rec, "I16", NULL, 0);     // remove I16 tag
+    bcf_update_info_int32(call->hdr, rec, "QS", NULL, 0);      // remove QS tag
+
+    rec->qual = r < 1e-100? 999 : -4.343 * log(r);
+    if (rec->qual > 999) rec->qual = 999;
+
+    // Remove unused alleles
+    int nals_ori = rec->n_allele, nals = !is_var && !(call->flag & CALL_KEEPALT) ? 1 : pr->rank0 < 2? 2 : pr->rank0+1;
+    if ( call->flag & CALL_KEEPALT && nals>1 )
+    {
+        if ( rec->d.allele[nals-1][0]=='X' ) nals--;   // old version of unseen allele "X"
+        else if ( rec->d.allele[nals-1][0]=='<' && rec->d.allele[nals-1][1]=='X' && rec->d.allele[nals-1][2]=='>' ) nals--;   // old version of unseen allele, "<X>"
+        else if ( rec->d.allele[nals-1][0]=='<' && rec->d.allele[nals-1][1]=='*' && rec->d.allele[nals-1][2]=='>' ) nals--;   // new version of unseen allele, "<*>"
+    }
+    
+    if ( nals<rec->n_allele )
+    {
+        bcf_update_alleles(call->hdr, rec, (const char**)rec->d.allele, nals);
+
+        // Update PLs
+        int npls_src = call->nPLs / rec->n_sample, npls_dst = nals*(nals+1)/2;
+        int *pls_src = call->PLs - npls_src, *pls_dst = call->PLs - npls_dst;
+        int isample, i;
+        for (isample = 0; isample < rec->n_sample; isample++)
+        {
+            pls_src += npls_src;
+            pls_dst += npls_dst;
+            if ( !call->ploidy || call->ploidy[isample]==2 )
+            {
+                for (i=0; i<npls_dst; i++)
+                    pls_dst[i] =  pls_src[i];
+            }
+            else
+            {
+                for (i=0; i<nals; i++)
+                {
+                    int isrc = (i+1)*(i+2)/2-1;
+                    pls_dst[i] = pls_src[isrc];
+                }
+                if (i<npls_dst) pls_dst[i] = bcf_int32_vector_end;
+            }
+        }
+        bcf_update_format_int32(call->hdr, rec, "PL", call->PLs, npls_dst*rec->n_sample);
+    }
+
+    // Call genotypes
+    int i;
+    for (i=0; i<rec->n_sample; i++)
+    {
+        int x = ( is_var || call->output_tags & CALL_FMT_GQ ) ? bcf_p1_call_gt(p1, pr->f_exp, i) : 2;
+        int gt = x&3;
+        if ( !call->ploidy || call->ploidy[i]==2 )
+        {
+            if ( gt==1 )
+            {
+                call->gts[2*i]   = bcf_gt_unphased(0);
+                call->gts[2*i+1] = bcf_gt_unphased(1);
+            }
+            else if ( gt==0 )
+            {
+                call->gts[2*i]   = bcf_gt_unphased(1);
+                call->gts[2*i+1] = bcf_gt_unphased(1);
+            }
+            else
+            {
+                call->gts[2*i]   = bcf_gt_unphased(0);
+                call->gts[2*i+1] = bcf_gt_unphased(0);
+            }
+            if ( call->output_tags & CALL_FMT_GQ ) call->GQs[i] = x>>2;
+        }
+        else
+        {
+            if ( gt==0 ) call->gts[2*i] = bcf_gt_unphased(1);
+            else call->gts[2*i] = bcf_gt_unphased(0);
+            call->gts[2*i+1] = bcf_int32_vector_end;
+            if ( call->output_tags & CALL_FMT_GQ ) call->GQs[i] = bcf_int32_missing;
+        }
+    }
+    bcf_update_genotypes(call->hdr, rec, call->gts, rec->n_sample*2);
+    if ( call->output_tags & CALL_FMT_GQ )
+        bcf_update_format_int32(call->hdr, rec, "GQ", call->GQs, rec->n_sample);
+
+    // trim Number=R tags
+    int out_als = 0;
+    for (i=0; i<nals; i++) out_als |= 1<<i;
+    init_allele_trimming_maps(call, out_als, nals_ori);
+    mcall_trim_numberR(call, rec, nals_ori, nals, out_als);
+
+    return is_var;
+}
+
+
+int ccall(call_t *call, bcf1_t *rec)
+{
+    int nsmpl = bcf_hdr_nsamples(call->hdr);
+
+    // Get the genotype likelihoods
+    int nals = rec->n_allele;
+    call->nPLs = bcf_get_format_int32(call->hdr, rec, "PL", &call->PLs, &call->mPLs);
+    if ( call->nPLs!=nsmpl*nals*(nals+1)/2 && call->nPLs!=nsmpl*nals )  // diploid+haploid or haploid only
+        error("Wrong number of PL fields? nals=%d npl=%d\n", nals,call->nPLs);
+
+    // Convert PLs to probabilities, only first two alleles are considered
+    int ngts = nals*(nals+1)/2;
+    hts_expand(double, 3*nsmpl, call->npdg, call->pdg);
+    set_pdg3(call->pl2p, call->PLs, call->pdg, nsmpl, ngts);
+
+    double em[10] = {-1.,-1.,-1.,-1.,-1.,-1.,-1.,-1.,-1.,-1.};
+    int ret = bcf_em1(call, rec, call->ngrp1_samples, 0x1ff, em);
+
+    bcf_p1rst_t pr;
+    int do_contrast = (em[7] >= 0 && em[7] < call->min_lrt) ? 1 : 0;
+    ret = bcf_p1_cal(call, rec, do_contrast, call->cdat->p1, &pr);
+    if (pr.p_ref >= call->pref && (call->flag & CALL_VARONLY)) return 0;
+    if (ret >= 0) ret = update_bcf1(call, rec, &pr, em);
+    return ret;
+}
+
diff --git a/consensus.c b/consensus.c
new file mode 100644
index 0000000..08f3d7d
--- /dev/null
+++ b/consensus.c
@@ -0,0 +1,651 @@
+/* The MIT License
+
+   Copyright (c) 2014 Genome Research Ltd.
+
+   Author: Petr Danecek <pd3 at sanger.ac.uk>
+   
+   Permission is hereby granted, free of charge, to any person obtaining a copy
+   of this software and associated documentation files (the "Software"), to deal
+   in the Software without restriction, including without limitation the rights
+   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+   copies of the Software, and to permit persons to whom the Software is
+   furnished to do so, subject to the following conditions:
+   
+   The above copyright notice and this permission notice shall be included in
+   all copies or substantial portions of the Software.
+   
+   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+   THE SOFTWARE.
+
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <getopt.h>
+#include <unistd.h>
+#include <ctype.h>
+#include <htslib/vcf.h>
+#include <htslib/kstring.h>
+#include <htslib/synced_bcf_reader.h>
+#include <htslib/kseq.h>
+#include <htslib/regidx.h>
+#include "bcftools.h"
+#include "rbuf.h"
+
+typedef struct
+{
+    int num;                // number of ungapped blocks in this chain
+    int *block_lengths;     // length of the ungapped blocks in this chain
+    int *ref_gaps;          // length of the gaps on the reference sequence between blocks
+    int *alt_gaps;          // length of the gaps on the alternative sequence between blocks
+    int ori_pos;
+    int ref_last_block_ori; // start position on the reference sequence of the following ungapped block (0-based)
+    int alt_last_block_ori; // start position on the alternative sequence of the following ungapped block (0-based)
+}
+chain_t;
+
+
+typedef struct
+{
+    kstring_t fa_buf;   // buffered reference sequence
+    int fa_ori_pos;     // start position of the fa_buffer (wrt original sequence)
+    int fa_frz_pos;     // protected position to avoid conflicting variants (last pos for SNPs/ins)
+    int fa_mod_off;     // position difference of fa_frz_pos in the ori and modified sequence (ins positive)
+    int fa_end_pos;     // region's end position in the original sequence
+    int fa_length;      // region's length in the original sequence (in case end_pos not provided in the FASTA header)
+    int fa_case;        // output upper case or lower case?
+    int fa_src_pos;     // last genomic coordinate read from the input fasta (0-based)
+
+    rbuf_t vcf_rbuf;
+    bcf1_t **vcf_buf;
+    int nvcf_buf, rid;
+
+    regidx_t *mask;
+
+    int chain_id;       // chain_id, to provide a unique ID to each chain in the chain output
+    chain_t *chain;     // chain structure to store the sequence of ungapped blocks between the ref and alt sequences
+                        // Note that the chain is re-initialised for each chromosome/seq_region
+
+    bcf_srs_t *files;
+    bcf_hdr_t *hdr;
+    FILE *fp_out;
+    FILE *fp_chain;
+    char **argv;
+    int argc, output_iupac, haplotype, isample;
+    char *fname, *ref_fname, *sample, *output_fname, *mask_fname, *chain_fname;
+}
+args_t;
+
+static chain_t* init_chain(chain_t *chain, int ref_ori_pos)
+{
+//     fprintf(stderr, "init_chain(*chain, ref_ori_pos=%d)\n", ref_ori_pos);
+    chain = (chain_t*) calloc(1,sizeof(chain_t));
+    chain->num = 0;
+    chain->block_lengths = NULL;
+    chain->ref_gaps = NULL;
+    chain->alt_gaps = NULL;
+    chain->ori_pos = ref_ori_pos;
+    chain->ref_last_block_ori = ref_ori_pos;
+    chain->alt_last_block_ori = ref_ori_pos;
+    return chain;
+}
+
+static void destroy_chain(args_t *args)
+{
+    chain_t *chain = args->chain;
+    free(chain->ref_gaps);
+    free(chain->alt_gaps);
+    free(chain->block_lengths);
+    free(chain);
+    chain = NULL;
+}
+
+static void print_chain(args_t *args)
+{
+    /*
+        Example chain format (see: https://genome.ucsc.edu/goldenPath/help/chain.html):
+        chain 1 500 + 480 500 1 501 + 480 501 1
+        12 3 1
+        1 0 3
+        484
+
+        chain line is:
+        - chain
+        - score (sum of the length of ungapped block in this case)
+        - ref_seqname (from the fasta header, parsed by htslib)
+        - ref_seqlength (from the fasta header)
+        - ref_strand (+ or -; always + for bcf-consensus)
+        - ref_start (as defined in the fasta header)
+        - ref_end (as defined in the fasta header)
+        - alt_seqname (same as ref_seqname as bcf-consensus only considers SNPs and indels)
+        - alt_seqlength (adjusted to match the length of the alt sequence)
+        - alt_strand (+ or -; always + for bcf-consensus)
+        - alt_start (same as ref_start, as no edits are recorded/applied before that position)
+        - alt_end (adjusted to match the length of the alt sequence)
+        - chain_num (just an auto-increment id)
+        
+        the other (sorted) lines are:
+        - length of the ungapped alignment block
+        - gap on the ref sequence between this and the next block (all but the last line)
+        - gap on the alt sequence between this and the next block (all but the last line)
+    */
+    chain_t *chain = args->chain;
+    int n = chain->num;
+    int ref_end_pos = args->fa_length + chain->ori_pos;
+    int last_block_size = ref_end_pos - chain->ref_last_block_ori;
+    int alt_end_pos = chain->alt_last_block_ori + last_block_size;
+    int score = 0;
+    for (n=0; n<chain->num; n++) {
+        score += chain->block_lengths[n];
+    }
+    score += last_block_size;
+    fprintf(args->fp_chain, "chain %d %s %d + %d %d %s %d + %d %d %d\n", score, bcf_hdr_id2name(args->hdr,args->rid), ref_end_pos, chain->ori_pos, ref_end_pos, bcf_hdr_id2name(args->hdr,args->rid), alt_end_pos, chain->ori_pos, alt_end_pos, ++args->chain_id);
+    for (n=0; n<chain->num; n++) {
+        fprintf(args->fp_chain, "%d %d %d\n", chain->block_lengths[n], chain->ref_gaps[n], chain->alt_gaps[n]);
+    }
+    fprintf(args->fp_chain, "%d\n\n", last_block_size);
+}
+
+static void push_chain_gap(chain_t *chain, int ref_start, int ref_len, int alt_start, int alt_len)
+{
+//     fprintf(stderr, "push_chain_gap(*chain, ref_start=%d, ref_len=%d, alt_start=%d, alt_len=%d)\n", ref_start, ref_len, alt_start, alt_len);
+    int num = chain->num;
+
+    if (ref_start <= chain->ref_last_block_ori) {
+        // In case this variant is back-to-back with the previous one
+        chain->ref_last_block_ori = ref_start + ref_len;
+        chain->alt_last_block_ori = alt_start + alt_len;
+        chain->ref_gaps[num-1] += ref_len;
+        chain->alt_gaps[num-1] += alt_len;
+
+    } else {
+        // Extend the ungapped blocks, store the gap length
+        chain->block_lengths = (int*) realloc(chain->block_lengths, (num + 1) * sizeof(int));
+        chain->ref_gaps = (int*) realloc(chain->ref_gaps, (num + 1) * sizeof(int));
+        chain->alt_gaps = (int*) realloc(chain->alt_gaps, (num + 1) * sizeof(int));
+        chain->block_lengths[num] = ref_start - chain->ref_last_block_ori;
+        chain->ref_gaps[num] = ref_len;
+        chain->alt_gaps[num] = alt_len;
+        // Update the start positions of the next block
+        chain->ref_last_block_ori = ref_start + ref_len;
+        chain->alt_last_block_ori = alt_start + alt_len;
+        // Increment the number of ungapped blocks
+        chain->num++;
+    }
+}
+
+static void init_data(args_t *args)
+{
+    args->files = bcf_sr_init();
+    args->files->require_index = 1;
+    if ( !bcf_sr_add_reader(args->files,args->fname) ) error("Failed to open %s: %s\n", args->fname, bcf_sr_strerror(args->files->errnum));
+    args->hdr = args->files->readers[0].header;
+    args->isample = -1;
+    if ( args->sample )
+    {
+        args->isample = bcf_hdr_id2int(args->hdr,BCF_DT_SAMPLE,args->sample);
+        if ( args->isample<0 ) error("No such sample: %s\n", args->sample);
+    }
+    if ( args->haplotype && args->isample<0 )
+    {
+        if ( bcf_hdr_nsamples(args->hdr) > 1 ) error("The --sample option is expected with --haplotype\n");
+        args->isample = 0;
+    }
+    if ( args->mask_fname )
+    {
+        args->mask = regidx_init(args->mask_fname,NULL,NULL,0,NULL);
+        if ( !args->mask ) error("Failed to initialize mask regions\n");
+    }
+    // In case we want to store the chains
+    if ( args->chain_fname )
+    {
+        args->fp_chain = fopen(args->chain_fname,"w");
+        args->chain_id = 0;
+    }
+    rbuf_init(&args->vcf_rbuf, 100);
+    args->vcf_buf = (bcf1_t**) calloc(args->vcf_rbuf.m, sizeof(bcf1_t*));
+    args->fp_out = args->output_fname ? fopen(args->output_fname,"w") : stdout;
+}
+
+static void destroy_data(args_t *args)
+{
+    bcf_sr_destroy(args->files);
+    int i;
+    for (i=0; i<args->vcf_rbuf.m; i++)
+        if ( args->vcf_buf[i] ) bcf_destroy1(args->vcf_buf[i]);
+    free(args->vcf_buf);
+    free(args->fa_buf.s);
+    if ( args->mask ) regidx_destroy(args->mask);
+    if ( args->chain_fname )
+        if ( fclose(args->fp_chain) ) error("Close failed: %s\n", args->chain_fname);
+    if ( fclose(args->fp_out) ) error("Close failed: %s\n", args->output_fname);
+}
+
+static void init_region(args_t *args, char *line)
+{
+    char *ss, *se = line;
+    while ( *se && !isspace(*se) && *se!=':' ) se++;
+    int from = 0, to = 0;
+    char tmp, *tmp_ptr = NULL;
+    if ( *se )
+    {
+        tmp = *se; *se = 0; tmp_ptr = se;
+        ss = ++se;
+        from = strtol(ss,&se,10);
+        if ( ss==se || !*se || *se!='-' ) from = 0;
+        else
+        {
+            from--;
+            ss = ++se;
+            to = strtol(ss,&se,10);
+            if ( ss==se || (*se && !isspace(*se)) ) { from = 0; to = 0; }
+            else to--;
+        }
+    }
+    args->rid = bcf_hdr_name2id(args->hdr,line);
+    if ( args->rid<0 ) fprintf(stderr,"Warning: Sequence \"%s\" not in %s\n", line,args->fname);
+    args->fa_buf.l = 0;
+    args->fa_length = 0;
+    args->fa_end_pos = to;
+    args->fa_ori_pos = from;
+    args->fa_src_pos = from;
+    args->fa_mod_off = 0;
+    args->fa_frz_pos = -1;
+    args->fa_case    = -1;
+    args->vcf_rbuf.n = 0;
+    bcf_sr_seek(args->files,line,args->fa_ori_pos);
+    if ( tmp_ptr ) *tmp_ptr = tmp;
+    fprintf(args->fp_out,">%s\n",line);
+    if (args->chain_fname )
+    {
+        args->chain = init_chain(args->chain, args->fa_ori_pos);
+    } else {
+        args->chain = NULL;
+    }
+}
+
+static bcf1_t **next_vcf_line(args_t *args)
+{
+    if ( args->vcf_rbuf.n )
+    {
+        int i = rbuf_shift(&args->vcf_rbuf);
+        return &args->vcf_buf[i];
+    }
+    else if ( bcf_sr_next_line(args->files) )
+        return &args->files->readers[0].buffer[0];
+
+    return NULL;
+}
+static void unread_vcf_line(args_t *args, bcf1_t **rec_ptr)
+{
+    bcf1_t *rec = *rec_ptr;
+    if ( args->vcf_rbuf.n >= args->vcf_rbuf.m )
+        error("FIXME: too many overlapping records near %s:%d\n", bcf_seqname(args->hdr,rec),rec->pos+1);
+
+    // Insert the new record in the buffer. The line would be overwritten in
+    // the next bcf_sr_next_line call, therefore we need to swap it with an
+    // unused one
+    int i = rbuf_append(&args->vcf_rbuf);
+    if ( !args->vcf_buf[i] ) args->vcf_buf[i] = bcf_init1();
+    bcf1_t *tmp = rec; *rec_ptr = args->vcf_buf[i]; args->vcf_buf[i] = tmp;
+}
+static void flush_fa_buffer(args_t *args, int len)
+{
+    if ( !args->fa_buf.l ) return;
+
+    int nwr = 0;
+    while ( nwr + 60 <= args->fa_buf.l )
+    {
+        if ( fwrite(args->fa_buf.s+nwr,1,60,args->fp_out) != 60 ) error("Could not write: %s\n", args->output_fname);
+        if ( fwrite("\n",1,1,args->fp_out) != 1 ) error("Could not write: %s\n", args->output_fname);
+        nwr += 60;
+    }
+    if ( nwr )
+        args->fa_ori_pos += nwr;
+
+    if ( len )
+    {
+        // not finished on this chr yet and the buffer cannot be emptied completely
+        if ( nwr && nwr < args->fa_buf.l )
+            memmove(args->fa_buf.s,args->fa_buf.s+nwr,args->fa_buf.l-nwr);
+        args->fa_buf.l -= nwr;
+        return;
+    }
+
+    // empty the whole buffer
+    if ( nwr == args->fa_buf.l ) { args->fa_buf.l = 0; return; }
+
+    if ( fwrite(args->fa_buf.s+nwr,1,args->fa_buf.l - nwr,args->fp_out) != args->fa_buf.l - nwr ) error("Could not write: %s\n", args->output_fname);
+    if ( fwrite("\n",1,1,args->fp_out) != 1 ) error("Could not write: %s\n", args->output_fname);
+
+    args->fa_ori_pos += args->fa_buf.l - nwr - args->fa_mod_off;
+    args->fa_mod_off = 0;
+    args->fa_buf.l = 0;
+}
+static void apply_variant(args_t *args, bcf1_t *rec)
+{
+    if ( rec->n_allele==1 ) return;
+
+    if ( rec->pos <= args->fa_frz_pos )
+    {
+        fprintf(stderr,"The site %s:%d overlaps with another variant, skipping...\n", bcf_seqname(args->hdr,rec),rec->pos+1);
+        return;
+    }
+    if ( args->mask )
+    {
+        char *chr = (char*)bcf_hdr_id2name(args->hdr,args->rid);
+        int start = rec->pos;
+        int end   = rec->pos + rec->rlen - 1;
+        if ( regidx_overlap(args->mask, chr,start,end,NULL) ) return;
+    }
+
+    int i, ialt = 1;
+    if ( args->isample >= 0 )
+    {
+        bcf_fmt_t *fmt = bcf_get_fmt(args->hdr, rec, "GT");
+        if ( !fmt ) return;
+        if ( args->haplotype )
+        {
+            if ( args->haplotype > fmt->n ) error("Can't apply %d-th haplotype at %s:%d\n", args->haplotype,bcf_seqname(args->hdr,rec),rec->pos+1);
+            uint8_t *ignore, *ptr = fmt->p + fmt->size*args->isample + args->haplotype - 1;
+            ialt = bcf_dec_int1(ptr, fmt->type, &ignore);
+            if ( bcf_gt_is_missing(ialt) || ialt==bcf_int32_vector_end ) return;
+            ialt = bcf_gt_allele(ialt);
+        }
+        else if ( args->output_iupac ) 
+        {
+            uint8_t *ignore, *ptr = fmt->p + fmt->size*args->isample;
+            ialt = bcf_dec_int1(ptr, fmt->type, &ignore);
+            if ( bcf_gt_is_missing(ialt) || ialt==bcf_int32_vector_end ) return;
+            ialt = bcf_gt_allele(ialt);
+
+            int jalt;
+            if ( fmt->n>1 )
+            {
+                ptr = fmt->p + fmt->size*args->isample + 1;
+                jalt = bcf_dec_int1(ptr, fmt->type, &ignore);
+                if ( bcf_gt_is_missing(jalt) || jalt==bcf_int32_vector_end ) jalt = ialt;
+                else jalt = bcf_gt_allele(jalt);
+            }
+            else jalt = ialt;
+            if ( rec->n_allele <= ialt || rec->n_allele <= jalt ) error("Broken VCF, too few alts at %s:%d\n", bcf_seqname(args->hdr,rec),rec->pos+1);
+            if ( ialt!=jalt && !rec->d.allele[ialt][1] && !rec->d.allele[jalt][1] ) // is this a het snp?
+            {
+                char ial = rec->d.allele[ialt][0];
+                char jal = rec->d.allele[jalt][0];
+                rec->d.allele[ialt][0] = gt2iupac(ial,jal);
+            }
+        }
+        else
+        {
+            for (i=0; i<fmt->n; i++)
+            {
+                uint8_t *ignore, *ptr = fmt->p + fmt->size*args->isample + i;
+                ialt = bcf_dec_int1(ptr, fmt->type, &ignore);
+                if ( bcf_gt_is_missing(ialt) || ialt==bcf_int32_vector_end ) return;
+                ialt = bcf_gt_allele(ialt);
+                if ( ialt ) break;
+            }
+        }
+        if ( !ialt ) return;  // ref allele
+        if ( rec->n_allele <= ialt ) error("Broken VCF, too few alts at %s:%d\n", bcf_seqname(args->hdr,rec),rec->pos+1);
+    }
+    else if ( args->output_iupac && !rec->d.allele[0][1] && !rec->d.allele[1][1] )
+    {
+        char ial = rec->d.allele[0][0];
+        char jal = rec->d.allele[1][0];
+        rec->d.allele[1][0] = gt2iupac(ial,jal);
+    }
+
+    int idx = rec->pos - args->fa_ori_pos + args->fa_mod_off;
+    if ( idx<0 || idx>=args->fa_buf.l ) 
+        error("FIXME: %s:%d .. idx=%d, ori_pos=%d, len=%d, off=%d\n",bcf_seqname(args->hdr,rec),rec->pos+1,idx,args->fa_ori_pos,args->fa_buf.l,args->fa_mod_off);
+
+    // sanity check the reference base
+    int len_diff = 0, alen = 0;
+    if ( rec->d.allele[ialt][0]=='<' )
+    {
+        if ( strcasecmp(rec->d.allele[ialt], "<DEL>") )
+            error("Symbolic alleles other than <DEL> are currently not supported: %s at %s:%d\n",rec->d.allele[ialt],bcf_seqname(args->hdr,rec),rec->pos+1);
+        assert( rec->d.allele[0][1]==0 );           // todo: for now expecting strlen(REF) = 1
+        len_diff = 1-rec->rlen;
+        rec->d.allele[ialt] = rec->d.allele[0];     // according to VCF spec, REF must precede the event
+        alen = strlen(rec->d.allele[ialt]);
+    }
+    else if ( strncasecmp(rec->d.allele[0],args->fa_buf.s+idx,rec->rlen) )
+    {
+        // fprintf(stderr,"%d .. [%s], idx=%d ori=%d off=%d\n",args->fa_ori_pos,args->fa_buf.s,idx,args->fa_ori_pos,args->fa_mod_off);
+        char tmp = 0;
+        if ( args->fa_buf.l - idx > rec->rlen ) 
+        { 
+            tmp = args->fa_buf.s[idx+rec->rlen];
+            args->fa_buf.s[idx+rec->rlen] = 0;
+        }
+        error(
+            "The fasta sequence does not match the REF allele at %s:%d:\n"
+            "   .vcf: [%s]\n" 
+            "   .vcf: [%s] <- (ALT)\n" 
+            "   .fa:  [%s]%c%s\n",
+            bcf_seqname(args->hdr,rec),rec->pos+1, rec->d.allele[0], rec->d.allele[ialt], args->fa_buf.s+idx, 
+            tmp?tmp:' ',tmp?args->fa_buf.s+idx+rec->rlen+1:""
+            );
+    }
+    else
+    {
+        alen = strlen(rec->d.allele[ialt]);
+        len_diff = alen - rec->rlen;
+    }
+
+    if ( args->fa_case )
+        for (i=0; i<alen; i++) rec->d.allele[ialt][i] = toupper(rec->d.allele[ialt][i]);
+    else
+        for (i=0; i<alen; i++) rec->d.allele[ialt][i] = tolower(rec->d.allele[ialt][i]);
+
+    if ( len_diff <= 0 )
+    {
+        // deletion or same size event
+        for (i=0; i<alen; i++)
+            args->fa_buf.s[idx+i] = rec->d.allele[ialt][i];
+        if ( len_diff )
+            memmove(args->fa_buf.s+idx+alen,args->fa_buf.s+idx+rec->rlen,args->fa_buf.l-idx-rec->rlen);
+    }
+    else
+    {
+        // insertion
+        ks_resize(&args->fa_buf, args->fa_buf.l + len_diff);
+        memmove(args->fa_buf.s + idx + rec->rlen + len_diff, args->fa_buf.s + idx + rec->rlen, args->fa_buf.l - idx - rec->rlen);
+        for (i=0; i<alen; i++)
+            args->fa_buf.s[idx+i] = rec->d.allele[ialt][i];
+    }
+    if (args->chain && len_diff != 0)
+    {
+        // If first nucleotide of both REF and ALT are the same... (indels typically include the nucleotide before the variant)
+        if ( strncasecmp(rec->d.allele[0],rec->d.allele[ialt],1) == 0)
+        {
+            // ...extend the block by 1 bp: start is 1 bp further and alleles are 1 bp shorter
+            push_chain_gap(args->chain, rec->pos + 1, rec->rlen - 1, rec->pos + 1 + args->fa_mod_off, alen - 1);
+        }
+        else
+        {
+            // otherwise, just the coordinates of the variant as given
+            push_chain_gap(args->chain, rec->pos, rec->rlen, rec->pos + args->fa_mod_off, alen);
+        }
+    }
+    args->fa_buf.l += len_diff;
+    args->fa_mod_off += len_diff;
+    args->fa_frz_pos  = rec->pos + rec->rlen - 1;
+}
+
+
+static void mask_region(args_t *args, char *seq, int len)
+{
+    char *chr = (char*)bcf_hdr_id2name(args->hdr,args->rid);
+    int start = args->fa_src_pos - len;
+    int end   = args->fa_src_pos;
+
+    regitr_t itr;
+    if ( !regidx_overlap(args->mask, chr,start,end, &itr) ) return;
+
+    int idx_start, idx_end, i;
+    while ( REGITR_OVERLAP(itr,start,end) )
+    {
+        idx_start = REGITR_START(itr) - start;
+        idx_end   = REGITR_END(itr) - start;
+        if ( idx_start < 0 ) idx_start = 0;
+        if ( idx_end >= len ) idx_end = len - 1;
+        for (i=idx_start; i<=idx_end; i++) seq[i] = 'N';
+        itr.i++;
+    }
+}
+
+static void consensus(args_t *args)
+{
+    htsFile *fasta = hts_open(args->ref_fname, "rb");
+    if ( !fasta ) error("Error reading %s\n", args->ref_fname);
+    kstring_t str = {0,0,0};
+    while ( hts_getline(fasta, KS_SEP_LINE, &str) > 0 )
+    {
+        if ( str.s[0]=='>' )
+        {
+            // new sequence encountered, apply all chached variants
+            while ( args->vcf_rbuf.n )
+            {
+                if (args->chain) {
+                    print_chain(args);
+                    destroy_chain(args);
+                }
+                bcf1_t *rec = args->vcf_buf[args->vcf_rbuf.f];
+                if ( rec->rid!=args->rid || ( args->fa_end_pos && rec->pos > args->fa_end_pos ) ) break;
+                int i = rbuf_shift(&args->vcf_rbuf);
+                apply_variant(args, args->vcf_buf[i]);
+            }
+            flush_fa_buffer(args, 0);
+            init_region(args, str.s+1);
+            continue;
+        }
+        args->fa_length  += str.l;
+        args->fa_src_pos += str.l;
+
+        // determine if uppercase or lowercase is used in this fasta file
+        if ( args->fa_case==-1 ) args->fa_case = toupper(str.s[0])==str.s[0] ? 1 : 0;
+
+        if ( args->mask && args->rid>=0) mask_region(args, str.s, str.l);
+        kputs(str.s, &args->fa_buf);
+
+        bcf1_t **rec_ptr = NULL;
+        while ( args->rid>=0 && (rec_ptr = next_vcf_line(args)) )
+        {
+            bcf1_t *rec = *rec_ptr;
+
+            // still the same chr and the same region? if not, fasta buf can be flushed
+            if ( rec->rid!=args->rid || ( args->fa_end_pos && rec->pos > args->fa_end_pos ) )
+            {
+                // save the vcf record until next time and flush
+                unread_vcf_line(args, rec_ptr);
+                rec_ptr = NULL;
+                break;
+            }
+
+            // is the vcf record well beyond cached fasta buffer? if yes, the buf can be flushed
+            if ( args->fa_ori_pos + args->fa_buf.l - args->fa_mod_off <= rec->pos )
+            {
+                unread_vcf_line(args, rec_ptr);
+                rec_ptr = NULL;
+                break;
+            }
+
+            // is the cached fasta buffer full enough? if not, read more fasta, no flushing
+            if ( args->fa_ori_pos + args->fa_buf.l - args->fa_mod_off <= rec->pos + rec->rlen )
+            {
+                unread_vcf_line(args, rec_ptr);
+                break;
+            }
+            apply_variant(args, rec);
+        }
+        if ( !rec_ptr ) flush_fa_buffer(args, 60);
+    }
+    if (args->chain) {
+        print_chain(args);
+        destroy_chain(args);
+    }
+    flush_fa_buffer(args, 0);
+    hts_close(fasta);
+    free(str.s);
+}
+
+static void usage(args_t *args)
+{
+    fprintf(stderr, "\n");
+    fprintf(stderr, "About:   Create consensus sequence by applying VCF variants to a reference\n");
+    fprintf(stderr, "         fasta file.\n");
+    fprintf(stderr, "Usage:   bcftools consensus [OPTIONS] <file.vcf>\n");
+    fprintf(stderr, "Options:\n");
+    fprintf(stderr, "    -f, --fasta-ref <file>     reference sequence in fasta format\n");
+    fprintf(stderr, "    -H, --haplotype <1|2>      apply variants for the given haplotype\n");
+    fprintf(stderr, "    -i, --iupac-codes          output variants in the form of IUPAC ambiguity codes\n");
+    fprintf(stderr, "    -m, --mask <file>          replace regions with N\n");
+    fprintf(stderr, "    -o, --output <file>        write output to a file [standard output]\n");
+    fprintf(stderr, "    -c, --chain <file>         write a chain file for liftover\n");
+    fprintf(stderr, "    -s, --sample <name>        apply variants of the given sample\n");
+    fprintf(stderr, "Examples:\n");
+    fprintf(stderr, "   # Get the consensus for one region. The fasta header lines are then expected\n");
+    fprintf(stderr, "   # in the form \">chr:from-to\".\n");
+    fprintf(stderr, "   samtools faidx ref.fa 8:11870-11890 | bcftools consensus in.vcf.gz > out.fa\n");
+    fprintf(stderr, "\n");
+    exit(1);
+}
+
+int main_consensus(int argc, char *argv[])
+{
+    args_t *args = (args_t*) calloc(1,sizeof(args_t));
+    args->argc   = argc; args->argv = argv;
+
+    static struct option loptions[] = 
+    {
+        {"sample",1,0,'s'},
+        {"iupac-codes",0,0,'i'},
+        {"haplotype",1,0,'H'},
+        {"output",1,0,'o'},
+        {"fasta-ref",1,0,'f'},
+        {"mask",1,0,'m'},
+        {"chain",1,0,'c'},
+        {0,0,0,0}
+    };
+    char c;
+    while ((c = getopt_long(argc, argv, "h?s:1iH:f:o:m:c:",loptions,NULL)) >= 0) 
+    {
+        switch (c) 
+        {
+            case 's': args->sample = optarg; break;
+            case 'o': args->output_fname = optarg; break;
+            case 'i': args->output_iupac = 1; break;
+            case 'f': args->ref_fname = optarg; break;
+            case 'm': args->mask_fname = optarg; break;
+            case 'c': args->chain_fname = optarg; break;
+            case 'H': 
+                args->haplotype = optarg[0] - '0'; 
+                if ( args->haplotype <=0 ) error("Expected positive integer with --haplotype\n");
+                break;
+            default: usage(args); break;
+        }
+    }
+    if ( optind>=argc ) usage(args);
+    args->fname = argv[optind];
+
+    if ( !args->ref_fname && !isatty(fileno((FILE *)stdin)) ) args->ref_fname = "-";
+    if ( !args->ref_fname ) usage(args);
+
+    init_data(args);
+    consensus(args);
+    destroy_data(args);
+    free(args);
+
+    return 0;
+}
+
+
diff --git a/convert.c b/convert.c
new file mode 100644
index 0000000..f3999ab
--- /dev/null
+++ b/convert.c
@@ -0,0 +1,976 @@
+/*  convert.c -- functions for converting between VCF/BCF and related formats.
+
+    Copyright (C) 2013-2014 Genome Research Ltd.
+
+    Author: Petr Danecek <pd3 at sanger.ac.uk>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.  */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <getopt.h>
+#include <ctype.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <math.h>
+#include <htslib/vcf.h>
+#include <htslib/synced_bcf_reader.h>
+#include <htslib/vcfutils.h>
+#include "bcftools.h"
+#include "convert.h"
+
+#define T_CHROM   1
+#define T_POS     2
+#define T_ID      3
+#define T_REF     4
+#define T_ALT     5
+#define T_QUAL    6
+#define T_FILTER  7
+#define T_INFO    8
+#define T_FORMAT  9
+#define T_SAMPLE  10
+#define T_SEP     11
+#define T_IS_TS   12
+#define T_TYPE    13
+#define T_MASK    14
+#define T_GT      15
+#define T_TGT     16
+#define T_LINE    17
+#define T_CHROM_POS_ID 18   // not publicly advertised
+#define T_GT_TO_PROB3  19   // not publicly advertised
+#define T_PL_TO_PROB3  20   // not publicly advertised
+#define T_GP_TO_PROB3  21   // not publicly advertised
+#define T_FIRST_ALT    22   // not publicly advertised
+#define T_IUPAC_GT     23
+#define T_GT_TO_HAP    24   // not publicly advertised
+#define T_GT_TO_HAP2   25   // not publicly advertised
+
+typedef struct _fmt_t
+{
+    int type, id, is_gt_field, ready, subscript;
+    char *key;
+    bcf_fmt_t *fmt;
+    void (*handler)(convert_t *, bcf1_t *, struct _fmt_t *, int, kstring_t *);
+}
+fmt_t;
+
+struct _convert_t
+{
+    fmt_t *fmt;
+    int nfmt, mfmt;
+    int nsamples, *samples;
+    bcf_hdr_t *header;
+    int max_unpack;
+    char *format_str;
+    bcf_srs_t *readers; // required only for %MASK
+    int nreaders;
+    void *dat;
+    int ndat;
+};
+
+
+static void process_chrom(convert_t *convert, bcf1_t *line, fmt_t *fmt, int isample, kstring_t *str) { kputs(convert->header->id[BCF_DT_CTG][line->rid].key, str); }
+static void process_pos(convert_t *convert, bcf1_t *line, fmt_t *fmt, int isample, kstring_t *str) { kputw(line->pos+1, str); }
+static void process_id(convert_t *convert, bcf1_t *line, fmt_t *fmt, int isample, kstring_t *str) { kputs(line->d.id, str); }
+static void process_ref(convert_t *convert, bcf1_t *line, fmt_t *fmt, int isample, kstring_t *str) { kputs(line->d.allele[0], str); }
+static void process_alt(convert_t *convert, bcf1_t *line, fmt_t *fmt, int isample, kstring_t *str)
+{
+    int i;
+    if ( line->n_allele==1 )
+    {
+        kputc('.', str);
+        return;
+    }
+    if ( fmt->subscript>=0 )
+    {
+        if ( line->n_allele > fmt->subscript+1 )
+            kputs(line->d.allele[fmt->subscript+1], str);
+        else
+            kputc('.', str);
+        return;
+    }
+    for (i=1; i<line->n_allele; i++)
+    {
+        if ( i>1 ) kputc(',', str);
+        kputs(line->d.allele[i], str);
+    }
+}
+static void process_first_alt(convert_t *convert, bcf1_t *line, fmt_t *fmt, int isample, kstring_t *str)
+{
+    if ( line->n_allele==1 )
+        kputc('.', str);
+    else
+        kputs(line->d.allele[1], str);
+}
+static void process_qual(convert_t *convert, bcf1_t *line, fmt_t *fmt, int isample, kstring_t *str)
+{
+    if ( bcf_float_is_missing(line->qual) ) kputc('.', str);
+    else ksprintf(str, "%g", line->qual);
+}
+static void process_filter(convert_t *convert, bcf1_t *line, fmt_t *fmt, int isample, kstring_t *str)
+{
+    int i;
+    if ( line->d.n_flt )
+    {
+        for (i=0; i<line->d.n_flt; i++)
+        {
+            if (i) kputc(';', str);
+            kputs(convert->header->id[BCF_DT_ID][line->d.flt[i]].key, str);
+        }
+    }
+    else kputc('.', str);
+}
+static inline int bcf_array_ivalue(void *bcf_array, int type, int idx)
+{
+    if ( type==BCF_BT_INT8 ) return ((int8_t*)bcf_array)[idx];
+    if ( type==BCF_BT_INT16 ) return ((int16_t*)bcf_array)[idx];
+    return ((int32_t*)bcf_array)[idx];
+}
+static void process_info(convert_t *convert, bcf1_t *line, fmt_t *fmt, int isample, kstring_t *str)
+{
+    int i;
+    for (i=0; i<line->n_info; i++)
+        if ( line->d.info[i].key == fmt->id ) break;
+
+    // output "." if the tag is not present
+    if ( i==line->n_info )
+    {
+        kputc('.', str);
+        return;
+    }
+
+    bcf_info_t *info = &line->d.info[i];
+
+    // if this is a flag, output 1
+    if ( info->len <=0 )
+    {
+        kputc('1', str);
+        return;
+    }
+
+    if ( info->len == 1 )
+    {
+        switch (info->type)
+        {
+            case BCF_BT_INT8:  if ( info->v1.i==bcf_int8_missing ) kputc('.', str); else kputw(info->v1.i, str); break;
+            case BCF_BT_INT16: if ( info->v1.i==bcf_int16_missing ) kputc('.', str); else kputw(info->v1.i, str); break;
+            case BCF_BT_INT32: if ( info->v1.i==bcf_int32_missing ) kputc('.', str); else kputw(info->v1.i, str); break;
+            case BCF_BT_FLOAT: if ( bcf_float_is_missing(info->v1.f) ) kputc('.', str); else ksprintf(str, "%g", info->v1.f); break;
+            case BCF_BT_CHAR:  kputc(info->v1.i, str); break;
+            default: fprintf(stderr,"todo: type %d\n", info->type); exit(1); break;
+        }
+    }
+    else if ( fmt->subscript >=0 )
+    {
+        if ( info->len <= fmt->subscript )
+        {
+            kputc('.', str);
+            return;
+        }
+        #define BRANCH(type_t, is_missing, is_vector_end, kprint) { \
+            type_t val = ((type_t *) info->vptr)[fmt->subscript]; \
+            if ( is_missing || is_vector_end ) kputc('.',str); \
+            else kprint; \
+        }
+        switch (info->type)
+        {
+            case BCF_BT_INT8:  BRANCH(int8_t,  val==bcf_int8_missing,  val==bcf_int8_vector_end,  kputw(val, str)); break;
+            case BCF_BT_INT16: BRANCH(int16_t, val==bcf_int16_missing, val==bcf_int16_vector_end, kputw(val, str)); break;
+            case BCF_BT_INT32: BRANCH(int32_t, val==bcf_int32_missing, val==bcf_int32_vector_end, kputw(val, str)); break;
+            case BCF_BT_FLOAT: BRANCH(float,   bcf_float_is_missing(val), bcf_float_is_vector_end(val), ksprintf(str, "%g", val)); break;
+            default: fprintf(stderr,"todo: type %d\n", info->type); exit(1); break;
+        }
+        #undef BRANCH
+    }
+    else
+        bcf_fmt_array(str, info->len, info->type, info->vptr);
+}
+static void init_format(convert_t *convert, bcf1_t *line, fmt_t *fmt)
+{
+    fmt->id = bcf_hdr_id2int(convert->header, BCF_DT_ID, fmt->key);
+    if ( fmt->id==-1 ) error("Error: no such tag defined in the VCF header: FORMAT/%s\n", fmt->key);
+    fmt->fmt = NULL;
+    int i;
+    for (i=0; i<(int)line->n_fmt; i++)
+        if ( line->d.fmt[i].id==fmt->id ) { fmt->fmt = &line->d.fmt[i]; break; }
+    fmt->ready = 1;
+}
+static void process_format(convert_t *convert, bcf1_t *line, fmt_t *fmt, int isample, kstring_t *str)
+{
+    if ( !fmt->ready )
+        init_format(convert, line, fmt);
+
+    if ( fmt->fmt==NULL )
+    {
+        kputc('.', str);
+        return;
+    }
+    else if ( fmt->subscript >=0 )
+    {
+        if ( fmt->fmt->n <= fmt->subscript )
+        {
+            kputc('.', str);
+            return;
+        }
+        if ( fmt->fmt->type == BCF_BT_FLOAT ) ksprintf(str, "%g", ((float*)(fmt->fmt->p + isample*fmt->fmt->size))[fmt->subscript]);
+        else if ( fmt->fmt->type != BCF_BT_CHAR ) kputw(bcf_array_ivalue(fmt->fmt->p+isample*fmt->fmt->size,fmt->fmt->type,fmt->subscript), str);
+        else error("TODO: %s:%d .. fmt->type=%d\n", __FILE__,__LINE__, fmt->fmt->type);
+    }
+    else
+        bcf_fmt_array(str, fmt->fmt->n, fmt->fmt->type, fmt->fmt->p + isample*fmt->fmt->size);
+}
+static void process_gt(convert_t *convert, bcf1_t *line, fmt_t *fmt, int isample, kstring_t *str)
+{
+    if ( !fmt->ready )
+        init_format(convert, line, fmt);
+
+    if ( fmt->fmt==NULL )
+    {
+        kputc('.', str);
+        return;
+    }
+    bcf_format_gt(fmt->fmt, isample, str);
+}
+static void process_tgt(convert_t *convert, bcf1_t *line, fmt_t *fmt, int isample, kstring_t *str)
+{
+    if ( !fmt->ready )
+        init_format(convert, line, fmt);
+
+    if ( fmt->fmt==NULL )
+    {
+        kputc('.', str);
+        return;
+    }
+
+    assert( fmt->fmt->type==BCF_BT_INT8 );
+
+    int l;
+    int8_t *x = (int8_t*)(fmt->fmt->p + isample*fmt->fmt->size); // FIXME: does not work with n_alt >= 64
+    for (l = 0; l < fmt->fmt->n && x[l] != bcf_int8_vector_end; ++l)
+    {
+        if (l) kputc("/|"[x[l]&1], str);
+        if (x[l]>>1)
+        {
+            int ial = (x[l]>>1) - 1;
+            kputs(line->d.allele[ial], str);
+        }
+        else
+            kputc('.', str);
+    }
+    if (l == 0) kputc('.', str);
+}
+static void init_format_iupac(convert_t *convert, bcf1_t *line, fmt_t *fmt)
+{
+    init_format(convert, line, fmt);
+    if ( fmt->fmt==NULL ) return;
+
+    // Init mapping between alleles and IUPAC table
+    hts_expand(uint8_t, line->n_allele, convert->ndat, convert->dat);
+    int8_t *dat = (int8_t*)convert->dat;
+    int i;
+    for (i=0; i<line->n_allele; i++)
+    {
+        if ( line->d.allele[i][1] ) dat[i] = -1;
+        else
+        {
+            switch (line->d.allele[i][0])
+            {
+                case 'A': dat[i] = 0; break;
+                case 'C': dat[i] = 1; break;
+                case 'G': dat[i] = 2; break;
+                case 'T': dat[i] = 3; break;
+                case 'a': dat[i] = 0; break;
+                case 'c': dat[i] = 1; break;
+                case 'g': dat[i] = 2; break;
+                case 't': dat[i] = 3; break;
+                default: dat[i] = -1;
+            }
+        }
+    }
+}
+static void process_iupac_gt(convert_t *convert, bcf1_t *line, fmt_t *fmt, int isample, kstring_t *str)
+{
+    if ( !fmt->ready )
+        init_format_iupac(convert, line, fmt);
+
+    if ( fmt->fmt==NULL )
+    {
+        kputc('.', str);
+        return;
+    }
+
+    assert( fmt->fmt->type==BCF_BT_INT8 );
+
+    static const char iupac[4][4] = { {'A','M','R','W'},{'M','C','S','Y'},{'R','S','G','K'},{'W','Y','K','T'} };
+    int8_t *dat = (int8_t*)convert->dat;
+
+    int8_t *x = (int8_t*)(fmt->fmt->p + isample*fmt->fmt->size); // FIXME: does not work with n_alt >= 64
+    int l = 0;
+    while ( l<fmt->fmt->n && x[l]!=bcf_int8_vector_end && x[l]!=bcf_int8_missing ) l++;
+
+    if ( l==2 )
+    {
+        // diploid
+        int ia = (x[0]>>1) - 1, ib = (x[1]>>1) - 1;
+        if ( ia>=0 && ia<line->n_allele && ib>=0 && ib<line->n_allele && dat[ia]>=0 && dat[ib]>=0 )
+        {
+            kputc(iupac[dat[ia]][dat[ib]], str);
+            return;
+        }
+    }
+    for (l = 0; l < fmt->fmt->n && x[l] != bcf_int8_vector_end; ++l)
+    {
+        if (l) kputc("/|"[x[l]&1], str);
+        if (x[l]>>1)
+        {
+            int ial = (x[l]>>1) - 1;
+            kputs(line->d.allele[ial], str);
+        }
+        else
+            kputc('.', str);
+    }
+    if (l == 0) kputc('.', str);
+}
+static void process_sample(convert_t *convert, bcf1_t *line, fmt_t *fmt, int isample, kstring_t *str)
+{
+    kputs(convert->header->samples[isample], str);
+}
+static void process_sep(convert_t *convert, bcf1_t *line, fmt_t *fmt, int isample, kstring_t *str) { if (fmt->key) kputs(fmt->key, str); }
+static void process_is_ts(convert_t *convert, bcf1_t *line, fmt_t *fmt, int isample, kstring_t *str)
+{
+    int is_ts = 0;
+    if ( bcf_get_variant_types(line) & (VCF_SNP|VCF_MNP) )
+        is_ts = abs(bcf_acgt2int(*line->d.allele[0])-bcf_acgt2int(*line->d.allele[1])) == 2 ? 1 : 0;
+    kputc(is_ts ? '1' : '0', str);
+}
+static void process_type(convert_t *convert, bcf1_t *line, fmt_t *fmt, int isample, kstring_t *str)
+{
+    int line_type = bcf_get_variant_types(line);
+    int i = 0;
+    if ( line_type == VCF_REF ) { kputs("REF", str); i++; }
+    if ( line_type & VCF_SNP ) { if (i) kputc(',',str); kputs("SNP", str); i++; }
+    if ( line_type & VCF_MNP ) { if (i) kputc(',',str); kputs("MNP", str); i++; }
+    if ( line_type & VCF_INDEL ) { if (i) kputc(',',str); kputs("INDEL", str); i++; }
+    if ( line_type & VCF_OTHER ) { if (i) kputc(',',str); kputs("OTHER", str); i++; }
+}
+static void process_line(convert_t *convert, bcf1_t *line, fmt_t *fmt, int isample, kstring_t *str)
+{
+    vcf_format1(convert->header, line, str);
+}
+static void process_chrom_pos_id(convert_t *convert, bcf1_t *line, fmt_t *fmt, int isample, kstring_t *str)
+{
+    if ( line->d.id[0]!='.' || line->d.id[1] )
+    {
+        // ID is present
+        kputs(line->d.id, str);
+    }
+    else
+    {
+        // use CHROM:POS instead of ID
+        kputs(convert->header->id[BCF_DT_CTG][line->rid].key, str);
+        kputc(':', str);
+        kputw(line->pos+1, str);
+    }
+}
+static void process_gt_to_prob3(convert_t *convert, bcf1_t *line, fmt_t *fmt, int isample, kstring_t *str)
+{
+    int m,n,i;
+
+    m = convert->ndat / sizeof(int32_t);
+    n = bcf_get_genotypes(convert->header,line,&convert->dat,&m);
+    convert->ndat = m * sizeof(int32_t);
+
+    if ( n<=0 )
+    {
+        // Throw an error or silently proceed?
+        //
+        // for (i=0; i<convert->nsamples; i++) kputs(" 0.33 0.33 0.33", str);
+        // return;
+
+        error("Error parsing GT tag at %s:%d\n", bcf_seqname(convert->header,line),line->pos+1);
+    }
+
+    n /= convert->nsamples;
+    for (i=0; i<convert->nsamples; i++)
+    {
+        int32_t *ptr = (int32_t*)convert->dat + i*n;
+        int j;
+        for (j=0; j<n; j++)
+            if ( ptr[j]==bcf_int32_vector_end ) break;
+
+        if ( j==2 )
+        {
+            // diploid
+            if ( bcf_gt_allele(ptr[0])!=bcf_gt_allele(ptr[1]) )
+                kputs(" 0 1 0", str);       // HET
+            else if ( bcf_gt_allele(ptr[0])==1 )
+                kputs(" 0 0 1", str);       // ALT HOM, first ALT allele
+            else
+                kputs(" 1 0 0", str);       // REF HOM or something else than first ALT
+        }
+        else if ( j==1 )
+        {
+            // haploid
+            if ( bcf_gt_is_missing(ptr[0]) )
+                kputs(" 0.5 0.0 0.5", str);
+            else if ( bcf_gt_allele(ptr[0])==1 )
+                kputs(" 0 0 1", str);       // first ALT allele
+            else
+                kputs(" 1 0 0", str);       // REF or something else than first ALT
+        }
+        else error("FIXME: not ready for ploidy %d\n", j);
+    }
+}
+static void process_pl_to_prob3(convert_t *convert, bcf1_t *line, fmt_t *fmt, int isample, kstring_t *str)
+{
+    int m,n,i;
+
+    m = convert->ndat / sizeof(int32_t);
+    n = bcf_get_format_int32(convert->header,line,"PL",&convert->dat,&m);
+    convert->ndat = m * sizeof(int32_t);
+
+    if ( n<=0 )
+    {
+        // Throw an error or silently proceed?
+        //
+        // for (i=0; i<convert->nsamples; i++) kputs(" 0.33 0.33 0.33", str);
+        // return;
+
+        error("Error parsing PL tag at %s:%d\n", bcf_seqname(convert->header,line),line->pos+1);
+    }
+
+    n /= convert->nsamples;
+    for (i=0; i<convert->nsamples; i++)
+    {
+        int32_t *ptr = (int32_t*)convert->dat + i*n;
+        int j;
+        float sum = 0;
+        for (j=0; j<n; j++)
+        {
+            if ( ptr[j]==bcf_int32_vector_end ) break;
+            sum += pow(10,-0.1*ptr[j]);
+        }
+        if ( j==line->n_allele )
+        {
+            // haploid
+            kputc(' ',str);
+            ksprintf(str,"%f",pow(10,-0.1*ptr[0])/sum);
+            kputs(" 0 ", str);
+            ksprintf(str,"%f",pow(10,-0.1*ptr[1])/sum);
+        }
+        else
+        {
+            // diploid
+            kputc(' ',str);
+            ksprintf(str,"%f",pow(10,-0.1*ptr[0])/sum);
+            kputc(' ',str);
+            ksprintf(str,"%f",pow(10,-0.1*ptr[1])/sum);
+            kputc(' ',str);
+            ksprintf(str,"%f",pow(10,-0.1*ptr[2])/sum);
+        }
+    }
+}
+static void process_gp_to_prob3(convert_t *convert, bcf1_t *line, fmt_t *fmt, int isample, kstring_t *str)
+{
+    int m,n,i;
+
+    m = convert->ndat / sizeof(float);
+    n = bcf_get_format_float(convert->header,line,"GP",&convert->dat,&m);
+    convert->ndat = m * sizeof(float);
+
+    if ( n<=0 )
+    {
+        // Throw an error or silently proceed?
+        //
+        // for (i=0; i<convert->nsamples; i++) kputs(" 0.33 0.33 0.33", str);
+        // return;
+
+        error("Error parsing GP tag at %s:%d\n", bcf_seqname(convert->header,line),line->pos+1);
+    }
+
+    n /= convert->nsamples;
+    for (i=0; i<convert->nsamples; i++)
+    {
+        float sum = 0, *ptr = (float*)convert->dat + i*n;
+        int j;
+        for (j=0; j<n; j++)
+        {
+            if ( ptr[j]==bcf_int32_vector_end ) break;
+            if ( ptr[j]==bcf_int32_missing ) { ptr[j]=0; continue; }
+            if ( ptr[j]<0 || ptr[j]>1 ) error("[%s:%d:%f] GP value outside range [0,1]; bcftools convert expects the VCF4.3+ spec for the GP field encoding genotype posterior probabilities", bcf_seqname(convert->header,line),line->pos+1,ptr[j]);
+            sum+=ptr[j];
+        }
+        if ( j==line->n_allele )
+            ksprintf(str," %f %f %f",ptr[0],0.,ptr[1]); // haploid
+        else
+            ksprintf(str," %f %f %f",ptr[0],ptr[1],ptr[2]); // diploid
+    }
+}
+
+static void process_gt_to_hap(convert_t *convert, bcf1_t *line, fmt_t *fmt, int isample, kstring_t *str)
+{
+    // https://mathgen.stats.ox.ac.uk/impute/impute_v2.html#-known_haps_g
+
+    // File containing known haplotypes for the study cohort. The format
+    // is the same as the output format from IMPUTE2's -phase option:
+    // five header columns (as in the -g file) followed by two columns
+    // (haplotypes) per individual. Allowed values in the haplotype
+    // columns are 0, 1, and ?.
+
+    // If your study dataset is fully phased, you can replace the -g file
+    // with a -known_haps_g file. This will cause IMPUTE2 to perform
+    // haploid imputation, although it will still report diploid imputation
+    // probabilities in the main output file. If any genotypes are missing,
+    // they can be marked as '? ?' (two question marks separated by one
+    // space) in the input file. (The program does not allow just one
+    // allele from a diploid genotype to be missing.) If the reference
+    // panels are also phased, IMPUTE2 will perform a single, fast
+    // imputation step rather than its standard MCMC module this is how
+    // the program imputes into pre-phased GWAS haplotypes.
+
+    // The -known_haps_g file can also be used to specify study
+    // genotypes that are "partially" phased, in the sense that some
+    // genotypes are phased relative to a fixed reference point while
+    // others are not. We anticipate that this will be most useful when
+    // trying to phase resequencing data onto a scaffold of known
+    // haplotypes. To mark a known genotype as unphased, place an
+    // asterisk immediately after each allele, with no space between
+    // the allele (0/1) and the asterisk (*); e.g., "0* 1*" for a
+    // heterozygous genotype of unknown phase.
+
+    int m, n, i;
+
+    m = convert->ndat / sizeof(int32_t);
+    n = bcf_get_genotypes(convert->header, line, &convert->dat, &m);
+    convert->ndat = m * sizeof(int32_t);
+
+    if ( n<=0 )
+    {
+        // Throw an error or silently proceed?
+        //
+        // for (i=0; i<convert->nsamples; i++) kputs(" ...", str);
+        // return;
+
+        error("Error parsing GT tag at %s:%d\n", bcf_seqname(convert->header, line), line->pos+1);
+    }
+
+    n /= convert->nsamples;
+    for (i=0; i<convert->nsamples; i++)
+    {
+        int32_t *ptr = (int32_t*)convert->dat + i*n;
+        int j;
+        for (j=0; j<n; j++)
+            if ( ptr[j]==bcf_int32_vector_end ) break;
+
+        if (i>0) kputs(" ", str); // no space separation for first column
+        if ( j==2 )
+        {
+            // diploid
+            if ( bcf_gt_is_missing(ptr[0]) || bcf_gt_is_missing(ptr[1]) ) {
+                kputs("? ?", str);
+            }
+            else if ( bcf_gt_is_phased(ptr[1])) {
+                ksprintf(str, "%d %d", bcf_gt_allele(ptr[0]), bcf_gt_allele(ptr[1]));
+            }
+            else {
+                ksprintf(str, "%d* %d*", bcf_gt_allele(ptr[0]), bcf_gt_allele(ptr[1]));
+            }
+        }
+        else if ( j==1 )
+        {
+            // haploid
+            if ( bcf_gt_is_missing(ptr[0]) )
+                kputs("? -", str);
+            else if ( bcf_gt_allele(ptr[0])==1 )
+                kputs("1 -", str);       // first ALT allele
+            else
+                kputs("0 -", str);       // REF or something else than first ALT
+        }
+        else error("FIXME: not ready for ploidy %d\n", j);
+    }
+}
+static void process_gt_to_hap2(convert_t *convert, bcf1_t *line, fmt_t *fmt, int isample, kstring_t *str)
+{
+    // same as process_gt_to_hap but converts haploid genotypes into diploid
+    int m, n, i;
+
+    m = convert->ndat / sizeof(int32_t);
+    n = bcf_get_genotypes(convert->header, line, &convert->dat, &m);
+    convert->ndat = m * sizeof(int32_t);
+
+    if ( n<=0 )
+        error("Error parsing GT tag at %s:%d\n", bcf_seqname(convert->header, line), line->pos+1);
+
+    n /= convert->nsamples;
+    for (i=0; i<convert->nsamples; i++)
+    {
+        int32_t *ptr = (int32_t*)convert->dat + i*n;
+        int j;
+        for (j=0; j<n; j++)
+            if ( ptr[j]==bcf_int32_vector_end ) break;
+
+        if (i>0) kputs(" ", str); // no space separation for first column
+        if ( j==2 )
+        {
+            // diploid
+            if ( bcf_gt_is_missing(ptr[0]) || bcf_gt_is_missing(ptr[1]) ) {
+                kputs("? ?", str);
+            }
+            else if ( bcf_gt_is_phased(ptr[1])) {
+                ksprintf(str, "%d %d", bcf_gt_allele(ptr[0]), bcf_gt_allele(ptr[1]));
+            }
+            else {
+                ksprintf(str, "%d* %d*", bcf_gt_allele(ptr[0]), bcf_gt_allele(ptr[1]));
+            }
+        }
+        else if ( j==1 )
+        {
+            // haploid
+            if ( bcf_gt_is_missing(ptr[0]) )
+                kputs("? ?", str);
+            else if ( bcf_gt_allele(ptr[0])==1 )
+                kputs("1 1", str);       // first ALT allele
+            else
+                kputs("0 0", str);       // REF or something else than first ALT
+        }
+        else error("FIXME: not ready for ploidy %d\n", j);
+    }
+}
+
+static fmt_t *register_tag(convert_t *convert, int type, char *key, int is_gtf)
+{
+    convert->nfmt++;
+    if ( convert->nfmt > convert->mfmt )
+    {
+        convert->mfmt += 10;
+        convert->fmt   = (fmt_t*) realloc(convert->fmt, convert->mfmt*sizeof(fmt_t));
+    }
+    fmt_t *fmt = &convert->fmt[ convert->nfmt-1 ];
+    fmt->type  = type;
+    fmt->key   = key ? strdup(key) : NULL;
+    fmt->is_gt_field = is_gtf;
+    fmt->subscript = -1;
+
+    // Allow non-format tags, such as CHROM, INFO, etc., to appear amongst the format tags.
+    if ( key )
+    {
+        int id = bcf_hdr_id2int(convert->header, BCF_DT_ID, key);
+        if ( fmt->type==T_FORMAT && !bcf_hdr_idinfo_exists(convert->header,BCF_HL_FMT,id) )
+        {
+            if ( !strcmp("CHROM",key) ) { fmt->type = T_CHROM; }
+            else if ( !strcmp("POS",key) ) { fmt->type = T_POS; }
+            else if ( !strcmp("ID",key) ) { fmt->type = T_ID; }
+            else if ( !strcmp("REF",key) ) { fmt->type = T_REF; }
+            else if ( !strcmp("ALT",key) ) { fmt->type = T_ALT; }
+            else if ( !strcmp("FIRST_ALT",key) ) { fmt->type = T_FIRST_ALT; }
+            else if ( !strcmp("QUAL",key) ) { fmt->type = T_QUAL; }
+            else if ( !strcmp("FILTER",key) ) { fmt->type = T_FILTER; }
+            else if ( !strcmp("_CHROM_POS_ID",key) ) { fmt->type = T_CHROM_POS_ID; }
+            else if ( id>=0 && bcf_hdr_idinfo_exists(convert->header,BCF_HL_INFO,id) )
+            {
+                fmt->type = T_INFO;
+                fprintf(stderr,"Warning: Assuming INFO/%s\n", key);
+            }
+        }
+    }
+
+    switch (fmt->type)
+    {
+        case T_FIRST_ALT: fmt->handler = &process_first_alt; break;
+        case T_CHROM_POS_ID: fmt->handler = &process_chrom_pos_id; break;
+        case T_GT_TO_PROB3: fmt->handler = &process_gt_to_prob3; break;
+        case T_PL_TO_PROB3: fmt->handler = &process_pl_to_prob3; break;
+        case T_GP_TO_PROB3: fmt->handler = &process_gp_to_prob3; break;
+        case T_CHROM: fmt->handler = &process_chrom; break;
+        case T_POS: fmt->handler = &process_pos; break;
+        case T_ID: fmt->handler = &process_id; break;
+        case T_REF: fmt->handler = &process_ref; break;
+        case T_ALT: fmt->handler = &process_alt; break;
+        case T_QUAL: fmt->handler = &process_qual; break;
+        case T_FILTER: fmt->handler = &process_filter; convert->max_unpack |= BCF_UN_FLT; break;
+        case T_INFO: fmt->handler = &process_info; convert->max_unpack |= BCF_UN_INFO; break;
+        case T_FORMAT: fmt->handler = &process_format; convert->max_unpack |= BCF_UN_FMT; break;
+        case T_SAMPLE: fmt->handler = &process_sample; break;
+        case T_SEP: fmt->handler = &process_sep; break;
+        case T_IS_TS: fmt->handler = &process_is_ts; break;
+        case T_TYPE: fmt->handler = &process_type; break;
+        case T_MASK: fmt->handler = NULL; break;
+        case T_GT: fmt->handler = &process_gt; convert->max_unpack |= BCF_UN_FMT; break;
+        case T_TGT: fmt->handler = &process_tgt; convert->max_unpack |= BCF_UN_FMT; break;
+        case T_IUPAC_GT: fmt->handler = &process_iupac_gt; convert->max_unpack |= BCF_UN_FMT; break;
+        case T_GT_TO_HAP: fmt->handler = &process_gt_to_hap; convert->max_unpack |= BCF_UN_FMT; break;
+        case T_GT_TO_HAP2: fmt->handler = &process_gt_to_hap2; convert->max_unpack |= BCF_UN_FMT; break;
+        case T_LINE: fmt->handler = &process_line; break;
+        default: error("TODO: handler for type %d\n", fmt->type);
+    }
+    if ( key )
+    {
+        if ( fmt->type==T_INFO )
+        {
+            fmt->id = bcf_hdr_id2int(convert->header, BCF_DT_ID, key);
+            if ( fmt->id==-1 ) error("Error: no such tag defined in the VCF header: INFO/%s\n", key);
+        }
+    }
+    return fmt;
+}
+
+static int parse_subscript(char **p)
+{
+    char *q = *p;
+    if ( *q!='{' ) return -1;
+    q++;
+    while ( *q && *q!='}' && isdigit(*q) ) q++;
+    if ( *q!='}' ) return -1;
+    int idx = atoi((*p)+1);
+    *p = q+1;
+    return idx;
+}
+
+static char *parse_tag(convert_t *convert, char *p, int is_gtf)
+{
+    char *q = ++p;
+    while ( *q && (isalnum(*q) || *q=='_' || *q=='.') ) q++;
+    kstring_t str = {0,0,0};
+    if ( q-p==0 ) error("Could not parse format string: %s\n", convert->format_str);
+    kputsn(p, q-p, &str);
+    if ( is_gtf )
+    {
+        if ( !strcmp(str.s, "SAMPLE") ) register_tag(convert, T_SAMPLE, "SAMPLE", is_gtf);
+        else if ( !strcmp(str.s, "GT") ) register_tag(convert, T_GT, "GT", is_gtf);
+        else if ( !strcmp(str.s, "TGT") ) register_tag(convert, T_TGT, "GT", is_gtf);
+        else if ( !strcmp(str.s, "IUPACGT") ) register_tag(convert, T_IUPAC_GT, "GT", is_gtf);
+        else
+        {
+            fmt_t *fmt = register_tag(convert, T_FORMAT, str.s, is_gtf);
+            fmt->subscript = parse_subscript(&q);
+        }
+    }
+    else
+    {
+        if ( !strcmp(str.s, "CHROM") ) register_tag(convert, T_CHROM, str.s, is_gtf);
+        else if ( !strcmp(str.s, "POS") ) register_tag(convert, T_POS, str.s, is_gtf);
+        else if ( !strcmp(str.s, "ID") ) register_tag(convert, T_ID, str.s, is_gtf);
+        else if ( !strcmp(str.s, "REF") ) register_tag(convert, T_REF, str.s, is_gtf);
+        else if ( !strcmp(str.s, "ALT") ) 
+        {
+            fmt_t *fmt = register_tag(convert, T_ALT, str.s, is_gtf);
+            fmt->subscript = parse_subscript(&q);
+        }
+        else if ( !strcmp(str.s, "FIRST_ALT") ) register_tag(convert, T_FIRST_ALT, str.s, is_gtf);
+        else if ( !strcmp(str.s, "QUAL") ) register_tag(convert, T_QUAL, str.s, is_gtf);
+        else if ( !strcmp(str.s, "FILTER") ) register_tag(convert, T_FILTER, str.s, is_gtf);
+        else if ( !strcmp(str.s, "QUAL") ) register_tag(convert, T_QUAL, str.s, is_gtf);
+        else if ( !strcmp(str.s, "IS_TS") ) register_tag(convert, T_IS_TS, str.s, is_gtf);
+        else if ( !strcmp(str.s, "TYPE") ) register_tag(convert, T_TYPE, str.s, is_gtf);
+        else if ( !strcmp(str.s, "MASK") ) register_tag(convert, T_MASK, str.s, is_gtf);
+        else if ( !strcmp(str.s, "LINE") ) register_tag(convert, T_LINE, str.s, is_gtf);
+        else if ( !strcmp(str.s, "_CHROM_POS_ID") ) register_tag(convert, T_CHROM_POS_ID, str.s, is_gtf);
+        else if ( !strcmp(str.s, "_GT_TO_PROB3") ) register_tag(convert, T_GT_TO_PROB3, str.s, is_gtf);
+        else if ( !strcmp(str.s, "_PL_TO_PROB3") ) register_tag(convert, T_PL_TO_PROB3, str.s, is_gtf);
+        else if ( !strcmp(str.s, "_GP_TO_PROB3") ) register_tag(convert, T_GP_TO_PROB3, str.s, is_gtf);
+        else if ( !strcmp(str.s, "_GT_TO_HAP") ) register_tag(convert, T_GT_TO_HAP, str.s, is_gtf);
+        else if ( !strcmp(str.s, "_GT_TO_HAP2") ) register_tag(convert, T_GT_TO_HAP2, str.s, is_gtf);
+        else if ( !strcmp(str.s, "INFO") )
+        {
+            if ( *q!='/' ) error("Could not parse format string: %s\n", convert->format_str);
+            p = ++q;
+            str.l = 0;
+            while ( *q && (isalnum(*q) || *q=='_' || *q=='.') ) q++;
+            if ( q-p==0 ) error("Could not parse format string: %s\n", convert->format_str);
+            kputsn(p, q-p, &str);
+            fmt_t *fmt = register_tag(convert, T_INFO, str.s, is_gtf);
+            fmt->subscript = parse_subscript(&q);
+        }
+        else
+        {
+            fmt_t *fmt = register_tag(convert, T_INFO, str.s, is_gtf);
+            fmt->subscript = parse_subscript(&q);
+        }
+    }
+    free(str.s);
+    return q;
+}
+
+static char *parse_sep(convert_t *convert, char *p, int is_gtf)
+{
+    char *q = p;
+    kstring_t str = {0,0,0};
+    while ( *q && *q!='[' && *q!=']' && *q!='%' )
+    {
+        if ( *q=='\\' )
+        {
+            q++;
+            if ( *q=='n' ) kputc('\n', &str);
+            else if ( *q=='t' ) kputc('\t', &str);
+            else kputc(*q, &str);
+        }
+        else kputc(*q, &str);
+        q++;
+    }
+    if ( !str.l ) error("Could not parse format string: %s\n", convert->format_str);
+    register_tag(convert, T_SEP, str.s, is_gtf);
+    free(str.s);
+    return q;
+}
+
+convert_t *convert_init(bcf_hdr_t *hdr, int *samples, int nsamples, const char *format_str)
+{
+    convert_t *convert = (convert_t*) calloc(1,sizeof(convert_t));
+    convert->header = hdr;
+    convert->format_str = strdup(format_str);
+
+    int i, is_gtf = 0;
+    char *p = convert->format_str;
+    while ( *p )
+    {
+        //fprintf(stderr,"<%s>\n", p);
+        switch (*p)
+        {
+            case '[': is_gtf = 1; p++; break;
+            case ']': is_gtf = 0; register_tag(convert, T_SEP, NULL, 0); p++; break;
+            case '%': p = parse_tag(convert, p, is_gtf); break;
+            default:  p = parse_sep(convert, p, is_gtf); break;
+        }
+    }
+
+    if ( nsamples )
+    {
+        convert->nsamples = nsamples;
+        convert->samples = (int*) malloc(sizeof(int)*nsamples);
+        for (i=0; i<convert->nsamples; i++) convert->samples[i] = samples[i];
+    }
+    else
+    {
+        convert->nsamples = bcf_hdr_nsamples(convert->header);
+        convert->samples = (int*) malloc(sizeof(int)*convert->nsamples);
+        for (i=0; i<convert->nsamples; i++) convert->samples[i] = i;
+    }
+    return convert;
+}
+
+void convert_destroy(convert_t *convert)
+{
+    int i;
+    for (i=0; i<convert->nfmt; i++)
+        if ( convert->fmt[i].key ) free(convert->fmt[i].key);
+    if ( convert->mfmt ) free(convert->fmt);
+    free(convert->dat);
+    free(convert->samples);
+    free(convert->format_str);
+    free(convert);
+}
+
+
+int convert_header(convert_t *convert, kstring_t *str)
+{
+    int i, icol = 0, l_ori = str->l;
+    bcf_hdr_t *hdr = convert->header;
+
+    // Supress the header output if LINE is present
+    for (i=0; i<convert->nfmt; i++)
+        if ( convert->fmt[i].type == T_LINE ) break;
+    if ( i!=convert->nfmt )
+        return str->l - l_ori;
+
+    kputs("# ", str);
+    for (i=0; i<convert->nfmt; i++)
+    {
+        // Genotype fields
+        if ( convert->fmt[i].is_gt_field )
+        {
+            int j = i, js, k;
+            while ( convert->fmt[j].is_gt_field ) j++;
+            for (js=0; js<convert->nsamples; js++)
+            {
+                int ks = convert->samples[js];
+                for (k=i; k<j; k++)
+                {
+                    if ( convert->fmt[k].type == T_SEP )
+                    {
+                        if ( convert->fmt[k].key ) kputs(convert->fmt[k].key, str);
+                    }
+                    else if ( convert->fmt[k].type == T_SAMPLE )
+                        ksprintf(str, "[%d]%s", ++icol, convert->fmt[k].key);
+                    else
+                        ksprintf(str, "[%d]%s:%s", ++icol, hdr->samples[ks], convert->fmt[k].key);
+                }
+            }
+            i = j-1;
+            continue;
+        }
+        // Fixed fields
+        if ( convert->fmt[i].type == T_SEP )
+        {
+            if ( convert->fmt[i].key ) kputs(convert->fmt[i].key, str);
+            continue;
+        }
+        ksprintf(str, "[%d]%s", ++icol, convert->fmt[i].key);
+    }
+    return str->l - l_ori;
+}
+
+int convert_line(convert_t *convert, bcf1_t *line, kstring_t *str)
+{
+    int l_ori = str->l;
+    bcf_unpack(line, convert->max_unpack);
+
+    int i, ir;
+    str->l = 0;
+    for (i=0; i<convert->nfmt; i++)
+    {
+        // Genotype fields
+        if ( convert->fmt[i].is_gt_field )
+        {
+            int j = i, js, k;
+            while ( convert->fmt[j].is_gt_field )
+            {
+                convert->fmt[j].ready = 0;
+                j++;
+            }
+            for (js=0; js<convert->nsamples; js++)
+            {
+                int ks = convert->samples[js];
+                for (k=i; k<j; k++)
+                {
+                    if ( convert->fmt[k].type == T_MASK )
+                    {
+                        for (ir=0; ir<convert->nreaders; ir++)
+                            kputc(bcf_sr_has_line(convert->readers,ir)?'1':'0', str);
+                    }
+                    else if ( convert->fmt[k].handler )
+                        convert->fmt[k].handler(convert, line, &convert->fmt[k], ks, str);
+                }
+            }
+            i = j-1;
+            continue;
+        }
+        // Fixed fields
+        if ( convert->fmt[i].type == T_MASK )
+        {
+            for (ir=0; ir<convert->nreaders; ir++)
+                kputc(bcf_sr_has_line(convert->readers,ir)?'1':'0', str);
+        }
+        else if ( convert->fmt[i].handler )
+            convert->fmt[i].handler(convert, line, &convert->fmt[i], -1, str);
+    }
+    return str->l - l_ori;
+}
+
diff --git a/convert.h b/convert.h
new file mode 100644
index 0000000..72e375c
--- /dev/null
+++ b/convert.h
@@ -0,0 +1,38 @@
+/*  convert.h -- functions for converting between VCF/BCF and related formats.
+
+    Copyright (C) 2014 Genome Research Ltd.
+
+    Author: Petr Danecek <pd3 at sanger.ac.uk>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.  */
+
+#ifndef __CONVERT_H__
+#define __CONVERT_H__
+
+#include <htslib/vcf.h>
+
+typedef struct _convert_t convert_t;
+
+convert_t *convert_init(bcf_hdr_t *hdr, int *samples, int nsamples, const char *str);
+void convert_destroy(convert_t *convert);
+int convert_header(convert_t *convert, kstring_t *str);
+int convert_line(convert_t *convert, bcf1_t *rec, kstring_t *str);
+
+#endif
+
diff --git a/doc/bcftools.1 b/doc/bcftools.1
new file mode 100644
index 0000000..dc03dc6
--- /dev/null
+++ b/doc/bcftools.1
@@ -0,0 +1,3242 @@
+'\" t
+.\"     Title: bcftools
+.\"    Author: [see the "AUTHORS" section]
+.\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
+.\"      Date: 2015-01-21 15:01 GMT
+.\"    Manual: \ \&
+.\"    Source: \ \&
+.\"  Language: English
+.\"
+.TH "BCFTOOLS" "1" "2015\-01\-21 15:01 GMT" "\ \&" "\ \&"
+.\" -----------------------------------------------------------------
+.\" * Define some portability stuff
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" http://bugs.debian.org/507673
+.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.ie \n(.g .ds Aq \(aq
+.el       .ds Aq '
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+bcftools \- utilities for variant calling and manipulating VCFs and BCFs\&.
+.SH "SYNOPSIS"
+.sp
+\fBbcftools\fR [\fICOMMAND\fR] [\fIOPTIONS\fR]
+.SH "DESCRIPTION"
+.sp
+BCFtools is a set of utilities that manipulate variant calls in the Variant Call Format (VCF) and its binary counterpart BCF\&. All commands work transparently with both VCFs and BCFs, both uncompressed and BGZF\-compressed\&.
+.sp
+Most commands accept VCF, bgzipped VCF and BCF with filetype detected automatically even when streaming from a pipe\&. Indexed VCF and BCF will work in all situations\&. Un\-indexed VCF and BCF and streams will work in most, but not all situations\&.
+.sp
+BCFtools is designed to work on a stream\&. It regards an input file "\-" as the standard input (stdin) and outputs to the standard output (stdout)\&. Several commands can thus be combined with Unix pipes\&.
+.SS "VERSION"
+.sp
+This manual page was last updated \fB2015\-01\-21 15:01 GMT\fR and refers to bcftools git version \fB1\&.1\-140\-g9b0e7cc+\fR\&.
+.SS "BCF1"
+.sp
+The BCF1 format output by versions of samtools <= 0\&.1\&.19 is \fBnot\fR compatible with this version of bcftools\&. To read BCF1 files one can use the view command from old versions of bcftools packaged with samtools versions <= 0\&.1\&.19 to convert to VCF, which can then be read by this version of bcftools\&.
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+    samtools\-0\&.1\&.19/bcftools/bcftools view file\&.bcf1 | bcftools view
+.fi
+.if n \{\
+.RE
+.\}
+.SS "VARIANT CALLING"
+.sp
+See \fIbcftools call\fR for variant calling from the output of the \fIsamtools mpileup\fR command\&. In versions of samtools <= 0\&.1\&.19 calling was done with \fIbcftools view\fR\&. Users are now required to choose between the old samtools calling model (\fI\-c/\-\-consensus\-caller\fR) and the new multiallelic calling model (\fI\-m/\-\-multiallelic\-caller\fR)\&. The multiallelic calling model is recommended for most tasks\&.
+.SH "LIST OF COMMANDS"
+.sp
+For a full list of available commands, run \fBbcftools\fR without arguments\&. For a full list of available options, run \fBbcftools\fR \fICOMMAND\fR without arguments\&.
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+
+\fBannotate\fR
+\&.\&. edit VCF files, add or remove annotations
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+
+\fBcall\fR
+\&.\&. SNP/indel calling (former "view")
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+
+\fBconcat\fR
+\&.\&. concatenate VCF/BCF files from the same set of samples
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+
+\fBconsensus\fR
+\&.\&. create consensus sequence by applying VCF variants
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+
+\fBconvert\fR
+\&.\&. convert VCF/BCF to other formats and back
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+
+\fBfilter\fR
+\&.\&. filter VCF/BCF files using fixed thresholds
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+
+\fBgtcheck\fR
+\&.\&. check sample concordance, detect sample swaps and contamination
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+
+\fBindex\fR
+\&.\&. index VCF/BCF
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+
+\fBisec\fR
+\&.\&. intersections of VCF/BCF files
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+
+\fBmerge\fR
+\&.\&. merge VCF/BCF files files from non\-overlapping sample sets
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+
+\fBnorm\fR
+\&.\&. normalize indels
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+
+\fBplugin\fR
+\&.\&. run user\-defined plugin
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+
+\fBquery\fR
+\&.\&. transform VCF/BCF into user\-defined formats
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+
+\fBreheader\fR
+\&.\&. modify VCF/BCF header, change sample names
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+
+\fBroh\fR
+\&.\&. identify runs of homo/auto\-zygosity
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+
+\fBstats\fR
+\&.\&. produce VCF/BCF stats (former vcfcheck)
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+
+\fBview\fR
+\&.\&. subset, filter and convert VCF and BCF files
+.RE
+.SH "LIST OF SCRIPTS"
+.sp
+Some helper scripts are bundled with the bcftools code\&.
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+
+\fBplot\-vcfstats\fR
+\&.\&. plots the output of
+\fBstats\fR
+.RE
+.SH "COMMANDS AND OPTIONS"
+.SS "Common Options"
+.sp
+The following options are common to many bcftools commands\&. See usage for specific commands to see if they apply\&.
+.PP
+\fIFILE\fR
+.RS 4
+Files can be both VCF or BCF, uncompressed or BGZF\-compressed\&. The file "\-" is interpreted as standard input\&. Some tools may require tabix\- or CSI\-indexed files\&.
+.RE
+.PP
+\fB\-c, \-\-collapse\fR \fIsnps\fR|\fIindels\fR|\fIboth\fR|\fIall\fR|\fIsome\fR|\fInone\fR|\fIid\fR
+.RS 4
+Controls how to treat records with duplicate positions and defines compatible records across multiple input files\&. Here by "compatible" we mean records which should be considered as identical by the tools\&. For example, when performing line intersections, the desire may be to consider as identical all sites with matching positions (\fBbcftools isec \-c\fR
+\fIall\fR), or only sites with matching variant type (\fBbcftools isec \-c\fR
+\fIsnps\fR\ \&
+\fB\-c\fR
+\fIindels\fR), or only sites with all alleles identical (\fBbcftools isec \-c\fR
+\fInone\fR)\&.
+.PP
+\fInone\fR
+.RS 4
+only records with identical REF and ALT alleles are compatible
+.RE
+.PP
+\fIsome\fR
+.RS 4
+only records where some subset of ALT alleles match are compatible
+.RE
+.PP
+\fIall\fR
+.RS 4
+all records are compatible, regardless of whether the ALT alleles match or not\&. In the case of records with the same position, only the first will be considered and appear on output\&.
+.RE
+.PP
+\fIsnps\fR
+.RS 4
+any SNP records are compatible, regardless of whether the ALT alleles match or not\&. For duplicate positions, only the first SNP record will be considered and appear on output\&.
+.RE
+.PP
+\fIindels\fR
+.RS 4
+all indel records are compatible, regardless of whether the REF and ALT alleles match or not\&. For duplicate positions, only the first indel record will be considered and appear on output\&.
+.RE
+.PP
+\fIboth\fR
+.RS 4
+abbreviation of "\fB\-c\fR
+\fIindels\fR\ \&
+\fB\-c\fR
+\fIsnps\fR"
+.RE
+.PP
+\fIid\fR
+.RS 4
+only records with identical ID column are compatible\&. Supported by
+\fBbcftools merge\fR
+only\&.
+.RE
+.RE
+.PP
+\fB\-f, \-\-apply\-filters\fR \fILIST\fR
+.RS 4
+Skip sites where FILTER column does not contain any of the strings listed in
+\fILIST\fR\&. For example, to include only sites which have no filters set, use
+\fB\-f\fR
+\fI\&.,PASS\fR\&.
+.RE
+.PP
+\fB\-o, \-\-output\fR \fIFILE\fR
+.RS 4
+When output consists of a single stream, write it to
+\fIFILE\fR
+rather than to standard output, where it is written by default\&.
+.RE
+.PP
+\fB\-O, \-\-output\-type\fR \fIb\fR|\fIu\fR|\fIz\fR|\fIv\fR
+.RS 4
+Output compressed BCF (\fIb\fR), uncompressed BCF (\fIu\fR), compressed VCF (\fIz\fR), uncompressed VCF (\fIv\fR)\&.
+.RE
+.PP
+\fB\-r, \-\-regions\fR \fIchr\fR|\fIchr:pos\fR|\fIchr:from\-to\fR|\fIchr:from\-\fR[,\&...]
+.RS 4
+Comma\-separated list of regions, see also
+\fB\-R, \-\-regions\-file\fR\&. Note that
+\fB\-r\fR
+cannot be used in combination with
+\fB\-R\fR\&.
+.RE
+.PP
+\fB\-R, \-\-regions\-file\fR \fIFILE\fR
+.RS 4
+Regions can be specified either on command line or in a VCF, BED, or tab\-delimited file (the default)\&. The columns of the tab\-delimited file are: CHROM, POS, and, optionally, POS_TO, where positions are 1\-based and inclusive\&. Uncompressed files are stored in memory, while bgzip\-compressed and tabix\-indexed region files are streamed\&. Note that sequence names must match exactly, "chr20" is not the same as "20"\&. Also note that chromosome ordering in
+\fIFILE\fR
+will be respected, the VCF will be processed in the order in which chromosomes first appear in
+\fIFILE\fR\&. However, within chromosomes, the VCF will always be processed in ascending genomic coordinate order no matter what order they appear in
+\fIFILE\fR\&. Note that overlapping regions in
+\fIFILE\fR
+can result in duplicated out of order positions in the output\&. This option requires indexed VCF/BCF files\&. Note that
+\fB\-R\fR
+cannot be used in combination with
+\fB\-r\fR\&.
+.RE
+.PP
+\fB\-s, \-\-samples\fR [^]\fILIST\fR
+.RS 4
+Comma\-separated list of samples to include or exclude if prefixed with "^"\&.
+.RE
+.PP
+\fB\-S, \-\-samples\-file\fR \fIFILE\fR
+.RS 4
+File of sample names to include or exclude if prefixed with "^"\&. One sample per line\&. The command
+\fBbcftools call\fR
+accepts an optional second column indicating ploidy (0, 1 or 2) and can parse also PED files\&. With
+\fBbcftools call\fR\fB \-C\fR
+\fItrio\fR, PED file is expected\&.
+.RE
+.PP
+\fB\-t, \-\-targets\fR [^]\fIchr\fR|\fIchr:pos\fR|\fIchr:from\-to\fR|\fIchr:from\-\fR[,\&...]
+.RS 4
+Similar as
+\fB\-r, \-\-regions\fR, but the next position is accessed by streaming the whole VCF/BCF rather than using the tbi/csi index\&. Both
+\fB\-r\fR
+and
+\fB\-t\fR
+options can be applied simultaneously:
+\fB\-r\fR
+uses the index to jump to a region and
+\fB\-t\fR
+discards positions which are not in the targets\&. Unlike
+\fB\-r\fR, targets can be prefixed with "^" to request logical complement\&. For example, "^X,Y,MT" indicates that sequences X, Y and MT should be skipped\&. Yet another difference between the two is that
+\fB\-r\fR
+checks both start and end positions of indels, whereas
+\fB\-t\fR
+checks start positions only\&. Note that
+\fB\-t\fR
+cannot be used in combination with
+\fB\-T\fR\&.
+.RE
+.PP
+\fB\-T, \-\-targets\-file\fR [^]\fIFILE\fR
+.RS 4
+Same
+\fB\-t, \-\-targets\fR, but reads regions from a file\&. Note that
+\fB\-T\fR
+cannot be used in combination with
+\fB\-t\fR\&.
+.RE
+.PP
+.RS 4
+With the
+\fBcall \-C\fR
+\fIalleles\fR
+command, third column of the targets file must be comma\-separated list of alleles, starting with the reference allele\&. Such a file can be easily created from a VCF using:
+.RE
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+    bcftools query \-f\*(Aq%CHROM\et%POS\et%REF,%ALT\en\*(Aq file\&.vcf
+.fi
+.if n \{\
+.RE
+.\}
+.SS "bcftools annotate \fI[OPTIONS]\fR \fIFILE\fR"
+.sp
+This command allows to add or remove annotations\&.
+.PP
+\fB\-a, \-\-annotations\fR \fIfile\fR
+.RS 4
+Bgzip\-compressed and tabix\-indexed file with annotations\&. The file can be VCF, BED, or a tab\-delimited file with mandatory columns CHROM, POS (or, alternatively, FROM and TO), optional columns REF and ALT, and arbitrary number of annotation columns\&. BED files are expected to have the "\&.bed" or "\&.bed\&.gz" suffix (case\-insensitive), otherwise a tab\-delimited file is assumed\&. Note that in case of tab\-delimited file, the coordinates POS, FROM and TO are one\-based and inclus [...]
+\fB\-c, \-\-columns\fR
+and
+\fB\-h, \-\-header\-lines\fR\&.
+.RE
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+    # Sample annotation file with columns CHROM, POS, STRING_TAG, NUMERIC_TAG
+    1  752566  SomeString      5
+    1  798959  SomeOtherString 6
+    # etc\&.
+.fi
+.if n \{\
+.RE
+.\}
+.PP
+\fB\-c, \-\-columns\fR \fIlist\fR
+.RS 4
+Comma\-separated list of columns or tags to carry over from the annotation file (see also
+\fB\-a, \-\-annotations\fR)\&. If the annotation file is not a VCF/BCF,
+\fIlist\fR
+describes the columns of the annotation file and must include CHROM, POS (or, alternatively, FROM and TO), and optionally REF and ALT\&. Unused columns which should be ignored can be indicated by "\-"\&. If the annotation file is a VCF/BCF, only the edited columns/tags must be present and their order does not matter\&. The columns ID, QUAL, FILTER, INFO and FORMAT can be edited, where INFO tags can be written both as "INFO/TAG" or simply "TAG", and FORMAT tags can be written as "FORMAT/T [...]
+\fB\-h, \-\-header\-lines\fR\&.
+.RE
+.PP
+\fB\-e, \-\-exclude\fR \fIEXPRESSION\fR
+.RS 4
+exclude sites for which
+\fIEXPRESSION\fR
+is true\&. For valid expressions see
+\fBEXPRESSIONS\fR\&.
+.RE
+.PP
+\fB\-h, \-\-header\-lines\fR \fIfile\fR
+.RS 4
+Lines to append to the VCF header, see also
+\fB\-c, \-\-columns\fR
+and
+\fB\-a, \-\-annotations\fR\&. For example:
+.RE
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+    ##INFO=<ID=NUMERIC_TAG,Number=1,Type=Integer,Description="Example header line">
+    ##INFO=<ID=STRING_TAG,Number=1,Type=String,Description="Yet another header line">
+.fi
+.if n \{\
+.RE
+.\}
+.PP
+\fB\-I, \-\-set\-id\fR [+]\fIFORMAT\fR
+.RS 4
+assign ID on the fly\&. The format is the same as in the
+\fBquery\fR
+command (see below)\&. By default all existing IDs are replaced\&. If the format string is preceded by "+", only missing IDs will be set\&. For example, one can use
+.RE
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+    bcftools annotate \-\-set\-id +\*(Aq%CHROM\e_%POS\e_%REF\e_%FIRST_ALT\*(Aq file\&.vcf
+.fi
+.if n \{\
+.RE
+.\}
+.PP
+\fB\-i, \-\-include\fR \fIEXPRESSION\fR
+.RS 4
+include only sites for which
+\fIEXPRESSION\fR
+is true\&. For valid expressions see
+\fBEXPRESSIONS\fR\&.
+.RE
+.PP
+\fB\-o, \-\-output\fR \fIFILE\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-O, \-\-output\-type\fR \fIb\fR|\fIu\fR|\fIz\fR|\fIv\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-r, \-\-regions\fR \fIchr\fR|\fIchr:pos\fR|\fIchr:from\-to\fR|\fIchr:from\-\fR[,\&...]
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-R, \-\-regions\-file\fR \fIfile\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-\-rename\-chrs\fR \fIfile\fR
+.RS 4
+rename chromosomes according to the map in
+\fIfile\fR, with "old_name new_name\en" pairs separated by whitespaces, each on a separate line\&.
+.RE
+.PP
+\fB\-s, \-\-samples\fR [^]\fILIST\fR
+.RS 4
+subset of samples to annotate, see also
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-S, \-\-samples\-file\fR \fIFILE\fR
+.RS 4
+subset of samples to annotate\&. If the samples are named differently in the target VCF and the
+\fB\-a, \-\-annotations\fR
+VCF, the name mapping can be given as "src_name dst_name\en", separated by whitespaces, each pair on a separate line\&.
+.RE
+.PP
+\fB\-x, \-\-remove\fR \fIlist\fR
+.RS 4
+List of annotations to remove\&. Use "FILTER" to remove all filters or "FILTER/SomeFilter" to remove a specific filter\&. Similarly, "INFO" can be used to remove all INFO tags and "FORMAT" to remove all FORMAT tags except GT\&. To remove all INFO tags except "FOO" and "BAR", use "^INFO/FOO,INFO/BAR" (and similarly for FORMAT and FILTER)\&. "INFO" can be abbreviated to "INF" and "FORMAT" to "FMT"\&.
+.RE
+.sp
+\fBExamples:\fR
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+    # Remove three fields
+    bcftools annotate \-x ID,INFO/DP,FORMAT/DP file\&.vcf\&.gz
+
+    # Remove all INFO fields and all FORMAT fields except for GT and PL
+    bcftools annotate \-x INFO,^FORMAT/GT,FORMAT/PL file\&.vcf
+
+    # Add ID, QUAL and INFO/TAG, not replacing TAG if already present
+    bcftools annotate \-a src\&.bcf \-c ID,QUAL,+TAG dst\&.bcf
+
+    # Carry over all INFO and FORMAT annotations except FORMAT/GT
+    bcftools annotate \-a src\&.bcf \-c INFO,^FORMAT/GT dst\&.bcf
+
+    # Annotate from a tab\-delimited file with six columns (the fifth is ignored),
+    # first indexing with tabix\&. The coordinates are 1\-based\&.
+    tabix \-s1 \-b2 \-e2 annots\&.tab\&.gz
+    bcftools annotate \-a annots\&.tab\&.gz \-h annots\&.hdr \-c CHROM,POS,REF,ALT,\-,TAG file\&.vcf
+
+    # Annotate from a tab\-delimited file with regions (1\-based coordinates, inclusive)
+    tabix \-s1 \-b2 \-e3 annots\&.tab\&.gz
+    bcftools annotate \-a annots\&.tab\&.gz \-h annots\&.hdr \-c CHROM,FROM,TO,TAG inut\&.vcf
+
+    # Annotate from a bed file (0\-based coordinates, half\-closed, half\-open intervals)
+    bcftools annotate \-a annots\&.bed\&.gz \-h annots\&.hdr \-c CHROM,FROM,TO,TAG input\&.vcf
+.fi
+.if n \{\
+.RE
+.\}
+.SS "bcftools call \fI[OPTIONS]\fR \fIFILE\fR"
+.sp
+This command replaces the former \fBbcftools view\fR caller\&. Some of the original functionality has been temporarily lost in the process of transition under htslib, but will be added back on popular demand\&. The original calling model can be invoked with the \fB\-c\fR option\&.
+.sp
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.br
+.ps +1
+\fBFile format options:\fR
+.RS 4
+.PP
+\fB\-O, \-\-output\-type\fR \fIb\fR|\fIu\fR|\fIz\fR|\fIv\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-r, \-\-regions\fR \fIchr\fR|\fIchr:pos\fR|\fIchr:from\-to\fR|\fIchr:from\-\fR[,\&...]
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-R, \-\-regions\-file\fR \fIfile\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-s, \-\-samples\fR \fILIST\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-S, \-\-samples\-file\fR \fIFILE\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-t, \-\-targets\fR \fILIST\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-T, \-\-targets\-file\fR \fIFILE\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.RE
+.sp
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.br
+.ps +1
+\fBInput/output options:\fR
+.RS 4
+.PP
+\fB\-A, \-\-keep\-alts\fR
+.RS 4
+output all alternate alleles present in the alignments even if they do not appear in any of the genotypes
+.RE
+.PP
+\fB\-f, \-\-format\-fields\fR \fIlist\fR
+.RS 4
+comma\-separated list of FORMAT fields to output for each sample\&. Currently GQ and GP fields are supported\&. For convenience, the fields can be given as lower case letters\&.
+.RE
+.PP
+\fB\-g, \-\-gvcf\fR \fIINT\fR
+.RS 4
+output also gVCF blocks of homozygous REF calls\&. The parameter
+\fIINT\fR
+is the minimum per\-sample depth required to include a site in the non\-variant block\&.
+.RE
+.PP
+\fB\-M, \-\-keep\-masked\-ref\fR
+.RS 4
+output sites where REF allele is N
+.RE
+.PP
+\fB\-o, \-\-output\fR \fIFILE\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-V, \-\-skip\-variants\fR \fIsnps\fR|\fIindels\fR
+.RS 4
+skip indel/SNP sites
+.RE
+.PP
+\fB\-v, \-\-variants\-only\fR
+.RS 4
+output variant sites only
+.RE
+.RE
+.sp
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.br
+.ps +1
+\fBConsensus/variant calling options:\fR
+.RS 4
+.PP
+\fB\-c, \-\-consensus\-caller\fR
+.RS 4
+the original
+\fBsamtools\fR/\fBbcftools\fR
+calling method (conflicts with
+\fB\-m\fR)
+.RE
+.PP
+\fB\-C, \-\-constrain\fR \fIalleles\fR|\fItrio\fR
+.RS 4
+.PP
+\fIalleles\fR
+.RS 4
+call genotypes given alleles\&. See also
+\fB\-T, \-\-targets\-file\fR\&.
+.RE
+.PP
+\fItrio\fR
+.RS 4
+call genotypes given the father\-mother\-child constraint\&. See also
+\fB\-s, \-\-samples\fR
+and
+\fB\-n, \-\-novel\-rate\fR\&.
+.RE
+.RE
+.PP
+\fB\-m, \-\-multiallelic\-caller\fR
+.RS 4
+alternative modelfor multiallelic and rare\-variant calling designed to overcome known limitations in
+\fB\-c\fR
+calling model (conflicts with
+\fB\-c\fR)
+.RE
+.PP
+\fB\-n, \-\-novel\-rate\fR \fIfloat\fR[,\&...]
+.RS 4
+likelihood of novel mutation for constrained
+\fB\-C\fR
+\fItrio\fR
+calling\&. The trio genotype calling maximizes likelihood of a particular combination of genotypes for father, mother and the child P(F=i,M=j,C=k) = P(unconstrained) * Pn + P(constrained) * (1\-Pn)\&. By providing three values, the mutation rate Pn is set explictly for SNPs, deletions and insertions, respectively\&. If two values are given, the first is interpreted as the mutation rate of SNPs and the second is used to calculate the mutation rate of indels according to their length as Pn [...]
+.RE
+.PP
+\fB\-p, \-\-pval\-threshold\fR \fIfloat\fR
+.RS 4
+with
+\fB\-c\fR, accept variant if P(ref|D) <
+\fIfloat\fR\&.
+.RE
+.PP
+\fB\-P, \-\-prior\fR \fIfloat\fR
+.RS 4
+expected substitution rate, or 0 to disable the prior\&.
+.RE
+.PP
+\fB\-t, \-\-targets\fR \fIfile\fR|\fIchr\fR|\fIchr:pos\fR|\fIchr:from\-to\fR|\fIchr:from\-\fR[,\&...]
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-X, \-\-chromosome\-X\fR
+.RS 4
+haploid output for male samples (requires PED file with
+\fB\-s\fR)
+.RE
+.PP
+\fB\-Y, \-\-chromosome\-Y\fR
+.RS 4
+haploid output for males and skips females (requires PED file with
+\fB\-s\fR)
+.RE
+.RE
+.SS "bcftools concat \fI[OPTIONS]\fR \fIFILE1\fR \fIFILE2\fR [\&...]"
+.sp
+Concatenate or combine VCF/BCF files\&. All source files must have the same sample columns appearing in the same order\&. Can be used, for example, to concatenate chromosome VCFs into one VCF, or combine a SNP VCF and an indel VCF into one\&. The input files must be sorted by chr and position\&. The files must be given in the correct order to produce sorted VCF on output unless the \fB\-a, \-\-allow\-overlaps\fR option is specified\&.
+.PP
+\fB\-a, \-\-allow\-overlaps\fR
+.RS 4
+First coordinate of the next file can precede last record of the current file\&.
+.RE
+.PP
+\fB\-D, \-\-remove\-duplicates\fR
+.RS 4
+If a record is present in multiple files, output only the first instance\&. Requires
+\fB\-a, \-\-allow\-overlaps\fR\&.
+.RE
+.PP
+\fB\-f, \-\-file\-list\fR \fIFILE\fR
+.RS 4
+Read the list of files from a file\&.
+.RE
+.PP
+\fB\-l, \-\-ligate\fR
+.RS 4
+Ligate phased VCFs by matching phase at overlapping haplotypes
+.RE
+.PP
+\fB\-o, \-\-output\fR \fIFILE\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-O, \-\-output\-type\fR \fIb\fR|\fIu\fR|\fIz\fR|\fIv\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-q, \-\-min\-PQ\fR \fIINT\fR
+.RS 4
+Break phase set if phasing quality is lower than
+\fIINT\fR
+.RE
+.PP
+\fB\-r, \-\-regions\fR \fIchr\fR|\fIchr:pos\fR|\fIchr:from\-to\fR|\fIchr:from\-\fR[,\&...]
+.RS 4
+see
+\fBCommon Options\fR\&. Requires
+\fB\-a, \-\-allow\-overlaps\fR\&.
+.RE
+.PP
+\fB\-R, \-\-regions\-file\fR \fIFILE\fR
+.RS 4
+see
+\fBCommon Options\fR\&. Requires
+\fB\-a, \-\-allow\-overlaps\fR\&.
+.RE
+.SS "bcftools consensus \fI[OPTIONS]\fR \fIFILE\fR"
+.sp
+Create consensus sequence by applying VCF variants to a reference fasta file\&.
+.PP
+\fB\-f, \-\-fasta\-ref\fR \fIFILE\fR
+.RS 4
+reference sequence in fasta format
+.RE
+.PP
+\fB\-H, \-\-haplotype\fR \fI1\fR|\fI2\fR
+.RS 4
+apply variants for the given haplotype\&. This option requires
+\fB\-s\fR, unless exactly one sample is present in the VCF
+.RE
+.PP
+\fB\-i, \-\-iupac\-codes\fR
+.RS 4
+output variants in the form of IUPAC ambiguity codes
+.RE
+.PP
+\fB\-m, \-\-mask\fR \fIFILE\fR
+.RS 4
+BED file or TAB file with regions to be replaced with N\&. See discussion of
+\fB\-\-regions\-file\fR
+in
+\fBCommon Options\fR
+for file format details\&.
+.RE
+.PP
+\fB\-o, \-\-output\fR \fIFILE\fR
+.RS 4
+write output to a file
+.RE
+.PP
+\fB\-s, \-\-sample\fR \fINAME\fR
+.RS 4
+apply variants of the given sample
+.RE
+.sp
+\fBExamples:\fR
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+    # Apply variants present in sample "NA001", output IUPAC codes for hets
+    bcftools consensus \-i \-s NA001 \-f in\&.fa in\&.vcf\&.gz > out\&.fa
+
+    # Create consensus for one region\&. The fasta header lines are then expected
+    # in the form ">chr:from\-to"\&.
+    samtools faidx ref\&.fa 8:11870\-11890 | bcftools consensus in\&.vcf\&.gz \-o out\&.fa
+.fi
+.if n \{\
+.RE
+.\}
+.SS "bcftools convert \fI[OPTIONS]\fR \fIFILE\fR"
+.sp
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.br
+.ps +1
+\fBVCF input options:\fR
+.RS 4
+.PP
+\fB\-e, \-\-exclude\fR \fIEXPRESSION\fR
+.RS 4
+exclude sites for which
+\fIEXPRESSION\fR
+is true\&. For valid expressions see
+\fBEXPRESSIONS\fR\&.
+.RE
+.PP
+\fB\-i, \-\-include\fR \fIEXPRESSION\fR
+.RS 4
+include only sites for which
+\fIEXPRESSION\fR
+is true\&. For valid expressions see
+\fBEXPRESSIONS\fR\&.
+.RE
+.PP
+\fB\-r, \-\-regions\fR \fIchr\fR|\fIchr:pos\fR|\fIchr:from\-to\fR|\fIchr:from\-\fR[,\&...]
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-R, \-\-regions\-file\fR \fIFILE\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-s, \-\-samples\fR \fILIST\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-S, \-\-samples\-file\fR \fIFILE\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-t, \-\-targets\fR \fILIST\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-T, \-\-targets\-file\fR \fIFILE\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.RE
+.sp
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.br
+.ps +1
+\fBVCF output options:\fR
+.RS 4
+.PP
+\fB\-o, \-\-output\fR \fIFILE\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-O, \-\-output\-type\fR \fIb\fR|\fIu\fR|\fIz\fR|\fIv\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.RE
+.sp
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.br
+.ps +1
+\fBGEN/SAMPLE conversion:\fR
+.RS 4
+.PP
+\fB\-G, \-\-gensample2vcf\fR \fIprefix\fR or \fIgen\-file\fR,\fIsample\-file\fR
+.RS 4
+convert IMPUTE2 output to VCF\&. The second column must be of the form "CHROM:POS_REF_ALT" to detect possible strand swaps; IMPUTE2 leaves the first one empty ("\-\-") when sites from reference panel are filled in\&. See also
+\fB\-g\fR
+below\&.
+.RE
+.PP
+\fB\-g, \-\-gensample\fR \fIprefix\fR or \fIgen\-file\fR,\fIsample\-file\fR
+.RS 4
+convert from VCF to gen/sample format used by IMPUTE2 and SHAPEIT\&. The columns of \&.gen file format are ID1,ID2,POS,A,B followed by three genotype probabilities P(AA), P(AB), P(BB) for each sample\&. In order to prevent strand swaps, the program uses IDs of the form "CHROM:POS_REF_ALT"\&. For example:
+.RE
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+  \&.gen
+  \-\-\-\-
+  1:111485207_G_A 1:111485207_G_A 111485207 G A 0 1 0 0 1 0
+  1:111494194_C_T 1:111494194_C_T 111494194 C T 0 1 0 0 0 1
+
+  \&.sample
+  \-\-\-\-\-\-\-
+  ID_1 ID_2 missing
+  0 0 0
+  sample1 sample1 0
+  sample2 sample2 0
+.fi
+.if n \{\
+.RE
+.\}
+.PP
+\fB\-\-tag\fR \fISTRING\fR
+.RS 4
+tag to take values for \&.gen file: GT,PL,GL,GP
+.RE
+.RE
+.sp
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.br
+.ps +1
+\fBgVCF conversion:\fR
+.RS 4
+.PP
+\fB\-\-gvcf2vcf\fR
+.RS 4
+convert gVCF to VCF, expanding REF blocks into sites\&. Only sites with FILTER set to "PASS" or "\&." will be expanded\&.
+.RE
+.RE
+.sp
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.br
+.ps +1
+\fBHAPS/SAMPLE conversion:\fR
+.RS 4
+.PP
+\fB\-\-hapsample2vcf\fR \fIprefix\fR or \fIhaps\-file\fR,\fIsample\-file\fR
+.RS 4
+convert from haps/sample format to VCF\&. The columns of \&.haps file are similar to \&.gen file above, but there are only two haplotype columns per sample\&. Note that the first column of the haps file is expected to be in the form "CHR:POS_REF_ALT", for example:
+.RE
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+  \&.haps
+  \-\-\-\-
+  1:111485207_G_A rsID1 111485207 G A 0 1 0 0
+  1:111494194_C_T rsID2 111494194 C T 0 1 0 0
+.fi
+.if n \{\
+.RE
+.\}
+.RE
+.sp
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.br
+.ps +1
+\fBHAPS/LEGEND/SAMPLE conversion:\fR
+.RS 4
+.PP
+\fB\-H, \-\-haplegendsample2vcf\fR \fIprefix\fR or \fIhaps\-file\fR,\fIlegend\-file\fR,\fIsample\-file\fR
+.RS 4
+convert from haps/legend/sample format used by IMPUTE2 to VCF, see also
+\fB\-h, \-\-hapslegendsample\fR
+below\&.
+.RE
+.PP
+\fB\-h, \-\-haplegendsample\fR \fIprefix\fR or \fIhaps\-file\fR,\fIlegend\-file\fR,\fIsample\-file\fR
+.RS 4
+convert from VCF to haps/legend/sample format used by IMPUTE2 and SHAPEIT\&. The columns of \&.legend file ID,POS,REF,ALT\&. In order to prevent strand swaps, the program uses IDs of the form "CHROM:POS_REF_ALT"\&. The \&.sample file is quite basic at the moment with columns for population, group and sex expected to be edited by the user\&. For example:
+.RE
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+  \&.haps
+  \-\-\-\-\-
+  0 1 0 0 1 0
+  0 1 0 0 0 1
+
+  \&.legend
+  \-\-\-\-\-\-\-
+  id position a0 a1
+  1:111485207_G_A 111485207 G A
+  1:111494194_C_T 111494194 C T
+
+  \&.sample
+  \-\-\-\-\-\-\-
+  sample population group sex
+  sample1 sample1 sample1 2
+  sample2 sample2 sample2 2
+.fi
+.if n \{\
+.RE
+.\}
+.PP
+\fB\-\-haploid2diploid\fR
+.RS 4
+with
+\fB\-h\fR
+option converts haploid genotypes to homozygous diploid genotypes\&. For example, the program will print
+\fI0 0\fR
+instead of the default
+\fI0 \-\fR\&. This is useful for programs which do not handle haploid genotypes correctly\&.
+.RE
+.PP
+\fB\-\-vcf\-ids\fR
+.RS 4
+output VCF IDs instead of "CHROM:POS_REF_ALT" IDs
+.RE
+.RE
+.sp
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.br
+.ps +1
+\fBTSV conversion:\fR
+.RS 4
+.PP
+\fB\-\-tsv2vcf\fR \fIfile\fR
+.RS 4
+convert from TSV (tab\-separated values) format (such as generated by 23andMe) to VCF\&. The input file fields can be tab\- or space\- delimited
+.RE
+.PP
+\fB\-c, \-\-columns\fR \fIlist\fR
+.RS 4
+comma\-separated list of fields in the input file\&. In the current version, the fields CHROM, POS, ID, and AA are expected and can appear in arbitrary order, columns which should be ignored in the input file can be indicated by "\-"\&. The AA field lists alleles on the forward reference strand, for example "CC" or "CT" for diploid genotypes or "C" for haploid genotypes (sex chromosomes)\&. Insertions and deletions are not supported yet, missing data can be indicated with "\-\-"\&.
+.RE
+.PP
+\fB\-f, \-\-fasta\-ref\fR \fIfile\fR
+.RS 4
+reference sequence in fasta format
+.RE
+.PP
+\fB\-s, \-\-samples\fR \fILIST\fR
+.RS 4
+list of sample names\&. See
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-S, \-\-samples\-file\fR \fIFILE\fR
+.RS 4
+file of sample names\&. See
+\fBCommon Options\fR
+.RE
+.sp
+\fBExample:\fR
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+# Convert 23andme results into VCF
+bcftools convert \-c ID,CHROM,POS,AA \-s SampleName \-f 23andme\-ref\&.fa \-\-tsv2vcf 23andme\&.txt \-Oz \-o out\&.vcf\&.gz
+.fi
+.if n \{\
+.RE
+.\}
+.RE
+.SS "bcftools filter \fI[OPTIONS]\fR \fIFILE\fR"
+.sp
+Apply fixed\-threshold filters\&.
+.PP
+\fB\-e, \-\-exclude\fR \fIEXPRESSION\fR
+.RS 4
+exclude sites for which
+\fIEXPRESSION\fR
+is true\&. For valid expressions see
+\fBEXPRESSIONS\fR\&.
+.RE
+.PP
+\fB\-g, \-\-SnpGap\fR \fIINT\fR
+.RS 4
+filter SNPs within
+\fIINT\fR
+base pairs of an indel\&. The following example demonstrates the logic of
+\fB\-\-SnpGap\fR
+\fI3\fR
+applied on a deletion and an insertion:
+.RE
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The SNPs at positions 1 and 7 are filtered, positions 0 and 8 are not:
+         0123456789
+    ref  \&.G\&.GT\&.\&.G\&.\&.
+    del  \&.A\&.G\-\&.\&.A\&.\&.
+Here the positions 1 and 6 are filtered, 0 and 7 are not:
+         0123\-456789
+    ref  \&.G\&.G\-\&.\&.G\&.\&.
+    ins  \&.A\&.GT\&.\&.A\&.\&.
+.fi
+.if n \{\
+.RE
+.\}
+.PP
+\fB\-G, \-\-IndelGap\fR \fIINT\fR
+.RS 4
+filter clusters of indels separated by
+\fIINT\fR
+or fewer base pairs allowing only one to pass\&. The following example demonstrates the logic of
+\fB\-\-IndelGap\fR
+\fI2\fR
+applied on a deletion and an insertion:
+.RE
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The second indel is filtered:
+         012345678901
+    ref  \&.GT\&.GT\&.\&.GT\&.\&.
+    del  \&.G\-\&.G\-\&.\&.G\-\&.\&.
+And similarly here, the second is filtered:
+         01 23 456 78
+    ref  \&.A\-\&.A\-\&.\&.A\-\&.\&.
+    ins  \&.AT\&.AT\&.\&.AT\&.\&.
+.fi
+.if n \{\
+.RE
+.\}
+.PP
+\fB\-i, \-\-include\fR \fIEXPRESSION\fR
+.RS 4
+include only sites for which
+\fIEXPRESSION\fR
+is true\&. For valid expressions see
+\fBEXPRESSIONS\fR\&.
+.RE
+.PP
+\fB\-m, \-\-mode\fR [\fI+x\fR]
+.RS 4
+define behaviour at sites with existing FILTER annotations\&. The default mode replaces existing filters of failed sites with a new FILTER string while leaving sites which pass untouched when non\-empty and setting to "PASS" when the FILTER string is absent\&. The "+" mode appends new FILTER strings of failed sites instead of replacing them\&. The "x" mode resets filters of sites which pass to "PASS"\&. Modes "+" and "x" can both be set\&.
+.RE
+.PP
+\fB\-o, \-\-output\fR \fIFILE\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-O, \-\-output\-type\fR \fIb\fR|\fIu\fR|\fIz\fR|\fIv\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-r, \-\-regions\fR \fIchr\fR|\fIchr:pos\fR|\fIchr:from\-to\fR|\fIchr:from\-\fR[,\&...]
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-R, \-\-regions\-file\fR \fIfile\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-s, \-\-soft\-filter\fR \fISTRING\fR|\fI+\fR
+.RS 4
+annotate FILTER column with
+\fISTRING\fR
+or, with
+\fI+\fR, a unique filter name generated by the program ("Filter%d")\&.
+.RE
+.PP
+\fB\-S, \-\-set\-GTs\fR \fI\&.\fR|\fI0\fR
+.RS 4
+set genotypes of failed samples to missing value (\fI\&.\fR) or reference allele (\fI0\fR)
+.RE
+.PP
+\fB\-t, \-\-targets\fR \fIchr\fR|\fIchr:pos\fR|\fIchr:from\-to\fR|\fIchr:from\-\fR[,\&...]
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-T, \-\-targets\-file\fR \fIfile\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.SS "bcftools gtcheck [\fIOPTIONS\fR] [\-g \fIgenotypes\&.vcf\&.gz\fR] \fIquery\&.vcf\&.gz\fR"
+.sp
+Checks sample identity or, without \fB\-g\fR, multi\-sample cross\-check is performed\&.
+.PP
+\fB\-a, \-\-all\-sites\fR
+.RS 4
+output for all sites
+.RE
+.PP
+\fB\-g, \-\-genotypes\fR \fIgenotypes\&.vcf\&.gz\fR
+.RS 4
+reference genotypes to compare against
+.RE
+.PP
+\fB\-G, \-\-GTs\-only\fR \fIINT\fR
+.RS 4
+use genotypes (GT) instead of genotype likelihoods (PL)\&. When set to 1, reported discordance is the number of non\-matching GTs, otherwise the number
+\fIINT\fR
+is interpreted as phred\-scaled likelihood of unobserved genotypes\&.
+.RE
+.PP
+\fB\-H, \-\-homs\-only\fR
+.RS 4
+consider only genotypes which are homozygous in both
+\fIgenotypes\fR
+and
+\fIquery\fR
+VCF\&. This may be useful with low coverage data\&.
+.RE
+.PP
+\fB\-p, \-\-plot\fR \fIPREFIX\fR
+.RS 4
+produce plots
+.RE
+.PP
+\fB\-r, \-\-regions\fR \fIchr\fR|\fIchr:pos\fR|\fIchr:from\-to\fR|\fIchr:from\-\fR[,\&...]
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-R, \-\-regions\-file\fR \fIfile\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-s, \-\-query\-sample\fR \fISTRING\fR
+.RS 4
+query sample in
+\fIquery\&.vcf\&.gz\fR\&. By default, the first sample is checked\&.
+.RE
+.PP
+\fB\-S, \-\-target\-sample\fR \fISTRING\fR
+.RS 4
+target sample in the
+\fB\-g\fR
+file, used only for plotting, not for analysis
+.RE
+.PP
+\fB\-t, \-\-targets\fR \fIfile\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-T, \-\-targets\-file\fR \fIfile\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.sp
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.br
+.ps +1
+\fBOutput files format:\fR
+.RS 4
+.PP
+CN, Discordance
+.RS 4
+Pairwise discordance for all sample pairs is calculated as
+.RE
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+        \esum_s { min_G { PL_a(G) + PL_b(G) } },
+.fi
+.if n \{\
+.RE
+.\}
+.PP
+.RS 4
+where the sum runs over all sites
+\fIs\fR
+and
+\fIG\fR
+is the the most likely genotype shared by both samples
+\fIa\fR
+and
+\fIb\fR\&. When PL field is not present, a constant value
+\fI99\fR
+is used for the unseen genotypes\&. With
+\fB\-G\fR, the value
+\fI1\fR
+can be used instead; the discordance value then gives exactly the number of differing genotypes\&.
+.RE
+.PP
+SM, Average Discordance
+.RS 4
+Average discordance between sample
+\fIa\fR
+and all other samples\&.
+.RE
+.PP
+SM, Average Depth
+.RS 4
+Average depth at evaluated sites, or 1 if FORMAT/DP field is not present\&.
+.RE
+.PP
+SM, Average Number of sites
+.RS 4
+The average number of sites used to calculate the discordance\&. In other words, the average number of non\-missing PLs/genotypes seen both samples\&.
+.RE
+.RE
+.SS "bcftools index [\fIOPTIONS\fR] \fI<in\&.bcf>|<in\&.vcf\&.gz>\fR"
+.sp
+Creates index for bgzip compressed VCF/BCF files for random access\&. CSI (coordinate\-sorted index) is created by default\&. The CSI format supports indexing of chromosomes up to length 2^31\&. TBI (tabix index) index files, which support chromosome lengths up to 2^29, can be created by using the \fI\-t/\-\-tbi\fR option or using the \fItabix\fR program packaged with htslib\&. When loading an index file, bcftools will try the CSI first and then the TBI\&.
+.sp
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.br
+.ps +1
+\fBIndexing options:\fR
+.RS 4
+.PP
+\fB\-c, \-\-csi\fR
+.RS 4
+generate CSI\-format index for VCF/BCF files [default]
+.RE
+.PP
+\fB\-f, \-\-force\fR
+.RS 4
+overwrite index if it already exists
+.RE
+.PP
+\fB\-m, \-\-min\-shift \fR\fB\fIINT\fR\fR
+.RS 4
+set minimal interval size for CSI indices to 2^INT; default: 14
+.RE
+.PP
+\fB\-t, \-\-tbi\fR
+.RS 4
+generate TBI\-format index for VCF files
+.RE
+.RE
+.sp
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.br
+.ps +1
+\fBStats options:\fR
+.RS 4
+.PP
+\fB\-n, \-\-nrecords\fR
+.RS 4
+print the number of records based on the CSI or TBI index files
+.RE
+.PP
+\fB\-s, \-\-stats\fR
+.RS 4
+Print per contig stats based on the CSI or TBI index files\&. Output format is three tab\-delimited columns listing the contig name, contig length (\fI\&.\fR
+if unknown) and number of records for the contig\&. Contigs with zero records are not printed\&.
+.RE
+.RE
+.SS "bcftools isec [\fIOPTIONS\fR] \fIA\&.vcf\&.gz\fR \fIB\&.vcf\&.gz\fR [\&...]"
+.sp
+Creates intersections, unions and complements of VCF files\&. Depending on the options, the program can output records from one (or more) files which have (or do not have) corresponding records with the same position in the other files\&.
+.PP
+\fB\-c, \-\-collapse\fR \fIsnps\fR|\fIindels\fR|\fIboth\fR|\fIall\fR|\fIsome\fR|\fInone\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-C, \-\-complement\fR
+.RS 4
+output positions present only in the first file but missing in the others
+.RE
+.PP
+\fB\-e, \-\-exclude\fR \fI\-\fR|\fIEXPRESSION\fR
+.RS 4
+exclude sites for which
+\fIEXPRESSION\fR
+is true\&. If
+\fB\-e\fR
+(or
+\fB\-i\fR) appears only once, the same filtering expression will be applied to all input files\&. Otherwise,
+\fB\-e\fR
+or
+\fB\-i\fR
+must be given for each input file\&. To indicate that no filtering should be performed on a file, use "\-" in place of
+\fIEXPRESSION\fR, as shown in the example below\&. For valid expressions see
+\fBEXPRESSIONS\fR\&.
+.RE
+.PP
+\fB\-f, \-\-apply\-filters\fR \fILIST\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-i, \-\-include\fR \fIEXPRESSION\fR
+.RS 4
+include only sites for which
+\fIEXPRESSION\fR
+is true\&. See discussion of
+\fB\-e, \-\-exclude\fR
+above\&.
+.RE
+.PP
+\fB\-n, \-\-nfiles\fR [+\-=]\fIINT\fR
+.RS 4
+output positions present in this many (=), this many or more (+), or this many or fewer (\-) files
+.RE
+.PP
+\fB\-o, \-\-output\fR \fIFILE\fR
+.RS 4
+see
+\fBCommon Options\fR\&. When several files are being output, their names are controlled via
+\fB\-p\fR
+instead\&.
+.RE
+.PP
+\fB\-O, \-\-output\-type\fR \fIb\fR|\fIu\fR|\fIz\fR|\fIv\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-p, \-\-prefix\fR \fIDIR\fR
+.RS 4
+if given, subset each of the input files accordingly\&. See also
+\fB\-w\fR\&.
+.RE
+.PP
+\fB\-r, \-\-regions\fR \fIchr\fR|\fIchr:pos\fR|\fIchr:from\-to\fR|\fIchr:from\-\fR[,\&...]
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-R, \-\-regions\-file\fR \fIfile\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-t, \-\-targets\fR \fIchr\fR|\fIchr:pos\fR|\fIchr:from\-to\fR|\fIchr:from\-\fR[,\&...]
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-T, \-\-targets\-file\fR \fIfile\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-w, \-\-write\fR \fILIST\fR
+.RS 4
+list of input files to output given as 1\-based indices\&. With
+\fB\-p\fR
+and no
+\fB\-w\fR, all files are written\&.
+.RE
+.sp
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.br
+.ps +1
+\fBExamples:\fR
+.RS 4
+.sp
+Create intersection and complements of two sets saving the output in dir/*
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+    bcftools isec \-p dir A\&.vcf\&.gz B\&.vcf\&.gz
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+Filter sites in A and B (but not in C) and create intersection
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+    bcftools isec \-e\*(AqMAF<0\&.01\*(Aq \-i\*(AqdbSNP=1\*(Aq \-e\- A\&.vcf\&.gz B\&.vcf\&.gz C\&.vcf\&.gz \-p dir
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+Extract and write records from A shared by both A and B using exact allele match
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+    bcftools isec \-p dir \-n=2 \-w1 A\&.vcf\&.gz B\&.vcf\&.gz
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+Extract records private to A or B comparing by position only
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+    bcftools isec \-p dir \-n\-1 \-c all A\&.vcf\&.gz B\&.vcf\&.gz
+.fi
+.if n \{\
+.RE
+.\}
+.RE
+.SS "bcftools merge [\fIOPTIONS\fR] \fIA\&.vcf\&.gz\fR \fIB\&.vcf\&.gz\fR [\&...]"
+.sp
+Merge multiple VCF/BCF files from non\-overlapping sample sets to create one multi\-sample file\&. For example, when merging file \fIA\&.vcf\&.gz\fR containing samples \fIS1\fR, \fIS2\fR and \fIS3\fR and file \fIB\&.vcf\&.gz\fR containing samples \fIS3\fR and \fIS4\fR, the output file will contain four samples named \fIS1\fR, \fIS2\fR, \fIS3\fR, \fI2:S3\fR and \fIS4\fR\&.
+.sp
+Note that it is responsibility of the user to ensure that the sample names are unique across all files\&. If they are not, the program will exit with an error unless the option \fB\-\-force\-samples\fR is given\&. The sample names can be also given explicitly using the \fB\-\-print\-header\fR and \fB\-\-use\-header\fR options\&.
+.sp
+Note that only records from different files can be merged, never from the same file\&. For "vertical" merge take a look at \fBbcftools norm\fR instead\&.
+.PP
+\fB\-\-force\-samples\fR
+.RS 4
+if the merged files contain duplicate samples names, proceed anyway\&. Duplicate sample names will be resolved by prepending index of the file as it appeared on the command line to the conflicting sample name (see
+\fI2:S3\fR
+in the above example)\&.
+.RE
+.PP
+\fB\-\-print\-header\fR
+.RS 4
+print only merged header and exit
+.RE
+.PP
+\fB\-\-use\-header\fR \fIFILE\fR
+.RS 4
+use the VCF header in the provided text
+\fIFILE\fR
+.RE
+.PP
+\fB\-f, \-\-apply\-filters\fR \fILIST\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-i, \-\-info\-rules\fR \fI\-\fR|\fITAG:METHOD\fR[,\&...]
+.RS 4
+Rules for merging INFO fields (scalars or vectors) or
+\fI\-\fR
+to disable the default rules\&.
+\fIMETHOD\fR
+is one of
+\fIsum\fR,
+\fIavg\fR,
+\fImin\fR,
+\fImax\fR,
+\fIjoin\fR\&.
+.RE
+.PP
+\fB\-l, \-\-file\-list\fR \fIFILE\fR
+.RS 4
+read file names from
+\fIFILE\fR
+.RE
+.PP
+\fB\-m, \-\-merge\fR \fIsnps\fR|\fIindels\fR|\fIboth\fR|\fIall\fR|\fInone\fR|\fIid\fR
+.RS 4
+The option controls what types of multiallelic records can be created:
+.RE
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+\-m none   \&.\&.  no new multiallelics, output multiple records instead
+\-m snps   \&.\&.  allow multiallelic SNP records
+\-m indels \&.\&.  allow multiallelic indel records
+\-m both   \&.\&.  both SNP and indel records can be multiallelic
+\-m all    \&.\&.  SNP records can be merged with indel records
+\-m id     \&.\&.  merge by ID
+.fi
+.if n \{\
+.RE
+.\}
+.PP
+\fB\-o, \-\-output\fR \fIFILE\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-O, \-\-output\-type\fR \fIb\fR|\fIu\fR|\fIz\fR|\fIv\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-r, \-\-regions\fR \fIchr\fR|\fIchr:pos\fR|\fIchr:from\-to\fR|\fIchr:from\-\fR[,\&...]
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-R, \-\-regions\-file\fR \fIfile\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.SS "bcftools norm [\fIOPTIONS\fR] \fIfile\&.vcf\&.gz\fR"
+.sp
+Left\-align and normalize indels, check if REF alleles match the reference, split multiallelic sites into multiple rows; recover multiallelics from multiple rows\&.
+.PP
+\fB\-D, \-\-remove\-duplicates\fR
+.RS 4
+remove duplicate lines of the same type
+.RE
+.PP
+\fB\-f, \-\-fasta\-ref\fR \fIFILE\fR
+.RS 4
+reference sequence
+.RE
+.PP
+\fB\-m, \-\-multiallelics\fR ←|+>[\fIsnps\fR|\fIindels\fR|\fIboth\fR|\fIany\fR]
+.RS 4
+split multiallelic sites into biallelic records (\fI\-\fR) or join biallelic sites into multiallelic records (\fI+\fR)\&. An optional type string can follow which controls variant types which should be split or merged together: If only SNP records should be split or merged, specify
+\fIsnps\fR; if both SNPs and indels should be merged separately into two records, specify
+\fIboth\fR; if SNPs and indels should be merged into a single record, specify
+\fIany\fR\&.
+.RE
+.PP
+\fB\-o, \-\-output\fR \fIFILE\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-O, \-\-output\-type\fR \fIb\fR|\fIu\fR|\fIz\fR|\fIv\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-r, \-\-regions\fR \fIchr\fR|\fIchr:pos\fR|\fIchr:from\-to\fR|\fIchr:from\-\fR[,\&...]
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-R, \-\-regions\-file\fR \fIfile\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-s, \-\-strict\-filter\fR
+.RS 4
+when merging (\fI\-m+\fR), merged site is PASS only if all sites being merged PASS
+.RE
+.PP
+\fB\-t, \-\-targets\fR \fILIST\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-T, \-\-targets\-file\fR \fIFILE\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-w, \-\-site\-win\fR \fIINT\fR
+.RS 4
+maximum distance between two records to consider when locally sorting variants which changed position during the realignment
+.RE
+.SS "bcftools plugin \fINAME\fR \fI[OPTIONS]\fR \fIFILE\fR \(em \fI[PLUGIN OPTIONS]\fR"
+.sp
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.br
+.ps +1
+\fBVCF input options:\fR
+.RS 4
+.PP
+\fB\-e, \-\-exclude\fR \fIEXPRESSION\fR
+.RS 4
+exclude sites for which
+\fIEXPRESSION\fR
+is true\&. For valid expressions see
+\fBEXPRESSIONS\fR\&.
+.RE
+.PP
+\fB\-i, \-\-include\fR \fIEXPRESSION\fR
+.RS 4
+include only sites for which
+\fIEXPRESSION\fR
+is true\&. For valid expressions see
+\fBEXPRESSIONS\fR\&.
+.RE
+.PP
+\fB\-r, \-\-regions\fR \fIchr\fR|\fIchr:pos\fR|\fIchr:from\-to\fR|\fIchr:from\-\fR[,\&...]
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-R, \-\-regions\-file\fR \fIfile\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-t, \-\-targets\fR \fIchr\fR|\fIchr:pos\fR|\fIchr:from\-to\fR|\fIchr:from\-\fR[,\&...]
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-T, \-\-targets\-file\fR \fIfile\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.RE
+.sp
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.br
+.ps +1
+\fBVCF output options:\fR
+.RS 4
+.PP
+\fB\-o, \-\-output\fR \fIFILE\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-O, \-\-output\-type\fR \fIb\fR|\fIu\fR|\fIz\fR|\fIv\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.RE
+.sp
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.br
+.ps +1
+\fBPlugin options:\fR
+.RS 4
+.PP
+\fB\-h, \-\-help\fR
+.RS 4
+list plugin\(cqs options
+.RE
+.PP
+\fB\-l, \-\-list\-plugins\fR
+.RS 4
+List all available plugins\&. If not installed systemwide, set the environment variable LD_LIBRARY_PATH (linux) or DYLD_LIBRARY_PATH (Mac OS X) to include directory where
+\fBlibhts\&.so\fR
+is located\&. The BCFTOOLS_PLUGINS environment variable tells the program which directories to search\&.
+.RE
+.PP
+\fB\-v, \-\-verbose\fR
+.RS 4
+print debugging information to debug plugin failure
+.RE
+.RE
+.sp
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.br
+.ps +1
+\fBList of plugins coming with the distribution:\fR
+.RS 4
+.PP
+\fBcounts\fR
+.RS 4
+a minimal plugin which counts number of SNPs, Indels, and total number of sites\&.
+.RE
+.PP
+\fBdosage\fR
+.RS 4
+print genotype dosage\&. By default the plugin searches for PL, GL and GT, in that order\&.
+.RE
+.PP
+\fBfill\-AN\-AC\fR
+.RS 4
+fill INFO fields AN and AC\&.
+.RE
+.PP
+\fBfix\-ploidy\fR
+.RS 4
+sets correct ploidy
+.RE
+.PP
+\fBframeshifts\fR
+.RS 4
+annotate frameshift indels
+.RE
+.PP
+\fBmissing2ref\fR
+.RS 4
+sets missing genotypes ("\&./\&.") to ref allele ("0/0" or "0|0")
+.RE
+.PP
+\fBtag2tag\fR
+.RS 4
+Convert between similar tags, such as GL and GP\&.
+.RE
+.PP
+\fBvcf2sex\fR
+.RS 4
+determine sample sex by checking genotypes in haploid regions
+.RE
+.RE
+.sp
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.br
+.ps +1
+\fBExamples:\fR
+.RS 4
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+# List options common to all plugins
+bcftools plugin
+
+# List available plugins
+bcftools plugin \-l
+
+# One can run plugins in several ways
+bcftools plugin counts in\&.vcf
+bcftools +counts in\&.vcf
+cat in\&.vcf | bcftools +counts
+
+# Print usage information of plugin "dosage"
+bcftools +dosage \-h
+
+# Replace missing genotypes with 0/0
+bcftools +missing2ref in\&.vcf
+
+# Replace missing genotypes with 0|0
+bcftools +missing2ref in\&.vcf \-\- \-p
+.fi
+.if n \{\
+.RE
+.\}
+.RE
+.sp
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.br
+.ps +1
+\fBPlugins troubleshooting:\fR
+.RS 4
+.sp
+Things to check if your plugin does not show up in the \fBbcftools plugin \-l\fR output:
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Run with the
+\fB\-v\fR
+option for verbose output:
+\fBbcftools plugin \-lv\fR
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Does the environment variable BCFTOOLS_PLUGINS include the correct path?
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Are all shared libraries, namely libhts\&.so, accessible? Verify with
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+on Mac OS X:
+\fBotool \-L your/plugin\&.so\fR
+and set DYLD_LIBRARY_PATH if they are not
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+on Linux:
+\fBldd your/plugin\&.so\fR
+and set LD_LIBRARY_PATH if they are not
+.RE
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+If not installed systemwide, set the environment variable LD_LIBRARY_PATH (linux) or DYLD_LIBRARY_PATH (mac) to include directory where
+\fBlibhts\&.so\fR
+is located\&.
+.RE
+.RE
+.sp
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.br
+.ps +1
+\fBPlugins API:\fR
+.RS 4
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+// Short description used by \*(Aqbcftools plugin \-l\*(Aq
+const char *about(void);
+
+// Longer description used by \*(Aqbcftools +name \-h\*(Aq
+const char *usage(void);
+
+// Called once at startup, allows to initialize local variables\&.
+// Return 1 to suppress normal VCF/BCF header output, \-1 on critical
+// errors, 0 otherwise\&.
+int init(int argc, char **argv, bcf_hdr_t *in_hdr, bcf_hdr_t *out_hdr);
+
+// Called for each VCF record, return NULL to suppress the output
+bcf1_t *process(bcf1_t *rec);
+
+// Called after all lines have been processed to clean up
+void destroy(void);
+.fi
+.if n \{\
+.RE
+.\}
+.RE
+.SS "bcftools query [\fIOPTIONS\fR] \fIfile\&.vcf\&.gz\fR [\fIfile\&.vcf\&.gz\fR [\&...]]"
+.sp
+Extracts fields from VCF or BCF files and outputs them in user\-defined format\&.
+.PP
+\fB\-c, \-\-collapse\fR \fIsnps\fR|\fIindels\fR|\fIboth\fR|\fIall\fR|\fIsome\fR|\fInone\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-e, \-\-exclude\fR \fIEXPRESSION\fR
+.RS 4
+exclude sites for which
+\fIEXPRESSION\fR
+is true\&. For valid expressions see
+\fBEXPRESSIONS\fR\&.
+.RE
+.PP
+\fB\-f, \-\-format\fR \fIFORMAT\fR
+.RS 4
+learn by example, see below
+.RE
+.PP
+\fB\-H, \-\-print\-header\fR
+.RS 4
+print header
+.RE
+.PP
+\fB\-i, \-\-include\fR \fIEXPRESSION\fR
+.RS 4
+include only sites for which
+\fIEXPRESSION\fR
+is true\&. For valid expressions see
+\fBEXPRESSIONS\fR\&.
+.RE
+.PP
+\fB\-l, \-\-list\-samples\fR
+.RS 4
+list sample names and exit
+.RE
+.PP
+\fB\-o, \-\-output\fR \fIFILE\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-r, \-\-regions\fR \fIchr\fR|\fIchr:pos\fR|\fIchr:from\-to\fR|\fIchr:from\-\fR[,\&...]
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-R, \-\-regions\-file\fR \fIfile\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-s, \-\-samples\fR \fILIST\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-S, \-\-samples\-file\fR \fIFILE\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-t, \-\-targets\fR \fIchr\fR|\fIchr:pos\fR|\fIchr:from\-to\fR|\fIchr:from\-\fR[,\&...]
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-T, \-\-targets\-file\fR \fIfile\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-v, \-\-vcf\-list\fR \fIFILE\fR
+.RS 4
+process multiple VCFs listed in the file
+.RE
+.sp
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.br
+.ps +1
+\fBFormat:\fR
+.RS 4
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+%CHROM          The CHROM column (similarly also other columns: POS, ID, REF, ALT, QUAL, FILTER)
+%INFO/TAG       Any tag in the INFO column
+%TYPE           Variant type (REF, SNP, MNP, INDEL, OTHER)
+%MASK           Indicates presence of the site in other files (with multiple files)
+%TAG{INT}       Curly brackets to subscript vectors (0\-based)
+%FIRST_ALT      Alias for %ALT{0}
+[]              The brackets loop over all samples
+%GT             Genotype (e\&.g\&. 0/1)
+%TGT            Translated genotype (e\&.g\&. C/A)
+%IUPACGT        Genotype translated to IUPAC ambiguity codes (e\&.g\&. M instead of C/A)
+%LINE           Prints the whole line
+%SAMPLE         Sample name
+.fi
+.if n \{\
+.RE
+.\}
+.RE
+.sp
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.br
+.ps +1
+\fBExamples:\fR
+.RS 4
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+bcftools query \-f \*(Aq%CHROM  %POS  %REF  %ALT{0}\en\*(Aq file\&.vcf\&.gz
+bcftools query \-f \*(Aq%CHROM\et%POS\et%REF\et%ALT[\et%SAMPLE=%GT]\en\*(Aq file\&.vcf\&.gz
+.fi
+.if n \{\
+.RE
+.\}
+.RE
+.SS "bcftools reheader [\fIOPTIONS\fR] \fIfile\&.vcf\&.gz\fR"
+.sp
+Modify header of VCF/BCF files, change sample names\&.
+.PP
+\fB\-h, \-\-header\fR \fIFILE\fR
+.RS 4
+new VCF header
+.RE
+.PP
+\fB\-o, \-\-output\fR \fIFILE\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-s, \-\-samples\fR \fIFILE\fR
+.RS 4
+new sample names, one name per line, in the same order as they appear in the VCF file\&. Alternatively, only samples which need to be renamed can be listed as "old_name new_name\en" pairs separated by whitespaces, each on separate line\&.
+.RE
+.SS "bcftools roh [\fIOPTIONS\fR] \fIfile\&.vcf\&.gz\fR"
+.sp
+A program for detecting runs of homo/autozygosity\&. Only bi\-allelic sites are considered\&.
+.sp
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.br
+.ps +1
+\fBThe HMM model:\fR
+.RS 4
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+Notation:
+  D  = Data, AZ = autozygosity, HW = Hardy\-Weinberg (non\-autozygosity),
+  f  = non\-ref allele frequency
+
+Emission probabilities:
+  oAZ = P_i(D|AZ) = (1\-f)*P(D|RR) + f*P(D|AA)
+  oHW = P_i(D|HW) = (1\-f)^2 * P(D|RR) + f^2 * P(D|AA) + 2*f*(1\-f)*P(D|RA)
+
+Transition probabilities:
+  tAZ = P(AZ|HW)  \&.\&. from HW to AZ, the \-a parameter
+  tHW = P(HW|AZ)  \&.\&. from AZ to HW, the \-H parameter
+  P(AZ|AZ) = 1 \- P(HW|AZ) = 1 \- tHW
+  P(HW|HW) = 1 \- P(AZ|HW) = 1 \- tAZ
+
+  ci  = P_i(C)  \&.\&. probability of cross\-over at site i, from genetic map
+  AZi = P_i(AZ) \&.\&. probability of site i being AZ/non\-AZ, scaled so that AZi+HWi = 1
+  HWi = P_i(HW)
+
+  P_{i+1}(AZ) = oAZ * max[(1\-tHW) * (1\-ci) * AZ{i\-1} , tAZ * ci * (1\-AZ{i\-1})]
+  P_{i+1}(HW) = oHW * max[(1\-tAZ) * (1\-ci) * (1\-AZ{i\-1}) , tHW * ci * AZ{i\-1}]
+.fi
+.if n \{\
+.RE
+.\}
+.RE
+.sp
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.br
+.ps +1
+\fBGeneral Options:\fR
+.RS 4
+.PP
+\fB\-\-AF\-tag\fR \fITAG\fR
+.RS 4
+use the specified INFO tag
+\fITAG\fR
+as an allele frequency estimate instead of the defaul AC and AN tags\&. Sites which do not have
+\fITAG\fR
+will be skipped\&.
+.RE
+.PP
+\fB\-\-AF\-file\fR \fIFILE\fR
+.RS 4
+Read allele frequencies from a tab\-delimited file containing the columns: CHROM\etPOS\etREF,ALT\etAF\&. The file can be compressed with
+\fBbgzip\fR
+and indexed with tabix \-s1 \-b2 \-e2\&. Sites which are not present in the
+\fIFILE\fR
+or have different reference or alternate allele will be skipped\&. Note that such a file can be easily created from a VCF using:
+.RE
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+    bcftools query \-f\*(Aq%CHROM\et%POS\et%REF,%ALT\et%INFO/TAG\en\*(Aq file\&.vcf | bgzip \-c > freqs\&.tab\&.gz
+.fi
+.if n \{\
+.RE
+.\}
+.PP
+\fB\-e, \-\-estimate\-AF\fR \fIFILE\fR
+.RS 4
+recalculate INFO/AC and INFO/AN on the fly, using either all samples ("\-") or samples listed in
+\fIFILE\fR\&. By default, allele frequency is estimated from AC and AN counts which are already present in the INFO field\&.
+.RE
+.PP
+\fB\-G, \-\-GTs\-only\fR \fIFLOAT\fR
+.RS 4
+use genotypes (FORMAT/GT fields) ignoring genotype likelihoods (FORMAT/PL), setting PL of unseen genotypes to
+\fIFLOAT\fR\&. Safe value to use is 30 to account for GT errors\&.
+.RE
+.PP
+\fB\-I, \-\-skip\-indels\fR
+.RS 4
+skip indels as their genotypes are usually enriched for errors
+.RE
+.PP
+\fB\-m, \-\-genetic\-map\fR \fIFILE\fR
+.RS 4
+genetic map in the format required also by IMPUTE2\&. Only the first and third column are used (position and Genetic_Map(cM))\&. The
+\fIFILE\fR
+can chromosome name\&.
+.RE
+.PP
+\fB\-r, \-\-regions\fR \fIchr\fR|\fIchr:pos\fR|\fIchr:from\-to\fR|\fIchr:from\-\fR[,\&...]
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-R, \-\-regions\-file\fR \fIfile\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-s, \-\-sample\fR \fIname\fR
+.RS 4
+the name of sample to analyze
+.RE
+.PP
+\fB\-t, \-\-targets\fR \fIchr\fR|\fIchr:pos\fR|\fIchr:from\-to\fR|\fIchr:from\-\fR[,\&...]
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-T, \-\-targets\-file\fR \fIfile\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.RE
+.sp
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.br
+.ps +1
+\fBHMM Options:\fR
+.RS 4
+.PP
+\fB\-a, \-\-hw\-to\-az\fR \fIFLOAT\fR
+.RS 4
+P(AZ|HW) transition probability from AZ (autozygous) to HW (Hardy\-Weinberg) state
+.RE
+.PP
+\fB\-H, \-\-az\-to\-hw\fR \fIFLOAT\fR
+.RS 4
+P(HW|AZ) transition probability from HW to AZ state
+.RE
+.PP
+\fB\-V, \-\-viterbi\-training\fR
+.RS 4
+perform Viterbi training to estimate transition probabilities
+.RE
+.RE
+.SS "bcftools stats [\fIOPTIONS\fR] \fIA\&.vcf\&.gz\fR [\fIB\&.vcf\&.gz\fR]"
+.sp
+Parses VCF or BCF and produces text file stats which is suitable for machine processing and can be plotted using \fBplot\-vcfstats\fR\&. When two files are given, the program generates separate stats for intersection and the complements\&. By default only sites are compared, \fB\-s\fR/\fB\-S\fR must given to include also sample columns\&.
+.PP
+\fB\-1, \-\-1st\-allele\-only\fR
+.RS 4
+consider only 1st allele at multiallelic sites
+.RE
+.PP
+\fB\-c, \-\-collapse\fR \fIsnps\fR|\fIindels\fR|\fIboth\fR|\fIall\fR|\fIsome\fR|\fInone\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-d, \-\-depth\fR \fIINT\fR,\fIINT\fR,\fIINT\fR
+.RS 4
+ranges of depth distribution: min, max, and size of the bin
+.RE
+.PP
+\fB\-\-debug\fR
+.RS 4
+produce verbose per\-site and per\-sample output
+.RE
+.PP
+\fB\-e, \-\-exons\fR \fIfile\&.gz\fR
+.RS 4
+tab\-delimited file with exons for indel frameshifts statistics\&. The columns of the file are CHR, FROM, TO, with 1\-based, inclusive, positions\&. The file is BGZF\-compressed and indexed with tabix
+.RE
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+    tabix \-s1 \-b2 \-e3 file\&.gz
+.fi
+.if n \{\
+.RE
+.\}
+.PP
+\fB\-f, \-\-apply\-filters\fR \fILIST\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-F, \-\-fasta\-ref\fR \fIref\&.fa\fR
+.RS 4
+faidx indexed reference sequence file to determine INDEL context
+.RE
+.PP
+\fB\-i, \-\-split\-by\-ID\fR
+.RS 4
+collect stats separately for sites which have the ID column set ("known sites") or which do not have the ID column set ("novel sites")\&.
+.RE
+.PP
+\fB\-r, \-\-regions\fR \fIchr\fR|\fIchr:pos\fR|\fIchr:from\-to\fR|\fIchr:from\-\fR[,\&...]
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-R, \-\-regions\-file\fR \fIfile\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-s, \-\-samples\fR \fILIST\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-S, \-\-samples\-file\fR \fIFILE\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-t, \-\-targets\fR \fIchr\fR|\fIchr:pos\fR|\fIchr:from\-to\fR|\fIchr:from\-\fR[,\&...]
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-T, \-\-targets\-file\fR \fIfile\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.SS "bcftools view [\fIOPTIONS\fR] \fIfile\&.vcf\&.gz\fR [\fIREGION\fR [\&...]]"
+.sp
+View, subset and filter VCF or BCF files by position and filtering expression\&. Convert between VCF and BCF\&. Former \fBbcftools subset\fR\&.
+.sp
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.br
+.ps +1
+\fBOutput options\fR
+.RS 4
+.PP
+\fB\-G, \-\-drop\-genotypes\fR
+.RS 4
+drop individual genotype information (after subsetting if
+\fB\-s\fR
+option is set)
+.RE
+.PP
+\fB\-h, \-\-header\-only\fR
+.RS 4
+output the VCF header only
+.RE
+.PP
+\fB\-H, \-\-no\-header\fR
+.RS 4
+suppress the header in VCF output
+.RE
+.PP
+\fB\-l, \-\-compression\-level\fR [\fI0\-9\fR]
+.RS 4
+compression level\&. 0 stands for uncompressed, 1 for best speed and 9 for best compression\&.
+.RE
+.PP
+\fB\-O, \-\-output\-type\fR \fIb\fR|\fIu\fR|\fIz\fR|\fIv\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.sp
+\fB\-o, \-\-output\-file\fR \fIFILE\fR: output file name\&. If not present, the default is to print to standard output (stdout)\&.
+.PP
+\fB\-r, \-\-regions\fR \fIchr\fR|\fIchr:pos\fR|\fIchr:from\-to\fR|\fIchr:from\-\fR[,\&...]
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-R, \-\-regions\-file\fR \fIfile\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-t, \-\-targets\fR \fIchr\fR|\fIchr:pos\fR|\fIchr:from\-to\fR|\fIchr:from\-\fR[,\&...]
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-T, \-\-targets\-file\fR \fIfile\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.RE
+.sp
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.br
+.ps +1
+\fBSubset options:\fR
+.RS 4
+.PP
+\fB\-a, \-\-trim\-alt\-alleles\fR
+.RS 4
+trim alternate alleles not seen in subset\&. Type A, G and R INFO and FORMAT fields will also be trimmed
+.RE
+.PP
+\fB\-I, \-\-no\-update\fR
+.RS 4
+do not (re)calculate INFO fields for the subset (currently INFO/AC and INFO/AN)
+.RE
+.PP
+\fB\-s, \-\-samples\fR \fILIST\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-S, \-\-samples\-file\fR \fIFILE\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.RE
+.sp
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.br
+.ps +1
+\fBFilter options:\fR
+.RS 4
+.PP
+\fB\-c, \-\-min\-ac\fR \fIINT\fR[\fI:nref\fR|\fI:alt1\fR|\fI:minor\fR|\fI:major\fR|:\*(Aqnonmajor\*(Aq]
+.RS 4
+minimum allele count (INFO/AC) of sites to be printed\&. Specifying the type of allele is optional and can be set to non\-reference (\fInref\fR, the default), 1st alternate (\fIalt1\fR), the least frequent (\fIminor\fR), the most frequent (\fImajor\fR) or sum of all but the most frequent (\fInonmajor\fR) alleles\&.
+.RE
+.PP
+\fB\-C, \-\-max\-ac\fR \fIINT\fR[\fI:nref\fR|\fI:alt1\fR|\fI:minor\fR|:\*(Aqmajor\*(Aq|:\*(Aqnonmajor\*(Aq]
+.RS 4
+maximum allele count (INFO/AC) of sites to be printed\&. Specifying the type of allele is optional and can be set to non\-reference (\fInref\fR, the default), 1st alternate (\fIalt1\fR), the least frequent (\fIminor\fR), the most frequent (\fImajor\fR) or sum of all but the most frequent (\fInonmajor\fR) alleles\&.
+.RE
+.PP
+\fB\-e, \-\-exclude\fR \fIEXPRESSION\fR
+.RS 4
+exclude sites for which
+\fIEXPRESSION\fR
+is true\&. For valid expressions see
+\fBEXPRESSIONS\fR\&.
+.RE
+.PP
+\fB\-f, \-\-apply\-filters\fR \fILIST\fR
+.RS 4
+see
+\fBCommon Options\fR
+.RE
+.PP
+\fB\-g, \-\-genotype\fR [^][\fIhom\fR|\fIhet\fR|\fImiss\fR]
+.RS 4
+include only sites with one or more homozygous (\fIhom\fR), heterozygous (\fIhet\fR) or missing (\fImiss\fR) genotypes\&. When prefixed with
+\fI^\fR, the logic is reversed; thus
+\fI^het\fR
+excludes sites with heterozygous genotypes\&.
+.RE
+.PP
+\fB\-i, \-\-include\fR \fIEXPRESSION\fR
+.RS 4
+include sites for which
+\fIEXPRESSION\fR
+is true\&. For valid expressions see
+\fBEXPRESSIONS\fR\&.
+.RE
+.PP
+\fB\-k, \-\-known\fR
+.RS 4
+print known sites only (ID column is not "\&.")
+.RE
+.PP
+\fB\-m, \-\-min\-alleles\fR \fIINT\fR
+.RS 4
+print sites with at least
+\fIINT\fR
+alleles listed in REF and ALT columns
+.RE
+.PP
+\fB\-M, \-\-max\-alleles\fR \fIINT\fR
+.RS 4
+print sites with at most
+\fIINT\fR
+alleles listed in REF and ALT columns\&. Use
+\fB\-m2 \-M2 \-v snps\fR
+to only view biallelic SNPs\&.
+.RE
+.PP
+\fB\-n, \-\-novel\fR
+.RS 4
+print novel sites only (ID column is "\&.")
+.RE
+.PP
+\fB\-p, \-\-phased\fR
+.RS 4
+print sites where all samples are phased\&. Haploid genotypes are considered phased\&. Missing genotypes considered unphased unless the phased bit is set\&.
+.RE
+.PP
+\fB\-P, \-\-exclude\-phased\fR
+.RS 4
+exclude sites where all samples are phased
+.RE
+.PP
+\fB\-q, \-\-min\-af\fR \fIFLOAT\fR[\fI:nref\fR|\fI:alt1\fR|\fI:minor\fR|:\*(Aqmajor\*(Aq|:\*(Aqnonmajor\*(Aq]
+.RS 4
+minimum allele frequency (INFO/AC / INFO/AN) of sites to be printed\&. Specifying the type of allele is optional and can be set to non\-reference (\fInref\fR, the default), 1st alternate (\fIalt1\fR), the least frequent (\fIminor\fR), the most frequent (\fImajor\fR) or sum of all but the most frequent (\fInonmajor\fR) alleles\&.
+.RE
+.PP
+\fB\-Q, \-\-max\-af\fR \fIFLOAT\fR[\fI:nref\fR|\fI:alt1\fR|\fI:minor\fR|:\*(Aqmajor\*(Aq|:\*(Aqnonmajor\*(Aq]
+.RS 4
+maximum allele frequency (INFO/AC / INFO/AN) of sites to be printed\&. Specifying the type of allele is optional and can be set to non\-reference (\fInref\fR, the default), 1st alternate (\fIalt1\fR), the least frequent (\fIminor\fR), the most frequent (\fImajor\fR) or sum of all but the most frequent (\fInonmajor\fR) alleles\&.
+.RE
+.PP
+\fB\-u, \-\-uncalled\fR
+.RS 4
+print sites without a called genotype
+.RE
+.PP
+\fB\-U, \-\-exclude\-uncalled\fR
+.RS 4
+exclude sites without a called genotype
+.RE
+.PP
+\fB\-v, \-\-types\fR \fIsnps\fR|\fIindels\fR|\fImnps\fR|\fIother\fR
+.RS 4
+comma\-separated list of variant types to select
+.RE
+.PP
+\fB\-V, \-\-exclude\-types\fR \fIsnps\fR|\fIindels\fR|\fImnps\fR|\fIother\fR
+.RS 4
+comma\-separated list of variant types to exclude
+.RE
+.PP
+\fB\-x, \-\-private\fR
+.RS 4
+print sites where only the subset samples carry an non\-reference allele
+.RE
+.PP
+\fB\-X, \-\-exclude\-private\fR
+.RS 4
+exclude sites where only the subset samples carry an non\-reference allele
+.RE
+.RE
+.SH "EXPRESSIONS"
+.sp
+These filtering expressions are accepted by \fBannotate\fR, \fBfilter\fR, \fBquery\fR and \fBview\fR commands\&.
+.PP
+\fBValid expressions may contain:\fR
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+numerical constants, string constants, file names
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+1, 1\&.0, 1e\-4
+"String"
+ at file_name
+.fi
+.if n \{\
+.RE
+.\}
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+arithmetic operators
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
++,*,\-,/
+.fi
+.if n \{\
+.RE
+.\}
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+comparison operators
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+== (same as =), >, >=, <=, <, !=
+.fi
+.if n \{\
+.RE
+.\}
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+regex operators "~" and its negation "!~"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+INFO/HAYSTACK ~ "needle"
+.fi
+.if n \{\
+.RE
+.\}
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+parentheses
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+(, )
+.fi
+.if n \{\
+.RE
+.\}
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+logical operators
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+&& (same as &), ||,  |
+.fi
+.if n \{\
+.RE
+.\}
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+INFO tags, FORMAT tags, column names
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+INFO/DP or DP
+FORMAT/DV, FMT/DV, or DV
+FILTER, QUAL, ID, REF, ALT[0]
+.fi
+.if n \{\
+.RE
+.\}
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+1 (or 0) to test the presence (or absence) of a flag
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+FlagA=1 && FlagB=0
+.fi
+.if n \{\
+.RE
+.\}
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+TYPE for variant type in REF,ALT columns (indel,snp,mnp,ref,other)
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+TYPE="indel" | TYPE="snp"
+.fi
+.if n \{\
+.RE
+.\}
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+array subscripts, "*" for any field
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+(DP4[0]+DP4[1])/(DP4[2]+DP4[3]) > 0\&.3
+DP4[*] == 0
+CSQ[*] ~ "missense_variant\&.*deleterious"
+.fi
+.if n \{\
+.RE
+.\}
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+function on FORMAT tags (over samples) and INFO tags (over vector fields)
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+MAX, MIN, AVG, SUM, STRLEN, ABS
+.fi
+.if n \{\
+.RE
+.\}
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+variables calculated on the fly if not present: number of alternate alleles; number of samples; count of alternate alleles; minor allele count (similar to AC but is always smaller than 0\&.5); frequency of alternate alleles (AF=AC/AN); frequency of minor alleles (MAF=MAC/AN); number of alleles in called genotypes
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+N_ALT, N_SAMPLES, AC, MAC, AF, MAF, AN
+.fi
+.if n \{\
+.RE
+.\}
+.RE
+.PP
+\fBNotes:\fR
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+String comparisons and regular expressions are case\-insensitive
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+If the subscript "*" is used in regular expression search, the whole field is treated as one string\&. For example, the regex STR[*]~"B,C" will be true for the string vector INFO/STR=AB,CD\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Variables and function names are case\-insensitive, but not tag names\&. For example, "qual" can be used instead of "QUAL", "strlen()" instead of "STRLEN()" , but not "dp" instead of "DP"\&.
+.RE
+.sp
+\fBExamples:\fR
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+MIN(DV)>5
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+MIN(DV/DP)>0\&.3
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+MIN(DP)>10 & MIN(DV)>3
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+QUAL>10 |  FMT/GQ>10   \&.\&. selects only GQ>10 samples
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+QUAL>10 || FMT/GQ>10   \&.\&. selects all samples at QUAL>10 sites
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+TYPE="snp" && QUAL>=10 && (DP4[2]+DP4[3] > 2)
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+MIN(DP)>35 && AVG(GQ)>50
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+ID=@file       \&.\&. selects lines with ID present in the file
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+ID!=@~/file    \&.\&. skip lines with ID present in the ~/file
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+MAF[0]<0\&.05    \&.\&. select rare variants at 5% cutoff
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+\fBShell expansion:\fR
+.sp
+Note that expressions must often be quoted because some characters have special meaning in the shell\&. An example of expression enclosed in single quotes which cause that the whole expression is passed to the program as intended:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+bcftools view \-i \*(Aq%ID!="\&." & MAF[0]<0\&.01\*(Aq
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+Please refer to the documentation of your shell for details\&.
+.SH "SCRIPTS AND OPTIONS"
+.SS "plot\-vcfstats [\fIOPTIONS\fR] \fIfile\&.vchk\fR [\&...]"
+.sp
+Script for processing output of \fBbcftools stats\fR\&. It can merge results from multiple outputs (useful when running the stats for each chromosome separately), plots graphs and creates a PDF presentation\&.
+.PP
+\fB\-m, \-\-merge\fR
+.RS 4
+Merge vcfstats files to STDOUT, skip plotting\&.
+.RE
+.PP
+\fB\-p, \-\-prefix\fR \fIPATH\fR
+.RS 4
+The output files prefix, add a slash to create new directory\&.
+.RE
+.PP
+\fB\-P, \-\-no\-PDF\fR
+.RS 4
+Skip the PDF creation step\&.
+.RE
+.PP
+\fB\-r, \-\-rasterize\fR
+.RS 4
+Rasterize PDF images for faster rendering\&.
+.RE
+.PP
+\fB\-s, \-\-sample\-names\fR
+.RS 4
+Use sample names for xticks rather than numeric IDs\&.
+.RE
+.PP
+\fB\-t, \-\-title\fR \fISTRING\fR
+.RS 4
+Identify files by these titles in plots\&. The option can be given multiple times, for each ID in the
+\fBbcftools stats\fR
+output\&. If not present, the script will use abbreviated source file names for the titles\&.
+.RE
+.PP
+\fB\-T, \-\-main\-title\fR \fISTRING\fR
+.RS 4
+Main title for the PDF\&.
+.RE
+.SH "PERFORMANCE"
+.sp
+HTSlib was designed with BCF format in mind\&. When parsing VCF files, all records are internally converted into BCF representation\&. Simple operations, like removing a single column from a VCF file, can be therefore done much faster with standard UNIX commands, such as \fBawk\fR or \fBcut\fR\&. Therefore it is recommended to use BCF as input/output format whenever possible to avoid large overhead of the VCF → BCF → VCF conversion\&.
+.SH "BUGS"
+.sp
+Please report any bugs you encounter on the github website: http://github\&.com/samtools/bcftools
+.SH "AUTHORS"
+.sp
+Heng Li from the Sanger Institute wrote the original C version of htslib, samtools and bcftools\&. Bob Handsaker from the Broad Institute implemented the BGZF library\&. Petr Danecek, Shane McCarthy and John Marshall are maintaining and further developing bcftools\&. Many other people contributed to the program and to the file format specifications, both directly and indirectly by providing patches, testing and reporting bugs\&. We thank them all\&.
+.SH "RESOURCES"
+.sp
+BCFtools GitHub website: http://github\&.com/samtools/bcftools
+.sp
+Samtools GitHub website: http://github\&.com/samtools/samtools
+.sp
+HTSlib GitHub website: http://github\&.com/samtools/htslib
+.sp
+File format specifications: http://samtools\&.github\&.io/hts\-specs
+.sp
+BCFtools documentation: http://samtools\&.github\&.io/bcftools
+.sp
+BCFtools wiki page: https://github\&.com/samtools/bcftools/wiki
+.SH "COPYING"
+.sp
+The MIT/Expat License or GPL License, see the LICENSE document for details\&. Copyright (c) Genome Research Ltd\&.
diff --git a/doc/bcftools.html b/doc/bcftools.html
new file mode 100644
index 0000000..ef1b841
--- /dev/null
+++ b/doc/bcftools.html
@@ -0,0 +1,1634 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>bcftools</title><link rel="stylesheet" type="text/css" href="docbook-xsl.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.76.1" /></head><body><div xml:lang="en" class="refentry" title="bcftools" lang="en"><a id="idp25137184"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>bcftools — utilities for variant calling and manipu [...]
+Call Format (VCF) and its binary counterpart BCF. All commands work
+transparently with both VCFs and BCFs, both uncompressed and BGZF-compressed.</p><p>Most commands accept VCF, bgzipped VCF and BCF with filetype detected
+automatically even when streaming from a pipe. Indexed VCF and BCF
+will work in all situations. Un-indexed VCF and BCF and streams will
+work in most, but not all situations.</p><p>BCFtools is designed to work on a stream. It regards an input file "-" as the
+standard input (stdin) and outputs to the standard output (stdout). Several
+commands can thus be  combined  with  Unix pipes.</p><div class="refsect2" title="VERSION"><a id="_version"></a><h3>VERSION</h3><p>This manual page was last updated <span class="strong"><strong>2015-01-21 15:01 GMT</strong></span> and refers to bcftools git version <span class="strong"><strong>1.1-140-g9b0e7cc+</strong></span>.</p></div><div class="refsect2" title="BCF1"><a id="_bcf1"></a><h3>BCF1</h3><p>The BCF1 format output by versions of samtools <= 0.1.19 is <span class="strong"> [...]
+compatible with this version of bcftools. To read BCF1 files one can use
+the view command from old versions of bcftools packaged with samtools
+versions <= 0.1.19 to convert to VCF, which can then be read by
+this version of bcftools.</p><pre class="screen">    samtools-0.1.19/bcftools/bcftools view file.bcf1 | bcftools view</pre></div><div class="refsect2" title="VARIANT CALLING"><a id="_variant_calling"></a><h3>VARIANT CALLING</h3><p>See <span class="emphasis"><em>bcftools call</em></span> for variant calling from the output of the
+<span class="emphasis"><em>samtools mpileup</em></span> command. In versions of samtools <= 0.1.19 calling was
+done with <span class="emphasis"><em>bcftools view</em></span>. Users are now required to choose between the old
+samtools calling model (<span class="emphasis"><em>-c/--consensus-caller</em></span>) and the new multiallelic
+calling model (<span class="emphasis"><em>-m/--multiallelic-caller</em></span>). The multiallelic calling model
+is recommended for most tasks.</p></div></div><div class="refsect1" title="LIST OF COMMANDS"><a id="_list_of_commands"></a><h2>LIST OF COMMANDS</h2><p>For a full list of available commands, run <span class="strong"><strong>bcftools</strong></span> without arguments. For a full
+list of available options, run <span class="strong"><strong>bcftools</strong></span> <span class="emphasis"><em>COMMAND</em></span> without arguments.</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
+<span class="strong"><strong><a class="link" href="#annotate" title="bcftools annotate [OPTIONS] FILE">annotate</a></strong></span>   .. edit VCF files, add or remove annotations
+</li><li class="listitem">
+<span class="strong"><strong><a class="link" href="#call" title="bcftools call [OPTIONS] FILE">call</a></strong></span>        ..  SNP/indel calling (former "view")
+</li><li class="listitem">
+<span class="strong"><strong><a class="link" href="#concat" title="bcftools concat [OPTIONS] FILE1 FILE2 […]">concat</a></strong></span>    ..  concatenate VCF/BCF files from the same set of samples
+</li><li class="listitem">
+<span class="strong"><strong><a class="link" href="#consensus" title="bcftools consensus [OPTIONS] FILE">consensus</a></strong></span>    ..  create consensus sequence by applying VCF variants
+</li><li class="listitem">
+<span class="strong"><strong><a class="link" href="#convert" title="bcftools convert [OPTIONS] FILE">convert</a></strong></span>  ..  convert VCF/BCF to other formats and back
+</li><li class="listitem">
+<span class="strong"><strong><a class="link" href="#filter" title="bcftools filter [OPTIONS] FILE">filter</a></strong></span>    ..  filter VCF/BCF files using fixed thresholds
+</li><li class="listitem">
+<span class="strong"><strong><a class="link" href="#gtcheck" title="bcftools gtcheck [OPTIONS] [-g genotypes.vcf.gz] query.vcf.gz">gtcheck</a></strong></span>  ..  check sample concordance, detect sample swaps and contamination
+</li><li class="listitem">
+<span class="strong"><strong><a class="link" href="#index" title="bcftools index [OPTIONS] <in.bcf>|<in.vcf.gz>">index</a></strong></span>      ..  index VCF/BCF
+</li><li class="listitem">
+<span class="strong"><strong><a class="link" href="#isec" title="bcftools isec [OPTIONS] A.vcf.gz B.vcf.gz […]">isec</a></strong></span>        ..  intersections of VCF/BCF files
+</li><li class="listitem">
+<span class="strong"><strong><a class="link" href="#merge" title="bcftools merge [OPTIONS] A.vcf.gz B.vcf.gz […]">merge</a></strong></span>      ..  merge VCF/BCF files files from non-overlapping sample sets
+</li><li class="listitem">
+<span class="strong"><strong><a class="link" href="#norm" title="bcftools norm [OPTIONS] file.vcf.gz">norm</a></strong></span>        ..  normalize indels
+</li><li class="listitem">
+<span class="strong"><strong><a class="link" href="#plugin" title="bcftools plugin NAME [OPTIONS] FILE — [PLUGIN OPTIONS]">plugin</a></strong></span>    ..  run user-defined plugin
+</li><li class="listitem">
+<span class="strong"><strong><a class="link" href="#query" title="bcftools query [OPTIONS] file.vcf.gz [file.vcf.gz […]]">query</a></strong></span>      ..  transform VCF/BCF into user-defined formats
+</li><li class="listitem">
+<span class="strong"><strong><a class="link" href="#reheader" title="bcftools reheader [OPTIONS] file.vcf.gz">reheader</a></strong></span>   ..  modify VCF/BCF header, change sample names
+</li><li class="listitem">
+<span class="strong"><strong><a class="link" href="#roh" title="bcftools roh [OPTIONS] file.vcf.gz">roh</a></strong></span>          ..  identify runs of homo/auto-zygosity
+</li><li class="listitem">
+<span class="strong"><strong><a class="link" href="#stats" title="bcftools stats [OPTIONS] A.vcf.gz [B.vcf.gz]">stats</a></strong></span>      ..  produce VCF/BCF stats (former vcfcheck)
+</li><li class="listitem">
+<span class="strong"><strong><a class="link" href="#view" title="bcftools view [OPTIONS] file.vcf.gz [REGION […]]">view</a></strong></span>        ..  subset, filter and convert VCF and BCF files
+</li></ul></div></div><div class="refsect1" title="LIST OF SCRIPTS"><a id="_list_of_scripts"></a><h2>LIST OF SCRIPTS</h2><p>Some helper scripts are bundled with the bcftools code.</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
+<span class="strong"><strong><a class="link" href="#plot-vcfstats" title="plot-vcfstats [OPTIONS] file.vchk […]">plot-vcfstats</a></strong></span>  .. plots the output of <span class="strong"><strong><a class="link" href="#stats" title="bcftools stats [OPTIONS] A.vcf.gz [B.vcf.gz]">stats</a></strong></span>
+</li></ul></div></div><div class="refsect1" title="COMMANDS AND OPTIONS"><a id="_commands_and_options"></a><h2>COMMANDS AND OPTIONS</h2><div class="refsect2" title="Common Options"><a id="common_options"></a><h3>Common Options</h3><p>The following options are common to many bcftools commands. See usage for
+specific commands to see if they apply.</p><div class="variablelist"><dl><dt><span class="term">
+<span class="emphasis"><em>FILE</em></span>
+</span></dt><dd>
+    Files can be both VCF or BCF, uncompressed or BGZF-compressed. The file "-"
+    is interpreted as standard input. Some tools may require tabix- or
+    CSI-indexed files.
+</dd><dt><span class="term">
+<span class="strong"><strong>-c, --collapse</strong></span> <span class="emphasis"><em>snps</em></span>|<span class="emphasis"><em>indels</em></span>|<span class="emphasis"><em>both</em></span>|<span class="emphasis"><em>all</em></span>|<span class="emphasis"><em>some</em></span>|<span class="emphasis"><em>none</em></span>|<span class="emphasis"><em>id</em></span>
+</span></dt><dd><p class="simpara">
+    Controls  how to treat records with duplicate positions and defines compatible
+    records across multiple input files. Here by "compatible" we mean records which
+    should be considered as identical by the tools. For example, when performing
+    line intersections, the desire may be to consider as identical all sites with
+    matching positions (<span class="strong"><strong>bcftools isec -c</strong></span> <span class="emphasis"><em>all</em></span>), or only sites with  matching variant
+    type (<span class="strong"><strong>bcftools isec -c</strong></span> <span class="emphasis"><em>snps</em></span>  <span class="strong"><strong>-c</strong></span> <span class="emphasis"><em>indels</em></span>), or only sites with all alleles
+    identical (<span class="strong"><strong>bcftools isec -c</strong></span> <span class="emphasis"><em>none</em></span>).
+</p><div class="variablelist"><dl><dt><span class="term">
+<span class="emphasis"><em>none</em></span>
+</span></dt><dd>
+            only records with identical REF and ALT alleles are compatible
+</dd><dt><span class="term">
+<span class="emphasis"><em>some</em></span>
+</span></dt><dd>
+            only records where some subset of ALT alleles match are compatible
+</dd><dt><span class="term">
+<span class="emphasis"><em>all</em></span>
+</span></dt><dd>
+            all records are compatible, regardless of whether the ALT alleles
+            match or not. In the case of records with the same position, only
+            the first will be considered and appear on output.
+</dd><dt><span class="term">
+<span class="emphasis"><em>snps</em></span>
+</span></dt><dd>
+            any SNP records are compatible, regardless of whether the ALT
+            alleles match or not. For duplicate positions, only the first SNP
+            record will be considered and appear on output.
+</dd><dt><span class="term">
+<span class="emphasis"><em>indels</em></span>
+</span></dt><dd>
+            all  indel records are compatible, regardless of whether the REF
+            and ALT alleles match or not. For duplicate positions, only the
+            first indel record will be considered and appear on output.
+</dd><dt><span class="term">
+<span class="emphasis"><em>both</em></span>
+</span></dt><dd>
+            abbreviation of "<span class="strong"><strong>-c</strong></span> <span class="emphasis"><em>indels</em></span>  <span class="strong"><strong>-c</strong></span> <span class="emphasis"><em>snps</em></span>"
+</dd><dt><span class="term">
+<span class="emphasis"><em>id</em></span>
+</span></dt><dd>
+            only records with identical ID column are compatible.
+            Supported by <span class="strong"><strong><a class="link" href="#merge" title="bcftools merge [OPTIONS] A.vcf.gz B.vcf.gz […]">bcftools merge</a></strong></span> only.
+</dd></dl></div></dd><dt><span class="term">
+<span class="strong"><strong>-f, --apply-filters</strong></span> <span class="emphasis"><em>LIST</em></span>
+</span></dt><dd>
+    Skip sites where FILTER column does not contain any of the strings listed
+    in <span class="emphasis"><em>LIST</em></span>. For example, to include only sites which have no filters set,
+    use <span class="strong"><strong>-f</strong></span> <span class="emphasis"><em>.,PASS</em></span>.
+</dd><dt><span class="term">
+<span class="strong"><strong>-o, --output</strong></span> <span class="emphasis"><em>FILE</em></span>
+</span></dt><dd>
+    When output consists of a single stream, write it to <span class="emphasis"><em>FILE</em></span> rather than
+    to standard output, where it is written by default.
+</dd><dt><span class="term">
+<span class="strong"><strong>-O, --output-type</strong></span> <span class="emphasis"><em>b</em></span>|<span class="emphasis"><em>u</em></span>|<span class="emphasis"><em>z</em></span>|<span class="emphasis"><em>v</em></span>
+</span></dt><dd>
+    Output compressed BCF (<span class="emphasis"><em>b</em></span>), uncompressed BCF (<span class="emphasis"><em>u</em></span>), compressed VCF (<span class="emphasis"><em>z</em></span>), uncompressed VCF (<span class="emphasis"><em>v</em></span>).
+</dd><dt><span class="term">
+<span class="strong"><strong>-r, --regions</strong></span> <span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:from-to</em></span>|<span class="emphasis"><em>chr:from-</em></span>[,…]
+</span></dt><dd>
+    Comma-separated list of regions, see also <span class="strong"><strong>-R, --regions-file</strong></span>. Note
+    that <span class="strong"><strong>-r</strong></span> cannot be used in combination with <span class="strong"><strong>-R</strong></span>.
+</dd><dt><span class="term">
+<span class="strong"><strong>-R, --regions-file</strong></span> <span class="emphasis"><em>FILE</em></span>
+</span></dt><dd>
+    Regions can be specified either on command line or in a VCF, BED, or
+    tab-delimited file (the default).  The columns of the tab-delimited file
+    are: CHROM, POS, and,  optionally,  POS_TO,  where positions are 1-based
+    and inclusive.  Uncompressed files are stored in memory, while
+    bgzip-compressed and tabix-indexed region files are streamed.  Note that
+    sequence names must match exactly, "chr20" is not the same as "20".
+    Also note that chromosome ordering in <span class="emphasis"><em>FILE</em></span> will be respected,
+    the VCF will be processed in the order in which chromosomes first appear
+    in <span class="emphasis"><em>FILE</em></span>. However, within chromosomes, the VCF will always be
+    processed in ascending genomic coordinate order no matter what order they
+    appear in <span class="emphasis"><em>FILE</em></span>. Note that overlapping regions in <span class="emphasis"><em>FILE</em></span> can result in
+    duplicated out of order positions in the output.
+    This option requires indexed VCF/BCF files. Note that <span class="strong"><strong>-R</strong></span> cannot be used
+    in combination with <span class="strong"><strong>-r</strong></span>.
+</dd><dt><span class="term">
+<span class="strong"><strong>-s, --samples</strong></span> [^]<span class="emphasis"><em>LIST</em></span>
+</span></dt><dd>
+    Comma-separated list of samples to include or exclude if prefixed
+    with "^".
+</dd><dt><span class="term">
+<span class="strong"><strong>-S, --samples-file</strong></span> <span class="emphasis"><em><span class="^">FILE</span></em></span>
+</span></dt><dd>
+    File of sample names to include or exclude if prefixed with "^".
+    One sample per line.
+    The command <span class="strong"><strong><a class="link" href="#call" title="bcftools call [OPTIONS] FILE">bcftools call</a></strong></span> accepts an optional second
+    column indicating ploidy (0, 1 or 2) and can parse also PED files.
+    With <span class="strong"><strong><a class="link" href="#call" title="bcftools call [OPTIONS] FILE">bcftools call</a> -C</strong></span> <span class="emphasis"><em>trio</em></span>, PED file is expected.
+</dd><dt><span class="term">
+<span class="strong"><strong>-t, --targets</strong></span> [^]<span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:from-to</em></span>|<span class="emphasis"><em>chr:from-</em></span>[,…]
+</span></dt><dd>
+    Similar as <span class="strong"><strong>-r, --regions</strong></span>, but the next position is accessed by streaming the
+    whole VCF/BCF rather than using the tbi/csi index. Both <span class="strong"><strong>-r</strong></span> and <span class="strong"><strong>-t</strong></span> options
+    can be applied simultaneously: <span class="strong"><strong>-r</strong></span>  uses  the index  to  jump  to  a  region
+    and <span class="strong"><strong>-t</strong></span> discards positions which are not in the targets. Unlike <span class="strong"><strong>-r</strong></span>, targets
+    can be prefixed with "^" to request logical complement. For example, "^X,Y,MT"
+    indicates that sequences X, Y and MT should be skipped.
+    Yet another difference between the two is that <span class="strong"><strong>-r</strong></span> checks both start and
+    end positions of indels, whereas <span class="strong"><strong>-t</strong></span> checks start positions only. Note
+    that <span class="strong"><strong>-t</strong></span> cannot be used in combination with <span class="strong"><strong>-T</strong></span>.
+</dd><dt><span class="term">
+<span class="strong"><strong>-T, --targets-file</strong></span> [^]<span class="emphasis"><em>FILE</em></span>
+</span></dt><dd>
+    Same <span class="strong"><strong>-t, --targets</strong></span>, but reads regions from a file. Note that <span class="strong"><strong>-T</strong></span>
+    cannot be used in combination with <span class="strong"><strong>-t</strong></span>.
+</dd><dt><span class="term">
+ 
+</span></dt><dd>
+    With the <span class="strong"><strong>call -C</strong></span> <span class="emphasis"><em>alleles</em></span> command, third column of the targets file must
+    be comma-separated list of alleles, starting with the reference allele.
+    Such a file can be easily created from a VCF using:
+</dd></dl></div><pre class="screen">    bcftools query -f'%CHROM\t%POS\t%REF,%ALT\n' file.vcf</pre></div><div class="refsect2" title="bcftools annotate [OPTIONS] FILE"><a id="annotate"></a><h3>bcftools annotate <span class="emphasis"><em>[OPTIONS]</em></span> <span class="emphasis"><em>FILE</em></span></h3><p>This command allows to add or remove annotations.</p><div class="variablelist"><dl><dt><span class="term">
+<span class="strong"><strong>-a, --annotations</strong></span> <span class="emphasis"><em>file</em></span>
+</span></dt><dd>
+    Bgzip-compressed and tabix-indexed file with annotations. The file
+    can be VCF, BED, or a tab-delimited file with mandatory columns CHROM, POS
+    (or, alternatively, FROM and TO), optional columns REF and ALT, and arbitrary
+    number of annotation columns. BED files are expected to have
+    the ".bed" or ".bed.gz" suffix (case-insensitive), otherwise a tab-delimited file is assumed.
+    Note that in case of tab-delimited file, the coordinates POS, FROM and TO are
+    one-based and inclusive.  When REF and ALT are present, only matching VCF
+    records will be annotated.
+    When multiple ALT alleles are present in the annotation file (given as
+    comma-separated list of alleles), at least one must match one of the
+    alleles in the corresponding VCF record. Similarly, at least one
+    alternate allele from a multi-allelic VCF record must be present in the
+    annotation file.
+    Note that flag types, such as "INFO/FLAG", can be annotated by including
+    a field with the value "1" to set the flag, "0" to remove it, or "." to
+    keep existing flags.
+    See also <span class="strong"><strong>-c, --columns</strong></span> and <span class="strong"><strong>-h, --header-lines</strong></span>.
+</dd></dl></div><pre class="screen">    # Sample annotation file with columns CHROM, POS, STRING_TAG, NUMERIC_TAG
+    1  752566  SomeString      5
+    1  798959  SomeOtherString 6
+    # etc.</pre><div class="variablelist"><dl><dt><span class="term">
+<span class="strong"><strong>-c, --columns</strong></span> <span class="emphasis"><em>list</em></span>
+</span></dt><dd>
+    Comma-separated list of columns or tags to carry over from the annotation file
+    (see also <span class="strong"><strong>-a, --annotations</strong></span>). If the annotation file is not a VCF/BCF,
+    <span class="emphasis"><em>list</em></span> describes the columns of the annotation file and must include CHROM,
+    POS (or, alternatively, FROM and TO), and optionally REF and ALT. Unused
+    columns which should be ignored can be indicated by "-".
+    If the annotation file is a VCF/BCF, only the edited columns/tags must be present and their
+    order does not matter. The columns ID, QUAL, FILTER, INFO and FORMAT
+    can be edited, where INFO tags can be written both as "INFO/TAG" or simply "TAG",
+    and FORMAT tags can be written as "FORMAT/TAG" or "FMT/TAG".
+    To carry over all INFO annotations, use "INFO". To add all INFO annotations except
+    "TAG", use "^INFO/TAG". By default, existing values are replaced. To add
+    values without overwriting existing annotations, use "+TAG" instead of "TAG".
+    To replace only existing values without modifying missing annotations, use "-TAG".
+    If the annotation file is not a VCF/BCF, all new annotations must be
+    defined via <span class="strong"><strong>-h, --header-lines</strong></span>.
+</dd><dt><span class="term">
+<span class="strong"><strong>-e, --exclude</strong></span> <span class="emphasis"><em>EXPRESSION</em></span>
+</span></dt><dd>
+    exclude sites for which <span class="emphasis"><em>EXPRESSION</em></span> is true. For valid expressions see
+    <span class="strong"><strong><a class="link" href="#expressions" title="EXPRESSIONS">EXPRESSIONS</a></strong></span>.
+</dd><dt><span class="term">
+<span class="strong"><strong>-h, --header-lines</strong></span> <span class="emphasis"><em>file</em></span>
+</span></dt><dd>
+    Lines to append to the VCF header, see also <span class="strong"><strong>-c, --columns</strong></span> and <span class="strong"><strong>-a, --annotations</strong></span>. For example:
+</dd></dl></div><pre class="screen">    ##INFO=<ID=NUMERIC_TAG,Number=1,Type=Integer,Description="Example header line">
+    ##INFO=<ID=STRING_TAG,Number=1,Type=String,Description="Yet another header line"></pre><div class="variablelist"><dl><dt><span class="term">
+<span class="strong"><strong>-I, --set-id</strong></span> [+]<span class="emphasis"><em>FORMAT</em></span>
+</span></dt><dd>
+    assign ID on the fly. The format is the same as in the <span class="strong"><strong><a class="link" href="#query" title="bcftools query [OPTIONS] file.vcf.gz [file.vcf.gz […]]">query</a></strong></span>
+    command (see below).  By default all existing IDs are replaced. If the
+    format string is preceded by "+", only missing IDs will be set. For example,
+    one can use
+</dd></dl></div><pre class="screen">    bcftools annotate --set-id +'%CHROM\_%POS\_%REF\_%FIRST_ALT' file.vcf</pre><div class="variablelist"><dl><dt><span class="term">
+<span class="strong"><strong>-i, --include</strong></span> <span class="emphasis"><em>EXPRESSION</em></span>
+</span></dt><dd>
+    include only sites for which <span class="emphasis"><em>EXPRESSION</em></span> is true. For valid expressions see
+    <span class="strong"><strong><a class="link" href="#expressions" title="EXPRESSIONS">EXPRESSIONS</a></strong></span>.
+</dd><dt><span class="term">
+<span class="strong"><strong>-o, --output</strong></span> <span class="emphasis"><em>FILE</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-O, --output-type</strong></span> <span class="emphasis"><em>b</em></span>|<span class="emphasis"><em>u</em></span>|<span class="emphasis"><em>z</em></span>|<span class="emphasis"><em>v</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-r, --regions</strong></span> <span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:from-to</em></span>|<span class="emphasis"><em>chr:from-</em></span>[,…]
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-R, --regions-file</strong></span> <span class="emphasis"><em>file</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>--rename-chrs</strong></span> <span class="emphasis"><em>file</em></span>
+</span></dt><dd>
+    rename chromosomes according to the map in <span class="emphasis"><em>file</em></span>, with
+    "old_name new_name\n" pairs separated by whitespaces, each on a separate
+    line.
+</dd><dt><span class="term">
+<span class="strong"><strong>-s, --samples</strong></span> [^]<span class="emphasis"><em>LIST</em></span>
+</span></dt><dd>
+    subset of samples to annotate, see also <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-S, --samples-file</strong></span> <span class="emphasis"><em>FILE</em></span>
+</span></dt><dd>
+    subset of samples to annotate. If the samples are named differently in the
+    target VCF and the <span class="strong"><strong>-a, --annotations</strong></span> VCF, the name mapping can be
+    given as "src_name dst_name\n", separated by whitespaces, each pair on a
+    separate line.
+</dd><dt><span class="term">
+<span class="strong"><strong>-x, --remove</strong></span> <span class="emphasis"><em>list</em></span>
+</span></dt><dd>
+    List of annotations to remove. Use "FILTER" to remove all filters or
+    "FILTER/SomeFilter" to remove a specific filter. Similarly, "INFO" can
+    be used to remove all INFO tags and "FORMAT" to remove all FORMAT tags
+    except GT. To remove all INFO tags except "FOO" and "BAR", use
+    "^INFO/FOO,INFO/BAR" (and similarly for FORMAT and FILTER).
+    "INFO" can be abbreviated to "INF" and "FORMAT" to "FMT".
+</dd></dl></div><p><span class="strong"><strong>Examples:</strong></span></p><pre class="screen">    # Remove three fields
+    bcftools annotate -x ID,INFO/DP,FORMAT/DP file.vcf.gz
+
+    # Remove all INFO fields and all FORMAT fields except for GT and PL
+    bcftools annotate -x INFO,^FORMAT/GT,FORMAT/PL file.vcf
+
+    # Add ID, QUAL and INFO/TAG, not replacing TAG if already present
+    bcftools annotate -a src.bcf -c ID,QUAL,+TAG dst.bcf
+
+    # Carry over all INFO and FORMAT annotations except FORMAT/GT
+    bcftools annotate -a src.bcf -c INFO,^FORMAT/GT dst.bcf
+
+    # Annotate from a tab-delimited file with six columns (the fifth is ignored),
+    # first indexing with tabix. The coordinates are 1-based.
+    tabix -s1 -b2 -e2 annots.tab.gz
+    bcftools annotate -a annots.tab.gz -h annots.hdr -c CHROM,POS,REF,ALT,-,TAG file.vcf
+
+    # Annotate from a tab-delimited file with regions (1-based coordinates, inclusive)
+    tabix -s1 -b2 -e3 annots.tab.gz
+    bcftools annotate -a annots.tab.gz -h annots.hdr -c CHROM,FROM,TO,TAG inut.vcf
+
+    # Annotate from a bed file (0-based coordinates, half-closed, half-open intervals)
+    bcftools annotate -a annots.bed.gz -h annots.hdr -c CHROM,FROM,TO,TAG input.vcf</pre></div><div class="refsect2" title="bcftools call [OPTIONS] FILE"><a id="call"></a><h3>bcftools call <span class="emphasis"><em>[OPTIONS]</em></span> <span class="emphasis"><em>FILE</em></span></h3><p>This command replaces the former <span class="strong"><strong>bcftools view</strong></span> caller. Some of the original
+functionality has been temporarily lost in the process of transition under
+<a class="ulink" href="http://github.com/samtools/htslib" target="_top">htslib</a>, but will be added back on popular
+demand. The original calling model can be invoked with the <span class="strong"><strong>-c</strong></span> option.</p><div class="refsect3" title="File format options:"><a id="_file_format_options"></a><h4>File format options:</h4><div class="variablelist"><dl><dt><span class="term">
+<span class="strong"><strong>-O, --output-type</strong></span> <span class="emphasis"><em>b</em></span>|<span class="emphasis"><em>u</em></span>|<span class="emphasis"><em>z</em></span>|<span class="emphasis"><em>v</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-r, --regions</strong></span> <span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:from-to</em></span>|<span class="emphasis"><em>chr:from-</em></span>[,…]
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-R, --regions-file</strong></span> <span class="emphasis"><em>file</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-s, --samples</strong></span> <span class="emphasis"><em>LIST</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-S, --samples-file</strong></span> <span class="emphasis"><em>FILE</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-t, --targets</strong></span> <span class="emphasis"><em>LIST</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-T, --targets-file</strong></span> <span class="emphasis"><em>FILE</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd></dl></div></div><div class="refsect3" title="Input/output options:"><a id="_input_output_options"></a><h4>Input/output options:</h4><div class="variablelist"><dl><dt><span class="term">
+<span class="strong"><strong>-A, --keep-alts</strong></span>
+</span></dt><dd>
+    output all alternate alleles present in the alignments even if they do not
+    appear in any of the genotypes
+</dd><dt><span class="term">
+<span class="strong"><strong>-f, --format-fields</strong></span> <span class="emphasis"><em>list</em></span>
+</span></dt><dd>
+    comma-separated list of FORMAT fields to output for each sample. Currently
+    GQ and GP fields are supported. For convenience, the fields can be given
+    as lower case letters.
+</dd><dt><span class="term">
+<span class="strong"><strong>-g, --gvcf</strong></span> <span class="emphasis"><em>INT</em></span>
+</span></dt><dd>
+    output also gVCF blocks of homozygous REF calls. The parameter <span class="emphasis"><em>INT</em></span> is the
+    minimum per-sample depth required to include a site in the non-variant
+    block.
+</dd><dt><span class="term">
+<span class="strong"><strong>-M, --keep-masked-ref</strong></span>
+</span></dt><dd>
+    output sites where REF allele is N
+</dd><dt><span class="term">
+<span class="strong"><strong>-o, --output</strong></span> <span class="emphasis"><em>FILE</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-V, --skip-variants</strong></span> <span class="emphasis"><em>snps</em></span>|<span class="emphasis"><em>indels</em></span>
+</span></dt><dd>
+    skip indel/SNP sites
+</dd><dt><span class="term">
+<span class="strong"><strong>-v, --variants-only</strong></span>
+</span></dt><dd>
+    output variant sites only
+</dd></dl></div></div><div class="refsect3" title="Consensus/variant calling options:"><a id="_consensus_variant_calling_options"></a><h4>Consensus/variant calling options:</h4><div class="variablelist"><dl><dt><span class="term">
+<span class="strong"><strong>-c, --consensus-caller</strong></span>
+</span></dt><dd>
+    the original <span class="strong"><strong>samtools</strong></span>/<span class="strong"><strong>bcftools</strong></span> calling method (conflicts with <span class="strong"><strong>-m</strong></span>)
+</dd><dt><span class="term">
+<span class="strong"><strong>-C, --constrain</strong></span> <span class="emphasis"><em>alleles</em></span>|<span class="emphasis"><em>trio</em></span>
+</span></dt><dd><div class="variablelist"><dl><dt><span class="term">
+<span class="emphasis"><em>alleles</em></span>
+</span></dt><dd>
+            call genotypes given alleles. See also <span class="strong"><strong>-T, --targets-file</strong></span>.
+</dd><dt><span class="term">
+<span class="emphasis"><em>trio</em></span>
+</span></dt><dd>
+            call genotypes given the father-mother-child constraint. See also
+            <span class="strong"><strong>-s, --samples</strong></span> and <span class="strong"><strong>-n, --novel-rate</strong></span>.
+</dd></dl></div></dd><dt><span class="term">
+<span class="strong"><strong>-m, --multiallelic-caller</strong></span>
+</span></dt><dd>
+    alternative modelfor multiallelic and rare-variant calling designed to
+    overcome known limitations in <span class="strong"><strong>-c</strong></span> calling model (conflicts with <span class="strong"><strong>-c</strong></span>)
+</dd><dt><span class="term">
+<span class="strong"><strong>-n, --novel-rate</strong></span> <span class="emphasis"><em>float</em></span>[,…]
+</span></dt><dd>
+    likelihood of novel mutation for constrained <span class="strong"><strong>-C</strong></span> <span class="emphasis"><em>trio</em></span> calling. The trio
+    genotype calling maximizes likelihood of a particular combination of
+    genotypes for father, mother and the child
+    P(F=i,M=j,C=k) = P(unconstrained) * Pn + P(constrained) * (1-Pn).
+    By providing three values, the mutation rate Pn is set explictly for SNPs,
+    deletions and insertions, respectively.  If two values are given, the first
+    is interpreted as the mutation rate of SNPs and the second is used to
+    calculate the mutation rate of indels according to their length as
+    Pn=<span class="emphasis"><em>float</em></span>*exp(-a-b*len), where a=22.8689, b=0.2994 for insertions and
+    a=21.9313, b=0.2856 for deletions [pubmed:23975140].  If only one value is
+    given, the same mutation rate Pn is used for SNPs and indels.
+</dd><dt><span class="term">
+<span class="strong"><strong>-p, --pval-threshold</strong></span> <span class="emphasis"><em>float</em></span>
+</span></dt><dd>
+    with <span class="strong"><strong>-c</strong></span>, accept variant if P(ref|D) < <span class="emphasis"><em>float</em></span>.
+</dd><dt><span class="term">
+<span class="strong"><strong>-P, --prior</strong></span> <span class="emphasis"><em>float</em></span>
+</span></dt><dd>
+    expected substitution rate, or 0 to disable the prior.
+</dd><dt><span class="term">
+<span class="strong"><strong>-t, --targets</strong></span> <span class="emphasis"><em>file</em></span>|<span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:from-to</em></span>|<span class="emphasis"><em>chr:from-</em></span>[,…]
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-X, --chromosome-X</strong></span>
+</span></dt><dd>
+    haploid output for male samples (requires PED file with <span class="strong"><strong>-s</strong></span>)
+</dd><dt><span class="term">
+<span class="strong"><strong>-Y, --chromosome-Y</strong></span>
+</span></dt><dd>
+    haploid output for males and skips females (requires PED file with <span class="strong"><strong>-s</strong></span>)
+</dd></dl></div></div></div><div class="refsect2" title="bcftools concat [OPTIONS] FILE1 FILE2 […]"><a id="concat"></a><h3>bcftools concat <span class="emphasis"><em>[OPTIONS]</em></span> <span class="emphasis"><em>FILE1</em></span> <span class="emphasis"><em>FILE2</em></span> […]</h3><p>Concatenate or combine VCF/BCF files. All source files must have the same sample
+columns appearing in the same order. Can be used, for example, to
+concatenate chromosome VCFs into one VCF, or combine a SNP VCF and an indel
+VCF into one. The input files must be sorted by chr and position. The files
+must be given in the correct order to produce sorted VCF on output unless
+the <span class="strong"><strong>-a, --allow-overlaps</strong></span> option is specified.</p><div class="variablelist"><dl><dt><span class="term">
+<span class="strong"><strong>-a, --allow-overlaps</strong></span>
+</span></dt><dd>
+    First coordinate of the next file can precede last record of the current file.
+</dd><dt><span class="term">
+<span class="strong"><strong>-D, --remove-duplicates</strong></span>
+</span></dt><dd>
+    If a record is present in multiple files, output only the first instance.
+    Requires <span class="strong"><strong>-a, --allow-overlaps</strong></span>.
+</dd><dt><span class="term">
+<span class="strong"><strong>-f, --file-list</strong></span> <span class="emphasis"><em>FILE</em></span>
+</span></dt><dd>
+    Read the list of files from a file.
+</dd><dt><span class="term">
+<span class="strong"><strong>-l, --ligate</strong></span>
+</span></dt><dd>
+    Ligate phased VCFs by matching phase at overlapping haplotypes
+</dd><dt><span class="term">
+<span class="strong"><strong>-o, --output</strong></span> <span class="emphasis"><em>FILE</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-O, --output-type</strong></span> <span class="emphasis"><em>b</em></span>|<span class="emphasis"><em>u</em></span>|<span class="emphasis"><em>z</em></span>|<span class="emphasis"><em>v</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-q, --min-PQ</strong></span> <span class="emphasis"><em>INT</em></span>
+</span></dt><dd>
+    Break phase set if phasing quality is lower than <span class="emphasis"><em>INT</em></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-r, --regions</strong></span> <span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:from-to</em></span>|<span class="emphasis"><em>chr:from-</em></span>[,…]
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>. Requires <span class="strong"><strong>-a, --allow-overlaps</strong></span>.
+</dd><dt><span class="term">
+<span class="strong"><strong>-R, --regions-file</strong></span> <span class="emphasis"><em>FILE</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>. Requires <span class="strong"><strong>-a, --allow-overlaps</strong></span>.
+</dd></dl></div></div><div class="refsect2" title="bcftools consensus [OPTIONS] FILE"><a id="consensus"></a><h3>bcftools consensus <span class="emphasis"><em>[OPTIONS]</em></span> <span class="emphasis"><em>FILE</em></span></h3><p>Create consensus sequence by applying VCF variants to a reference fasta file.</p><div class="variablelist"><dl><dt><span class="term">
+<span class="strong"><strong>-f, --fasta-ref</strong></span> <span class="emphasis"><em>FILE</em></span>
+</span></dt><dd>
+    reference sequence in fasta format
+</dd><dt><span class="term">
+<span class="strong"><strong>-H, --haplotype</strong></span> <span class="emphasis"><em>1</em></span>|<span class="emphasis"><em>2</em></span>
+</span></dt><dd>
+    apply variants for the given haplotype. This option requires <span class="strong"><strong>-s</strong></span>, unless
+    exactly one sample is present in the VCF
+</dd><dt><span class="term">
+<span class="strong"><strong>-i, --iupac-codes</strong></span>
+</span></dt><dd>
+    output variants in the form of IUPAC ambiguity codes
+</dd><dt><span class="term">
+<span class="strong"><strong>-m, --mask</strong></span> <span class="emphasis"><em>FILE</em></span>
+</span></dt><dd>
+    BED file or TAB file with regions to be replaced with N. See discussion
+    of <span class="strong"><strong>--regions-file</strong></span> in <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span> for file
+    format details.
+</dd><dt><span class="term">
+<span class="strong"><strong>-o, --output</strong></span> <span class="emphasis"><em>FILE</em></span>
+</span></dt><dd>
+    write output to a file
+</dd><dt><span class="term">
+<span class="strong"><strong>-s, --sample</strong></span> <span class="emphasis"><em>NAME</em></span>
+</span></dt><dd>
+    apply variants of the given sample
+</dd></dl></div><p><span class="strong"><strong>Examples:</strong></span></p><pre class="screen">    # Apply variants present in sample "NA001", output IUPAC codes for hets
+    bcftools consensus -i -s NA001 -f in.fa in.vcf.gz > out.fa
+
+    # Create consensus for one region. The fasta header lines are then expected
+    # in the form ">chr:from-to".
+    samtools faidx ref.fa 8:11870-11890 | bcftools consensus in.vcf.gz -o out.fa</pre></div><div class="refsect2" title="bcftools convert [OPTIONS] FILE"><a id="convert"></a><h3>bcftools convert <span class="emphasis"><em>[OPTIONS]</em></span> <span class="emphasis"><em>FILE</em></span></h3><div class="refsect3" title="VCF input options:"><a id="_vcf_input_options"></a><h4>VCF input options:</h4><div class="variablelist"><dl><dt><span class="term">
+<span class="strong"><strong>-e, --exclude</strong></span> <span class="emphasis"><em>EXPRESSION</em></span>
+</span></dt><dd>
+    exclude sites for which <span class="emphasis"><em>EXPRESSION</em></span> is true. For valid expressions see
+    <span class="strong"><strong><a class="link" href="#expressions" title="EXPRESSIONS">EXPRESSIONS</a></strong></span>.
+</dd><dt><span class="term">
+<span class="strong"><strong>-i, --include</strong></span> <span class="emphasis"><em>EXPRESSION</em></span>
+</span></dt><dd>
+    include only sites for which <span class="emphasis"><em>EXPRESSION</em></span> is true. For valid expressions see
+    <span class="strong"><strong><a class="link" href="#expressions" title="EXPRESSIONS">EXPRESSIONS</a></strong></span>.
+</dd><dt><span class="term">
+<span class="strong"><strong>-r, --regions</strong></span> <span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:from-to</em></span>|<span class="emphasis"><em>chr:from-</em></span>[,…]
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-R, --regions-file</strong></span> <span class="emphasis"><em>FILE</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-s, --samples</strong></span> <span class="emphasis"><em>LIST</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-S, --samples-file</strong></span> <span class="emphasis"><em>FILE</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-t, --targets</strong></span> <span class="emphasis"><em>LIST</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-T, --targets-file</strong></span> <span class="emphasis"><em>FILE</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd></dl></div></div><div class="refsect3" title="VCF output options:"><a id="_vcf_output_options"></a><h4>VCF output options:</h4><div class="variablelist"><dl><dt><span class="term">
+<span class="strong"><strong>-o, --output</strong></span> <span class="emphasis"><em>FILE</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-O, --output-type</strong></span> <span class="emphasis"><em>b</em></span>|<span class="emphasis"><em>u</em></span>|<span class="emphasis"><em>z</em></span>|<span class="emphasis"><em>v</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd></dl></div></div><div class="refsect3" title="GEN/SAMPLE conversion:"><a id="_gen_sample_conversion"></a><h4>GEN/SAMPLE conversion:</h4><div class="variablelist"><dl><dt><span class="term">
+<span class="strong"><strong>-G, --gensample2vcf</strong></span> <span class="emphasis"><em>prefix</em></span> or <span class="emphasis"><em>gen-file</em></span>,<span class="emphasis"><em>sample-file</em></span>
+</span></dt><dd>
+    convert IMPUTE2 output to VCF. The second column must be of the form
+    "CHROM:POS_REF_ALT" to detect possible strand swaps; IMPUTE2 leaves the
+    first one empty ("--") when sites from reference panel are filled in. See
+    also <span class="strong"><strong>-g</strong></span> below.
+</dd><dt><span class="term">
+<span class="strong"><strong>-g, --gensample</strong></span> <span class="emphasis"><em>prefix</em></span> or <span class="emphasis"><em>gen-file</em></span>,<span class="emphasis"><em>sample-file</em></span>
+</span></dt><dd>
+    convert from VCF to gen/sample format used by IMPUTE2 and SHAPEIT.
+    The columns of .gen file format are ID1,ID2,POS,A,B followed by three
+    genotype probabilities P(AA), P(AB), P(BB) for each sample.  In order to
+    prevent strand swaps, the program uses IDs of the form "CHROM:POS_REF_ALT".
+    For example:
+</dd></dl></div><pre class="screen">  .gen
+  ----
+  1:111485207_G_A 1:111485207_G_A 111485207 G A 0 1 0 0 1 0
+  1:111494194_C_T 1:111494194_C_T 111494194 C T 0 1 0 0 0 1
+
+  .sample
+  -------
+  ID_1 ID_2 missing
+  0 0 0
+  sample1 sample1 0
+  sample2 sample2 0</pre><div class="variablelist"><dl><dt><span class="term">
+<span class="strong"><strong>--tag</strong></span> <span class="emphasis"><em>STRING</em></span>
+</span></dt><dd>
+    tag to take values for .gen file: GT,PL,GL,GP
+</dd></dl></div></div><div class="refsect3" title="gVCF conversion:"><a id="_gvcf_conversion"></a><h4>gVCF conversion:</h4><div class="variablelist"><dl><dt><span class="term">
+<span class="strong"><strong>--gvcf2vcf</strong></span>
+</span></dt><dd>
+    convert gVCF to VCF, expanding REF blocks into sites. Only sites
+    with FILTER set to "PASS" or "." will be expanded.
+</dd></dl></div></div><div class="refsect3" title="HAPS/SAMPLE conversion:"><a id="_haps_sample_conversion"></a><h4>HAPS/SAMPLE conversion:</h4><div class="variablelist"><dl><dt><span class="term">
+<span class="strong"><strong>--hapsample2vcf</strong></span> <span class="emphasis"><em>prefix</em></span> or <span class="emphasis"><em>haps-file</em></span>,<span class="emphasis"><em>sample-file</em></span>
+</span></dt><dd>
+    convert from haps/sample format to VCF. The columns of .haps file are
+    similar to .gen file above, but there are only two haplotype columns per
+    sample. Note that the first column of the haps file is expected to be in
+    the form "CHR:POS_REF_ALT", for example:
+</dd></dl></div><pre class="screen">  .haps
+  ----
+  1:111485207_G_A rsID1 111485207 G A 0 1 0 0
+  1:111494194_C_T rsID2 111494194 C T 0 1 0 0</pre></div><div class="refsect3" title="HAPS/LEGEND/SAMPLE conversion:"><a id="_haps_legend_sample_conversion"></a><h4>HAPS/LEGEND/SAMPLE conversion:</h4><div class="variablelist"><dl><dt><span class="term">
+<span class="strong"><strong>-H, --haplegendsample2vcf</strong></span> <span class="emphasis"><em>prefix</em></span> or <span class="emphasis"><em>haps-file</em></span>,<span class="emphasis"><em>legend-file</em></span>,<span class="emphasis"><em>sample-file</em></span>
+</span></dt><dd>
+    convert from haps/legend/sample format used by IMPUTE2 to VCF, see
+    also <span class="strong"><strong>-h, --hapslegendsample</strong></span> below.
+</dd><dt><span class="term">
+<span class="strong"><strong>-h, --haplegendsample</strong></span> <span class="emphasis"><em>prefix</em></span> or <span class="emphasis"><em>haps-file</em></span>,<span class="emphasis"><em>legend-file</em></span>,<span class="emphasis"><em>sample-file</em></span>
+</span></dt><dd>
+    convert from VCF to haps/legend/sample format used by IMPUTE2 and SHAPEIT.
+    The columns of .legend file ID,POS,REF,ALT. In order to prevent strand
+    swaps, the program uses IDs of the form "CHROM:POS_REF_ALT". The .sample
+    file is quite basic at the moment with columns for population, group and
+    sex expected to be edited by the user. For example:
+</dd></dl></div><pre class="screen">  .haps
+  -----
+  0 1 0 0 1 0
+  0 1 0 0 0 1
+
+  .legend
+  -------
+  id position a0 a1
+  1:111485207_G_A 111485207 G A
+  1:111494194_C_T 111494194 C T
+
+  .sample
+  -------
+  sample population group sex
+  sample1 sample1 sample1 2
+  sample2 sample2 sample2 2</pre><div class="variablelist"><dl><dt><span class="term">
+<span class="strong"><strong>--haploid2diploid</strong></span>
+</span></dt><dd>
+    with <span class="strong"><strong>-h</strong></span> option converts haploid genotypes to homozygous diploid
+    genotypes. For example, the program will print <span class="emphasis"><em>0 0</em></span> instead of the
+    default <span class="emphasis"><em>0 -</em></span>. This is useful for programs which do not handle haploid
+    genotypes correctly.
+</dd><dt><span class="term">
+<span class="strong"><strong>--vcf-ids</strong></span>
+</span></dt><dd>
+    output VCF IDs instead of "CHROM:POS_REF_ALT" IDs
+</dd></dl></div></div><div class="refsect3" title="TSV conversion:"><a id="_tsv_conversion"></a><h4>TSV conversion:</h4><div class="variablelist"><dl><dt><span class="term">
+<span class="strong"><strong>--tsv2vcf</strong></span> <span class="emphasis"><em>file</em></span>
+</span></dt><dd>
+    convert from TSV (tab-separated values) format (such as generated by
+    23andMe) to VCF. The input file fields can be tab- or space- delimited
+</dd><dt><span class="term">
+<span class="strong"><strong>-c, --columns</strong></span> <span class="emphasis"><em>list</em></span>
+</span></dt><dd>
+    comma-separated list of fields in the input file. In the current
+    version, the fields CHROM, POS, ID, and AA are expected and
+    can appear in arbitrary order, columns which should be ignored in the input
+    file can be indicated by "-".
+    The AA field lists alleles on the forward reference strand,
+    for example "CC" or "CT" for diploid genotypes or "C"
+    for haploid genotypes (sex chromosomes). Insertions and deletions
+    are not supported yet, missing data can be indicated with "--".
+</dd><dt><span class="term">
+<span class="strong"><strong>-f, --fasta-ref</strong></span> <span class="emphasis"><em>file</em></span>
+</span></dt><dd>
+    reference sequence in fasta format
+</dd><dt><span class="term">
+<span class="strong"><strong>-s, --samples</strong></span> <span class="emphasis"><em>LIST</em></span>
+</span></dt><dd>
+    list of sample names. See <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-S, --samples-file</strong></span> <span class="emphasis"><em>FILE</em></span>
+</span></dt><dd>
+    file of sample names. See <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd></dl></div><p><span class="strong"><strong>Example:</strong></span></p><pre class="screen"># Convert 23andme results into VCF
+bcftools convert -c ID,CHROM,POS,AA -s SampleName -f 23andme-ref.fa --tsv2vcf 23andme.txt -Oz -o out.vcf.gz</pre></div></div><div class="refsect2" title="bcftools filter [OPTIONS] FILE"><a id="filter"></a><h3>bcftools filter <span class="emphasis"><em>[OPTIONS]</em></span> <span class="emphasis"><em>FILE</em></span></h3><p>Apply fixed-threshold filters.</p><div class="variablelist"><dl><dt><span class="term">
+<span class="strong"><strong>-e, --exclude</strong></span> <span class="emphasis"><em>EXPRESSION</em></span>
+</span></dt><dd>
+    exclude sites for which <span class="emphasis"><em>EXPRESSION</em></span> is true. For valid expressions see
+    <span class="strong"><strong><a class="link" href="#expressions" title="EXPRESSIONS">EXPRESSIONS</a></strong></span>.
+</dd><dt><span class="term">
+<span class="strong"><strong>-g, --SnpGap</strong></span> <span class="emphasis"><em>INT</em></span>
+</span></dt><dd>
+    filter SNPs within <span class="emphasis"><em>INT</em></span> base pairs of an indel. The following example
+    demonstrates the logic of <span class="strong"><strong>--SnpGap</strong></span> <span class="emphasis"><em>3</em></span> applied on a deletion and
+    an insertion:
+</dd></dl></div><pre class="screen">The SNPs at positions 1 and 7 are filtered, positions 0 and 8 are not:
+         0123456789
+    ref  .G.GT..G..
+    del  .A.G-..A..
+Here the positions 1 and 6 are filtered, 0 and 7 are not:
+         0123-456789
+    ref  .G.G-..G..
+    ins  .A.GT..A..</pre><div class="variablelist"><dl><dt><span class="term">
+<span class="strong"><strong>-G, --IndelGap</strong></span> <span class="emphasis"><em>INT</em></span>
+</span></dt><dd>
+    filter clusters of indels separated by <span class="emphasis"><em>INT</em></span> or fewer base pairs allowing
+    only one to pass. The following example demonstrates the logic of
+    <span class="strong"><strong>--IndelGap</strong></span> <span class="emphasis"><em>2</em></span> applied on a deletion and an insertion:
+</dd></dl></div><pre class="screen">The second indel is filtered:
+         012345678901
+    ref  .GT.GT..GT..
+    del  .G-.G-..G-..
+And similarly here, the second is filtered:
+         01 23 456 78
+    ref  .A-.A-..A-..
+    ins  .AT.AT..AT..</pre><div class="variablelist"><dl><dt><span class="term">
+<span class="strong"><strong>-i, --include</strong></span> <span class="emphasis"><em>EXPRESSION</em></span>
+</span></dt><dd>
+    include only sites for which <span class="emphasis"><em>EXPRESSION</em></span> is true. For valid expressions see
+    <span class="strong"><strong><a class="link" href="#expressions" title="EXPRESSIONS">EXPRESSIONS</a></strong></span>.
+</dd><dt><span class="term">
+<span class="strong"><strong>-m, --mode</strong></span> [<span class="emphasis"><em>+x</em></span>]
+</span></dt><dd>
+    define behaviour at sites with existing FILTER annotations. The default
+    mode replaces existing filters of failed sites with a new FILTER string
+    while leaving sites which pass untouched when non-empty and setting to
+    "PASS" when the FILTER string is absent. The "+" mode appends new FILTER
+    strings of failed sites instead of replacing them. The "x" mode resets
+    filters of sites which pass to "PASS". Modes "+" and "x" can both be set.
+</dd><dt><span class="term">
+<span class="strong"><strong>-o, --output</strong></span> <span class="emphasis"><em>FILE</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-O, --output-type</strong></span> <span class="emphasis"><em>b</em></span>|<span class="emphasis"><em>u</em></span>|<span class="emphasis"><em>z</em></span>|<span class="emphasis"><em>v</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-r, --regions</strong></span> <span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:from-to</em></span>|<span class="emphasis"><em>chr:from-</em></span>[,…]
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-R, --regions-file</strong></span> <span class="emphasis"><em>file</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-s, --soft-filter</strong></span> <span class="emphasis"><em>STRING</em></span>|<span class="emphasis"><em>+</em></span>
+</span></dt><dd>
+    annotate FILTER column with <span class="emphasis"><em>STRING</em></span> or, with <span class="emphasis"><em>+</em></span>, a unique filter name generated
+    by the program ("Filter%d").
+</dd><dt><span class="term">
+<span class="strong"><strong>-S, --set-GTs</strong></span> <span class="emphasis"><em>.</em></span>|<span class="emphasis"><em>0</em></span>
+</span></dt><dd>
+    set genotypes of failed samples to missing value (<span class="emphasis"><em>.</em></span>) or reference allele (<span class="emphasis"><em>0</em></span>)
+</dd><dt><span class="term">
+<span class="strong"><strong>-t, --targets</strong></span> <span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:from-to</em></span>|<span class="emphasis"><em>chr:from-</em></span>[,…]
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-T, --targets-file</strong></span> <span class="emphasis"><em>file</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd></dl></div></div><div class="refsect2" title="bcftools gtcheck [OPTIONS] [-g genotypes.vcf.gz] query.vcf.gz"><a id="gtcheck"></a><h3>bcftools gtcheck [<span class="emphasis"><em>OPTIONS</em></span>] [<span class="strong"><strong>-g</strong></span> <span class="emphasis"><em>genotypes.vcf.gz</em></span>] <span class="emphasis"><em>query.vcf.gz</em></span></h3><p>Checks sample identity or, without <span class="strong"><strong>-g</strong></span>, multi-sample cross-check is performed.< [...]
+<span class="strong"><strong>-a, --all-sites</strong></span>
+</span></dt><dd>
+    output for all sites
+</dd><dt><span class="term">
+<span class="strong"><strong>-g, --genotypes</strong></span> <span class="emphasis"><em>genotypes.vcf.gz</em></span>
+</span></dt><dd>
+    reference genotypes to compare against
+</dd><dt><span class="term">
+<span class="strong"><strong>-G, --GTs-only</strong></span> <span class="emphasis"><em>INT</em></span>
+</span></dt><dd>
+    use genotypes (GT) instead of genotype likelihoods (PL). When set to 1,
+    reported discordance is the number of non-matching GTs, otherwise the
+    number <span class="emphasis"><em>INT</em></span> is interpreted as phred-scaled likelihood of unobserved
+    genotypes.
+</dd><dt><span class="term">
+<span class="strong"><strong>-H, --homs-only</strong></span>
+</span></dt><dd>
+    consider only genotypes which are homozygous in both <span class="emphasis"><em>genotypes</em></span> and
+    <span class="emphasis"><em>query</em></span> VCF. This may be useful with low coverage data.
+</dd><dt><span class="term">
+<span class="strong"><strong>-p, --plot</strong></span> <span class="emphasis"><em>PREFIX</em></span>
+</span></dt><dd>
+    produce plots
+</dd><dt><span class="term">
+<span class="strong"><strong>-r, --regions</strong></span> <span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:from-to</em></span>|<span class="emphasis"><em>chr:from-</em></span>[,…]
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-R, --regions-file</strong></span> <span class="emphasis"><em>file</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-s, --query-sample</strong></span> <span class="emphasis"><em>STRING</em></span>
+</span></dt><dd>
+    query sample in <span class="emphasis"><em>query.vcf.gz</em></span>. By default, the first sample is checked.
+</dd><dt><span class="term">
+<span class="strong"><strong>-S, --target-sample</strong></span> <span class="emphasis"><em>STRING</em></span>
+</span></dt><dd>
+    target sample in the <span class="strong"><strong>-g</strong></span> file, used only for plotting, not for analysis
+</dd><dt><span class="term">
+<span class="strong"><strong>-t, --targets</strong></span> <span class="emphasis"><em>file</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-T, --targets-file</strong></span> <span class="emphasis"><em>file</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd></dl></div><div class="refsect3" title="Output files format:"><a id="_output_files_format"></a><h4>Output files format:</h4><div class="variablelist"><dl><dt><span class="term">
+CN, Discordance
+</span></dt><dd>
+        Pairwise discordance for all sample pairs is calculated as
+</dd></dl></div><pre class="screen">        \sum_s { min_G { PL_a(G) + PL_b(G) } },</pre><div class="variablelist"><dl><dt><span class="term">
+ 
+</span></dt><dd>
+        where the sum runs over all sites <span class="emphasis"><em>s</em></span> and <span class="emphasis"><em>G</em></span> is the the most likely
+        genotype shared by both samples <span class="emphasis"><em>a</em></span> and <span class="emphasis"><em>b</em></span>.  When PL field is not
+        present, a constant value <span class="emphasis"><em>99</em></span> is used for the unseen genotypes.  With
+        <span class="strong"><strong>-G</strong></span>, the value <span class="emphasis"><em>1</em></span> can be used instead; the discordance value then
+        gives exactly the number of differing genotypes.
+</dd><dt><span class="term">
+SM, Average Discordance
+</span></dt><dd>
+        Average discordance between sample <span class="emphasis"><em>a</em></span> and all other samples.
+</dd><dt><span class="term">
+SM, Average Depth
+</span></dt><dd>
+        Average depth at evaluated sites, or 1 if FORMAT/DP field is not
+        present.
+</dd><dt><span class="term">
+SM, Average Number of sites
+</span></dt><dd>
+        The average number of sites used to calculate the discordance.  In
+        other words, the average number of non-missing PLs/genotypes seen
+        both samples.
+</dd></dl></div></div></div><div class="refsect2" title="bcftools index [OPTIONS] <in.bcf>|<in.vcf.gz>"><a id="index"></a><h3>bcftools index [<span class="emphasis"><em>OPTIONS</em></span>]  <span class="emphasis"><em><in.bcf>|<in.vcf.gz></em></span></h3><p>Creates index for bgzip compressed VCF/BCF files for random access. CSI
+(coordinate-sorted index) is created by default. The CSI format
+supports indexing of chromosomes up to length 2^31. TBI (tabix index)
+index files, which support chromosome lengths up to 2^29, can be
+created by using the <span class="emphasis"><em>-t/--tbi</em></span> option or using the <span class="emphasis"><em>tabix</em></span> program
+packaged with htslib. When loading an index file, bcftools will try
+the CSI first and then the TBI.</p><div class="refsect3" title="Indexing options:"><a id="_indexing_options"></a><h4>Indexing options:</h4><div class="variablelist"><dl><dt><span class="term">
+<span class="strong"><strong>-c, --csi</strong></span>
+</span></dt><dd>
+    generate CSI-format index for VCF/BCF files [default]
+</dd><dt><span class="term">
+<span class="strong"><strong>-f, --force</strong></span>
+</span></dt><dd>
+    overwrite index if it already exists
+</dd><dt><span class="term">
+<span class="strong"><strong>-m, --min-shift <span class="emphasis"><em>INT</em></span></strong></span>
+</span></dt><dd>
+    set minimal interval size for CSI indices to 2^INT; default: 14
+</dd><dt><span class="term">
+<span class="strong"><strong>-t, --tbi</strong></span>
+</span></dt><dd>
+    generate TBI-format index for VCF files
+</dd></dl></div></div><div class="refsect3" title="Stats options:"><a id="_stats_options"></a><h4>Stats options:</h4><div class="variablelist"><dl><dt><span class="term">
+<span class="strong"><strong>-n, --nrecords</strong></span>
+</span></dt><dd>
+    print the number of records based on the CSI or TBI index files
+</dd><dt><span class="term">
+<span class="strong"><strong>-s, --stats</strong></span>
+</span></dt><dd>
+    Print per contig stats based on the CSI or TBI index files.
+    Output format is three tab-delimited columns listing the contig
+    name, contig length (<span class="emphasis"><em>.</em></span> if unknown) and number of records for
+    the contig. Contigs with zero records are not printed.
+</dd></dl></div></div></div><div class="refsect2" title="bcftools isec [OPTIONS] A.vcf.gz B.vcf.gz […]"><a id="isec"></a><h3>bcftools isec [<span class="emphasis"><em>OPTIONS</em></span>]  <span class="emphasis"><em>A.vcf.gz</em></span> <span class="emphasis"><em>B.vcf.gz</em></span> […]</h3><p>Creates intersections, unions and complements of VCF files. Depending
+on the options, the program can output records from one (or more) files
+which have (or do not have) corresponding records with the same position
+in the other files.</p><div class="variablelist"><dl><dt><span class="term">
+<span class="strong"><strong>-c, --collapse</strong></span> <span class="emphasis"><em>snps</em></span>|<span class="emphasis"><em>indels</em></span>|<span class="emphasis"><em>both</em></span>|<span class="emphasis"><em>all</em></span>|<span class="emphasis"><em>some</em></span>|<span class="emphasis"><em>none</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-C, --complement</strong></span>
+</span></dt><dd>
+    output positions present only in the first file but missing in the others
+</dd><dt><span class="term">
+<span class="strong"><strong>-e, --exclude</strong></span> <span class="emphasis"><em>-</em></span>|<span class="emphasis"><em>EXPRESSION</em></span>
+</span></dt><dd>
+    exclude sites for which <span class="emphasis"><em>EXPRESSION</em></span> is true. If <span class="strong"><strong>-e</strong></span> (or <span class="strong"><strong>-i</strong></span>)
+    appears only once, the same filtering expression will be applied to all
+    input files.  Otherwise, <span class="strong"><strong>-e</strong></span> or <span class="strong"><strong>-i</strong></span> must be given for each input file.
+    To indicate that no filtering should be performed on a file, use "-" in
+    place of <span class="emphasis"><em>EXPRESSION</em></span>, as shown in the example below.
+    For valid expressions see <span class="strong"><strong><a class="link" href="#expressions" title="EXPRESSIONS">EXPRESSIONS</a></strong></span>.
+</dd><dt><span class="term">
+<span class="strong"><strong>-f, --apply-filters</strong></span> <span class="emphasis"><em>LIST</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-i, --include</strong></span> <span class="emphasis"><em>EXPRESSION</em></span>
+</span></dt><dd>
+    include only sites for which <span class="emphasis"><em>EXPRESSION</em></span> is true. See discussion
+    of <span class="strong"><strong>-e, --exclude</strong></span> above.
+</dd><dt><span class="term">
+<span class="strong"><strong>-n, --nfiles</strong></span> [+-=]<span class="emphasis"><em>INT</em></span>
+</span></dt><dd>
+    output positions present in this many (=), this many or more (+), or this
+    many or fewer (-) files
+</dd><dt><span class="term">
+<span class="strong"><strong>-o, --output</strong></span> <span class="emphasis"><em>FILE</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>.  When several files are being
+    output, their names are controlled via <span class="strong"><strong>-p</strong></span> instead.
+</dd><dt><span class="term">
+<span class="strong"><strong>-O, --output-type</strong></span> <span class="emphasis"><em>b</em></span>|<span class="emphasis"><em>u</em></span>|<span class="emphasis"><em>z</em></span>|<span class="emphasis"><em>v</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-p, --prefix</strong></span> <span class="emphasis"><em>DIR</em></span>
+</span></dt><dd>
+    if given, subset each of the input files accordingly. See also <span class="strong"><strong>-w</strong></span>.
+</dd><dt><span class="term">
+<span class="strong"><strong>-r, --regions</strong></span> <span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:from-to</em></span>|<span class="emphasis"><em>chr:from-</em></span>[,…]
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-R, --regions-file</strong></span> <span class="emphasis"><em>file</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-t, --targets</strong></span> <span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:from-to</em></span>|<span class="emphasis"><em>chr:from-</em></span>[,…]
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-T, --targets-file</strong></span> <span class="emphasis"><em>file</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-w, --write</strong></span> <span class="emphasis"><em>LIST</em></span>
+</span></dt><dd>
+    list of input files to output given as 1-based indices. With <span class="strong"><strong>-p</strong></span> and no
+    <span class="strong"><strong>-w</strong></span>, all files are written.
+</dd></dl></div><div class="refsect3" title="Examples:"><a id="_examples"></a><h4>Examples:</h4><p>Create intersection and complements of two sets saving the output in dir/*</p><pre class="screen">    bcftools isec -p dir A.vcf.gz B.vcf.gz</pre><p>Filter sites in A and B (but not in C) and create intersection</p><pre class="screen">    bcftools isec -e'MAF<0.01' -i'dbSNP=1' -e- A.vcf.gz B.vcf.gz C.vcf.gz -p dir</pre><p>Extract and write records from A shared by both A and B using exac [...]
+multi-sample file.  For example, when merging file <span class="emphasis"><em>A.vcf.gz</em></span> containing
+samples <span class="emphasis"><em>S1</em></span>, <span class="emphasis"><em>S2</em></span> and <span class="emphasis"><em>S3</em></span> and file <span class="emphasis"><em>B.vcf.gz</em></span> containing samples <span class="emphasis"><em>S3</em></span> and
+<span class="emphasis"><em>S4</em></span>, the output file will contain four samples named <span class="emphasis"><em>S1</em></span>, <span class="emphasis"><em>S2</em></span>, <span class="emphasis"><em>S3</em></span>, <span class="emphasis"><em>2:S3</em></span>
+and <span class="emphasis"><em>S4</em></span>.</p><p>Note that it is responsibility of the user to ensure that the sample names are
+unique across all files. If they are not, the program will exit with an error
+unless the option <span class="strong"><strong>--force-samples</strong></span> is given.  The sample names can be
+also given explicitly using the <span class="strong"><strong>--print-header</strong></span> and <span class="strong"><strong>--use-header</strong></span> options.</p><p>Note that only records from different files can be merged, never from the same file.
+For "vertical" merge take a look at <span class="strong"><strong><a class="link" href="#norm" title="bcftools norm [OPTIONS] file.vcf.gz">bcftools norm</a></strong></span> instead.</p><div class="variablelist"><dl><dt><span class="term">
+<span class="strong"><strong>--force-samples</strong></span>
+</span></dt><dd>
+    if the merged files contain duplicate samples names, proceed anyway.
+    Duplicate sample names will be resolved by prepending index of the file
+    as it appeared on the command line to the conflicting sample name (see
+    <span class="emphasis"><em>2:S3</em></span> in the above example).
+</dd><dt><span class="term">
+<span class="strong"><strong>--print-header</strong></span>
+</span></dt><dd>
+    print only merged header and exit
+</dd><dt><span class="term">
+<span class="strong"><strong>--use-header</strong></span> <span class="emphasis"><em>FILE</em></span>
+</span></dt><dd>
+    use the VCF header in the provided text <span class="emphasis"><em>FILE</em></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-f, --apply-filters</strong></span> <span class="emphasis"><em>LIST</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-i, --info-rules</strong></span> <span class="emphasis"><em>-</em></span>|<span class="emphasis"><em>TAG:METHOD</em></span>[,…]
+</span></dt><dd>
+    Rules for merging INFO fields (scalars or vectors) or <span class="emphasis"><em>-</em></span> to disable the
+    default rules.  <span class="emphasis"><em>METHOD</em></span> is one of <span class="emphasis"><em>sum</em></span>, <span class="emphasis"><em>avg</em></span>, <span class="emphasis"><em>min</em></span>, <span class="emphasis"><em>max</em></span>, <span class="emphasis"><em>join</em></span>.
+</dd><dt><span class="term">
+<span class="strong"><strong>-l, --file-list</strong></span> <span class="emphasis"><em>FILE</em></span>
+</span></dt><dd>
+    read file names from <span class="emphasis"><em>FILE</em></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-m, --merge</strong></span> <span class="emphasis"><em>snps</em></span>|<span class="emphasis"><em>indels</em></span>|<span class="emphasis"><em>both</em></span>|<span class="emphasis"><em>all</em></span>|<span class="emphasis"><em>none</em></span>|<span class="emphasis"><em>id</em></span>
+</span></dt><dd>
+    The option controls what types of multiallelic records can be created:
+</dd></dl></div><pre class="screen">-m none   ..  no new multiallelics, output multiple records instead
+-m snps   ..  allow multiallelic SNP records
+-m indels ..  allow multiallelic indel records
+-m both   ..  both SNP and indel records can be multiallelic
+-m all    ..  SNP records can be merged with indel records
+-m id     ..  merge by ID</pre><div class="variablelist"><dl><dt><span class="term">
+<span class="strong"><strong>-o, --output</strong></span> <span class="emphasis"><em>FILE</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-O, --output-type</strong></span> <span class="emphasis"><em>b</em></span>|<span class="emphasis"><em>u</em></span>|<span class="emphasis"><em>z</em></span>|<span class="emphasis"><em>v</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-r, --regions</strong></span> <span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:from-to</em></span>|<span class="emphasis"><em>chr:from-</em></span>[,…]
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-R, --regions-file</strong></span> <span class="emphasis"><em>file</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd></dl></div></div><div class="refsect2" title="bcftools norm [OPTIONS] file.vcf.gz"><a id="norm"></a><h3>bcftools norm [<span class="emphasis"><em>OPTIONS</em></span>] <span class="emphasis"><em>file.vcf.gz</em></span></h3><p>Left-align and normalize indels,  check if REF alleles match the reference,
+split multiallelic sites into multiple rows; recover multiallelics from
+multiple rows.</p><div class="variablelist"><dl><dt><span class="term">
+<span class="strong"><strong>-D, --remove-duplicates</strong></span>
+</span></dt><dd>
+    remove duplicate lines of the same type
+</dd><dt><span class="term">
+<span class="strong"><strong>-f, --fasta-ref</strong></span> <span class="emphasis"><em>FILE</em></span>
+</span></dt><dd>
+    reference sequence
+</dd><dt><span class="term">
+<span class="strong"><strong>-m, --multiallelics</strong></span> ←|+>[<span class="emphasis"><em>snps</em></span>|<span class="emphasis"><em>indels</em></span>|<span class="emphasis"><em>both</em></span>|<span class="emphasis"><em>any</em></span>]
+</span></dt><dd>
+    split multiallelic sites into biallelic records (<span class="emphasis"><em>-</em></span>) or join
+    biallelic sites into multiallelic records (<span class="emphasis"><em>+</em></span>). An optional type string
+    can follow which controls variant types which should be split or merged
+    together: If only SNP records should be split or merged, specify <span class="emphasis"><em>snps</em></span>; if
+    both SNPs and indels should be merged separately into two records, specify
+    <span class="emphasis"><em>both</em></span>; if SNPs and indels should be merged into a single record, specify
+    <span class="emphasis"><em>any</em></span>.
+</dd><dt><span class="term">
+<span class="strong"><strong>-o, --output</strong></span> <span class="emphasis"><em>FILE</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-O, --output-type</strong></span> <span class="emphasis"><em>b</em></span>|<span class="emphasis"><em>u</em></span>|<span class="emphasis"><em>z</em></span>|<span class="emphasis"><em>v</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-r, --regions</strong></span> <span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:from-to</em></span>|<span class="emphasis"><em>chr:from-</em></span>[,…]
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-R, --regions-file</strong></span> <span class="emphasis"><em>file</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-s, --strict-filter</strong></span>
+</span></dt><dd>
+    when merging (<span class="emphasis"><em>-m+</em></span>), merged site is PASS only if all sites being merged PASS
+</dd><dt><span class="term">
+<span class="strong"><strong>-t, --targets</strong></span> <span class="emphasis"><em>LIST</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-T, --targets-file</strong></span> <span class="emphasis"><em>FILE</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-w, --site-win</strong></span> <span class="emphasis"><em>INT</em></span>
+</span></dt><dd>
+    maximum distance between two records to consider when locally
+    sorting variants which changed position during the realignment
+</dd></dl></div></div><div class="refsect2" title="bcftools plugin NAME [OPTIONS] FILE — [PLUGIN OPTIONS]"><a id="plugin"></a><h3>bcftools plugin <span class="emphasis"><em>NAME</em></span> <span class="emphasis"><em>[OPTIONS]</em></span> <span class="emphasis"><em>FILE</em></span> — <span class="emphasis"><em>[PLUGIN OPTIONS]</em></span></h3><div class="refsect3" title="VCF input options:"><a id="_vcf_input_options_2"></a><h4>VCF input options:</h4><div class="variablelist"><dl><dt><spa [...]
+<span class="strong"><strong>-e, --exclude</strong></span> <span class="emphasis"><em>EXPRESSION</em></span>
+</span></dt><dd>
+    exclude sites for which <span class="emphasis"><em>EXPRESSION</em></span> is true. For valid expressions see
+    <span class="strong"><strong><a class="link" href="#expressions" title="EXPRESSIONS">EXPRESSIONS</a></strong></span>.
+</dd><dt><span class="term">
+<span class="strong"><strong>-i, --include</strong></span> <span class="emphasis"><em>EXPRESSION</em></span>
+</span></dt><dd>
+    include only sites for which <span class="emphasis"><em>EXPRESSION</em></span> is true. For valid expressions see
+    <span class="strong"><strong><a class="link" href="#expressions" title="EXPRESSIONS">EXPRESSIONS</a></strong></span>.
+</dd><dt><span class="term">
+<span class="strong"><strong>-r, --regions</strong></span> <span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:from-to</em></span>|<span class="emphasis"><em>chr:from-</em></span>[,…]
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-R, --regions-file</strong></span> <span class="emphasis"><em>file</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-t, --targets</strong></span> <span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:from-to</em></span>|<span class="emphasis"><em>chr:from-</em></span>[,…]
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-T, --targets-file</strong></span> <span class="emphasis"><em>file</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd></dl></div></div><div class="refsect3" title="VCF output options:"><a id="_vcf_output_options_2"></a><h4>VCF output options:</h4><div class="variablelist"><dl><dt><span class="term">
+<span class="strong"><strong>-o, --output</strong></span> <span class="emphasis"><em>FILE</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-O, --output-type</strong></span> <span class="emphasis"><em>b</em></span>|<span class="emphasis"><em>u</em></span>|<span class="emphasis"><em>z</em></span>|<span class="emphasis"><em>v</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd></dl></div></div><div class="refsect3" title="Plugin options:"><a id="_plugin_options"></a><h4>Plugin options:</h4><div class="variablelist"><dl><dt><span class="term">
+<span class="strong"><strong>-h, --help</strong></span>
+</span></dt><dd>
+    list plugin’s options
+</dd><dt><span class="term">
+<span class="strong"><strong>-l, --list-plugins</strong></span>
+</span></dt><dd>
+    List all available plugins. If not installed systemwide, set the environment
+    variable LD_LIBRARY_PATH (linux) or DYLD_LIBRARY_PATH (Mac OS X) to include
+    directory where <span class="strong"><strong>libhts.so</strong></span> is located.  The BCFTOOLS_PLUGINS
+    environment variable tells the program which directories to search.
+</dd><dt><span class="term">
+<span class="strong"><strong>-v, --verbose</strong></span>
+</span></dt><dd>
+    print debugging information to debug plugin failure
+</dd></dl></div></div><div class="refsect3" title="List of plugins coming with the distribution:"><a id="_list_of_plugins_coming_with_the_distribution"></a><h4>List of plugins coming with the distribution:</h4><div class="variablelist"><dl><dt><span class="term">
+<span class="strong"><strong>counts</strong></span>
+</span></dt><dd>
+    a minimal plugin which counts number of SNPs, Indels, and total number of sites.
+</dd><dt><span class="term">
+<span class="strong"><strong>dosage</strong></span>
+</span></dt><dd>
+    print genotype dosage. By default the plugin searches for PL, GL and GT, in
+    that order.
+</dd><dt><span class="term">
+<span class="strong"><strong>fill-AN-AC</strong></span>
+</span></dt><dd>
+    fill INFO fields AN and AC.
+</dd><dt><span class="term">
+<span class="strong"><strong>fix-ploidy</strong></span>
+</span></dt><dd>
+    sets correct ploidy
+</dd><dt><span class="term">
+<span class="strong"><strong>frameshifts</strong></span>
+</span></dt><dd>
+    annotate frameshift indels
+</dd><dt><span class="term">
+<span class="strong"><strong>missing2ref</strong></span>
+</span></dt><dd>
+    sets missing genotypes ("./.") to ref allele ("0/0" or "0|0")
+</dd><dt><span class="term">
+<span class="strong"><strong>tag2tag</strong></span>
+</span></dt><dd>
+    Convert between similar tags, such as GL and GP.
+</dd><dt><span class="term">
+<span class="strong"><strong>vcf2sex</strong></span>
+</span></dt><dd>
+    determine sample sex by checking genotypes in haploid regions
+</dd></dl></div></div><div class="refsect3" title="Examples:"><a id="_examples_2"></a><h4>Examples:</h4><pre class="screen"># List options common to all plugins
+bcftools plugin
+
+# List available plugins
+bcftools plugin -l
+
+# One can run plugins in several ways
+bcftools plugin counts in.vcf
+bcftools +counts in.vcf
+cat in.vcf | bcftools +counts
+
+# Print usage information of plugin "dosage"
+bcftools +dosage -h
+
+# Replace missing genotypes with 0/0
+bcftools +missing2ref in.vcf
+
+# Replace missing genotypes with 0|0
+bcftools +missing2ref in.vcf -- -p</pre></div><div class="refsect3" title="Plugins troubleshooting:"><a id="_plugins_troubleshooting"></a><h4>Plugins troubleshooting:</h4><p>Things to check if your plugin does not show up in the <span class="strong"><strong>bcftools plugin -l</strong></span> output:</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
+Run with the <span class="strong"><strong>-v</strong></span> option for verbose output: <span class="strong"><strong>bcftools plugin -lv</strong></span>
+</li><li class="listitem">
+Does the environment variable BCFTOOLS_PLUGINS include the correct path?
+</li><li class="listitem"><p class="simpara">
+Are all shared libraries, namely libhts.so, accessible? Verify with
+</p><div class="itemizedlist"><ul class="itemizedlist" type="circle"><li class="listitem">
+on Mac OS X: <span class="strong"><strong>otool -L your/plugin.so</strong></span> and set DYLD_LIBRARY_PATH if they are not
+</li><li class="listitem">
+on Linux: <span class="strong"><strong>ldd your/plugin.so</strong></span> and set LD_LIBRARY_PATH if they are not
+</li></ul></div></li><li class="listitem">
+If not installed systemwide, set the environment variable LD_LIBRARY_PATH (linux) or
+DYLD_LIBRARY_PATH (mac) to include directory where <span class="strong"><strong>libhts.so</strong></span> is located.
+</li></ul></div></div><div class="refsect3" title="Plugins API:"><a id="_plugins_api"></a><h4>Plugins API:</h4><pre class="screen">// Short description used by 'bcftools plugin -l'
+const char *about(void);
+
+// Longer description used by 'bcftools +name -h'
+const char *usage(void);
+
+// Called once at startup, allows to initialize local variables.
+// Return 1 to suppress normal VCF/BCF header output, -1 on critical
+// errors, 0 otherwise.
+int init(int argc, char **argv, bcf_hdr_t *in_hdr, bcf_hdr_t *out_hdr);
+
+// Called for each VCF record, return NULL to suppress the output
+bcf1_t *process(bcf1_t *rec);
+
+// Called after all lines have been processed to clean up
+void destroy(void);</pre></div></div><div class="refsect2" title="bcftools query [OPTIONS] file.vcf.gz [file.vcf.gz […]]"><a id="query"></a><h3>bcftools query [<span class="emphasis"><em>OPTIONS</em></span>] <span class="emphasis"><em>file.vcf.gz</em></span> [<span class="emphasis"><em>file.vcf.gz</em></span> […]]</h3><p>Extracts fields from VCF or BCF files and outputs them in user-defined format.</p><div class="variablelist"><dl><dt><span class="term">
+<span class="strong"><strong>-c, --collapse</strong></span> <span class="emphasis"><em>snps</em></span>|<span class="emphasis"><em>indels</em></span>|<span class="emphasis"><em>both</em></span>|<span class="emphasis"><em>all</em></span>|<span class="emphasis"><em>some</em></span>|<span class="emphasis"><em>none</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-e, --exclude</strong></span> <span class="emphasis"><em>EXPRESSION</em></span>
+</span></dt><dd>
+    exclude sites for which <span class="emphasis"><em>EXPRESSION</em></span> is true. For valid expressions see
+    <span class="strong"><strong><a class="link" href="#expressions" title="EXPRESSIONS">EXPRESSIONS</a></strong></span>.
+</dd><dt><span class="term">
+<span class="strong"><strong>-f, --format</strong></span> <span class="emphasis"><em>FORMAT</em></span>
+</span></dt><dd>
+    learn by example, see below
+</dd><dt><span class="term">
+<span class="strong"><strong>-H, --print-header</strong></span>
+</span></dt><dd>
+    print header
+</dd><dt><span class="term">
+<span class="strong"><strong>-i, --include</strong></span> <span class="emphasis"><em>EXPRESSION</em></span>
+</span></dt><dd>
+    include only sites for which <span class="emphasis"><em>EXPRESSION</em></span> is true. For valid expressions see
+    <span class="strong"><strong><a class="link" href="#expressions" title="EXPRESSIONS">EXPRESSIONS</a></strong></span>.
+</dd><dt><span class="term">
+<span class="strong"><strong>-l, --list-samples</strong></span>
+</span></dt><dd>
+    list sample names and exit
+</dd><dt><span class="term">
+<span class="strong"><strong>-o, --output</strong></span> <span class="emphasis"><em>FILE</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-r, --regions</strong></span> <span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:from-to</em></span>|<span class="emphasis"><em>chr:from-</em></span>[,…]
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-R, --regions-file</strong></span> <span class="emphasis"><em>file</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-s, --samples</strong></span> <span class="emphasis"><em>LIST</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-S, --samples-file</strong></span> <span class="emphasis"><em>FILE</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-t, --targets</strong></span> <span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:from-to</em></span>|<span class="emphasis"><em>chr:from-</em></span>[,…]
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-T, --targets-file</strong></span> <span class="emphasis"><em>file</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-v, --vcf-list</strong></span> <span class="emphasis"><em>FILE</em></span>
+</span></dt><dd>
+    process multiple VCFs listed in the file
+</dd></dl></div><div class="refsect3" title="Format:"><a id="_format"></a><h4>Format:</h4><pre class="literallayout">%CHROM          The CHROM column (similarly also other columns: POS, ID, REF, ALT, QUAL, FILTER)
+%INFO/TAG       Any tag in the INFO column
+%TYPE           Variant type (REF, SNP, MNP, INDEL, OTHER)
+%MASK           Indicates presence of the site in other files (with multiple files)
+%TAG{INT}       Curly brackets to subscript vectors (0-based)
+%FIRST_ALT      Alias for %ALT{0}
+[]              The brackets loop over all samples
+%GT             Genotype (e.g. 0/1)
+%TGT            Translated genotype (e.g. C/A)
+%IUPACGT        Genotype translated to IUPAC ambiguity codes (e.g. M instead of C/A)
+%LINE           Prints the whole line
+%SAMPLE         Sample name</pre></div><div class="refsect3" title="Examples:"><a id="_examples_3"></a><h4>Examples:</h4><pre class="literallayout">bcftools query -f '%CHROM  %POS  %REF  %ALT{0}\n' file.vcf.gz
+bcftools query -f '%CHROM\t%POS\t%REF\t%ALT[\t%SAMPLE=%GT]\n' file.vcf.gz</pre></div></div><div class="refsect2" title="bcftools reheader [OPTIONS] file.vcf.gz"><a id="reheader"></a><h3>bcftools reheader [<span class="emphasis"><em>OPTIONS</em></span>] <span class="emphasis"><em>file.vcf.gz</em></span></h3><p>Modify header of VCF/BCF files, change sample names.</p><div class="variablelist"><dl><dt><span class="term">
+<span class="strong"><strong>-h, --header</strong></span> <span class="emphasis"><em>FILE</em></span>
+</span></dt><dd>
+    new VCF header
+</dd><dt><span class="term">
+<span class="strong"><strong>-o, --output</strong></span> <span class="emphasis"><em>FILE</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-s, --samples</strong></span> <span class="emphasis"><em>FILE</em></span>
+</span></dt><dd>
+    new sample names, one name per line, in the same order as they appear
+    in the VCF file. Alternatively, only samples which need to be renamed
+    can be listed as "old_name new_name\n" pairs separated by
+    whitespaces, each on separate line.
+</dd></dl></div></div><div class="refsect2" title="bcftools roh [OPTIONS] file.vcf.gz"><a id="roh"></a><h3>bcftools roh [<span class="emphasis"><em>OPTIONS</em></span>] <span class="emphasis"><em>file.vcf.gz</em></span></h3><p>A program for detecting runs of homo/autozygosity. Only bi-allelic sites
+are considered.</p><div class="refsect3" title="The HMM model:"><a id="_the_hmm_model"></a><h4>The HMM model:</h4><pre class="screen">Notation:
+  D  = Data, AZ = autozygosity, HW = Hardy-Weinberg (non-autozygosity),
+  f  = non-ref allele frequency
+
+Emission probabilities:
+  oAZ = P_i(D|AZ) = (1-f)*P(D|RR) + f*P(D|AA)
+  oHW = P_i(D|HW) = (1-f)^2 * P(D|RR) + f^2 * P(D|AA) + 2*f*(1-f)*P(D|RA)
+
+Transition probabilities:
+  tAZ = P(AZ|HW)  .. from HW to AZ, the -a parameter
+  tHW = P(HW|AZ)  .. from AZ to HW, the -H parameter
+  P(AZ|AZ) = 1 - P(HW|AZ) = 1 - tHW
+  P(HW|HW) = 1 - P(AZ|HW) = 1 - tAZ
+
+  ci  = P_i(C)  .. probability of cross-over at site i, from genetic map
+  AZi = P_i(AZ) .. probability of site i being AZ/non-AZ, scaled so that AZi+HWi = 1
+  HWi = P_i(HW)
+
+  P_{i+1}(AZ) = oAZ * max[(1-tHW) * (1-ci) * AZ{i-1} , tAZ * ci * (1-AZ{i-1})]
+  P_{i+1}(HW) = oHW * max[(1-tAZ) * (1-ci) * (1-AZ{i-1}) , tHW * ci * AZ{i-1}]</pre></div><div class="refsect3" title="General Options:"><a id="_general_options"></a><h4>General Options:</h4><div class="variablelist"><dl><dt><span class="term">
+<span class="strong"><strong>--AF-tag</strong></span> <span class="emphasis"><em>TAG</em></span>
+</span></dt><dd>
+    use the specified INFO tag <span class="emphasis"><em>TAG</em></span> as an allele frequency estimate
+    instead of the defaul AC and AN tags. Sites which do not have <span class="emphasis"><em>TAG</em></span>
+    will be skipped.
+</dd><dt><span class="term">
+<span class="strong"><strong>--AF-file</strong></span> <span class="emphasis"><em>FILE</em></span>
+</span></dt><dd>
+    Read allele frequencies from a tab-delimited file containing
+    the columns: CHROM\tPOS\tREF,ALT\tAF. The file can be compressed with
+    <span class="strong"><strong>bgzip</strong></span> and indexed with tabix -s1 -b2 -e2.  Sites which are not present in
+    the <span class="emphasis"><em>FILE</em></span> or have different reference or alternate allele will be skipped.
+    Note that such a file can be easily created from a VCF using:
+</dd></dl></div><pre class="screen">    bcftools query -f'%CHROM\t%POS\t%REF,%ALT\t%INFO/TAG\n' file.vcf | bgzip -c > freqs.tab.gz</pre><div class="variablelist"><dl><dt><span class="term">
+<span class="strong"><strong>-e, --estimate-AF</strong></span> <span class="emphasis"><em>FILE</em></span>
+</span></dt><dd>
+    recalculate INFO/AC and INFO/AN on the fly, using either all samples
+    ("-") or samples listed in <span class="emphasis"><em>FILE</em></span>. By default, allele frequency is
+    estimated from AC and AN counts which are already present in the INFO
+    field.
+</dd><dt><span class="term">
+<span class="strong"><strong>-G, --GTs-only</strong></span> <span class="emphasis"><em>FLOAT</em></span>
+</span></dt><dd>
+    use genotypes (FORMAT/GT fields) ignoring genotype likelihoods (FORMAT/PL),
+    setting PL of unseen genotypes to <span class="emphasis"><em>FLOAT</em></span>. Safe value to use is 30 to
+    account for GT errors.
+</dd><dt><span class="term">
+<span class="strong"><strong>-I, --skip-indels</strong></span>
+</span></dt><dd>
+    skip indels as their genotypes are usually enriched for errors
+</dd><dt><span class="term">
+<span class="strong"><strong>-m, --genetic-map</strong></span> <span class="emphasis"><em>FILE</em></span>
+</span></dt><dd>
+    genetic map in the format required also by IMPUTE2. Only the first and
+    third column are used (position and Genetic_Map(cM)). The <span class="emphasis"><em>FILE</em></span> can
+    chromosome name.
+</dd><dt><span class="term">
+<span class="strong"><strong>-r, --regions</strong></span> <span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:from-to</em></span>|<span class="emphasis"><em>chr:from-</em></span>[,…]
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-R, --regions-file</strong></span> <span class="emphasis"><em>file</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-s, --sample</strong></span> <span class="emphasis"><em>name</em></span>
+</span></dt><dd>
+    the name of sample to analyze
+</dd><dt><span class="term">
+<span class="strong"><strong>-t, --targets</strong></span> <span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:from-to</em></span>|<span class="emphasis"><em>chr:from-</em></span>[,…]
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-T, --targets-file</strong></span> <span class="emphasis"><em>file</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd></dl></div></div><div class="refsect3" title="HMM Options:"><a id="_hmm_options"></a><h4>HMM Options:</h4><div class="variablelist"><dl><dt><span class="term">
+<span class="strong"><strong>-a, --hw-to-az</strong></span> <span class="emphasis"><em>FLOAT</em></span>
+</span></dt><dd>
+    P(AZ|HW) transition probability from AZ (autozygous) to HW (Hardy-Weinberg) state
+</dd><dt><span class="term">
+<span class="strong"><strong>-H, --az-to-hw</strong></span> <span class="emphasis"><em>FLOAT</em></span>
+</span></dt><dd>
+    P(HW|AZ) transition probability from HW to AZ state
+</dd><dt><span class="term">
+<span class="strong"><strong>-V, --viterbi-training</strong></span>
+</span></dt><dd>
+    perform Viterbi training to estimate transition probabilities
+</dd></dl></div></div></div><div class="refsect2" title="bcftools stats [OPTIONS] A.vcf.gz [B.vcf.gz]"><a id="stats"></a><h3>bcftools stats [<span class="emphasis"><em>OPTIONS</em></span>] <span class="emphasis"><em>A.vcf.gz</em></span> [<span class="emphasis"><em>B.vcf.gz</em></span>]</h3><p>Parses VCF or BCF and produces text file stats which is suitable for machine
+processing and can be plotted using <span class="strong"><strong><a class="link" href="#plot-vcfstats" title="plot-vcfstats [OPTIONS] file.vchk […]">plot-vcfstats</a></strong></span>.  When two files are given,
+the program generates separate stats for intersection and the complements. By
+default only sites are compared, <span class="strong"><strong>-s</strong></span>/<span class="strong"><strong>-S</strong></span> must given to include also sample
+columns.</p><div class="variablelist"><dl><dt><span class="term">
+<span class="strong"><strong>-1, --1st-allele-only</strong></span>
+</span></dt><dd>
+    consider only 1st allele at multiallelic sites
+</dd><dt><span class="term">
+<span class="strong"><strong>-c, --collapse</strong></span> <span class="emphasis"><em>snps</em></span>|<span class="emphasis"><em>indels</em></span>|<span class="emphasis"><em>both</em></span>|<span class="emphasis"><em>all</em></span>|<span class="emphasis"><em>some</em></span>|<span class="emphasis"><em>none</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-d, --depth</strong></span> <span class="emphasis"><em>INT</em></span>,<span class="emphasis"><em>INT</em></span>,<span class="emphasis"><em>INT</em></span>
+</span></dt><dd>
+    ranges of depth distribution: min, max, and size of the bin
+</dd><dt><span class="term">
+<span class="strong"><strong>--debug</strong></span>
+</span></dt><dd>
+    produce verbose per-site and per-sample output
+</dd><dt><span class="term">
+<span class="strong"><strong>-e, --exons</strong></span> <span class="emphasis"><em>file.gz</em></span>
+</span></dt><dd>
+    tab-delimited file with exons for indel frameshifts statistics. The columns
+    of the file are CHR, FROM, TO, with 1-based, inclusive, positions. The file
+    is BGZF-compressed and indexed with tabix
+</dd></dl></div><pre class="screen">    tabix -s1 -b2 -e3 file.gz</pre><div class="variablelist"><dl><dt><span class="term">
+<span class="strong"><strong>-f, --apply-filters</strong></span> <span class="emphasis"><em>LIST</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-F, --fasta-ref</strong></span> <span class="emphasis"><em>ref.fa</em></span>
+</span></dt><dd>
+    faidx indexed reference sequence file to determine INDEL context
+</dd><dt><span class="term">
+<span class="strong"><strong>-i, --split-by-ID</strong></span>
+</span></dt><dd>
+    collect stats separately for sites which have the ID column set ("known
+    sites") or which do not have the ID column set ("novel sites").
+</dd><dt><span class="term">
+<span class="strong"><strong>-r, --regions</strong></span> <span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:from-to</em></span>|<span class="emphasis"><em>chr:from-</em></span>[,…]
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-R, --regions-file</strong></span> <span class="emphasis"><em>file</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-s, --samples</strong></span> <span class="emphasis"><em>LIST</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-S, --samples-file</strong></span> <span class="emphasis"><em>FILE</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-t, --targets</strong></span> <span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:from-to</em></span>|<span class="emphasis"><em>chr:from-</em></span>[,…]
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-T, --targets-file</strong></span> <span class="emphasis"><em>file</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd></dl></div></div><div class="refsect2" title="bcftools view [OPTIONS] file.vcf.gz [REGION […]]"><a id="view"></a><h3>bcftools view [<span class="emphasis"><em>OPTIONS</em></span>] <span class="emphasis"><em>file.vcf.gz</em></span> [<span class="emphasis"><em>REGION</em></span> […]]</h3><p>View, subset and filter VCF or BCF files by position and filtering expression.
+Convert between VCF and BCF. Former <span class="strong"><strong>bcftools subset</strong></span>.</p><div class="refsect3" title="Output options"><a id="_output_options"></a><h4>Output options</h4><div class="variablelist"><dl><dt><span class="term">
+<span class="strong"><strong>-G, --drop-genotypes</strong></span>
+</span></dt><dd>
+    drop individual genotype information (after subsetting if <span class="strong"><strong>-s</strong></span> option is set)
+</dd><dt><span class="term">
+<span class="strong"><strong>-h, --header-only</strong></span>
+</span></dt><dd>
+    output the VCF header only
+</dd><dt><span class="term">
+<span class="strong"><strong>-H, --no-header</strong></span>
+</span></dt><dd>
+    suppress the header in VCF output
+</dd><dt><span class="term">
+<span class="strong"><strong>-l, --compression-level</strong></span> [<span class="emphasis"><em>0-9</em></span>]
+</span></dt><dd>
+    compression level. 0 stands for uncompressed, 1 for best speed and 9 for
+    best compression.
+</dd><dt><span class="term">
+<span class="strong"><strong>-O, --output-type</strong></span> <span class="emphasis"><em>b</em></span>|<span class="emphasis"><em>u</em></span>|<span class="emphasis"><em>z</em></span>|<span class="emphasis"><em>v</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd></dl></div><p><span class="strong"><strong>-o, --output-file</strong></span> <span class="emphasis"><em>FILE</em></span>:
+    output file name. If not present, the default is to print to standard output (stdout).</p><div class="variablelist"><dl><dt><span class="term">
+<span class="strong"><strong>-r, --regions</strong></span> <span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:from-to</em></span>|<span class="emphasis"><em>chr:from-</em></span>[,…]
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-R, --regions-file</strong></span> <span class="emphasis"><em>file</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-t, --targets</strong></span> <span class="emphasis"><em>chr</em></span>|<span class="emphasis"><em>chr:pos</em></span>|<span class="emphasis"><em>chr:from-to</em></span>|<span class="emphasis"><em>chr:from-</em></span>[,…]
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-T, --targets-file</strong></span> <span class="emphasis"><em>file</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd></dl></div></div><div class="refsect3" title="Subset options:"><a id="_subset_options"></a><h4>Subset options:</h4><div class="variablelist"><dl><dt><span class="term">
+<span class="strong"><strong>-a, --trim-alt-alleles</strong></span>
+</span></dt><dd>
+    trim alternate alleles not seen in subset. Type A, G and R INFO and FORMAT fields will also be trimmed
+</dd><dt><span class="term">
+<span class="strong"><strong>-I, --no-update</strong></span>
+</span></dt><dd>
+    do not (re)calculate INFO fields for the subset (currently INFO/AC and INFO/AN)
+</dd><dt><span class="term">
+<span class="strong"><strong>-s, --samples</strong></span> <span class="emphasis"><em>LIST</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-S, --samples-file</strong></span> <span class="emphasis"><em>FILE</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd></dl></div></div><div class="refsect3" title="Filter options:"><a id="_filter_options"></a><h4>Filter options:</h4><div class="variablelist"><dl><dt><span class="term">
+<span class="strong"><strong>-c, --min-ac</strong></span> <span class="emphasis"><em>INT</em></span>[<span class="emphasis"><em>:nref</em></span>|<span class="emphasis"><em>:alt1</em></span>|<span class="emphasis"><em>:minor</em></span>|<span class="emphasis"><em>:major</em></span>|:'nonmajor']
+</span></dt><dd>
+    minimum allele count (INFO/AC) of sites to be printed.
+    Specifying the type of allele is optional and can be set to
+    non-reference (<span class="emphasis"><em>nref</em></span>, the default), 1st alternate  (<span class="emphasis"><em>alt1</em></span>), the least
+    frequent (<span class="emphasis"><em>minor</em></span>), the most frequent (<span class="emphasis"><em>major</em></span>) or sum of all but the
+    most frequent (<span class="emphasis"><em>nonmajor</em></span>) alleles.
+</dd><dt><span class="term">
+<span class="strong"><strong>-C, --max-ac</strong></span> <span class="emphasis"><em>INT</em></span>[<span class="emphasis"><em>:nref</em></span>|<span class="emphasis"><em>:alt1</em></span>|<span class="emphasis"><em>:minor</em></span>|:'major'|:'nonmajor']
+</span></dt><dd>
+    maximum allele count (INFO/AC) of sites to be printed.
+    Specifying the type of allele is optional and can be set to
+    non-reference (<span class="emphasis"><em>nref</em></span>, the default), 1st alternate  (<span class="emphasis"><em>alt1</em></span>), the least
+    frequent (<span class="emphasis"><em>minor</em></span>), the most frequent (<span class="emphasis"><em>major</em></span>) or sum of all but the
+    most frequent (<span class="emphasis"><em>nonmajor</em></span>) alleles.
+</dd><dt><span class="term">
+<span class="strong"><strong>-e, --exclude</strong></span> <span class="emphasis"><em>EXPRESSION</em></span>
+</span></dt><dd>
+    exclude sites for which <span class="emphasis"><em>EXPRESSION</em></span> is true. For valid expressions see
+    <span class="strong"><strong><a class="link" href="#expressions" title="EXPRESSIONS">EXPRESSIONS</a></strong></span>.
+</dd><dt><span class="term">
+<span class="strong"><strong>-f, --apply-filters</strong></span> <span class="emphasis"><em>LIST</em></span>
+</span></dt><dd>
+    see <span class="strong"><strong><a class="link" href="#common_options" title="Common Options">Common Options</a></strong></span>
+</dd><dt><span class="term">
+<span class="strong"><strong>-g, --genotype</strong></span> [^][<span class="emphasis"><em>hom</em></span>|<span class="emphasis"><em>het</em></span>|<span class="emphasis"><em>miss</em></span>]
+</span></dt><dd>
+    include only sites with one or more homozygous (<span class="emphasis"><em>hom</em></span>), heterozygous
+    (<span class="emphasis"><em>het</em></span>) or missing (<span class="emphasis"><em>miss</em></span>) genotypes. When prefixed with <span class="emphasis"><em>^</em></span>, the logic
+    is reversed; thus <span class="emphasis"><em>^het</em></span> excludes sites with heterozygous genotypes.
+</dd><dt><span class="term">
+<span class="strong"><strong>-i, --include</strong></span> <span class="emphasis"><em>EXPRESSION</em></span>
+</span></dt><dd>
+    include sites for which <span class="emphasis"><em>EXPRESSION</em></span> is true. For valid expressions see
+    <span class="strong"><strong><a class="link" href="#expressions" title="EXPRESSIONS">EXPRESSIONS</a></strong></span>.
+</dd><dt><span class="term">
+<span class="strong"><strong>-k, --known</strong></span>
+</span></dt><dd>
+    print known sites only (ID column is not ".")
+</dd><dt><span class="term">
+<span class="strong"><strong>-m, --min-alleles</strong></span> <span class="emphasis"><em>INT</em></span>
+</span></dt><dd>
+    print sites with at least <span class="emphasis"><em>INT</em></span> alleles listed in REF and ALT columns
+</dd><dt><span class="term">
+<span class="strong"><strong>-M, --max-alleles</strong></span> <span class="emphasis"><em>INT</em></span>
+</span></dt><dd>
+    print sites with at most <span class="emphasis"><em>INT</em></span> alleles listed in REF and ALT columns. Use <span class="strong"><strong>-m2 -M2 -v snps</strong></span> to only view biallelic SNPs.
+</dd><dt><span class="term">
+<span class="strong"><strong>-n, --novel</strong></span>
+</span></dt><dd>
+    print novel sites only (ID column is ".")
+</dd><dt><span class="term">
+<span class="strong"><strong>-p, --phased</strong></span>
+</span></dt><dd>
+    print sites where all samples are phased. Haploid genotypes are
+    considered phased. Missing genotypes considered unphased unless the
+    phased bit is set.
+</dd><dt><span class="term">
+<span class="strong"><strong>-P, --exclude-phased</strong></span>
+</span></dt><dd>
+    exclude sites where all samples are phased
+</dd><dt><span class="term">
+<span class="strong"><strong>-q, --min-af</strong></span> <span class="emphasis"><em>FLOAT</em></span>[<span class="emphasis"><em>:nref</em></span>|<span class="emphasis"><em>:alt1</em></span>|<span class="emphasis"><em>:minor</em></span>|:'major'|:'nonmajor']
+</span></dt><dd>
+    minimum allele frequency (INFO/AC / INFO/AN) of sites to be printed.
+    Specifying the type of allele is optional and can be set to
+    non-reference (<span class="emphasis"><em>nref</em></span>, the default), 1st alternate  (<span class="emphasis"><em>alt1</em></span>), the least
+    frequent (<span class="emphasis"><em>minor</em></span>), the most frequent (<span class="emphasis"><em>major</em></span>) or sum of all but the
+    most frequent (<span class="emphasis"><em>nonmajor</em></span>) alleles.
+</dd><dt><span class="term">
+<span class="strong"><strong>-Q, --max-af</strong></span> <span class="emphasis"><em>FLOAT</em></span>[<span class="emphasis"><em>:nref</em></span>|<span class="emphasis"><em>:alt1</em></span>|<span class="emphasis"><em>:minor</em></span>|:'major'|:'nonmajor']
+</span></dt><dd>
+    maximum allele frequency (INFO/AC / INFO/AN) of sites to be printed.
+    Specifying the type of allele is optional and can be set to
+    non-reference (<span class="emphasis"><em>nref</em></span>, the default), 1st alternate  (<span class="emphasis"><em>alt1</em></span>), the least
+    frequent (<span class="emphasis"><em>minor</em></span>), the most frequent (<span class="emphasis"><em>major</em></span>) or sum of all but the
+    most frequent (<span class="emphasis"><em>nonmajor</em></span>) alleles.
+</dd><dt><span class="term">
+<span class="strong"><strong>-u, --uncalled</strong></span>
+</span></dt><dd>
+    print sites without a called genotype
+</dd><dt><span class="term">
+<span class="strong"><strong>-U, --exclude-uncalled</strong></span>
+</span></dt><dd>
+    exclude sites without a called genotype
+</dd><dt><span class="term">
+<span class="strong"><strong>-v, --types</strong></span> <span class="emphasis"><em>snps</em></span>|<span class="emphasis"><em>indels</em></span>|<span class="emphasis"><em>mnps</em></span>|<span class="emphasis"><em>other</em></span>
+</span></dt><dd>
+    comma-separated list of variant types to select
+</dd><dt><span class="term">
+<span class="strong"><strong>-V, --exclude-types</strong></span> <span class="emphasis"><em>snps</em></span>|<span class="emphasis"><em>indels</em></span>|<span class="emphasis"><em>mnps</em></span>|<span class="emphasis"><em>other</em></span>
+</span></dt><dd>
+    comma-separated list of variant types to exclude
+</dd><dt><span class="term">
+<span class="strong"><strong>-x, --private</strong></span>
+</span></dt><dd>
+    print sites where only the subset samples carry an non-reference allele
+</dd><dt><span class="term">
+<span class="strong"><strong>-X, --exclude-private</strong></span>
+</span></dt><dd>
+    exclude sites where only the subset samples carry an non-reference allele
+</dd></dl></div></div></div></div><div class="refsect1" title="EXPRESSIONS"><a id="expressions"></a><h2>EXPRESSIONS</h2><p>These filtering expressions are accepted by <span class="strong"><strong><a class="link" href="#annotate" title="bcftools annotate [OPTIONS] FILE">annotate</a></strong></span>,
+<span class="strong"><strong><a class="link" href="#filter" title="bcftools filter [OPTIONS] FILE">filter</a></strong></span>, <span class="strong"><strong><a class="link" href="#query" title="bcftools query [OPTIONS] file.vcf.gz [file.vcf.gz […]]">query</a></strong></span> and <span class="strong"><strong><a class="link" href="#view" title="bcftools view [OPTIONS] file.vcf.gz [REGION […]]">view</a></strong></span> commands.</p><div class="itemizedlist" title="Valid expressions may conta [...]
+numerical constants, string constants, file names
+</p><pre class="literallayout">1, 1.0, 1e-4
+"String"
+ at file_name</pre></li><li class="listitem"><p class="simpara">
+arithmetic operators
+</p><pre class="literallayout">+,*,-,/</pre></li><li class="listitem"><p class="simpara">
+comparison operators
+</p><pre class="literallayout">== (same as =), >, >=, <=, <, !=</pre></li><li class="listitem"><p class="simpara">
+regex operators "~" and its negation "!~"
+</p><pre class="literallayout">INFO/HAYSTACK ~ "needle"</pre></li><li class="listitem"><p class="simpara">
+parentheses
+</p><pre class="literallayout">(, )</pre></li><li class="listitem"><p class="simpara">
+logical operators
+</p><pre class="literallayout">&& (same as &), ||,  |</pre></li><li class="listitem"><p class="simpara">
+INFO tags, FORMAT tags, column names
+</p><pre class="literallayout">INFO/DP or DP
+FORMAT/DV, FMT/DV, or DV
+FILTER, QUAL, ID, REF, ALT[0]</pre></li><li class="listitem"><p class="simpara">
+1 (or 0) to test the presence (or absence) of a flag
+</p><pre class="literallayout">FlagA=1 && FlagB=0</pre></li><li class="listitem"><p class="simpara">
+TYPE for variant type in REF,ALT columns (indel,snp,mnp,ref,other)
+</p><pre class="literallayout">TYPE="indel" | TYPE="snp"</pre></li><li class="listitem"><p class="simpara">
+array subscripts, "*" for any field
+</p><pre class="literallayout">(DP4[0]+DP4[1])/(DP4[2]+DP4[3]) > 0.3
+DP4[*] == 0
+CSQ[*] ~ "missense_variant.*deleterious"</pre></li><li class="listitem"><p class="simpara">
+function on FORMAT tags (over samples) and INFO tags (over vector fields)
+</p><pre class="literallayout">MAX, MIN, AVG, SUM, STRLEN, ABS</pre></li><li class="listitem"><p class="simpara">
+variables calculated on the fly if not present: number of alternate alleles;
+number of samples; count of alternate alleles; minor allele count (similar to
+AC but is always smaller than 0.5); frequency of alternate alleles (AF=AC/AN);
+frequency of minor alleles (MAF=MAC/AN); number of alleles in called genotypes
+</p><pre class="literallayout">N_ALT, N_SAMPLES, AC, MAC, AF, MAF, AN</pre></li></ul></div><div class="itemizedlist" title="Notes:"><p class="title"><strong>Notes:</strong></p><ul class="itemizedlist" type="disc"><li class="listitem">
+String comparisons and regular expressions are case-insensitive
+</li><li class="listitem">
+If the subscript "*" is used in regular expression search, the
+whole field is treated as one string. For example, the regex STR[*]~"B,C" will be
+true for the string vector INFO/STR=AB,CD.
+</li><li class="listitem">
+Variables and function names are case-insensitive, but not tag names. For example,
+"qual" can be used instead of "QUAL", "strlen()" instead of "STRLEN()" , but
+not "dp" instead of "DP".
+</li></ul></div><p><span class="strong"><strong>Examples:</strong></span></p><pre class="literallayout">MIN(DV)>5</pre><pre class="literallayout">MIN(DV/DP)>0.3</pre><pre class="literallayout">MIN(DP)>10 & MIN(DV)>3</pre><pre class="literallayout">QUAL>10 |  FMT/GQ>10   .. selects only GQ>10 samples</pre><pre class="literallayout">QUAL>10 || FMT/GQ>10   .. selects all samples at QUAL>10 sites</pre><pre class="literallayout">TYPE="snp" && QUAL> [...]
+have special meaning in the shell.
+An example of expression enclosed in single quotes which cause
+that the whole expression is passed to the program as intended:</p><pre class="literallayout">bcftools view -i '%ID!="." & MAF[0]<0.01'</pre><p>Please refer to the documentation of your shell for details.</p></div><div class="refsect1" title="SCRIPTS AND OPTIONS"><a id="_scripts_and_options"></a><h2>SCRIPTS AND OPTIONS</h2><div class="refsect2" title="plot-vcfstats [OPTIONS] file.vchk […]"><a id="plot-vcfstats"></a><h3>plot-vcfstats [<span class="emphasis"><em>OPTIONS</em></span>] [...]
+results from multiple outputs (useful when running the stats for each
+chromosome separately), plots graphs and creates a PDF presentation.</p><div class="variablelist"><dl><dt><span class="term">
+<span class="strong"><strong>-m, --merge</strong></span>
+</span></dt><dd>
+    Merge vcfstats files to STDOUT, skip plotting.
+</dd><dt><span class="term">
+<span class="strong"><strong>-p, --prefix</strong></span> <span class="emphasis"><em>PATH</em></span>
+</span></dt><dd>
+    The output files prefix, add a slash to create new directory.
+</dd><dt><span class="term">
+<span class="strong"><strong>-P, --no-PDF</strong></span>
+</span></dt><dd>
+    Skip the PDF creation step.
+</dd><dt><span class="term">
+<span class="strong"><strong>-r, --rasterize</strong></span>
+</span></dt><dd>
+    Rasterize PDF images for faster rendering.
+</dd><dt><span class="term">
+<span class="strong"><strong>-s, --sample-names</strong></span>
+</span></dt><dd>
+    Use sample names for xticks rather than numeric IDs.
+</dd><dt><span class="term">
+<span class="strong"><strong>-t, --title</strong></span> <span class="emphasis"><em>STRING</em></span>
+</span></dt><dd>
+    Identify files by these titles in plots. The option can be given multiple
+    times, for each ID in the <span class="strong"><strong><a class="link" href="#stats" title="bcftools stats [OPTIONS] A.vcf.gz [B.vcf.gz]">bcftools stats</a></strong></span> output. If not
+    present, the script will use abbreviated source file names for the titles.
+</dd><dt><span class="term">
+<span class="strong"><strong>-T, --main-title</strong></span> <span class="emphasis"><em>STRING</em></span>
+</span></dt><dd>
+    Main title for the PDF.
+</dd></dl></div></div></div><div class="refsect1" title="PERFORMANCE"><a id="_performance"></a><h2>PERFORMANCE</h2><p>HTSlib was designed with BCF format in mind. When parsing VCF files, all records
+are internally converted into BCF representation. Simple operations, like removing
+a single column from a VCF file, can be therefore done much faster with standard
+UNIX commands, such as <span class="strong"><strong>awk</strong></span> or <span class="strong"><strong>cut</strong></span>.
+Therefore it is recommended to use BCF as input/output format whenever possible to avoid
+large overhead of the VCF → BCF → VCF conversion.</p></div><div class="refsect1" title="BUGS"><a id="_bugs"></a><h2>BUGS</h2><p>Please report any bugs you encounter on the github website: <a class="ulink" href="http://github.com/samtools/bcftools" target="_top">http://github.com/samtools/bcftools</a></p></div><div class="refsect1" title="AUTHORS"><a id="_authors"></a><h2>AUTHORS</h2><p>Heng Li from the Sanger Institute wrote the original C version of htslib,
+samtools and bcftools. Bob Handsaker from the Broad Institute implemented the
+BGZF library. Petr Danecek, Shane McCarthy and John Marshall are  maintaining
+and further developing bcftools.  Many other people contributed to the program
+and to the file format specifications, both directly and indirectly by
+providing patches, testing and reporting bugs. We thank them all.</p></div><div class="refsect1" title="RESOURCES"><a id="_resources"></a><h2>RESOURCES</h2><p>BCFtools GitHub website: <a class="ulink" href="http://github.com/samtools/bcftools" target="_top">http://github.com/samtools/bcftools</a></p><p>Samtools GitHub website: <a class="ulink" href="http://github.com/samtools/samtools" target="_top">http://github.com/samtools/samtools</a></p><p>HTSlib GitHub website: <a class="ulink" hre [...]
+Copyright (c) Genome Research Ltd.</p></div></div></body></html>
diff --git a/doc/bcftools.txt b/doc/bcftools.txt
new file mode 100644
index 0000000..efb6c3d
--- /dev/null
+++ b/doc/bcftools.txt
@@ -0,0 +1,1773 @@
+// bcftools.txt -- asciidoc template for the bcftools man page and html.
+//
+// Please do not modify bcftools.1 or bcftools.html directly,
+// edit this file and convert using the following commands:
+//
+//      make docs
+//
+// or
+//
+//      a2x --doctype manpage --format manpage bcftools.txt
+//      a2x --doctype manpage --format xhtml bcftools.txt
+//
+// Contributions are welcome, simply edit this file and send
+// a pull request or email the modified file directly.
+//
+
+bcftools(1)
+===========
+:doctype: manpage
+
+
+NAME
+----
+bcftools - utilities for variant calling and manipulating VCFs and BCFs.
+
+
+SYNOPSIS
+--------
+*bcftools* ['COMMAND'] ['OPTIONS']
+
+
+DESCRIPTION
+-----------
+BCFtools  is  a set of utilities that manipulate variant calls in the Variant
+Call Format (VCF) and its binary counterpart BCF. All commands work
+transparently with both VCFs and BCFs, both uncompressed and BGZF-compressed.
+
+Most commands accept VCF, bgzipped VCF and BCF with filetype detected
+automatically even when streaming from a pipe. Indexed VCF and BCF
+will work in all situations. Un-indexed VCF and BCF and streams will
+work in most, but not all situations.
+
+BCFtools is designed to work on a stream. It regards an input file "-" as the
+standard input (stdin) and outputs to the standard output (stdout). Several
+commands can thus be  combined  with  Unix pipes.
+
+
+=== VERSION 
+This manual page was last updated *{date}* and refers to bcftools git version *{version}*.
+
+=== BCF1
+The BCF1 format output by versions of samtools \<= 0.1.19 is *not*
+compatible with this version of bcftools. To read BCF1 files one can use
+the view command from old versions of bcftools packaged with samtools
+versions \<= 0.1.19 to convert to VCF, which can then be read by
+this version of bcftools.
+----
+    samtools-0.1.19/bcftools/bcftools view file.bcf1 | bcftools view
+----
+
+
+=== VARIANT CALLING
+See 'bcftools call' for variant calling from the output of the
+'samtools mpileup' command. In versions of samtools \<= 0.1.19 calling was
+done with 'bcftools view'. Users are now required to choose between the old
+samtools calling model ('-c/--consensus-caller') and the new multiallelic
+calling model ('-m/--multiallelic-caller'). The multiallelic calling model
+is recommended for most tasks.
+
+
+LIST OF COMMANDS
+----------------
+For a full list of available commands, run *bcftools* without arguments. For a full
+list of available options, run *bcftools* 'COMMAND' without arguments.
+
+- *<<annotate,annotate>>*   .. edit VCF files, add or remove annotations
+- *<<call,call>>*        ..  SNP/indel calling (former "view")
+- *<<concat,concat>>*    ..  concatenate VCF/BCF files from the same set of samples
+- *<<consensus,consensus>>*    ..  create consensus sequence by applying VCF variants
+- *<<convert,convert>>*  ..  convert VCF/BCF to other formats and back
+- *<<filter,filter>>*    ..  filter VCF/BCF files using fixed thresholds
+- *<<gtcheck,gtcheck>>*  ..  check sample concordance, detect sample swaps and contamination
+- *<<index,index>>*      ..  index VCF/BCF
+- *<<isec,isec>>*        ..  intersections of VCF/BCF files
+- *<<merge,merge>>*      ..  merge VCF/BCF files files from non-overlapping sample sets
+- *<<norm,norm>>*        ..  normalize indels
+- *<<plugin,plugin>>*    ..  run user-defined plugin
+- *<<query,query>>*      ..  transform VCF/BCF into user-defined formats
+- *<<reheader,reheader>>*   ..  modify VCF/BCF header, change sample names
+- *<<roh,roh>>*          ..  identify runs of homo/auto-zygosity
+- *<<stats,stats>>*      ..  produce VCF/BCF stats (former vcfcheck)
+- *<<view,view>>*        ..  subset, filter and convert VCF and BCF files
+
+
+LIST OF SCRIPTS
+---------------
+Some helper scripts are bundled with the bcftools code.
+
+- *<<plot-vcfstats,plot-vcfstats>>*  .. plots the output of *<<stats,stats>>*
+
+
+COMMANDS AND OPTIONS
+--------------------
+
+[[common_options]]
+=== Common Options
+
+The following options are common to many bcftools commands. See usage for
+specific commands to see if they apply.
+
+'FILE'::
+    Files can be both VCF or BCF, uncompressed or BGZF-compressed. The file "-"
+    is interpreted as standard input. Some tools may require tabix- or
+    CSI-indexed files.
+
+*-c, --collapse* 'snps'|'indels'|'both'|'all'|'some'|'none'|'id'::
+    Controls  how to treat records with duplicate positions and defines compatible
+    records across multiple input files. Here by "compatible" we mean records which
+    should be considered as identical by the tools. For example, when performing
+    line intersections, the desire may be to consider as identical all sites with
+    matching positions (*bcftools isec -c* 'all'), or only sites with  matching variant
+    type (*bcftools isec -c* 'snps'{nbsp} *-c* 'indels'), or only sites with all alleles
+    identical (*bcftools isec -c* 'none').
+
+
+        'none';;
+            only records with identical REF and ALT alleles are compatible
+
+        'some';;
+            only records where some subset of ALT alleles match are compatible
+
+        'all';;
+            all records are compatible, regardless of whether the ALT alleles
+            match or not. In the case of records with the same position, only
+            the first will be considered and appear on output.
+
+        'snps';;
+            any SNP records are compatible, regardless of whether the ALT
+            alleles match or not. For duplicate positions, only the first SNP
+            record will be considered and appear on output.
+
+        'indels';;
+            all  indel records are compatible, regardless of whether the REF
+            and ALT alleles match or not. For duplicate positions, only the
+            first indel record will be considered and appear on output.
+
+        'both';;
+            abbreviation of "*-c* 'indels'{nbsp} *-c* 'snps'"
+
+        'id';;
+            only records with identical ID column are compatible.
+            Supported by *<<merge,bcftools merge>>* only.
+
+*-f, --apply-filters* 'LIST'::
+    Skip sites where FILTER column does not contain any of the strings listed
+    in 'LIST'. For example, to include only sites which have no filters set,
+    use *-f* '.,PASS'.
+
+*-o, --output* 'FILE'::
+    When output consists of a single stream, write it to 'FILE' rather than
+    to standard output, where it is written by default.
+
+*-O, --output-type* 'b'|'u'|'z'|'v'::
+    Output compressed BCF ('b'), uncompressed BCF ('u'), compressed VCF ('z'), uncompressed VCF ('v').
+
+*-r, --regions* 'chr'|'chr:pos'|'chr:from-to'|'chr:from-'[,...]::
+    Comma-separated list of regions, see also *-R, --regions-file*. Note
+    that *-r* cannot be used in combination with *-R*.
+
+*-R, --regions-file* 'FILE'::
+    Regions can be specified either on command line or in a VCF, BED, or
+    tab-delimited file (the default).  The columns of the tab-delimited file
+    are: CHROM, POS, and,  optionally,  POS_TO,  where positions are 1-based
+    and inclusive.  Uncompressed files are stored in memory, while
+    bgzip-compressed and tabix-indexed region files are streamed.  Note that
+    sequence names must match exactly, "chr20" is not the same as "20".
+    Also note that chromosome ordering in 'FILE' will be respected,
+    the VCF will be processed in the order in which chromosomes first appear
+    in 'FILE'. However, within chromosomes, the VCF will always be
+    processed in ascending genomic coordinate order no matter what order they
+    appear in 'FILE'. Note that overlapping regions in 'FILE' can result in
+    duplicated out of order positions in the output.
+    This option requires indexed VCF/BCF files. Note that *-R* cannot be used 
+    in combination with *-r*.
+
+*-s, --samples* \[^]'LIST'::
+    Comma-separated list of samples to include or exclude if prefixed
+    with "^".
+
+*-S, --samples-file* [^]'FILE'::
+    File of sample names to include or exclude if prefixed with "^".
+    One sample per line.
+    The command *<<call,bcftools call>>* accepts an optional second
+    column indicating ploidy (0, 1 or 2) and can parse also PED files.
+    With *<<call,bcftools call>> -C* 'trio', PED file is expected.
+
+*-t, --targets* \[^]'chr'|'chr:pos'|'chr:from-to'|'chr:from-'[,...]::
+    Similar as *-r, --regions*, but the next position is accessed by streaming the
+    whole VCF/BCF rather than using the tbi/csi index. Both *-r* and *-t* options
+    can be applied simultaneously: *-r*  uses  the index  to  jump  to  a  region
+    and *-t* discards positions which are not in the targets. Unlike *-r*, targets
+    can be prefixed with "^" to request logical complement. For example, "^X,Y,MT"
+    indicates that sequences X, Y and MT should be skipped.
+    Yet another difference between the two is that *-r* checks both start and
+    end positions of indels, whereas *-t* checks start positions only. Note
+    that *-t* cannot be used in combination with *-T*.
+
+*-T, --targets-file* \[^]'FILE'::
+    Same *-t, --targets*, but reads regions from a file. Note that *-T*
+    cannot be used in combination with *-t*.
+
+    ::
+    With the *call -C* 'alleles' command, third column of the targets file must
+    be comma-separated list of alleles, starting with the reference allele.
+    Such a file can be easily created from a VCF using:
+----
+    bcftools query -f'%CHROM\t%POS\t%REF,%ALT\n' file.vcf
+----
+
+[[annotate]]
+=== bcftools annotate '[OPTIONS]' 'FILE'
+
+This command allows to add or remove annotations.
+
+*-a, --annotations* 'file'::
+    Bgzip-compressed and tabix-indexed file with annotations. The file
+    can be VCF, BED, or a tab-delimited file with mandatory columns CHROM, POS
+    (or, alternatively, FROM and TO), optional columns REF and ALT, and arbitrary
+    number of annotation columns. BED files are expected to have 
+    the ".bed" or ".bed.gz" suffix (case-insensitive), otherwise a tab-delimited file is assumed.
+    Note that in case of tab-delimited file, the coordinates POS, FROM and TO are
+    one-based and inclusive.  When REF and ALT are present, only matching VCF
+    records will be annotated.
+    When multiple ALT alleles are present in the annotation file (given as
+    comma-separated list of alleles), at least one must match one of the
+    alleles in the corresponding VCF record. Similarly, at least one
+    alternate allele from a multi-allelic VCF record must be present in the
+    annotation file.
+    Note that flag types, such as "INFO/FLAG", can be annotated by including
+    a field with the value "1" to set the flag, "0" to remove it, or "." to
+    keep existing flags.
+    See also *-c, --columns* and *-h, --header-lines*.
+----
+    # Sample annotation file with columns CHROM, POS, STRING_TAG, NUMERIC_TAG
+    1  752566  SomeString      5
+    1  798959  SomeOtherString 6
+    # etc.
+----
+
+*-c, --columns* 'list'::
+    Comma-separated list of columns or tags to carry over from the annotation file
+    (see also *-a, --annotations*). If the annotation file is not a VCF/BCF,
+    'list' describes the columns of the annotation file and must include CHROM,
+    POS (or, alternatively, FROM and TO), and optionally REF and ALT. Unused
+    columns which should be ignored can be indicated by "-".
+    If the annotation file is a VCF/BCF, only the edited columns/tags must be present and their
+    order does not matter. The columns ID, QUAL, FILTER, INFO and FORMAT
+    can be edited, where INFO tags can be written both as "INFO/TAG" or simply "TAG",
+    and FORMAT tags can be written as "FORMAT/TAG" or "FMT/TAG".
+    To carry over all INFO annotations, use "INFO". To add all INFO annotations except
+    "TAG", use "^INFO/TAG". By default, existing values are replaced. To add
+    values without overwriting existing annotations, use "+TAG" instead of "TAG".
+    To replace only existing values without modifying missing annotations, use "-TAG".
+    If the annotation file is not a VCF/BCF, all new annotations must be
+    defined via *-h, --header-lines*.
+
+*-e, --exclude* 'EXPRESSION'::
+    exclude sites for which 'EXPRESSION' is true. For valid expressions see
+    *<<expressions,EXPRESSIONS>>*.
+
+*-h, --header-lines* 'file'::
+    Lines to append to the VCF header, see also *-c, --columns* and *-a, --annotations*. For example:
+----
+    ##INFO=<ID=NUMERIC_TAG,Number=1,Type=Integer,Description="Example header line">
+    ##INFO=<ID=STRING_TAG,Number=1,Type=String,Description="Yet another header line">
+----
+
+*-I, --set-id* \[+]'FORMAT'::
+    assign ID on the fly. The format is the same as in the *<<query,query>>*
+    command (see below).  By default all existing IDs are replaced. If the
+    format string is preceded by "+", only missing IDs will be set. For example,
+    one can use
+----
+    bcftools annotate --set-id +'%CHROM\_%POS\_%REF\_%FIRST_ALT' file.vcf
+----
+
+*-i, --include* 'EXPRESSION'::
+    include only sites for which 'EXPRESSION' is true. For valid expressions see
+    *<<expressions,EXPRESSIONS>>*.
+
+*-o, --output* 'FILE'::
+    see *<<common_options,Common Options>>*
+
+*-O, --output-type* 'b'|'u'|'z'|'v'::
+    see *<<common_options,Common Options>>*
+
+
+*-r, --regions* 'chr'|'chr:pos'|'chr:from-to'|'chr:from-'[,...]::
+    see *<<common_options,Common Options>>*
+
+*-R, --regions-file* 'file'::
+    see *<<common_options,Common Options>>*
+
+*--rename-chrs* 'file'::
+    rename chromosomes according to the map in 'file', with
+    "old_name new_name\n" pairs separated by whitespaces, each on a separate
+    line.
+
+*-s, --samples* \[^]'LIST'::
+    subset of samples to annotate, see also *<<common_options,Common Options>>*
+
+*-S, --samples-file* 'FILE'::
+    subset of samples to annotate. If the samples are named differently in the
+    target VCF and the *-a, --annotations* VCF, the name mapping can be
+    given as "src_name dst_name\n", separated by whitespaces, each pair on a
+    separate line.
+
+*-x, --remove* 'list'::
+    List of annotations to remove. Use "FILTER" to remove all filters or
+    "FILTER/SomeFilter" to remove a specific filter. Similarly, "INFO" can
+    be used to remove all INFO tags and "FORMAT" to remove all FORMAT tags
+    except GT. To remove all INFO tags except "FOO" and "BAR", use
+    "^INFO/FOO,INFO/BAR" (and similarly for FORMAT and FILTER).
+    "INFO" can be abbreviated to "INF" and "FORMAT" to "FMT".
+
+*Examples:*
+----
+    # Remove three fields
+    bcftools annotate -x ID,INFO/DP,FORMAT/DP file.vcf.gz
+
+    # Remove all INFO fields and all FORMAT fields except for GT and PL
+    bcftools annotate -x INFO,^FORMAT/GT,FORMAT/PL file.vcf
+
+    # Add ID, QUAL and INFO/TAG, not replacing TAG if already present
+    bcftools annotate -a src.bcf -c ID,QUAL,+TAG dst.bcf
+
+    # Carry over all INFO and FORMAT annotations except FORMAT/GT
+    bcftools annotate -a src.bcf -c INFO,^FORMAT/GT dst.bcf
+    
+    # Annotate from a tab-delimited file with six columns (the fifth is ignored),
+    # first indexing with tabix. The coordinates are 1-based.
+    tabix -s1 -b2 -e2 annots.tab.gz
+    bcftools annotate -a annots.tab.gz -h annots.hdr -c CHROM,POS,REF,ALT,-,TAG file.vcf
+
+    # Annotate from a tab-delimited file with regions (1-based coordinates, inclusive)
+    tabix -s1 -b2 -e3 annots.tab.gz 
+    bcftools annotate -a annots.tab.gz -h annots.hdr -c CHROM,FROM,TO,TAG inut.vcf
+
+    # Annotate from a bed file (0-based coordinates, half-closed, half-open intervals)
+    bcftools annotate -a annots.bed.gz -h annots.hdr -c CHROM,FROM,TO,TAG input.vcf
+----
+
+
+[[call]]
+=== bcftools call '[OPTIONS]' 'FILE'
+
+This command replaces the former *bcftools view* caller. Some of the original
+functionality has been temporarily lost in the process of transition under
+http://github.com/samtools/htslib[htslib], but will be added back on popular
+demand. The original calling model can be invoked with the *-c* option.
+
+==== File format options:
+
+*-O, --output-type* 'b'|'u'|'z'|'v'::
+    see *<<common_options,Common Options>>*
+
+*-r, --regions* 'chr'|'chr:pos'|'chr:from-to'|'chr:from-'[,...]::
+    see *<<common_options,Common Options>>*
+
+*-R, --regions-file* 'file'::
+    see *<<common_options,Common Options>>*
+
+*-s, --samples* 'LIST'::
+    see *<<common_options,Common Options>>*
+
+*-S, --samples-file* 'FILE'::
+    see *<<common_options,Common Options>>*
+
+*-t, --targets* 'LIST'::
+    see *<<common_options,Common Options>>*
+
+*-T, --targets-file* 'FILE'::
+    see *<<common_options,Common Options>>*
+
+==== Input/output options:
+
+*-A, --keep-alts*::
+    output all alternate alleles present in the alignments even if they do not
+    appear in any of the genotypes
+
+*-f, --format-fields* 'list'::
+    comma-separated list of FORMAT fields to output for each sample. Currently
+    GQ and GP fields are supported. For convenience, the fields can be given
+    as lower case letters.
+
+*-g, --gvcf* 'INT'::
+    output also gVCF blocks of homozygous REF calls. The parameter 'INT' is the
+    minimum per-sample depth required to include a site in the non-variant
+    block.
+
+*-M, --keep-masked-ref*::
+    output sites where REF allele is N
+
+*-o, --output* 'FILE'::
+    see *<<common_options,Common Options>>*
+
+*-V, --skip-variants* 'snps'|'indels'::
+    skip indel/SNP sites
+
+*-v, --variants-only*::
+    output variant sites only
+
+==== Consensus/variant calling options:
+
+*-c, --consensus-caller*::
+    the original *samtools*/*bcftools* calling method (conflicts with *-m*)
+
+*-C, --constrain* 'alleles'|'trio'::
+
+        'alleles';;
+            call genotypes given alleles. See also *-T, --targets-file*.
+
+        'trio';;
+            call genotypes given the father-mother-child constraint. See also
+            *-s, --samples* and *-n, --novel-rate*.
+
+*-m, --multiallelic-caller*::
+    alternative modelfor multiallelic and rare-variant calling designed to
+    overcome known limitations in *-c* calling model (conflicts with *-c*)
+
+*-n, --novel-rate* 'float'[,...]::
+    likelihood of novel mutation for constrained *-C* 'trio' calling. The trio
+    genotype calling maximizes likelihood of a particular combination of
+    genotypes for father, mother and the child
+    P(F=i,M=j,C=k) = P(unconstrained) * Pn + P(constrained) * (1-Pn).
+    By providing three values, the mutation rate Pn is set explictly for SNPs,
+    deletions and insertions, respectively.  If two values are given, the first
+    is interpreted as the mutation rate of SNPs and the second is used to
+    calculate the mutation rate of indels according to their length as
+    Pn='float'*exp(-a-b*len), where a=22.8689, b=0.2994 for insertions and
+    a=21.9313, b=0.2856 for deletions [pubmed:23975140].  If only one value is
+    given, the same mutation rate Pn is used for SNPs and indels.
+
+*-p, --pval-threshold* 'float'::
+    with *-c*, accept variant if P(ref|D) < 'float'.
+
+*-P, --prior* 'float'::
+    expected substitution rate, or 0 to disable the prior.
+
+*-t, --targets* 'file'|'chr'|'chr:pos'|'chr:from-to'|'chr:from-'[,...]::
+    see *<<common_options,Common Options>>*
+
+*-X, --chromosome-X*::
+    haploid output for male samples (requires PED file with *-s*)
+
+*-Y, --chromosome-Y*::
+    haploid output for males and skips females (requires PED file with *-s*)
+
+
+[[concat]]
+=== bcftools concat '[OPTIONS]' 'FILE1' 'FILE2' [...]
+
+Concatenate or combine VCF/BCF files. All source files must have the same sample
+columns appearing in the same order. Can be used, for example, to
+concatenate chromosome VCFs into one VCF, or combine a SNP VCF and an indel
+VCF into one. The input files must be sorted by chr and position. The files
+must be given in the correct order to produce sorted VCF on output unless
+the *-a, --allow-overlaps* option is specified.
+
+*-a, --allow-overlaps*::
+    First coordinate of the next file can precede last record of the current file.
+
+*-D, --remove-duplicates*::
+    If a record is present in multiple files, output only the first instance.
+    Requires *-a, --allow-overlaps*.
+
+*-f, --file-list* 'FILE'::
+    Read the list of files from a file.
+
+*-l, --ligate*::
+    Ligate phased VCFs by matching phase at overlapping haplotypes
+
+*-o, --output* 'FILE'::
+    see *<<common_options,Common Options>>*
+
+*-O, --output-type* 'b'|'u'|'z'|'v'::
+    see *<<common_options,Common Options>>*
+
+*-q, --min-PQ* 'INT'::
+    Break phase set if phasing quality is lower than 'INT'
+
+*-r, --regions* 'chr'|'chr:pos'|'chr:from-to'|'chr:from-'[,...]::
+    see *<<common_options,Common Options>>*. Requires *-a, --allow-overlaps*.
+
+*-R, --regions-file* 'FILE'::
+    see *<<common_options,Common Options>>*. Requires *-a, --allow-overlaps*.
+
+
+[[consensus]]
+=== bcftools consensus '[OPTIONS]' 'FILE'
+Create consensus sequence by applying VCF variants to a reference fasta file.
+
+*-f, --fasta-ref* 'FILE'::
+    reference sequence in fasta format
+
+*-H, --haplotype* '1'|'2'::
+    apply variants for the given haplotype. This option requires *-s*, unless
+    exactly one sample is present in the VCF
+
+*-i, --iupac-codes*::
+    output variants in the form of IUPAC ambiguity codes
+
+*-m, --mask* 'FILE'::
+    BED file or TAB file with regions to be replaced with N. See discussion
+    of *--regions-file* in *<<common_options,Common Options>>* for file
+    format details.
+
+*-o, --output* 'FILE'::
+    write output to a file
+
+*-s, --sample* 'NAME'::
+    apply variants of the given sample
+
+*Examples:*
+----
+    # Apply variants present in sample "NA001", output IUPAC codes for hets
+    bcftools consensus -i -s NA001 -f in.fa in.vcf.gz > out.fa
+
+    # Create consensus for one region. The fasta header lines are then expected
+    # in the form ">chr:from-to".
+    samtools faidx ref.fa 8:11870-11890 | bcftools consensus in.vcf.gz -o out.fa
+----
+
+
+[[convert]]
+=== bcftools convert '[OPTIONS]' 'FILE'
+
+==== VCF input options:
+
+*-e, --exclude* 'EXPRESSION'::
+    exclude sites for which 'EXPRESSION' is true. For valid expressions see
+    *<<expressions,EXPRESSIONS>>*.
+
+*-i, --include* 'EXPRESSION'::
+    include only sites for which 'EXPRESSION' is true. For valid expressions see
+    *<<expressions,EXPRESSIONS>>*.
+
+*-r, --regions* 'chr'|'chr:pos'|'chr:from-to'|'chr:from-'[,...]::
+    see *<<common_options,Common Options>>*
+
+*-R, --regions-file* 'FILE'::
+    see *<<common_options,Common Options>>*
+
+*-s, --samples* 'LIST'::
+    see *<<common_options,Common Options>>*
+
+*-S, --samples-file* 'FILE'::
+    see *<<common_options,Common Options>>*
+
+*-t, --targets* 'LIST'::
+    see *<<common_options,Common Options>>*
+
+*-T, --targets-file* 'FILE'::
+    see *<<common_options,Common Options>>*
+
+==== VCF output options:
+
+*-o, --output* 'FILE'::
+    see *<<common_options,Common Options>>*
+
+*-O, --output-type* 'b'|'u'|'z'|'v'::
+    see *<<common_options,Common Options>>*
+
+==== GEN/SAMPLE conversion:
+*-G, --gensample2vcf* 'prefix' or 'gen-file','sample-file'::
+    convert IMPUTE2 output to VCF. The second column must be of the form
+    "CHROM:POS_REF_ALT" to detect possible strand swaps; IMPUTE2 leaves the
+    first one empty ("--") when sites from reference panel are filled in. See
+    also *-g* below.
+
+*-g, --gensample* 'prefix' or 'gen-file','sample-file'::
+    convert from VCF to gen/sample format used by IMPUTE2 and SHAPEIT.
+    The columns of .gen file format are ID1,ID2,POS,A,B followed by three
+    genotype probabilities P(AA), P(AB), P(BB) for each sample.  In order to
+    prevent strand swaps, the program uses IDs of the form "CHROM:POS_REF_ALT".
+    For example:
+----
+  .gen
+  ----
+  1:111485207_G_A 1:111485207_G_A 111485207 G A 0 1 0 0 1 0
+  1:111494194_C_T 1:111494194_C_T 111494194 C T 0 1 0 0 0 1
+
+  .sample
+  -------
+  ID_1 ID_2 missing
+  0 0 0
+  sample1 sample1 0
+  sample2 sample2 0
+----
+
+*--tag* 'STRING'::
+    tag to take values for .gen file: GT,PL,GL,GP
+
+==== gVCF conversion:
+*--gvcf2vcf*::
+    convert gVCF to VCF, expanding REF blocks into sites. Only sites
+    with FILTER set to "PASS" or "." will be expanded.
+
+==== HAPS/SAMPLE conversion:
+*--hapsample2vcf* 'prefix' or 'haps-file','sample-file'::
+    convert from haps/sample format to VCF. The columns of .haps file are
+    similar to .gen file above, but there are only two haplotype columns per
+    sample. Note that the first column of the haps file is expected to be in
+    the form "CHR:POS_REF_ALT", for example:
+----
+  .haps
+  ----
+  1:111485207_G_A rsID1 111485207 G A 0 1 0 0
+  1:111494194_C_T rsID2 111494194 C T 0 1 0 0
+----
+
+==== HAPS/LEGEND/SAMPLE conversion:
+*-H, --haplegendsample2vcf* 'prefix' or 'haps-file','legend-file','sample-file'::
+    convert from haps/legend/sample format used by IMPUTE2 to VCF, see
+    also *-h, --hapslegendsample* below.
+
+*-h, --haplegendsample* 'prefix' or 'haps-file','legend-file','sample-file'::
+    convert from VCF to haps/legend/sample format used by IMPUTE2 and SHAPEIT.
+    The columns of .legend file ID,POS,REF,ALT. In order to prevent strand
+    swaps, the program uses IDs of the form "CHROM:POS_REF_ALT". The .sample
+    file is quite basic at the moment with columns for population, group and
+    sex expected to be edited by the user. For example:
+----
+  .haps
+  -----
+  0 1 0 0 1 0
+  0 1 0 0 0 1
+
+  .legend
+  -------
+  id position a0 a1
+  1:111485207_G_A 111485207 G A
+  1:111494194_C_T 111494194 C T
+
+  .sample
+  -------
+  sample population group sex
+  sample1 sample1 sample1 2
+  sample2 sample2 sample2 2
+----
+
+*--haploid2diploid*::
+    with *-h* option converts haploid genotypes to homozygous diploid
+    genotypes. For example, the program will print '0 0' instead of the 
+    default '0 -'. This is useful for programs which do not handle haploid
+    genotypes correctly.
+
+*--vcf-ids*::
+    output VCF IDs instead of "CHROM:POS_REF_ALT" IDs
+
+==== TSV conversion:
+*--tsv2vcf* 'file'::
+    convert from TSV (tab-separated values) format (such as generated by
+    23andMe) to VCF. The input file fields can be tab- or space- delimited
+
+*-c, --columns* 'list'::
+    comma-separated list of fields in the input file. In the current
+    version, the fields CHROM, POS, ID, and AA are expected and 
+    can appear in arbitrary order, columns which should be ignored in the input
+    file can be indicated by "-".
+    The AA field lists alleles on the forward reference strand,
+    for example "CC" or "CT" for diploid genotypes or "C"
+    for haploid genotypes (sex chromosomes). Insertions and deletions
+    are not supported yet, missing data can be indicated with "--".
+
+*-f, --fasta-ref* 'file'::
+    reference sequence in fasta format
+
+*-s, --samples* 'LIST'::
+    list of sample names. See *<<common_options,Common Options>>*
+
+*-S, --samples-file* 'FILE'::
+    file of sample names. See *<<common_options,Common Options>>*
+
+*Example:*
+----
+# Convert 23andme results into VCF
+bcftools convert -c ID,CHROM,POS,AA -s SampleName -f 23andme-ref.fa --tsv2vcf 23andme.txt -Oz -o out.vcf.gz
+----
+
+[[filter]]
+=== bcftools filter '[OPTIONS]' 'FILE'
+
+Apply fixed-threshold filters.
+
+*-e, --exclude* 'EXPRESSION'::
+    exclude sites for which 'EXPRESSION' is true. For valid expressions see
+    *<<expressions,EXPRESSIONS>>*.
+
+*-g, --SnpGap* 'INT'::
+    filter SNPs within 'INT' base pairs of an indel. The following example
+    demonstrates the logic of *--SnpGap* '3' applied on a deletion and
+    an insertion:
+----
+The SNPs at positions 1 and 7 are filtered, positions 0 and 8 are not:
+         0123456789
+    ref  .G.GT..G..
+    del  .A.G-..A..
+Here the positions 1 and 6 are filtered, 0 and 7 are not:
+         0123-456789
+    ref  .G.G-..G..
+    ins  .A.GT..A..
+----
+
+*-G, --IndelGap* 'INT'::
+    filter clusters of indels separated by 'INT' or fewer base pairs allowing
+    only one to pass. The following example demonstrates the logic of
+    *--IndelGap* '2' applied on a deletion and an insertion:
+----
+The second indel is filtered:
+         012345678901
+    ref  .GT.GT..GT..
+    del  .G-.G-..G-..
+And similarly here, the second is filtered:
+         01 23 456 78
+    ref  .A-.A-..A-..
+    ins  .AT.AT..AT..
+----
+
+*-i, --include* 'EXPRESSION'::
+    include only sites for which 'EXPRESSION' is true. For valid expressions see
+    *<<expressions,EXPRESSIONS>>*.
+
+*-m, --mode* ['+x']::
+    define behaviour at sites with existing FILTER annotations. The default
+    mode replaces existing filters of failed sites with a new FILTER string
+    while leaving sites which pass untouched when non-empty and setting to
+    "PASS" when the FILTER string is absent. The "\+" mode appends new FILTER
+    strings of failed sites instead of replacing them. The "x" mode resets
+    filters of sites which pass to "PASS". Modes "+" and "x" can both be set.
+
+*-o, --output* 'FILE'::
+    see *<<common_options,Common Options>>*
+
+*-O, --output-type* 'b'|'u'|'z'|'v'::
+    see *<<common_options,Common Options>>*
+
+*-r, --regions* 'chr'|'chr:pos'|'chr:from-to'|'chr:from-'[,...]::
+    see *<<common_options,Common Options>>*
+
+*-R, --regions-file* 'file'::
+    see *<<common_options,Common Options>>*
+
+*-s, --soft-filter* 'STRING'|'+'::
+    annotate FILTER column with 'STRING' or, with '+', a unique filter name generated
+    by the program ("Filter%d").
+
+*-S, --set-GTs* '.'|'0'::
+    set genotypes of failed samples to missing value ('.') or reference allele ('0')
+
+*-t, --targets* 'chr'|'chr:pos'|'chr:from-to'|'chr:from-'[,...]::
+    see *<<common_options,Common Options>>*
+
+*-T, --targets-file* 'file'::
+    see *<<common_options,Common Options>>*
+
+
+
+
+
+[[gtcheck]]
+=== bcftools gtcheck ['OPTIONS'] [*-g* 'genotypes.vcf.gz'] 'query.vcf.gz'
+Checks sample identity or, without *-g*, multi-sample cross-check is performed.
+
+*-a, --all-sites*::
+    output for all sites
+
+*-g, --genotypes* 'genotypes.vcf.gz'::
+    reference genotypes to compare against
+
+*-G, --GTs-only* 'INT'::
+    use genotypes (GT) instead of genotype likelihoods (PL). When set to 1, 
+    reported discordance is the number of non-matching GTs, otherwise the 
+    number 'INT' is interpreted as phred-scaled likelihood of unobserved
+    genotypes.
+
+*-H, --homs-only*::
+    consider only genotypes which are homozygous in both 'genotypes' and
+    'query' VCF. This may be useful with low coverage data.
+
+*-p, --plot* 'PREFIX'::
+    produce plots
+
+*-r, --regions* 'chr'|'chr:pos'|'chr:from-to'|'chr:from-'[,...]::
+    see *<<common_options,Common Options>>*
+
+*-R, --regions-file* 'file'::
+    see *<<common_options,Common Options>>*
+
+*-s, --query-sample* 'STRING'::
+    query sample in 'query.vcf.gz'. By default, the first sample is checked.
+
+*-S, --target-sample* 'STRING'::
+    target sample in the *-g* file, used only for plotting, not for analysis
+
+*-t, --targets* 'file'::
+    see *<<common_options,Common Options>>*
+
+*-T, --targets-file* 'file'::
+    see *<<common_options,Common Options>>*
+
+==== Output files format:
+    CN, Discordance;;
+        Pairwise discordance for all sample pairs is calculated as
+----
+        \sum_s { min_G { PL_a(G) + PL_b(G) } },
+----
+    ;;
+        where the sum runs over all sites 's' and 'G' is the the most likely
+        genotype shared by both samples 'a' and 'b'.  When PL field is not
+        present, a constant value '99' is used for the unseen genotypes.  With
+        *-G*, the value '1' can be used instead; the discordance value then
+        gives exactly the number of differing genotypes.
+
+    SM, Average Discordance;;
+        Average discordance between sample 'a' and all other samples.
+
+    SM, Average Depth;;
+        Average depth at evaluated sites, or 1 if FORMAT/DP field is not
+        present.
+
+    SM, Average Number of sites;;
+        The average number of sites used to calculate the discordance.  In
+        other words, the average number of non-missing PLs/genotypes seen
+        both samples.
+
+//    MD, Maximum Deviation;;
+//        The maximum absolute deviation from average score of the sample
+//        most dissimilar to the rest.
+
+
+[[index]]
+=== bcftools index ['OPTIONS']  '<in.bcf>|<in.vcf.gz>'
+Creates index for bgzip compressed VCF/BCF files for random access. CSI
+(coordinate-sorted index) is created by default. The CSI format
+supports indexing of chromosomes up to length 2^31. TBI (tabix index)
+index files, which support chromosome lengths up to 2^29, can be
+created by using the '-t/--tbi' option or using the 'tabix' program
+packaged with htslib. When loading an index file, bcftools will try
+the CSI first and then the TBI.
+
+==== Indexing options:
+*-c, --csi*::
+    generate CSI-format index for VCF/BCF files [default]
+
+*-f, --force*::
+    overwrite index if it already exists
+
+*-m, --min-shift 'INT'*::
+    set minimal interval size for CSI indices to 2^INT; default: 14
+
+*-t, --tbi*::
+    generate TBI-format index for VCF files
+
+==== Stats options:
+*-n, --nrecords*::
+    print the number of records based on the CSI or TBI index files
+
+*-s, --stats*::
+    Print per contig stats based on the CSI or TBI index files. 
+    Output format is three tab-delimited columns listing the contig 
+    name, contig length ('.' if unknown) and number of records for 
+    the contig. Contigs with zero records are not printed.
+
+[[isec]]
+=== bcftools isec ['OPTIONS']  'A.vcf.gz' 'B.vcf.gz' [...]
+Creates intersections, unions and complements of VCF files. Depending
+on the options, the program can output records from one (or more) files
+which have (or do not have) corresponding records with the same position
+in the other files.
+
+*-c, --collapse* 'snps'|'indels'|'both'|'all'|'some'|'none'::
+    see *<<common_options,Common Options>>*
+
+*-C, --complement*::
+    output positions present only in the first file but missing in the others
+
+*-e, --exclude* '-'|'EXPRESSION'::
+    exclude sites for which 'EXPRESSION' is true. If *-e* (or *-i*)
+    appears only once, the same filtering expression will be applied to all
+    input files.  Otherwise, *-e* or *-i* must be given for each input file.
+    To indicate that no filtering should be performed on a file, use "-" in
+    place of 'EXPRESSION', as shown in the example below.
+    For valid expressions see *<<expressions,EXPRESSIONS>>*.
+
+*-f, --apply-filters* 'LIST'::
+    see *<<common_options,Common Options>>*
+
+*-i, --include* 'EXPRESSION'::
+    include only sites for which 'EXPRESSION' is true. See discussion
+    of *-e, --exclude* above.
+
+*-n, --nfiles* \[+-=]'INT'::
+    output positions present in this many (=), this many or more (+), or this
+    many or fewer (-) files
+
+*-o, --output* 'FILE'::
+    see *<<common_options,Common Options>>*.  When several files are being
+    output, their names are controlled via *-p* instead.
+
+*-O, --output-type* 'b'|'u'|'z'|'v'::
+    see *<<common_options,Common Options>>*
+
+*-p, --prefix* 'DIR'::
+    if given, subset each of the input files accordingly. See also *-w*.
+
+*-r, --regions* 'chr'|'chr:pos'|'chr:from-to'|'chr:from-'[,...]::
+    see *<<common_options,Common Options>>*
+
+*-R, --regions-file* 'file'::
+    see *<<common_options,Common Options>>*
+
+*-t, --targets* 'chr'|'chr:pos'|'chr:from-to'|'chr:from-'[,...]::
+    see *<<common_options,Common Options>>*
+
+*-T, --targets-file* 'file'::
+    see *<<common_options,Common Options>>*
+
+*-w, --write* 'LIST'::
+    list of input files to output given as 1-based indices. With *-p* and no
+    *-w*, all files are written.
+
+==== Examples:
+
+Create intersection and complements of two sets saving the output in dir/*
+----
+    bcftools isec -p dir A.vcf.gz B.vcf.gz
+----
+
+Filter sites in A and B (but not in C) and create intersection
+----
+    bcftools isec -e'MAF<0.01' -i'dbSNP=1' -e- A.vcf.gz B.vcf.gz C.vcf.gz -p dir
+----
+
+Extract and write records from A shared by both A and B using exact allele match
+----
+    bcftools isec -p dir -n=2 -w1 A.vcf.gz B.vcf.gz
+----
+
+Extract records private to A or B comparing by position only
+----
+    bcftools isec -p dir -n-1 -c all A.vcf.gz B.vcf.gz
+----
+
+
+[[merge]]
+=== bcftools merge ['OPTIONS'] 'A.vcf.gz' 'B.vcf.gz' [...]
+Merge multiple VCF/BCF files from non-overlapping sample sets to create one
+multi-sample file.  For example, when merging file 'A.vcf.gz' containing
+samples 'S1', 'S2' and 'S3' and file 'B.vcf.gz' containing samples 'S3' and
+'S4', the output file will contain four samples named 'S1', 'S2', 'S3', '2:S3'
+and 'S4'.
+
+Note that it is responsibility of the user to ensure that the sample names are
+unique across all files. If they are not, the program will exit with an error
+unless the option *--force-samples* is given.  The sample names can be
+also given explicitly using the *--print-header* and *--use-header* options.
+
+Note that only records from different files can be merged, never from the same file.
+For "vertical" merge take a look at *<<norm,bcftools norm>>* instead.
+
+
+*--force-samples*::
+    if the merged files contain duplicate samples names, proceed anyway.
+    Duplicate sample names will be resolved by prepending index of the file
+    as it appeared on the command line to the conflicting sample name (see
+    '2:S3' in the above example).
+
+*--print-header*::
+    print only merged header and exit
+
+*--use-header* 'FILE'::
+    use the VCF header in the provided text 'FILE'
+
+*-f, --apply-filters* 'LIST'::
+    see *<<common_options,Common Options>>*
+
+*-i, --info-rules* '-'|'TAG:METHOD'[,...]::
+    Rules for merging INFO fields (scalars or vectors) or '-' to disable the
+    default rules.  'METHOD' is one of 'sum', 'avg', 'min', 'max', 'join'.
+
+*-l, --file-list* 'FILE'::
+    read file names from 'FILE'
+
+*-m, --merge* 'snps'|'indels'|'both'|'all'|'none'|'id'::
+    The option controls what types of multiallelic records can be created:
+----
+-m none   ..  no new multiallelics, output multiple records instead
+-m snps   ..  allow multiallelic SNP records
+-m indels ..  allow multiallelic indel records
+-m both   ..  both SNP and indel records can be multiallelic
+-m all    ..  SNP records can be merged with indel records
+-m id     ..  merge by ID
+----
+
+*-o, --output* 'FILE'::
+    see *<<common_options,Common Options>>*
+
+*-O, --output-type* 'b'|'u'|'z'|'v'::
+    see *<<common_options,Common Options>>*
+
+*-r, --regions* 'chr'|'chr:pos'|'chr:from-to'|'chr:from-'[,...]::
+    see *<<common_options,Common Options>>*
+
+*-R, --regions-file* 'file'::
+    see *<<common_options,Common Options>>*
+
+
+
+[[norm]]
+=== bcftools norm ['OPTIONS'] 'file.vcf.gz'
+Left-align and normalize indels,  check if REF alleles match the reference,
+split multiallelic sites into multiple rows; recover multiallelics from
+multiple rows.
+
+*-D, --remove-duplicates*::
+    remove duplicate lines of the same type
+
+*-f, --fasta-ref* 'FILE'::
+    reference sequence
+
+*-m, --multiallelics* <-|+>['snps'|'indels'|'both'|'any']::
+    split multiallelic sites into biallelic records ('-') or join
+    biallelic sites into multiallelic records ('+'). An optional type string
+    can follow which controls variant types which should be split or merged
+    together: If only SNP records should be split or merged, specify 'snps'; if
+    both SNPs and indels should be merged separately into two records, specify
+    'both'; if SNPs and indels should be merged into a single record, specify
+    'any'.
+
+*-o, --output* 'FILE'::
+    see *<<common_options,Common Options>>*
+
+*-O, --output-type* 'b'|'u'|'z'|'v'::
+    see *<<common_options,Common Options>>*
+
+*-r, --regions* 'chr'|'chr:pos'|'chr:from-to'|'chr:from-'[,...]::
+    see *<<common_options,Common Options>>*
+
+*-R, --regions-file* 'file'::
+    see *<<common_options,Common Options>>*
+
+*-s, --strict-filter*::
+    when merging ('-m+'), merged site is PASS only if all sites being merged PASS
+
+*-t, --targets* 'LIST'::
+    see *<<common_options,Common Options>>*
+
+*-T, --targets-file* 'FILE'::
+    see *<<common_options,Common Options>>*
+
+*-w, --site-win* 'INT'::
+    maximum distance between two records to consider when locally
+    sorting variants which changed position during the realignment
+
+
+[[plugin]]
+=== bcftools plugin 'NAME' '[OPTIONS]' 'FILE' -- '[PLUGIN OPTIONS]'
+
+==== VCF input options:
+
+*-e, --exclude* 'EXPRESSION'::
+    exclude sites for which 'EXPRESSION' is true. For valid expressions see
+    *<<expressions,EXPRESSIONS>>*.
+
+*-i, --include* 'EXPRESSION'::
+    include only sites for which 'EXPRESSION' is true. For valid expressions see
+    *<<expressions,EXPRESSIONS>>*.
+
+*-r, --regions* 'chr'|'chr:pos'|'chr:from-to'|'chr:from-'[,...]::
+    see *<<common_options,Common Options>>*
+
+*-R, --regions-file* 'file'::
+    see *<<common_options,Common Options>>*
+
+*-t, --targets* 'chr'|'chr:pos'|'chr:from-to'|'chr:from-'[,...]::
+    see *<<common_options,Common Options>>*
+
+*-T, --targets-file* 'file'::
+    see *<<common_options,Common Options>>*
+
+==== VCF output options:
+
+*-o, --output* 'FILE'::
+    see *<<common_options,Common Options>>*
+
+*-O, --output-type* 'b'|'u'|'z'|'v'::
+    see *<<common_options,Common Options>>*
+
+==== Plugin options:
+
+*-h, --help*::
+    list plugin's options
+
+*-l, --list-plugins*::
+    List all available plugins. If not installed systemwide, set the environment
+    variable LD_LIBRARY_PATH (linux) or DYLD_LIBRARY_PATH (Mac OS X) to include
+    directory where *libhts.so* is located.  The BCFTOOLS_PLUGINS
+    environment variable tells the program which directories to search.
+
+*-v, --verbose*::
+    print debugging information to debug plugin failure
+
+==== List of plugins coming with the distribution:
+
+*counts*::
+    a minimal plugin which counts number of SNPs, Indels, and total number of sites.
+
+*dosage*:: 
+    print genotype dosage. By default the plugin searches for PL, GL and GT, in
+    that order.
+
+*fill-AN-AC*::
+    fill INFO fields AN and AC.
+
+*fix-ploidy*::
+    sets correct ploidy
+
+*frameshifts*::
+    annotate frameshift indels
+
+*missing2ref*::
+    sets missing genotypes ("./.") to ref allele ("0/0" or "0|0")
+
+*tag2tag*::
+    Convert between similar tags, such as GL and GP.
+
+*vcf2sex*::
+    determine sample sex by checking genotypes in haploid regions
+
+==== Examples:
+
+----
+# List options common to all plugins
+bcftools plugin
+
+# List available plugins
+bcftools plugin -l
+
+# One can run plugins in several ways
+bcftools plugin counts in.vcf
+bcftools +counts in.vcf
+cat in.vcf | bcftools +counts
+
+# Print usage information of plugin "dosage"
+bcftools +dosage -h
+
+# Replace missing genotypes with 0/0
+bcftools +missing2ref in.vcf 
+
+# Replace missing genotypes with 0|0
+bcftools +missing2ref in.vcf -- -p
+----
+
+==== Plugins troubleshooting:
+
+Things to check if your plugin does not show up in the *bcftools plugin -l* output:
+
+- Run with the *-v* option for verbose output: *bcftools plugin -lv*
+- Does the environment variable BCFTOOLS_PLUGINS include the correct path?
+- Are all shared libraries, namely libhts.so, accessible? Verify with
+* on Mac OS X: *otool -L your/plugin.so* and set DYLD_LIBRARY_PATH if they are not
+* on Linux: *ldd your/plugin.so* and set LD_LIBRARY_PATH if they are not
+- If not installed systemwide, set the environment variable LD_LIBRARY_PATH (linux) or
+DYLD_LIBRARY_PATH (mac) to include directory where *libhts.so* is located.
+
+
+==== Plugins API:
+
+----
+// Short description used by 'bcftools plugin -l'
+const char *about(void);
+
+// Longer description used by 'bcftools +name -h'
+const char *usage(void);
+
+// Called once at startup, allows to initialize local variables.
+// Return 1 to suppress normal VCF/BCF header output, -1 on critical
+// errors, 0 otherwise.
+int init(int argc, char **argv, bcf_hdr_t *in_hdr, bcf_hdr_t *out_hdr);
+
+// Called for each VCF record, return NULL to suppress the output
+bcf1_t *process(bcf1_t *rec);
+
+// Called after all lines have been processed to clean up
+void destroy(void);
+----
+
+
+[[query]]
+=== bcftools query ['OPTIONS'] 'file.vcf.gz' ['file.vcf.gz' [...]]
+Extracts fields from VCF or BCF files and outputs them in user-defined format.
+
+*-c, --collapse* 'snps'|'indels'|'both'|'all'|'some'|'none'::
+    see *<<common_options,Common Options>>*
+
+*-e, --exclude* 'EXPRESSION'::
+    exclude sites for which 'EXPRESSION' is true. For valid expressions see
+    *<<expressions,EXPRESSIONS>>*.
+
+*-f, --format* 'FORMAT'::
+    learn by example, see below
+
+*-H, --print-header*::
+    print header
+
+*-i, --include* 'EXPRESSION'::
+    include only sites for which 'EXPRESSION' is true. For valid expressions see
+    *<<expressions,EXPRESSIONS>>*.
+
+*-l, --list-samples*::
+    list sample names and exit
+
+*-o, --output* 'FILE'::
+    see *<<common_options,Common Options>>*
+
+*-r, --regions* 'chr'|'chr:pos'|'chr:from-to'|'chr:from-'[,...]::
+    see *<<common_options,Common Options>>*
+
+*-R, --regions-file* 'file'::
+    see *<<common_options,Common Options>>*
+
+*-s, --samples* 'LIST'::
+    see *<<common_options,Common Options>>*
+
+*-S, --samples-file* 'FILE'::
+    see *<<common_options,Common Options>>*
+
+*-t, --targets* 'chr'|'chr:pos'|'chr:from-to'|'chr:from-'[,...]::
+    see *<<common_options,Common Options>>*
+
+*-T, --targets-file* 'file'::
+    see *<<common_options,Common Options>>*
+
+*-v, --vcf-list* 'FILE'::
+    process multiple VCFs listed in the file
+
+==== Format:
+
+    %CHROM          The CHROM column (similarly also other columns: POS, ID, REF, ALT, QUAL, FILTER)
+    %INFO/TAG       Any tag in the INFO column
+    %TYPE           Variant type (REF, SNP, MNP, INDEL, OTHER)
+    %MASK           Indicates presence of the site in other files (with multiple files)
+    %TAG{INT}       Curly brackets to subscript vectors (0-based)
+    %FIRST_ALT      Alias for %ALT{0}
+    []              The brackets loop over all samples
+    %GT             Genotype (e.g. 0/1)
+    %TGT            Translated genotype (e.g. C/A)
+    %IUPACGT        Genotype translated to IUPAC ambiguity codes (e.g. M instead of C/A)
+    %LINE           Prints the whole line
+    %SAMPLE         Sample name
+
+==== Examples:
+
+    bcftools query -f '%CHROM  %POS  %REF  %ALT{0}\n' file.vcf.gz
+    bcftools query -f '%CHROM\t%POS\t%REF\t%ALT[\t%SAMPLE=%GT]\n' file.vcf.gz
+
+
+[[reheader]]
+=== bcftools reheader ['OPTIONS'] 'file.vcf.gz'
+Modify header of VCF/BCF files, change sample names.
+
+*-h, --header* 'FILE'::
+    new VCF header
+
+*-o, --output* 'FILE'::
+    see *<<common_options,Common Options>>*
+
+*-s, --samples* 'FILE'::
+    new sample names, one name per line, in the same order as they appear
+    in the VCF file. Alternatively, only samples which need to be renamed
+    can be listed as "old_name new_name\n" pairs separated by
+    whitespaces, each on separate line.
+
+
+
+[[roh]]
+=== bcftools roh ['OPTIONS'] 'file.vcf.gz'
+A program for detecting runs of homo/autozygosity. Only bi-allelic sites
+are considered.
+
+==== The HMM model:
+--------------------------------------
+Notation:
+  D  = Data, AZ = autozygosity, HW = Hardy-Weinberg (non-autozygosity),
+  f  = non-ref allele frequency
+
+Emission probabilities:
+  oAZ = P_i(D|AZ) = (1-f)*P(D|RR) + f*P(D|AA)
+  oHW = P_i(D|HW) = (1-f)^2 * P(D|RR) + f^2 * P(D|AA) + 2*f*(1-f)*P(D|RA)
+
+Transition probabilities:
+  tAZ = P(AZ|HW)  .. from HW to AZ, the -a parameter
+  tHW = P(HW|AZ)  .. from AZ to HW, the -H parameter
+  P(AZ|AZ) = 1 - P(HW|AZ) = 1 - tHW
+  P(HW|HW) = 1 - P(AZ|HW) = 1 - tAZ
+
+  ci  = P_i(C)  .. probability of cross-over at site i, from genetic map
+  AZi = P_i(AZ) .. probability of site i being AZ/non-AZ, scaled so that AZi+HWi = 1
+  HWi = P_i(HW) 
+
+  P_{i+1}(AZ) = oAZ * max[(1-tHW) * (1-ci) * AZ{i-1} , tAZ * ci * (1-AZ{i-1})]
+  P_{i+1}(HW) = oHW * max[(1-tAZ) * (1-ci) * (1-AZ{i-1}) , tHW * ci * AZ{i-1}]
+
+--------------------------------------
+
+==== General Options:
+
+*--AF-tag* 'TAG'::
+    use the specified INFO tag 'TAG' as an allele frequency estimate
+    instead of the defaul AC and AN tags. Sites which do not have 'TAG'
+    will be skipped.
+    
+*--AF-file* 'FILE'::
+    Read allele frequencies from a tab-delimited file containing
+    the columns: CHROM\tPOS\tREF,ALT\tAF. The file can be compressed with
+    *bgzip* and indexed with tabix -s1 -b2 -e2.  Sites which are not present in
+    the 'FILE' or have different reference or alternate allele will be skipped. 
+    Note that such a file can be easily created from a VCF using:
+----
+    bcftools query -f'%CHROM\t%POS\t%REF,%ALT\t%INFO/TAG\n' file.vcf | bgzip -c > freqs.tab.gz
+----
+
+*-e, --estimate-AF* 'FILE'::
+    recalculate INFO/AC and INFO/AN on the fly, using either all samples
+    ("-") or samples listed in 'FILE'. By default, allele frequency is
+    estimated from AC and AN counts which are already present in the INFO
+    field.
+
+*-G, --GTs-only* 'FLOAT'::
+    use genotypes (FORMAT/GT fields) ignoring genotype likelihoods (FORMAT/PL),
+    setting PL of unseen genotypes to 'FLOAT'. Safe value to use is 30 to
+    account for GT errors.
+
+*-I, --skip-indels*::
+    skip indels as their genotypes are usually enriched for errors
+
+*-m, --genetic-map* 'FILE'::
+    genetic map in the format required also by IMPUTE2. Only the first and
+    third column are used (position and Genetic_Map(cM)). The 'FILE' can
+    be a single file or a file mask, where string "{CHROM}" is replaced with
+    chromosome name.
+
+*-r, --regions* 'chr'|'chr:pos'|'chr:from-to'|'chr:from-'[,...]::
+    see *<<common_options,Common Options>>*
+
+*-R, --regions-file* 'file'::
+    see *<<common_options,Common Options>>*
+
+*-s, --sample* 'name'::
+    the name of sample to analyze
+
+*-t, --targets* 'chr'|'chr:pos'|'chr:from-to'|'chr:from-'[,...]::
+    see *<<common_options,Common Options>>*
+
+*-T, --targets-file* 'file'::
+    see *<<common_options,Common Options>>*
+
+==== HMM Options:
+
+*-a, --hw-to-az* 'FLOAT'::
+    P(AZ|HW) transition probability from AZ (autozygous) to HW (Hardy-Weinberg) state
+
+*-H, --az-to-hw* 'FLOAT'::
+    P(HW|AZ) transition probability from HW to AZ state
+
+*-V, --viterbi-training*::
+    perform Viterbi training to estimate transition probabilities
+
+
+
+[[stats]]
+=== bcftools stats ['OPTIONS'] 'A.vcf.gz' ['B.vcf.gz']
+Parses VCF or BCF and produces text file stats which is suitable for machine
+processing and can be plotted using *<<plot-vcfstats,plot-vcfstats>>*.  When two files are given,
+the program generates separate stats for intersection and the complements. By
+default only sites are compared, *-s*/*-S* must given to include also sample
+columns.
+
+*-1, --1st-allele-only*::
+    consider only 1st allele at multiallelic sites
+
+*-c, --collapse* 'snps'|'indels'|'both'|'all'|'some'|'none'::
+    see *<<common_options,Common Options>>*
+
+*-d, --depth* 'INT','INT','INT'::
+    ranges of depth distribution: min, max, and size of the bin
+
+*--debug*::
+    produce verbose per-site and per-sample output
+
+*-e, --exons* 'file.gz'::
+    tab-delimited file with exons for indel frameshifts statistics. The columns
+    of the file are CHR, FROM, TO, with 1-based, inclusive, positions. The file
+    is BGZF-compressed and indexed with tabix
+----
+    tabix -s1 -b2 -e3 file.gz
+----
+
+*-f, --apply-filters* 'LIST'::
+    see *<<common_options,Common Options>>*
+
+*-F, --fasta-ref* 'ref.fa'::
+    faidx indexed reference sequence file to determine INDEL context
+
+*-i, --split-by-ID*::
+    collect stats separately for sites which have the ID column set ("known
+    sites") or which do not have the ID column set ("novel sites").
+
+*-r, --regions* 'chr'|'chr:pos'|'chr:from-to'|'chr:from-'[,...]::
+    see *<<common_options,Common Options>>*
+
+*-R, --regions-file* 'file'::
+    see *<<common_options,Common Options>>*
+
+*-s, --samples* 'LIST'::
+    see *<<common_options,Common Options>>*
+
+*-S, --samples-file* 'FILE'::
+    see *<<common_options,Common Options>>*
+
+*-t, --targets* 'chr'|'chr:pos'|'chr:from-to'|'chr:from-'[,...]::
+    see *<<common_options,Common Options>>*
+
+*-T, --targets-file* 'file'::
+    see *<<common_options,Common Options>>*
+
+
+
+
+[[view]]
+=== bcftools view ['OPTIONS'] 'file.vcf.gz' ['REGION' [...]]
+View, subset and filter VCF or BCF files by position and filtering expression.
+Convert between VCF and BCF. Former *bcftools subset*.
+
+==== Output options
+
+*-G, --drop-genotypes*::
+    drop individual genotype information (after subsetting if *-s* option is set)
+
+*-h, --header-only*::
+    output the VCF header only
+
+*-H, --no-header*::
+    suppress the header in VCF output
+
+*-l, --compression-level* ['0-9']::
+    compression level. 0 stands for uncompressed, 1 for best speed and 9 for
+    best compression.
+
+*-O, --output-type* 'b'|'u'|'z'|'v'::
+    see *<<common_options,Common Options>>*
+
+*-o, --output-file* 'FILE':
+    output file name. If not present, the default is to print to standard output (stdout).
+
+*-r, --regions* 'chr'|'chr:pos'|'chr:from-to'|'chr:from-'[,...]::
+    see *<<common_options,Common Options>>*
+
+*-R, --regions-file* 'file'::
+    see *<<common_options,Common Options>>*
+
+*-t, --targets* 'chr'|'chr:pos'|'chr:from-to'|'chr:from-'[,...]::
+    see *<<common_options,Common Options>>*
+
+*-T, --targets-file* 'file'::
+    see *<<common_options,Common Options>>*
+
+
+==== Subset options:
+*-a, --trim-alt-alleles*::
+    trim alternate alleles not seen in subset. Type A, G and R INFO and FORMAT fields will also be trimmed
+
+*-I, --no-update*::
+    do not (re)calculate INFO fields for the subset (currently INFO/AC and INFO/AN)
+
+*-s, --samples* 'LIST'::
+    see *<<common_options,Common Options>>*
+
+*-S, --samples-file* 'FILE'::
+    see *<<common_options,Common Options>>*
+
+
+==== Filter options:
+*-c, --min-ac* 'INT'[':nref'|':alt1'|':minor'|':major'|:'nonmajor']::
+    minimum allele count (INFO/AC) of sites to be printed.
+    Specifying the type of allele is optional and can be set to 
+    non-reference ('nref', the default), 1st alternate  ('alt1'), the least 
+    frequent ('minor'), the most frequent ('major') or sum of all but the 
+    most frequent ('nonmajor') alleles.
+
+*-C, --max-ac* 'INT'[':nref'|':alt1'|':minor'|:'major'|:'nonmajor']::
+    maximum allele count (INFO/AC) of sites to be printed.
+    Specifying the type of allele is optional and can be set to 
+    non-reference ('nref', the default), 1st alternate  ('alt1'), the least 
+    frequent ('minor'), the most frequent ('major') or sum of all but the 
+    most frequent ('nonmajor') alleles.
+
+*-e, --exclude* 'EXPRESSION'::
+    exclude sites for which 'EXPRESSION' is true. For valid expressions see
+    *<<expressions,EXPRESSIONS>>*.
+
+*-f, --apply-filters* 'LIST'::
+    see *<<common_options,Common Options>>*
+
+*-g, --genotype* [^]['hom'|'het'|'miss']::
+    include only sites with one or more homozygous ('hom'), heterozygous
+    ('het') or missing ('miss') genotypes. When prefixed with '^', the logic
+    is reversed; thus '^het' excludes sites with heterozygous genotypes.
+
+*-i, --include* 'EXPRESSION'::
+    include sites for which 'EXPRESSION' is true. For valid expressions see
+    *<<expressions,EXPRESSIONS>>*.
+
+*-k, --known*::
+    print known sites only (ID column is not ".")
+
+*-m, --min-alleles* 'INT'::
+    print sites with at least 'INT' alleles listed in REF and ALT columns
+
+*-M, --max-alleles* 'INT'::
+    print sites with at most 'INT' alleles listed in REF and ALT columns. Use *-m2 -M2 -v snps* to only view biallelic SNPs.
+
+*-n, --novel*::
+    print novel sites only (ID column is ".")
+
+*-p, --phased*::
+    print sites where all samples are phased. Haploid genotypes are
+    considered phased. Missing genotypes considered unphased unless the
+    phased bit is set.
+
+*-P, --exclude-phased*::
+    exclude sites where all samples are phased
+
+*-q, --min-af* 'FLOAT'[':nref'|':alt1'|':minor'|:'major'|:'nonmajor']::
+    minimum allele frequency (INFO/AC / INFO/AN) of sites to be printed.
+    Specifying the type of allele is optional and can be set to 
+    non-reference ('nref', the default), 1st alternate  ('alt1'), the least 
+    frequent ('minor'), the most frequent ('major') or sum of all but the 
+    most frequent ('nonmajor') alleles.
+
+*-Q, --max-af* 'FLOAT'[':nref'|':alt1'|':minor'|:'major'|:'nonmajor']::
+    maximum allele frequency (INFO/AC / INFO/AN) of sites to be printed.
+    Specifying the type of allele is optional and can be set to 
+    non-reference ('nref', the default), 1st alternate  ('alt1'), the least 
+    frequent ('minor'), the most frequent ('major') or sum of all but the 
+    most frequent ('nonmajor') alleles.
+
+*-u, --uncalled*::
+    print sites without a called genotype
+
+*-U, --exclude-uncalled*::
+    exclude sites without a called genotype
+
+*-v, --types* 'snps'|'indels'|'mnps'|'other'::
+    comma-separated list of variant types to select
+
+*-V, --exclude-types* 'snps'|'indels'|'mnps'|'other'::
+    comma-separated list of variant types to exclude
+
+*-x, --private*::
+    print sites where only the subset samples carry an non-reference allele
+
+*-X, --exclude-private*::
+    exclude sites where only the subset samples carry an non-reference allele
+
+
+[[expressions]]
+EXPRESSIONS
+-----------
+
+These filtering expressions are accepted by *<<annotate,annotate>>*,
+*<<filter,filter>>*, *<<query,query>>* and *<<view,view>>* commands.
+
+.Valid expressions may contain:
+
+* numerical constants, string constants, file names
+
+        1, 1.0, 1e-4
+        "String"
+        @file_name
+
+
+* arithmetic operators
+
+        +,*,-,/
+
+* comparison operators
+
+        == (same as =), >, >=, <=, <, !=
+
+* regex operators "\~" and its negation "!~"
+
+        INFO/HAYSTACK ~ "needle"
+
+* parentheses
+
+        (, )
+
+* logical operators
+
+        && (same as &), ||,  |
+
+* INFO tags, FORMAT tags, column names
+
+        INFO/DP or DP
+        FORMAT/DV, FMT/DV, or DV
+        FILTER, QUAL, ID, REF, ALT[0]
+
+* 1 (or 0) to test the presence (or absence) of a flag
+
+        FlagA=1 && FlagB=0
+
+* TYPE for variant type in REF,ALT columns (indel,snp,mnp,ref,other)
+
+        TYPE="indel" | TYPE="snp"
+
+* array subscripts, "*" for any field
+
+        (DP4[0]+DP4[1])/(DP4[2]+DP4[3]) > 0.3
+        DP4[*] == 0
+        CSQ[*] ~ "missense_variant.*deleterious"
+
+* function on FORMAT tags (over samples) and INFO tags (over vector fields)
+
+        MAX, MIN, AVG, SUM, STRLEN, ABS
+
+* variables calculated on the fly if not present: number of alternate alleles;
+number of samples; count of alternate alleles; minor allele count (similar to
+AC but is always smaller than 0.5); frequency of alternate alleles (AF=AC/AN);
+frequency of minor alleles (MAF=MAC/AN); number of alleles in called genotypes
+
+        N_ALT, N_SAMPLES, AC, MAC, AF, MAF, AN
+
+
+.Notes:
+
+* String comparisons and regular expressions are case-insensitive
+* If the subscript "\*" is used in regular expression search, the
+whole field is treated as one string. For example, the regex STR[*]~"B,C" will be
+true for the string vector INFO/STR=AB,CD.
+* Variables and function names are case-insensitive, but not tag names. For example,
+"qual" can be used instead of "QUAL", "strlen()" instead of "STRLEN()" , but
+not "dp" instead of "DP".
+
+
+*Examples:*
+
+--
+    MIN(DV)>5
+
+    MIN(DV/DP)>0.3
+
+    MIN(DP)>10 & MIN(DV)>3
+
+    QUAL>10 |  FMT/GQ>10   .. selects only GQ>10 samples
+
+    QUAL>10 || FMT/GQ>10   .. selects all samples at QUAL>10 sites
+
+    TYPE="snp" && QUAL>=10 && (DP4[2]+DP4[3] > 2)
+
+    MIN(DP)>35 && AVG(GQ)>50
+
+    ID=@file       .. selects lines with ID present in the file
+
+    ID!=@~/file    .. skip lines with ID present in the ~/file
+
+    MAF[0]<0.05    .. select rare variants at 5% cutoff
+
+--
+
+*Shell expansion:*
+
+Note that expressions must often be quoted because some characters
+have special meaning in the shell.
+An example of expression enclosed in single quotes which cause
+that the whole expression is passed to the program as intended:
+
+--
+    bcftools view -i '%ID!="." & MAF[0]<0.01'
+--
+
+Please refer to the documentation of your shell for details.
+
+
+SCRIPTS AND OPTIONS
+-------------------
+
+[[plot-vcfstats]]
+=== plot-vcfstats ['OPTIONS'] 'file.vchk' [...]
+Script for processing output of *<<stats,bcftools stats>>*. It can merge
+results from multiple outputs (useful when running the stats for each
+chromosome separately), plots graphs and creates a PDF presentation.
+
+*-m, --merge*::
+    Merge vcfstats files to STDOUT, skip plotting.
+
+*-p, --prefix* 'PATH'::
+    The output files prefix, add a slash to create new directory.
+
+*-P, --no-PDF*::
+    Skip the PDF creation step.
+
+*-r, --rasterize*::
+    Rasterize PDF images for faster rendering.
+
+*-s, --sample-names*::
+    Use sample names for xticks rather than numeric IDs.
+
+*-t, --title* 'STRING'::
+    Identify files by these titles in plots. The option can be given multiple
+    times, for each ID in the *<<stats,bcftools stats>>* output. If not
+    present, the script will use abbreviated source file names for the titles.
+
+*-T, --main-title* 'STRING'::
+    Main title for the PDF.
+
+
+PERFORMANCE
+-----------
+HTSlib was designed with BCF format in mind. When parsing VCF files, all records
+are internally converted into BCF representation. Simple operations, like removing
+a single column from a VCF file, can be therefore done much faster with standard
+UNIX commands, such as *awk* or *cut*.
+Therefore it is recommended to use BCF as input/output format whenever possible to avoid
+large overhead of the VCF -> BCF -> VCF conversion.
+
+
+BUGS
+----
+Please report any bugs you encounter on the github website: <http://github.com/samtools/bcftools>
+
+
+AUTHORS
+-------
+Heng Li from the Sanger Institute wrote the original C version of htslib,
+samtools and bcftools. Bob Handsaker from the Broad Institute implemented the
+BGZF library. Petr Danecek, Shane McCarthy and John Marshall are  maintaining
+and further developing bcftools.  Many other people contributed to the program
+and to the file format specifications, both directly and indirectly by
+providing patches, testing and reporting bugs. We thank them all.
+
+
+RESOURCES
+---------
+BCFtools GitHub website: <http://github.com/samtools/bcftools>
+
+Samtools GitHub website: <http://github.com/samtools/samtools>
+
+HTSlib GitHub website: <http://github.com/samtools/htslib>
+
+File format specifications: <http://samtools.github.io/hts-specs>
+
+BCFtools documentation: <http://samtools.github.io/bcftools>
+
+BCFtools wiki page: <https://github.com/samtools/bcftools/wiki>
+
+
+COPYING
+-------
+The MIT/Expat License or GPL License, see the LICENSE document for details.
+Copyright (c) Genome Research Ltd.
+
diff --git a/doc/docbook-xsl.css b/doc/docbook-xsl.css
new file mode 100644
index 0000000..0b83c64
--- /dev/null
+++ b/doc/docbook-xsl.css
@@ -0,0 +1,355 @@
+/*
+  CSS stylesheet for XHTML produced by DocBook XSL stylesheets.
+*/
+
+body {
+  /* font-family: Georgia,serif; */
+}
+
+code, pre {
+  /* font-family: "Courier New", Courier, monospace; */
+}
+
+span.strong {
+  font-weight: bold;
+}
+
+body blockquote {
+  margin-top: .75em;
+  line-height: 1.5;
+  margin-bottom: .75em;
+}
+
+html body {
+  margin: 1em 5% 1em 10%;
+  /*x line-height: 1.2; */
+}
+
+body div {
+  margin: 0;
+}
+
+h1, h2, h3, h4, h5, h6
+{
+  /*x color: #527bbd; */
+  color: #FF8800;
+  /* font-family: Arial,Helvetica,sans-serif; */
+}
+
+a { color: #dd7700; }
+
+h1 { font-size: 130%; padding-top: 1em; }
+h2 { font-size: 120%; padding-top: 1em; }
+h3 { font-size: 110%; }
+
+dl.variablelist { padding-left: 2em; }
+div.refsect3 > .variablelist { padding-left: 2em; }
+
+div.toc p:first-child,
+div.list-of-figures p:first-child,
+div.list-of-tables p:first-child,
+div.list-of-examples p:first-child,
+div.example p.title,
+div.sidebar p.title
+{
+  font-weight: bold;
+  color: #527bbd;
+  /* font-family: Arial,Helvetica,sans-serif; */
+  margin-bottom: 0.2em;
+}
+
+body h1 {
+  margin: .0em 0 0 -3%;
+  line-height: 1.3;
+  border-bottom: 2px solid silver;
+}
+
+body h2 {
+  margin: 0.5em 0 0 -3%;
+  line-height: 1.3;
+  border-bottom: 1px solid #FF8800;
+}
+
+body h3 {
+  margin: 2em 0 0em -3%;
+  line-height: 1.3;
+  display: inline-block;
+  padding: 0.2em; 
+  /* 
+  background-color: #eee; 
+  border-bottom: 1px solid #FF8800;
+  border-top: 1px solid #FF8800;
+  */
+}
+
+/* div.refsect3 { margin-left: 4em; } */
+pre.screen { margin-left: 5em; }
+
+body h4 {
+  margin: .8em 0 0 0;
+  line-height: 1.3;
+  color: black;
+}
+
+body h5 {
+  margin: .8em 0 0 0;
+  line-height: 1.3;
+}
+
+body h6 {
+  margin: .8em 0 0 0;
+  line-height: 1.3;
+}
+
+body hr {
+  border: none; /* Broken on IE6 */
+}
+div.footnotes hr {
+  border: 1px solid silver;
+}
+
+div.navheader th, div.navheader td, div.navfooter td {
+  /* font-family: Arial,Helvetica,sans-serif; */
+  font-size: 0.9em;
+  font-weight: bold;
+  color: #527bbd;
+}
+div.navheader img, div.navfooter img {
+  border-style: none;
+}
+div.navheader a, div.navfooter a {
+  font-weight: normal;
+}
+div.navfooter hr {
+  border: 1px solid silver;
+}
+
+body td {
+  line-height: 1.2
+}
+
+body th {
+  line-height: 1.2;
+}
+
+ol {
+  line-height: 1.2;
+}
+
+ul, body dir, body menu {
+  line-height: 1.2;
+}
+
+html {
+  margin: 0; 
+  padding: 0;
+}
+
+/* body h1, body h2, body h3, body h4, body h5, body h6 
+{
+  margin-left: 0em;
+}
+*/
+
+body pre {
+  margin: 0.5em 10% 0.5em 1em;
+  line-height: 1.0;
+  /*x color: navy; */
+  /* color: #004499;*/
+}
+
+tt.literal, code.literal {
+  /* color: navy; */
+  /* color: #004499; */
+}
+
+.programlisting, .screen {
+  border: 1px solid silver;
+  background: #f4f4f4;
+  margin: 0.5em 10% 0.5em 0;
+  padding: 0.5em 1em;
+}
+
+div.sidebar {
+  background: #ffffee;
+  margin: 1.0em 10% 0.5em 0;
+  padding: 0.5em 1em;
+  border: 1px solid silver;
+}
+div.sidebar * { padding: 0; }
+div.sidebar div { margin: 0; }
+div.sidebar p.title {
+  margin-top: 0.5em;
+  margin-bottom: 0.2em;
+}
+
+div.bibliomixed {
+  margin: 0.5em 5% 0.5em 1em;
+}
+
+div.glossary dt {
+  font-weight: bold;
+}
+div.glossary dd p {
+  margin-top: 0.2em;
+}
+
+dl {
+  margin: .8em 0;
+  line-height: 1.2;
+}
+
+dt {
+  margin-top: 0.5em;
+}
+
+dt span.term {
+  font-style: normal;
+  /*x color: navy; */
+  /* color: #004499; */
+}
+
+div.variablelist dd p {
+  margin-top: 0;
+}
+
+div.itemizedlist li, div.orderedlist li {
+  margin-left: -0.8em;
+  margin-top: 0.5em;
+}
+
+ul, ol {
+    list-style-position: outside;
+}
+
+div.sidebar ul, div.sidebar ol {
+    margin-left: 2.8em;
+}
+
+div.itemizedlist p.title,
+div.orderedlist p.title,
+div.variablelist p.title
+{
+  margin-bottom: -0.8em;
+}
+
+div.revhistory table {
+  border-collapse: collapse;
+  border: none;
+}
+div.revhistory th {
+  border: none;
+  color: #527bbd;
+  /* font-family: Arial,Helvetica,sans-serif; */
+}
+div.revhistory td {
+  border: 1px solid silver;
+}
+
+/* Keep TOC and index lines close together. */
+div.toc dl, div.toc dt,
+div.list-of-figures dl, div.list-of-figures dt,
+div.list-of-tables dl, div.list-of-tables dt,
+div.indexdiv dl, div.indexdiv dt
+{
+  line-height: normal;
+  margin-top: 0;
+  margin-bottom: 0;
+}
+
+/*
+  Table styling does not work because of overriding attributes in
+  generated HTML.
+*/
+div.table table,
+div.informaltable table
+{
+    margin-left: 0;
+    margin-right: 5%;
+    margin-bottom: 0.8em;
+}
+div.informaltable table
+{
+    margin-top: 0.4em
+}
+div.table thead,
+div.table tfoot,
+div.table tbody,
+div.informaltable thead,
+div.informaltable tfoot,
+div.informaltable tbody
+{
+    /* No effect in IE6. */
+    border-top: 3px solid #527bbd;
+    border-bottom: 3px solid #527bbd;
+}
+div.table thead, div.table tfoot,
+div.informaltable thead, div.informaltable tfoot
+{
+    font-weight: bold;
+}
+
+div.mediaobject img {
+    margin-bottom: 0.8em;
+}
+div.figure p.title,
+div.table p.title
+{
+  margin-top: 1em;
+  margin-bottom: 0.4em;
+}
+
+div.calloutlist p
+{
+  margin-top: 0em;
+  margin-bottom: 0.4em;
+}
+
+a img {
+  border-style: none;
+}
+
+ at media print {
+  div.navheader, div.navfooter { display: none; }
+}
+
+span.aqua { color: aqua; }
+span.black { color: black; }
+span.blue { color: blue; }
+span.fuchsia { color: fuchsia; }
+span.gray { color: gray; }
+span.green { color: green; }
+span.lime { color: lime; }
+span.maroon { color: maroon; }
+span.navy { color: navy; }
+span.olive { color: olive; }
+span.purple { color: purple; }
+span.red { color: red; }
+span.silver { color: silver; }
+span.teal { color: teal; }
+span.white { color: white; }
+span.yellow { color: yellow; }
+
+span.aqua-background { background: aqua; }
+span.black-background { background: black; }
+span.blue-background { background: blue; }
+span.fuchsia-background { background: fuchsia; }
+span.gray-background { background: gray; }
+span.green-background { background: green; }
+span.lime-background { background: lime; }
+span.maroon-background { background: maroon; }
+span.navy-background { background: navy; }
+span.olive-background { background: olive; }
+span.purple-background { background: purple; }
+span.red-background { background: red; }
+span.silver-background { background: silver; }
+span.teal-background { background: teal; }
+span.white-background { background: white; }
+span.yellow-background { background: yellow; }
+
+span.big { font-size: 2em; }
+span.small { font-size: 0.6em; }
+
+span.underline { text-decoration: underline; }
+span.overline { text-decoration: overline; }
+span.line-through { text-decoration: line-through; }
diff --git a/em.c b/em.c
new file mode 100644
index 0000000..a976f22
--- /dev/null
+++ b/em.c
@@ -0,0 +1,259 @@
+/*  em.c -- mathematical functions.
+
+    Copyright (C) 2010, 2011 Broad Institute.
+    Portions copyright (C) 2013 Genome Research Ltd.
+
+    Author: Heng Li <lh3 at live.co.uk>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.  */
+
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <htslib/vcf.h>
+#include "kmin.h"
+#include "call.h"
+
+#define ITER_MAX 50
+#define ITER_TRY 10
+#define EPS 1e-5
+
+extern double kf_gammaq(double, double);
+
+/*
+    Generic routines
+ */
+
+// estimate site allele frequency in a very naive and inaccurate way
+static double est_freq(int n, const double *pdg)
+{
+    int i, gcnt[3], tmp1;
+    // get a rough estimate of the genotype frequency
+    gcnt[0] = gcnt[1] = gcnt[2] = 0;
+    for (i = 0; i < n; ++i) {
+        const double *p = pdg + i * 3;
+        if (p[0] != 1. || p[1] != 1. || p[2] != 1.) {
+            int which = p[0] > p[1]? 0 : 1;
+            which = p[which] > p[2]? which : 2;
+            ++gcnt[which];
+        }
+    }
+    tmp1 = gcnt[0] + gcnt[1] + gcnt[2];
+    return (tmp1 == 0)? -1.0 : (.5 * gcnt[1] + gcnt[2]) / tmp1;
+}
+
+/*
+    Single-locus EM
+ */
+
+typedef struct {
+    int beg, end;
+    const double *pdg;
+} minaux1_t;
+
+static double prob1(double f, void *data)
+{
+    minaux1_t *a = (minaux1_t*)data;
+    double p = 1., l = 0., f3[3];
+    int i;
+//  printf("brent %lg\n", f);
+    if (f < 0 || f > 1) return 1e300;
+    f3[0] = (1.-f)*(1.-f); f3[1] = 2.*f*(1.-f); f3[2] = f*f;
+    for (i = a->beg; i < a->end; ++i) {
+        const double *pdg = a->pdg + i * 3;
+        p *= pdg[0] * f3[0] + pdg[1] * f3[1] + pdg[2] * f3[2];
+        if (p < 1e-200) l -= log(p), p = 1.;
+    }
+    return l - log(p);
+}
+
+// one EM iteration for allele frequency estimate
+static double freq_iter(double *f, const double *_pdg, int beg, int end)
+{
+    double f0 = *f, f3[3], err;
+    int i;
+//  printf("em %lg\n", *f);
+    f3[0] = (1.-f0)*(1.-f0); f3[1] = 2.*f0*(1.-f0); f3[2] = f0*f0;
+    for (i = beg, f0 = 0.; i < end; ++i) {
+        const double *pdg = _pdg + i * 3;
+        f0 += (pdg[1] * f3[1] + 2. * pdg[2] * f3[2])
+            / (pdg[0] * f3[0] + pdg[1] * f3[1] + pdg[2] * f3[2]);
+    }
+    f0 /= (end - beg) * 2;
+    err = fabs(f0 - *f);
+    *f = f0;
+    return err;
+}
+
+/* The following function combines EM and Brent's method. When the signal from
+ * the data is strong, EM is faster but sometimes, EM may converge very slowly.
+ * When this happens, we switch to Brent's method. The idea is learned from
+ * Rasmus Nielsen.
+ */
+static double freqml(double f0, int beg, int end, const double *pdg)
+{
+    int i;
+    double f;
+    for (i = 0, f = f0; i < ITER_TRY; ++i)
+        if (freq_iter(&f, pdg, beg, end) < EPS) break;
+    if (i == ITER_TRY) { // haven't converged yet; try Brent's method
+        minaux1_t a;
+        a.beg = beg; a.end = end; a.pdg = pdg;
+        kmin_brent(prob1, f0 == f? .5*f0 : f0, f, (void*)&a, EPS, &f);
+    }
+    return f;
+}
+
+// one EM iteration for genotype frequency estimate
+static double g3_iter(double g[3], const double *_pdg, int beg, int end)
+{
+    double err, gg[3];
+    int i;
+    gg[0] = gg[1] = gg[2] = 0.;
+//  printf("%lg,%lg,%lg\n", g[0], g[1], g[2]);
+    for (i = beg; i < end; ++i) {
+        double sum, tmp[3];
+        const double *pdg = _pdg + i * 3;
+        tmp[0] = pdg[0] * g[0]; tmp[1] = pdg[1] * g[1]; tmp[2] = pdg[2] * g[2];
+        sum = (tmp[0] + tmp[1] + tmp[2]) * (end - beg);
+        gg[0] += tmp[0] / sum; gg[1] += tmp[1] / sum; gg[2] += tmp[2] / sum;
+    }
+    err = fabs(gg[0] - g[0]) > fabs(gg[1] - g[1])? fabs(gg[0] - g[0]) : fabs(gg[1] - g[1]);
+    err = err > fabs(gg[2] - g[2])? err : fabs(gg[2] - g[2]);
+    g[0] = gg[0]; g[1] = gg[1]; g[2] = gg[2];
+    return err;
+}
+
+// perform likelihood ratio test
+static double lk_ratio_test(int n, int n1, const double *pdg, double f3[3][3])
+{
+    double r;
+    int i;
+    for (i = 0, r = 1.; i < n1; ++i) {
+        const double *p = pdg + i * 3;
+        r *= (p[0] * f3[1][0] + p[1] * f3[1][1] + p[2] * f3[1][2])
+            / (p[0] * f3[0][0] + p[1] * f3[0][1] + p[2] * f3[0][2]);
+    }
+    for (; i < n; ++i) {
+        const double *p = pdg + i * 3;
+        r *= (p[0] * f3[2][0] + p[1] * f3[2][1] + p[2] * f3[2][2])
+            / (p[0] * f3[0][0] + p[1] * f3[0][1] + p[2] * f3[0][2]);
+    }
+    return r;
+}
+
+// x[0]: ref frequency
+// x[1..3]: alt-alt, alt-ref, ref-ref frequenc
+// x[4]: HWE P-value
+// x[5..6]: group1 freq, group2 freq
+// x[7]: 1-degree P-value
+// x[8]: 2-degree P-value
+int bcf_em1(call_t *call, const bcf1_t *rec, int n1, int flag, double x[10])
+{
+    double *pdg;
+    int i, n; //, n2;
+    if (rec->n_allele < 2) return -1; // one allele only
+    // initialization
+    if (n1 < 0 || n1 > rec->n_sample) n1 = 0;
+    if (flag & 1<<7) flag |= 7<<5; // compute group freq if LRT is required
+    if (flag & 0xf<<1) flag |= 0xf<<1;
+    n = rec->n_sample; //n2 = n - n1;
+    pdg = call->pdg;
+    if (pdg == 0) return -1;
+    for (i = 0; i < 10; ++i) x[i] = -1.; // set to negative
+    {
+        if ((x[0] = est_freq(n, pdg)) < 0.) return -1; // no data
+        x[0] = freqml(x[0], 0, n, pdg);
+    }
+    if (flag & (0xf<<1|3<<8)) { // estimate the genotype frequency and test HWE
+        double *g = x + 1, f3[3], r;
+        f3[0] = g[0] = (1 - x[0]) * (1 - x[0]);
+        f3[1] = g[1] = 2 * x[0] * (1 - x[0]);
+        f3[2] = g[2] = x[0] * x[0];
+        for (i = 0; i < ITER_MAX; ++i)
+            if (g3_iter(g, pdg, 0, n) < EPS) break;
+        // Hardy-Weinberg equilibrium (HWE)
+        for (i = 0, r = 1.; i < n; ++i) {
+            double *p = pdg + i * 3;
+            r *= (p[0] * g[0] + p[1] * g[1] + p[2] * g[2]) / (p[0] * f3[0] + p[1] * f3[1] + p[2] * f3[2]);
+        }
+        x[4] = kf_gammaq(.5, log(r));
+    }
+    if ((flag & 7<<5) && n1 > 0 && n1 < n) { // group frequency
+        x[5] = freqml(x[0], 0, n1, pdg);
+        x[6] = freqml(x[0], n1, n, pdg);
+    }
+    if ((flag & 1<<7) && n1 > 0 && n1 < n) { // 1-degree P-value
+        double f[3], f3[3][3], tmp;
+        f[0] = x[0]; f[1] = x[5]; f[2] = x[6];
+        for (i = 0; i < 3; ++i)
+            f3[i][0] = (1-f[i])*(1-f[i]), f3[i][1] = 2*f[i]*(1-f[i]), f3[i][2] = f[i]*f[i];
+        tmp = log(lk_ratio_test(n, n1, pdg, f3));
+        if (tmp < 0) tmp = 0;
+        x[7] = kf_gammaq(.5, tmp);
+    }
+    if ((flag & 3<<8) && n1 > 0 && n1 < n) { // 2-degree P-value
+        double g[3][3], tmp;
+        for (i = 0; i < 3; ++i) memcpy(g[i], x + 1, 3 * sizeof(double));
+        for (i = 0; i < ITER_MAX; ++i)
+            if (g3_iter(g[1], pdg, 0, n1) < EPS) break;
+        for (i = 0; i < ITER_MAX; ++i)
+            if (g3_iter(g[2], pdg, n1, n) < EPS) break;
+        tmp = log(lk_ratio_test(n, n1, pdg, g));
+        if (tmp < 0) tmp = 0;
+        x[8] = kf_gammaq(1., tmp);
+    }
+    return 0;
+}
+
+/*
+    Two-locus EM (LD)
+ */
+
+#define _G1(h, k) ((h>>1&1) + (k>>1&1))
+#define _G2(h, k) ((h&1) + (k&1))
+
+#if 0
+// 0: the previous site; 1: the current site
+static int pair_freq_iter(int n, double *pdg[2], double f[4])
+{
+    double ff[4];
+    int i, k, h;
+//  printf("%lf,%lf,%lf,%lf\n", f[0], f[1], f[2], f[3]);
+    memset(ff, 0, 4 * sizeof(double));
+    for (i = 0; i < n; ++i) {
+        double *p[2], sum, tmp;
+        p[0] = pdg[0] + i * 3; p[1] = pdg[1] + i * 3;
+        for (k = 0, sum = 0.; k < 4; ++k)
+            for (h = 0; h < 4; ++h)
+                sum += f[k] * f[h] * p[0][_G1(k,h)] * p[1][_G2(k,h)];
+        for (k = 0; k < 4; ++k) {
+            tmp = f[0] * (p[0][_G1(0,k)] * p[1][_G2(0,k)] + p[0][_G1(k,0)] * p[1][_G2(k,0)])
+                + f[1] * (p[0][_G1(1,k)] * p[1][_G2(1,k)] + p[0][_G1(k,1)] * p[1][_G2(k,1)])
+                + f[2] * (p[0][_G1(2,k)] * p[1][_G2(2,k)] + p[0][_G1(k,2)] * p[1][_G2(k,2)])
+                + f[3] * (p[0][_G1(3,k)] * p[1][_G2(3,k)] + p[0][_G1(k,3)] * p[1][_G2(k,3)]);
+            ff[k] += f[k] * tmp / sum;
+        }
+    }
+    for (k = 0; k < 4; ++k) f[k] = ff[k] / (2 * n);
+    return 0;
+}
+#endif
+
+
diff --git a/filter.c b/filter.c
new file mode 100644
index 0000000..aca8835
--- /dev/null
+++ b/filter.c
@@ -0,0 +1,1677 @@
+/*  filter.c -- filter expressions.
+
+    Copyright (C) 2013-2014 Genome Research Ltd.
+
+    Author: Petr Danecek <pd3 at sanger.ac.uk>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.  */
+
+#include <ctype.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <math.h>
+#include <wordexp.h>
+#include <regex.h>
+#include <htslib/khash_str2int.h>
+#include "filter.h"
+#include "bcftools.h"
+#include <htslib/hts_defs.h>
+#include <htslib/vcfutils.h>
+
+typedef struct _token_t
+{
+    // read-only values, same for all VCF lines
+    int tok_type;       // one of the TOK_* keys below
+    char *key;          // set only for string constants, otherwise NULL
+    char *tag;          // for debugging and printout only, VCF tag name
+    float threshold;    // filtering threshold
+    int hdr_id;         // BCF header lookup ID
+    int idx;            // 0-based index to VCF vectors, -1: not a vector, -2: any field ([*])
+    void (*setter)(filter_t *, bcf1_t *, struct _token_t *);
+    int (*comparator)(struct _token_t *, struct _token_t *, int op_type, bcf1_t *);
+    void *hash;         // test presence of str value in the hash via comparator
+    regex_t *regex;     // precompiled regex for string comparison
+
+    // modified on filter evaluation at each VCF line
+    float *values;      // In case str_value is set, values[0] is one sample's string length
+    char *str_value;    //  and values[0]*nsamples gives the total length;
+    int is_str;
+    int pass_site;          // -1 not applicable, 0 fails, >0 pass
+    uint8_t *pass_samples;  // status of individual samples
+    int nsamples;           // number of samples
+    int nvalues, mvalues;   // number of used values, n=0 for missing values, n=1 for scalars
+                            // for strings, total length of str_value
+}
+token_t;
+
+struct _filter_t
+{
+    bcf_hdr_t *hdr;
+    char *str;
+    int nfilters;
+    token_t *filters, **flt_stack;  // filtering input tokens (in RPN) and evaluation stack
+    int32_t *tmpi;
+    int max_unpack, mtmpi, nsamples;
+};
+
+
+#define TOK_VAL     0
+#define TOK_LFT     1       // (
+#define TOK_RGT     2       // )
+#define TOK_LE      3       // less or equal
+#define TOK_LT      4       // less than
+#define TOK_EQ      5       // equal
+#define TOK_BT      6       // bigger than
+#define TOK_BE      7       // bigger or equal
+#define TOK_NE      8       // not equal
+#define TOK_OR      9       // |
+#define TOK_AND     10      // &
+#define TOK_ADD     11      // +
+#define TOK_SUB     12      // -
+#define TOK_MULT    13      // *
+#define TOK_DIV     14      // /
+#define TOK_MAX     15
+#define TOK_MIN     16
+#define TOK_AVG     17
+#define TOK_AND_VEC 18      // &&   (operator applied in samples)
+#define TOK_OR_VEC  19      // ||   (operator applied in samples)
+#define TOK_LIKE    20      //  ~ regular expression
+#define TOK_NLIKE   21      // !~ regular expression
+#define TOK_SUM     22
+#define TOK_ABS     23
+#define TOK_LEN     24
+#define TOK_FUNC    25
+
+//                      0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
+//                        ( ) [ < = > ] ! | &  +  -  *  /  M  m  a  A  O  ~  ^  S  .  l
+static int op_prec[] = {0,1,1,5,5,5,5,5,5,2,3, 6, 6, 7, 7, 8, 8, 8, 3, 2, 5, 5, 8, 8, 8};
+#define TOKEN_STRING "x()[<=>]!|&+-*/MmaAO~^f"
+
+static int filters_next_token(char **str, int *len)
+{
+    char *tmp = *str;
+    while ( *tmp && isspace(*tmp) ) tmp++;
+    *str = tmp;
+    *len = 0;
+
+    // test for doubles: d.ddde[+-]dd
+    if ( isdigit(*str[0]) || *str[0]=='.' )   // strtod would eat +/-
+    {
+        double HTS_UNUSED v = strtod(*str, &tmp);
+        if ( *str!=tmp && (!tmp[0] || !isalnum(tmp[0])) )
+        {
+            *len = tmp - (*str);
+            return TOK_VAL;
+        }
+        tmp = *str;
+    }
+
+    if ( !strncasecmp(tmp,"MAX(",4) ) { (*str) += 3; return TOK_MAX; }
+    if ( !strncasecmp(tmp,"MIN(",4) ) { (*str) += 3; return TOK_MIN; }
+    if ( !strncasecmp(tmp,"AVG(",4) ) { (*str) += 3; return TOK_AVG; }
+    if ( !strncasecmp(tmp,"SUM(",4) ) { (*str) += 3; return TOK_SUM; }
+    if ( !strncasecmp(tmp,"ABS(",4) ) { (*str) += 3; return TOK_ABS; }
+    if ( !strncasecmp(tmp,"STRLEN(",7) ) { (*str) += 6; return TOK_LEN; }
+    if ( !strncasecmp(tmp,"%MAX(",5) ) { (*str) += 4; return TOK_MAX; } // for backward compatibility
+    if ( !strncasecmp(tmp,"%MIN(",5) ) { (*str) += 4; return TOK_MIN; } // for backward compatibility
+    if ( !strncasecmp(tmp,"%AVG(",5) ) { (*str) += 4; return TOK_AVG; } // for backward compatibility
+    if ( !strncasecmp(tmp,"%SUM(",5) ) { (*str) += 4; return TOK_SUM; } // for backward compatibility
+    if ( !strncasecmp(tmp,"INFO/",5) ) tmp += 5;
+    if ( !strncasecmp(tmp,"FORMAT/",7) ) tmp += 7;
+    if ( !strncasecmp(tmp,"FMT/",4) ) tmp += 4;
+
+    if ( tmp[0]=='@' )  // file name
+    {
+        while ( *tmp && !isspace(*tmp) && *tmp!='=' && *tmp!='!' ) tmp++;
+        *len = tmp - (*str);
+        return TOK_VAL;
+    }
+
+    while ( tmp[0] )
+    {
+        if ( tmp[0]=='"' ) break;
+        if ( tmp[0]=='\'' ) break;
+        if ( isspace(tmp[0]) ) break;
+        if ( tmp[0]=='<' ) break;
+        if ( tmp[0]=='>' ) break;
+        if ( tmp[0]=='=' ) break;
+        if ( tmp[0]=='!' ) break;
+        if ( tmp[0]=='&' ) break;
+        if ( tmp[0]=='|' ) break;
+        if ( tmp[0]=='(' ) break;
+        if ( tmp[0]==')' ) break;
+        if ( tmp[0]=='+' ) break;
+        // hacky: so that [*] is not split, the tokenizer does not recognise square brackets []
+        if ( tmp[0]=='*' && (tmp==*str || tmp[-1]!='[') ) break;
+        if ( tmp[0]=='-' ) break;
+        if ( tmp[0]=='/' ) break;
+        if ( tmp[0]=='~' ) break;
+        tmp++;
+    }
+    if ( tmp > *str )
+    {
+        *len = tmp - (*str);
+        return TOK_VAL;
+    }
+    if ( tmp[0]=='"' || tmp[0]=='\'' )
+    {
+        int quote = tmp[0];
+        tmp++;
+        while ( *tmp && tmp[0]!=quote ) tmp++;
+        if ( !*tmp ) return -1;     // missing quotes
+        *len = tmp - (*str) + 1;
+        return TOK_VAL;
+    }
+    if ( tmp[0]=='!' )
+    {
+        if ( tmp[1]=='=' ) { (*str) += 2; return TOK_NE; }
+        if ( tmp[1]=='~' ) { (*str) += 2; return TOK_NLIKE; }
+    }
+    if ( tmp[0]=='<' )
+    {
+        if ( tmp[1]=='=' ) { (*str) += 2; return TOK_LE; }
+        (*str) += 1; return TOK_LT;
+    }
+    if ( tmp[0]=='>' )
+    {
+        if ( tmp[1]=='=' ) { (*str) += 2; return TOK_BE; }
+        (*str) += 1; return TOK_BT;
+    }
+    if ( tmp[0]=='=' )
+    {
+        if ( tmp[1]=='=' ) { (*str) += 2; return TOK_EQ; }
+        (*str) += 1; return TOK_EQ;
+    }
+    if ( tmp[0]=='(' ) { (*str) += 1; return TOK_LFT; }
+    if ( tmp[0]==')' ) { (*str) += 1; return TOK_RGT; }
+    if ( tmp[0]=='&' && tmp[1]=='&' ) { (*str) += 2; return TOK_AND_VEC; }
+    if ( tmp[0]=='|' && tmp[1]=='|' ) { (*str) += 2; return TOK_OR_VEC; }
+    if ( tmp[0]=='&' ) { (*str) += 1; return TOK_AND; }
+    if ( tmp[0]=='|' ) { (*str) += 1; return TOK_OR; }
+    if ( tmp[0]=='+' ) { (*str) += 1; return TOK_ADD; }
+    if ( tmp[0]=='-' ) { (*str) += 1; return TOK_SUB; }
+    if ( tmp[0]=='*' ) { (*str) += 1; return TOK_MULT; }
+    if ( tmp[0]=='/' ) { (*str) += 1; return TOK_DIV; }
+    if ( tmp[0]=='~' ) { (*str) += 1; return TOK_LIKE; }
+
+    *len = tmp - (*str);
+    return TOK_VAL;
+}
+
+static void filters_set_qual(filter_t *flt, bcf1_t *line, token_t *tok)
+{
+    float *ptr = &line->qual;
+    if ( bcf_float_is_missing(*ptr) )
+        tok->nvalues = 0;
+    else
+    {
+        tok->values[0] = line->qual;
+        tok->nvalues = 1;
+    }
+}
+static void filters_set_type(filter_t *flt, bcf1_t *line, token_t *tok)
+{
+    tok->values[0] = bcf_get_variant_types(line);
+    tok->nvalues = 1;
+}
+static void filters_set_info(filter_t *flt, bcf1_t *line, token_t *tok)
+{
+    assert( tok->hdr_id >=0  );
+    int i;
+    for (i=0; i<line->n_info; i++)
+        if ( line->d.info[i].key == tok->hdr_id ) break;
+
+    if ( i==line->n_info )
+        tok->nvalues = 0;
+    else if ( line->d.info[i].type==BCF_BT_CHAR )
+    {
+        int n = line->d.info[i].len;
+        int m = (int)tok->values[0];
+        hts_expand(char,n+1,m,tok->str_value);
+        memcpy(tok->str_value,line->d.info[i].vptr,n);
+        tok->str_value[n] = 0;
+        tok->values[0] = m;
+        tok->nvalues   = n;
+    }
+    else if ( line->d.info[i].type==BCF_BT_FLOAT )
+    {
+        tok->values[0] = line->d.info[i].v1.f;
+        tok->str_value = NULL;
+        tok->nvalues   = 1;
+    }
+    else
+    {
+        tok->values[0] = line->d.info[i].v1.i;
+        tok->str_value = NULL;
+        tok->nvalues   = 1;
+    }
+}
+static int filters_cmp_filter(token_t *atok, token_t *btok, int op_type, bcf1_t *line)
+{
+    int i;
+    if ( op_type==TOK_NE )  // AND logic: none of the filters can match
+    {
+        if ( !line->d.n_flt )
+        {
+            if ( atok->hdr_id==-1 ) return 0;   // missing value
+            return 1; // no filter present, eval to true
+        }
+        for (i=0; i<line->d.n_flt; i++)
+            if ( atok->hdr_id==line->d.flt[i] ) return 0;
+        return 1;
+    }
+    // TOK_EQ with OR logic: at least one of the filters must match
+    if ( !line->d.n_flt )
+    {
+        if ( atok->hdr_id==-1 ) return 1;
+        return 0; // no filter present, eval to false
+    }
+    for (i=0; i<line->d.n_flt; i++)
+        if ( atok->hdr_id==line->d.flt[i] ) return 1;
+    return 0;
+}
+static int filters_cmp_id(token_t *atok, token_t *btok, int op_type, bcf1_t *line)
+{
+    // multiple IDs not supported yet (easy to add though)
+
+    if ( btok->hash )
+    {
+        token_t *tmp = atok; atok = btok; btok = tmp;
+    }
+    if ( atok->hash )
+    {
+        int ret = khash_str2int_has_key(atok->hash, line->d.id);
+        if ( op_type==TOK_EQ ) return ret;
+        return ret ? 0 : 1;
+    }
+
+    if ( op_type==TOK_EQ ) return strcmp(btok->str_value,line->d.id) ? 0 : 1;
+    return strcmp(btok->str_value,line->d.id) ? 1 : 0;
+}
+
+/**
+ *  bcf_get_info_value() - get single INFO value, int or float
+ *  @line:      BCF line
+ *  @info_id:   tag ID, as returned by bcf_hdr_id2int
+ *  @ivec:      0-based index to retrieve, -1 when single value is expected
+ *  @vptr:      pointer to memory location of sufficient size to accomodate
+ *              info_id's type
+ *
+ *  The returned value is -1 if tag is not present, 0 if present but
+ *  values is missing or ivec is out of range, and 1 on success.
+ */
+static int bcf_get_info_value(bcf1_t *line, int info_id, int ivec, void *value)
+{
+    int j;
+    for (j=0; j<line->n_info; j++)
+        if ( line->d.info[j].key == info_id ) break;
+    if ( j==line->n_info ) return -1;
+
+    bcf_info_t *info = &line->d.info[j];
+    if ( info->len == 1 )
+    {
+        if ( info->type==BCF_BT_FLOAT ) *((float*)value) = info->v1.f;
+        else if ( info->type==BCF_BT_INT8 || info->type==BCF_BT_INT16 || info->type==BCF_BT_INT32 ) *((int*)value) = info->v1.i;
+        return 1;
+    }
+
+    if ( ivec<0 ) ivec = 0;
+
+    #define BRANCH(type_t, is_missing, is_vector_end, out_type_t) { \
+        type_t *p = (type_t *) info->vptr; \
+        for (j=0; j<ivec && j<info->len; j++) \
+        { \
+            if ( is_vector_end ) return 0; \
+        } \
+        if ( is_missing ) return 0; \
+        *((out_type_t*)value) = p[j]; \
+        return 1; \
+    }
+    switch (info->type) {
+        case BCF_BT_INT8:  BRANCH(int8_t,  p[j]==bcf_int8_missing,  p[j]==bcf_int8_vector_end,  int); break;
+        case BCF_BT_INT16: BRANCH(int16_t, p[j]==bcf_int16_missing, p[j]==bcf_int16_vector_end, int); break;
+        case BCF_BT_INT32: BRANCH(int32_t, p[j]==bcf_int32_missing, p[j]==bcf_int32_vector_end, int); break;
+        case BCF_BT_FLOAT: BRANCH(float,   bcf_float_is_missing(p[j]), bcf_float_is_vector_end(p[j]), float); break;
+        default: fprintf(stderr,"todo: type %d\n", info->type); exit(1); break;
+    }
+    #undef BRANCH
+    return -1;  // this shouldn't happen
+}
+
+static void filters_set_info_int(filter_t *flt, bcf1_t *line, token_t *tok)
+{
+    if ( tok->idx==-2 )
+    {
+        int i, n = bcf_get_info_int32(flt->hdr,line,tok->tag,&flt->tmpi,&flt->mtmpi);
+        tok->nvalues = n;
+        hts_expand(float,n,tok->mvalues,tok->values);
+        for (i=0; i<n; i++) tok->values[i] = flt->tmpi[i];
+    }
+    else
+    {
+        int32_t value;
+        if ( bcf_get_info_value(line,tok->hdr_id,tok->idx,&value) <= 0 )
+            tok->nvalues = 0;
+        else
+        {
+            tok->values[0] = value;
+            tok->nvalues = 1;
+        }
+    }
+}
+
+static void filters_set_info_float(filter_t *flt, bcf1_t *line, token_t *tok)
+{
+    if ( tok->idx==-2 )
+    {
+        tok->nvalues = bcf_get_info_float(flt->hdr,line,tok->tag,&tok->values,&tok->mvalues);
+        if ( tok->nvalues<0 ) tok->nvalues = 0;
+    }
+    else
+    {
+        float value;
+        if ( bcf_get_info_value(line,tok->hdr_id,tok->idx,&value) <= 0 )
+            tok->nvalues = 0;
+        else
+        {
+            tok->values[0] = value;
+            tok->nvalues = 1;
+        }
+    }
+}
+
+static void filters_set_info_string(filter_t *flt, bcf1_t *line, token_t *tok)
+{
+    int m = (int)tok->values[0];
+    int n = bcf_get_info_string(flt->hdr,line,tok->tag,&tok->str_value,&m);
+    if ( n<0 ) { tok->nvalues = 0; return; }
+    tok->values[0] = m;     // allocated length
+
+    if ( tok->idx>=0 )
+    {
+        // get ith field (i=tok->idx)
+        int i = 0;
+        char *ss = tok->str_value, *se = tok->str_value + n;
+        while ( ss<se && i<tok->idx )
+        {
+            if ( *ss==',' ) i++;
+            ss++;
+        }
+        if ( ss==se || i!=tok->idx ) { tok->nvalues = 0; return; }
+        se = ss;
+        while ( se-tok->str_value<n && *se!=',' ) se++;
+        if ( ss==tok->str_value ) *se = 0;
+        else
+        {
+            memmove(tok->str_value,ss,se-ss);
+            tok->str_value[se-ss] = 0;
+        }
+        tok->nvalues = se-ss;
+    }
+    else if ( tok->idx==-2 ) tok->nvalues = n;
+}
+
+static void filters_set_info_flag(filter_t *flt, bcf1_t *line, token_t *tok)
+{
+    int j;
+    for (j=0; j<line->n_info; j++)
+        if ( line->d.info[j].key == tok->hdr_id ) break;
+    tok->values[0] = j==line->n_info ? 0 : 1;
+    tok->nvalues = 1;
+}
+
+static void filters_set_format_int(filter_t *flt, bcf1_t *line, token_t *tok)
+{
+    int i;
+    if ( (tok->nvalues=bcf_get_format_int32(flt->hdr,line,tok->tag,&flt->tmpi,&flt->mtmpi))<0 )
+        tok->nvalues = 0;
+    else
+    {
+        int is_missing = 1;
+        hts_expand(float,tok->nvalues,tok->mvalues,tok->values);
+        for (i=0; i<tok->nvalues; i++)
+        {
+            if ( flt->tmpi[i]==bcf_int32_missing || flt->tmpi[i]==bcf_int32_vector_end )
+                bcf_float_set_missing(tok->values[i]);
+            else
+            {
+                tok->values[i] = flt->tmpi[i];
+                is_missing = 0;
+            }
+        }
+        if ( is_missing ) tok->nvalues = 0;
+        else if ( tok->idx >= 0 )
+        {
+            int nsmpl = bcf_hdr_nsamples(flt->hdr);
+            int nvals = tok->nvalues / nsmpl;
+            if ( tok->idx >= nvals )
+                tok->nvalues = 0;  // the index is too big
+            else
+            {
+                for (i=0; i<nsmpl; i++)
+                    tok->values[i] = tok->values[i*nvals+tok->idx];
+                tok->nvalues = nsmpl;
+            }
+        }
+    }
+    tok->nsamples = tok->nvalues;
+}
+static void filters_set_format_float(filter_t *flt, bcf1_t *line, token_t *tok)
+{
+    if ( (tok->nvalues=bcf_get_format_float(flt->hdr,line,tok->tag,&tok->values,&tok->mvalues))<=0 )
+        tok->nvalues = tok->nsamples = 0;   // missing values
+    else if ( tok->idx >= 0 )
+    {
+        int i, nsmpl, nvals;
+        nsmpl = bcf_hdr_nsamples(flt->hdr);
+        nvals = tok->nvalues / nsmpl;
+        if ( tok->idx >= nvals )
+            tok->nsamples = tok->nvalues = 0;  // the index is too big
+        else
+        {
+            for (i=0; i<nsmpl; i++)
+                tok->values[i] = tok->values[i*nvals+tok->idx];
+            tok->nsamples = tok->nvalues = nsmpl;
+        }
+    }
+}
+static void filters_set_format_string(filter_t *flt, bcf1_t *line, token_t *tok)
+{
+    int ndim = tok->nsamples * (int)tok->values[0];
+    int ret = bcf_get_format_char(flt->hdr,line,tok->tag,&tok->str_value,&ndim);
+
+    int nsmpl = bcf_hdr_nsamples(flt->hdr);
+    ndim /= nsmpl;
+    tok->values[0] = ndim;
+
+    if ( ret<=0 )
+    {
+        tok->nvalues = 0;
+        return;
+    }
+
+    if ( tok->idx < 0 ) // scalar
+    {
+        tok->nvalues = tok->nsamples = nsmpl;
+        return;
+    }
+
+    // vector
+    int i;
+    for (i=0; i<nsmpl; i++)
+    {
+        char *ss = tok->str_value + i*ndim;
+        int is = 0, ivec = 0;
+        while ( ivec<tok->idx && is<ndim && ss[is] )
+        {
+            if ( ss[is]==',' ) ivec++;
+            is++;
+        }
+        if ( ivec!=tok->idx || is==ndim || !ss[is] )
+        {
+            ss[0] = '.';
+            ss[1] = 0;
+            continue;
+        }
+        int ie = is;
+        while ( ie<ndim && ss[ie] && ss[ie]!=',' ) ie++;
+        if ( is ) memmove(ss,&ss[is],ie-is);
+        if ( ndim-(ie-is) ) memset(ss+ie-is,0,ndim-(ie-is));
+    }
+    if ( !ndim )
+    {
+        tok->nvalues = 0;
+        return;
+    }
+    tok->nvalues  = ret;
+    tok->nsamples = nsmpl;
+}
+static void filters_set_genotype_string(filter_t *flt, bcf1_t *line, token_t *tok)
+{
+    bcf_fmt_t *fmt = bcf_get_fmt(flt->hdr, line, "GT");
+    if ( !fmt )
+    {
+        tok->nvalues = tok->nsamples = 0;
+        return;
+    }
+    int i, blen = 3, nsmpl = bcf_hdr_nsamples(flt->hdr);
+    kstring_t str; str.s = tok->str_value; str.m = tok->values[0] * nsmpl; str.l = 0;
+    for (i=0; i<nsmpl; i++)
+    {
+        int plen = str.l;
+        bcf_format_gt(fmt, i, &str);
+        assert( str.l - plen <= blen ); // increase blen if this fails
+        plen = str.l - plen;
+        while ( plen<blen )
+        {
+            kputc_(0, &str);
+            plen++;
+        }
+    }
+    tok->nvalues = str.l;
+    tok->nsamples = nsmpl;
+    tok->values[0] = blen;
+    tok->str_value = str.s;
+}
+static void filters_set_ref_string(filter_t *flt, bcf1_t *line, token_t *tok)
+{
+    kstring_t str; str.s = tok->str_value; str.m = tok->values[0]; str.l = 0;
+    kputs(line->d.allele[0], &str);
+    tok->nvalues = str.l;
+    tok->values[0] = str.m;
+    tok->str_value = str.s;
+}
+static void filters_set_alt_string(filter_t *flt, bcf1_t *line, token_t *tok)
+{
+    kstring_t str; str.s = tok->str_value; str.m = tok->values[0]; str.l = 0;
+    if ( tok->idx>=0 )
+    {
+        if ( line->n_allele >= tok->idx )
+            kputs(line->d.allele[tok->idx], &str);
+        else
+            kputc('.', &str);
+    }
+    else
+    {
+        kputs(line->d.allele[1], &str);
+        int i;
+        for (i=2; i<line->n_allele; i++)
+        {
+            kputc(',', &str);
+            kputs(line->d.allele[i], &str);
+        }
+    }
+    tok->nvalues = str.l;
+    tok->values[0] = str.m;
+    tok->str_value = str.s;
+}
+static void filters_set_nalt(filter_t *flt, bcf1_t *line, token_t *tok)
+{
+    tok->nvalues = 1;
+    tok->values[0] = line->n_allele - 1;
+}
+static void filters_set_ac(filter_t *flt, bcf1_t *line, token_t *tok)
+{
+    hts_expand(int32_t, line->n_allele, flt->mtmpi, flt->tmpi);
+    if ( !bcf_calc_ac(flt->hdr, line, flt->tmpi, BCF_UN_INFO|BCF_UN_FMT) )
+    {
+        tok->nvalues = 0;
+        return;
+    }
+    int i, an = flt->tmpi[0];
+    for (i=1; i<line->n_allele; i++) an += flt->tmpi[i];
+    if ( !an )
+    {
+        tok->nvalues = 0;
+        return;
+    }
+    flt->tmpi[0] = an;  // for filters_set_[mac|af|maf]
+    if ( tok->idx>=0 )
+    {
+        tok->nvalues = 1;
+        tok->values[0] = flt->tmpi[tok->idx+1];
+    }
+    else
+    {
+        hts_expand(float,line->n_allele,tok->mvalues,tok->values);
+        for (i=1; i<line->n_allele; i++)
+            tok->values[i-1] = flt->tmpi[i];
+        tok->nvalues = line->n_allele - 1;
+    }
+}
+static void filters_set_an(filter_t *flt, bcf1_t *line, token_t *tok)
+{
+    filters_set_ac(flt,line,tok);
+    tok->values[0] = tok->nvalues ? flt->tmpi[0] : 0; 
+    tok->nvalues = 1;
+}
+static void filters_set_mac(filter_t *flt, bcf1_t *line, token_t *tok)
+{
+    filters_set_ac(flt,line,tok);
+    if ( !tok->nvalues ) return;
+    int i, an = flt->tmpi[0];
+    for (i=0; i<tok->nvalues; i++)
+        if ( tok->values[i] > an*0.5 ) tok->values[i] = an - tok->values[i];
+}
+static void filters_set_af(filter_t *flt, bcf1_t *line, token_t *tok)
+{
+    filters_set_ac(flt,line,tok);
+    if ( !tok->nvalues ) return;
+    int i, an = flt->tmpi[0];
+    for (i=0; i<tok->nvalues; i++)
+        tok->values[i] /= (float)an;
+}
+static void filters_set_maf(filter_t *flt, bcf1_t *line, token_t *tok)
+{
+    filters_set_ac(flt,line,tok);
+    if ( !tok->nvalues ) return;
+    int i, an = flt->tmpi[0];
+    for (i=0; i<tok->nvalues; i++)
+    {
+        tok->values[i] /= (float)an;
+        if ( tok->values[i] > 0.5 ) tok->values[i] = 1 - tok->values[i];
+    }
+}
+
+static void set_max(filter_t *flt, bcf1_t *line, token_t *tok)
+{
+    float val = -HUGE_VAL;
+    int i;
+    for (i=0; i<tok->nvalues; i++)
+    {
+        if ( !bcf_float_is_missing(tok->values[i]) && val < tok->values[i] ) val = tok->values[i];
+    }
+    tok->values[0] = val;
+    tok->nvalues   = 1;
+    tok->nsamples  = 0;
+}
+static void set_min(filter_t *flt, bcf1_t *line, token_t *tok)
+{
+    float val = HUGE_VAL;
+    int i;
+    for (i=0; i<tok->nvalues; i++)
+        if ( !bcf_float_is_missing(tok->values[i]) && val > tok->values[i] ) val = tok->values[i];
+    tok->values[0] = val;
+    tok->nvalues   = 1;
+    tok->nsamples  = 0;
+}
+static void set_avg(filter_t *flt, bcf1_t *line, token_t *tok)
+{
+    float val = 0;
+    int i, n = 0;
+    for (i=0; i<tok->nvalues; i++)
+        if ( !bcf_float_is_missing(tok->values[i]) ) { val += tok->values[i]; n++; }
+    tok->values[0] = n ? val / n : 0;
+    tok->nvalues   = 1;
+    tok->nsamples  = 0;
+}
+static void set_sum(filter_t *flt, bcf1_t *line, token_t *tok)
+{
+    float val = 0;
+    int i, n = 0;
+    for (i=0; i<tok->nvalues; i++)
+        if ( !bcf_float_is_missing(tok->values[i]) ) { val += tok->values[i]; n++; }
+    tok->values[0] = val;
+    tok->nvalues   = 1;
+    tok->nsamples  = 0;
+}
+static void set_abs(filter_t *flt, bcf1_t *line, token_t *tok)
+{
+    if ( tok->is_str ) error("ABS() can be applied only on numeric values\n");
+    int i;
+    for (i=0; i<tok->nvalues; i++)
+        tok->values[i] = fabs(tok->values[i]);
+}
+static void set_strlen(filter_t *flt, bcf1_t *line, token_t *tok)
+{
+    tok->is_str = 0;
+    if ( !tok->nvalues ) return;
+    if ( tok->idx==-2 )
+    {
+        int i = 0;
+        char *ss = tok->str_value;
+        while ( *ss )
+        {
+            char *se = ss;
+            while ( *se && *se!=',' ) se++;
+            if ( !*se ) tok->values[i] = strlen(ss);
+            else
+            {
+                *se = 0;
+                tok->values[i] = strlen(ss);
+                *se = ',';
+            }
+            ss = *se ? se + 1 : se;
+            i++;
+        }
+        tok->nvalues = i;
+    }
+    else
+    {
+        tok->values[0] = strlen(tok->str_value);
+        tok->nvalues = 1;
+    }
+}
+#define VECTOR_ARITHMETICS(atok,btok,AOP) \
+{ \
+    int i, has_values = 0; \
+    if ( !(atok)->nvalues || !(btok)->nvalues ) /* missing values */ \
+    { \
+        (atok)->nvalues = 0; (atok)->nsamples = 0; \
+    } \
+    else \
+    { \
+        if ( ((atok)->nsamples && (btok)->nsamples) || (!(atok)->nsamples && !(btok)->nsamples)) \
+        { \
+            for (i=0; i<(atok)->nvalues; i++) \
+            { \
+                if ( bcf_float_is_missing((atok)->values[i]) ) continue; \
+                if ( bcf_float_is_missing((btok)->values[i]) ) { bcf_float_set_missing((atok)->values[i]); continue; } \
+                has_values = 1; \
+                (atok)->values[i] = (atok)->values[i] AOP (btok)->values[i]; \
+            } \
+        } \
+        else if ( (btok)->nsamples ) \
+        { \
+            hts_expand(float,(btok)->nvalues,(atok)->mvalues,(atok)->values); \
+            for (i=0; i<(btok)->nvalues; i++) \
+            { \
+                if ( bcf_float_is_missing((atok)->values[0]) || bcf_float_is_missing((btok)->values[i]) ) \
+                { \
+                    bcf_float_set_missing((atok)->values[i]); \
+                    continue; \
+                } \
+                has_values = 1; \
+                (atok)->values[i] = (atok)->values[0] AOP (btok)->values[i]; \
+            } \
+            (atok)->nvalues  = (btok)->nvalues; \
+            (atok)->nsamples = (btok)->nsamples; \
+        } \
+        else if ( (atok)->nsamples ) \
+        { \
+            for (i=0; i<(atok)->nvalues; i++) \
+            { \
+                if ( bcf_float_is_missing((atok)->values[i]) || bcf_float_is_missing((btok)->values[0]) ) \
+                { \
+                    bcf_float_set_missing((atok)->values[i]); \
+                    continue; \
+                } \
+                has_values = 1; \
+                (atok)->values[i] = (atok)->values[i] AOP (btok)->values[0]; \
+            } \
+        } \
+    } \
+    if ( !has_values ) { (atok)->nvalues = 0; (atok)->nsamples = 0; } \
+}
+
+static int vector_logic_and(token_t *atok, token_t *btok)
+{
+    // We are comparing either two scalars (result of INFO tag vs a threshold), two vectors (two FORMAT fields),
+    // or a vector and a scalar (FORMAT field vs threshold)
+    int i, pass_site = 0;
+    if ( !atok->nvalues || !btok->nvalues )
+    {
+        atok->nvalues = atok->nsamples = 0;
+        return 0;
+    }
+    if ( !atok->nsamples && !btok->nsamples ) return atok->pass_site && btok->pass_site;
+    if ( atok->nsamples && btok->nsamples )
+    {
+        for (i=0; i<atok->nsamples; i++)
+        {
+            atok->pass_samples[i] = atok->pass_samples[i] && btok->pass_samples[i];
+            if ( !pass_site && atok->pass_samples[i] ) pass_site = 1;
+        }
+        return pass_site;
+    }
+    if ( btok->nsamples )
+    {
+        for (i=0; i<btok->nsamples; i++)
+        {
+            atok->pass_samples[i] = atok->pass_site && btok->pass_samples[i];
+            if ( !pass_site && atok->pass_samples[i] ) pass_site = 1;
+        }
+        atok->nsamples = btok->nsamples;
+        return pass_site;
+    }
+    /* atok->nsamples!=0 */
+    for (i=0; i<atok->nsamples; i++)
+    {
+        atok->pass_samples[i] = atok->pass_samples[i] && btok->pass_site;
+        if ( !pass_site && atok->pass_samples[i] ) pass_site = 1;
+    }
+    return pass_site;
+}
+static int vector_logic_or(token_t *atok, token_t *btok, int or_type)
+{
+    int i, pass_site = 0;
+    if ( !atok->nvalues && !btok->nvalues )   // missing sites in both
+    {
+        atok->nvalues = atok->nsamples = 0;
+        return 0;
+    }
+    if ( !atok->nvalues ) // missing value in a
+    {
+        for (i=0; i<btok->nsamples; i++)
+            atok->pass_samples[i] = btok->pass_samples[i];
+        atok->nsamples = btok->nsamples;
+        return btok->pass_site;
+    }
+    if ( !btok->nvalues ) // missing value in b
+        return atok->pass_site;
+
+    if ( !atok->nsamples && !btok->nsamples ) return atok->pass_site || btok->pass_site;
+    if ( !atok->nsamples )
+    {
+        if ( or_type==TOK_OR )
+        {
+            for (i=0; i<btok->nsamples; i++)
+            {
+                atok->pass_samples[i] = btok->pass_samples[i];
+                if ( atok->pass_site || atok->pass_samples[i] ) pass_site = 1;
+            }
+        }
+        else
+        {
+            for (i=0; i<btok->nsamples; i++)
+            {
+                atok->pass_samples[i] = atok->pass_site || btok->pass_samples[i];
+                if ( atok->pass_samples[i] ) pass_site = 1;
+            }
+        }
+        atok->nsamples = btok->nsamples;
+        return pass_site;
+    }
+    if ( !btok->nsamples )  // vector vs site
+    {
+        if ( or_type==TOK_OR )
+        {
+            for (i=0; i<atok->nsamples; i++)
+                if ( btok->pass_site || atok->pass_samples[i] ) pass_site = 1;
+        }
+        else
+        {
+            for (i=0; i<atok->nsamples; i++)
+            {
+                atok->pass_samples[i] = atok->pass_samples[i] || btok->pass_site;
+                if ( atok->pass_samples[i] ) pass_site = 1;
+            }
+        }
+        return pass_site;
+    }
+    for (i=0; i<atok->nsamples; i++)
+    {
+        atok->pass_samples[i] = atok->pass_samples[i] || btok->pass_samples[i];
+        if ( !pass_site && atok->pass_samples[i] ) pass_site = 1;
+    }
+    return pass_site;
+}
+
+#define CMP_VECTORS(atok,btok,CMP_OP,ret) \
+{ \
+    int i, j, has_values = 0, pass_site = 0; \
+    if ( !(atok)->nvalues || !(btok)->nvalues ) { (atok)->nvalues = 0; (atok)->nsamples = 0; (ret) = 0; } \
+    else \
+    { \
+        if ( (atok)->nsamples && (btok)->nsamples ) \
+        { \
+            for (i=0; i<(atok)->nsamples; i++) \
+            { \
+                if ( bcf_float_is_missing((atok)->values[i]) ) { (atok)->pass_samples[i] = 0; continue; } \
+                if ( bcf_float_is_missing((btok)->values[i]) ) { (atok)->pass_samples[i] = 0; continue; } \
+                has_values = 1; \
+                if ( (atok)->values[i] CMP_OP (btok)->values[i] ) { (atok)->pass_samples[i] = 1; pass_site = 1; } \
+                else (atok)->pass_samples[i] = 0; \
+            } \
+            if ( !has_values ) (atok)->nvalues = 0; \
+        } \
+        else if ( (atok)->nsamples ) \
+        { \
+            if ( bcf_float_is_missing((btok)->values[0]) ) { (atok)->nvalues = 0; (atok)->nsamples = 0; (ret) = 0; } \
+            else \
+            { \
+                for (i=0; i<(atok)->nsamples; i++) \
+                { \
+                    if ( bcf_float_is_missing((atok)->values[i]) ) { (atok)->pass_samples[i] = 0; continue; } \
+                    has_values = 1; \
+                    if ( (atok)->values[i] CMP_OP (btok)->values[0] ) { (atok)->pass_samples[i] = 1; pass_site = 1; } \
+                    else (atok)->pass_samples[i] = 0; \
+                } \
+            } \
+            if ( !has_values ) (atok)->nvalues = 0; \
+        } \
+        else if ( (btok)->nsamples ) \
+        { \
+            if ( bcf_float_is_missing((atok)->values[0]) ) { (atok)->nvalues = 0; (atok)->nsamples = 0; (ret) = 0; } \
+            else \
+            { \
+                for (i=0; i<(btok)->nsamples; i++) \
+                { \
+                    if ( bcf_float_is_missing((btok)->values[i]) ) { (atok)->pass_samples[i] = 0; continue; } \
+                    has_values = 1; \
+                    if ( (atok)->values[0] CMP_OP (btok)->values[i] ) { (atok)->pass_samples[i] = 1; pass_site = 1; } \
+                    else (atok)->pass_samples[i] = 0; \
+                } \
+                (atok)->nvalues  = (btok)->nvalues; \
+                (atok)->nsamples = (btok)->nsamples; \
+            } \
+            if ( !has_values ) (atok)->nvalues = 0; \
+        } \
+        else if ( (atok)->idx==-2 || (btok)->idx==-2 ) \
+        { \
+            /* any field can match: [*] */ \
+            for (i=0; i<(atok)->nvalues; i++) \
+            { \
+                for (j=0; j<(btok)->nvalues; j++) \
+                    if ( (atok)->values[i] CMP_OP (btok)->values[j] ) { pass_site = 1; i = (atok)->nvalues; break; } \
+            } \
+        } \
+        else \
+        { \
+            if ( bcf_float_is_missing((atok)->values[0]) || bcf_float_is_missing((btok)->values[0]) ) \
+            { \
+                (atok)->nvalues = 0; (atok)->nsamples = 0; (ret) = 0; \
+            } \
+            else if ( (atok)->values[0] CMP_OP (btok)->values[0] ) { pass_site = 1; } \
+        } \
+        /*fprintf(stderr,"pass=%d\n", pass_site);*/ \
+        (ret) = pass_site; \
+    } \
+}
+static int cmp_vector_strings(token_t *atok, token_t *btok, int logic)    // logic: TOK_EQ or TOK_NE
+{
+    if ( !atok->nvalues ) { return 0; }
+    if ( !btok->nvalues ) { atok->nvalues = 0; return 0; }
+    int i, pass_site = 0;
+    if ( atok->nsamples && atok->nsamples==btok->nsamples )
+    {
+        for (i=0; i<atok->nsamples; i++)
+        {
+            char *astr = atok->str_value + i*(int)atok->values[0];
+            char *bstr = btok->str_value + i*(int)btok->values[0];
+            char *aend = astr + (int)atok->values[0], *a = astr;
+            while ( a<aend && *a ) a++;
+            char *bend = bstr + (int)btok->values[0], *b = bstr;
+            while ( b<bend && *b ) b++;
+            if ( a-astr != b-bstr ) atok->pass_samples[i] = 0;
+            else atok->pass_samples[i] = strncmp(astr,bstr,a-astr)==0 ? 1 : 0;
+            if ( logic!=TOK_EQ )
+                atok->pass_samples[i] = atok->pass_samples[i] ? 0 : 1;
+            pass_site |= atok->pass_samples[i];
+        }
+        if ( !atok->nsamples ) atok->nsamples = btok->nsamples;
+    }
+    else if ( !atok->nsamples && !btok->nsamples )
+    {
+        if ( atok->idx==-2 || btok->idx==-2 )
+        {
+            // any field can match: [*]
+            if ( atok->idx==-2 && btok->idx==-2 )
+                error("fixme: Expected at least one scalar value [%s %s %s]\n", atok->tag ? atok->tag : btok->tag, atok->str_value,btok->str_value);
+            token_t *xtok, *ytok;   // xtok is scalar, ytok array
+            if ( btok->idx==-2 ) { xtok = atok; ytok = btok; }
+            else { xtok = btok; ytok = atok; }
+            char *xstr = xtok->str_value, *xend = xstr + xtok->nvalues;
+            char *ystr = ytok->str_value, *yend = ystr + ytok->nvalues, *y = ystr;
+            while ( y<=yend )
+            {
+                if ( y==yend || *y==',' )
+                {
+                    if ( y-ystr==xend-xstr && !strncmp(xstr,ystr,xend-xstr) )
+                    {
+                        pass_site = 1;
+                        break;
+                    }
+                    ystr = y+1;
+                }
+                y++;
+            }
+        }
+        else
+            pass_site = strcmp(atok->str_value,btok->str_value) ? 0 : 1;
+        if ( logic!=TOK_EQ ) pass_site = pass_site ? 0 : 1;
+    }
+    else
+    {
+        token_t *xtok, *ytok;
+        if ( !atok->nsamples ) { xtok = atok; ytok = btok; }
+        else { xtok = btok; ytok = atok; }
+        char *xstr = xtok->str_value;
+        char *xend = xstr + (int)xtok->values[0], *x = xstr;
+        while ( x<xend && *x ) x++;
+        for (i=0; i<ytok->nsamples; i++)
+        {
+            char *ystr = ytok->str_value + i*(int)ytok->values[0];
+            char *yend = ystr + (int)ytok->values[0], *y = ystr;
+            while ( y<yend && *y ) y++;
+            if ( x-xstr != y-ystr ) atok->pass_samples[i] = 0;
+            else atok->pass_samples[i] = strncmp(xstr,ystr,x-xstr)==0 ? 1 : 0;
+            if ( logic!=TOK_EQ )
+                atok->pass_samples[i] = atok->pass_samples[i] ? 0 : 1;
+            pass_site |= atok->pass_samples[i];
+        }
+        if ( !atok->nsamples )
+            atok->nvalues = atok->nsamples = btok->nsamples; // is it a bug? not sure if atok->nvalues should be set
+    }
+    return pass_site;
+}
+static int regex_vector_strings(token_t *atok, token_t *btok)
+{
+    int ret = regexec(btok->regex, atok->str_value, 0,NULL,0);
+    return ret==0 ? 1 : 0;
+}
+
+static int filters_init1(filter_t *filter, char *str, int len, token_t *tok)
+{
+    tok->tok_type  = TOK_VAL;
+    tok->hdr_id    = -1;
+    tok->pass_site = -1;
+    tok->idx       = -1;
+
+    // is this a string constant?
+    if ( str[0]=='"' || str[0]=='\'' )
+    {
+        int quote = str[0];
+        if ( str[len-1] != quote ) error("TODO: [%s]\n", filter->str);
+        tok->key = (char*) calloc(len-1,sizeof(char));
+        hts_expand(float,1,tok->mvalues,tok->values);
+        tok->values[0] = len-2;
+        memcpy(tok->key,str+1,len-2);
+        tok->key[len-2] = 0;
+        tok->is_str = 1;
+        tok->nvalues = len-2;
+        return 0;
+    }
+
+    // is it a file?
+    if ( str[0]=='@' )
+    {
+        tok->tag = (char*) calloc(len+1,sizeof(char));
+        memcpy(tok->tag,str,len);
+        tok->tag[len] = 0;
+        wordexp_t wexp;
+        wordexp(tok->tag+1, &wexp, 0);
+        if ( !wexp.we_wordc ) error("No such file: %s\n", tok->tag+1);
+        int i, n;
+        char **list = hts_readlist(wexp.we_wordv[0], 1, &n);
+        if ( !list ) error("Could not read: %s\n", wexp.we_wordv[0]);
+        wordfree(&wexp);
+        tok->hash = khash_str2int_init();
+        for (i=0; i<n; i++)
+        {
+            char *se = list[i];
+            while ( *se && !isspace(*se) ) se++;
+            *se = 0;
+            if ( !khash_str2int_has_key(tok->hash,list[i]) )
+                khash_str2int_inc(tok->hash,list[i]);
+            else
+                free(list[i]);
+        }
+        free(list);
+        return 0;
+    }
+
+    int is_fmt = -1;
+    if ( !strncasecmp(str,"FMT/",4) ) { str += 4; len -= 4; is_fmt = 1; }
+    else if ( !strncasecmp(str,"FORMAT/",7) ) { str += 7; len -= 7; is_fmt = 1; }
+    else
+    {
+        if ( !strncasecmp(str,"INFO/",5) ) { is_fmt = 0; str += 5; len -= 5; }
+        else if ( !strncasecmp(str,"QUAL",len) || !strncmp(str,"%QUAL",len) /* for backward compatibility */ )
+        {
+            tok->setter = filters_set_qual;
+            tok->tag = strdup("QUAL");
+            return 0;
+        }
+        else if ( !strncasecmp(str,"TYPE",len) || !strncmp(str,"%TYPE",len) /* for backward compatibility */ )
+        {
+            tok->setter = filters_set_type;
+            tok->tag = strdup("TYPE");
+            return 0;
+        }
+        else if ( !strncasecmp(str,"FILTER",len) || !strncmp(str,"%FILTER",len) /* for backward compatibility */ )
+        {
+            tok->comparator = filters_cmp_filter;
+            tok->tag = strdup("FILTER");
+            filter->max_unpack |= BCF_UN_FLT;
+            return 0;
+        }
+        else if ( !strncasecmp(str,"ID",len) || !strncasecmp(str,"%ID",len) /* for backward compatibility */ )
+        {
+            tok->comparator = filters_cmp_id;
+            tok->tag = strdup("ID");
+            return 0;
+        }
+        else if ( !strncasecmp(str,"REF",len) )
+        {
+            tok->setter = &filters_set_ref_string;
+            tok->is_str = 1;
+            tok->tag = strdup("REF");
+            return 0;
+        }
+        else if ( !strncasecmp(str,"ALT",len) )
+        {
+            tok->setter = &filters_set_alt_string;
+            tok->is_str = 1;
+            tok->tag = strdup("ALT");
+            return 0;
+        }
+        else if ( !strncasecmp(str,"N_ALT",len) )
+        {
+            tok->setter = &filters_set_nalt;
+            tok->tag = strdup("N_ALT");
+            return 0;
+        }
+        else if ( !strncasecmp(str,"N_SAMPLES",len) )
+        {
+            tok->tok_type = TOK_VAL;
+            tok->threshold = bcf_hdr_nsamples(filter->hdr);
+            return 0;
+        }
+    }
+
+    // does it have array subscript?
+    int is_array = 0;
+    kstring_t tmp = {0,0,0};
+    kputsn(str, len, &tmp);
+    if ( tmp.s[tmp.l-1] == ']' )
+    {
+        int i;
+        for (i=0; i<tmp.l; i++)
+            if ( tmp.s[i]=='[' ) { tmp.s[i] = 0; is_array = i+1; break; }
+        if ( is_array )
+        {
+            if ( tmp.s[is_array]=='*' )
+                tok->idx = -2;      // tag[*] .. any field
+            else
+            {
+                char *end;
+                tok->idx = strtol(tmp.s+is_array, &end, 10);
+                if ( *end!=']' ) error("Could not parse the index: %s[%s\n", tmp.s,tmp.s+is_array);
+            }
+        }
+    }
+    tok->hdr_id = bcf_hdr_id2int(filter->hdr,BCF_DT_ID,tmp.s);
+    if ( is_fmt==-1 )
+    {
+        if ( tok->hdr_id >=0 )
+        {
+            if ( bcf_hdr_idinfo_exists(filter->hdr,BCF_HL_INFO,tok->hdr_id) ) is_fmt = 0;
+            else if ( bcf_hdr_idinfo_exists(filter->hdr,BCF_HL_FMT,tok->hdr_id) ) is_fmt = 1;
+        }
+        if ( is_fmt==-1 ) is_fmt = 0;
+    }
+    if ( is_fmt ) filter->max_unpack |= BCF_UN_FMT;
+    if ( tok->hdr_id>=0 )
+    {
+        if ( is_fmt && !strcmp("GT",tmp.s) )
+        {
+            tok->setter = &filters_set_genotype_string; tok->is_str = 1;
+        }
+        else if ( is_fmt )
+        {
+            if ( !bcf_hdr_idinfo_exists(filter->hdr,BCF_HL_FMT,tok->hdr_id) )
+                error("No such FORMAT field: %s\n", tmp.s);
+            if ( bcf_hdr_id2number(filter->hdr,BCF_HL_FMT,tok->hdr_id)!=1 && !is_array )
+                error("Error: FORMAT vectors must be subscripted, e.g. %s[0] or %s[*]\n", tmp.s, tmp.s);
+            switch ( bcf_hdr_id2type(filter->hdr,BCF_HL_FMT,tok->hdr_id) )
+            {
+                case BCF_HT_INT:  tok->setter = &filters_set_format_int; break;
+                case BCF_HT_REAL: tok->setter = &filters_set_format_float; break;
+                case BCF_HT_STR:  tok->setter = &filters_set_format_string; tok->is_str = 1; break;
+                default: error("[%s:%d %s] FIXME\n", __FILE__,__LINE__,__FUNCTION__);
+            }
+        }
+        else if ( !bcf_hdr_idinfo_exists(filter->hdr,BCF_HL_INFO,tok->hdr_id) )
+            error("No such INFO field: %s\n", tmp.s);
+        else
+        {
+            if ( bcf_hdr_id2type(filter->hdr,BCF_HL_INFO,tok->hdr_id) == BCF_HT_FLAG )
+                tok->setter = filters_set_info_flag;
+            else
+            {
+                if ( bcf_hdr_id2type(filter->hdr,BCF_HL_INFO,tok->hdr_id) == BCF_HT_STR ) tok->is_str = 1;
+                if ( bcf_hdr_id2number(filter->hdr,BCF_HL_INFO,tok->hdr_id)==1 )
+                tok->setter = filters_set_info;
+            else
+            {
+                switch ( bcf_hdr_id2type(filter->hdr,BCF_HL_INFO,tok->hdr_id) )
+                {
+                    case BCF_HT_INT:  tok->setter = &filters_set_info_int; break;
+                    case BCF_HT_REAL: tok->setter = &filters_set_info_float; break;
+                    case BCF_HT_STR:  tok->setter = &filters_set_info_string; tok->is_str = 1; break;
+                    default: error("[%s:%d %s] FIXME\n", __FILE__,__LINE__,__FUNCTION__);
+                }
+                    //tok->idx = -2;
+            }
+            }
+            filter->max_unpack |= BCF_UN_INFO;
+            }
+            tok->tag = strdup(tmp.s);
+            if ( tmp.s ) free(tmp.s);
+            return 0;
+        }
+    else if ( !strcasecmp(tmp.s,"ALT") )
+    {
+        tok->setter = &filters_set_alt_string;
+        tok->is_str = 1;
+        tok->tag = strdup(tmp.s);
+        free(tmp.s);
+        return 0;
+    }
+    else if ( !strcasecmp(tmp.s,"AN") )
+    {
+        tok->setter = &filters_set_an;
+        tok->tag = strdup("AN");
+        free(tmp.s);
+        return 0;
+    }
+    else if ( !strcasecmp(tmp.s,"AC") )
+    {
+        tok->setter = &filters_set_ac;
+        tok->tag = strdup("AC");
+        free(tmp.s);
+        return 0;
+    }
+    else if ( !strcasecmp(tmp.s,"MAC") )
+    {
+        tok->setter = &filters_set_mac;
+        tok->tag = strdup("MAC");
+        free(tmp.s);
+        return 0;
+    }
+    else if ( !strcasecmp(tmp.s,"AF") )
+    {
+        tok->setter = &filters_set_af;
+        tok->tag = strdup("AF");
+        free(tmp.s);
+        return 0;
+    }
+    else if ( !strcasecmp(tmp.s,"MAF") )
+    {
+        tok->setter = &filters_set_maf;
+        tok->tag = strdup("MAF");
+        free(tmp.s);
+        return 0;
+    }
+
+    // is it a value?
+    char *end;
+    errno = 0;
+    tok->threshold = strtod(tmp.s, &end);
+    if ( errno!=0 || end!=tmp.s+len ) error("[%s:%d %s] Error: the tag \"INFO/%s\" is not defined in the VCF header\n", __FILE__,__LINE__,__FUNCTION__,tmp.s);
+
+    if ( tmp.s ) free(tmp.s);
+    return 0;
+}
+
+
+static void filter_debug_print(token_t *toks, token_t **tok_ptrs, int ntoks)
+{
+    int i;
+    for (i=0; i<ntoks; i++)
+    {
+        token_t *tok = toks ? &toks[i] : tok_ptrs[i];
+        if ( tok->tok_type==TOK_VAL )
+        {
+            if ( tok->key )
+                fprintf(stderr,"%s", tok->key);
+            else if ( tok->tag )
+                fprintf(stderr,"%s", tok->tag);
+            else
+                fprintf(stderr,"%e", tok->threshold);
+        }
+        else
+            fprintf(stderr,"%c", TOKEN_STRING[tok->tok_type]);
+        if ( tok->setter ) fprintf(stderr,"\t[setter %p]", tok->setter);
+        fprintf(stderr,"\n");
+    }
+}
+
+
+// Parse filter expression and convert to reverse polish notation. Dijkstra's shunting-yard algorithm
+filter_t *filter_init(bcf_hdr_t *hdr, const char *str)
+{
+    filter_t *filter = (filter_t *) calloc(1,sizeof(filter_t));
+    filter->str = strdup(str);
+    filter->hdr = hdr;
+    filter->max_unpack |= BCF_UN_STR;
+
+    int nops = 0, mops = 0, *ops = NULL;    // operators stack
+    int nout = 0, mout = 0;                 // filter tokens, RPN
+    token_t *out = NULL;
+    char *tmp = filter->str;
+    int last_op = -1;
+    while ( *tmp )
+    {
+        int len, ret;
+        ret = filters_next_token(&tmp, &len);
+        if ( ret==-1 ) error("Missing quotes in: %s\n", str);
+
+        //fprintf(stderr,"token=[%c] .. [%s] %d\n", TOKEN_STRING[ret], tmp, len);
+        //int i; for (i=0; i<nops; i++) fprintf(stderr," .%c.", TOKEN_STRING[ops[i]]); fprintf(stderr,"\n");
+
+        if ( ret==TOK_LFT )         // left bracket
+        {
+            nops++;
+            hts_expand(int, nops, mops, ops);
+            ops[nops-1] = ret;
+        }
+        else if ( ret==TOK_RGT )    // right bracket
+        {
+            while ( nops>0 && ops[nops-1]!=TOK_LFT )
+            {
+                nout++;
+                hts_expand0(token_t, nout, mout, out);
+                out[nout-1].tok_type = ops[nops-1];
+                nops--;
+            }
+            if ( nops<=0 ) error("Could not parse: %s\n", str);
+            nops--;
+        }
+        else if ( ret!=TOK_VAL )    // one of the operators
+        {
+            // detect unary minus: replace -value with -1*(value)
+            if ( ret==TOK_SUB && last_op!=TOK_VAL && last_op!=TOK_RGT )
+            {
+                nout++;
+                hts_expand0(token_t, nout, mout, out);
+                token_t *tok = &out[nout-1];
+                tok->tok_type  = TOK_VAL;
+                tok->hdr_id    = -1;
+                tok->pass_site = -1;
+                tok->threshold = -1.0;
+                ret = TOK_MULT;
+            }
+            else
+            {
+                while ( nops>0 && op_prec[ret] < op_prec[ops[nops-1]] )
+                {
+                    nout++;
+                    hts_expand0(token_t, nout, mout, out);
+                    out[nout-1].tok_type = ops[nops-1];
+                    nops--;
+                }
+            }
+            nops++;
+            hts_expand(int, nops, mops, ops);
+            ops[nops-1] = ret;
+        }
+        else if ( !len )
+        {
+            if ( *tmp && !isspace(*tmp) ) error("Could not parse the expression: [%s]\n", str);
+            break;     // all tokens read
+        }
+        else           // annotation name or filtering value
+        {
+            nout++;
+            hts_expand0(token_t, nout, mout, out);
+            filters_init1(filter, tmp, len, &out[nout-1]);
+            tmp += len;
+        }
+        last_op = ret;
+    }
+    while ( nops>0 )
+    {
+        if ( ops[nops-1]==TOK_LFT || ops[nops-1]==TOK_RGT ) error("Could not parse the expression: [%s]\n", filter->str);
+        nout++;
+        hts_expand0(token_t, nout, mout, out);
+        out[nout-1].tok_type = ops[nops-1];
+        nops--;
+    }
+
+    // In the special cases of TYPE and FILTER the BCF header IDs are yet unknown. Walk through the
+    // list of operators and convert the strings (e.g. "PASS") to BCF ids. The string value token must be
+    // just before or after the FILTER token and they must be followed with a comparison operator.
+    // At this point we also initialize regex expressions which, in RPN, must preceed the LIKE/NLIKE operator.
+    // This code is fragile: improve me.
+    int i;
+    for (i=0; i<nout; i++)
+    {
+        if ( out[i].tok_type==TOK_LIKE || out[i].tok_type==TOK_NLIKE )
+        {
+            int j = i-1;
+            if ( !out[j].key )
+                error("Could not parse the expression, wrong value for regex operator: %s\n", filter->str);
+            out[j].regex = (regex_t *) malloc(sizeof(regex_t));
+            if ( regcomp(out[j].regex, out[j].key, REG_ICASE|REG_NOSUB) )
+                error("Could not compile the regex expression \"%s\": %s\n", out[j].key,filter->str);
+        }
+        if ( out[i].tok_type!=TOK_VAL ) continue;
+        if ( !out[i].tag ) continue;
+        if ( !strcmp(out[i].tag,"TYPE") )
+        {
+            if ( i+1==nout ) error("Could not parse the expression: %s\n", filter->str);
+            int j = i+1;
+            if ( out[j].tok_type==TOK_EQ || out[j].tok_type==TOK_NE ) j = i - 1;
+            if ( out[j].tok_type!=TOK_VAL || !out[j].key ) error("[%s:%d %s] Could not parse the expression: %s\n",  __FILE__,__LINE__,__FUNCTION__, filter->str);
+            if ( !strcasecmp(out[j].key,"snp") || !strcasecmp(out[j].key,"snps") ) { out[j].threshold = VCF_SNP; out[j].is_str = 0; }
+            else if ( !strcasecmp(out[j].key,"indel") || !strcasecmp(out[j].key,"indels") ) { out[j].threshold = VCF_INDEL; out[j].is_str = 0; }
+            else if ( !strcasecmp(out[j].key,"mnp") || !strcasecmp(out[j].key,"mnps") ) { out[j].threshold = VCF_MNP; out[j].is_str = 0; }
+            else if ( !strcasecmp(out[j].key,"other") ) { out[j].threshold = VCF_OTHER; out[j].is_str = 0; }
+            else if ( !strcasecmp(out[j].key,"ref") ) { out[j].threshold = VCF_REF; out[j].is_str = 0; }
+            else error("The type \"%s\" not recognised: %s\n", out[j].key, filter->str);
+            out[j].tag = out[j].key; out[j].key = NULL;
+            i = j;
+            continue;
+        }
+        if ( !strcmp(out[i].tag,"FILTER") )
+        {
+            if ( i+1==nout ) error("Could not parse the expression: %s\n", filter->str);
+            int j = i+1;
+            if ( out[j].tok_type==TOK_EQ || out[j].tok_type==TOK_NE || out[j].tok_type==TOK_LIKE ) j = i - 1;
+            if ( out[j].tok_type!=TOK_VAL || !out[j].key )
+                error("[%s:%d %s] Could not parse the expression, an unquoted string value perhaps? %s\n", __FILE__,__LINE__,__FUNCTION__, filter->str);
+            if ( strcmp(".",out[j].key) )
+            {
+                out[j].hdr_id = bcf_hdr_id2int(filter->hdr, BCF_DT_ID, out[j].key);
+                if ( !bcf_hdr_idinfo_exists(filter->hdr,BCF_HL_FLT,out[j].hdr_id) )
+                    error("The filter \"%s\" not present in the VCF header\n", out[j].key);
+            }
+            else
+                out[j].hdr_id = -1;
+            out[j].tag = out[j].key; out[j].key = NULL;
+            out[i].hdr_id = out[j].hdr_id;
+            i = j;
+            continue;
+        }
+    }
+    filter->nsamples = filter->max_unpack&BCF_UN_FMT ? bcf_hdr_nsamples(filter->hdr) : 0;
+    for (i=0; i<nout; i++)
+    {
+        if ( out[i].tok_type==TOK_MAX )      { out[i].setter = set_max; out[i].tok_type = TOK_FUNC; }
+        else if ( out[i].tok_type==TOK_MIN ) { out[i].setter = set_min; out[i].tok_type = TOK_FUNC; }
+        else if ( out[i].tok_type==TOK_AVG ) { out[i].setter = set_avg; out[i].tok_type = TOK_FUNC; }
+        else if ( out[i].tok_type==TOK_SUM ) { out[i].setter = set_sum; out[i].tok_type = TOK_FUNC; }
+        else if ( out[i].tok_type==TOK_ABS ) { out[i].setter = set_abs; out[i].tok_type = TOK_FUNC; }
+        else if ( out[i].tok_type==TOK_LEN ) { out[i].setter = set_strlen; out[i].tok_type = TOK_FUNC; }
+        hts_expand0(float,1,out[i].mvalues,out[i].values);
+        if ( filter->nsamples )
+        {
+            out[i].pass_samples = (uint8_t*)malloc(filter->nsamples);
+            int j;
+            for (j=0; j<filter->nsamples; j++) out[i].pass_samples[j] = 1;
+        }
+    }
+
+    if (0) filter_debug_print(out, NULL, nout);
+
+    if ( mops ) free(ops);
+    filter->filters   = out;
+    filter->nfilters  = nout;
+    filter->flt_stack = (token_t **)malloc(sizeof(token_t*)*nout);
+    return filter;
+}
+
+void filter_destroy(filter_t *filter)
+{
+    int i;
+    for (i=0; i<filter->nfilters; i++)
+    {
+        //if ( filter->filters[i].key ) free(filter->filters[i].key);
+        free(filter->filters[i].str_value);
+        free(filter->filters[i].tag);
+        free(filter->filters[i].values);
+        free(filter->filters[i].pass_samples);
+        if (filter->filters[i].hash) khash_str2int_destroy_free(filter->filters[i].hash);
+        if (filter->filters[i].regex)
+        {
+            regfree(filter->filters[i].regex);
+            free(filter->filters[i].regex);
+        }
+    }
+    free(filter->filters);
+    free(filter->flt_stack);
+    free(filter->str);
+    free(filter->tmpi);
+    free(filter);
+}
+
+int filter_test(filter_t *filter, bcf1_t *line, const uint8_t **samples)
+{
+    bcf_unpack(line, filter->max_unpack);
+
+    int i, nstack = 0;
+    for (i=0; i<filter->nfilters; i++)
+    {
+        filter->filters[i].nsamples  = 0;
+        filter->filters[i].nvalues   = 0;
+        filter->filters[i].pass_site = -1;
+
+        if ( filter->filters[i].tok_type == TOK_VAL )
+        {
+            if ( filter->filters[i].setter )    // variable, query the VCF line
+                filter->filters[i].setter(filter, line, &filter->filters[i]);
+            else if ( filter->filters[i].key )  // string constant
+            {
+                filter->filters[i].str_value = filter->filters[i].key;
+                filter->filters[i].values[0] = filter->filters[i].values[0];
+                filter->filters[i].nvalues   = strlen(filter->filters[i].key);
+            }
+            else    // numeric constant
+            {
+                filter->filters[i].values[0] = filter->filters[i].threshold;
+                filter->filters[i].nvalues   = 1;
+            }
+
+            filter->flt_stack[nstack++] = &filter->filters[i];
+            continue;
+        }
+        else if ( filter->filters[i].tok_type == TOK_FUNC ) // all functions take only one argument
+        {
+            filter->filters[i].setter(filter, line, filter->flt_stack[nstack-1]);
+            continue;
+        }
+        if ( nstack<2 )
+            error("Error occurred while processing the filter \"%s\" (1:%d)\n", filter->str,nstack);  // too few values left on the stack
+
+        int is_str  = filter->flt_stack[nstack-1]->is_str + filter->flt_stack[nstack-2]->is_str;
+
+        if ( filter->filters[i].tok_type == TOK_OR || filter->filters[i].tok_type == TOK_OR_VEC )
+        {
+            if ( filter->flt_stack[nstack-1]->pass_site<0 || filter->flt_stack[nstack-2]->pass_site<0 )
+                error("Error occurred while processing the filter \"%s\" (%d %d OR)\n", filter->str,filter->flt_stack[nstack-2]->pass_site,filter->flt_stack[nstack-1]->pass_site);
+            filter->flt_stack[nstack-2]->pass_site = vector_logic_or(filter->flt_stack[nstack-2],filter->flt_stack[nstack-1], filter->filters[i].tok_type);
+            nstack--;
+            continue;
+        }
+        if ( filter->filters[i].tok_type == TOK_AND || filter->filters[i].tok_type == TOK_AND_VEC )
+        {
+            if ( filter->flt_stack[nstack-1]->pass_site<0 || filter->flt_stack[nstack-2]->pass_site<0 )
+                error("Error occurred while processing the filter \"%s\" (%d %d AND)\n", filter->str,filter->flt_stack[nstack-2]->pass_site,filter->flt_stack[nstack-1]->pass_site);
+            filter->flt_stack[nstack-2]->pass_site = vector_logic_and(filter->flt_stack[nstack-2],filter->flt_stack[nstack-1]);
+            nstack--;
+            continue;
+        }
+
+        if ( filter->filters[i].tok_type == TOK_ADD )
+        {
+            VECTOR_ARITHMETICS(filter->flt_stack[nstack-2],filter->flt_stack[nstack-1],+);
+            nstack--;
+            continue;
+        }
+        else if ( filter->filters[i].tok_type == TOK_SUB )
+        {
+            VECTOR_ARITHMETICS(filter->flt_stack[nstack-2],filter->flt_stack[nstack-1],-);
+            nstack--;
+            continue;
+        }
+        else if ( filter->filters[i].tok_type == TOK_MULT )
+        {
+            VECTOR_ARITHMETICS(filter->flt_stack[nstack-2],filter->flt_stack[nstack-1],*);
+            nstack--;
+            continue;
+        }
+        else if ( filter->filters[i].tok_type == TOK_DIV )
+        {
+            VECTOR_ARITHMETICS(filter->flt_stack[nstack-2],filter->flt_stack[nstack-1],/);
+            nstack--;
+            continue;
+        }
+
+        int is_true = 0;
+        if ( !filter->flt_stack[nstack-1]->nvalues || !filter->flt_stack[nstack-2]->nvalues )
+        {
+            filter->flt_stack[nstack-2]->nvalues = filter->flt_stack[nstack-2]->nsamples = 0;
+        }
+        else if ( filter->filters[i].tok_type == TOK_EQ )
+        {
+            if ( filter->flt_stack[nstack-1]->comparator )
+                is_true = filter->flt_stack[nstack-1]->comparator(filter->flt_stack[nstack-1],filter->flt_stack[nstack-2],TOK_EQ,line);
+            else if ( filter->flt_stack[nstack-2]->comparator )
+                is_true = filter->flt_stack[nstack-2]->comparator(filter->flt_stack[nstack-2],filter->flt_stack[nstack-1],TOK_EQ,line);
+            else if ( is_str==2 )   // both are strings
+                is_true = cmp_vector_strings(filter->flt_stack[nstack-2],filter->flt_stack[nstack-1],TOK_EQ);
+            else if ( is_str==1 )
+                error("Comparing string to numeric value: %s\n", filter->str);
+            else
+                CMP_VECTORS(filter->flt_stack[nstack-2],filter->flt_stack[nstack-1],==,is_true);
+        }
+        else if ( filter->filters[i].tok_type == TOK_NE )
+        {
+            if ( filter->flt_stack[nstack-1]->comparator )
+                is_true = filter->flt_stack[nstack-1]->comparator(filter->flt_stack[nstack-1],filter->flt_stack[nstack-2],TOK_NE,line);
+            else if ( filter->flt_stack[nstack-2]->comparator )
+                is_true = filter->flt_stack[nstack-2]->comparator(filter->flt_stack[nstack-2],filter->flt_stack[nstack-1],TOK_NE,line);
+            else if ( is_str==2 )
+                is_true = cmp_vector_strings(filter->flt_stack[nstack-2],filter->flt_stack[nstack-1],TOK_NE);
+            else if ( is_str==1 )
+                error("Comparing string to numeric value: %s\n", filter->str);
+            else
+                CMP_VECTORS(filter->flt_stack[nstack-2],filter->flt_stack[nstack-1],!=,is_true);
+        }
+        else if ( filter->filters[i].tok_type == TOK_LIKE || filter->filters[i].tok_type == TOK_NLIKE )
+        {
+            if ( is_str==2 )
+            {
+                is_true = regex_vector_strings(filter->flt_stack[nstack-2],filter->flt_stack[nstack-1]);
+                if ( filter->filters[i].tok_type == TOK_NLIKE ) is_true = is_true ? 0 : 1;
+            }
+            else
+                error("The regex operator can be used on strings only: %s\n", filter->str);
+        }
+        else if ( is_str>0 )
+            error("Wrong operator in string comparison: %s [%s,%s]\n", filter->str, filter->flt_stack[nstack-1]->str_value, filter->flt_stack[nstack-2]->str_value);
+        else if ( filter->filters[i].tok_type == TOK_LE )
+            CMP_VECTORS(filter->flt_stack[nstack-2],filter->flt_stack[nstack-1],<=,is_true)
+        else if ( filter->filters[i].tok_type == TOK_LT )
+            CMP_VECTORS(filter->flt_stack[nstack-2],filter->flt_stack[nstack-1],<,is_true)
+        else if ( filter->filters[i].tok_type == TOK_BT )
+            CMP_VECTORS(filter->flt_stack[nstack-2],filter->flt_stack[nstack-1],>,is_true)
+        else if ( filter->filters[i].tok_type == TOK_BE )
+            CMP_VECTORS(filter->flt_stack[nstack-2],filter->flt_stack[nstack-1],>=,is_true)
+        else
+            error("FIXME: did not expect this .. tok_type %d = %d\n", i, filter->filters[i].tok_type);
+
+        filter->flt_stack[nstack-2]->pass_site = is_true;
+        nstack--;
+    }
+    if ( nstack>1 ) error("Error occurred while processing the filter \"%s\" (2:%d)\n", filter->str,nstack);    // too few values left on the stack
+    if ( samples )
+    {
+        *samples = filter->max_unpack&BCF_UN_FMT ? filter->flt_stack[0]->pass_samples : NULL;
+        if ( *samples && !filter->flt_stack[0]->nsamples )
+        {
+            for (i=0; i<filter->nsamples; i++)
+                filter->flt_stack[0]->pass_samples[i] = filter->flt_stack[0]->pass_site;
+        }
+    }
+    return filter->flt_stack[0]->pass_site;
+}
+
diff --git a/filter.h b/filter.h
new file mode 100644
index 0000000..132ef31
--- /dev/null
+++ b/filter.h
@@ -0,0 +1,51 @@
+/*  filter.h -- filter expressions.
+
+    Copyright (C) 2013-2014 Genome Research Ltd.
+
+    Author: Petr Danecek <pd3 at sanger.ac.uk>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.  */
+
+#ifndef __FILTER_H__
+#define __FILTER_H__
+
+#include <htslib/vcf.h>
+
+typedef struct _filter_t filter_t;
+
+/**
+  *  @hdr:  BCF header file
+  *  @str:  see the bcftools filter command help for description
+  */
+filter_t *filter_init(bcf_hdr_t *hdr, const char *str);
+
+void filter_destroy(filter_t *filter);
+
+/**
+  *  filter_test() - test whether the BCF record passes the test
+  *  @samples:  if not NULL, a pointer to an array with samples statuses is
+  *             stored in the location referenced by @samples. The pointer
+  *             will be set to NULL if the FORMAT fields were not queried.
+  *  Returns 1 if the expression is true and 0 if false.
+  */
+int filter_test(filter_t *filter, bcf1_t *rec, const uint8_t **samples);
+
+void filter_expression_info(FILE *fp);
+
+#endif
diff --git a/gvcf.c b/gvcf.c
new file mode 100644
index 0000000..bba5df7
--- /dev/null
+++ b/gvcf.c
@@ -0,0 +1,89 @@
+/*  gvcf.c -- support for gVCF files.
+
+    Copyright (C) 2014 Genome Research Ltd.
+
+    Author: Petr Danecek <pd3 at sanger.ac.uk>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.  */
+
+#include "call.h"
+
+void gvcf_write(htsFile *fh, gvcf_t *gvcf, bcf_hdr_t *hdr, bcf1_t *rec, int is_ref)
+{
+    int i, ret, nsmpl = bcf_hdr_nsamples(hdr);
+
+    // Flush gVCF block if chr changed, non-ref call encountered, depth is too
+    // low, or no more records to come
+    if ( rec && is_ref )
+    {
+        bcf_unpack(rec, BCF_UN_ALL);
+
+        // per-sample depth
+        ret = bcf_get_format_int32(hdr, rec, "DP", &gvcf->dp, &gvcf->mdp);
+        if ( ret==nsmpl )
+        {
+            for (i=0; i<nsmpl; i++)
+                if ( gvcf->dp[i] < gvcf->min_dp ) break;
+            if ( i<nsmpl )
+            {
+                is_ref = 0;  // the depth is too low
+                rec = NULL;
+            }
+        }
+    }
+
+    if ( gvcf->rid!=-1 && (!rec || gvcf->rid!=rec->rid || !is_ref || rec->pos > gvcf->end+1) )
+    {
+        // mpileup can output two records with the same position, SNP and
+        // indel. Make sure the end position does not include the non-variant
+        // SNP position just before the indel.
+        if ( rec && rec->rid==gvcf->rid && rec->pos==gvcf->end ) gvcf->end--;
+
+        gvcf->end++;    // from 0-based to 1-based coordinate
+
+        bcf_clear1(gvcf->line);
+        gvcf->line->rid  = gvcf->rid;
+        gvcf->line->pos  = gvcf->start;
+        gvcf->line->rlen = gvcf->end - gvcf->start;
+        bcf_update_alleles_str(hdr, gvcf->line, gvcf->ref);
+        bcf_update_info_int32(hdr, gvcf->line, "END", &gvcf->end, 1);
+        bcf_update_genotypes(hdr, gvcf->line, gvcf->gt, nsmpl*2);
+        bcf_write1(fh, hdr, gvcf->line);
+
+        gvcf->rid = -1;
+    }
+
+    if ( !rec ) return;
+
+    if ( is_ref )
+    {
+        if ( gvcf->rid==-1 )
+        {
+            gvcf->rid    = rec->rid;
+            gvcf->start  = rec->pos;
+            gvcf->ref[0] = rec->d.allele[0][0];
+            gvcf->ref[1] = 0;
+        }
+        gvcf->end = rec->pos;
+        return;
+    }
+
+    bcf_write1(fh, hdr, rec);
+}
+
diff --git a/khash_str2str.h b/khash_str2str.h
new file mode 100644
index 0000000..ecf4e0b
--- /dev/null
+++ b/khash_str2str.h
@@ -0,0 +1,89 @@
+/*  khash_str2str.h -- C-string to C-string hash table.
+
+    Copyright (C) 2014 Genome Research Ltd.
+
+    Author: Petr Danecek <pd3 at sanger.ac.uk>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.  */
+
+#ifndef KHASH_STR2STR_H
+#define KHASH_STR2STR_H
+
+#include <htslib/khash.h>
+
+KHASH_MAP_INIT_STR(str2str, const char*)
+
+/*
+ *  Wrappers for khash dictionaries used by mpileup.
+ */
+
+static inline void *khash_str2str_init(void)
+{
+    return kh_init(str2str);
+}
+
+/*
+ *  Destroy the hash structure, but not the keys
+ */
+static inline void khash_str2str_destroy(void *_hash)
+{
+    khash_t(str2str) *hash = (khash_t(str2str)*)_hash;
+    if (hash) kh_destroy(str2str, hash); // Note that strings are not freed.
+}
+
+/*
+ *  Destroys both the hash structure and the keys
+ */
+static inline void khash_str2str_destroy_free(void *_hash)
+{
+    khash_t(str2str) *hash = (khash_t(str2str)*)_hash;
+    khint_t k;
+    if (hash == 0) return;
+    for (k = 0; k < kh_end(hash); ++k)
+        if (kh_exist(hash, k)) free((char*)kh_key(hash, k));
+    kh_destroy(str2str, hash);
+}
+
+/*
+ *  Returns value if key exists or NULL if not
+ */
+static inline char *khash_str2str_get(void *_hash, const char *str)
+{
+    khash_t(str2str) *hash = (khash_t(str2str)*)_hash;
+    khint_t k = kh_get(str2str, hash, str);
+    if ( k == kh_end(hash) ) return NULL;
+    return (char*)kh_val(hash, k);
+}
+
+/*
+ *  Set a new key,value pair. On success returns the bin index, on
+ *  error -1 is returned.
+ */
+static inline int khash_str2str_set(void *_hash, const char *str, const char *value)
+{
+    khint_t k;
+    int ret;
+    khash_t(str2str) *hash = (khash_t(str2str)*)_hash;
+    if ( !hash ) return -1;
+    k = kh_put(str2str, hash, str, &ret);
+    kh_val(hash,k) = value;
+    return k;
+}
+
+#endif
diff --git a/kmin.c b/kmin.c
new file mode 100644
index 0000000..5b8193b
--- /dev/null
+++ b/kmin.c
@@ -0,0 +1,209 @@
+/* The MIT License
+
+   Copyright (c) 2008, 2010 by Attractive Chaos <attractor at live.co.uk>
+
+   Permission is hereby granted, free of charge, to any person obtaining
+   a copy of this software and associated documentation files (the
+   "Software"), to deal in the Software without restriction, including
+   without limitation the rights to use, copy, modify, merge, publish,
+   distribute, sublicense, and/or sell copies of the Software, and to
+   permit persons to whom the Software is furnished to do so, subject to
+   the following conditions:
+
+   The above copyright notice and this permission notice shall be
+   included in all copies or substantial portions of the Software.
+
+   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+   NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+   BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+   ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+   CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+   SOFTWARE.
+*/
+
+/* Hooke-Jeeves algorithm for nonlinear minimization
+ 
+   Based on the pseudocodes by Bell and Pike (CACM 9(9):684-685), and
+   the revision by Tomlin and Smith (CACM 12(11):637-638). Both of the
+   papers are comments on Kaupe's Algorithm 178 "Direct Search" (ACM
+   6(6):313-314). The original algorithm was designed by Hooke and
+   Jeeves (ACM 8:212-229). This program is further revised according to
+   Johnson's implementation at Netlib (opt/hooke.c).
+ 
+   Hooke-Jeeves algorithm is very simple and it works quite well on a
+   few examples. However, it might fail to converge due to its heuristic
+   nature. A possible improvement, as is suggested by Johnson, may be to
+   choose a small r at the beginning to quickly approach to the minimum
+   and a large r at later step to hit the minimum.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include "kmin.h"
+
+static double __kmin_hj_aux(kmin_f func, int n, double *x1, void *data, double fx1, double *dx, int *n_calls)
+{
+	int k, j = *n_calls;
+	double ftmp;
+	for (k = 0; k != n; ++k) {
+		x1[k] += dx[k];
+		ftmp = func(n, x1, data); ++j;
+		if (ftmp < fx1) fx1 = ftmp;
+		else { /* search the opposite direction */
+			dx[k] = 0.0 - dx[k];
+			x1[k] += dx[k] + dx[k];
+			ftmp = func(n, x1, data); ++j;
+			if (ftmp < fx1) fx1 = ftmp;
+			else x1[k] -= dx[k]; /* back to the original x[k] */
+		}
+	}
+	*n_calls = j;
+	return fx1; /* here: fx1=f(n,x1) */
+}
+
+double kmin_hj(kmin_f func, int n, double *x, void *data, double r, double eps, int max_calls)
+{
+	double fx, fx1, *x1, *dx, radius;
+	int k, n_calls = 0;
+	x1 = (double*)calloc(n, sizeof(double));
+	dx = (double*)calloc(n, sizeof(double));
+	for (k = 0; k != n; ++k) { /* initial directions, based on MGJ */
+		dx[k] = fabs(x[k]) * r;
+		if (dx[k] == 0) dx[k] = r;
+	}
+	radius = r;
+	fx1 = fx = func(n, x, data); ++n_calls;
+	for (;;) {
+		memcpy(x1, x, n * sizeof(double)); /* x1 = x */
+		fx1 = __kmin_hj_aux(func, n, x1, data, fx, dx, &n_calls);
+		while (fx1 < fx) {
+			for (k = 0; k != n; ++k) {
+				double t = x[k];
+				dx[k] = x1[k] > x[k]? fabs(dx[k]) : 0.0 - fabs(dx[k]);
+				x[k] = x1[k];
+				x1[k] = x1[k] + x1[k] - t;
+			}
+			fx = fx1;
+			if (n_calls >= max_calls) break;
+			fx1 = func(n, x1, data); ++n_calls;
+			fx1 = __kmin_hj_aux(func, n, x1, data, fx1, dx, &n_calls);
+			if (fx1 >= fx) break;
+			for (k = 0; k != n; ++k)
+				if (fabs(x1[k] - x[k]) > .5 * fabs(dx[k])) break;
+			if (k == n) break;
+		}
+		if (radius >= eps) {
+			if (n_calls >= max_calls) break;
+			radius *= r;
+			for (k = 0; k != n; ++k) dx[k] *= r;
+		} else break; /* converge */
+	}
+	free(x1); free(dx);
+	return fx1;
+}
+
+// I copied this function somewhere several years ago with some of my modifications, but I forgot the source.
+double kmin_brent(kmin1_f func, double a, double b, void *data, double tol, double *xmin)
+{
+	double bound, u, r, q, fu, tmp, fa, fb, fc, c;
+	const double gold1 = 1.6180339887;
+	const double gold2 = 0.3819660113;
+	const double tiny = 1e-20;
+	const int max_iter = 100;
+
+	double e, d, w, v, mid, tol1, tol2, p, eold, fv, fw;
+	int iter;
+
+	fa = func(a, data); fb = func(b, data);
+	if (fb > fa) { // swap, such that f(a) > f(b)
+		tmp = a; a = b; b = tmp;
+		tmp = fa; fa = fb; fb = tmp;
+	}
+	c = b + gold1 * (b - a), fc = func(c, data); // golden section extrapolation
+	while (fb > fc) {
+		bound = b + 100.0 * (c - b); // the farthest point where we want to go
+		r = (b - a) * (fb - fc);
+		q = (b - c) * (fb - fa);
+		if (fabs(q - r) < tiny) { // avoid 0 denominator
+			tmp = q > r? tiny : 0.0 - tiny;
+		} else tmp = q - r;
+		u = b - ((b - c) * q - (b - a) * r) / (2.0 * tmp); // u is the parabolic extrapolation point
+		if ((b > u && u > c) || (b < u && u < c)) { // u lies between b and c
+			fu = func(u, data);
+			if (fu < fc) { // (b,u,c) bracket the minimum
+				a = b; b = u; fa = fb; fb = fu;
+				break;
+			} else if (fu > fb) { // (a,b,u) bracket the minimum
+				c = u; fc = fu;
+				break;
+			}
+			u = c + gold1 * (c - b); fu = func(u, data); // golden section extrapolation
+		} else if ((c > u && u > bound) || (c < u && u < bound)) { // u lies between c and bound
+			fu = func(u, data);
+			if (fu < fc) { // fb > fc > fu
+				b = c; c = u; u = c + gold1 * (c - b);
+				fb = fc; fc = fu; fu = func(u, data);
+			} else { // (b,c,u) bracket the minimum
+				a = b; b = c; c = u;
+				fa = fb; fb = fc; fc = fu;
+				break;
+			}
+		} else if ((u > bound && bound > c) || (u < bound && bound < c)) { // u goes beyond the bound
+			u = bound; fu = func(u, data);
+		} else { // u goes the other way around, use golden section extrapolation
+			u = c + gold1 * (c - b); fu = func(u, data);
+		}
+		a = b; b = c; c = u;
+		fa = fb; fb = fc; fc = fu;
+	}
+	if (a > c) u = a, a = c, c = u; // swap
+
+	// now, a<b<c, fa>fb and fb<fc, move on to Brent's algorithm
+	e = d = 0.0;
+	w = v = b; fv = fw = fb;
+	for (iter = 0; iter != max_iter; ++iter) {
+		mid = 0.5 * (a + c);
+		tol2 = 2.0 * (tol1 = tol * fabs(b) + tiny);
+		if (fabs(b - mid) <= (tol2 - 0.5 * (c - a))) {
+			*xmin = b; return fb; // found
+		}
+		if (fabs(e) > tol1) {
+			// related to parabolic interpolation
+			r = (b - w) * (fb - fv);
+			q = (b - v) * (fb - fw);
+			p = (b - v) * q - (b - w) * r;
+			q = 2.0 * (q - r);
+			if (q > 0.0) p = 0.0 - p;
+			else q = 0.0 - q;
+			eold = e; e = d;
+			if (fabs(p) >= fabs(0.5 * q * eold) || p <= q * (a - b) || p >= q * (c - b)) {
+				d = gold2 * (e = (b >= mid ? a - b : c - b));
+			} else {
+				d = p / q; u = b + d; // actual parabolic interpolation happens here
+				if (u - a < tol2 || c - u < tol2)
+					d = (mid > b)? tol1 : 0.0 - tol1;
+			}
+		} else d = gold2 * (e = (b >= mid ? a - b : c - b)); // golden section interpolation
+		u = fabs(d) >= tol1 ? b + d : b + (d > 0.0? tol1 : -tol1);
+		fu = func(u, data);
+		if (fu <= fb) { // u is the minimum point so far
+			if (u >= b) a = b;
+			else c = b;
+			v = w; w = b; b = u; fv = fw; fw = fb; fb = fu;
+		} else { // adjust (a,c) and (u,v,w)
+			if (u < b) a = u;
+			else c = u;
+			if (fu <= fw || w == b) {
+				v = w; w = u;
+				fv = fw; fw = fu;
+			} else if (fu <= fv || v == b || v == w) {
+				v = u; fv = fu;
+			}
+		}
+	}
+	*xmin = b;
+	return fb;
+}
diff --git a/kmin.h b/kmin.h
new file mode 100644
index 0000000..6feba45
--- /dev/null
+++ b/kmin.h
@@ -0,0 +1,46 @@
+/*
+   Copyright (c) 2008, 2010 by Attractive Chaos <attractor at live.co.uk>
+
+   Permission is hereby granted, free of charge, to any person obtaining
+   a copy of this software and associated documentation files (the
+   "Software"), to deal in the Software without restriction, including
+   without limitation the rights to use, copy, modify, merge, publish,
+   distribute, sublicense, and/or sell copies of the Software, and to
+   permit persons to whom the Software is furnished to do so, subject to
+   the following conditions:
+
+   The above copyright notice and this permission notice shall be
+   included in all copies or substantial portions of the Software.
+
+   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+   NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+   BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+   ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+   CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+   SOFTWARE.
+*/
+
+#ifndef KMIN_H
+#define KMIN_H
+
+#define KMIN_RADIUS  0.5
+#define KMIN_EPS     1e-7
+#define KMIN_MAXCALL 50000
+
+typedef double (*kmin_f)(int, double*, void*);
+typedef double (*kmin1_f)(double, void*);
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+	double kmin_hj(kmin_f func, int n, double *x, void *data, double r, double eps, int max_calls);
+	double kmin_brent(kmin1_f func, double a, double b, void *data, double tol, double *xmin);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/main.c b/main.c
new file mode 100644
index 0000000..98d8ee1
--- /dev/null
+++ b/main.c
@@ -0,0 +1,264 @@
+/*  main.c -- main bcftools command front-end.
+
+    Copyright (C) 2012-2015 Genome Research Ltd.
+
+    Author: Petr Danecek <pd3 at sanger.ac.uk>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.  */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <ctype.h>
+#include <htslib/hts.h>
+#include "version.h"
+#include "bcftools.h"
+
+int main_tabix(int argc, char *argv[]);
+int main_vcfindex(int argc, char *argv[]);
+int main_vcfstats(int argc, char *argv[]);
+int main_vcfisec(int argc, char *argv[]);
+int main_vcfmerge(int argc, char *argv[]);
+int main_vcfquery(int argc, char *argv[]);
+int main_vcffilter(int argc, char *argv[]);
+int main_vcfsom(int argc, char *argv[]);
+int main_vcfnorm(int argc, char *argv[]);
+int main_vcfgtcheck(int argc, char *argv[]);
+int main_vcfview(int argc, char *argv[]);
+int main_vcfcall(int argc, char *argv[]);
+int main_vcfannotate(int argc, char *argv[]);
+int main_vcfroh(int argc, char *argv[]);
+int main_vcfconcat(int argc, char *argv[]);
+int main_reheader(int argc, char *argv[]);
+int main_vcfconvert(int argc, char *argv[]);
+int main_vcfcnv(int argc, char *argv[]);
+#if USE_GPL
+int main_polysomy(int argc, char *argv[]);
+#endif
+int main_plugin(int argc, char *argv[]);
+int main_consensus(int argc, char *argv[]);
+
+typedef struct
+{
+    int (*func)(int, char*[]);
+    const char *alias, *help;
+}
+cmd_t;
+
+static cmd_t cmds[] =
+{
+    { .func  = NULL,
+      .alias = "Indexing",
+      .help  = NULL
+    },
+    { .func = main_vcfindex,
+      .alias = "index",
+      .help = "index VCF/BCF files"
+    },
+    { .func = main_tabix,
+      .alias = "tabix",
+      .help = "-tabix for BGZF'd BED, GFF, SAM, VCF and more" // do not advertise; only keep here for testing
+    },
+
+    { .func  = NULL,
+      .alias = "VCF/BCF manipulation",
+      .help  = NULL
+    },
+
+    { .func  = main_vcfannotate,
+      .alias = "annotate",
+      .help  = "annotate and edit VCF/BCF files",
+    },
+    { .func  = main_vcfconcat,
+      .alias = "concat",
+      .help  = "concatenate VCF/BCF files from the same set of samples"
+    },
+    { .func  = main_vcfconvert,
+      .alias = "convert",
+      .help  = "convert VCF/BCF files to different formats and back"
+    },
+    { .func  = main_vcfisec,
+      .alias = "isec",
+      .help  = "intersections of VCF/BCF files"
+    },
+    { .func  = main_vcfmerge,
+      .alias = "merge",
+      .help  = "merge VCF/BCF files files from non-overlapping sample sets"
+    },
+    { .func  = main_vcfnorm,
+      .alias = "norm",
+      .help  = "left-align and normalize indels"
+    },
+    { .func  = main_plugin,
+      .alias = "plugin",
+      .help  = "user-defined plugins"
+    },
+    { .func  = main_vcfquery,
+      .alias = "query",
+      .help  = "transform VCF/BCF into user-defined formats"
+    },
+    { .func  = main_reheader,
+      .alias = "reheader",
+      .help  = "modify VCF/BCF header, change sample names"
+    },
+    { .func  = main_vcfview,
+      .alias = "view",
+      .help  = "VCF/BCF conversion, view, subset and filter VCF/BCF files"
+    },
+
+    { .func  = NULL,
+      .alias = "VCF/BCF analysis",
+      .help  = NULL
+    },
+
+    { .func  = main_vcfcall,
+      .alias = "call",
+      .help  = "SNP/indel calling"
+    },
+    { .func  = main_consensus,
+      .alias = "consensus",
+      .help  = "create consensus sequence by applying VCF variants"
+    },
+    { .func  = main_vcfcnv,
+      .alias = "cnv",
+      .help  = "-HMM CNV calling"    // do not advertise yet
+    },
+    { .func  = main_vcffilter,
+      .alias = "filter",
+      .help  = "filter VCF/BCF files using fixed thresholds"
+    },
+    { .func  = main_vcfgtcheck,
+      .alias = "gtcheck",
+      .help  = "check sample concordance, detect sample swaps and contamination"
+    },
+#if USE_GPL
+    { .func  = main_polysomy,
+      .alias = "polysomy",
+      .help  = "-detect number of chromosomal copies",
+    },
+#endif
+    { .func  = main_vcfroh,
+      .alias = "roh",
+      .help  = "identify runs of autozygosity (HMM)",
+    },
+    { .func  = main_vcfstats,
+      .alias = "stats",
+      .help  = "produce VCF/BCF stats"
+    },
+
+    { .func  = main_vcfsom,
+      .alias = "som",
+      .help  = "-filter using Self-Organized Maps (experimental)"   // do not advertise
+
+    },
+    { .func  = NULL,
+      .alias = NULL,
+      .help  = NULL
+    }
+};
+
+char *bcftools_version(void)
+{
+    return BCFTOOLS_VERSION;
+}
+
+static void usage(FILE *fp)
+{
+    fprintf(fp, "\n");
+    fprintf(fp, "Program: bcftools (Tools for variant calling and manipulating VCFs and BCFs)\n");
+#if USE_GPL
+    fprintf(fp, "License: GNU GPLv3+, due to use of the GNU Scientific Library\n");
+#endif
+    fprintf(fp, "Version: %s (using htslib %s)\n", bcftools_version(), hts_version());
+    fprintf(fp, "\n");
+    fprintf(fp, "Usage:   bcftools <command> <argument>\n");
+    fprintf(fp, "\n");
+    fprintf(fp, "Commands:\n");
+
+    int i = 0;
+    const char *sep = NULL;
+    while (cmds[i].alias)
+    {
+        if ( !cmds[i].func ) sep = cmds[i].alias;
+        if ( sep )
+        {
+            fprintf(fp, "\n -- %s\n", sep);
+            sep = NULL;
+        }
+        if ( cmds[i].func && cmds[i].help[0]!='-' ) fprintf(fp, "    %-12s %s\n", cmds[i].alias, cmds[i].help);
+        i++;
+    }
+    fprintf(fp,"\n");
+    fprintf(fp,
+            " Most commands accept VCF, bgzipped VCF, and BCF with the file type detected\n"
+            " automatically even when streaming from a pipe. Indexed VCF and BCF will work\n"
+            " in all situations. Un-indexed VCF and BCF and streams will work in most but\n"
+            " not all situations.\n");
+    fprintf(fp,"\n");
+}
+
+int main(int argc, char *argv[])
+{
+    if (argc < 2) { usage(stderr); return 1; }
+
+    if (strcmp(argv[1], "version") == 0 || strcmp(argv[1], "--version") == 0 || strcmp(argv[1], "-v") == 0) {
+        printf("bcftools %s\nUsing htslib %s\nCopyright (C) 2015 Genome Research Ltd.\n", bcftools_version(), hts_version());
+#if USE_GPL
+        printf("License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n");
+#else
+        printf("License Expat: The MIT/Expat license\n");
+#endif
+        printf("This is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law.\n");
+        return 0;
+    }
+    else if (strcmp(argv[1], "--version-only") == 0) {
+        printf("%s+htslib-%s\n", bcftools_version(), hts_version());
+        return 0;
+    }
+    else if (strcmp(argv[1], "help") == 0 || strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-h") == 0) {
+        if (argc == 2) { usage(stdout); return 0; }
+        // Otherwise change "bcftools help COMMAND [...]" to "bcftools COMMAND";
+        // main_xyz() functions by convention display the subcommand's usage
+        // when invoked without any arguments.
+        argv++;
+        argc = 2;
+    }
+    else if ( argv[1][0]=='+' )
+    {
+        // "bcftools plugin name" can be run as "bcftools +name"
+        argv[1]++;
+        argv[0] = "plugin";
+        argv--;
+        argc++;
+    }
+
+    int i = 0;
+    while (cmds[i].alias)
+    {
+        if (cmds[i].func && strcmp(argv[1],cmds[i].alias)==0)
+        {
+            return cmds[i].func(argc-1,argv+1);
+        }
+        i++;
+    }
+    fprintf(stderr, "[E::%s] unrecognized command '%s'\n", __func__, argv[1]);
+    return 1;
+}
+
diff --git a/mcall.c b/mcall.c
new file mode 100644
index 0000000..a6096d8
--- /dev/null
+++ b/mcall.c
@@ -0,0 +1,1491 @@
+/*  mcall.c -- multiallelic and rare variant calling.
+
+    Copyright (C) 2012-2014 Genome Research Ltd.
+
+    Author: Petr Danecek <pd3 at sanger.ac.uk>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.  */
+
+#include <math.h>
+#include <htslib/kfunc.h>
+#include "call.h"
+
+// Using priors for GTs does not seem to be mathematically justified. Although
+// it seems effective in removing false calls, it also flips a significant
+// proportion of HET genotypes. Better is to filter by FORMAT/GQ using
+// `bcftools filter`.
+#define USE_PRIOR_FOR_GTS 0
+
+// Go with uniform PLs for samples with no coverage. If unset, missing
+// genotypes is reported instead.
+#define FLAT_PDG_FOR_MISSING 0
+
+// Estimate QS (combined quality and allele frequencies) from PLs
+#define QS_FROM_PDG 0
+
+
+void qcall_init(call_t *call) { return; }
+void qcall_destroy(call_t *call) { return; }
+int qcall(call_t *call, bcf1_t *rec)
+{
+    // QCall format:
+    //  chromosome, position, reference allele, depth, mapping quality, 0, ..
+    error("TODO: qcall output\n");
+    return 0;
+}
+
+void call_init_pl2p(call_t *call)
+{
+    int i;
+    for (i=0; i<256; i++)
+        call->pl2p[i] = pow(10., -i/10.);
+}
+
+// Macros for accessing call->trio and call->ntrio
+#define FTYPE_222 0     // family type: all diploid
+#define FTYPE_121 1     // chrX, the child is a boy
+#define FTYPE_122 2     // chrX, a girl
+#define FTYPE_101 3     // chrY, boy
+#define FTYPE_100 4     // chrY, girl
+
+#define GT_SKIP 0xf     // empty genotype (chrY in females)
+
+#define IS_POW2(x) (!((x) & ((x) - 1)))    // zero is permitted
+#define IS_HOM(x)  IS_POW2(x)
+
+// Pkij = P(k|i,j) tells how likely it is to be a het if the parents
+// are homs etc. The consistency of i,j,k has been already checked.
+// Parameters are alleles and ploidy of father, mother, kid
+// Returns 2/Pkij.
+int calc_Pkij(int fals, int mals, int kals, int fpl, int mpl, int kpl)
+{
+    int als = fals|mals|kals;
+    if ( IS_HOM(als) ) return 2;    // all are the same: child must be a HOM, P=1
+
+    if ( fpl==1 )
+    {
+        if ( kpl==1 )   // chr X, the child is a boy, the copy is inherited from the mother
+        {
+            if ( IS_HOM(mals) ) return 2;   // 0 11 -> P(1) = 1
+            return 4;                       // 0 01 -> P(0) = P(1) = 1/2
+        }
+        // chr X, the child is a girl
+        if ( IS_HOM(mals) ) return 2;       // 0 11 -> P(01) = 1
+        return 4;                           // 0 01 -> P(00) = P(01) = 1/2
+    }
+
+    if ( IS_HOM(fals) && IS_HOM(mals) ) return 2;   // 00 11 01, the child must be a HET, P=1
+    if ( !IS_HOM(fals) && !IS_HOM(mals) )
+    {
+        if ( IS_HOM(kals) ) return 8;   // 01 01 00 or 01 01 11, P(k=HOM) = 1/4
+        return 4;                       // 01 01 01, P(k=HET) = 1/2
+    }
+    return 4;   // 00 01, P(k=HET) = P(k=HOM) = 1/2
+}
+
+// Initialize ntrio and trio: ntrio lists the number of possible
+// genotypes given combination of haploid/diploid genomes and the
+// number of alleles. trio lists allowed genotype combinations:
+//      4bit: 2/Pkij, 4: father, 4: mother, 4: child
+// See also mcall_call_trio_genotypes()
+//
+static void mcall_init_trios(call_t *call)
+{
+    // 23, 138, 478 possible diploid trio genotypes with 2, 3, 4 alleles
+    call->ntrio[FTYPE_222][2] = 15; call->ntrio[FTYPE_222][3] = 78;  call->ntrio[FTYPE_222][4] = 250;
+    call->ntrio[FTYPE_121][2] = 8;  call->ntrio[FTYPE_121][3] = 27;  call->ntrio[FTYPE_121][4] = 64;
+    call->ntrio[FTYPE_122][2] = 8;  call->ntrio[FTYPE_122][3] = 27;  call->ntrio[FTYPE_122][4] = 64;
+    call->ntrio[FTYPE_101][2] = 2;  call->ntrio[FTYPE_101][3] = 3;   call->ntrio[FTYPE_101][4] = 4;
+    call->ntrio[FTYPE_100][2] = 2;  call->ntrio[FTYPE_100][3] = 3;   call->ntrio[FTYPE_100][4] = 4;
+
+    int nals, itype;
+    for (itype=0; itype<=4; itype++)
+    {
+        for (nals=2; nals<=4; nals++)
+            call->trio[itype][nals] = (uint16_t*) malloc(sizeof(uint16_t)*call->ntrio[itype][nals]);
+    }
+
+    // max 10 possible diploid genotypes
+    int gts[10];
+    for (nals=2; nals<=4; nals++)
+    {
+        int i,j,k, n = 0, ngts = 0;
+        for (i=0; i<nals; i++)
+            for (j=0; j<=i; j++)
+                gts[ngts++] = 1<<i | 1<<j;
+
+        // 222: all diploid
+        // i,j,k: father, mother, child
+        for (i=0; i<ngts; i++)
+            for (j=0; j<ngts; j++)
+                for (k=0; k<ngts; k++)
+                {
+                    if ( ((gts[i]|gts[j])&gts[k]) != gts[k] ) continue;             // k not present in neither i nor j
+                    if ( !(gts[i] & gts[k]) || !(gts[j] & gts[k]) ) continue;       // one copy from father, one from mother
+                    int Pkij = calc_Pkij(gts[i],gts[j],gts[k], 2,2,2);
+                    call->trio[FTYPE_222][nals][n++] = Pkij<<12 | i<<8 | j<<4 | k;  // father, mother, child
+                }
+        assert( n==call->ntrio[FTYPE_222][nals] );
+
+        // 121: chrX, boy
+        n = 0;
+        for (i=0; i<ngts; i++)
+            for (j=0; j<ngts; j++)
+                for (k=0; k<ngts; k++)
+                {
+                    if ( !IS_HOM(gts[i]) || !IS_HOM(gts[k]) ) continue;   // father nor boy can be diploid
+                    if ( ((gts[i]|gts[j])&gts[k]) != gts[k] ) continue;
+                    if ( !(gts[j] & gts[k]) ) continue;     // boy must inherit the copy from mother
+                    int Pkij = calc_Pkij(gts[i],gts[j],gts[k], 1,2,1);
+                    call->trio[FTYPE_121][nals][n++] = Pkij<<12 | i<<8 | j<<4 | k;
+                }
+        assert( n==call->ntrio[FTYPE_121][nals] );
+
+        // 122: chrX, girl
+        n = 0;
+        for (i=0; i<ngts; i++)
+            for (j=0; j<ngts; j++)
+                for (k=0; k<ngts; k++)
+                {
+                    if ( !IS_HOM(gts[i]) ) continue;
+                    if ( ((gts[i]|gts[j])&gts[k]) != gts[k] ) continue;
+                    if ( !(gts[i] & gts[k]) ) continue;     // girl must inherit one copy from the father and one from the mother
+                    if ( !(gts[j] & gts[k]) ) continue;
+                    int Pkij = calc_Pkij(gts[i],gts[j],gts[k], 1,2,2);
+                    call->trio[FTYPE_122][nals][n++] = Pkij<<12 | i<<8 | j<<4 | k;
+                }
+        assert( n==call->ntrio[FTYPE_122][nals] );
+
+        // 101: chrY, boy
+        n = 0;
+        for (i=0; i<ngts; i++)
+            for (k=0; k<ngts; k++)
+            {
+                if ( !IS_HOM(gts[i]) || !IS_HOM(gts[k]) ) continue;
+                if ( (gts[i]&gts[k]) != gts[k] ) continue;
+                call->trio[FTYPE_101][nals][n++] = 1<<12 | i<<8 | GT_SKIP<<4 | k;
+            }
+        assert( n==call->ntrio[FTYPE_101][nals] );
+
+        // 100: chrY, girl
+        n = 0;
+        for (i=0; i<ngts; i++)
+        {
+            if ( !IS_POW2(gts[i]) ) continue;
+            call->trio[FTYPE_100][nals][n++] = 1<<12 | i<<8 | GT_SKIP<<4 | GT_SKIP;
+        }
+        assert( n==call->ntrio[FTYPE_100][nals] );
+
+    }
+    call->GLs = (double*) calloc(bcf_hdr_nsamples(call->hdr)*10,sizeof(double));
+
+    int i, j;
+    for (i=0; i<call->nfams; i++)
+    {
+        family_t *fam = &call->fams[i];
+        int ploidy[3];
+        for (j=0; j<3; j++)
+            ploidy[j] = call->ploidy[fam->sample[j]];
+
+        if ( ploidy[FATHER]==2 )    // not X, not Y
+        {
+            if ( ploidy[MOTHER]!=2 || ploidy[CHILD]!=2 )
+                error("Incorrect ploidy: %d %d %d\n", ploidy[FATHER],ploidy[MOTHER],ploidy[CHILD]);
+            fam->type = FTYPE_222;
+            continue;
+        }
+        if ( ploidy[FATHER]!=1 || ploidy[MOTHER]==1 )
+                error("Incorrect ploidy: %d %d %d\n", ploidy[FATHER],ploidy[MOTHER],ploidy[CHILD]);
+        if ( ploidy[MOTHER]==2 )    // X
+        {
+            if ( ploidy[CHILD]==0 )
+                error("Incorrect ploidy: %d %d %d\n", ploidy[FATHER],ploidy[MOTHER],ploidy[CHILD]);
+            fam->type = ploidy[CHILD]==2 ? FTYPE_122 : FTYPE_121;   // a girl or a boy
+        }
+        else    // Y
+        {
+            if ( ploidy[CHILD]==2 )
+                error("Incorrect ploidy: %d %d %d\n", ploidy[FATHER],ploidy[MOTHER],ploidy[CHILD]);
+            fam->type = ploidy[CHILD]==0 ? FTYPE_100 : FTYPE_101;   // a girl or a boy
+        }
+    }
+}
+static void mcall_destroy_trios(call_t *call)
+{
+    int i, j;
+    for (i=2; i<=4; i++)
+        for (j=0; j<=4; j++)
+            free(call->trio[j][i]);
+}
+
+void mcall_init(call_t *call)
+{
+    call_init_pl2p(call);
+
+    call->nqsum = 5;
+    call->qsum  = (float*) malloc(sizeof(float)*call->nqsum); // will be expanded later if ncessary
+    call->nals_map = 5;
+    call->als_map  = (int*) malloc(sizeof(int)*call->nals_map);
+    call->npl_map  = 5*(5+1)/2;     // will be expanded later if necessary
+    call->pl_map   = (int*) malloc(sizeof(int)*call->npl_map);
+    call->gts  = (int32_t*) calloc(bcf_hdr_nsamples(call->hdr)*2,sizeof(int32_t));   // assuming at most diploid everywhere
+
+    if ( call->flag & CALL_CONSTR_TRIO )
+    {
+        call->cgts = (int32_t*) calloc(bcf_hdr_nsamples(call->hdr),sizeof(int32_t));
+        call->ugts = (int32_t*) calloc(bcf_hdr_nsamples(call->hdr),sizeof(int32_t));
+        mcall_init_trios(call);
+        bcf_hdr_append(call->hdr,"##FORMAT=<ID=CGT,Number=1,Type=Integer,Description=\"Constrained Genotype (0-based index to Number=G ordering).\">");
+        bcf_hdr_append(call->hdr,"##FORMAT=<ID=UGT,Number=1,Type=Integer,Description=\"Unconstrained Genotype (0-based index to Number=G ordering).\">");
+    }
+    if ( call->flag & CALL_CONSTR_ALLELES ) call->vcmp = vcmp_init();
+
+    bcf_hdr_append(call->hdr,"##FORMAT=<ID=GT,Number=1,Type=String,Description=\"Genotype\">");
+    if ( call->output_tags & CALL_FMT_GQ )
+        bcf_hdr_append(call->hdr,"##FORMAT=<ID=GQ,Number=1,Type=Integer,Description=\"Phred-scaled Genotype Quality\">");
+    if ( call->output_tags & CALL_FMT_GP )
+        bcf_hdr_append(call->hdr,"##FORMAT=<ID=GP,Number=G,Type=Float,Description=\"Phred-scaled genotype posterior probabilities\">");
+    if ( call->output_tags & (CALL_FMT_GQ|CALL_FMT_GP) )
+        call->GQs = (int32_t*) malloc(sizeof(int32_t)*bcf_hdr_nsamples(call->hdr));
+    bcf_hdr_append(call->hdr,"##INFO=<ID=ICB,Number=1,Type=Float,Description=\"Inbreeding Coefficient Binomial test (bigger is better)\">");
+    bcf_hdr_append(call->hdr,"##INFO=<ID=HOB,Number=1,Type=Float,Description=\"Bias in the number of HOMs number (smaller is better)\">");
+    bcf_hdr_append(call->hdr,"##INFO=<ID=AC,Number=A,Type=Integer,Description=\"Allele count in genotypes for each ALT allele, in the same order as listed\">");
+    bcf_hdr_append(call->hdr,"##INFO=<ID=AN,Number=1,Type=Integer,Description=\"Total number of alleles in called genotypes\">");
+    bcf_hdr_append(call->hdr,"##INFO=<ID=DP4,Number=4,Type=Integer,Description=\"Number of high-quality ref-forward , ref-reverse, alt-forward and alt-reverse bases\">");
+    bcf_hdr_append(call->hdr,"##INFO=<ID=MQ,Number=1,Type=Integer,Description=\"Average mapping quality\">");
+
+    // init the prior
+    if ( call->theta>0 )
+    {
+        int i, n = 0;
+        if ( !call->ploidy ) n = 2*bcf_hdr_nsamples(call->hdr); // all are diploid
+        else
+        {
+            for (i=0; i<bcf_hdr_nsamples(call->hdr); i++)
+                n += call->ploidy[i];
+        }
+        // Watterson factor, here aM_1 = aM_2 = 1
+        double aM = 1;
+        for (i=2; i<n; i++) aM += 1./i;
+        call->theta *= aM;
+        if ( call->theta >= 1 )
+        {
+            fprintf(stderr,"The prior is too big (theta*aM=%.2f), going with 0.99\n", call->theta);
+            call->theta = 0.99;
+        }
+        call->theta = log(call->theta);
+    }
+
+    return;
+}
+
+void mcall_destroy(call_t *call)
+{
+    if (call->vcmp) vcmp_destroy(call->vcmp);
+    free(call->itmp);
+    mcall_destroy_trios(call);
+    free(call->GPs);
+    free(call->GLs);
+    free(call->GQs);
+    free(call->anno16);
+    free(call->PLs);
+    free(call->qsum);
+    free(call->als_map);
+    free(call->pl_map);
+    free(call->gts); free(call->cgts); free(call->ugts);
+    free(call->pdg);
+    free(call->als);
+    return;
+}
+
+
+// Inits P(D|G): convert PLs from log space and normalize. In case of zero
+// depth, missing PLs are all zero. In this case, pdg's are set to 0
+// so that the corresponding genotypes can be set as missing and the
+// qual calculation is not affected.
+// Missing values are replaced by generic likelihoods when X (unseen allele) is
+// present.
+// NB: While the -m callig model uses the pdgs in canonical order,
+// the original samtools -c calling code uses pdgs in reverse order (AA comes
+// first, RR last).
+// NB: Ploidy is not taken into account here, which is incorrect.
+void set_pdg(double *pl2p, int *PLs, double *pdg, int n_smpl, int n_gt, int unseen)
+{
+    int i, j, nals;
+
+    // find out the number of alleles, expecting diploid genotype likelihoods
+    bcf_gt2alleles(n_gt-1, &i, &nals);
+    assert( i==nals );
+    nals++;
+
+    for (i=0; i<n_smpl; i++)
+    {
+        double sum = 0;
+        for (j=0; j<n_gt; j++)
+        {
+            if ( PLs[j]==bcf_int32_vector_end )
+            {
+                // We expect diploid genotype likelihoods. If not diploid, treat as missing
+                j = 0;
+                break;
+            }
+            if ( PLs[j]==bcf_int32_missing ) break;
+            assert( PLs[j]<256 );
+            pdg[j] = pl2p[ PLs[j] ];
+            sum += pdg[j];
+        }
+
+        if ( j==0 )
+        {
+            // First value is missing (LK of RR), this indicates that
+            // all values are missing.
+            j = sum = n_gt;
+        }
+        else if ( j<n_gt && unseen<0 )
+        {
+            // Some of the values are missing and the unseen allele LK is not
+            // available. In such a case, we set LK to a very small value.
+            sum = 0;
+            for (j=0; j<n_gt; j++)
+            {
+                assert( PLs[j]!=bcf_int32_vector_end );
+                if ( PLs[j]==bcf_int32_missing ) PLs[j] = 255;
+                assert( PLs[j]<256 );
+                pdg[j] = pl2p[ PLs[j] ];
+                sum += pdg[j];
+            }
+        }
+        if ( j<n_gt )
+        {
+            // Missing values present, fill with unseen allele LK. This can be only
+            // as good as the merge was.
+            int ia,ib, k;
+            j = 0;
+            sum = 0;
+            for (ia=0; ia<nals; ia++)
+            {
+                for (ib=0; ib<=ia; ib++)
+                {
+                    if ( PLs[j]==bcf_int32_missing )
+                    {
+                        k = bcf_alleles2gt(ia,unseen);
+                        if ( PLs[k]==bcf_int32_missing ) k = bcf_alleles2gt(ib,unseen);
+                        if ( PLs[k]==bcf_int32_missing ) k = bcf_alleles2gt(unseen,unseen);
+                        if ( PLs[k]==bcf_int32_missing )
+                        {
+                            // The PLs for unseen allele X are not present as well as for ia, ib.
+                            // This can happen with incremental calling, when one of the merged
+                            // files had all alleles A,C,G,T, in such a case, X was not present.
+                            // Use a very small value instead.
+                            PLs[j] = 255;
+                        }
+                        else
+                            PLs[j] = PLs[k];
+                    }
+                    pdg[j] = pl2p[ PLs[j] ];
+                    sum += pdg[j];
+                    j++;
+                }
+            }
+        }
+        // Normalize: sum_i pdg_i = 1
+        if ( sum==n_gt )
+        {
+            // all missing
+            #if FLAT_PDG_FOR_MISSING
+                for (j=0; j<n_gt; j++) pdg[j] = 1./n_gt;
+            #else
+                for (j=0; j<n_gt; j++) pdg[j] = 0;
+            #endif
+        }
+        else
+            for (j=0; j<n_gt; j++) pdg[j] /= sum;
+
+        PLs += n_gt;
+        pdg += n_gt;
+    }
+}
+
+/*
+    Allele frequency estimated as:
+        #A  = \sum_i (2*P_AA + P_AB)
+        F_A = #A / ( #A + #B )
+    where i runs across all samples
+*/
+void estimate_qsum(call_t *call, bcf1_t *rec)
+{
+    double *pdg  = call->pdg;
+    int ngts = rec->n_allele*(rec->n_allele+1)/2;
+    int i,nsmpl = bcf_hdr_nsamples(call->hdr);
+
+    hts_expand(float,rec->n_allele,call->nqsum,call->qsum);
+    for (i=0; i<rec->n_allele; i++) call->qsum[i] = 0;
+
+    for (i=0; i<nsmpl; i++)
+    {
+        int a, b, k = 0;
+        for (a=0; a<rec->n_allele; a++)
+        {
+            for (b=0; b<=a; b++)
+            {
+                call->qsum[a] += pdg[k];
+                call->qsum[b] += pdg[k];
+                k++;
+            }
+        }
+        pdg += ngts;
+    }
+    float sum = 0;
+    for (i=0; i<rec->n_allele; i++) sum += call->qsum[i];
+    if ( sum ) for (i=0; i<rec->n_allele; i++) call->qsum[i] /= sum;
+}
+
+// Create mapping between old and new (trimmed) alleles
+void init_allele_trimming_maps(call_t *call, int als, int nals)
+{
+    int i, j;
+
+    // als_map: old(i) -> new(j)
+    for (i=0, j=0; i<nals; i++)
+    {
+        if ( als & 1<<i ) call->als_map[i] = j++;
+        else call->als_map[i] = -1;
+    }
+
+    if ( !call->pl_map ) return;
+
+    // pl_map: new(k) -> old(l)
+    int k = 0, l = 0;
+    for (i=0; i<nals; i++)
+    {
+        for (j=0; j<=i; j++)
+        {
+            if ( (als & 1<<i) && (als & 1<<j) ) call->pl_map[k++] = l;
+            l++;
+        }
+    }
+}
+
+double binom_dist(int N, double p, int k)
+{
+    int mean = (int) (N*p);
+    if ( mean==k ) return 1.0;
+
+    double log_p = (k-mean)*log(p) + (mean-k)*log(1.0-p);
+    if ( k > N - k ) k = N - k;
+    if ( mean > N - mean ) mean = N - mean;
+
+    if ( k < mean ) { int tmp = k; k = mean; mean = tmp; }
+    double diff = k - mean;
+
+    double val = 1.0;
+    int i;
+    for (i=0; i<diff; i++)
+        val = val * (N-mean-i) / (k-i);
+
+    return exp(log_p)/val;
+}
+
+
+// Inbreeding Coefficient, binomial test
+float calc_ICB(int nref, int nalt, int nhets, int ndiploid)
+{
+    if ( !nref || !nalt || !ndiploid ) return HUGE_VAL;
+
+    double fref = (double)nref/(nref+nalt); // fraction of reference allelels
+    double falt = (double)nalt/(nref+nalt); // non-ref als
+    double q = 2*fref*falt;                 // probability of a het, assuming HWE
+    double mean = q*ndiploid;
+
+    //fprintf(stderr,"\np=%e N=%d k=%d  .. nref=%d nalt=%d nhets=%d ndiploid=%d\n", q,ndiploid,nhets, nref,nalt,nhets,ndiploid);
+
+    // Can we use normal approximation? The second condition is for performance only
+    // and is not well justified.
+    if ( (mean>10 && (1-q)*ndiploid>10 ) || ndiploid>200 )
+    {
+        //fprintf(stderr,"out: mean=%e  p=%e\n", mean,exp(-0.5*(nhets-mean)*(nhets-mean)/(mean*(1-q))));
+        return exp(-0.5*(nhets-mean)*(nhets-mean)/(mean*(1-q)));
+    }
+
+    return binom_dist(ndiploid, q, nhets);
+}
+
+float calc_HOB(int nref, int nalt, int nhets, int ndiploid)
+{
+    if ( !nref || !nalt || !ndiploid ) return HUGE_VAL;
+
+    double fref = (double)nref/(nref+nalt); // fraction of reference allelels
+    double falt = (double)nalt/(nref+nalt); // non-ref als
+    return fabs((double)nhets/ndiploid - 2*fref*falt);
+}
+
+/**
+  *  log(sum_i exp(a_i))
+  */
+static inline double logsumexp(double *vals, int nvals)
+{
+    int i;
+    double max_exp = vals[0];
+    for (i=1; i<nvals; i++)
+        if ( max_exp < vals[i] ) max_exp = vals[i];
+
+    double sum = 0;
+    for (i=0; i<nvals; i++)
+        sum += exp(vals[i] - max_exp);
+
+    return log(sum) + max_exp;
+}
+/** log(exp(a)+exp(b)) */
+static inline double logsumexp2(double a, double b)
+{
+    if ( a>b )
+        return log(1 + exp(b-a)) + a;
+    else
+        return log(1 + exp(a-b)) + b;
+}
+
+// Macro to set the most likely alleles
+#define UPDATE_MAX_LKs(als) { \
+     if ( max_lk<lk_tot ) { max_lk = lk_tot; max_als = (als); } \
+     if ( lk_tot_set ) lk_sum = logsumexp2(lk_tot,lk_sum); \
+}
+
+#define SWAP(type_t,x,y) {type_t tmp; tmp = x; x = y; y = tmp; }
+
+// Determine the most likely combination of alleles. In this implementation,
+// at most tri-allelic sites are considered. Returns the number of alleles.
+static int mcall_find_best_alleles(call_t *call, int nals, int *out_als)
+{
+    int ia,ib,ic;   // iterators over up to three alleles
+    int max_als=0;  // most likely combination of alleles
+    double ref_lk = 0, max_lk = -HUGE_VAL; // likelihood of the reference and of most likely combination of alleles
+    double lk_sum = -HUGE_VAL;    // for normalizing the likelihoods
+    int nsmpl = bcf_hdr_nsamples(call->hdr);
+    int ngts  = nals*(nals+1)/2;
+
+    // Single allele
+    for (ia=0; ia<nals; ia++)
+    {
+        double lk_tot  = 0;
+        int lk_tot_set = 0;
+        int iaa = (ia+1)*(ia+2)/2-1;    // index in PL which corresponds to the homozygous "ia/ia" genotype
+        int isample;
+        double *pdg = call->pdg + iaa;
+        for (isample=0; isample<nsmpl; isample++)
+        {
+            if ( *pdg ) { lk_tot += log(*pdg); lk_tot_set = 1; }
+            pdg += ngts;
+        }
+        if ( ia==0 ) ref_lk = lk_tot;   // likelihood of 0/0 for all samples
+        else lk_tot += call->theta; // the prior
+        UPDATE_MAX_LKs(1<<ia);
+    }
+
+    // Two alleles
+    if ( nals>1 )
+    {
+        for (ia=0; ia<nals; ia++)
+        {
+            if ( call->qsum[ia]==0 ) continue;
+            int iaa = (ia+1)*(ia+2)/2-1;
+            for (ib=0; ib<ia; ib++)
+            {
+                if ( call->qsum[ib]==0 ) continue;
+                double lk_tot  = 0;
+                int lk_tot_set = 0;
+                double fa  = call->qsum[ia]/(call->qsum[ia]+call->qsum[ib]);
+                double fb  = call->qsum[ib]/(call->qsum[ia]+call->qsum[ib]);
+                double fab = 2*fa*fb; fa *= fa; fb *= fb;
+                int isample, ibb = (ib+1)*(ib+2)/2-1, iab = iaa - ia + ib;
+                double *pdg  = call->pdg;
+                for (isample=0; isample<nsmpl; isample++)
+                {
+                    double val = 0;
+                    if ( !call->ploidy || call->ploidy[isample]==2 )
+                        val = fa*pdg[iaa] + fb*pdg[ibb] + fab*pdg[iab];
+                    else if ( call->ploidy && call->ploidy[isample]==1 )
+                        val = fa*pdg[iaa] + fb*pdg[ibb];
+                    if ( val ) { lk_tot += log(val); lk_tot_set = 1; }
+                    pdg += ngts;
+                }
+                if ( ia!=0 ) lk_tot += call->theta;    // the prior
+                if ( ib!=0 ) lk_tot += call->theta;
+                UPDATE_MAX_LKs(1<<ia|1<<ib);
+            }
+        }
+    }
+
+    // Three alleles
+    if ( nals>2 )
+    {
+        for (ia=0; ia<nals; ia++)
+        {
+            if ( call->qsum[ia]==0 ) continue;
+            int iaa = (ia+1)*(ia+2)/2-1;
+            for (ib=0; ib<ia; ib++)
+            {
+                if ( call->qsum[ib]==0 ) continue;
+                int ibb = (ib+1)*(ib+2)/2-1;
+                int iab = iaa - ia + ib;
+                for (ic=0; ic<ib; ic++)
+                {
+                    if ( call->qsum[ic]==0 ) continue;
+                    double lk_tot  = 0;
+                    int lk_tot_set = 1;
+                    double fa  = call->qsum[ia]/(call->qsum[ia]+call->qsum[ib]+call->qsum[ic]);
+                    double fb  = call->qsum[ib]/(call->qsum[ia]+call->qsum[ib]+call->qsum[ic]);
+                    double fc  = call->qsum[ic]/(call->qsum[ia]+call->qsum[ib]+call->qsum[ic]);
+                    double fab = 2*fa*fb, fac = 2*fa*fc, fbc = 2*fb*fc; fa *= fa; fb *= fb; fc *= fc;
+                    int isample, icc = (ic+1)*(ic+2)/2-1;
+                    int iac = iaa - ia + ic, ibc = ibb - ib + ic;
+                    double *pdg = call->pdg;
+                    for (isample=0; isample<nsmpl; isample++)
+                    {
+                        double val = 0;
+                        if ( !call->ploidy || call->ploidy[isample]==2 )
+                            val = fa*pdg[iaa] + fb*pdg[ibb] + fc*pdg[icc] + fab*pdg[iab] + fac*pdg[iac] + fbc*pdg[ibc];
+                        else if ( call->ploidy && call->ploidy[isample]==1 )
+                            val = fa*pdg[iaa] + fb*pdg[ibb] + fc*pdg[icc];
+                        if ( val ) { lk_tot += log(val); lk_tot_set = 1; }
+                        pdg += ngts;
+                    }
+                    if ( ia!=0 ) lk_tot += call->theta;    // the prior
+                    if ( ib!=0 ) lk_tot += call->theta;    // the prior
+                    if ( ic!=0 ) lk_tot += call->theta;    // the prior
+                    UPDATE_MAX_LKs(1<<ia|1<<ib|1<<ic);
+                }
+            }
+        }
+    }
+
+    call->ref_lk = ref_lk;
+    call->lk_sum = lk_sum;
+    *out_als = max_als;
+
+    int i, n = 0;
+    for (i=0; i<nals; i++) if ( max_als & 1<<i) n++;
+
+    return n;
+}
+
+static void mcall_set_ref_genotypes(call_t *call, int nals)
+{
+    int i;
+    int ngts  = nals*(nals+1)/2;
+    int nsmpl = bcf_hdr_nsamples(call->hdr);
+
+    for (i=0; i<4; i++) call->ac[i] = 0;
+    call->nhets = 0;
+    call->ndiploid = 0;
+
+    // Set all genotypes to 0/0 or 0
+    int *gts    = call->gts;
+    double *pdg = call->pdg;
+    int isample;
+    for (isample = 0; isample < nsmpl; isample++)
+    {
+        int ploidy = call->ploidy ? call->ploidy[isample] : 2;
+        for (i=0; i<ngts; i++) if ( pdg[i]!=0.0 ) break;
+        if ( i==ngts || !ploidy )
+        {
+            gts[0] = bcf_gt_missing;
+            gts[1] = ploidy==2 ? bcf_gt_missing : bcf_int32_vector_end;
+        }
+        else
+        {
+            gts[0] = bcf_gt_unphased(0);
+            gts[1] = ploidy==2 ? bcf_gt_unphased(0) : bcf_int32_vector_end;
+            call->ac[0] += ploidy;
+        }
+        gts += 2;
+        pdg += ngts;
+    }
+}
+
+static void mcall_call_genotypes(call_t *call, bcf1_t *rec, int nals, int nout_als, int out_als)
+{
+    int ia, ib, i;
+    int ngts  = nals*(nals+1)/2;
+    int nsmpl = bcf_hdr_nsamples(call->hdr);
+    int nout_gts = nout_als*(nout_als+1)/2;
+    hts_expand(float,nout_gts*nsmpl,call->nGPs,call->GPs);
+
+    for (i=0; i<4; i++) call->ac[i] = 0;
+    call->nhets = 0;
+    call->ndiploid = 0;
+
+    #if USE_PRIOR_FOR_GTS
+        float prior = exp(call->theta);
+    #endif
+    float *gps  = call->GPs - nout_gts;
+    double *pdg = call->pdg - ngts;
+    int *gts  = call->gts - 2;
+
+    int isample;
+    for (isample = 0; isample < nsmpl; isample++)
+    {
+        int ploidy = call->ploidy ? call->ploidy[isample] : 2;
+        assert( ploidy>=0 && ploidy<=2 );
+
+        pdg += ngts;
+        gts += 2;
+        gps += nout_gts;
+
+        if ( !ploidy )
+        {
+            gts[0] = bcf_gt_missing;
+            gts[1] = bcf_int32_vector_end;
+            gps[0] = -1;
+            continue;
+        }
+
+        #if !FLAT_PDG_FOR_MISSING
+            // Skip samples with zero depth, they have all pdg's equal to 0
+            for (i=0; i<ngts; i++) if ( pdg[i]!=0.0 ) break;
+            if ( i==ngts )
+            {
+                gts[0] = bcf_gt_missing;
+                gts[1] = ploidy==2 ? bcf_gt_missing : bcf_int32_vector_end;
+                gps[0] = -1;
+                continue;
+            }
+        #endif
+
+        if ( ploidy==2 ) call->ndiploid++;
+
+        // Default fallback for the case all LKs are the same
+        gts[0] = bcf_gt_unphased(0);
+        gts[1] = ploidy==2 ? bcf_gt_unphased(0) : bcf_int32_vector_end;
+
+        // Non-zero depth, determine the most likely genotype
+        double best_lk = 0;
+        for (ia=0; ia<nals; ia++)
+        {
+            if ( !(out_als & 1<<ia) ) continue;     // ia-th allele not in the final selection, skip
+            int iaa = (ia+1)*(ia+2)/2-1;            // PL index of the ia/ia genotype
+            double lk = pdg[iaa]*call->qsum[ia]*call->qsum[ia];
+            #if USE_PRIOR_FOR_GTS
+                if ( ia!=0 ) lk *= prior;
+            #endif
+            int igt  = ploidy==2 ? bcf_alleles2gt(call->als_map[ia],call->als_map[ia]) : call->als_map[ia];
+            gps[igt] = lk;
+            if ( best_lk < lk )
+            {
+                best_lk = lk;
+                gts[0] = bcf_gt_unphased(call->als_map[ia]);
+            }
+        }
+        if ( ploidy==2 )
+        {
+            gts[1] = gts[0];
+            for (ia=0; ia<nals; ia++)
+            {
+                if ( !(out_als & 1<<ia) ) continue;
+                int iaa = (ia+1)*(ia+2)/2-1;
+                for (ib=0; ib<ia; ib++)
+                {
+                    if ( !(out_als & 1<<ib) ) continue;
+                    int iab = iaa - ia + ib;
+                    double lk = 2*pdg[iab]*call->qsum[ia]*call->qsum[ib];
+                    #if USE_PRIOR_FOR_GTS
+                        if ( ia!=0 ) lk *= prior;
+                        if ( ib!=0 ) lk *= prior;
+                    #endif
+                    int igt  = bcf_alleles2gt(call->als_map[ia],call->als_map[ib]);
+                    gps[igt] = lk;
+                    if ( best_lk < lk )
+                    {
+                        best_lk = lk;
+                        gts[0] = bcf_gt_unphased(call->als_map[ib]);
+                        gts[1] = bcf_gt_unphased(call->als_map[ia]);
+                    }
+                }
+            }
+            if ( gts[0] != gts[1] ) call->nhets++;
+        }
+        else
+            gts[1] = bcf_int32_vector_end;
+
+        call->ac[ bcf_gt_allele(gts[0]) ]++;
+        if ( gts[1]!=bcf_int32_vector_end ) call->ac[ bcf_gt_allele(gts[1]) ]++;
+    }
+    if ( call->output_tags & (CALL_FMT_GQ|CALL_FMT_GP) )
+    {
+        double max, sum;
+        for (isample=0; isample<nsmpl; isample++)
+        {
+            gps = call->GPs + isample*nout_gts;
+
+            int nmax;
+            if ( call->ploidy )
+            {
+                if ( call->ploidy[isample]==2 ) nmax = nout_gts;
+                else if ( call->ploidy[isample]==1 ) nmax = nout_als;
+                else nmax = 0;
+            }
+            else nmax = nout_gts;
+
+            max = gps[0];
+            if ( max<0 || nmax==0 )
+            {
+                // no call
+                if ( call->output_tags & CALL_FMT_GP )
+                {
+                    for (i=0; i<nmax; i++) gps[i] = 0;
+                    if ( nmax==0 ) { bcf_float_set_missing(gps[i]); nmax++; }
+                    if ( nmax < nout_gts ) bcf_float_set_vector_end(gps[nmax]);
+                }
+                call->GQs[isample] = 0;
+                continue;
+            }
+            sum = gps[0];
+            for (i=1; i<nmax; i++)
+            {
+                if ( max < gps[i] ) max = gps[i];
+                sum += gps[i];
+            }
+            max = -4.34294*log(1 - max/sum);
+            call->GQs[isample] = max<=INT8_MAX ? max : INT8_MAX;
+            if ( call->output_tags & CALL_FMT_GP )
+            {
+                assert( max );
+                for (i=0; i<nmax; i++) gps[i] = (int)(-4.34294*log(gps[i]/sum));
+                if ( nmax < nout_gts ) bcf_float_set_vector_end(gps[nmax]);
+            }
+        }
+    }
+    if ( call->output_tags & CALL_FMT_GP )
+        bcf_update_format_float(call->hdr, rec, "GP", call->GPs, nsmpl*nout_gts);
+    if ( call->output_tags & CALL_FMT_GQ )
+        bcf_update_format_int32(call->hdr, rec, "GQ", call->GQs, nsmpl);
+}
+
+
+/**
+    Pm = P(mendelian) .. parameter to vary, 1-Pm is the probability of novel mutation.
+                         When trio_Pm_ins is negative, Pm is calculated dynamically
+                         according to indel length. For simplicity, only the
+                         first ALT is considered.
+    Pkij = P(k|i,j)   .. probability that the genotype combination i,j,k is consistent
+                         with mendelian inheritance (the likelihood that offspring
+                         of two HETs is a HOM is smaller than it being a HET)
+
+    P_uc(F=i,M=j,K=k) = P(F=i) . P(M=j) . P(K=k)  .. unconstrained P
+    P_c(F=i,M=j,K=k) = P_uc . Pkij                .. constrained P
+    P(F=i,M=j,K=k) = P_uc . (1 - Pm) + P_c . Pm
+                   = P_uc . [1 - Pm + Pkij . Pm]
+
+    We choose genotype combination i,j,k which maximizes P(F=i,M=j,K=k). This
+    probability gives the quality GQ(Trio).
+    Individual qualities are calculated as
+        GQ(F=i,M=j,K=k) = P(F=i,M=j,K=k) / \sum_{x,y} P(F=i,M=x,K=y)
+ */
+static void mcall_call_trio_genotypes(call_t *call, bcf1_t *rec, int nals, int nout_als, int out_als)
+{
+    int ia, ib, i;
+    int nsmpl   = bcf_hdr_nsamples(call->hdr);
+    int ngts    = nals*(nals+1)/2;
+    double *gls = call->GLs - ngts;
+    double *pdg = call->pdg - ngts;
+
+    // Calculate individuals' genotype likelihoods P(X=i)
+    int isample;
+    for (isample = 0; isample < nsmpl; isample++)
+    {
+        int ploidy = call->ploidy ? call->ploidy[isample] : 2;
+        int32_t *gts = call->ugts + isample;
+
+        gls += ngts;
+        pdg += ngts;
+
+        // Skip samples with all pdg's equal to 1. These have zero depth.
+        for (i=0; i<ngts; i++) if ( pdg[i]!=0.0 ) break;
+        if ( i==ngts || !ploidy )
+        {
+            gts[0] = bcf_gt_missing;
+            gls[0] = 1;
+            continue;
+        }
+
+        for (i=0; i<ngts; i++) gls[i] = -HUGE_VAL;
+
+        double sum_lk  = 0;
+        double best_lk = 0;
+        for (ia=0; ia<nals; ia++)
+        {
+            if ( !(out_als & 1<<ia) ) continue;     // ia-th allele not in the final selection, skip
+            int iaa   = bcf_alleles2gt(ia,ia);      // PL index of the ia/ia genotype
+            int idx   = bcf_alleles2gt(call->als_map[ia],call->als_map[ia]);
+            double lk = pdg[iaa]*call->qsum[ia]*call->qsum[ia];
+            sum_lk   += lk;
+            gls[idx]  = lk;
+            if ( best_lk < lk )
+            {
+                best_lk = lk;
+                gts[0] = bcf_alleles2gt(call->als_map[ia],call->als_map[ia]);
+            }
+        }
+        if ( ploidy==2 )
+        {
+            for (ia=0; ia<nals; ia++)
+            {
+                if ( !(out_als & 1<<ia) ) continue;
+                for (ib=0; ib<ia; ib++)
+                {
+                    if ( !(out_als & 1<<ib) ) continue;
+                    int iab   = bcf_alleles2gt(ia,ib);
+                    int idx   = bcf_alleles2gt(call->als_map[ia],call->als_map[ib]);
+                    double lk = 2*pdg[iab]*call->qsum[ia]*call->qsum[ib];
+                    sum_lk   += lk;
+                    gls[idx]  = lk;
+                    if ( best_lk < lk )
+                    {
+                        best_lk = lk;
+                        gts[0] = bcf_alleles2gt(call->als_map[ib],call->als_map[ia]);
+                    }
+                }
+            }
+        }
+        for (i=0; i<ngts; i++)
+            if ( gls[i]!=-HUGE_VAL ) gls[i] = log(gls[i]/sum_lk);
+    }
+
+    // Set novel mutation rate for this site: using first ALT allele for simplicity.
+    double trio_Pm;
+    if ( call->trio_Pm_ins<0 && call->trio_Pm_del<0 ) trio_Pm = call->trio_Pm_SNPs;     // the same Pm for indels and SNPs requested
+    else
+    {
+        int ret = bcf_get_variant_types(rec);
+        if ( !(ret & VCF_INDEL) ) trio_Pm = call->trio_Pm_SNPs;
+        else
+        {
+            if ( call->trio_Pm_ins<0 )  // dynamic calculation, trio_Pm_del holds the scaling factor
+            {
+                trio_Pm = rec->d.var[1].n<0 ? -21.9313 - 0.2856*rec->d.var[1].n : -22.8689 + 0.2994*rec->d.var[1].n;
+                trio_Pm = 1 - call->trio_Pm_del * exp(trio_Pm);
+            }
+            else                        // snps and indels set explicitly
+            {
+                trio_Pm = rec->d.var[1].n<0 ? call->trio_Pm_del : call->trio_Pm_ins;
+            }
+        }
+    }
+
+    // Calculate constrained likelihoods and determine genotypes
+    int ifm;
+    for (ifm=0; ifm<call->nfams; ifm++)
+    {
+        family_t *fam = &call->fams[ifm];
+        int ntrio = call->ntrio[fam->type][nout_als];
+        uint16_t *trio = call->trio[fam->type][nout_als];
+
+        // Unconstrained likelihood
+        int uc_itr = 0;
+        double uc_lk = 0;
+        for (i=0; i<3; i++)     // for father, mother, child
+        {
+            int ismpl = fam->sample[i];
+            double *gl = call->GLs + ngts*ismpl;
+            if ( gl[0]==1 ) continue;
+            int j, jmax = 0;
+            double max  = gl[0];
+            for (j=1; j<ngts; j++)
+                if ( max < gl[j] ) { max = gl[j]; jmax = j; }
+            uc_lk += max;
+            uc_itr |= jmax << ((2-i)*4);
+        }
+
+        // Best constrained likelihood
+        int c_itr = -1, itr, uc_is_mendelian = 0;
+        double c_lk = -HUGE_VAL;
+        for (itr=0; itr<ntrio; itr++)   // for each trio genotype combination
+        {
+            double lk = 0;
+            int npresent = 0;
+            for (i=0; i<3; i++)     // for father, mother, child
+            {
+                int ismpl = fam->sample[i];
+                double *gl = call->GLs + ngts*ismpl;
+                if ( gl[0]==1 ) continue;
+                int igt = trio[itr]>>((2-i)*4) & 0xf;
+                assert( !call->ploidy || call->ploidy[ismpl]>0 );
+                if ( igt==GT_SKIP ) continue;
+                lk += gl[igt];
+                npresent++;
+                // fprintf(stderr," %e", gl[igt]);
+            }
+            // fprintf(stderr,"\t\t");
+            double Pkij = npresent==3 ? (double)2/(trio[itr]>>12) : 1;  // with missing genotypes Pkij's are different
+            lk += log(1 - trio_Pm * (1 - Pkij));
+            // fprintf(stderr,"%d%d%d\t%e\t%.2f\n", trio[itr]>>8&0xf,trio[itr]>>4&0xf,trio[itr]&0xf, lk, Pkij);
+            if ( c_lk < lk ) { c_lk = lk; c_itr = trio[itr]; }
+            if ( uc_itr==trio[itr] ) uc_is_mendelian = 1;
+        }
+
+        if ( !uc_is_mendelian )
+        {
+            uc_lk += log(1 - trio_Pm);
+            //fprintf(stderr,"c_lk=%e uc_lk=%e c_itr=%d%d%d uc_itr=%d%d%d\n", c_lk,uc_lk,c_itr>>8&0xf,c_itr>>4&0xf,c_itr&0xf,uc_itr>>8&0xf,uc_itr>>4&0xf,uc_itr&0xf);
+            if ( c_lk < uc_lk ) { c_lk = uc_lk; c_itr = uc_itr; }
+        }
+        //fprintf(stderr,"best_lk=%e best_itr=%d%d%d uc_itr=%d%d%d\n", c_lk,c_itr>>8&0xf,c_itr>>4&0xf,c_itr&0xf,uc_itr>>8&0xf,uc_itr>>4&0xf,uc_itr&0xf);
+
+        // Set genotypes for father, mother, child and calculate genotype qualities
+        for (i=0; i<3; i++)
+        {
+            // GT
+            int ismpl    = fam->sample[i];
+            int igt      = c_itr>>((2-i)*4) & 0xf;
+            double *gl   = call->GLs + ngts*ismpl;
+            int32_t *gts = call->cgts + ismpl;
+            if ( gl[0]==1 || igt==GT_SKIP )    // zero depth, set missing genotypes
+            {
+                gts[0] = bcf_gt_missing;
+                // bcf_float_set_missing(call->GQs[ismpl]);
+                continue;
+            }
+            gts[0] = igt;
+
+            #if 0
+                // todo: Genotype Qualities
+                //
+                // GQ: for each family member i sum over all genotypes j,k keeping igt fixed
+                double lk_sum = 0;
+                for (itr=0; itr<ntrio; itr++)
+                {
+                    if ( igt != (trio[itr]>>((2-i)*4) & 0xf) ) continue;
+                    double lk = 0;
+                    int j;
+                    for (j=0; j<3; j++)
+                    {
+                        int jsmpl = fam->sample[j];
+                        double *gl = call->GLs + ngts*jsmpl;
+                        if ( gl[0]==1 ) continue;
+                        int jgt = trio[itr]>>((2-j)*4) & 0xf;
+                        if ( jgt==GT_SKIP ) continue;
+                        lk += gl[jgt];
+                    }
+                    double Pkij = (double)2/(trio[itr]>>12);
+                    lk += log(1 - trio_Pm * (1 - Pkij));
+                    lk_sum = logsumexp2(lk_sum, lk);
+                }
+                if ( !uc_is_mendelian && (best_itr>>((2-i)*4)&0xf)==(uc_itr>>((2-i)*4)&0xf) ) lk_sum = logsumexp2(lk_sum,uc_lk);
+                call->GQs[ismpl] = -4.3429*(best_lk - lk_sum);
+            #endif
+        }
+    }
+
+    for (i=0; i<4; i++) call->ac[i] = 0;
+    call->nhets = 0;
+    call->ndiploid = 0;
+
+    // Test if CGT,UGT are needed
+    int ucgts_needed = 0;
+    int32_t *cgts = call->cgts - 1;
+    int32_t *ugts = call->ugts - 1;
+    int32_t *gts  = call->gts - 2;
+    for (isample = 0; isample < nsmpl; isample++)
+    {
+        int ploidy = call->ploidy ? call->ploidy[isample] : 2;
+        cgts++;
+        ugts++;
+        gts += 2;
+        if ( bcf_gt_is_missing(ugts[0]) )
+        {
+            gts[0] = bcf_gt_missing;
+            gts[1] = ploidy==2 ? bcf_gt_missing : bcf_int32_vector_end;
+            continue;
+        }
+        int a,b;
+        if ( cgts[0]!=ugts[0] )
+        {
+            bcf_gt2alleles(cgts[0], &a, &b);
+            gts[0] = bcf_gt_unphased(a);
+            gts[1] = ploidy==1 ? bcf_int32_vector_end : bcf_gt_unphased(b);
+        }
+        else
+        {
+            bcf_gt2alleles(ugts[0], &a, &b);
+            gts[0] = bcf_gt_unphased(a);
+            gts[1] = ploidy==1 ? bcf_int32_vector_end : bcf_gt_unphased(b);
+        }
+        if ( cgts[0]!=ugts[0] ) ucgts_needed = 1;
+        call->ac[a]++;
+        if ( ploidy==2 )
+        {
+            call->ac[b]++;
+            call->ndiploid++;
+            if ( a!=b ) call->nhets++;
+        }
+    }
+    if ( ucgts_needed )
+    {
+        // Some GTs are different
+        bcf_update_format_int32(call->hdr,rec,"UGT",call->ugts,nsmpl);
+        bcf_update_format_int32(call->hdr,rec,"CGT",call->cgts,nsmpl);
+    }
+}
+
+static void mcall_trim_PLs(call_t *call, bcf1_t *rec, int nals, int nout_als, int out_als)
+{
+    int ngts  = nals*(nals+1)/2;
+    int npls_src = ngts, npls_dst = nout_als*(nout_als+1)/2;     // number of PL values in diploid samples, ori and new
+    if ( call->all_diploid && npls_src == npls_dst ) return;
+
+    int *pls_src = call->PLs, *pls_dst = call->PLs;
+
+    int nsmpl = bcf_hdr_nsamples(call->hdr);
+    int isample, ia;
+    for (isample = 0; isample < nsmpl; isample++)
+    {
+        int ploidy = call->ploidy ? call->ploidy[isample] : 2;
+        if ( ploidy==2 )
+        {
+            for (ia=0; ia<npls_dst; ia++)
+                pls_dst[ia] =  pls_src[ call->pl_map[ia] ];
+        }
+        else if ( ploidy==1 )
+        {
+            for (ia=0; ia<nout_als; ia++)
+            {
+                int isrc = (ia+1)*(ia+2)/2-1;
+                pls_dst[ia] = pls_src[ call->pl_map[isrc] ];
+            }
+            if ( ia<npls_dst ) pls_dst[ia] = bcf_int32_vector_end;
+        }
+        else
+        {
+            pls_dst[0] = bcf_int32_missing;
+            pls_dst[1] = bcf_int32_vector_end;  // relying on nout_als>1 in mcall()
+        }
+        pls_src += npls_src;
+        pls_dst += npls_dst;
+    }
+    bcf_update_format_int32(call->hdr, rec, "PL", call->PLs, npls_dst*nsmpl);
+}
+
+void mcall_trim_numberR(call_t *call, bcf1_t *rec, int nals, int nout_als, int out_als)
+{
+    int i, ret;
+
+    // only DPR so far, we may generalize to arbitrary Number=R if necessary
+    ret = bcf_get_info_int32(call->hdr, rec, "DPR", &call->itmp, &call->n_itmp);
+    if ( ret>0 )
+    {
+        assert( ret==nals );
+        if ( out_als==1 )
+            bcf_update_info_int32(call->hdr, rec, "DPR", call->itmp, 1);
+        else
+        {
+            for (i=0; i<nals; i++)
+            {
+                if ( call->als_map[i]==-1 ) continue;   // to be dropped
+                call->PLs[ call->als_map[i] ] = call->itmp[i]; // reusing PLs storage which is not used at this point
+            }
+            bcf_update_info_int32(call->hdr, rec, "DPR", call->PLs, nout_als);
+        }
+    }
+
+    ret = bcf_get_format_int32(call->hdr, rec, "DPR", &call->itmp, &call->n_itmp);
+    if ( ret>0 )
+    {
+        int nsmpl = bcf_hdr_nsamples(call->hdr);
+        int ndp = ret / nsmpl;
+        assert( ndp==nals );
+        if ( out_als==1 )
+        {
+            for (i=0; i<nsmpl; i++)
+                call->PLs[i] = call->itmp[i*ndp];
+
+            bcf_update_format_int32(call->hdr, rec, "DPR", call->PLs, nsmpl);
+        }
+        else
+        {
+            int j;
+            for (i=0; i<nsmpl; i++)
+            {
+                int32_t *dp_dst = call->PLs + i*nout_als;
+                int32_t *dp_src = call->itmp + i*ndp;
+                for (j=0; j<nals; j++)
+                {
+                    if ( call->als_map[j]==-1 ) continue;   // to be dropped
+                    dp_dst[ call->als_map[j] ] = dp_src[j]; // reusing PLs storage which is not used at this point
+                }
+            }
+            bcf_update_format_int32(call->hdr, rec, "DPR", call->PLs, nsmpl*nout_als);
+        }
+    }
+}
+
+static void mcall_constrain_alleles(call_t *call, bcf1_t *rec, int unseen)
+{
+    bcf_sr_regions_t *tgt = call->srs->targets;
+    if ( tgt->nals>5 ) error("Maximum accepted number of alleles is 5, got %d\n", tgt->nals);
+    hts_expand(char*,tgt->nals+1,call->nals,call->als);
+
+    int has_new = 0;
+
+    int i, j, nals = 1;
+    for (i=1; i<call->nals_map; i++) call->als_map[i] = -1;
+
+    if ( vcmp_set_ref(call->vcmp, rec->d.allele[0], tgt->als[0]) < 0 )
+        error("The reference alleles are not compatible at %s:%d .. %s vs %s\n", call->hdr->id[BCF_DT_CTG][rec->rid].key,rec->pos+1,tgt->als[0],rec->d.allele[0]);
+
+    // create mapping from new to old alleles
+    call->als[0] = tgt->als[0];
+    call->als_map[0] = 0;
+
+    for (i=1; i<tgt->nals; i++)
+    {
+        call->als[nals] = tgt->als[i];
+        j = vcmp_find_allele(call->vcmp, rec->d.allele+1, rec->n_allele - 1, tgt->als[i]);
+
+        if ( j>=0 )
+        {
+            // existing allele
+            call->als_map[nals] = j+1;
+        }
+        else
+        {
+            // There is a new allele in targets which is not present in VCF.
+            // We use the X allele to estimate PLs. Note that X may not be
+            // present at multiallelic indels sites. In that case we use the
+            // last allele anyway, because the least likely allele comes last
+            // in mpileup's ALT output.
+            call->als_map[nals] = unseen>=0 ? unseen : rec->n_allele - 1;
+            has_new = 1;
+        }
+        nals++;
+    }
+    if ( !has_new && nals==rec->n_allele ) return;
+    bcf_update_alleles(call->hdr, rec, (const char**)call->als, nals);
+
+    // create mapping from new PL to old PL
+    int k = 0;
+    for (i=0; i<nals; i++)
+    {
+        for (j=0; j<=i; j++)
+        {
+            int a = call->als_map[i], b = call->als_map[j];
+            call->pl_map[k++] = a>b ? a*(a+1)/2 + b : b*(b+1)/2 + a;
+        }
+    }
+
+    // update PL
+    call->nPLs = bcf_get_format_int32(call->hdr, rec, "PL", &call->PLs, &call->mPLs);
+    int nsmpl  = bcf_hdr_nsamples(call->hdr);
+    int npls_ori = call->nPLs / nsmpl;
+    int npls_new = k;
+    hts_expand(int32_t,npls_new*nsmpl,call->n_itmp,call->itmp);
+    int *ori_pl = call->PLs, *new_pl = call->itmp;
+    for (i=0; i<nsmpl; i++)
+    {
+        for (k=0; k<npls_new; k++)
+        {
+            new_pl[k] = ori_pl[call->pl_map[k]];
+            if ( new_pl[k]==bcf_int32_missing && unseen>=0 )
+            {
+                // missing value, and there is an unseen allele: identify the
+                // alleles and use the lk of either AX or XX
+                int k_ori = call->pl_map[k], ia, ib;
+                bcf_gt2alleles(k_ori, &ia, &ib);
+                k_ori = bcf_alleles2gt(ia,unseen);
+                if ( ori_pl[k_ori]==bcf_int32_missing ) k_ori = bcf_alleles2gt(ib,unseen);
+                if ( ori_pl[k_ori]==bcf_int32_missing ) k_ori = bcf_alleles2gt(unseen,unseen);
+                new_pl[k] = ori_pl[k_ori];
+            }
+        }
+        ori_pl += npls_ori;
+        new_pl += npls_new;
+    }
+    bcf_update_format_int32(call->hdr, rec, "PL", call->itmp, npls_new*nsmpl);
+
+    // update QS
+    float qsum[5];
+    int nqs = bcf_get_info_float(call->hdr, rec, "QS", &call->qsum, &call->nqsum);
+    for (i=0; i<nals; i++)
+        qsum[i] = call->als_map[i]<nqs ? call->qsum[call->als_map[i]] : 0;
+    bcf_update_info_float(call->hdr, rec, "QS", qsum, nals);
+}
+
+
+/**
+  *  This function implements the multiallelic calling model. It has two major parts:
+  *   1) determine the most likely set of alleles and calculate the quality of ref/non-ref site
+  *   2) determine and set the genotypes
+  *  In various places in between, the BCF record gets updated.
+  */
+int mcall(call_t *call, bcf1_t *rec)
+{
+    int i, unseen = -1;
+    for (i=1; i<rec->n_allele; i++)
+    {
+        if ( rec->d.allele[i][0]=='X' ) { unseen = i; break; }  // old X
+        if ( rec->d.allele[i][0]=='<' && rec->d.allele[i][1]=='X' && rec->d.allele[i][1]=='>' ) { unseen = i; break; } // old <X>
+        if ( rec->d.allele[i][0]=='<' && rec->d.allele[i][1]=='*' && rec->d.allele[i][1]=='>' ) { unseen = i; break; } // new <*>
+    }
+
+    // Force alleles when calling genotypes given alleles was requested
+    if ( call->flag & CALL_CONSTR_ALLELES ) mcall_constrain_alleles(call, rec, unseen);
+
+    int nsmpl = bcf_hdr_nsamples(call->hdr);
+    int nals  = rec->n_allele;
+    hts_expand(int,nals,call->nals_map,call->als_map);
+    hts_expand(int,nals*(nals+1)/2,call->npl_map,call->pl_map);
+
+    // Get the genotype likelihoods
+    call->nPLs = bcf_get_format_int32(call->hdr, rec, "PL", &call->PLs, &call->mPLs);
+    if ( call->nPLs!=nsmpl*nals*(nals+1)/2 && call->nPLs!=nsmpl*nals )  // a mixture of diploid and haploid or haploid only
+        error("Wrong number of PL fields? nals=%d npl=%d\n", nals,call->nPLs);
+
+    // Convert PLs to probabilities
+    int ngts = nals*(nals+1)/2;
+    hts_expand(double, call->nPLs, call->npdg, call->pdg);
+    set_pdg(call->pl2p, call->PLs, call->pdg, nsmpl, ngts, unseen);
+
+    #if QS_FROM_PDG
+        estimate_qsum(call, rec);
+    #else
+        // Get sum of qualities
+        int nqs = bcf_get_info_float(call->hdr, rec, "QS", &call->qsum, &call->nqsum);
+        if ( nqs<=0 ) error("The QS annotation not present at %s:%d\n", bcf_seqname(call->hdr,rec),rec->pos+1);
+        if ( nqs < nals )
+        {
+            // Some of the listed alleles do not have the corresponding QS field. This is
+            // typically ref-only site with X in ALT.
+
+            hts_expand(float,nals,call->nqsum,call->qsum);
+            for (i=nqs; i<nals; i++) call->qsum[i] = 0;
+        }
+        float qsum_tot = 0;
+        for (i=0; i<nals; i++) qsum_tot += call->qsum[i];
+        if ( !call->qsum[0] )
+        {
+            // As P(RR)!=0 even for QS(ref)=0, we set QS(ref) to a small value,
+            // an equivalent of a single reference read.
+            if ( bcf_get_info_int32(call->hdr, rec, "DP", &call->itmp, &call->n_itmp)!=1 )
+                error("Could not read DP at %s:%d\n", call->hdr->id[BCF_DT_CTG][rec->rid].key,rec->pos+1);
+            if ( call->itmp[0] )
+            {
+                call->qsum[0] = 1.0 / call->itmp[0] / nsmpl;
+                qsum_tot += call->qsum[0];
+            }
+        }
+        if ( qsum_tot ) for (i=0; i<nals; i++) call->qsum[i] /= qsum_tot;
+    #endif
+
+    // Find the best combination of alleles
+    int out_als, nout = mcall_find_best_alleles(call, nals, &out_als);
+
+    // Make sure the REF allele is always present
+    if ( !(out_als&1) )
+    {
+        out_als |= 1;
+        nout++;
+    }
+    int is_variant = out_als==1 ? 0 : 1;
+    if ( call->flag & CALL_VARONLY && !is_variant ) return 0;
+
+    // With -A, keep all ALTs except X
+    if ( call->flag & CALL_KEEPALT )
+    {
+        nout = 0;
+        for (i=0; i<nals; i++)
+        {
+            if ( rec->d.allele[i][0]=='X' ) continue;   // old version of unseen allele "X"
+            if ( rec->d.allele[i][0]=='<' && rec->d.allele[i][1]=='X' && rec->d.allele[i][2]=='>' ) continue;   // old version of unseen allele, "<X>"
+            if ( rec->d.allele[i][0]=='<' && rec->d.allele[i][1]=='*' && rec->d.allele[i][2]=='>' ) continue;   // new version of unseen allele, "<*>"
+            out_als |= 1<<i;
+            nout++;
+        }
+    }
+
+    int nAC = 0;
+    if ( out_als==1 )   // only REF allele on output
+    {
+        init_allele_trimming_maps(call, 1, nals);
+        mcall_set_ref_genotypes(call,nals);
+        bcf_update_format_int32(call->hdr, rec, "PL", NULL, 0);    // remove PL, useless now
+    }
+    else
+    {
+        // The most likely set of alleles includes non-reference allele (or was enforced), call genotypes.
+        // Note that it is a valid outcome if the called genotypes exclude some of the ALTs.
+        init_allele_trimming_maps(call, out_als, nals);
+        if ( !is_variant )
+            mcall_set_ref_genotypes(call,nals);     // running with -A, prevent mcall_call_genotypes from putting some ALT back
+        else if ( call->flag & CALL_CONSTR_TRIO )
+            mcall_call_trio_genotypes(call, rec, nals,nout,out_als);
+        else
+            mcall_call_genotypes(call,rec,nals,nout,out_als);
+
+        // Skip the site if all samples are 0/0. This can happen occasionally.
+        nAC = call->ac[1] + call->ac[2] + call->ac[3];
+        if ( !nAC && call->flag & CALL_VARONLY ) return 0;
+        mcall_trim_PLs(call, rec, nals, nout, out_als);
+    }
+    if ( nals!=nout ) mcall_trim_numberR(call, rec, nals, nout, out_als);
+
+    // Set QUAL and calculate HWE-related annotations
+    if ( nAC )
+    {
+        float icb = calc_ICB(call->ac[0],nAC, call->nhets, call->ndiploid);
+        if ( icb != HUGE_VAL ) bcf_update_info_float(call->hdr, rec, "ICB", &icb, 1);
+
+        float hob = calc_HOB(call->ac[0],nAC, call->nhets, call->ndiploid);
+        if ( hob != HUGE_VAL ) bcf_update_info_float(call->hdr, rec, "HOB", &hob, 1);
+
+        // Quality of a variant site. fabs() to avoid negative zeros in VCF output when CALL_KEEPALT is set
+        rec->qual = call->lk_sum==-HUGE_VAL ? 0 : fabs(-4.343*(call->ref_lk - call->lk_sum));
+    }
+    else
+    {
+        // Set the quality of a REF site
+        rec->qual = call->lk_sum==-HUGE_VAL ? 0 : -4.343*log(1 - exp(call->ref_lk - call->lk_sum));
+    }
+    if ( rec->qual>999 ) rec->qual = 999;
+    if ( rec->qual>50 ) rec->qual = rint(rec->qual);
+
+    // AC, AN
+    if ( nout>1 ) bcf_update_info_int32(call->hdr, rec, "AC", call->ac+1, nout-1);
+    nAC += call->ac[0];
+    bcf_update_info_int32(call->hdr, rec, "AN", &nAC, 1);
+
+    // Remove unused alleles
+    hts_expand(char*,nout,call->nals,call->als);
+    for (i=0; i<nals; i++)
+        if ( call->als_map[i]>=0 ) call->als[call->als_map[i]] = rec->d.allele[i];
+    bcf_update_alleles(call->hdr, rec, (const char**)call->als, nout);
+    bcf_update_genotypes(call->hdr, rec, call->gts, nsmpl*2);
+
+    // DP4 tag
+    if ( bcf_get_info_float(call->hdr, rec, "I16", &call->anno16, &call->n16)!=16 )
+        error("I16 hasn't 16 fields at %s:%d\n", call->hdr->id[BCF_DT_CTG][rec->rid].key,rec->pos+1);
+    int32_t dp[4]; dp[0] = call->anno16[0]; dp[1] = call->anno16[1]; dp[2] = call->anno16[2]; dp[3] = call->anno16[3];
+    bcf_update_info_int32(call->hdr, rec, "DP4", dp, 4);
+
+    int32_t mq = (call->anno16[8]+call->anno16[10])/(call->anno16[0]+call->anno16[1]+call->anno16[2]+call->anno16[3]);
+    bcf_update_info_int32(call->hdr, rec, "MQ", &mq, 1);
+
+    bcf_update_info_int32(call->hdr, rec, "I16", NULL, 0);     // remove I16 tag
+    bcf_update_info_int32(call->hdr, rec, "QS", NULL, 0);      // remove QS tag
+
+    return nout;
+}
+
diff --git a/ploidy.c b/ploidy.c
new file mode 100644
index 0000000..44dac77
--- /dev/null
+++ b/ploidy.c
@@ -0,0 +1,223 @@
+/* 
+    Copyright (C) 2014 Genome Research Ltd.
+
+    Author: Petr Danecek <pd3 at sanger.ac.uk>
+
+    Permission is hereby granted, free of charge, to any person obtaining a copy
+    of this software and associated documentation files (the "Software"), to deal
+    in the Software without restriction, including without limitation the rights
+    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+    copies of the Software, and to permit persons to whom the Software is
+    furnished to do so, subject to the following conditions:
+    
+    The above copyright notice and this permission notice shall be included in
+    all copies or substantial portions of the Software.
+    
+    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+    THE SOFTWARE.
+*/
+
+#include <htslib/regidx.h>
+#include <htslib/khash_str2int.h>
+#include <htslib/kseq.h>
+#include <htslib/hts.h>
+#include "bcftools.h"
+#include "ploidy.h"
+
+struct _ploidy_t
+{
+    int nsex, msex;     // number of genders, m:number of allocated elements in id2sex array
+    int dflt, min, max; // ploidy: default, min and max (only explicitly listed)
+    regidx_t *idx;
+    void *sex2id;
+    char **id2sex;
+    kstring_t tmp_str;
+};
+
+regidx_t *ploidy_regions(ploidy_t *ploidy)
+{
+    return ploidy->idx;
+}
+
+int ploidy_parse(const char *line, char **chr_beg, char **chr_end, reg_t *reg, void *payload, void *usr)
+{
+    ploidy_t *ploidy = (ploidy_t*) usr;
+    void *sex2id = ploidy->sex2id;
+
+    // Fill CHR,FROM,TO
+    int i, ret = regidx_parse_tab(line,chr_beg,chr_end,reg,NULL,NULL);
+    if ( ret!=0 ) return ret;
+
+    // Skip the fields already parsed by regidx_parse_tab
+    char *ss = (char*) line;
+    while ( *ss && isspace(*ss) ) ss++;
+    for (i=0; i<3; i++)
+    {
+        while ( *ss && !isspace(*ss) ) ss++;
+        if ( !*ss ) return -2;  // wrong number of fields
+        while ( *ss && isspace(*ss) ) ss++;
+    }
+    if ( !*ss ) return -2;
+
+    // Parse the payload
+    char *se = ss;
+    while ( *se && !isspace(*se) ) se++;
+    if ( !*se || se==ss ) error("Could not parse: %s\n", line);
+    ploidy->tmp_str.l = 0;
+    kputsn(ss,se-ss,&ploidy->tmp_str);
+
+    sex_ploidy_t *sp = (sex_ploidy_t*) payload;
+    if ( khash_str2int_get(sex2id, ploidy->tmp_str.s, &sp->sex) != 0 )
+    {
+        ploidy->nsex++;
+        hts_expand0(char*,ploidy->nsex,ploidy->msex,ploidy->id2sex);
+        ploidy->id2sex[ploidy->nsex-1] = strdup(ploidy->tmp_str.s);
+        sp->sex = khash_str2int_inc(ploidy->sex2id, ploidy->id2sex[ploidy->nsex-1]);
+    }
+
+    ss = se;
+    while ( *se && isspace(*se) ) se++;
+    if ( !*se ) error("Could not parse: %s\n", line);
+    sp->ploidy = strtol(ss,&se,10);
+    if ( ss==se ) error("Could not parse: %s\n", line);
+    if ( sp->ploidy < ploidy->min ) ploidy->min = sp->ploidy;
+    if ( sp->ploidy > ploidy->max ) ploidy->max = sp->ploidy;
+
+    return 0;
+}
+
+ploidy_t *ploidy_init(const char *fname, int dflt)
+{
+    ploidy_t *pld = (ploidy_t*) calloc(1,sizeof(ploidy_t));
+    if ( !pld ) return NULL;
+
+    pld->dflt = pld->min = pld->max = dflt;
+    pld->sex2id = khash_str2int_init();
+    pld->idx = regidx_init(fname,ploidy_parse,NULL,sizeof(sex_ploidy_t),pld);
+    if ( !pld->idx )
+    {
+        ploidy_destroy(pld);
+        pld = NULL;
+    }
+    return pld;
+}
+
+ploidy_t *ploidy_init_string(const char *str, int dflt)
+{
+    ploidy_t *pld = (ploidy_t*) calloc(1,sizeof(ploidy_t));
+    if ( !pld ) return NULL;
+
+    pld->dflt = pld->min = pld->max = dflt;
+    pld->sex2id = khash_str2int_init();
+    pld->idx = regidx_init(NULL,ploidy_parse,NULL,sizeof(sex_ploidy_t),pld);
+
+    kstring_t tmp = {0,0,0};
+    const char *ss = str;
+    while ( *ss )
+    {
+        while ( *ss && isspace(*ss) ) ss++;
+        const char *se = ss;
+        while ( *se && *se!='\r' && *se!='\n' ) se++;
+        tmp.l = 0;
+        kputsn(ss, se-ss, &tmp);
+        regidx_insert(pld->idx,tmp.s);
+        while ( *se && isspace(*se) ) se++;
+        ss = se;
+    }
+    regidx_insert(pld->idx,NULL);
+    free(tmp.s);
+
+    return pld;
+}
+
+void ploidy_destroy(ploidy_t *ploidy)
+{
+    if ( ploidy->sex2id ) khash_str2int_destroy_free(ploidy->sex2id);
+    if ( ploidy->idx ) regidx_destroy(ploidy->idx);
+    free(ploidy->id2sex);
+    free(ploidy->tmp_str.s);
+    free(ploidy);
+}
+
+int ploidy_query(ploidy_t *ploidy, char *seq, int pos, int *sex2ploidy, int *min, int *max)
+{
+    regitr_t itr;
+    int i, ret = regidx_overlap(ploidy->idx, seq,pos,pos, &itr);
+
+    if ( !sex2ploidy && !min && !max ) return ret;
+
+    if ( !ret )
+    {
+        // no overlap
+        if ( min ) *min = ploidy->dflt;
+        if ( max ) *max = ploidy->dflt;
+        if ( sex2ploidy )
+            for (i=0; i<ploidy->nsex; i++) sex2ploidy[i] = ploidy->dflt;
+        return 0;
+    }
+
+    int _min = INT_MAX, _max = -1;
+    if ( sex2ploidy ) for (i=0; i<ploidy->nsex; i++) sex2ploidy[i] = ploidy->dflt;
+
+    while ( REGITR_OVERLAP(itr,pos,pos) )
+    {
+        int sex = REGITR_PAYLOAD(itr,sex_ploidy_t).sex;
+        int pld = REGITR_PAYLOAD(itr,sex_ploidy_t).ploidy;
+        if ( pld!=ploidy->dflt ) 
+        {
+            if ( sex2ploidy ) sex2ploidy[ sex ] = pld;
+            if ( _min > pld ) _min = pld;
+            if ( _max < pld ) _max = pld;
+        }
+        itr.i++;
+    }
+    if ( _max==-1 ) _max = _min = ploidy->dflt;
+    if ( max ) *max = _max;
+    if ( min ) *min = _min;
+
+    return 1;
+}
+
+int ploidy_nsex(ploidy_t *ploidy)
+{
+    return ploidy->nsex;
+}
+
+char *ploidy_id2sex(ploidy_t *ploidy, int id)
+{
+    if ( id<0 || id>=ploidy->nsex ) return NULL;
+    return ploidy->id2sex[id];
+}
+
+int ploidy_sex2id(ploidy_t *ploidy, char *sex)
+{
+    int id;
+    if ( khash_str2int_get(ploidy->sex2id,sex,&id)!=0 ) return -1;
+    return id;
+}
+
+int ploidy_add_sex(ploidy_t *ploidy, const char *sex)
+{
+    int id;
+    if ( khash_str2int_get(ploidy->sex2id, sex, &id)==0 ) return id;
+    ploidy->nsex++;
+    hts_expand0(char*,ploidy->nsex,ploidy->msex,ploidy->id2sex);
+    ploidy->id2sex[ploidy->nsex-1] = strdup(sex);
+    return khash_str2int_inc(ploidy->sex2id, ploidy->id2sex[ploidy->nsex-1]);
+}
+
+int ploidy_max(ploidy_t *ploidy)
+{
+    return ploidy->dflt > ploidy->max ? ploidy->dflt : ploidy->max;
+}
+
+int ploidy_min(ploidy_t *ploidy)
+{
+    return ploidy->dflt < ploidy->min ? ploidy->dflt : ploidy->min;
+}
+
diff --git a/ploidy.h b/ploidy.h
new file mode 100644
index 0000000..b505eb9
--- /dev/null
+++ b/ploidy.h
@@ -0,0 +1,133 @@
+/* 
+    Copyright (C) 2014 Genome Research Ltd.
+
+    Author: Petr Danecek <pd3 at sanger.ac.uk>
+
+    Permission is hereby granted, free of charge, to any person obtaining a copy
+    of this software and associated documentation files (the "Software"), to deal
+    in the Software without restriction, including without limitation the rights
+    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+    copies of the Software, and to permit persons to whom the Software is
+    furnished to do so, subject to the following conditions:
+    
+    The above copyright notice and this permission notice shall be included in
+    all copies or substantial portions of the Software.
+    
+    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+    THE SOFTWARE.
+*/
+
+/*
+    Lookup from region and sex to ploidy.
+
+    Example of usage:
+
+        int default_ploidy = 2;
+        ploidy_t *pld = ploidy_init(fname, default_ploidy);
+
+        int nsex = ploidy_nsex(pld);
+        int *sex2ploidy = malloc(sizeof(int)*nsex);
+
+        ploidy_query(pld, "X",60000, sex2ploidy, NULL, NULL);
+        for (i=0; i<nsex; i++)
+            printf("ploidy of %s is %d\n", ploidy_id2sex(pld,i), sex2ploidy[i]);
+
+        ploidy_destroy(pld);
+
+    An example of ploidy file format follows. The coordinates are 1-based and
+    inclusive:
+        X 1 60000 M 1
+        X 2699521 154931043 M 1
+        Y 1 59373566 M 1
+        Y 1 59373566 F 0
+        MT 1 16569 M 1
+        MT 1 16569 F 1
+*/
+
+#ifndef __PLOIDY_H__
+#define __PLOIDY_H__
+
+#include <htslib/regidx.h>
+
+typedef struct _ploidy_t ploidy_t;
+
+typedef struct
+{
+    int sex, ploidy;
+}
+sex_ploidy_t;
+
+
+/*
+ *  ploidy_init()
+ *  @param fname:   input file name or NULL if default ploidy from example above should be used
+ *  @param dflt:    default ploidy to use for unlisted regions
+ *
+ *  Returns new structure on success or NULL on error.
+ */
+ploidy_t *ploidy_init(const char *fname, int dflt);
+
+/* Same as ploidy_init() but the whole file is passed as a single string */
+ploidy_t *ploidy_init_string(const char *str, int dflt);
+
+/*
+ *  ploidy_destroy() - free memory allocated by ploidy_init
+ */
+void ploidy_destroy(ploidy_t *ploidy);
+
+/*
+ *  ploidy_query() - query ploidy at a position for all genders at once
+ *  @param seq: chromosome name
+ *  @param pos: 0-based position
+ *  @param sex2ploidy:  if not NULL, array will be filled with mapping from sex id to ploidy
+ *  @param min: if not NULL, minimum encountered encountered will be set
+ *  @param max: if not NULL, maximum encountered encountered will be set
+ *
+ *  Returns 1 if the position is listed in the regions or 0 otherwise.
+ */
+int ploidy_query(ploidy_t *ploidy, char *seq, int pos, int *sex2ploidy, int *min, int *max);
+
+/*
+ *  ploidy_nsex() - return number of recognised genders
+ */
+int ploidy_nsex(ploidy_t *ploidy);
+
+/*
+ *  ploidy_id2sex() - mapping between numeric gender id and name
+ *
+ *  Returns gender name (e.g. "M" or "F" in the example above)
+ *  or NULL if there is no such id.
+ */
+char *ploidy_id2sex(ploidy_t *ploidy, int id);
+
+/*
+ *  ploidy_sex2id() - mapping between gender name and its numeric id
+ *
+ *  Returns numeric id or -1 if not present.
+ */
+int ploidy_sex2id(ploidy_t *ploidy, char *sex);
+
+/*
+ *  ploidy_add_sex() - register new gender name. This function is
+ *      useful when gender has the default ploidy for all regions
+ *      and is not listed in the file passed to ploidy_init()
+ *
+ *  Returns numeric id of the added sex, regardless of whether the string was
+ *  newly added or was already present in the dictionary.
+ */
+int ploidy_add_sex(ploidy_t *ploidy, const char *sex);
+
+/** Returns region index for raw access */
+regidx_t *ploidy_regions(ploidy_t *ploidy);
+
+/** Return the minimum / maximum recognised ploidy  */
+int ploidy_max(ploidy_t *ploidy);
+int ploidy_min(ploidy_t *ploidy);
+
+#endif
+
diff --git a/plot-vcfstats b/plot-vcfstats
new file mode 100755
index 0000000..38d9335
--- /dev/null
+++ b/plot-vcfstats
@@ -0,0 +1,2128 @@
+#!/usr/bin/env perl
+#
+#   Copyright (C) 2012-2014 Genome Research Ltd.
+#
+#   Author: Petr Danecek <pd3 at sanger.ac.uk>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+
+# Dependencies:
+#   - matplotlib
+#       http://matplotlib.sourceforge.net
+#   - LaTex/xcolor.sty
+#       Download .sty.gz LaTeX class style from http://www.ukern.de/tex/xcolor.html,
+#       unpack and install system-wide or place elsewhere and make available by
+#       setting the TEXINPUTS environment variable (note the colon)
+#           export TEXINPUTS=some/dir:
+#       The list of the recognised path can be obtained from `kpsepath tex`
+#
+#
+
+use strict;
+use warnings;
+use Carp;
+use Storable qw(dclone);
+
+my $opts = parse_params();
+parse_vcfstats($opts);
+merge_vcfstats($opts) if @{$$opts{vcfstats}} > 1;
+
+if ( $$opts{make_plots} )
+{
+    init_plots($opts);
+    plot_venn_bars($opts);
+    plot_counts_by_AF($opts);
+    plot_overlap_by_AF($opts);
+    plot_concordance_by_AF($opts);
+    plot_concordance_by_sample($opts);
+    for my $id (file_ids($opts))
+    {
+        # irc plots will be deprecated
+        #   plot_irc_by_AF($opts,$id);
+        #   plot_irc_by_rlen($opts,$id);
+        plot_tstv_by_AF($opts,$id);
+        plot_tstv_by_QUAL($opts,$id);
+        plot_indel_distribution($opts,$id);
+        plot_substitutions($opts,$id);
+        plot_per_sample_stats($opts,$id);
+        plot_DP($opts,$id);
+        plot_hwe($opts,$id);
+    }
+    plot($opts);
+}
+create_pdf($opts) unless !$$opts{make_pdf};
+
+exit;
+
+#--------------------------------
+
+sub error
+{
+    my (@msg) = @_;
+    if ( scalar @msg ) { confess @msg; }
+    die
+        "Usage: plot-vcfstats [OPTIONS] file.chk ...\n",
+        "       plot-vcfstats -p outdir/ file.chk ...\n",
+        "Options:\n",
+        "   -m, --merge                         Merge vcfstats files to STDOUT, skip plotting.\n",
+        "   -p, --prefix <path>                 The output files prefix, add a slash to create new directory.\n",
+        "   -P, --no-PDF                        Skip the PDF creation step.\n",
+        "   -r, --rasterize                     Rasterize PDF images for fast rendering.\n",
+        "   -s, --sample-names                  Use sample names for xticks rather than numeric IDs.\n",
+        "   -t, --title <string>                Identify files by these titles in plots. Can be given multiple times.\n",
+        "   -T, --main-title <string>           Main title for the PDF.\n",
+        "   -h, -?, --help                      This help message.\n",
+        "\n";
+}
+
+
+sub parse_params
+{
+    $0 =~ s{^.+/}{};
+    my $opts =
+    {
+        pdf_plots  => 1,
+        use_sample_names => 0,
+        verbose    => 1,
+        make_pdf   => 1,
+        make_plots => 1,
+        merge      => 0,
+        args       => join(' ',$0, at ARGV),
+        img_width  => 11/2.54,
+        img_height => 10/2.54,
+        id2col     => [ 'orange', 'red', 'darkgreen' ],
+        tex =>
+        {
+            slide3v => { height1 => '7cm', height2 => '7cm',  height3 => '4.5cm' },
+            slide3h => { width1  => '15cm', width2 => '10cm', width3 => '8cm' },
+        },
+
+        # for file version sanity check
+        sections =>
+        [
+            {
+                id=>'ID',
+                header=>'Definition of sets',
+                exp=>"# ID\t[2]id\t[3]tab-separated file names"
+            },
+            {
+                id=>'SN',
+                header=>'SN, Summary numbers',
+                exp=>"# SN  [2]id   [3]key  [4]value"
+            },
+            {
+                id=>'TSTV',
+                header=>'# TSTV, transition/transversions:',
+                exp=>"# TSTV\t[2]id\t[3]ts\t[4]tv\t[5]ts/tv\t[6]ts (1st ALT)\t[7]tv (1st ALT)\t[8]ts/tv (1st ALT)"
+            },
+            {
+                id=>'SiS',
+                header=>'Sis, Singleton stats',
+                exp=>"# SiS\t[2]id\t[3]allele count\t[4]number of SNPs\t[5]number of transitions\t[6]number of transversions\t[7]number of indels\t[8]repeat-consistent\t[9]repeat-inconsistent\t[10]not applicable"
+            },
+            {
+                id=>'AF',
+                header=>'AF, Stats by non-reference allele frequency',
+                exp=>"# AF\t[2]id\t[3]allele frequency\t[4]number of SNPs\t[5]number of transitions\t[6]number of transversions\t[7]number of indels\t[8]repeat-consistent\t[9]repeat-inconsistent\t[10]not applicable"
+            },
+            {
+                id=>'IDD',
+                header=>'IDD, InDel distribution',
+                exp=>"# IDD\t[2]id\t[3]length (deletions negative)\t[4]count"
+            },
+            {
+                id=>'ST',
+                header=>'ST, Substitution types',
+                exp=>"# ST\t[2]id\t[3]type\t[4]count"
+            },
+            {
+                id=>'GCsAF',
+                header=>'GCsAF, Genotype concordance by non-reference allele frequency (SNPs)',
+                exp=>"# GCsAF\t[2]id\t[3]allele frequency\t[4]RR Hom matches\t[5]RA Het matches\t[6]AA Hom matches\t[7]RR Hom mismatches\t[8]RA Het mismatches\t[9]AA Hom mismatches\t[10]dosage r-squared\t[11]number of sites"
+            },
+            {
+                id=>'GCiAF',
+                header=>'GCiAF, Genotype concordance by non-reference allele frequency (indels)',
+                exp=>"# GCiAF\t[2]id\t[3]allele frequency\t[4]RR Hom matches\t[5]RA Het matches\t[6]AA Hom matches\t[7]RR Hom mismatches\t[8]RA Het mismatches\t[9]AA Hom mismatches\t[10]dosage r-squared\t[11]number of sites"
+            },
+            {
+                id=>'NRDs',
+                header=>'Non-Reference Discordance (NRD), SNPs',
+                exp=>"# NRDs\t[2]id\t[3]NRD\t[4]Ref/Ref discordance\t[5]Ref/Alt discordance\t[6]Alt/Alt discordance"
+            },
+            {
+                id=>'NRDi',
+                header=>'Non-Reference Discordance (NRD), indels',
+                exp=>"# NRDi\t[2]id\t[3]NRD\t[4]Ref/Ref discordance\t[5]Ref/Alt discordance\t[6]Alt/Alt discordance"
+            },
+            {
+                id=>'GCsS',
+                header=>'GCsS, Genotype concordance by sample (SNPs)',
+                exp=>"# GCsS\t[2]id\t[3]sample\t[4]non-reference discordance rate\t[5]RR Hom matches\t[6]RA Het matches\t[7]AA Hom matches\t[8]RR Hom mismatches\t[9]RA Het mismatches\t[10]AA Hom mismatches"
+            },
+            {
+                id=>'GCiS',
+                header=>'GCiS, Genotype concordance by sample (indels)',
+                exp=>"# GCiS\t[2]id\t[3]sample\t[4]non-reference discordance rate\t[5]RR Hom matches\t[6]RA Het matches\t[7]AA Hom matches\t[8]RR Hom mismatches\t[9]RA Het mismatches\t[10]AA Hom mismatches"
+            },
+            {
+                id=>'PSC',
+                header=>'PSC, Per-sample counts',
+                exp=>"# PSC\t[2]id\t[3]sample\t[4]nRefHom\t[5]nNonRefHom\t[6]nHets\t[7]nTransitions\t[8]nTransversions\t[9]nIndels\t[10]average depth\t[11]nSingletons"
+            },
+            {
+                id=>'PSI',
+                header=>'PSI, Per-sample Indels',
+                exp=>"# PSI\t[2]id\t[3]sample\t[4]in-frame\t[5]out-frame\t[6]not applicable\t[7]out/(in+out) ratio"
+            },
+            {
+                id=>'DP',
+                header=>'DP, Depth distribution',
+                exp=>"# DP\t[2]id\t[3]bin\t[4]number of genotypes\t[5]fraction of genotypes (%)\t[6]number of sites\t[7]fraction of sites (%)"
+            },
+            {
+                id=>'FS',
+                header=>'FS, Indel frameshifts',
+                exp=>"# FS\t[2]id\t[3]in-frame\t[4]out-frame\t[5]not applicable\t[6]out/(in+out) ratio\t[7]in-frame (1st ALT)\t[8]out-frame (1st ALT)\t[9]not applicable (1st ALT)\t[10]out/(in+out) ratio (1st ALT)"
+            },
+            {
+                id=>'ICS',
+                header=>'ICS, Indel context summary',
+                exp=>"# ICS\t[2]id\t[3]repeat-consistent\t[4]repeat-inconsistent\t[5]not applicable\t[6]c/(c+i) ratio"
+            },
+            {
+                id=>'ICL',
+                header=>'ICL, Indel context by length',
+                exp=>"# ICL\t[2]id\t[3]length of repeat element\t[4]repeat-consistent deletions)\t[5]repeat-inconsistent deletions\t[6]consistent insertions\t[7]inconsistent insertions\t[8]c/(c+i) ratio"
+            },
+            {
+                id=>'QUAL',
+                header=>'QUAL, Stats by quality',
+                exp=>"# QUAL\t[2]id\t[3]Quality\t[4]number of SNPs\t[5]number of transitions (1st ALT)\t[6]number of transversions (1st ALT)\t[7]number of indels"
+            },
+            {
+                id=>'HWE',
+                header=>'HWE',
+                exp=>"# HWE\t[2]id\t[3]1st ALT allele frequency\t[4]Number of observations\t[5]25th percentile\t[6]median\t[7]75th percentile",
+            },
+        ],
+    };
+    for my $sec (@{$$opts{sections}}) { $$opts{exp}{$$sec{id}} = $$sec{exp}; $$opts{id2sec}{$$sec{id}} = $sec; }
+    while (defined(my $arg=shift(@ARGV)))
+    {
+        if (                 $arg eq '--no-plots' ) { $$opts{make_plots}=0; next; }
+        if ( $arg eq '-P' || $arg eq '--no-PDF' ) { $$opts{make_pdf}=0; next; }
+        if ( $arg eq '-r' || $arg eq '--rasterize' ) { $$opts{rasterize}=1; $$opts{pdf_plots} = 0; next; }
+        if ( $arg eq '-m' || $arg eq '--merge' ) { $$opts{make_plots}=0; $$opts{make_pdf}=0; $$opts{merge}=1; next; }
+        if ( $arg eq '-s' || $arg eq '--sample-names' ) { $$opts{use_sample_names}=1; next; }
+        if ( $arg eq '-t' || $arg eq '--title' ) { push @{$$opts{titles}},shift(@ARGV); next; }
+        if ( $arg eq '-T' || $arg eq '--main-title' ) { $$opts{main_title} = shift(@ARGV); next; }
+        if ( $arg eq '-p' || $arg eq '--prefix' ) { $$opts{prefix}=shift(@ARGV); next; }
+        if ( $arg eq '-?' || $arg eq '-h' || $arg eq '--help' ) { error(); }
+        if ( -e $arg ) { push @{$$opts{vcfstats}},$arg; next; }
+        error("Unknown parameter or non-existent file \"$arg\". Run -h for help.\n");
+    }
+    if ( !exists($$opts{vcfstats}) ) { error(); }
+    if ( !exists($$opts{prefix}) )
+    {
+        if ( !$$opts{merge} ) { error("Expected -p parameter.\n") }
+        $$opts{prefix} = './';
+    }
+    elsif ( $$opts{merge} ) { error("Only one of -p or -m should be given.\n"); }
+    if ( $$opts{merge} && @{$$opts{vcfstats}} < 2 ) { error("Nothing to merge\n") }
+
+    $$opts{dir} = $$opts{prefix};
+    $$opts{dir} =~ s{/[^/]+$}{/};
+    if ( !($$opts{dir}=~m{/$}) ) { $$opts{dir} = './'; }
+    if ( !($$opts{prefix}=~m{/$}) && !($$opts{prefix}=~/-$/) ) { $$opts{prefix} .= '-'; }
+    $$opts{lprefix} = $$opts{prefix};
+    $$opts{lprefix} =~ s{^.+/}{};
+    $$opts{logfile} = "$$opts{lprefix}plot-vcfstats.log";
+    if ( !-d $$opts{dir} ) { `mkdir -p $$opts{dir}`; }
+    `> $$opts{dir}$$opts{logfile}` unless $$opts{merge};
+    return $opts;
+}
+
+
+sub plot
+{
+    my ($opts) = @_;
+    if ( !exists($$opts{plt_fh}) ) { return; }
+    close($$opts{plt_fh}) or error("close $$opts{plt_fh}");
+    my $cmd = "python $$opts{plt_file}";
+    print STDERR "Plotting graphs: $cmd\n" unless !$$opts{verbose};
+    system($cmd);
+    if ( $? ) { error("The command exited with non-zero status $?:\n\t$cmd\n\n"); }
+}
+
+
+sub parse_vcfstats
+{
+    my ($opts) = @_;
+    for (my $i=0; $i<@{$$opts{vcfstats}}; $i++) { parse_vcfstats1($opts,$i); }
+
+    # Check sanity
+    if ( !exists($$opts{dat}{ID}{0}) )
+    {
+        error("Sanity check failed: no stats found by vcfstats??\n");
+    }
+
+    # Set titles
+    my %file2title;
+    my %title2file;
+    if ( exists($$opts{titles}) )
+    {
+        for (my $i=0; $i<@{$$opts{titles}}; $i++)
+        {
+            if ( !exists($$opts{dat}{ID}{$i}) ) { next; }
+            $file2title{$$opts{dat}{ID}{$i}[0][0]} = $$opts{titles}[$i];
+            $title2file{$$opts{titles}[$i]} = $$opts{dat}{ID}{$i}[0][0];
+        }
+    }
+    for my $id (file_ids($opts))
+    {
+        if ( @{$$opts{dat}{ID}{$id}[0]}>1 ) { next; }   # shared stats of two files
+        my $file = $$opts{dat}{ID}{$id}[0][0];
+        if ( !exists($file2title{$file}) )  # create short title
+        {
+            my $bname = $file;
+            $bname =~ s{^.*/}{};
+            $bname =~ s{\.vcf\.gz$}{}i;
+            if ( length($bname) > 5 ) { $bname = substr($bname,0,5); }
+            my $i = 0;
+            my $title = $bname;
+            while ( exists($title2file{$title}) ) { $title = $bname.chr(66+$i); $i++; }
+            $file2title{$file} = $title;
+            $title2file{$title} = $file;
+        }
+    }
+    for my $id (file_ids($opts))
+    {
+        my @titles;
+        for my $file (@{$$opts{dat}{ID}{$id}[0]}) { push @titles, $file2title{$file} if $file2title{$file}; }
+        $$opts{title}{$id} = join(' + ', at titles);
+    }
+
+    # mapping from file names to list of IDs
+    for my $id (file_ids($opts))
+    {
+        my @files;
+        for my $file (@{$$opts{dat}{ID}{$id}[0]})
+        {
+            push @{$$opts{file2ids}{$file}}, $id;
+        }
+    }
+
+    # check sanity of the file merge: were the correct files merged?
+    if ( exists($$opts{coalesced_files}) && $$opts{verbose} )
+    {
+        print STDERR "The vcfstats outputs have been merged as follows:\n";
+        my %printed;
+        for my $id (keys %{$$opts{coalesced_files}})
+        {
+            for (my $i=0; $i<@{$$opts{coalesced_files}{$id}}; $i++)
+            {
+                for (my $j=0; $j<@{$$opts{coalesced_files}{$id}[$i]}; $j++)
+                {
+                    if ( exists($printed{$$opts{dat}{ID}{$id}[$i][$j]}) ) { next; }
+                    print STDERR "\t$$opts{dat}{ID}{$id}[$i][$j]\n";
+                    for my $file (keys %{$$opts{coalesced_files}{$id}[$i][$j]})
+                    {
+                        my $n = $$opts{coalesced_files}{$id}[$i][$j]{$file};
+                        print STDERR "\t\t$file", ($n>1 ? "\t..\t${n}x" : ''),"\n";
+                    }
+                    $printed{$$opts{dat}{ID}{$id}[$i][$j]} = 1;
+                }
+            }
+        }
+    }
+}
+
+sub add_to_values
+{
+    my ($dst,$src,$cmp) = @_;
+    my $id = 0;
+    my $is = 0;
+    while ($is<@$src)
+    {
+        while ( $id<@$dst && &$cmp($$src[$is][0],$$dst[$id][0])>0 ) { $id++; }
+        if ( $id<@$dst && !&$cmp($$src[$is][0],$$dst[$id][0]) )
+        {
+            for (my $j=1; $j<@{$$src[$is]}; $j++) { $$dst[$id][$j] += $$src[$is][$j]; }
+        }
+        else { splice(@$dst,$id,0,$$src[$is]); }
+        $is++;
+    }
+}
+
+sub add_to_sample_values
+{
+    my ($dst,$src) = @_;
+    my %id2i;
+    for (my $i=0; $i<@$dst; $i++)
+    {
+        $id2i{$$dst[$i][0]} = $i;
+    }
+    for (my $i=0; $i<@$src; $i++)
+    {
+        if ( !exists($id2i{$$src[$i][0]}) ) { error("Whoops, no such dst sample: $$src[$i][0]\n"); }
+        my $di = $id2i{$$src[$i][0]};
+        for (my $j=1; $j<@{$$src[$i]}; $j++)
+        {
+            $$dst[$di][$j] += $$src[$i][$j];
+        }
+    }
+}
+
+sub merge_PSC
+{
+    my ($a,$b,$n) = @_;
+    for (my $i=0; $i<@$a; $i++) { $$a[$i][7] *= $n; }   # average DP
+    add_to_sample_values($a,$b);
+    for (my $i=0; $i<@$a; $i++) { $$a[$i][7] /= $n+1; }
+}
+
+sub merge_PSI
+{
+    my ($a,$b,$n) = @_;
+    add_to_sample_values($a,$b);
+    for (my $i=0; $i<@$b; $i++) { $$a[$i][4] = sprintf "%.2f", ($$a[$i][1]+$$a[$i][2] ? $$a[$i][2]/($$a[$i][1]+$$a[$i][2]) : 0); }
+}
+
+sub rglob
+{
+    my ($a,$b) = @_;
+    if ( $a eq $b ) { return $a; }
+    $a =~ s/\*//;
+    my $la = length($a);
+    my $lb = length($b);
+    my $i = 0;
+    while ( $i<$la && $i<$lb && substr($a,$i,1) eq substr($b,$i,1) ) { $i++; }
+    $la--; $lb--;
+    while ( $la>$i && $lb>$i && substr($a,$la,1) eq substr($b,$lb,1) ) { $la--; $lb--; }
+    $la = $la==$i && $lb==$i ? 1 : $la-$i;
+    substr($a,$i,$la,'*');
+    return $a;
+}
+
+sub merge_id
+{
+    # merge id filenames
+    my ($opts,$dst,$src,$id) = @_;
+    for (my $i=0; $i<@{$$src{$id}}; $i++)
+    {
+        for (my $j=0; $j<@{$$src{$id}[$i]}; $j++)
+        {
+            my $gname = rglob($$dst{$id}[$i][$j], $$src{$id}[$i][$j]);
+            $$dst{$id}[$i][$j] = $gname;
+            $$opts{coalesced_files}{$id}[$i][$j]{$$src{$id}[$i][$j]}++;
+        }
+    }
+}
+
+sub add_to_avg
+{
+    my ($dst,$src,$n) = @_;
+    for (my $i=0; $i<@$src; $i++)
+    {
+        if ( ref($$dst[$i]) eq 'ARRAY' )
+        {
+            for (my $j=0; $j<@{$$dst[$i]}; $j++)
+            {
+                $$dst[$i][$j] = ($n*$$dst[$i][$j]+$$src[$i][$j])/($n+1);
+            }
+        }
+        else
+        {
+            $$dst[$i] = ($n*$$dst[$i]+$$src[$i])/($n+1);
+        }
+    }
+}
+
+sub cmp_str($$) { my ($a,$b) = @_; return $a cmp $b; }
+sub cmp_num($$) { my ($a,$b) = @_; return $a <=> $b; }
+sub cmp_num_op($$)
+{
+    # numeric compare with operators
+    # Cases like <3, >500 make it complicated
+    my ($a,$b) = @_;
+    my $xa = '=';
+    my $xb = '=';
+    if ( $a=~/^(\D+)/ ) { $xa = $1; $a = $'; }
+    if ( $b=~/^(\D+)/ ) { $xb = $1; $b = $'; }
+    if ( $a==$b ) { return $xa cmp $xb; }
+    $a <=> $b;
+}
+
+sub merge_dp
+{
+    my ($a,$b) = @_;
+    add_to_values($a,$b,\&cmp_num_op);
+    # recalculate fraction of GTs, cannot be simply summed
+    my $sum = 0;
+    for (my $i=0; $i<@$a; $i++) { $sum += $$a[$i][1]; }
+    for (my $i=0; $i<@$a; $i++) { $$a[$i][2] = $$a[$i][1]*100./$sum; }
+}
+
+sub merge_GCsS
+{
+    my ($a,$b,$n) = @_;
+    # average the non-ref discordance rate
+    for (my $i=0; $i<@$a; $i++) { $$a[$i][1] *= $n; }
+    add_to_sample_values($a,$b);
+    for (my $i=0; $i<@$a; $i++) { $$a[$i][1] /= $n+1; }
+}
+
+sub merge_FS
+{
+    my ($a,$b) = @_;
+    for (my $i=0; $i<@$a; $i++)
+    {
+        for (my $j=0; $j<3; $j++) { $$a[$i][$j] += $$b[$i][$j]; }
+        $$a[$i][3] = sprintf "%.2f", ($$a[$i][0] + $$a[$i][1]) ? $$a[$i][1]/($$a[$i][0] + $$a[$i][1]) : 0;
+
+        for (my $j=4; $j<7; $j++) { $$a[$i][$j] += $$b[$i][$j]; }
+        $$a[$i][7] = sprintf "%.2f", ($$a[$i][4] + $$a[$i][5]) ? $$a[$i][5]/($$a[$i][4] + $$a[$i][5]) : 0;
+    }
+}
+
+sub merge_ICS
+{
+    my ($a,$b) = @_;
+    for (my $i=0; $i<@$a; $i++)
+    {
+        for (my $j=0; $j<3; $j++) { $$a[$i][$j] += $$b[$i][$j]; }
+        $$a[$i][3] = sprintf "%.4f", ($$a[$i][0] + $$a[$i][1]) ? $$a[$i][0]/($$a[$i][0] + $$a[$i][1]) : 0;
+    }
+}
+
+sub merge_ICL
+{
+    my ($a,$b) = @_;
+    for (my $i=0; $i<@$a; $i++)
+    {
+        for (my $j=1; $j<5; $j++) { $$a[$i][$j] += $$b[$i][$j]; }
+        $$a[$i][5] = sprintf "%.4f", ($$a[$i][2] + $$a[$i][4]) ? ($$a[$i][1] + $$a[$i][3])/($$a[$i][1] + $$a[$i][2] + $$a[$i][3] + $$a[$i][4]) : 0;
+    }
+}
+
+sub merge_TSTV
+{
+    my ($a,$b) = @_;
+    for (my $i=0; $i<@$a; $i++)
+    {
+        for (my $j=0; $j<2; $j++) { $$a[$i][$j] += $$b[$i][$j]; }
+        $$a[$i][2] = sprintf "%.2f", $$a[$i][1] ? $$a[$i][0]/$$a[$i][1] : 0;
+
+        for (my $j=3; $j<5; $j++) { $$a[$i][$j] += $$b[$i][$j]; }
+        $$a[$i][5] = sprintf "%.2f", $$a[$i][4] ? $$a[$i][3]/$$a[$i][4] : 0;
+    }
+}
+
+sub merge_GCsAF
+{
+    my ($a,$b) = @_;
+    # recalculate r2
+    for (my $i=0; $i<@$a; $i++) { $$a[$i][7] *= $$a[$i][8]; }
+    for (my $i=0; $i<@$b; $i++) { $$b[$i][7] *= $$b[$i][8]; }
+    add_to_values($a,$b,\&cmp_num_op);
+    for (my $i=0; $i<@$a; $i++) { $$a[$i][7] /= $$a[$i][8]; }
+}
+
+sub parse_vcfstats1
+{
+    my ($opts,$i) = @_;
+    my $file = $$opts{vcfstats}[$i];
+    print STDERR "Parsing bcftools stats output: $file\n" unless !$$opts{verbose};
+    open(my $fh,'<',$file) or error("$file: $!");
+    my $line = <$fh>;
+    if ( !$line or !($line=~/^# This file was produced by \S*/) ) { error("Sanity check failed: was this file generated by bcftools stats?"); }
+    my %dat;
+    while ($line=<$fh>)
+    {
+        $line =~ s/\s*$//;
+        if ( $line=~/^#\s+(\S+)\t/ )
+        {
+            $$opts{def_line}{$1} = $line;
+            next;
+        }
+        if ( $line=~/^#/ ) { next; }
+        my @items = split(/\t/,$line);
+        if ( $items[0] eq 'SN' )
+        {
+            $dat{$items[1]}{$items[2]} = splice(@items,3);
+            next;
+        }
+        push @{$dat{$items[0]}{$items[1]}}, [splice(@items,2)];
+    }
+    close($fh);
+    for my $a (keys %dat)
+    {
+        if ( !exists($$opts{dat}{$a}) ) { $$opts{dat}{$a} = $dat{$a}; next; } # first vcfstats file
+        for my $b (keys %{$dat{$a}})
+        {
+            # Merging multiple vcfstats files. Honestly, this is quite hacky.
+            if ( !exists($$opts{dat}{$a}{$b}) ) { $$opts{dat}{$a}{$b} = $dat{$a}{$b}; next; } # copy all, first occurance
+
+            if ( $a eq 'ID' ) { merge_id($opts,$$opts{dat}{$a},$dat{$a},$b); }
+            elsif ( ref($dat{$a}{$b}) ne 'ARRAY' ) { $$opts{dat}{$a}{$b} += $dat{$a}{$b} unless $b eq 'number of samples:'; } # SN, Summary numbers, do not sum sample counts
+            elsif ( $a eq 'NRDs' ) { add_to_avg($$opts{dat}{$a}{$b},$dat{$a}{$b},$i); }
+            elsif ( $a eq 'NRDi' ) { add_to_avg($$opts{dat}{$a}{$b},$dat{$a}{$b},$i); }
+            elsif ( $a eq 'DP' ) { merge_dp($$opts{dat}{$a}{$b},$dat{$a}{$b}); }
+            elsif ( $a eq 'GCsS' ) { merge_GCsS($$opts{dat}{$a}{$b},$dat{$a}{$b},$i); }
+            elsif ( $a eq 'GCiS' ) { merge_GCsS($$opts{dat}{$a}{$b},$dat{$a}{$b},$i); }
+            elsif ( $a eq 'GCsAF' ) { merge_GCsAF($$opts{dat}{$a}{$b},$dat{$a}{$b},$i); }
+            elsif ( $a eq 'GCiAF' ) { merge_GCsAF($$opts{dat}{$a}{$b},$dat{$a}{$b},$i); }
+            elsif ( $a eq 'ST' ) { add_to_values($$opts{dat}{$a}{$b},$dat{$a}{$b},\&cmp_str); }
+            elsif ( $a eq 'PSC') { merge_PSC($$opts{dat}{$a}{$b},$dat{$a}{$b},$i); }
+            elsif ( $a eq 'PSI') { merge_PSI($$opts{dat}{$a}{$b},$dat{$a}{$b},$i); }
+            elsif ( $a eq 'IDD') { add_to_values($$opts{dat}{$a}{$b},$dat{$a}{$b},\&cmp_num); }
+            elsif ( $a eq 'FS') { merge_FS($$opts{dat}{$a}{$b},$dat{$a}{$b}); }
+            elsif ( $a eq 'ICS') { merge_ICS($$opts{dat}{$a}{$b},$dat{$a}{$b}); }
+            elsif ( $a eq 'ICL') { merge_ICL($$opts{dat}{$a}{$b},$dat{$a}{$b}); }
+            elsif ( $a eq 'TSTV') { merge_TSTV($$opts{dat}{$a}{$b},$dat{$a}{$b},$i); }
+            elsif ( $a eq 'DBG' ) { next; }
+            else { add_to_values($$opts{dat}{$a}{$b},$dat{$a}{$b},\&cmp_num_op); } # SiS AF IDD
+        }
+    }
+}
+
+sub file_ids
+{
+    my ($opts) = @_;
+    my $id = 0;
+    my @out;
+    while ( exists($$opts{dat}{ID}) && exists($$opts{dat}{ID}{$id}) ) { push @out, $id++; }
+    return @out;
+}
+
+sub tprint
+{
+    my ($fh, at txt) = @_;
+    for my $txt (@txt)
+    {
+        $txt =~ s/\n[ \t]+/\n/g;        # eat leading tabs
+        while ( ($txt =~ /\n\t*\\t/) )
+        {
+            $txt =~ s/(\n\t*)\\t/$1\t/g;    # replace escaped tabs (\\t) with tabs
+        }
+        print $fh $txt;
+    }
+}
+
+sub init_plots
+{
+    my ($opts) = @_;
+
+    $$opts{plt_file} = "$$opts{prefix}plot.py";
+
+    my $titles = "# Title abbreviations:\n";
+    for my $id (file_ids($opts))
+    {
+        $titles .= "# \t $id .. $$opts{title}{$id} .. $$opts{dat}{ID}{$id}[0][0]\n";
+    }
+    $titles .= "#";
+
+    open(my $fh,'>',$$opts{plt_file}) or error("$$opts{plt_file}: $!");
+    tprint $fh, qq[
+        # This file was produced by plot-vcfstats, the command line was:
+        #   $$opts{args}
+        #
+        # Edit as necessary and recreate the plots by running
+        #   python $$opts{plt_file}
+        #
+        $titles
+
+        # Set to 1 to plot in PDF instead of PNG
+        pdf_plots = $$opts{pdf_plots}
+
+        # Plots to generate, set to 0 to disable
+        plot_venn_snps = 1
+        plot_venn_indels = 1
+        plot_tstv_by_sample = 1
+        plot_hethom_by_sample = 1
+        plot_snps_by_sample = 1
+        plot_indels_by_sample = 1
+        plot_singletons_by_sample = 1 
+        plot_depth_by_sample = 1
+        plot_SNP_count_by_af = 1
+        plot_Indel_count_by_af = 1
+        plot_SNP_overlap_by_af = 1
+        plot_Indel_overlap_by_af = 1
+        plot_dp_dist = 1
+        plot_hwe = 1
+        plot_concordance_by_af = 1
+        plot_r2_by_af = 1
+        plot_discordance_by_sample = 1
+        plot_tstv_by_af = 1
+        plot_indel_dist = 1
+        plot_tstv_by_qual = 1
+        plot_substitutions = 1
+
+
+        # Set to 1 to use sample names for xticks instead of numeric sequential IDs
+        #   and adjust margins and font properties if necessary
+        sample_names   = $$opts{use_sample_names}
+        sample_margins = {'right':0.98, 'left':0.07, 'bottom':0.2}
+        sample_font    = {'rotation':45, 'ha':'right', 'fontsize':8}
+
+        if sample_names==0: sample_margins=(); sample_font=();
+
+
+        #-------------------------------------------------
+
+
+        import matplotlib as mpl
+        mpl.use('Agg')
+        import matplotlib.pyplot as plt
+
+        import csv
+        csv.register_dialect('tab', delimiter='\\t', quoting=csv.QUOTE_NONE)
+
+        import numpy
+        def smooth(x,window_len=11,window='hanning'):
+        \\tif x.ndim != 1: raise ValueError, "smooth only accepts 1 dimension arrays."
+        \\tif x.size < window_len: return x
+        \\tif window_len<3: return x
+        \\tif not window in ['flat', 'hanning', 'hamming', 'bartlett', 'blackman']: raise ValueError, "Window is on of 'flat', 'hanning', 'hamming', 'bartlett', 'blackman'"
+        \\ts = numpy.r_[x[window_len-1:0:-1],x,x[-1:-window_len:-1]]
+        \\tif window == 'flat': # moving average
+        \\t\\tw = numpy.ones(window_len,'d')
+        \\telse:
+        \\t\\tw = eval('numpy.'+window+'(window_len)')
+        \\ty = numpy.convolve(w/w.sum(),s,mode='valid')
+        \\treturn y[(window_len/2-1):-(window_len/2)]
+
+        ];
+    $$opts{plt_fh} = $fh;
+}
+
+sub percentile
+{
+    my ($p, at vals) = @_;
+    my $N = 0;
+    for my $val (@vals) { $N += $val; }
+    my $n = $p*($N+1)/100.;
+    my $k = int($n);
+    my $d = $n-$k;
+    if ( $k<=0 ) { return 0; }
+    if ( $k>=$N ) { return scalar @vals-1; }
+    my $cnt;
+    for (my $i=0; $i<@vals; $i++)
+    {
+        $cnt += $vals[$i];
+        if ( $cnt>=$k ) { return $i; }
+    }
+    error("FIXME: this should not happen [percentile]\n");
+}
+
+sub get_values
+{
+    my ($opts,$id,$key,$i,$j) = @_;
+    if ( !exists($$opts{dat}{$key}) ) { return (); }
+    if ( !exists($$opts{dat}{$key}{$id}) ) { return (); }
+    my $fields_ok = 1;
+    if ( !exists($$opts{exp}{$key}) ) { error("todo: sanity check for $key\n"); }
+    if ( exists($$opts{def_line}{$key}) && $$opts{def_line}{$key} ne $$opts{exp}{$key} && !$$opts{def_line_warned}{$key} )
+    {
+        warn("Warning: Possible version mismatch, the definition line differs\n\texpected: $$opts{exp}{$key}\n\tfound:    $$opts{def_line}{$key}\n");
+        $$opts{def_line_warned}{$key} = 1;
+    }
+    if ( defined $i )
+    {
+        if ( defined $j ) { return $$opts{dat}{$key}{$id}[$i][$j]; }
+        return (@{$$opts{dat}{$key}{$id}[$i]});
+    }
+    return (@{$$opts{dat}{$key}{$id}});
+}
+
+sub get_value
+{
+    my ($opts,$id,$key) = @_;
+    if ( !exists($$opts{dat}{$id}) ) { return undef; }
+    if ( !exists($$opts{dat}{$id}{$key}) ) { return undef}
+    return $$opts{dat}{$id}{$key};
+}
+
+sub plot_venn_bars
+{
+    my ($opts) = @_;
+
+    my @ids  = file_ids($opts);
+    if ( @ids != 3 ) { return; }
+
+    my (@snps, at indels, at tstv, at snp_titles, at indel_titles);
+    for my $id (0..2)
+    {
+        push @snps, get_value($opts,$id,'number of SNPs:');
+        push @indels, get_value($opts,$id,'number of indels:');
+        push @tstv, sprintf("%.2f",get_values($opts,$id,'TSTV',0,5));
+        push @snp_titles, "$$opts{title}{$id}\\nts/tv $tstv[$id]\\n" .bignum($snps[$id]);
+        my @fs = get_values($opts,$id,'FS');
+        my $fs = @fs ? "frm $fs[0][3]\\n" : '';
+        push @indel_titles, "$$opts{title}{$id}\\n$fs" .bignum($indels[$id]);
+    }
+
+    my $fh = $$opts{plt_fh};
+    tprint $fh, qq[
+
+            if plot_venn_snps:
+            \\tfig = plt.figure(figsize=($$opts{img_width},$$opts{img_height}))
+            \\tax1 = fig.add_subplot(111)
+            \\tax1.bar([1,2,3],[$snps[0],$snps[2],$snps[1]],align='center',color='$$opts{id2col}[0]',width=0.3)
+            \\tax1.ticklabel_format(style='sci', scilimits=(0,0), axis='y')
+            \\tax1.set_xlim(0.5,3.5)
+            \\tplt.xticks([1,2,3],('$snp_titles[0]','$snp_titles[2]','$snp_titles[1]'))
+            \\tplt.title('Number of SNPs')
+            \\tplt.subplots_adjust(right=0.95,bottom=0.15)
+            \\tplt.savefig('$$opts{prefix}venn_bars.snps.png')
+            \\tif pdf_plots: plt.savefig('$$opts{prefix}venn_bars.snps.pdf')
+            \\tplt.close()
+
+
+            if plot_venn_indels:
+            \\tfig = plt.figure(figsize=($$opts{img_width},$$opts{img_height}))
+            \\tax1 = fig.add_subplot(111)
+            \\tax1.bar([1,2,3],[$indels[0],$indels[2],$indels[1]],align='center',color='$$opts{id2col}[1]',width=0.3)
+            \\tax1.ticklabel_format(style='sci', scilimits=(0,0), axis='y')
+            \\tax1.set_xlim(0.5,3.5)
+            \\tplt.xticks([1,2,3],('$indel_titles[0]','$indel_titles[2]','$indel_titles[1]'))
+            \\tplt.title('Number of indels')
+            \\tplt.subplots_adjust(right=0.95,bottom=0.15)
+            \\tplt.savefig('$$opts{prefix}venn_bars.indels.png')
+            \\tif pdf_plots: plt.savefig('$$opts{prefix}venn_bars.indels.pdf')
+            \\tplt.close()
+
+        ];
+}
+
+sub plot_per_sample_stats
+{
+    my ($opts,$id) = @_;
+    my @vals = get_values($opts,$id,'PSC');
+    if ( !@vals ) { return; }
+
+    my $fh   = $$opts{plt_fh};
+    my $img  = "$$opts{prefix}tstv_by_sample.$id";
+    my $img2 = "$$opts{prefix}hets_by_sample.$id";
+    my $img3 = "$$opts{prefix}snps_by_sample.$id";
+    my $img4 = "$$opts{prefix}indels_by_sample.$id";
+    my $img5 = "$$opts{prefix}singletons_by_sample.$id";
+    my $img6 = "$$opts{prefix}dp_by_sample.$id";
+
+    open(my $tfh,'>',"$img.dat") or error("$img.dat: $!");
+    print $tfh "# [1]Sample ID\t[2]ts/tv\t[3]het/hom\t[4]nSNPs\t[5]nIndels\t[6]Average depth\t[7]nSingletons\t[8]Sample name\n";
+    for (my $i=0; $i<@vals; $i++)
+    {
+        my $tstv = $vals[$i][5] ? $vals[$i][4]/$vals[$i][5] : 0;
+        my $hethom = $vals[$i][2] ? $vals[$i][3]/$vals[$i][2] : 0;
+        printf $tfh "%d\t%f\t%f\t%d\t%d\t%f\t%d\t%s\n", $i, $tstv, $hethom, $vals[$i][4]+$vals[$i][5], $vals[$i][6], $vals[$i][7], $vals[$i][8], $vals[$i][0];
+    }
+    close($tfh);
+
+    tprint $fh, "
+
+
+            dat = []
+            with open('$img.dat', 'rb') as f:
+            \\treader = csv.reader(f, 'tab')
+            \\tfor row in reader:
+            \\t\\tif row[0][0] != '#': dat.append(row)
+
+            if plot_tstv_by_sample:
+            \\tfig = plt.figure(figsize=(2*$$opts{img_width},$$opts{img_height}*0.7))
+            \\tax1 = fig.add_subplot(111)
+            \\tax1.plot([row[0] for row in dat], [row[1] for row in dat], 'o', color='$$opts{id2col}[$id]',mec='$$opts{id2col}[$id]')
+            \\tax1.set_ylabel('Ts/Tv')
+            \\tax1.set_ylim(min(float(row[1]) for row in dat)-0.1,max(float(row[1]) for row in dat)+0.1)
+            \\tif sample_names:
+            \\t\\t     plt.xticks([row[0] for row in dat],[row[7] for row in dat],**sample_font)
+            \\t\\t     plt.subplots_adjust(**sample_margins)
+            \\telse:
+            \\t\\t     plt.subplots_adjust(right=0.98,left=0.07,bottom=0.17)
+            \\t\\t     ax1.set_xlabel('Sample ID')
+            \\tplt.title('$$opts{title}{$id}')
+            \\tplt.savefig('$img.png')
+            \\tif pdf_plots: plt.savefig('$img.pdf')
+            \\tplt.close()
+
+
+            if plot_hethom_by_sample:
+            \\tfig = plt.figure(figsize=(2*$$opts{img_width},$$opts{img_height}*0.7))
+            \\tax1 = fig.add_subplot(111)
+            \\tax1.plot([row[0] for row in dat], [row[2] for row in dat], 'o', color='$$opts{id2col}[$id]',mec='$$opts{id2col}[$id]')
+            \\tax1.set_ylabel('nHet(RA) / nHom(AA)')
+            \\tax1.ticklabel_format(style='sci', scilimits=(0,0), axis='y')
+            \\tif sample_names:
+            \\t\\t     plt.xticks([row[0] for row in dat],[row[7] for row in dat],**sample_font)
+            \\t\\t     plt.subplots_adjust(**sample_margins)
+            \\telse:
+            \\t\\t     plt.subplots_adjust(right=0.98,left=0.07,bottom=0.17)
+            \\t\\t     ax1.set_xlabel('Sample ID')
+            \\tplt.title('$$opts{title}{$id}')
+            \\tplt.savefig('$img2.png')
+            \\tif pdf_plots: plt.savefig('$img2.pdf')
+            \\tplt.close()
+
+
+            if plot_snps_by_sample:
+            \\tfig = plt.figure(figsize=(2*$$opts{img_width},$$opts{img_height}*0.7))
+            \\tax1 = fig.add_subplot(111)
+            \\tax1.plot([row[0] for row in dat], [row[3] for row in dat], 'o', color='$$opts{id2col}[$id]',mec='$$opts{id2col}[$id]')
+            \\tax1.set_ylabel('Number of SNPs')
+            \\tax1.ticklabel_format(style='sci', scilimits=(0,0), axis='y')
+            \\tif sample_names:
+            \\t\\t     plt.xticks([row[0] for row in dat],[row[7] for row in dat],**sample_font)
+            \\t\\t     plt.subplots_adjust(**sample_margins)
+            \\telse:
+            \\t\\t     plt.subplots_adjust(right=0.98,left=0.07,bottom=0.17)
+            \\t\\t     ax1.set_xlabel('Sample ID')
+            \\tplt.title('$$opts{title}{$id}')
+            \\tplt.savefig('$img3.png')
+            \\tif pdf_plots: plt.savefig('$img3.pdf')
+            \\tplt.close()
+
+
+            if plot_indels_by_sample:
+            \\tfig = plt.figure(figsize=(2*$$opts{img_width},$$opts{img_height}*0.7))
+            \\tax1 = fig.add_subplot(111)
+            \\tax1.plot([row[0] for row in dat], [row[4] for row in dat], 'o', color='$$opts{id2col}[$id]',mec='$$opts{id2col}[$id]')
+            \\tax1.set_ylabel('Number of indels')
+            \\tax1.ticklabel_format(style='sci', scilimits=(0,0), axis='y')
+            \\tif sample_names:
+            \\t\\t     plt.xticks([row[0] for row in dat],[row[7] for row in dat],**sample_font)
+            \\t\\t     plt.subplots_adjust(**sample_margins)
+            \\telse:
+            \\t\\t     plt.subplots_adjust(right=0.98,left=0.07,bottom=0.17)
+            \\t\\t     ax1.set_xlabel('Sample ID')
+            \\tplt.title('$$opts{title}{$id}')
+            \\tplt.savefig('$img4.png')
+            \\tif pdf_plots: plt.savefig('$img4.pdf')
+            \\tplt.close()
+
+
+            if plot_singletons_by_sample:
+            \\tfig = plt.figure(figsize=(2*$$opts{img_width},$$opts{img_height}*0.7))
+            \\tax1 = fig.add_subplot(111)
+            \\tax1.plot([row[0] for row in dat], [row[6] for row in dat], 'o', color='$$opts{id2col}[$id]',mec='$$opts{id2col}[$id]')
+            \\tax1.set_ylabel('Number of singletons')
+            \\tax1.ticklabel_format(style='sci', scilimits=(0,0), axis='y')
+            \\tif sample_names:
+            \\t\\t     plt.xticks([row[0] for row in dat],[row[7] for row in dat],**sample_font)
+            \\t\\t     plt.subplots_adjust(**sample_margins)
+            \\telse:
+            \\t\\t     plt.subplots_adjust(right=0.98,left=0.07,bottom=0.17)
+            \\t\\t     ax1.set_xlabel('Sample ID')
+            \\tplt.title('$$opts{title}{$id}')
+            \\tplt.savefig('$img5.png')
+            \\tif pdf_plots: plt.savefig('$img5.pdf')
+            \\tplt.close()
+
+
+            if plot_depth_by_sample:
+            \\tfig = plt.figure(figsize=(2*$$opts{img_width},$$opts{img_height}*0.7))
+            \\tax1 = fig.add_subplot(111)
+            \\tax1.plot([row[0] for row in dat], [row[5] for row in dat], 'o', color='$$opts{id2col}[$id]',mec='$$opts{id2col}[$id]')
+            \\tax1.set_ylabel('Average depth')
+            \\tax1.ticklabel_format(style='sci', scilimits=(0,0), axis='y')
+            \\tif sample_names:
+            \\t\\t     plt.xticks([row[0] for row in dat],[row[7] for row in dat],**sample_font)
+            \\t\\t     plt.subplots_adjust(**sample_margins)
+            \\telse:
+            \\t\\t     plt.subplots_adjust(right=0.98,left=0.07,bottom=0.17)
+            \\t\\t     ax1.set_xlabel('Sample ID')
+            \\tplt.title('$$opts{title}{$id}')
+            \\tplt.savefig('$img6.png')
+            \\tif pdf_plots: plt.savefig('$img6.pdf')
+            \\tplt.close()
+
+        ";
+}
+
+sub plot_DP
+{
+    my ($opts,$id) = @_;
+    my @vals = get_values($opts,$id,'DP');
+    if ( !@vals ) { return; }
+
+    my $fh   = $$opts{plt_fh};
+    my $img  = "$$opts{prefix}depth.$id";
+
+    open(my $tfh,'>',"$img.dat") or error("$img.dat: $!");
+    print $tfh "# [1]Depth\t[2]Cumulative number of genotypes\t[3]Number of genotypes\n";
+    my $sum = 0;
+    for (my $i=0; $i<@vals; $i++)
+    {
+        if ( $sum>99. ) { last; }
+        if ( !($vals[$i][0]=~/^\d+$/) ) { next; }  # DP ">500" case
+        $sum += $vals[$i][2];
+        printf $tfh "%d\t%f\t%f\n", $vals[$i][0], $sum, $vals[$i][2];
+    }
+    close($tfh);
+
+    tprint $fh, "
+
+            dat = []
+            with open('$img.dat', 'rb') as f:
+            \\treader = csv.reader(f, 'tab')
+            \\tfor row in reader:
+            \\t\\tif row[0][0] != '#': dat.append(row)
+
+            if plot_dp_dist:
+            \\tfig = plt.figure(figsize=($$opts{img_width},$$opts{img_height}))
+            \\tax1 = fig.add_subplot(111)
+            \\tax1.plot([row[0] for row in dat], [row[2] for row in dat], '-^', color='k')
+            \\tax1.set_ylabel('Number of genotypes [%]',color='k')
+            \\tax1.set_xlabel('Depth')
+            \\tax2 = ax1.twinx()
+            \\tax2.plot([row[0] for row in dat], [row[1] for row in dat], '-o', color='$$opts{id2col}[$id]')
+            \\tax2.set_ylabel('Cumulative number of genotypes [%]',color='$$opts{id2col}[$id]')
+            \\tfor tl in ax2.get_yticklabels(): tl.set_color('$$opts{id2col}[$id]')
+            \\tplt.subplots_adjust(left=0.15,bottom=0.15,right=0.87)
+            \\tplt.title('$$opts{title}{$id}')
+            \\tplt.savefig('$img.png')
+            \\tif pdf_plots: plt.savefig('$img.pdf')
+            \\tplt.close()
+
+        ";
+}
+
+sub plot_hwe
+{
+    my ($opts,$id) = @_;
+    my @vals = get_values($opts,$id,'HWE');
+    if ( !@vals ) { return; }
+
+    my $fh   = $$opts{plt_fh};
+    my $img  = "$$opts{prefix}hwe.$id";
+
+    open(my $tfh,'>',"$img.dat") or error("$img.dat: $!");
+    print $tfh "# [1]Allele Frequency\t[2]Depth\t[3]Number of hets (median)\t[4]Number of hets (25-75th percentile)\n";
+    for (my $i=0; $i<@vals; $i++)
+    {
+        if ( !$vals[$i][1] ) { next; }
+        print $tfh join("\t", @{$vals[$i]}), "\n";
+    }
+    close($tfh);
+
+    tprint $fh, "
+
+
+            dat = []
+            with open('$img.dat', 'rb') as f:
+            \\treader = csv.reader(f, 'tab')
+            \\tfor row in reader:
+            \\t\\tif row[0][0] != '#': dat.append(row)
+
+            if plot_hwe and len(dat)>1:
+            \\tx  = [float(row[0]) for row in dat]
+            \\ty1 = smooth(numpy.array([float(row[2]) for row in dat]),40,'hanning')
+            \\ty2 = smooth(numpy.array([float(row[3]) for row in dat]),40,'hanning')
+            \\ty3 = smooth(numpy.array([float(row[4]) for row in dat]),40,'hanning')
+            \\tdp = smooth(numpy.array([float(row[1]) for row in dat]),40,'hanning')
+            \\thwe = []
+            \\tfor af in x: hwe.append(2*af/100.*(1-af/100.))
+
+            \\tfig = plt.figure(figsize=($$opts{img_width},$$opts{img_height}))
+            \\tax1 = fig.add_subplot(111)
+            \\tplots  = ax1.plot(x,hwe,'--',color='#ff9900',label='HWE')
+            \\tplots += ax1.plot(x,y2,color='#ff9900',label='Median')
+            \\tplots += ax1.plot(x,y3,color='#ffe0b2',label='25-75th percentile')
+            \\tax1.fill_between(x,y1,y3, facecolor='#ffeacc',edgecolor='#ffe0b2')
+            \\tax1.set_ylabel('Fraction of hets',color='#ff9900')
+            \\tax1.set_xlabel('Allele frequency [%]')
+            \\tfor tl in ax1.get_yticklabels(): tl.set_color('#ff9900')
+            \\tax2 = ax1.twinx()
+            \\tplots += ax2.plot(x,dp, 'k', label='Number of sites')
+            \\tax2.set_ylabel('Number of sites')
+            \\tax2.set_yscale('log')
+            \\tlabels = [l.get_label() for l in plots]
+            \\tplt.legend(plots,labels,numpoints=1,markerscale=2,loc='center',prop={'size':9},frameon=False)
+            \\tplt.subplots_adjust(left=0.15,bottom=0.15,right=0.86)
+            \\tplt.title('$$opts{title}{$id}')
+            \\tplt.savefig('$img.png')
+            \\tif pdf_plots: plt.savefig('$img.pdf')
+            \\tplt.close()
+
+        ";
+}
+
+sub plot_irc_by_rlen
+{
+    my ($opts,$id) = @_;
+    my @vals = get_values($opts,$id,'ICL');
+    if ( !@vals ) { return; }
+
+    my $fh  = $$opts{plt_fh};
+    my $img = "$$opts{prefix}irc_by_rlen.$id";
+
+    open(my $tfh,'>',"$img.dat") or error("$img.dat: $!");
+    print $tfh "# [1]Repeat type\t[2]Total count\t[3]repeat consistency: deletions\t[4]repeat consistency: insertions\n";
+    for (my $i=0; $i<@vals; $i++)
+    {
+        printf $tfh "%d\t%d\t%f\t%f\n",
+            $vals[$i][0],                                                   # repeat type
+            $vals[$i][1]+$vals[$i][2]+$vals[$i][3]+$vals[$i][4],            # total count
+            $vals[$i][2] ? $vals[$i][1]/($vals[$i][1]+$vals[$i][2]) : 0,    # IRC of deletions
+            $vals[$i][4] ? $vals[$i][3]/($vals[$i][3]+$vals[$i][4]) : 0     # IRC of insertions
+            ;
+    }
+    close($tfh);
+
+    tprint $fh, "
+
+            dat = []
+            with open('$img.dat', 'rb') as f:
+            \\treader = csv.reader(f, 'tab')
+            \\tfor row in reader:
+            \\t\\tif row[0][0] != '#': dat.append([float(x) for x in row])
+
+            if plot_irc_by_len and len(dat):
+            \\tfig = plt.figure(figsize=($$opts{img_width},$$opts{img_height}))
+            \\tax1 = fig.add_subplot(111)
+            \\tax2 = ax1.twinx()
+            \\tplots =  ax1.plot([row[0] for row in dat], [row[2] for row in dat], 'o-', ms=3, color='r', mec='r', label='Deletions');
+            \\tplots += ax1.plot([row[0] for row in dat], [row[3] for row in dat], 'o-', ms=3, color='g', mec='g', label='Insertions');
+            \\tplots += ax2.plot([row[0] for row in dat], [row[1] for row in dat], '^--', ms=3, color='k', mec='k', label='Number of sites');
+
+            \\tax2.ticklabel_format(style='sci',scilimits=(-3,4))
+            \\tax1.set_xlabel('Repeat type');
+            \\tax1.set_ylabel('Repeat Consistency');
+            \\tax2.set_ylabel('Number of sites');
+            \\tlabels = [l.get_label() for l in plots]
+            \\tax1.legend(plots,labels,numpoints=1,markerscale=1,loc='best',prop={'size':9},frameon=False)
+
+            \\tplt.subplots_adjust(right=0.88,left=0.15,bottom=0.11)
+            \\tplt.title('$$opts{title}{$id}')
+            \\tplt.savefig('$img.png')
+            \\tif pdf_plots: plt.savefig('$img.pdf')
+            \\tplt.close()
+
+        ";
+}
+
+sub plot_irc_by_AF
+{
+    error("plot_irc_by_AF: deprecated\n");
+
+    
+    my ($opts,$id) = @_;
+    my @vals = get_values($opts,$id,'AF');
+    if ( !@vals ) { return; }
+
+    my $fh   = $$opts{plt_fh};
+    my $img  = "$$opts{prefix}irc_by_af.$id";
+    my $vals = rebin_values(\@vals,8,0);
+
+    open(my $tfh,'>',"$img.dat") or error("$img.dat: $!");
+    print $tfh "# [1]Repeat type\t[2]Total count\t[3]repeat consistency: deletions\t[4]repeat consistency: insertions\n";
+
+    my $has_vals = 0;
+    tprint $fh, "
+            dat = [
+        ";
+    for (my $i=0; $i<@$vals; $i++)
+    {
+        if ( $$vals[$i][5] + $$vals[$i][6] == 0 ) { next; }
+        $has_vals++;
+        tprint $fh, sprintf("\t[ %f, %d, %f, %f ],\n",
+            $$vals[$i][0]/100.,
+            $$vals[$i][5] + $$vals[$i][6],
+            $$vals[$i][6] ? $$vals[$i][5]/($$vals[$i][5] + $$vals[$i][6]) : 0,
+            ($$vals[$i][6] + $$vals[$i][7]) ? $$vals[$i][5]/($$vals[$i][5] + $$vals[$i][6] + $$vals[$i][7]) : 0);
+    }
+    tprint $fh, "]";
+    if ( $has_vals<2 ) { return; }
+
+    tprint $fh, "
+            fig = plt.figure(figsize=($$opts{img_width},$$opts{img_height}))
+            ax1 = fig.add_subplot(111)
+            ax1.plot([row[0] for row in dat], [row[1] for row in dat], '-o',color='k',mec='k',markersize=3)
+            ax1.set_ylabel('Number of sites',color='k')
+            ax1.set_yscale('log')
+            #ax1.ticklabel_format(style='sci', scilimits=(0,0), axis='y')
+            for tl in ax1.get_yticklabels(): tl.set_color('k')
+            ax1.set_xlabel('Non-ref allele frequency')
+            ax2 = ax1.twinx()
+            ax2.plot([row[0] for row in dat], [row[2] for row in dat], '-o',color='$$opts{id2col}[$id]',mec='$$opts{id2col}[$id]',markersize=3,label='c/(c+i)')
+            ax2.plot([row[0] for row in dat], [row[3] for row in dat], '--^',color='$$opts{id2col}[$id]',mec='$$opts{id2col}[$id]',markersize=3,label='c/(c+i+n/a)')
+            ax2.legend(numpoints=1,markerscale=2,loc='best',prop={'size':10},frameon=False)
+            ax2.set_ylabel('Indel Repeat Consistency',color='$$opts{id2col}[$id]')
+            ax2.set_ylim(0,1)
+            ax1.set_xlim(0,1)
+            for tl in ax2.get_yticklabels(): tl.set_color('$$opts{id2col}[$id]')
+            plt.subplots_adjust(right=0.88,left=0.15,bottom=0.11)
+            plt.title('$$opts{title}{$id}')
+            plt.savefig('$img.png')
+            if pdf_plots: plt.savefig('$img.pdf')
+            plt.close()
+        ";
+}
+
+sub plot_tstv_by_AF
+{
+    my ($opts,$id) = @_;
+    my @vals = get_values($opts,$id,'AF');
+    if ( !@vals ) { return; }
+
+    my $fh   = $$opts{plt_fh};
+    my $img  = "$$opts{prefix}tstv_by_af.$id";
+    my $vals = rebin_values(\@vals,8,0);
+
+    
+    open(my $tfh,'>',"$img.dat") or error("$img.dat: $!");
+    print $tfh "# [1]Allele frequency\t[2]Number of sites\t[3]ts/tv\n";
+    for (my $i=0; $i<@$vals; $i++)
+    {
+        if ( $$vals[$i][2] + $$vals[$i][3] == 0 ) { next; }
+        printf $tfh "%f\t%d\t%f\n",
+            $$vals[$i][0]/100.,
+            $$vals[$i][2] + $$vals[$i][3],
+            $$vals[$i][3] ? $$vals[$i][2]/$$vals[$i][3]: 0;
+    }
+    close($tfh);
+
+    tprint $fh, "
+
+            dat = []
+            with open('$img.dat', 'rb') as f:
+            \\treader = csv.reader(f, 'tab')
+            \\tfor row in reader:
+            \\t\\tif row[0][0] != '#': dat.append([float(x) for x in row])
+
+
+            if plot_tstv_by_af and len(dat)>2:
+            \\tfig = plt.figure(figsize=($$opts{img_width},$$opts{img_height}))
+            \\tax1 = fig.add_subplot(111)
+            \\tax1.plot([row[0] for row in dat], [row[1] for row in dat], '-o',color='k',mec='k',markersize=3)
+            \\tax1.set_ylabel('Number of sites',color='k')
+            \\tax1.set_yscale('log')
+            \\t#ax1.ticklabel_format(style='sci', scilimits=(0,0), axis='y')
+            \\tfor tl in ax1.get_yticklabels(): tl.set_color('k')
+            \\tax1.set_xlabel('Non-ref allele frequency')
+            \\tax2 = ax1.twinx()
+            \\tax2.plot([row[0] for row in dat], [row[2] for row in dat], '-o',color='$$opts{id2col}[$id]',mec='$$opts{id2col}[$id]',markersize=3)
+            \\tax2.set_ylabel('Ts/Tv',color='$$opts{id2col}[$id]')
+            \\tax2.set_ylim(0,0.5+max(3,max(row[2] for row in dat)))
+            \\tax1.set_xlim(0,1)
+            \\tfor tl in ax2.get_yticklabels(): tl.set_color('$$opts{id2col}[$id]')
+            \\tplt.subplots_adjust(right=0.88,left=0.15,bottom=0.11)
+            \\tplt.title('$$opts{title}{$id}')
+            \\tplt.savefig('$img.png')
+            \\tif pdf_plots: plt.savefig('$img.pdf')
+            \\tplt.close()
+
+        ";
+}
+
+sub plot_tstv_by_QUAL
+{
+    my ($opts,$id) = @_;
+    my @vals = get_values($opts,$id,'QUAL');
+    if ( !@vals ) { return; }
+
+    my $fh   = $$opts{plt_fh};
+    my $img  = "$$opts{prefix}tstv_by_qual.$id";
+
+    open(my $tfh,'>',"$img.dat") or error("$img.dat: $!");
+    print $tfh "# [1]Quality\t[2]Number of sites\t[3]Marginal Ts/Tv\n";
+
+    my @dat = ();
+    my $ntot = 0;
+    for my $val (@vals)
+    {
+        push @dat, [ $$val[0], $$val[2], $$val[3] ];    # qual, nts, ntv
+        $ntot += $$val[2] + $$val[3];
+    }
+    my @sdat = sort { $$b[0] <=> $$a[0] } @dat;
+    push @sdat, [-1];
+    my $dn    = $ntot*0.05;
+    my $qprev = $sdat[0][0];
+    my $nts   = 0;
+    my $ntv   = 0;
+    my $nout  = 0;
+    for my $rec (@sdat)
+    {
+        if ( $$rec[0]==-1 or $nts+$ntv > $dn )
+        {
+            if ( $ntv ) {  printf $tfh "$qprev\t%d\t%f\n", $nts+$ntv+$nout,$nts/$ntv; }
+            if ( $$rec[0]==-1 ) { last; }
+            $nout += $nts+$ntv;
+            $nts   = 0;
+            $ntv   = 0;
+            $qprev = $$rec[0];
+        }
+        $nts += $$rec[1];
+        $ntv += $$rec[2];
+    }
+    close($tfh) or error("close $img.dat");
+
+    tprint $fh, "
+
+            dat = []
+            with open('$img.dat', 'rb') as f:
+            \\treader = csv.reader(f, 'tab')
+            \\tfor row in reader:
+            \\t\\tif row[0][0] != '#': dat.append([float(x) for x in row])
+
+            if plot_tstv_by_qual:
+            \\tfig = plt.figure(figsize=($$opts{img_width},$$opts{img_height}))
+            \\tax1 = fig.add_subplot(111)
+            \\tax1.plot([row[1] for row in dat], [row[2] for row in dat], '^-', ms=3, mec='$$opts{id2col}[$id]', color='$$opts{id2col}[$id]')
+            \\tax1.set_ylabel('Ts/Tv',fontsize=10)
+            \\tax1.set_xlabel('Number of sites\\n(sorted by QUAL, descending)',fontsize=10)
+            \\tax1.ticklabel_format(style='sci', scilimits=(-3,2), axis='x')
+            \\tax1.set_ylim(min(2,min(row[2] for row in dat))-0.3,0.3+max(2.2,max(row[2] for row in dat)))
+
+            \\tplt.subplots_adjust(right=0.88,left=0.15,bottom=0.15)
+            \\tplt.title('$$opts{title}{$id}')
+            \\tplt.savefig('$img.png')
+            \\tif pdf_plots: plt.savefig('$img.pdf')
+            \\tplt.close()
+
+        ";
+}
+
+sub rebin_values
+{
+    my ($vals,$bin_size,$col,%args) = @_;
+    my %avg  = exists($args{avg}) ? map {$_=>1} @{$args{avg}} : ();
+    my $prev = $$vals[0][$col];
+    my $iout = 0;
+    my $nsum = 0;
+    my (@dat, at out);
+    for (my $i=0; $i<@$vals; $i++)
+    {
+        for (my $icol=0; $icol<@{$$vals[$i]}; $icol++)
+        {
+            if ( $icol==$col ) { next; }
+            $dat[$icol] += $$vals[$i][$icol];
+        }
+        $nsum++;
+        if ( $i+1<@$vals && $$vals[$i][$col] - $prev < $bin_size ) { next; }
+        $dat[$col] = $prev;
+        for (my $icol=0; $icol<@{$$vals[$i]}; $icol++)
+        {
+            $out[$iout][$icol] = $dat[$icol] ? $dat[$icol] : 0;
+            if ( $avg{$icol} && $nsum ) { $out[$iout][$icol] /= $nsum; }
+        }
+        $nsum = 0;
+        @dat = ();
+        $iout++;
+        $prev = $$vals[$i][$col];
+    }
+    return \@out;
+}
+
+sub plot_concordance_by_AF
+{
+    my ($opts) = @_;
+    my @vals = get_values($opts,2,'GCsAF');
+    if ( !@vals ) { return; }
+
+    # create a local copy and prepare r2 for rebinning
+    @vals = @{ dclone(\@vals) };
+    for (my $i=0; $i<@vals; $i++) { $vals[$i][7] *= $vals[$i][8]; }
+    my $vals = rebin_values(\@vals,1,0);
+    my $fh   = $$opts{plt_fh};
+    my $img  = "$$opts{prefix}gts_by_af";
+    my $img2 = "$$opts{prefix}r2_by_af";
+
+    open(my $tfh,'>',"$img.dat") or error("$img.dat: $!");
+    print $tfh "# [1]Allele Frequency\t[2]RR concordance\t[3]RA concordance\t[4]AA concordance\t[5]nRR\t[6]nRA\t[7]nAA\t[8]R^2\t[9]Number of sites\n";
+    for (my $i=0; $i<@$vals; $i++)
+    {
+        printf $tfh "%f\t%f\t%f\t%f\t%d\t%d\t%d\t%f\t%d\n",
+            $$vals[$i][0]/100.,
+            $$vals[$i][1]+$$vals[$i][4] ? $$vals[$i][1]/($$vals[$i][1]+$$vals[$i][4]) : 1,
+            $$vals[$i][2]+$$vals[$i][5] ? $$vals[$i][2]/($$vals[$i][2]+$$vals[$i][5]) : 1,
+            $$vals[$i][3]+$$vals[$i][6] ? $$vals[$i][3]/($$vals[$i][3]+$$vals[$i][6]) : 1,
+            $$vals[$i][1]+$$vals[$i][4],
+            $$vals[$i][2]+$$vals[$i][5],
+            $$vals[$i][3]+$$vals[$i][6],
+            $$vals[$i][8] ? $$vals[$i][7]/$$vals[$i][8] : 1,
+            $$vals[$i][8];
+    }
+    close($tfh);
+
+    tprint $fh, "
+
+            dat = []
+            with open('$img.dat', 'rb') as f:
+            \\treader = csv.reader(f, 'tab')
+            \\tfor row in reader:
+            \\t\\tif row[0][0] != '#': dat.append(row)
+
+            if plot_concordance_by_af and len(dat)>1:
+            \\tfig = plt.figure(figsize=($$opts{img_width}*1.2,$$opts{img_height}))
+            \\tax1 = fig.add_subplot(111)
+            \\tax1.plot([row[0] for row in dat], [row[1] for row in dat],'.',color='$$opts{id2col}[1]',label='Hom RR')
+            \\tax1.plot([row[0] for row in dat], [row[2] for row in dat],'.',color='$$opts{id2col}[0]',label='Het RA')
+            \\tax1.plot([row[0] for row in dat], [row[3] for row in dat],'.',color='k',label='Hom AA')
+            \\tax1.set_xlabel('Non-ref allele frequency')
+            \\tax1.set_ylabel('Concordance')
+            \\tleg = ax1.legend(title='Concordance:',numpoints=1,markerscale=2,loc='best',prop={'size':9})
+            \\tleg.draw_frame(False)
+            \\tplt.setp(leg.get_title(),fontsize=9)
+            \\tax2 = ax1.twinx()
+            \\tax2.plot([row[0] for row in dat], [row[4] for row in dat],color='$$opts{id2col}[1]')
+            \\tax2.plot([row[0] for row in dat], [row[5] for row in dat],color='$$opts{id2col}[0]')
+            \\tax2.plot([row[0] for row in dat], [row[6] for row in dat],color='k')
+            \\tax2.set_ylabel('Number of genotypes')
+            \\tax2.set_yscale('log')
+            \\tplt.subplots_adjust(left=0.15,right=0.83,bottom=0.11)
+            \\tplt.savefig('$img.png')
+            \\tif pdf_plots: plt.savefig('$img.pdf')
+            \\tplt.close()
+
+            if plot_r2_by_af and len(dat)>1:
+            \\tfig = plt.figure(figsize=($$opts{img_width}*1.3,$$opts{img_height}))
+            \\tax1 = fig.add_subplot(111)
+            \\tax2 = ax1.twinx()
+            \\tax1.set_zorder(ax2.get_zorder()+1)
+            \\tax1.patch.set_visible(False)
+            \\tax2.plot([row[0] for row in dat], [row[8] for row in dat], '-o', color='r',mec='r',markersize=3)
+            \\tax1.plot([row[0] for row in dat], [row[7] for row in dat], '-^', color='k',markersize=3)
+            \\tfor tl in ax2.get_yticklabels(): tl.set_color('r')
+            \\tax2.set_ylabel('Number of sites', color='r')
+            \\tax2.set_yscale('log')
+            \\tax1.set_ylabel('Mean allelic R\$^2\$', color='k')
+            \\tax1.set_xlabel('Non-ref allele frequency')
+            \\tplt.subplots_adjust(left=0.19,right=0.83,bottom=0.11)
+            \\tplt.savefig('$img2.png')
+            \\tif pdf_plots: plt.savefig('$img2.pdf')
+            \\tplt.close()
+
+        ";
+}
+
+sub plot_concordance_by_sample
+{
+    my ($opts) = @_;
+    my @vals = get_values($opts,2,'GCsS');
+    if ( !@vals ) { return; }
+
+    my $fh   = $$opts{plt_fh};
+    my $img  = "$$opts{prefix}gts_by_sample";
+
+    open(my $tfh,'>',"$img.dat") or error("$img.dat: $!");
+    print $tfh "# [1]Sample ID\t[2]Discordance\t[3]Sample Name\n";
+    for (my $i=0; $i<@vals; $i++)
+    {
+        printf $tfh "%d\t%f\t%s\n", $i, $vals[$i][1], $vals[$i][0];
+    }
+    close($tfh);
+
+    tprint $fh, "
+
+            dat = []
+            with open('$img.dat', 'rb') as f:
+            \\treader = csv.reader(f, 'tab')
+            \\tfor row in reader:
+            \\t\\tif row[0][0] != '#': dat.append(row)
+
+            if plot_discordance_by_sample:
+            \\tfig = plt.figure(figsize=(2*$$opts{img_width},$$opts{img_height}*0.7))
+            \\tax1 = fig.add_subplot(111)
+            \\tax1.plot([row[0] for row in dat], [row[1] for row in dat],'.',color='orange')
+            \\tax1.set_ylabel('Non-ref discordance')
+            \\tax1.set_ylim(0,)
+            \\tif sample_names:
+            \\t\\t     plt.xticks([row[0] for row in dat],[row[2] for row in dat],**sample_font)
+            \\t\\t     plt.subplots_adjust(**sample_margins)
+            \\telse:
+            \\t\\t     plt.subplots_adjust(right=0.98,left=0.07,bottom=0.17)
+            \\t\\t     ax1.set_xlabel('Sample ID')
+            \\tplt.savefig('$img.png')
+            \\tif pdf_plots: plt.savefig('$img.pdf')
+            \\tplt.close()
+
+
+        ";
+}
+
+sub plot_counts_by_AF
+{
+    my ($opts) = @_;
+    plot_counts_by_AF_col($opts,1,'SNP');
+    plot_counts_by_AF_col($opts,4,'Indel');
+}
+
+sub plot_counts_by_AF_col
+{
+    my ($opts,$col,$title) = @_;
+
+    my $fh  = $$opts{plt_fh};
+    my $img = "$$opts{prefix}counts_by_af.".lc($title)."s";
+
+    open(my $tfh,'>',"$img.dat") or error("$img.dat: $!");
+    print $tfh "# [1]id\t[2]Nonref Allele Frequency\t[3]Number of sites\n";
+    for my $id (file_ids($opts))
+    {
+        my @tmp = get_values($opts,$id,'AF');
+        my $vals = rebin_values(\@tmp,1,0);
+        for my $val (@$vals)
+        {
+            if ( !$$val[$col] ) { next; }
+            print $tfh "$id\t$$val[0]\t$$val[$col]\n";
+        }
+    }
+    close($tfh);
+
+    tprint $fh, "
+
+            dat = {}
+            with open('$img.dat', 'rb') as f:
+            \\treader = csv.reader(f, 'tab')
+            \\tfor row in reader:
+            \\t\\tif row[0][0] == '#': continue
+            \\t\\tid = int(row[0])
+            \\t\\tif id not in dat: dat[id] = []
+            \\t\\tdat[id].append([float(row[1]),float(row[2])])
+            
+            if plot_${title}_count_by_af:
+            \\tfig = plt.figure(figsize=(2*$$opts{img_width},$$opts{img_height}*0.7))
+            \\tax1 = fig.add_subplot(111)
+            \\tax1.set_ylabel('Number of sites')
+            \\tax1.ticklabel_format(style='sci', scilimits=(0,0), axis='y')
+            \\tax1.set_yscale('log')
+            \\tax1.set_xlabel('Non-reference allele frequency')
+            \\tax1.set_xlim(-0.05,1.05)
+            \\thas_data = 0
+        ";
+    for my $id (file_ids($opts))
+    {
+        tprint $fh, "
+            \\tif $id in dat and len(dat[$id])>2:
+            \\t\\tax1.plot([row[0]/100. for row in dat[$id]], [row[1] for row in dat[$id]], '-o',markersize=3, color='$$opts{id2col}[$id]',mec='$$opts{id2col}[$id]',label='$$opts{title}{$id}')
+            \\t\\thas_data = 1
+        ";
+    }
+    tprint $fh, "
+            \\tif has_data:
+            \\t\\tax1.legend(numpoints=1,markerscale=1,loc='best',prop={'size':10},frameon=False)
+            \\t\\tplt.title('$title count by AF')
+            \\t\\tplt.subplots_adjust(bottom=0.2,left=0.1,right=0.95)
+            \\t\\tplt.savefig('$img.png')
+            \\t\\tif pdf_plots: plt.savefig('$img.pdf')
+            \\t\\tplt.close()
+
+
+        ";
+}
+
+sub plot_overlap_by_AF
+{
+    my ($opts) = @_;
+    plot_overlap_by_AF_col($opts,1,'SNP');
+    plot_overlap_by_AF_col($opts,4,'Indel');
+}
+
+sub plot_overlap_by_AF_col
+{
+    my ($opts,$col,$title) = @_;
+
+    my @ids  = file_ids($opts);
+    if ( @ids != 3 ) { return; }
+
+    my ($ia,$ib,$iab);
+    for (my $i=0; $i<@ids; $i++)
+    {
+        if ( @{$$opts{dat}{ID}{$ids[$i]}[0]}>1 ) { $iab = $i; next; }
+        if ( !defined $ia ) { $ia = $i; next; }
+        $ib = $i;
+    }
+
+    my $fh  = $$opts{plt_fh};
+    my $img = "$$opts{prefix}overlap_by_af.".lc($title)."s";
+    my @has_vals;
+
+    my @vals_a  = get_values($opts,$ia,'AF');
+    my @vals_b  = get_values($opts,$ib,'AF');
+    my @vals_ab = get_values($opts,$iab,'AF');
+
+    my (%afs,%af_a,%af_ab);
+    for my $val (@vals_a) { $afs{$$val[0]} = $$val[$col]; $af_a{$$val[0]} = $$val[$col]; }
+    for my $val (@vals_ab) { $afs{$$val[0]} = $$val[$col]; $af_ab{$$val[0]} = $$val[$col]; }
+
+    open(my $tfh,'>',"$img.dat") or error("$img.dat: $!");
+    print $tfh "# [1]Allele frequency\t[2]Fraction of sites from $$opts{title}{$ids[$ia]} also in $$opts{title}{$ids[$ib]}\t[3]Number of sites\n";
+    for my $af (sort { $a<=>$b } keys %afs)
+    {
+        my $a  = exists($af_a{$af})  ? $af_a{$af}  : 0;
+        my $ab = exists($af_ab{$af}) ? $af_ab{$af} : 0;
+        my $yval =  ($a+$ab) ? $ab * 100. / ($a + $ab) : 0;
+        print $tfh "$af\t$yval\t" .($a+$ab). "\n";
+    }
+    close($tfh) or error("close $img.dat");
+
+    tprint $fh, "
+
+        dat = []
+
+        with open('$img.dat', 'rb') as f:
+        \\treader = csv.reader(f, 'tab')
+        \\tfor row in reader:
+        \\t\\tif row[0][0] != '#': dat.append(row)
+
+        if plot_${title}_overlap_by_af and len(dat)>1:
+        \\tfig = plt.figure(figsize=(2*$$opts{img_width},$$opts{img_height}*0.7))
+        \\tax1 = fig.add_subplot(111)
+        \\tax1.plot([row[0] for row in dat], [row[1] for row in dat],'-o',markersize=3, color='$$opts{id2col}[1]',mec='$$opts{id2col}[1]')
+        \\tax1.set_ylabel('Fraction found in $$opts{title}{$ib} [%]')
+        \\tax1.set_xscale('log')
+        \\tax1.set_xlabel('Non-reference allele frequency in $$opts{title}{$ia} [%]')
+        \\tax1.set_xlim(0,11)
+        \\tax1.set_xticks([0.1,0.2,0.5,1,2,5,10])
+        \\tax1.set_xticklabels([0.1,0.2,0.5,1,2,5,10])
+        \\tplt.title('$title overlap by AF')
+        \\tplt.subplots_adjust(bottom=0.2,left=0.1,right=0.95)
+        \\tplt.savefig('$img.png')
+        \\tif pdf_plots: plt.savefig('$img.pdf')
+        \\tplt.close()
+
+
+    ";
+
+}
+
+
+sub plot_indel_distribution
+{
+    my ($opts,$id) = @_;
+
+    my @vals = get_values($opts,$id,'IDD');
+    if ( !@vals ) { return; }
+
+    # Set xlim to show 99 of indels but ignore outliers
+    my @tmp;
+    for my $id (file_ids($opts))
+    {
+        my @v = get_values($opts,$id,'IDD');
+        for my $v (@v) { $tmp[ abs($$v[0]) ] += $$v[1]; }
+    }
+    my $n;
+    for my $t (@tmp) { $n += $t ? $t : 0; }
+    my ($sum,$xlim);
+    for ($xlim=0; $xlim<@tmp; $xlim++)
+    {
+        $sum += $tmp[$xlim] ? $tmp[$xlim] : 0;
+        if ( $sum/$n >= 0.99 ) { last; }
+    }
+    if ( $xlim<20 ) { $xlim=20; }
+
+    my $fh  = $$opts{plt_fh};
+    my $img = "$$opts{prefix}indels.$id";
+
+
+    open(my $tfh,'>',"$img.dat") or error("$img.dat: $!");
+    print $tfh "# [1]Indel length\t[2]Count\n";
+    for my $val (@vals) { print $tfh "$$val[0]\t$$val[1]\n"; }
+    close($tfh);
+
+    tprint $fh, "
+
+            dat = []
+            with open('$img.dat', 'rb') as f:
+            \\treader = csv.reader(f, 'tab')
+            \\tfor row in reader:
+            \\t\\tif row[0][0] != '#': dat.append([float(x) for x in row])
+
+            if plot_indel_dist and len(dat)>0:
+            \\tfig = plt.figure(figsize=($$opts{img_width},$$opts{img_height}))
+            \\tax1 = fig.add_subplot(111)
+            \\tax1.bar([row[0]-0.5 for row in dat], [row[1] for row in dat], color='$$opts{id2col}[0]')# , edgecolor='$$opts{id2col}[0]')
+            \\tax1.set_xlabel('InDel Length')
+            \\tax1.set_ylabel('Count')
+            \\tax1.ticklabel_format(style='sci', scilimits=(0,0), axis='y')
+            \\tax1.set_xlim(-$xlim,$xlim)
+            \\tplt.subplots_adjust(bottom=0.17)
+            \\tplt.title('$$opts{title}{$id}')
+            \\tplt.savefig('$img.png')
+            \\tif pdf_plots: plt.savefig('$img.pdf')
+            \\tplt.close()
+        ";
+}
+
+sub plot_substitutions
+{
+    my ($opts,$id) = @_;
+
+    my @vals = get_values($opts,$id,'ST');
+    if ( !@vals ) { return; }
+
+    my $fh  = $$opts{plt_fh};
+    my $img = "$$opts{prefix}substitutions.$id";
+
+    tprint $fh, "
+            dat = [
+        ";
+    for (my $i=0; $i<@vals; $i++) { my $val=$vals[$i]; tprint $fh, "\t[$i,'$$val[0]',$$val[1]],\n"; }
+    tprint $fh, "]
+
+            if plot_substitutions:
+            \\tfig = plt.figure(figsize=($$opts{img_width},$$opts{img_height}))
+            \\tcm  = mpl.cm.get_cmap('autumn')
+            \\tn = 12
+            \\tcol = range(n)
+            \\tfor i in range(n): col[i] = cm(1.*i/n)
+            \\tax1 = fig.add_subplot(111)
+            \\tax1.bar([row[0] for row in dat], [row[2] for row in dat], color=col)
+            \\tax1.set_ylabel('Count')
+            \\tax1.ticklabel_format(style='sci', scilimits=(0,0), axis='y')
+            \\tax1.set_xlim(-0.5,n+0.5)
+            \\tplt.xticks([row[0] for row in dat],[row[1] for row in dat],rotation=45)
+            \\tplt.title('$$opts{title}{$id}')
+            \\tplt.savefig('$img.png')
+            \\tif pdf_plots: plt.savefig('$img.pdf')
+            \\tplt.close()
+
+        ";
+}
+
+sub singletons
+{
+    my ($opts,$id) = @_;
+    my @si_vals   = get_values($opts,$id,'SiS');
+    my $si_snps   = $si_vals[0][1];
+    my $si_indels = $si_vals[0][4];
+    my $si_irc    = sprintf "%.3f", $si_vals[0][6] ? $si_vals[0][5]/($si_vals[0][5]+$si_vals[0][6]) : 0;
+    my $si_tstv   = sprintf "%.2f", $si_vals[0][3] ? $si_vals[0][2]/$si_vals[0][3] : 0;
+    my @all_vals  = get_values($opts,$id,'AF');
+    my $nsnps = 0;
+    my $nindels = 0;
+    for my $val (@all_vals)
+    {
+        $nsnps += $$val[1];
+        $nindels += $$val[4];
+    }
+    $si_snps   = sprintf "%.1f", $nsnps ? $si_snps*100./$nsnps : 0;
+    $si_indels = sprintf "%.1f", $nindels ? $si_indels*100./$nindels : 0;
+    return { snps=>$si_snps, indels=>$si_indels, tstv=>$si_tstv, irc=>$si_irc };
+}
+
+sub calc_3n_n3n
+{
+    my (@vals) = @_;
+    my $n3  = 0;
+    my $nn3 = 0;
+    for my $val (@vals)
+    {
+        if ( !($$val[0]%3) ) { $n3++; }
+        else { $nn3++; }
+    }
+    if ( !$nn3 ) { return '-'; }
+    return sprintf("%.2f", $n3/$nn3);
+}
+
+sub fmt_slide3v
+{
+    my ($opts, $image, $title) = @_;
+
+    my $n = 0;
+    for my $id (0..2)
+    {
+        if ( -e "$image.$id.$$opts{fmt}" ) { $n++; }
+    }
+    if ( !$n ) { return ''; }
+    my $h = $$opts{tex}{slide3v}{"height$n"};
+    my $slide = q[\vbox{];
+    for my $id (0..2)
+    {
+        if ( !-e "$image.$id.$$opts{fmt}" ) { next; }
+        $slide .= qq[\\centerline{\\includegraphics[$$opts{ext},height=$h]{$image.$id}}];
+    }
+    $slide .= '}';
+    return qq[
+            % $title
+            %
+            \\hslide{$title}{$slide}
+        ];
+}
+sub fmt_slide3h
+{
+    my ($opts, $image, $title) = @_;
+    my $n = 0;
+    for my $id (0..2)
+    {
+        if ( -e "$image.$id.$$opts{fmt}" ) { $n++; }
+    }
+    if ( !$n ) { return ''; }
+    my $w = $$opts{tex}{slide3h}{"width$n"};
+    my $slide = '';
+    for my $id (0..2)
+    {
+        if ( !-e "$image.$id.$$opts{fmt}" ) { next; }
+        $slide .= qq[\\includegraphics[$$opts{ext},width=$w]{$image.$id}];
+    }
+    return qq[
+            % $title
+            %
+            \\hslide{$title}{$slide}
+        ];
+}
+
+sub bignum
+{
+    my ($num) = @_;
+    if ( !defined $num ) { return ''; }
+    if ( !($num=~/^\d+$/) ) { return $num; }
+    my $len = length($num);
+    my $out;
+    for (my $i=0; $i<$len; $i++)
+    {
+        $out .= substr($num,$i,1);
+        if ( $i+1<$len && !(($len-$i-1)%3) ) { $out .= ','; }
+    }
+    return $out;
+}
+
+sub create_pdf
+{
+    my ($opts) = @_;
+
+    chdir($$opts{dir});
+
+    my @ids     = file_ids($opts);
+    my $width   = "25.4cm"; # todo: move all this to $$opts{tex}
+    my $height  = "19cm";
+    my $height1 = "13cm";
+    my $width1  = "23cm";
+    my $width2  = @ids==3 ? "10.5cm" : "10.5cm";
+    my $width3  = @ids==3 ? "8cm" : "15cm";
+    my $fmt     = $$opts{rasterize} ? 'png' : 'pdf';
+    my $ext     = "type=$fmt,ext=.$fmt,read=.$fmt";
+    my $args    = { ext=>$ext, width3=>$width3, n=>scalar @ids };
+    $$opts{fmt} = $fmt;
+    $$opts{ext} = $ext;
+
+    # Check that xcolor is available
+    my @has_xcolor = `kpsewhich xcolor.sty`;
+    if ( !@has_xcolor )
+    {
+        warn("Note: The xcolor.sty package not available, black and white tables only...\n\n");
+    }
+
+    my $tex_file = "$$opts{lprefix}summary.tex";
+    my $pdf_file = "$$opts{prefix}summary.pdf";
+    open(my $tex,'>',$tex_file) or error("$tex_file: $!");
+    tprint $tex, qq[
+            % This file was produced by plot-vcfstats, the command line was:
+            %   $$opts{args}
+            %
+            % Edit as necessary and recreate the PDF by running
+            %   pdflatex $tex_file
+            %
+
+            % Slides style and dimensions
+            %
+            \\nonstopmode
+            \\documentclass[17pt]{memoir}
+            \\setstocksize{$height}{$width}
+            \\settrimmedsize{\\stockheight}{\\stockwidth}{*}
+            \\settrims{0pt}{0pt}
+            \\setlrmarginsandblock{1cm}{*}{*}
+            \\setulmarginsandblock{1.5cm}{*}{*}
+            \\setheadfoot{1mm}{1cm}
+            \\setlength{\\parskip}{0pt}
+            \\setheaderspaces{*}{1mm}{*}
+            \\setmarginnotes{1mm}{1mm}{1mm}
+            \\checkandfixthelayout[fixed]
+            \\usepackage{charter}   % font
+            \\pagestyle{plain}
+            \\makeevenfoot{plain}{}{}{\\thepage}
+            \\makeoddfoot{plain}{}{}{\\thepage}
+            \\usepackage{graphicx}
+
+            % For colored tables. If xcolor.sty is not available on your system,
+            % download xcolor.sty.gz LaTeX class style from
+            %   http://www.ukern.de/tex/xcolor.html
+            % Unpack and install system-wide or place elsewhere and make available by
+            % setting the TEXINPUTS environment variable (note the colon)
+            %   export TEXINPUTS=some/dir:
+            % The list of the recognised path can be obtained by running `kpsepath tex`
+            %
+            \\usepackage{multirow}
+            \\setlength{\\tabcolsep}{0.6em}
+            \\renewcommand{\\arraystretch}{1.2}
+        ];
+    if ( @has_xcolor )
+    {
+        tprint $tex, '\usepackage[table]{xcolor}';
+    }
+    else
+    {
+        tprint $tex, qq[
+            \\newcommand{\\definecolor}[3]{}
+            \\newcommand{\\columncolor}[1]{}
+            \\newcommand{\\rowcolors}[4]{}
+            \\newcommand{\\arrayrulecolor}[1]{}
+        ];
+    }
+    tprint $tex, qq[
+            \\definecolor{hcol1}{rgb}{1,0.6,0}
+            \\definecolor{hcol2}{rgb}{1,0.68,0.2}
+            \\definecolor{row1}{rgb}{1,0.88,0.7}
+            \\definecolor{row2}{rgb}{1,0.92,0.8}    % #FFEBCC
+            \\setlength{\\arrayrulewidth}{1.5pt}
+
+            % Slide headings
+            \\newcommand*{\\head}[1]{{\\Large\\centerline{#1}\\vskip0.5em}}
+
+            % Slide definition
+            \\newcommand*{\\hslide}[2]{%
+                    \\head{#1}%
+                    \\begin{vplace}[0.5]\\centerline{#2}\\end{vplace}\\newpage}
+            \\newcommand{\\pdf}[2]{\\IfFileExists{#2.$fmt}{\\includegraphics[#1]{#2}}{}}
+
+
+            % The actual slides
+            \\begin{document}
+        ];
+
+
+    # Table with summary numbers
+    my $slide .= q[
+            \begin{minipage}{\textwidth}\centering
+            \small \rowcolors*{3}{row2}{row1} \arrayrulecolor{black}
+            \begin{tabular}{l | r r r | r r r | r | r}
+            \multicolumn{1}{>{\columncolor{hcol1}}l|}{}
+            & \multicolumn{3}{>{\columncolor{hcol1}}c|}{SNPs}
+            & \multicolumn{3}{>{\columncolor{hcol1}}c|}{indels}
+            & \multicolumn{1}{>{\columncolor{hcol1}}c|}{MNPs}
+            & \multicolumn{1}{>{\columncolor{hcol1}}c}{others}  \\\\
+            %
+            \multicolumn{1}{>{\columncolor{hcol2}}l|}{Callset}
+            & \multicolumn{1}{>{\columncolor{hcol2}}c}{n}
+            & \multicolumn{1}{>{\columncolor{hcol2}}c }{ts/tv}
+            & \multicolumn{1}{>{\columncolor{hcol2}}c|}{\\footnotesize(1st ALT)}
+            & \multicolumn{1}{>{\columncolor{hcol2}}c}{n}
+            & \multicolumn{1}{>{\columncolor{hcol2}}c}{frm$^*$}
+            & \multicolumn{1}{>{\columncolor{hcol2}}c|}{rc$^{**}$}
+            & \multicolumn{1}{>{\columncolor{hcol2}}c|}{}
+            & \multicolumn{1}{>{\columncolor{hcol2}}c}{} \\\\ \hline
+        ];
+    my %tex_titles;
+    for my $id (@ids)
+    {
+        my $snps   = get_value($opts,$id,'number of SNPs:');
+        my $indels = get_value($opts,$id,'number of indels:');
+        my $mnps   = get_value($opts,$id,'number of MNPs:');
+        my $others = get_value($opts,$id,'number of others:');
+        my $tstv   = sprintf "%.2f",get_values($opts,$id,'TSTV',0,2);
+        my $tstv1  = sprintf "%.2f",get_values($opts,$id,'TSTV',0,5);
+        my @frsh   = get_values($opts,$id,'FS');
+        my $frsh   = @frsh ? $frsh[0][3] : '--';
+        my @rc     = get_values($opts,$id,'ICS');
+        my $rc     = @rc ? sprintf("%.3f",$rc[0][3]) : '--';
+        my $title  = $$opts{title}{$id};
+        $title =~ s/_/\\_/g;
+        $title =~ s/^\s*\*/\$*\$/;    # leading asterisks is eaten by TeX
+        $tex_titles{$id} = $title;
+        $slide .= qq[ $title & ] . bignum($snps) . qq[ & $tstv & $tstv1 & ] . bignum($indels) . qq[ & $frsh & $rc & ] . bignum($mnps) . ' & ' . bignum($others) . qq[ \\\\ \n];
+    }
+    $slide .= q[%
+        \multicolumn{8}{r}{$^*$ frameshift ratio: out/(out+in);\hspace{1em} $^{**}$ repeat-consistency} \\\\
+        \end{tabular}
+        \\\\ \vspace{1em}
+        \begin{tabular}{l | r r r r | r r}
+        \multicolumn{1}{>{\columncolor{hcol1}}l|}{}
+        & \multicolumn{4}{>{\columncolor{hcol1}}c|}{singletons {\footnotesize(AC=1)}}
+        & \multicolumn{2}{>{\columncolor{hcol1}}c}{multiallelic}  \\\\
+        %
+        \multicolumn{1}{>{\columncolor{hcol2}}l|}{Callset}
+        & \multicolumn{1}{>{\columncolor{hcol2}}c}{SNPs}
+        & \multicolumn{1}{>{\columncolor{hcol2}}c}{ts/tv}
+        & \multicolumn{1}{>{\columncolor{hcol2}}c}{indels}
+        & \multicolumn{1}{>{\columncolor{hcol2}}c|}{rc}
+        & \multicolumn{1}{>{\columncolor{hcol2}}c}{sites}
+        & \multicolumn{1}{>{\columncolor{hcol2}}c}{SNPs} \\\\ \hline
+    ];
+    for my $id (@ids)
+    {
+        my $snps  = get_value($opts,$id,'number of SNPs:');
+        my $s     = singletons($opts,$id);
+        my $mals  = get_value($opts,$id,'number of multiallelic sites:');
+        my $msnps = get_value($opts,$id,'number of multiallelic SNP sites:');
+        my $title = $tex_titles{$id};
+        $slide .= qq[ $title & $$s{snps}\\% & $$s{tstv} & $$s{indels}\\% & $$s{irc} &  ] . bignum($mals) . ' &' . bignum($msnps) . qq[ \\\\ \n];
+    }
+    $slide .= q[ \\end{tabular}
+            \\vspace{2em}
+            \\begin{itemize}[-]
+            \\setlength{\\itemsep}{0pt}
+        ];
+    for my $id (@ids)
+    {
+        my $fname = $$opts{dat}{ID}{$id}[0][0];
+        if ( $$opts{title}{$id} =~ / \+ / ) { next; }
+        $fname =~ s/.{80}/$&\\\\\\hskip2em /g;
+        $fname =~ s/_/\\_/g;
+        $slide .= qq[\\item $tex_titles{$id} .. \\texttt{\\footnotesize $fname}\n];
+    }
+    $slide .= q[\\end{itemize}\\end{minipage}];
+    my $title = exists($$opts{main_title}) ? $$opts{main_title} : 'Summary Numbers';
+    tprint $tex, qq[
+            % Table with summary numbers
+            %
+            \\hslide{$title}{$slide}
+
+        ];
+
+
+    # Venn bars
+    if ( @ids==3 )
+    {
+        tprint $tex, qq[%
+
+            % Venn numbers
+            %
+            \\hslide{Total counts}{%
+                \\includegraphics[$ext,width=$width2]{$$opts{lprefix}venn_bars.snps}%
+                \\includegraphics[$ext,width=$width2]{$$opts{lprefix}venn_bars.indels}
+            }
+        ];
+    }
+
+    tprint $tex, fmt_slide3v($opts, "$$opts{lprefix}tstv_by_sample", 'Ts/Tv by sample');
+    tprint $tex, fmt_slide3v($opts, "$$opts{lprefix}hets_by_sample", 'Hets vs non-ref Homs by sample');
+    tprint $tex, fmt_slide3v($opts, "$$opts{lprefix}singletons_by_sample", 'Singletons by sample {\normalsize(hets and homs)}');
+    tprint $tex, fmt_slide3v($opts, "$$opts{lprefix}dp_by_sample", 'Average depth by sample');
+    tprint $tex, fmt_slide3v($opts, "$$opts{lprefix}snps_by_sample", 'Number of SNPs by sample');
+    tprint $tex, fmt_slide3v($opts, "$$opts{lprefix}indels_by_sample", 'Number of indels by sample');
+    if ( scalar get_values($opts,2,'GCsS') )
+    {
+        tprint $tex, qq[
+            % Genotype discordance by sample
+            %
+            \\hslide{Genotype discordance by sample}{\\pdf{$ext,width=$width1}{$$opts{lprefix}gts_by_sample}}
+
+            ];
+    }
+    if ( scalar get_values($opts,2,'GCsAF') )
+    {
+        my @vals = get_values($opts,2,'NRDs');
+        my $nrd = sprintf "%.2f", $vals[0][0];
+        my $rr  = sprintf "%.2f", $vals[0][1];
+        my $ra  = sprintf "%.2f", $vals[0][2];
+        my $aa  = sprintf "%.2f", $vals[0][3];
+        my $nsamples = get_value($opts,2,'number of samples:');
+        my $table = qq[%
+            {\\small
+            \\rowcolors*{1}{row2}{row1}\\arrayrulecolor{black}
+            \\begin{tabular}{c | c | c | c }
+            \\multicolumn{1}{>{\\columncolor{hcol1}}c|}{REF/REF} &
+            \\multicolumn{1}{>{\\columncolor{hcol1}}c|}{REF/ALT} &
+            \\multicolumn{1}{>{\\columncolor{hcol1}}c|}{ALT/ALT} &
+            \\multicolumn{1}{>{\\columncolor{hcol1}}c}{NRDs} \\\\ \\hline
+            $rr\\% & $ra\\% & $aa\\% & $nrd\\% \\\\
+            \\end{tabular}}];
+        tprint $tex, qq[
+                % Genotype discordance by AF
+                %
+                \\head{Genotype discordance by AF}\\begin{vplace}[0.7]\\centerline{$table}%
+                \\centerline{\\pdf{$ext,height=$height1}{$$opts{lprefix}gts_by_af}}\\end{vplace}
+                \\newpage
+
+                % dosage r2 by AF
+                %
+                \\hslide{Allelic R\$^2\$ by AF}{\\pdf{$ext,height=$height1}{$$opts{lprefix}r2_by_af}}
+            ];
+    }
+    if ( -e "$$opts{lprefix}counts_by_af.snps.$fmt" && -e "$$opts{lprefix}counts_by_af.indels.$fmt" )
+    {
+        tprint $tex, qq[
+            % SNP and indel counts by AF
+            %
+            \\hslide{}{\\vbox{\\noindent\\includegraphics[$ext,width=$width1]{$$opts{lprefix}counts_by_af.snps}\\\\%
+                \\noindent\\includegraphics[$ext,width=$width1]{$$opts{lprefix}counts_by_af.indels}}}
+            ];
+    }
+    if ( -e "$$opts{lprefix}overlap_by_af.snps.$fmt" && -e "$$opts{lprefix}overlap_by_af.indels.$fmt" )
+    {
+        tprint $tex, qq[
+            % SNP and indel overlap by AF
+            %
+            \\hslide{}{\\vbox{\\noindent\\includegraphics[$ext,width=$width1]{$$opts{lprefix}overlap_by_af.snps}\\\\%
+                \\noindent\\includegraphics[$ext,width=$width1]{$$opts{lprefix}overlap_by_af.indels}}}
+            ];
+    }
+    tprint $tex, fmt_slide3h($opts, "$$opts{lprefix}tstv_by_af", 'Ts/Tv by AF');
+    tprint $tex, fmt_slide3h($opts, "$$opts{lprefix}tstv_by_qual", 'Ts/Tv stratified by QUAL');
+    tprint $tex, fmt_slide3h($opts, "$$opts{lprefix}indels", 'Indel distribution');
+    tprint $tex, fmt_slide3h($opts, "$$opts{lprefix}depth", 'Depth distribution');
+    tprint $tex, fmt_slide3h($opts, "$$opts{lprefix}hwe", 'Number of HETs by AF');
+    tprint $tex, fmt_slide3h($opts, "$$opts{lprefix}substitutions", 'Substitution types');
+    tprint $tex, fmt_slide3h($opts, "$$opts{lprefix}irc_by_af", 'Indel Repeat Consistency by AF');
+    tprint $tex, fmt_slide3h($opts, "$$opts{lprefix}irc_by_rlen", 'Indel Consistency by Repeat Type');
+
+    tprint $tex, "\n\n\\end{document}\n";
+    close($tex);
+
+    $tex_file =~ s{^.+/}{};
+    my $cmd = "pdflatex $tex_file >$$opts{logfile} 2>&1";
+    print STDERR "Creating PDF: $cmd\n" unless !$$opts{verbose};
+    system($cmd);
+    if ( $? ) { error("The command exited with non-zero status, please consult the output of pdflatex: $$opts{dir}$$opts{logfile}\n\n"); }
+    print STDERR "Finished: $pdf_file\n" unless !$$opts{verbose};
+}
+
+
+sub merge_vcfstats
+{
+    my ($opts) = @_;
+
+    my $fh = *STDOUT;
+    if ( !$$opts{merge} )
+    {
+        open($fh,'>',"$$opts{prefix}merge.chk") or error("$$opts{prefix}merge.chk: $!\n");
+    }
+
+    print $fh "# This file was produced by plot-vcfstats, the command line was:\n#   $$opts{args}\n#\n";
+
+    for my $sec (@{$$opts{sections}})
+    {
+        my $sid = $$sec{id};
+        if ( !exists($$opts{dat}{$sid}) ) { next; }
+
+        print $fh "# $$sec{header}\n$$sec{exp}\n";
+        for my $id (sort keys %{$$opts{dat}{$sid}})
+        {
+            for my $rec (@{$$opts{dat}{$sid}{$id}})
+            {
+                print $fh "$sid\t$id\t", join("\t",@$rec), "\n";
+            }
+        }
+
+        if ( $sid eq 'ID' )
+        {
+            print $fh "# $$opts{id2sec}{SN}{header}\n$$opts{id2sec}{SN}{exp}\n";
+            # output summary numbers here
+            for my $id (keys %{$$opts{dat}})
+            {
+                if ( exists($$opts{exp}{$id}) ) { next; }
+                for my $key (keys %{$$opts{dat}{$id}})
+                {
+                    print $fh "SN\t$id\t$key\t$$opts{dat}{$id}{$key}\n";
+                }
+            }
+        }
+    }
+}
+
diff --git a/plugins/counts.c b/plugins/counts.c
new file mode 100644
index 0000000..2d57ba4
--- /dev/null
+++ b/plugins/counts.c
@@ -0,0 +1,82 @@
+/*  plugins/counts.c -- counts SNPs, Indels, and total number of sites.
+
+    Copyright (C) 2013, 2014 Genome Research Ltd.
+
+    Author: Petr Danecek <pd3 at sanger.ac.uk>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.  */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <htslib/vcf.h>
+
+int nsamples, nsnps, nindels, nmnps, nothers, nsites;
+
+/*
+    This short description is used to generate the output of `bcftools plugin -l`.
+*/
+const char *about(void)
+{
+    return
+        "A minimal plugin which counts number of samples, SNPs,\n"
+        "INDELs, MNPs and total number of sites.\n";
+}
+
+/*
+    Called once at startup, allows to initialize local variables.
+    Return 1 to suppress VCF/BCF header from printing, 0 otherwise.
+*/
+int init(int argc, char **argv, bcf_hdr_t *in, bcf_hdr_t *out)
+{
+    nsamples = bcf_hdr_nsamples(in);
+    nsnps = nindels = nmnps = nothers = nsites = 0;
+    return 1;
+}
+
+
+/*
+    Called for each VCF record. Return rec to output the line or NULL
+    to suppress output.
+*/
+bcf1_t *process(bcf1_t *rec)
+{
+    int type = bcf_get_variant_types(rec);
+    if ( type & VCF_SNP ) nsnps++;
+    if ( type & VCF_INDEL ) nindels++;
+    if ( type & VCF_MNP ) nmnps++;
+    if ( type & VCF_OTHER ) nothers++;
+    nsites++;
+    return NULL;
+}
+
+
+/*
+    Clean up.
+*/
+void destroy(void)
+{
+    printf("Number of samples: %d\n", nsamples);
+    printf("Number of SNPs:    %d\n", nsnps);
+    printf("Number of INDELs:  %d\n", nindels);
+    printf("Number of MNPs:    %d\n", nmnps);
+    printf("Number of others:  %d\n", nothers);
+    printf("Number of sites:   %d\n", nsites);
+}
+
+
diff --git a/plugins/dosage.c b/plugins/dosage.c
new file mode 100644
index 0000000..bbfe2e5
--- /dev/null
+++ b/plugins/dosage.c
@@ -0,0 +1,283 @@
+/*  plugins/dosage.c -- prints genotype dosage.
+
+    Copyright (C) 2014 Genome Research Ltd.
+
+    Author: Petr Danecek <pd3 at sanger.ac.uk>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.  */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <htslib/vcf.h>
+#include <math.h>
+#include <getopt.h>
+
+
+/*
+    This short description is used to generate the output of `bcftools plugin -l`.
+*/
+const char *about(void)
+{
+    return "Prints genotype dosage determined from tags requested by the user.\n";
+}
+
+const char *usage(void)
+{
+    return 
+        "\n"
+        "About: Print genotype dosage\n"
+        "Usage: bcftools +dosage [General Options] -- [Plugin Options]\n"
+        "Options:\n"
+        "   run \"bcftools plugin\" for a list of common options\n"
+        "\n"
+        "Plugin options:\n"
+        "   -t, --tags <list>   VCF tags to determine the dosage from [PL,GL,GT]\n"
+        "\n"
+        "Example:\n"
+        "   bcftools +dosage in.vcf -- -t GT\n"
+        "\n";
+}
+
+bcf_hdr_t *in_hdr = NULL;
+int pl_type = 0, gl_type = 0;
+uint8_t *buf = NULL;
+int nbuf = 0;   // NB: number of elements, not bytes
+char **tags = NULL;
+int ntags = 0;
+
+typedef int (*dosage_f) (bcf1_t *);
+dosage_f *handlers = NULL;
+int nhandlers = 0;
+
+
+int calc_dosage_PL(bcf1_t *rec)
+{
+    int i, j, nret = bcf_get_format_values(in_hdr,rec,"PL",(void**)&buf,&nbuf,pl_type);
+    if ( nret<0 ) return -1;
+
+    nret /= rec->n_sample;
+    #define BRANCH(type_t,is_missing,is_vector_end) \
+    { \
+        type_t *ptr = (type_t*) buf; \
+        for (i=0; i<rec->n_sample; i++) \
+        { \
+            float vals[3] = {0,0,0}; \
+            for (j=0; j<nret; j++) \
+            { \
+                if ( is_missing || is_vector_end ) break; \
+                vals[j] = exp(-0.1*ptr[j]); \
+            } \
+            float sum = vals[0] + vals[1] + vals[2]; \
+            printf("\t%.1f", sum==0 ? -1 : (vals[1] + 2*vals[2]) / sum); \
+            ptr += nret; \
+        } \
+    }
+    switch (pl_type)
+    {
+        case BCF_HT_INT:  BRANCH(int32_t,ptr[j]==bcf_int32_missing,ptr[j]==bcf_int32_vector_end); break;
+        case BCF_HT_REAL: BRANCH(float,bcf_float_is_missing(ptr[j]),bcf_float_is_vector_end(ptr[j])); break;
+    }
+    #undef BRANCH
+    return 0;
+}
+
+int calc_dosage_GL(bcf1_t *rec)
+{
+    int i, j, nret = bcf_get_format_values(in_hdr,rec,"GL",(void**)&buf,&nbuf,pl_type);
+    if ( nret<0 ) return -1;
+
+    nret /= rec->n_sample;
+    #define BRANCH(type_t,is_missing,is_vector_end) \
+    { \
+        type_t *ptr = (type_t*) buf; \
+        for (i=0; i<rec->n_sample; i++) \
+        { \
+            float vals[3] = {0,0,0}; \
+            for (j=0; j<nret; j++) \
+            { \
+                if ( is_missing || is_vector_end ) break; \
+                vals[j] = exp(ptr[j]); \
+            } \
+            float sum = vals[0] + vals[1] + vals[2]; \
+            printf("\t%.1f", sum==0 ? -1 : (vals[1] + 2*vals[2]) / sum); \
+            ptr  += nret; \
+        } \
+    }
+    switch (pl_type)
+    {
+        case BCF_HT_INT:  BRANCH(int32_t,ptr[j]==bcf_int32_missing,ptr[j]==bcf_int32_vector_end); break;
+        case BCF_HT_REAL: BRANCH(float,bcf_float_is_missing(ptr[j]),bcf_float_is_vector_end(ptr[j])); break;
+    }
+    #undef BRANCH
+    return 0;
+}
+
+int calc_dosage_GT(bcf1_t *rec)
+{
+    int i, j, nret = bcf_get_genotypes(in_hdr,rec,(void**)&buf,&nbuf);
+    if ( nret<0 ) return -1;
+
+    nret /= rec->n_sample;
+    int32_t *ptr = (int32_t*) buf;
+    for (i=0; i<rec->n_sample; i++)
+    {
+        float dsg = 0;
+        for (j=0; j<nret; j++)
+        {
+            if ( ptr[j]==bcf_int32_missing || ptr[j]==bcf_int32_vector_end || ptr[j]==bcf_gt_missing ) break;
+            if ( bcf_gt_allele(ptr[j]) ) dsg += 1;
+        }
+        printf("\t%.1f", j>0 ? dsg : -1);
+        ptr += nret;
+    }
+    return 0;
+}
+
+
+char **split_list(char *str, int *nitems)
+{
+    int n = 0, done = 0;
+    char *ss = strdup(str), **out = NULL;
+    while ( !done && *ss )
+    {
+        char *se = ss;
+        while ( *se && *se!=',' ) se++;
+        if ( !*se ) done = 1;
+        *se = 0;
+        n++;
+        out = (char**) realloc(out,sizeof(char*)*n);
+        out[n-1] = ss;
+        ss = se+1;
+    }
+    *nitems = n;
+    return out;
+}
+
+int init(int argc, char **argv, bcf_hdr_t *in, bcf_hdr_t *out)
+{
+    int i, id, c;
+    char *tags_str = "PL,GL,GT";
+
+    static struct option loptions[] =
+    {
+        {"tags",1,0,'t'},
+        {0,0,0,0}
+    };
+    while ((c = getopt_long(argc, argv, "t:?h",loptions,NULL)) >= 0)
+    {
+        switch (c) 
+        {
+            case 't': tags_str = optarg; break;
+            case 'h':
+            case '?':
+            default: fprintf(stderr,"%s", usage()); exit(1); break;
+        }
+    }
+    tags = split_list(tags_str, &ntags);
+
+    in_hdr = in;
+    for (i=0; i<ntags; i++)
+    {
+        if ( !strcmp("PL",tags[i]) )
+        {
+            id = bcf_hdr_id2int(in_hdr,BCF_DT_ID,"PL");
+            if ( bcf_hdr_idinfo_exists(in_hdr,BCF_HL_FMT,id) )
+            {
+                pl_type = bcf_hdr_id2type(in_hdr,BCF_HL_FMT,id);
+                if ( pl_type!=BCF_HT_INT && pl_type!=BCF_HT_REAL )
+                {
+                    fprintf(stderr,"Expected numeric type of FORMAT/PL\n");
+                    return -1;
+                }
+                handlers = (dosage_f*) realloc(handlers,(nhandlers+1)*sizeof(*handlers));
+                handlers[nhandlers++] = calc_dosage_PL;
+            }
+        }
+        else if ( !strcmp("GL",tags[i]) )
+        {
+            id = bcf_hdr_id2int(in_hdr,BCF_DT_ID,"GL");
+            if ( bcf_hdr_idinfo_exists(in_hdr,BCF_HL_FMT,id) )
+            {
+                gl_type = bcf_hdr_id2type(in_hdr,BCF_HL_FMT,id);
+                if ( gl_type!=BCF_HT_INT && gl_type!=BCF_HT_REAL )
+                {
+                    fprintf(stderr,"Expected numeric type of FORMAT/GL\n");
+                    return -1;
+                }
+                handlers = (dosage_f*) realloc(handlers,(nhandlers+1)*sizeof(*handlers));
+                handlers[nhandlers++] = calc_dosage_GL;
+            }
+        }
+        else if ( !strcmp("GT",tags[i]) )
+        {
+            handlers = (dosage_f*) realloc(handlers,(nhandlers+1)*sizeof(*handlers));
+            handlers[nhandlers++] = calc_dosage_GT;
+        }
+        else
+        {
+            fprintf(stderr,"No handler for tag \"%s\"\n", tags[i]);
+            return -1;
+        }
+    }
+    free(tags[0]);
+    free(tags);
+
+    printf("#[1]CHROM\t[2]POS\t[3]REF\t[4]ALT");
+    for (i=0; i<bcf_hdr_nsamples(in_hdr); i++) printf("\t[%d]%s", i+5,in_hdr->samples[i]);
+    printf("\n");
+
+    return 1;
+}
+
+
+bcf1_t *process(bcf1_t *rec)
+{
+    int i, ret;
+
+    printf("%s\t%d\t%s\t%s", bcf_seqname(in_hdr,rec),rec->pos+1,rec->d.allele[0],rec->n_allele>1 ? rec->d.allele[1] : ".");
+    if ( rec->n_allele==1 )
+    {
+        for (i=0; i<rec->n_sample; i++) printf("\t0.0");
+    }
+    else
+    {
+        for (i=0; i<nhandlers; i++)
+        {
+            ret = handlers[i](rec);
+            if ( !ret ) break;  // successfully printed
+        }
+        if ( i==nhandlers )
+        {
+            // none of the annotations present
+            for (i=0; i<rec->n_sample; i++) printf("\t-1.0");
+        }
+    }
+    printf("\n");
+
+    return NULL;
+}
+
+
+void destroy(void)
+{
+    free(handlers);
+    free(buf);
+}
+
+
diff --git a/plugins/fill-AN-AC.c b/plugins/fill-AN-AC.c
new file mode 100644
index 0000000..7d6c6f4
--- /dev/null
+++ b/plugins/fill-AN-AC.c
@@ -0,0 +1,67 @@
+/*  plugins/fill-AN-AC.c -- fills AN and AC INFO fields.
+
+    Copyright (C) 2014 Genome Research Ltd.
+
+    Author: Petr Danecek <pd3 at sanger.ac.uk>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.  */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <htslib/hts.h>
+#include <htslib/vcf.h>
+#include <htslib/vcfutils.h>
+
+bcf_hdr_t *in_hdr, *out_hdr;
+int *arr = NULL, marr = 0;
+
+const char *about(void)
+{
+    return "Fill INFO fields AN and AC.\n";
+}
+
+int init(int argc, char **argv, bcf_hdr_t *in, bcf_hdr_t *out)
+{
+    in_hdr  = in;
+    out_hdr = out;
+    bcf_hdr_append(out_hdr, "##INFO=<ID=AC,Number=A,Type=Integer,Description=\"Allele count in genotypes\">");
+    bcf_hdr_append(out_hdr, "##INFO=<ID=AN,Number=1,Type=Integer,Description=\"Total number of alleles in called genotypes\">");
+    return 0;
+}
+
+bcf1_t *process(bcf1_t *rec)
+{
+    hts_expand(int,rec->n_allele,marr,arr);
+    int ret = bcf_calc_ac(in_hdr,rec,arr,BCF_UN_FMT);
+    if ( ret>0 )
+    {
+        int i, an = 0;
+        for (i=0; i<rec->n_allele; i++) an += arr[i];
+        bcf_update_info_int32(out_hdr, rec, "AN", &an, 1);
+        bcf_update_info_int32(out_hdr, rec, "AC", arr+1, rec->n_allele-1);
+    }
+    return rec;
+}
+
+void destroy(void)
+{
+    free(arr);
+}
+
+
diff --git a/plugins/fixploidy.c b/plugins/fixploidy.c
new file mode 100644
index 0000000..ab4c8f5
--- /dev/null
+++ b/plugins/fixploidy.c
@@ -0,0 +1,226 @@
+/* 
+    Copyright (C) 2014 Genome Research Ltd.
+
+    Author: Petr Danecek <pd3 at sanger.ac.uk>
+
+    Permission is hereby granted, free of charge, to any person obtaining a copy
+    of this software and associated documentation files (the "Software"), to deal
+    in the Software without restriction, including without limitation the rights
+    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+    copies of the Software, and to permit persons to whom the Software is
+    furnished to do so, subject to the following conditions:
+    
+    The above copyright notice and this permission notice shall be included in
+    all copies or substantial portions of the Software.
+    
+    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+    THE SOFTWARE.
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <getopt.h>
+#include <stdarg.h>
+#include <ctype.h>
+#include <htslib/vcf.h>
+#include <htslib/kseq.h>
+#include "bcftools.h"
+#include "ploidy.h"
+
+static bcf_hdr_t *in_hdr = NULL, *out_hdr = NULL;
+static int *sample2sex = NULL;
+static int n_sample = 0, nsex = 0, *sex2ploidy = NULL;
+static int32_t ngt_arr = 0, *gt_arr = NULL, *gt_arr2 = NULL, ngt_arr2 = 0;
+static ploidy_t *ploidy = NULL;
+
+const char *about(void)
+{
+    return "Fix ploidy.\n";
+}
+
+const char *usage(void)
+{
+    return 
+        "\n"
+        "About: Fix ploidy\n"
+        "Usage: bcftools +fixploidy [General Options] -- [Plugin Options]\n"
+        "Options:\n"
+        "   run \"bcftools plugin\" for a list of common options\n"
+        "\n"
+        "Plugin options:\n"
+        "   -p, --ploidy <file>   space/tab-delimited list of CHROM,FROM,TO,SEX,PLOIDY\n"
+        "   -s, --sex <file>      list of samples, \"NAME SEX\"\n"
+        "   -t, --tags <list>     VCF tags to fix [GT]\n"
+        "\n"
+        "Example:\n"
+        "   # Default ploidy, if -p not given. Unlisted regions have ploidy 2\n"
+        "   X 1 60000 M 1\n"
+        "   X 2699521 154931043 M 1\n"
+        "   Y 1 59373566 M 1\n"
+        "   Y 1 59373566 F 0\n"
+        "   MT 1 16569 M 1\n"
+        "   MT 1 16569 F 1\n"
+        "   \n"
+        "   # Example of -s file, sex of unlisted samples is \"F\"\n"
+        "   sampleName1 M\n"
+        "   \n"
+        "   bcftools +fixploidy in.vcf -- -s samples.txt\n"
+        "\n";
+}
+
+void set_samples(char *fname, bcf_hdr_t *hdr, ploidy_t *ploidy, int *sample2sex)
+{
+    kstring_t tmp = {0,0,0};
+
+    htsFile *fp = hts_open(fname, "r");
+    if ( !fp ) error("Could not read: %s\n", fname);
+    while ( hts_getline(fp, KS_SEP_LINE, &tmp) > 0 )
+    {
+        char *ss = tmp.s;
+        while ( *ss && isspace(*ss) ) ss++;
+        if ( !*ss ) error("Could not parse: %s\n", tmp.s);
+        if ( *ss=='#' ) continue;
+        char *se = ss;
+        while ( *se && !isspace(*se) ) se++;
+        char x = *se; *se = 0;
+
+        int ismpl = bcf_hdr_id2int(hdr, BCF_DT_SAMPLE, ss);
+        if ( ismpl < 0 ) { fprintf(stderr,"Warning: No such sample in the VCF: %s\n",ss); continue; }
+
+        *se = x;
+        ss = se+1;
+        while ( *ss && isspace(*ss) ) ss++;
+        if ( !*ss )  error("Could not parse: %s\n", tmp.s);
+        se = ss;
+        while ( *se && !isspace(*se) ) se++;
+        if ( se==ss ) error("Could not parse: %s\n", tmp.s);
+
+        sample2sex[ismpl] = ploidy_add_sex(ploidy, ss);
+    }
+    if ( hts_close(fp) ) error("Close failed: %s\n", fname);
+    free(tmp.s);
+}
+
+int init(int argc, char **argv, bcf_hdr_t *in, bcf_hdr_t *out)
+{
+    int c;
+    char *tags_str = "GT";
+    char *ploidy_fname = NULL, *sex_fname = NULL;
+
+    static struct option loptions[] =
+    {
+        {"ploidy",1,0,'p'},
+        {"sex",1,0,'s'},
+        {"tags",1,0,'t'},
+        {0,0,0,0}
+    };
+    while ((c = getopt_long(argc, argv, "?ht:s:p:",loptions,NULL)) >= 0)
+    {
+        switch (c) 
+        {
+            case 'p': ploidy_fname = optarg; break;
+            case 's': sex_fname = optarg; break;
+            case 't': tags_str = optarg; break;
+            case 'h':
+            case '?':
+            default: error("%s", usage()); break;
+        }
+    }
+    if ( strcasecmp("GT",tags_str) ) error("Only -t GT is currently supported, sorry\n");
+
+    n_sample   = bcf_hdr_nsamples(in);
+    sample2sex = (int*) calloc(n_sample,sizeof(int));
+    in_hdr     = in;
+    out_hdr    = out;
+
+    if ( ploidy_fname )
+        ploidy = ploidy_init(ploidy_fname, 2);
+    else
+    {
+        ploidy = ploidy_init_string(
+                "X 1 60000 M 1\n"
+                "X 2699521 154931043 M 1\n"
+                "Y 1 59373566 M 1\n"
+                "Y 1 59373566 F 0\n"
+                "MT 1 16569 M 1\n"
+                "MT 1 16569 F 1\n", 2);
+    }
+    if ( !ploidy ) return -1;
+
+    // add default sex in case it was not included
+    int i, dflt_sex_id = ploidy_add_sex(ploidy, "F");
+    for (i=0; i<n_sample; i++) sample2sex[i] = dflt_sex_id; // by default all are F
+    if ( sex_fname ) set_samples(sex_fname, in, ploidy, sample2sex);
+    nsex = ploidy_nsex(ploidy);
+    sex2ploidy = (int*) malloc(sizeof(int)*nsex);
+
+    return 0;
+}
+
+
+bcf1_t *process(bcf1_t *rec)
+{
+    int i,j, max_ploidy;
+
+    ploidy_query(ploidy, (char*)bcf_seqname(in_hdr,rec), rec->pos, sex2ploidy,NULL,&max_ploidy);
+
+    int ngts = bcf_get_genotypes(in_hdr, rec, &gt_arr, &ngt_arr);
+    if ( ngts % n_sample )
+        error("Error at %s:%d: wrong number of GT fields\n",bcf_seqname(in_hdr,rec),rec->pos+1);
+
+    ngts /= n_sample;
+    if ( ngts < max_ploidy )
+    {
+        hts_expand(int32_t,max_ploidy*n_sample,ngt_arr2,gt_arr2);
+        for (i=0; i<n_sample; i++)
+        {
+            int ploidy = sex2ploidy[ sample2sex[i] ];
+            int32_t *src = &gt_arr[i*ngts];
+            int32_t *dst = &gt_arr2[i*max_ploidy];
+            j = 0;
+            if ( !ploidy ) { dst[j] = bcf_gt_missing; j++; }
+            else
+                while ( j<ngts && j<ploidy && src[j]!=bcf_int32_vector_end ) { dst[j] = src[j]; j++; }
+            assert( j );
+            while ( j<ploidy ) { dst[j] = dst[j-1]; j++; } // expand "." to "./." and "0" to "0/0"
+            while ( j<max_ploidy ) { dst[j] = bcf_int32_vector_end; j++; }
+        }
+        if ( bcf_update_genotypes(out_hdr,rec,gt_arr2,n_sample*max_ploidy) )
+            error("Could not update GT field at %s:%d\n", bcf_seqname(in_hdr,rec),rec->pos+1);
+    }
+    else if ( ngts!=1 || max_ploidy!=1 )
+    {
+        for (i=0; i<n_sample; i++)
+        {
+            int ploidy = sex2ploidy[ sample2sex[i] ];
+            int32_t *gts = &gt_arr[i*ngts];
+            j = 0;
+            if ( !ploidy ) { gts[j] = bcf_gt_missing; j++; }
+            else 
+                while ( j<ngts && j<ploidy && gts[j]!=bcf_int32_vector_end ) j++;
+            assert( j );
+            while ( j<ploidy ) { gts[j] = gts[j-1]; j++; } // expand "." to "./." and "0" to "0/0"
+            while ( j<ngts ) { gts[j] = bcf_int32_vector_end; j++; }
+        }
+        if ( bcf_update_genotypes(out_hdr,rec,gt_arr,n_sample*ngts) )
+            error("Could not update GT field at %s:%d\n", bcf_seqname(in_hdr,rec),rec->pos+1);
+    }
+    return rec;
+}
+
+
+void destroy(void)
+{
+    free(gt_arr);
+    free(gt_arr2);
+    free(sample2sex);
+    free(sex2ploidy);
+    ploidy_destroy(ploidy);
+}
+
+
diff --git a/plugins/fixploidy.mk b/plugins/fixploidy.mk
new file mode 100644
index 0000000..c564409
--- /dev/null
+++ b/plugins/fixploidy.mk
@@ -0,0 +1,2 @@
+plugins/fixploidy.so: plugins/fixploidy.c version.h version.c ploidy.h ploidy.c $(HTSDIR)/libhts.so
+	$(CC) $(CFLAGS) $(INCLUDES) -fPIC -shared -o $@ ploidy.c version.c $< -L$(HTSDIR) -lhts
diff --git a/plugins/frameshifts.c b/plugins/frameshifts.c
new file mode 100644
index 0000000..5c0e924
--- /dev/null
+++ b/plugins/frameshifts.c
@@ -0,0 +1,157 @@
+/*  plugins/frameshifts.c -- annotates frameshift indels.
+
+    Copyright (C) 2014 Genome Research Ltd.
+
+    Author: Petr Danecek <pd3 at sanger.ac.uk>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.  */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <htslib/vcf.h>
+#include <htslib/synced_bcf_reader.h>
+#include <getopt.h>
+
+bcf_hdr_t *in_hdr, *out_hdr;
+bcf_sr_regions_t *exons;
+int32_t *frm = NULL, nfrm = 0;
+
+const char *about(void)
+{
+    return
+        "Annotate frameshift indels.\n";
+}
+
+const char *usage(void)
+{
+    return 
+        "\n"
+        "About: Annotate frameshift indels\n"
+        "Usage: bcftools +frameshifts [General Options] -- [Plugin Options]\n"
+        "Options:\n"
+        "   run \"bcftools plugin\" for a list of common options\n"
+        "\n"
+        "Plugin options:\n"
+        "   -e, --exons <file>      list of exons, see \"--targets-file\" man page entry for details\n"
+        "\n"
+        "Example:\n"
+        "   bcftools +frameshifts in.vcf -- -e exons.bed.gz\n"
+        "\n";
+}
+
+
+int init(int argc, char **argv, bcf_hdr_t *in, bcf_hdr_t *out)
+{
+    int c;
+    char *fname = NULL;
+
+    static struct option loptions[] =
+    {
+        {"exons",1,0,'e'},
+        {0,0,0,0}
+    };
+    while ((c = getopt_long(argc, argv, "e:?h",loptions,NULL)) >= 0)
+    {
+        switch (c) 
+        {
+            case 'e': fname = optarg; break;
+            case 'h':
+            case '?':
+            default: fprintf(stderr,"%s", usage()); exit(1); break;
+        }
+    }
+    if ( !fname )
+    {
+        fprintf(stderr,"Missing the -e option.\n");
+        return -1;
+    }
+
+    in_hdr = in;
+    out_hdr = out;
+
+    int ret = bcf_hdr_append(out_hdr,"##INFO=<ID=OOF,Number=A,Type=Integer,Description=\"Frameshift Indels: out-of-frame (1), in-frame (0), not-applicable (-1 or missing)\">");
+    if ( ret!=0 )
+    {
+        fprintf(stderr,"Error updating the header\n");
+        return -1;
+    }
+
+    exons = bcf_sr_regions_init(fname,1,0,1,2);
+    if ( !exons )
+    {
+        fprintf(stderr,"Error occurred while reading (was the file compressed with bgzip?): %s\n", fname);
+        return -1;
+    }
+
+    return 0;
+}
+
+bcf1_t *process(bcf1_t *rec)
+{
+    if ( rec->n_allele<2 ) return rec;    // not a variant
+
+    int type = bcf_get_variant_types(rec);
+    if ( !(type&VCF_INDEL) ) return rec;  // not an indel
+
+    int i, len = 0;
+    for (i=1; i<rec->n_allele; i++)
+        if ( len > rec->d.var[i].n ) len = rec->d.var[i].n;
+
+    int pos_to = len!=0 ? rec->pos : rec->pos - len;    // len is negative
+    if ( bcf_sr_regions_overlap(exons, bcf_seqname(in_hdr,rec),rec->pos,pos_to) ) return rec;  // no overlap
+
+    hts_expand(int32_t,rec->n_allele-1,nfrm,frm);
+    for (i=1; i<rec->n_allele; i++)
+    {
+        if ( rec->d.var[i].type!=VCF_INDEL ) { frm[i-1] = -1; continue; }
+
+        int len = rec->d.var[i].n, tlen = 0;
+        if ( len>0 )
+        {
+            // insertion
+            if ( exons->start <= rec->pos && exons->end > rec->pos ) tlen = abs(len);
+        }
+        else if ( exons->start <= rec->pos + abs(len) )
+        {
+            // deletion
+            tlen = abs(len);
+            if ( rec->pos < exons->start )              // trim the beginning
+                tlen -= exons->start - rec->pos + 1;
+            if ( exons->end < rec->pos + abs(len) )     // trim the end
+                tlen -= rec->pos + abs(len) - exons->end;
+        }
+        if ( tlen )     // there are some deleted/inserted bases in the exon
+        {
+            if ( tlen%3 ) frm[i-1] = 1; // out-of-frame
+            else frm[i-1] = 0;          // in-frame
+        }
+        else frm[i-1] = -1;             // not applicable (is outside)
+    }
+
+    if ( bcf_update_info_int32(out_hdr,rec,"OOF",frm,rec->n_allele-1)<0 ) { fprintf(stderr, "Could not annotate OOF :-/\n"); exit(1); }
+    return rec;
+}
+
+
+void destroy(void)
+{
+    bcf_sr_regions_destroy(exons);
+}
+
+
diff --git a/plugins/missing2ref.c b/plugins/missing2ref.c
new file mode 100644
index 0000000..c4fb6ab
--- /dev/null
+++ b/plugins/missing2ref.c
@@ -0,0 +1,144 @@
+/*  plugins/missing2ref.c -- sets missing genotypes to reference allele.
+
+    Copyright (C) 2014 Genome Research Ltd.
+
+    Author: Petr Danecek <pd3 at sanger.ac.uk>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.  */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <htslib/vcf.h>
+#include <htslib/vcfutils.h>
+#include <inttypes.h>
+#include <getopt.h>
+
+bcf_hdr_t *in_hdr, *out_hdr;
+int32_t *gts = NULL, mgts = 0;
+int *arr = NULL, marr = 0;
+uint64_t nchanged = 0;
+int new_gt = bcf_gt_unphased(0);
+int use_major = 0;
+
+const char *about(void)
+{
+    return "Set missing genotypes (\"./.\") to ref or major allele (\"0/0\" or \"0|0\").\n";
+}
+
+const char *usage(void)
+{
+    return 
+        "\n"
+        "About: Set missing genotypes\n"
+        "Usage: bcftools +missing2ref [General Options] -- [Plugin Options]\n"
+        "Options:\n"
+        "   run \"bcftools plugin\" for a list of common options\n"
+        "\n"
+        "Plugin options:\n"
+        "   -p, --phased       Set to \"0|0\" \n"
+        "   -m, --major        Set to major allele \n"
+        "\n"
+        "Example:\n"
+        "   bcftools +missing2ref in.vcf -- -p\n"
+        "   bcftools +missing2ref in.vcf -- -p -m\n"
+        "\n";
+}
+
+
+int init(int argc, char **argv, bcf_hdr_t *in, bcf_hdr_t *out)
+{
+    int c;
+    static struct option loptions[] =
+    {
+        {"phased",0,0,'p'},
+        {"major",0,0,'m'},
+        {0,0,0,0}
+    };
+    while ((c = getopt_long(argc, argv, "mp?h",loptions,NULL)) >= 0)
+    {
+        switch (c) 
+        {
+            case 'p': new_gt = bcf_gt_phased(0); break;
+            case 'm': use_major = 1; break;
+            case 'h':
+            case '?':
+            default: fprintf(stderr,"%s", usage()); exit(1); break;
+        }
+    }
+    in_hdr  = in;
+    out_hdr = out;
+    return 0;
+}
+
+bcf1_t *process(bcf1_t *rec)
+{
+    int ngts = bcf_get_genotypes(in_hdr, rec, &gts, &mgts);
+    int i, changed = 0;
+    
+    // Calculating allele frequency for each allele and determining major allele
+    // only do this if use_major is true
+    int majorAllele = -1;
+    int maxAC = -1;
+    int an = 0;
+    if(use_major == 1){
+        hts_expand(int,rec->n_allele,marr,arr);
+        int ret = bcf_calc_ac(in_hdr,rec,arr,BCF_UN_FMT);
+        if(ret > 0){
+            for(i=0; i < rec->n_allele; ++i){
+                an += arr[i];
+                if(*(arr+i) > maxAC){
+                    maxAC = *(arr+i);
+                    majorAllele = i;
+                }
+            }
+        }
+        else{
+            fprintf(stderr,"Warning: Could not calculate allele count at position %d\n", rec->pos);
+            exit(1);
+        }
+
+        // replacing new_gt by major allele
+        if(bcf_gt_is_phased(new_gt))
+            new_gt = bcf_gt_phased(majorAllele);
+        else
+            new_gt = bcf_gt_unphased(majorAllele);
+    }
+
+    // replace gts
+    for (i=0; i<ngts; i++)
+    {
+        if ( gts[i]==bcf_gt_missing )
+        {
+            gts[i] = new_gt;
+            changed++;
+        }
+    }
+    nchanged += changed;
+    if ( changed ) bcf_update_genotypes(out_hdr, rec, gts, ngts);
+    return rec;
+}
+
+void destroy(void)
+{
+    free(arr);
+    fprintf(stderr,"Filled %"PRId64" REF alleles\n", nchanged);
+    free(gts);
+}
+
+
diff --git a/plugins/tag2tag.c b/plugins/tag2tag.c
new file mode 100644
index 0000000..4081bd7
--- /dev/null
+++ b/plugins/tag2tag.c
@@ -0,0 +1,128 @@
+/*  plugins/fill-AN-AC.c -- fills AN and AC INFO fields.
+
+    Copyright (C) 2014 Genome Research Ltd.
+
+    Author: Petr Danecek <pd3 at sanger.ac.uk>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.  */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <getopt.h>
+#include <math.h>
+#include <htslib/hts.h>
+#include <htslib/vcf.h>
+#include "bcftools.h"
+
+
+#define GP_TO_GL 1
+
+static int mode = 0, drop_source_tag = 0;
+static bcf_hdr_t *in_hdr, *out_hdr;
+static float *farr = NULL;
+static int mfarr = 0;
+
+const char *about(void)
+{
+    return "Convert between similar tags, such as GL and GP.\n";
+}
+
+const char *usage(void)
+{
+    return 
+        "\n"
+        "About: Convert between similar tags, such as GL and GP.\n"
+        "Usage: bcftools +tag2tag [General Options] -- [Plugin Options]\n"
+        "Options:\n"
+        "   run \"bcftools plugin\" for a list of common options\n"
+        "\n"
+        "Plugin options:\n"
+//todo        "       --gl-to-gp    convert FORMAT/GL to FORMAT/GP\n" 
+        "       --gp-to-gl    convert FORMAT/GP to FORMAT/GL\n"
+        "   -r, --replace     drop the source tag\n"
+        "\n"
+        "Example:\n"
+        "   bcftools +tag2tag in.vcf -- -r --gp-to-gl\n"
+        "\n";
+}
+
+
+static void init_header(bcf_hdr_t *hdr, const char *ori, int ori_type, const char *new_hdr_line)
+{
+    if ( ori )
+        bcf_hdr_remove(hdr,ori_type,ori);
+
+    bcf_hdr_append(hdr, new_hdr_line);
+}
+
+int init(int argc, char **argv, bcf_hdr_t *in, bcf_hdr_t *out)
+{
+    static struct option loptions[] =
+    {
+        {"replace",0,0,'r'},
+        {"gp-to-gl",0,0,1},
+        {0,0,0,0}
+    };
+    char c;
+    while ((c = getopt_long(argc, argv, "?hr",loptions,NULL)) >= 0)
+    {
+        switch (c) 
+        {
+            case  1 : mode = GP_TO_GL; break;
+            case 'r': drop_source_tag = 1; break;
+            case 'h':
+            case '?':
+            default: error("%s", usage()); break;
+        }
+    }
+    if ( !mode ) mode = GP_TO_GL;
+
+    in_hdr  = in;
+    out_hdr = out;
+
+    if ( mode==GP_TO_GL )
+        init_header(out_hdr,drop_source_tag?"GP":NULL,BCF_HL_FMT,"##FORMAT=<ID=GL,Number=G,Type=Float,Description=\"Genotype Likelihoods\">");
+
+    return 0;
+}
+
+bcf1_t *process(bcf1_t *rec)
+{
+    int i, n;
+    if ( mode==GP_TO_GL )
+    {
+        n = bcf_get_format_float(in_hdr,rec,"GP",&farr,&mfarr);
+        for (i=0; i<n; i++)
+        {
+            if ( bcf_float_is_missing(farr[i]) || bcf_float_is_vector_end(farr[i]) ) continue;
+            farr[i] = farr[i] ? log(farr[i]) : -99;
+        }
+        bcf_update_format_float(out_hdr,rec,"GL",farr,n);
+        if ( drop_source_tag )
+            bcf_update_format_float(out_hdr,rec,"GP",NULL,0);
+    }
+    return rec;
+}
+
+void destroy(void)
+{
+    free(farr);
+}
+
+
diff --git a/plugins/vcf2sex.c b/plugins/vcf2sex.c
new file mode 100644
index 0000000..bad4c3d
--- /dev/null
+++ b/plugins/vcf2sex.c
@@ -0,0 +1,311 @@
+/* 
+    Copyright (C) 2014 Genome Research Ltd.
+
+    Author: Petr Danecek <pd3 at sanger.ac.uk>
+
+    Permission is hereby granted, free of charge, to any person obtaining a copy
+    of this software and associated documentation files (the "Software"), to deal
+    in the Software without restriction, including without limitation the rights
+    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+    copies of the Software, and to permit persons to whom the Software is
+    furnished to do so, subject to the following conditions:
+    
+    The above copyright notice and this permission notice shall be included in
+    all copies or substantial portions of the Software.
+    
+    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+    THE SOFTWARE.
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <getopt.h>
+#include <stdarg.h>
+#include <stdint.h>
+#include <htslib/vcf.h>
+#include <htslib/regidx.h>
+#include <htslib/synced_bcf_reader.h>
+#include <htslib/vcfutils.h>
+#include "bcftools.h"
+#include "ploidy.h"
+
+typedef struct
+{
+    int nsites, nsex, *sex2ploidy, dflt_ploidy, max_ploidy, guess;
+    int ncounts, *counts, nsample, verbose;
+    float *sex2prob, min_hets;
+    int32_t *gts, ngts;
+    bcf_srs_t *sr;
+    bcf_hdr_t *hdr;
+    ploidy_t *ploidy;
+}
+args_t;
+
+const char *about(void)
+{
+    return "Determine sample sex by checking genotypes in haploid regions.\n";
+}
+
+const char *usage(void)
+{
+    return 
+        "\n"
+        "About: Determine sample sex by either checking the presence of haploid/diploid\n"
+        "       genotypes (requires correct ploidy in the VCF) or by counting homs/hets\n"
+        "       in haploid regions.\n"
+        "Usage: bcftools +vcf2sex <file.vcf.gz> -- [Plugin Options]\n"
+        "Plugin options:\n"
+        "   -g, --guess             do not trust genotypes ploidy, count hom/hets\n"
+        "   -m, --min-hets <float>  minimum fraction of hets in diploid regions [0.05]\n"
+        "   -n, --nsites <int>      number of sites to check per region (ignored with -g) [10]\n"
+        "   -p, --ploidy <file>     space/tab-delimited list of CHROM,FROM,TO,SEX,PLOIDY\n"
+        "\n"
+        "Example:\n"
+        "   # Default ploidy, if -p not given. Unlisted regions have ploidy 2\n"
+        "   X 1 60000 M 1\n"
+        "   X 2699521 154931043 M 1\n"
+        "   Y 1 59373566 M 1\n"
+        "   Y 1 59373566 F 0\n"
+        "   \n"
+        "   bcftools +vcf2sex in.vcf.gz\n"
+        "   bcftools +vcf2sex in.vcf.gz -- -n 10\n"
+        "\n";
+}
+
+int process_region_precise(args_t *args, char *seq, regitr_t *itr)
+{
+    int k = 1;
+    uint32_t start = itr->reg[itr->i].start, end = itr->reg[itr->i].end;
+    while ( itr->i+k<itr->n && start==itr->reg[itr->i+k].start && end==itr->reg[itr->i+k].end ) k++;
+    
+    int ret = ploidy_query(args->ploidy, seq, start, args->sex2ploidy, NULL, NULL);
+    assert(ret);
+
+    memset(args->counts,0,args->ncounts*sizeof(int));
+
+    // Select 'nsites' sites spaced so that they evenly cover the whole region 
+    // to get a representative sample. We index-jump as we should be checking
+    // a few sites only.
+    int i, rid = -1, pos, prev_pos = -1, ismpl;
+    for (i=0; i<args->nsites; i++)
+    {
+        rid = -1;
+        pos = ((i+1.0)/(args->nsites+1))*(end - start) + start;
+        if ( i>0 && pos <= prev_pos ) continue;     // the vcf is too sparse
+        if ( bcf_sr_seek(args->sr,seq,pos)!=0 ) return k;   // sequence not present
+        if ( !bcf_sr_next_line(args->sr) ) return k;        // no sites found
+        bcf1_t *rec = bcf_sr_get_line(args->sr,0);
+        if ( rid==-1 ) rid = rec->rid;
+        if ( rid!=rec->rid || rec->pos > end ) break;
+        prev_pos = rec->pos;
+
+        int ngts = bcf_get_genotypes(args->hdr,rec,&args->gts,&args->ngts);
+        ngts /= args->nsample;
+        for (ismpl=0; ismpl<args->nsample; ismpl++)
+        {
+            int32_t *gts = args->gts + ngts*ismpl;
+            int igt, ploidy = 0;
+            for (igt=0; igt<ngts; igt++)
+                if ( gts[igt]==bcf_gt_missing || gts[igt]==bcf_int32_missing || gts[igt]==bcf_int32_vector_end ) break;
+                else ploidy++;
+            args->counts[ismpl*(args->max_ploidy+1) + ploidy]++;
+            if ( args->verbose )
+                fprintf(stderr,"%s:%d\t%s\tploidy=%d\n", seq,rec->pos+1,args->hdr->samples[ismpl],ploidy);
+        }
+    }
+
+    for (ismpl=0; ismpl<args->nsample; ismpl++)
+    {
+        float sum = 0, *probs = args->sex2prob + ismpl*args->nsex;
+        int *counts = args->counts + ismpl*(args->max_ploidy+1);
+        for (i=0; i<args->max_ploidy+1; i++) sum += counts[i];
+        if ( !sum ) continue;
+        for (i=0; i<args->nsex; i++)
+        {
+            int ploidy = args->sex2ploidy[i];
+            probs[i] *= counts[ploidy]/sum;
+        }
+    }
+
+    return k;
+}
+
+int process_region_guess(args_t *args, char *seq, regitr_t *itr)
+{
+    int ismpl, k = 1;
+    uint32_t start = itr->reg[itr->i].start, end = itr->reg[itr->i].end;
+    while ( itr->i+k<itr->n && start==itr->reg[itr->i+k].start && end==itr->reg[itr->i+k].end ) k++;
+    
+    int ret = ploidy_query(args->ploidy, seq, start, args->sex2ploidy, NULL, NULL);
+    assert(ret);
+
+    memset(args->counts,0,args->ncounts*sizeof(int));
+
+    if ( bcf_sr_seek(args->sr,seq,start)!=0 ) return k;   // sequence not present
+    int rid = bcf_hdr_name2id(args->hdr,seq);
+    while ( bcf_sr_next_line(args->sr) )
+    {
+        bcf1_t *rec = bcf_sr_get_line(args->sr,0);
+        if ( rec->rid!=rid || rec->pos > end ) break;
+
+        bcf_fmt_t *fmt = bcf_get_fmt(args->hdr, rec, "GT");
+        for (ismpl=0; ismpl<args->nsample; ismpl++)
+        {
+            int gt = bcf_gt_type(fmt, ismpl, NULL,NULL);
+            if ( gt==GT_UNKN ) args->counts[ismpl*3+0]++;       // missing
+            else if ( gt==GT_HET_RA || gt==GT_HET_AA ) args->counts[ismpl*3+1]++;   // het
+            else args->counts[ismpl*3+2]++; // hom
+        }
+    }
+
+    for (ismpl=0; ismpl<args->nsample; ismpl++)
+    {
+        float sum = 0, *probs = args->sex2prob + ismpl*args->nsex;
+        int i, *counts = args->counts + ismpl*(args->max_ploidy+1);
+        float fhet = (counts[1]+counts[2]) ? (float)counts[1]/(counts[1]+counts[2]) : 0;
+        for (i=0; i<args->max_ploidy+1; i++) sum += counts[i];
+        for (i=0; i<args->nsex; i++)
+        {
+            // a very simple heuristics to determine sex by counting hets/homs/missing sites,
+            // in human nhet/nhom ~ 0.2
+            int ploidy = args->sex2ploidy[i];
+            float prob = 1;
+            if ( ploidy==0 )
+                prob = sum ? counts[0] / sum : 1;   // fraction of missing sites
+            else if ( ploidy==1 )
+            {
+                if ( counts[1]+counts[2] ) prob = fhet > args->min_hets ? 0.1 : 0.9;
+                prob *= sum ? 1 - counts[0] / sum : 1./args->nsex;
+            }
+            else 
+            {
+                if ( counts[1]+counts[2] ) prob = fhet > args->min_hets ? 0.9 : 0.1;
+                prob *= sum ? 1 - counts[0] / sum : 1./args->nsex;
+            }
+            probs[i] *= prob;
+        }
+        if ( args->verbose )
+            printf("DBG\t%s:%d-%d\t%s\t%f\t%d\t%d\t%d\n", seq,start+1,end+1,args->hdr->samples[ismpl], fhet,counts[0],counts[1],counts[2]);
+    }
+
+    return k;
+}
+
+int run(int argc, char **argv)
+{
+    args_t *args  = (args_t*) calloc(1,sizeof(args_t));
+    args->nsites = 10;
+    args->min_hets = 0.05;
+    static struct option loptions[] =
+    {
+        {"verbose",1,0,'v'},
+        {"ploidy",1,0,'p'},
+        {"nsites",1,0,'n'},
+        {"guess",0,0,'g'},
+        {"min-hets",1,0,'m'},
+        {0,0,0,0}
+    };
+    char c, *tmp, *ploidy_fname = NULL;
+    while ((c = getopt_long(argc, argv, "p:n:gm:v",loptions,NULL)) >= 0)
+    {
+        switch (c) {
+            case 'v': args->verbose = 1; break; 
+            case 'g': args->guess = 1; break;
+            case 'm': 
+                args->min_hets = strtod(optarg,&tmp); 
+                if ( *tmp ) error("Unexpected argument to --min-hets: %s\n", optarg);
+                break; 
+            case 'p': ploidy_fname = optarg; break; 
+            case 'n': 
+                args->nsites = strtol(optarg,&tmp,10); 
+                if (*tmp) error("Unexpected argument to --nsites: %s\n", optarg); break; 
+            case 'h':
+            case '?':
+            default: error("%s", usage()); break;
+        }
+    }
+
+    args->sr = bcf_sr_init();
+    args->sr->require_index = 1;
+    if ( !argv[0] || !bcf_sr_add_reader(args->sr,argv[0]) ) error("%s", usage());
+    args->hdr = args->sr->readers[0].header;
+    args->nsample = bcf_hdr_nsamples(args->hdr);
+ 
+    args->dflt_ploidy = 2;
+    if ( ploidy_fname )
+    {
+        args->ploidy = ploidy_init(ploidy_fname, args->dflt_ploidy);
+        if ( !args->ploidy ) error("Could not read %s\n", ploidy_fname);
+    }
+    else
+    {
+        args->ploidy = ploidy_init_string(
+                "X 1 60000 M 1\n"
+                "X 2699521 154931043 M 1\n"
+                "Y 1 59373566 M 1\n"
+                "Y 1 59373566 F 0\n", args->dflt_ploidy);
+    }
+    args->nsex = ploidy_nsex(args->ploidy);
+    args->sex2ploidy = (int*) malloc(sizeof(int)*args->nsex);
+    args->max_ploidy = ploidy_max(args->ploidy);
+    if ( args->guess && args->max_ploidy > 2 ) error("Sorry, ploidy %d not supported with -g\n", args->max_ploidy);
+    args->ncounts = args->nsample * ((args->max_ploidy>2 ? args->max_ploidy : 2)+1);
+    args->counts = (int*) malloc(sizeof(int)*args->ncounts);
+    args->sex2prob = (float*) calloc(args->nsample*args->nsex,sizeof(float));
+
+    int i, nseq;
+    for (i=0; i<args->nsample*args->nsex; i++) args->sex2prob[i] = 1;
+
+    if ( args->verbose && args->guess )
+        printf("# [1]DBG\t[2]Region\t[3]Sample\t[4]HET fraction\t[5]nHet\t[6]nHom\t[7]nMissing\n");
+
+    regidx_t *idx = ploidy_regions(args->ploidy);
+    char **seqs = regidx_seq_names(idx, &nseq);
+    for (i=0; i<nseq; i++)
+    {
+        regitr_t itr;
+        regidx_overlap(idx, seqs[i], 0, UINT32_MAX, &itr);
+        while ( itr.i < itr.n )
+            if ( args->guess )
+                itr.i += process_region_guess(args, seqs[i], &itr);
+            else
+                itr.i += process_region_precise(args, seqs[i], &itr);
+    }
+
+    for (i=0; i<args->nsample; i++)
+    {
+        int j, jmax = 0;
+        float max = 0, sum = 0;
+        for (j=0; j<args->nsex; j++)
+        {
+            sum += args->sex2prob[i*args->nsex+j];
+            if ( max < args->sex2prob[i*args->nsex+j] )
+            {
+                jmax = j;
+                max = args->sex2prob[i*args->nsex+j];
+            }
+        }
+        if ( args->verbose )
+            printf("%s\t%s\t%f\n", args->hdr->samples[i],ploidy_id2sex(args->ploidy,jmax),args->sex2prob[i*args->nsex+jmax]/sum);
+        else
+            printf("%s\t%s\n", args->hdr->samples[i],ploidy_id2sex(args->ploidy,jmax));
+    }
+   
+    bcf_sr_destroy(args->sr);
+    ploidy_destroy(args->ploidy);
+    free(args->sex2ploidy);
+    free(args->counts);
+    free(args->gts);
+    free(args->sex2prob);
+    free(args);
+    return 0;
+}
+
+
+
+
diff --git a/plugins/vcf2sex.mk b/plugins/vcf2sex.mk
new file mode 100644
index 0000000..a3720aa
--- /dev/null
+++ b/plugins/vcf2sex.mk
@@ -0,0 +1,2 @@
+plugins/vcf2sex.so: plugins/vcf2sex.c version.h version.c ploidy.h ploidy.c $(HTSDIR)/libhts.so
+	$(CC) $(CFLAGS) $(INCLUDES) -fPIC -shared -o $@ ploidy.c version.c $< -L$(HTSDIR) -lhts
diff --git a/polysomy.c b/polysomy.c
new file mode 100644
index 0000000..e5a94dc
--- /dev/null
+++ b/polysomy.c
@@ -0,0 +1,672 @@
+/* The MIT License
+
+   Copyright (c) 2013-2014 Genome Research Ltd.
+
+   Author: Petr Danecek <pd3 at sanger.ac.uk>
+   
+   Permission is hereby granted, free of charge, to any person obtaining a copy
+   of this software and associated documentation files (the "Software"), to deal
+   in the Software without restriction, including without limitation the rights
+   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+   copies of the Software, and to permit persons to whom the Software is
+   furnished to do so, subject to the following conditions:
+   
+   The above copyright notice and this permission notice shall be included in
+   all copies or substantial portions of the Software.
+   
+   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+   THE SOFTWARE.
+
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <getopt.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <gsl/gsl_vector.h>
+#include <gsl/gsl_multifit_nlin.h>
+#include <htslib/vcf.h>
+#include <htslib/synced_bcf_reader.h>
+#include "bcftools.h"
+
+typedef struct
+{
+    int nvals;      // number of data points to fit against (excluding RR,AA peaks)
+    double *xvals;  // xvalues, pointer to dist_t.xvals
+    double *yvals;  // yvalues, pointer to dist_t.yvals
+    int ngauss;     // number of gaussian functions
+}
+data_t;
+
+typedef struct
+{
+    data_t dat;
+    int nvals;          // all values, including RR,AA peaks
+    double *xvals;      // pointer to args_t.xvals
+    double *yvals;   
+    int copy_number;    // heuristics to skip futile CN1 fits when no het peak is detected
+    int irr, iaa;       // chop off RR and AA peaks
+    char *chr;
+}
+dist_t;
+
+typedef struct
+{
+    int ndist, nbins;
+    double *xvals;
+    dist_t *dist;
+    char **argv, *output_dir;
+    double fit_th, peak_symmetry, cn_penalty;
+    int argc, plot, verbose, regions_is_file, targets_is_file;
+    char *dat_fname, *fname, *regions_list, *targets_list, *sample;
+    FILE *dat_fp;
+}
+args_t;
+
+FILE *open_file(char **fname, const char *mode, const char *fmt, ...);
+
+static void init_dist(dist_t *dist, int verbose)
+{
+    // isolate RR and AA peaks and rescale so that they are comparable to hets
+    int i, irr, iaa, n = dist->nvals;
+
+    // smooth the distribution
+    double *tmp = (double*) malloc(sizeof(double)*n);
+    int win = 0.02*n < 1 ? 1 : 0.02*n;
+    double avg = 0;
+    for (i=0; i<win; i++) avg += dist->yvals[i];
+    for (i=0; i<n-win; i++)
+    {
+        tmp[i] = avg / win;
+        avg += -dist->yvals[i] + dist->yvals[i+win];
+    }
+    for (; i<n; i++) tmp[i] = avg;
+
+    // find the extremes; first a simple approach: find a gap
+    for (irr=0,i=0; i<n/2; i++) if ( tmp[i] < tmp[irr] ) irr = i;
+    for (iaa=n-1,i=n-1; i>=n/2; i--) if ( tmp[i] < tmp[iaa] ) iaa = i;
+    irr += win*0.5;
+    iaa += win*0.5;
+    if ( irr>=iaa ) error("FIXME: oops, dist normalization failed for %s: %d vs %d\n", dist->chr,irr,iaa); // we may need to be smarter
+    free(tmp);
+
+    // find the maximum and scale the peaks (first draft: no attempt to join the segments smootly)
+    double max_rr = 0, max_aa = 0, max_ra = 0, srr = 0, saa = 0, sra = 0;
+    for (i=0; i<irr; i++)
+    {
+        srr += dist->yvals[i];
+        if ( max_rr < dist->yvals[i] ) max_rr = dist->yvals[i];
+    }
+    for (i=irr; i<=iaa; i++)
+    {
+        sra += dist->yvals[i];
+        if ( max_ra < dist->yvals[i] ) max_ra = dist->yvals[i];
+    }
+    for (i=iaa+1; i<n; i++)
+    {
+        saa += dist->yvals[i];
+        if ( max_aa < dist->yvals[i] ) max_aa = dist->yvals[i];
+    }
+
+
+    // Does the het peak exist at all? Usually the numbers are as follows:
+    //  1:  cn=0     ra/rr=0.205730      aa/ra=0.674922      nra=7066
+    //  20: cn=0     ra/rr=0.258019      aa/ra=0.548929      nra=2381
+    //  X:  cn=0     ra/rr=0.005976      aa/ra=44.116667     nra=60
+    //  Y:  cn=0     ra/rr=0.008316      aa/ra=7.250000      nra=12
+    //  MT: cn=0     ra/rr=0.013699      aa/ra=0.666667      nra=3
+
+    if ( !sra || (sra/srr<0.1 && saa/sra>1.0) )
+    {
+        max_ra = max_aa;
+        dist->copy_number = 1;
+    }
+    else if ( sra/srr<0.1 || saa/sra>1.0 )
+    {
+        max_ra = max_aa;
+        dist->copy_number = -1;     // unknown copy number
+    }
+    if ( max_rr ) for (i=0; i<irr; i++) dist->yvals[i] /= max_rr;
+    if ( max_ra ) for (i=irr; i<=iaa; i++) dist->yvals[i] /= max_ra;
+    if ( max_aa ) for (i=iaa+1; i<n; i++) dist->yvals[i] /= max_aa;
+
+    dist->dat.yvals = &dist->yvals[irr];
+    dist->dat.xvals = &dist->xvals[irr];
+    dist->dat.nvals = iaa - irr + 1;
+
+    if ( verbose )
+        fprintf(stderr,"%s:\t cn=%2d \t ra/rr=%f \t aa/ra=%f \t nra=%d\n", dist->chr,dist->copy_number,sra/srr,saa/sra, (int)sra);
+}
+
+static void init_data(args_t *args)
+{
+    bcf_srs_t *files = bcf_sr_init();
+    if ( args->regions_list )
+    {
+        if ( bcf_sr_set_regions(files, args->regions_list, args->regions_is_file)<0 )
+            error("Failed to read the regions: %s\n", args->regions_list);
+    }
+    if ( args->targets_list )
+    {
+        if ( bcf_sr_set_targets(files, args->targets_list, args->targets_is_file, 0)<0 )
+            error("Failed to read the targets: %s\n", args->targets_list);
+    }
+    if ( !bcf_sr_add_reader(files, args->fname) ) error("Failed to open %s: %s\n", args->fname,bcf_sr_strerror(files->errnum));
+    bcf_hdr_t *hdr = files->readers[0].header;
+    if ( !args->sample )
+    {
+        if ( bcf_hdr_nsamples(hdr)>1 ) error("Missing the option -s, --sample\n");
+        args->sample = hdr->samples[0];
+    }
+    else if ( bcf_hdr_id2int(hdr,BCF_DT_SAMPLE,args->sample)<0 ) error("No such sample: %s\n", args->sample);
+    int ret = bcf_hdr_set_samples(hdr, args->sample, 0);
+    if ( ret<0 ) error("Error setting the sample: %s\n", args->sample);
+
+    if ( !bcf_hdr_idinfo_exists(hdr,BCF_HL_FMT,bcf_hdr_id2int(hdr,BCF_DT_ID,"BAF")) )
+        error("The tag FORMAT/BAF is not present in the VCF: %s\n", args->fname);
+
+    int i;
+    args->xvals = (double*) calloc(args->nbins,sizeof(double));
+    for (i=0; i<args->nbins; i++) args->xvals[i] = 1.0*i/(args->nbins-1);
+
+    // collect BAF distributions for all chromosomes
+    int idist = -1, nbaf = 0, nprocessed = 0, ntotal = 0, prev_chr = -1;
+    float *baf = NULL;
+    while ( bcf_sr_next_line(files) )
+    {
+        ntotal++;
+
+        bcf1_t *line = bcf_sr_get_line(files,0);
+        if ( bcf_get_format_float(hdr,line,"BAF",&baf,&nbaf) != 1 ) continue;
+        if ( bcf_float_is_missing(baf[0]) ) continue;
+
+        nprocessed++;
+
+        if ( prev_chr==-1 || prev_chr!=line->rid )
+        {
+            // new chromosome
+            idist = args->ndist++;
+            args->dist = (dist_t*) realloc(args->dist, sizeof(dist_t)*args->ndist);
+            memset(&args->dist[idist],0,sizeof(dist_t));
+            args->dist[idist].chr   = strdup(bcf_seqname(hdr,line));
+            args->dist[idist].yvals = (double*) calloc(args->nbins,sizeof(double));
+            args->dist[idist].xvals = args->xvals;
+            args->dist[idist].nvals = args->nbins;
+            prev_chr = line->rid;
+        }
+        int bin = baf[0]*(args->nbins-1);
+        args->dist[idist].yvals[bin]++;   // the distribution
+    }
+    free(baf);
+    bcf_sr_destroy(files);
+
+    for (idist=0; idist<args->ndist; idist++)
+        init_dist(&args->dist[idist],args->verbose);
+
+    args->dat_fp = open_file(&args->dat_fname,"w","%s/dist.dat", args->output_dir);
+    fprintf(args->dat_fp, "# This file was produced by: bcftools polysomy(%s+htslib-%s), the command line was:\n", bcftools_version(),hts_version());
+    fprintf(args->dat_fp, "# \t bcftools %s ", args->argv[0]);
+    for (i=1; i<args->argc; i++)
+        fprintf(args->dat_fp, " %s",args->argv[i]);
+    fprintf(args->dat_fp,"\n#\n");
+    fprintf(args->dat_fp,"# DIST\t[2]Chrom\t[3]BAF\t[4]Normalized Count\n");
+    fprintf(args->dat_fp,"# FIT\t[2]Chrom\t[3]Mean of fitted Gaussian\t[4]Scale\t[5]Sigma[6]\tMean etc.\n");
+    fprintf(args->dat_fp,"# CN\t[2]Chrom\t[3]Estimated Copy Number\t[4]Absolute fit deviation\n");
+
+    char *fname = NULL;
+    FILE *fp = open_file(&fname,"w","%s/dist.py", args->output_dir);
+//-------- matplotlib script --------------
+    fprintf(fp,
+        "#!/usr/bin/env python\n"
+        "#\n"
+        "import matplotlib as mpl\n"
+        "mpl.use('Agg')\n"
+        "import matplotlib.pyplot as plt\n"
+        "import csv,math,sys,argparse\n"
+        "\n"
+        "outdir = '%s'\n"
+        "\n"
+        "def read_dat(dat,fit,cn):\n"
+        "   csv.register_dialect('tab', delimiter='\t', quoting=csv.QUOTE_NONE)\n"
+        "   with open(outdir+'/dist.dat', 'rb') as f:\n"
+        "      reader = csv.reader(f, 'tab')\n"
+        "      for row in reader:\n"
+        "          if row[0][0]=='#': continue\n"
+        "          type = row[0]\n"
+        "          chr  = row[1]\n"
+        "          if type=='DIST':\n"
+        "              if chr not in dat: dat[chr] = []\n"
+        "              dat[chr].append(row)\n"
+        "          elif type=='FIT':\n"
+        "              if chr not in fit: fit[chr] = []\n"
+        "              fit[chr] = row[2:]\n"
+        "          elif type=='CN':\n"
+        "              cn[chr] = row[2]\n"
+        "\n"
+        "def fitted_func(xvals,params):\n"
+        "   n = len(params)/3\n"
+        "   out = []\n"
+        "   for x in xvals:\n"
+        "       y = 0\n"
+        "       for i in range(n):\n"
+        "           mean  = float(params[i*3+0])\n"
+        "           scale = float(params[i*3+1])\n"
+        "           sigma = float(params[i*3+2])\n"
+        "           y += scale * math.exp(-(float(x)-mean)**2/sigma**2)\n"
+        "       out.append(y)\n"
+        "   return out\n"
+        "\n"
+        "def plot_dist(dat,fit,chr):\n"
+        "   fig, ax = plt.subplots(1, 1, figsize=(7,5))\n"
+        "   ax.plot([x[2] for x in dat[chr]],[x[3] for x in dat[chr]],'-',label='Distribution')\n"
+        "   ax.plot([x[2] for x in dat[chr]],fitted_func([x[2] for x in dat[chr]], fit[chr]),'-',label='Best Fit')\n"
+        "   ax.set_title('BAF distribution, chr'+chr)\n"
+        "   ax.set_xlabel('BAF')\n"
+        "   ax.set_ylabel('Frequency')\n"
+        "   ax.legend(loc='best',prop={'size':7},frameon=False)\n"
+        "   plt.savefig(outdir+'/dist.chr'+chr+'.png')\n"
+        "   plt.close()\n"
+        "\n"
+        "def plot_copy_number(cn):\n"
+        "   fig, ax = plt.subplots(1, 1, figsize=(7,5))\n"
+        "   xlabels = sorted(cn.keys())\n"
+        "   xvals = range(len(xlabels))\n"
+        "   yvals = [float(cn[x]) for x in xlabels]\n"
+        "   ax.plot(xvals,yvals,'o',color='red')\n"
+        "   for i in range(len(xvals)):\n"
+        "       if yvals[i]==-1: ax.annotate('?', xy=(xvals[i],0.5),va='center',ha='center',color='red',fontweight='bold')\n"
+        "   ax.tick_params(axis='both', which='major', labelsize=9)\n"
+        "   ax.set_xticks(xvals)\n"
+        "   ax.set_xticklabels(xlabels,rotation=45)\n"
+        "   ax.set_xlim(-1,len(xlabels))\n"
+        "   ax.set_ylim(0,5.0)\n"
+        "   ax.set_yticks([1.0,2.0,3.0,4.0])\n"
+        "   ax.set_xlabel('Chromosome')\n"
+        "   ax.set_ylabel('Copy Number')\n"
+        "   plt.savefig(outdir+'/copy-number.png')\n"
+        "   plt.close()\n"
+        "\n"
+        "def main():\n"
+        "   parser = argparse.ArgumentParser()\n"
+        "   parser.add_argument('-a', '--all', action='store_true', help='Create all plots')\n"
+        "   parser.add_argument('-c', '--copy-number', action='store_true', help='Create copy-number plot')\n"
+        "   parser.add_argument('-d', '--distrib', metavar='CHR', help='Plot BAF distribution of a single chromosome')\n"
+        "   args = parser.parse_args()\n"
+        "   if args.distrib==None and not args.all and not args.copy_number: parser.print_help()\n"
+        "   dat = {}; fit = {}; cn = {}\n"
+        "   read_dat(dat,fit,cn)\n"
+        "   if args.distrib!=None:\n"
+        "       plot_dist(dat,fit,args.distrib)\n"
+        "   if args.all:\n"
+        "       for chr in dat: plot_dist(dat,fit,chr)\n"
+        "       plot_copy_number(cn)\n"
+        "   elif args.copy_number:\n"
+        "       plot_copy_number(cn)\n"
+        "\n"
+        "if __name__ == '__main__':\n"
+        "   main()\n",
+        args->output_dir);
+//---------------------------------------
+    chmod(fname, S_IWUSR|S_IRUSR|S_IRGRP|S_IROTH|S_IXUSR|S_IXGRP|S_IXOTH);
+    free(fname);
+    fclose(fp);
+}
+
+static void destroy_data(args_t *args)
+{
+    int i;
+    for (i=0; i<args->ndist; i++)
+    {
+        free(args->dist[i].chr);
+        free(args->dist[i].yvals);
+    }
+    free(args->dist);
+    free(args->xvals);
+    free(args->dat_fname);
+    fclose(args->dat_fp);
+}
+
+static void save_dist(args_t *args, int idist, int ngauss, double *params)
+{
+    int i;
+    for (i=0; i<args->nbins; i++)
+        fprintf(args->dat_fp,"DIST\t%s\t%f\t%f\n",args->dist[idist].chr,args->dist[idist].xvals[i],args->dist[idist].yvals[i]);
+    fprintf(args->dat_fp,"FIT\t%s", args->dist[idist].chr);
+    for (i=0; i<ngauss*3; i++) fprintf(args->dat_fp,"\t%f", params[i]);
+    fprintf(args->dat_fp,"\n");
+}
+
+int func_f(const gsl_vector *params, void *data, gsl_vector *yvals)
+{
+    data_t *dat = (data_t *) data;
+
+    int i, j;
+    for (i=0; i<dat->nvals; i++)
+    {
+        double xi = dat->xvals[i];
+        double yi = 0;
+        for (j=0; j<dat->ngauss; j++)
+        {
+            double center = gsl_vector_get(params,j*3 + 0);
+            double scale  = gsl_vector_get(params,j*3 + 1);
+            double sigma  = gsl_vector_get(params,j*3 + 2);
+
+            double zi = (xi - center) / sigma;
+            yi += scale*scale * exp(-zi*zi);
+        }
+        gsl_vector_set(yvals, i, (yi - dat->yvals[i])/0.1);
+    }
+    return GSL_SUCCESS;
+}
+
+int func_df(const gsl_vector *params, void *data, gsl_matrix *jacobian)
+{
+    data_t *dat = (data_t *) data;
+
+    int i, j;
+    for (i=0; i<dat->nvals; i++)
+    {
+        // Jacobian matrix J(i,j) = dfi / dxj,
+        // where fi = (Yi - yi),
+        //       Yi = scale^2 * exp(-(center - xi)^2/sigma^2)
+        //
+
+        double xi = dat->xvals[i];
+        for (j=0; j<dat->ngauss; j++)
+        {
+            double center = gsl_vector_get(params,j*3 + 0);
+            double scale  = gsl_vector_get(params,j*3 + 1);
+            double sigma  = gsl_vector_get(params,j*3 + 2);
+
+            double zi = (xi - center) / sigma;
+            double ei = exp(-zi*zi);
+
+            gsl_matrix_set(jacobian, i, j*3 + 0, 2*scale*scale*(xi-center)/(sigma*sigma)*ei);
+            gsl_matrix_set(jacobian, i, j*3 + 1, 2*scale*ei);
+            gsl_matrix_set(jacobian, i, j*3 + 2, 2*scale*scale*(xi-center)*(xi-center)/(sigma*sigma*sigma)*ei);
+        }
+    }
+    return GSL_SUCCESS;
+}
+
+int func_set(const gsl_vector *params, void *data, gsl_vector *yvals, gsl_matrix *jacobian)
+{
+    func_f(params, data, yvals);
+    func_df(params, data, jacobian);
+    return GSL_SUCCESS;
+}
+static double eval_fit(int nvals, double *xvals, double *yvals, int ngauss, double *params)
+{
+    double sum = 0;
+    int i, j;
+    for (i=0; i<nvals; i++)
+    {
+        double yval = 0;
+        for (j=0; j<ngauss; j++)
+        {
+            double center = params[j*3 + 0];
+            double scale  = params[j*3 + 1];
+            double sigma  = params[j*3 + 2];
+            
+            double zi = (xvals[i] - center) / sigma;
+            yval += scale * exp(-zi*zi);
+        }
+        sum += fabs(yval - yvals[i]);
+    }
+    return sum;
+}
+
+static int gauss_fit(dist_t *dist, int ngauss, double *params)
+{
+    data_t *dat = &dist->dat;
+    dat->ngauss = ngauss;
+
+    gsl_multifit_function_fdf mfunc;
+    mfunc.f   = &func_f;
+    mfunc.df  = &func_df;
+    mfunc.fdf = &func_set;
+    mfunc.n   = dat->nvals;
+    mfunc.p   = ngauss*3;      // number of fitting parameters
+    mfunc.params = dat;
+
+    const gsl_multifit_fdfsolver_type *solver_type;
+    gsl_multifit_fdfsolver *solver;
+    gsl_vector_view vview = gsl_vector_view_array(params, mfunc.p);
+    solver_type = gsl_multifit_fdfsolver_lmsder;
+    solver = gsl_multifit_fdfsolver_alloc(solver_type, dat->nvals, mfunc.p);
+    gsl_multifit_fdfsolver_set(solver, &mfunc, &vview.vector);
+
+    int i, status;
+    size_t iter = 0;
+    do
+    {
+        status = gsl_multifit_fdfsolver_iterate(solver);
+        if ( status ) break;
+        status = gsl_multifit_test_delta(solver->dx, solver->x, 1e-4, 1e-4);
+    }
+    while (status == GSL_CONTINUE && iter++ < 500);
+
+    for (i=0; i<mfunc.p; i++)
+        params[i] = gsl_vector_get(solver->x, i);
+
+    gsl_multifit_fdfsolver_free(solver);
+    return iter>500 ? -1 : 0;
+}
+
+static double best_fit(args_t *args, dist_t *dist, int ngauss, double *params)
+{
+    if ( ngauss==1 )
+    {
+        gauss_fit(dist,ngauss,params);
+        params[1] *= params[1];
+        return eval_fit(dist->dat.nvals, dist->dat.xvals, dist->dat.yvals, ngauss,params);
+    }
+
+    int i, j, n = 3;
+    int ipk = 3*(ngauss-1);
+    double delta = 0.5 * (params[ipk] - params[0]) / n;
+    double best_params[9], tmp_params[9], best_fit = HUGE_VAL;
+    for (i=0; i<n; i++)
+    {
+        memcpy(tmp_params,params,sizeof(double)*ngauss*3);
+        tmp_params[0]   += delta*i;
+        tmp_params[ipk] -= delta*i;
+        if ( gauss_fit(dist,ngauss,tmp_params)<0 ) continue;    // did not converge
+
+        for (j=0; j<ngauss; j++) tmp_params[j*3+1] *= tmp_params[j*3+1];
+
+        // From the nature of the data, we can assume that in presence of
+        // multiple peaks they will be placed symmetrically around 0.5. Also
+        // their size should be about the same. We evaluate the fit with this
+        // in mind.
+        double dx = fabs(0.5 - tmp_params[0]) + fabs(tmp_params[ipk] - 0.5);
+        tmp_params[0] = 0.5 - dx*0.5;
+        tmp_params[ipk] = 0.5 + dx*0.5;
+        double fit = eval_fit(dist->dat.nvals, dist->dat.xvals, dist->dat.yvals, ngauss, tmp_params);
+
+        if ( best_fit < fit ) continue;     // worse than previous
+        best_fit = fit;
+        memcpy(best_params,tmp_params,sizeof(double)*ngauss*3);
+    }
+    memcpy(params,best_params,sizeof(double)*ngauss*3);
+    return best_fit;
+}
+
+static void print_params(data_t *dat, int ngauss, double *params, float fit, float frac, char fail, char comment)
+{
+    int i, j;
+    printf("\t%c%c fit=%f frac=%.2f .. center,scale,sigma = ", comment,fail?fail:'o',fit,frac);
+    for (i=0; i<ngauss; i++)
+    {
+        if ( i!=0 ) printf("\t");
+        for (j=0; j<3; j++) printf(" %f", params[i*3+j]);
+    }
+    printf("\n");
+}
+static void fit_curves(args_t *args)
+{
+    int i;
+    for (i=0; i<args->ndist; i++)
+    {
+        dist_t *dist = &args->dist[i];
+        if ( dist->copy_number!=0 )
+        {
+            fprintf(args->dat_fp,"CN\t%s\t%.2f\n", dist->chr,(float)dist->copy_number);
+            save_dist(args, i, 0, NULL);
+            continue;
+        }
+
+        // Parameters (center,scale,sigma) for gaussian peaks.
+        double params_cn2[] = { 1/2.,0.5,0.05 };
+        double params_cn3[] = { 1/3.,0.5,0.05, 2/3.,0.5,0.05 };
+        double params_cn4[] = { 1/4.,0.5,0.05, 1/2.,0.5,0.05, 3/4.,0.5,0.05 };
+
+        double fit_cn2 = best_fit(args,&args->dist[i],1,params_cn2);
+        double fit_cn3 = best_fit(args,&args->dist[i],2,params_cn3);
+        double fit_cn4 = best_fit(args,&args->dist[i],3,params_cn4);
+
+        double dx_cn3  = fabs(params_cn3[0] - params_cn3[3]);
+        double dx_cn4  = fabs(params_cn4[0] - params_cn4[6]);
+        double dy_cn3  = params_cn3[1] > params_cn3[4] ? params_cn3[4]/params_cn3[1] : params_cn3[1]/params_cn3[4];
+        double dy_cn4a = params_cn4[1] > params_cn4[7] ? params_cn4[7]/params_cn4[1] : params_cn4[1]/params_cn4[7]; // side peaks
+        double ymax = params_cn4[1] > params_cn4[7] ? params_cn4[1] : params_cn4[7];
+        double dy_cn4b = ymax > params_cn4[4] ? params_cn4[4]/ymax : ymax/params_cn4[4];    // middle peak
+
+        // Three peaks (CN4) are always a better fit than two (CN3) or one (CN2). Therefore
+        // check that peaks are well separated and that the peak sizes are reasonable
+        char cn2_fail = 0, cn3_fail = 0, cn4_fail = 0;
+        if ( fit_cn2 > args->fit_th ) cn2_fail = 'f';
+
+        if ( fit_cn3 > args->fit_th ) cn3_fail = 'f';
+        else if ( dx_cn3 < 0.05 ) cn3_fail = 'x';         // peak separation: at least ~10% of cells
+        else if ( dy_cn3 < args->peak_symmetry ) cn3_fail = 'y';    
+
+        if ( fit_cn4 > args->fit_th ) cn4_fail = 'f';
+        else if ( dx_cn4 < 0.1 ) cn4_fail = 'x';            // peak separation
+        else if ( dy_cn4a < args->peak_symmetry ) cn4_fail = 'y';
+        else if ( dy_cn4b < args->peak_symmetry ) cn4_fail = 'Y';
+
+        // Estimate fraction of affected cells. For CN4 we estimate
+        // contamination (the fraction of foreign cells), which is more
+        // common than CN4; hence the value is from the interval [0,0.5].
+        //      CN3 .. f = 2*dx/(1-dx)
+        //      CN4 .. f = dx
+        dx_cn3 = 2*dx_cn3 / (1-dx_cn3);
+
+        double cn = -1, fit = fit_cn2;
+        if ( !cn2_fail ) { cn = 2; fit = fit_cn2; }
+        if ( !cn3_fail && fit_cn3 < args->cn_penalty * fit ) { cn = 3; fit = fit_cn3; }
+        if ( !cn4_fail && fit_cn4 < args->cn_penalty * fit ) { cn = 4; fit = fit_cn4; }
+
+        if ( cn==-1 ) save_dist(args, i, 0, NULL);
+        else if ( cn==2 ) save_dist(args, i, 1, params_cn2);
+        else if ( cn==3 ) { save_dist(args, i, 2, params_cn3); cn = 2 + dx_cn3; }
+        else if ( cn==4 ) { save_dist(args, i, 3, params_cn4); cn = 3 + dx_cn4; }
+
+        if ( args->verbose )
+        {
+            printf("%s: \n", args->dist[i].chr);
+            print_params(&args->dist[i].dat, 1, params_cn2, fit_cn2, 1.0,    cn2_fail, cn==2 ? '*' : ' ');
+            print_params(&args->dist[i].dat, 2, params_cn3, fit_cn3, dx_cn3, cn3_fail, cn>2 && cn<=3 ? '*' : ' ');
+            print_params(&args->dist[i].dat, 3, params_cn4, fit_cn4, dx_cn4, cn4_fail, cn>3 ? '*' : ' ');
+            printf("\n");
+        }
+        fprintf(args->dat_fp,"CN\t%s\t%.2f\t%f\n", dist->chr, cn, fit);
+    }
+}
+
+static void usage(args_t *args)
+{
+    fprintf(stderr, "\n");
+    fprintf(stderr, "About:   Detect number of chromosomal copies from Illumina's B-allele frequency (BAF)\n");
+    fprintf(stderr, "Usage:   bcftools polysomy [OPTIONS] <file.vcf>\n");
+    fprintf(stderr, "General options:\n");
+    fprintf(stderr, "    -o, --output-dir <path>        \n");
+    fprintf(stderr, "    -r, --regions <region>         restrict to comma-separated list of regions\n");
+    fprintf(stderr, "    -R, --regions-file <file>      restrict to regions listed in a file\n");
+    fprintf(stderr, "    -s, --sample <name>            sample to analyze\n");
+    fprintf(stderr, "    -t, --targets <region>         similar to -r but streams rather than index-jumps\n");
+    fprintf(stderr, "    -T, --targets-file <file>      similar to -R but streams rather than index-jumps\n");
+    fprintf(stderr, "    -v, --verbose                  \n");
+    fprintf(stderr, "Algorithm options:\n");
+    fprintf(stderr, "    -c, --cn-penalty <float>       penalty for increasing CN (smaller more strict) [0.7]\n");
+    fprintf(stderr, "    -f, --fit-th <float>           goodness of fit threshold (smaller more strict) [3.0]\n");
+    fprintf(stderr, "    -p, --peak-symmetry <float>    peak symmetry threshold (bigger more strict) [0.7]\n");
+    fprintf(stderr, "\n");
+    exit(1);
+}
+
+int main_polysomy(int argc, char *argv[])
+{
+    args_t *args = (args_t*) calloc(1,sizeof(args_t));
+    args->argc   = argc; args->argv = argv;
+    args->nbins  = 150;
+    args->fit_th = 3.0;
+    args->cn_penalty = 0.7;
+    args->peak_symmetry = 0.7;
+
+    static struct option loptions[] = 
+    {
+        {"verbose",0,0,'v'},
+        {"fit-th",1,0,'f'},
+        {"cn-penalty",1,0,'c'},
+        {"peak-symmetry",1,0,'p'},
+        {"output-dir",1,0,'o'},
+        {"sample",1,0,'s'},
+        {"targets",1,0,'t'},
+        {"targets-file",1,0,'T'},
+        {"regions",1,0,'r'},
+        {"regions-file",1,0,'R'},
+        {0,0,0,0}
+    };
+    char c, *tmp;
+    while ((c = getopt_long(argc, argv, "h?o:vt:T:r:R:s:f:p:c:",loptions,NULL)) >= 0) 
+    {
+        switch (c) 
+        {
+            case 'f': 
+                args->fit_th = strtod(optarg,&tmp);
+                if ( *tmp ) error("Could not parse: -f %s\n", optarg);
+                break;
+            case 'p': 
+                args->peak_symmetry = strtod(optarg,&tmp);
+                if ( *tmp ) error("Could not parse: -p %s\n", optarg);
+                break;
+            case 'c': 
+                args->cn_penalty = strtod(optarg,&tmp);
+                if ( *tmp ) error("Could not parse: -c %s\n", optarg);
+                break;
+            case 's': args->sample = optarg; break;
+            case 't': args->targets_list = optarg; break;
+            case 'T': args->targets_list = optarg; args->targets_is_file = 1; break;
+            case 'r': args->regions_list = optarg; break;
+            case 'R': args->regions_list = optarg; args->regions_is_file = 1; break;
+            case 'o': args->output_dir = optarg; break;
+            case 'v': args->verbose = 1; break;
+            default: usage(args); break;
+        }
+    }
+    if ( optind>=argc )
+    {
+        if ( !isatty(fileno((FILE *)stdin)) ) args->fname = "-";
+    }
+    else args->fname = argv[optind];
+    if ( !args->fname ) usage(args);
+    if ( !args->output_dir ) error("Missing the -o option\n");
+
+    init_data(args);
+    fit_curves(args);
+    destroy_data(args);
+    free(args);
+
+    return 0;
+}
+
+
diff --git a/prob1.c b/prob1.c
new file mode 100644
index 0000000..8f4463f
--- /dev/null
+++ b/prob1.c
@@ -0,0 +1,529 @@
+/*  prob1.c -- mathematical utility functions.
+
+    Copyright (C) 2010, 2011 Broad Institute.
+    Copyright (C) 2012, 2013 Genome Research Ltd.
+
+    Author: Heng Li <lh3 at sanger.ac.uk>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.  */
+
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <errno.h>
+#include <assert.h>
+#include <limits.h>
+#include <zlib.h>
+#include "prob1.h"
+
+// #include "kstring.h"
+// #include "kseq.h"
+// KSTREAM_INIT(gzFile, gzread, 16384)
+
+#define MC_MAX_EM_ITER 16
+#define MC_EM_EPS 1e-5
+#define MC_DEF_INDEL 0.15
+
+gzFile bcf_p1_fp_lk;
+
+void bcf_p1_indel_prior(bcf_p1aux_t *ma, double x)
+{
+    int i;
+    for (i = 0; i < ma->M; ++i)
+        ma->phi_indel[i] = ma->phi[i] * x;
+    ma->phi_indel[ma->M] = 1. - ma->phi[ma->M] * x;
+}
+
+static void init_prior(int type, double theta, int M, double *phi)
+{
+    int i;
+    if (type == MC_PTYPE_COND2) {
+        for (i = 0; i <= M; ++i)
+            phi[i] = 2. * (i + 1) / (M + 1) / (M + 2);
+    } else if (type == MC_PTYPE_FLAT) {
+        for (i = 0; i <= M; ++i)
+            phi[i] = 1. / (M + 1);
+    } else {
+        double sum;
+        for (i = 0, sum = 0.; i < M; ++i)
+            sum += (phi[i] = theta / (M - i));
+        phi[M] = 1. - sum;
+    }
+}
+
+void bcf_p1_init_prior(bcf_p1aux_t *ma, int type, double theta)
+{
+    init_prior(type, theta, ma->M, ma->phi);
+    bcf_p1_indel_prior(ma, MC_DEF_INDEL);
+}
+
+void bcf_p1_init_subprior(bcf_p1aux_t *ma, int type, double theta)
+{
+    if (ma->n1 <= 0 || ma->n1 >= ma->M) return;
+    init_prior(type, theta, 2*ma->n1, ma->phi1);
+    init_prior(type, theta, 2*(ma->n - ma->n1), ma->phi2);
+}
+
+
+/* Initialise a bcf_p1aux_t */
+bcf_p1aux_t *bcf_p1_init(int n_smpl, uint8_t *ploidy)
+{
+    bcf_p1aux_t *ma;
+    int i;
+    ma = (bcf_p1aux_t*) calloc(1, sizeof(bcf_p1aux_t));
+    ma->n1 = -1;
+    ma->n = n_smpl;
+    ma->M = 2 * n_smpl;
+    if (ploidy) {
+        ma->ploidy = (uint8_t*) malloc(n_smpl);
+        memcpy(ma->ploidy, ploidy, n_smpl);
+        for (i = 0, ma->M = 0; i < n_smpl; ++i) ma->M += ploidy[i];
+        if (ma->M == 2 * n_smpl) {
+            free(ma->ploidy);
+            ma->ploidy = 0;
+        }
+    }
+    ma->q2p = (double*) calloc(256, sizeof(double));
+    ma->pdg = (double*) calloc(3 * ma->n, sizeof(double));
+    ma->phi = (double*) calloc(ma->M + 1, sizeof(double));
+    ma->phi_indel = (double*) calloc(ma->M + 1, sizeof(double));
+    ma->phi1 = (double*) calloc(ma->M + 1, sizeof(double));
+    ma->phi2 = (double*) calloc(ma->M + 1, sizeof(double));
+    ma->z = (double*) calloc(ma->M + 1, sizeof(double));
+    ma->zswap = (double*) calloc(ma->M + 1, sizeof(double));
+    ma->z1 = (double*) calloc(ma->M + 1, sizeof(double)); // actually we do not need this large
+    ma->z2 = (double*) calloc(ma->M + 1, sizeof(double));
+    ma->afs = (double*) calloc(ma->M + 1, sizeof(double));
+    ma->afs1 = (double*) calloc(ma->M + 1, sizeof(double));
+    ma->lf = (double*) calloc(ma->M + 1, sizeof(double));
+    for (i = 0; i < 256; ++i)
+        ma->q2p[i] = pow(10., -i / 10.);
+    for (i = 0; i <= ma->M; ++i) ma->lf[i] = lgamma(i + 1);
+    bcf_p1_init_prior(ma, MC_PTYPE_FULL, 1e-3); // the simplest prior
+    return ma;
+}
+
+int bcf_p1_get_M(bcf_p1aux_t *b) { return b->M; }
+
+int bcf_p1_set_n1(bcf_p1aux_t *b, int n1)
+{
+    if (n1 == 0 || n1 >= b->n) return -1;
+    if (b->M != b->n * 2) {
+        fprintf(stderr, "[%s] unable to set `n1' when there are haploid samples.\n", __func__);
+        return -1;
+    }
+    b->n1 = n1;
+    return 0;
+}
+
+void bcf_p1_destroy(bcf_p1aux_t *ma)
+{
+    if (ma) {
+        int k;
+        free(ma->lf);
+        if (ma->hg && ma->n1 > 0) {
+            for (k = 0; k <= 2*ma->n1; ++k) free(ma->hg[k]);
+            free(ma->hg);
+        }
+        free(ma->ploidy); free(ma->q2p); free(ma->pdg);
+        free(ma->phi); free(ma->phi_indel); free(ma->phi1); free(ma->phi2);
+        free(ma->z); free(ma->zswap); free(ma->z1); free(ma->z2);
+        free(ma->afs); free(ma->afs1);
+        free(ma);
+    }
+}
+
+extern double kf_gammap(double s, double z);
+int test16(bcf1_t *b, anno16_t *a);
+
+/* Calculate P(D|g) */
+static int cal_pdg(const bcf1_t *b, bcf_p1aux_t *ma)
+{
+    int i, j;
+    long *p, tmp;
+    p = (long*) alloca(b->n_allele * sizeof(long));
+    memset(p, 0, sizeof(long) * b->n_allele);
+
+    // Set P(D|g) for each sample and sum phread likelihoods across all samples to create lk
+    for (j = 0; j < ma->n; ++j) {
+        // Fetch the PL array for the sample
+        const int *pi = ma->PL + j * ma->PL_len;
+        // Fetch the P(D|g) array for the sample
+        double *pdg = ma->pdg + j * 3;
+        pdg[0] = ma->q2p[pi[2]]; pdg[1] = ma->q2p[pi[1]]; pdg[2] = ma->q2p[pi[0]];
+        for (i = 0; i < b->n_allele; ++i)
+            p[i] += (int)pi[(i+1)*(i+2)/2-1];
+    }
+    for (i = 0; i < b->n_allele; ++i) p[i] = p[i]<<4 | i;
+    for (i = 1; i < b->n_allele; ++i) // insertion sort
+        for (j = i; j > 0 && p[j] < p[j-1]; --j)
+            tmp = p[j], p[j] = p[j-1], p[j-1] = tmp;
+    for (i = b->n_allele - 1; i >= 0; --i)
+        if ((p[i]&0xf) == 0) break;
+    return i;
+}
+
+
+/* f0 is minor allele fraction */
+int bcf_p1_call_gt(const bcf_p1aux_t *ma, double f0, int k)
+{
+    double sum, g[3];
+    double max, f3[3], *pdg = ma->pdg + k * 3;
+    int q, i, max_i, ploidy;
+    /* determine ploidy */
+    ploidy = ma->ploidy? ma->ploidy[k] : 2;
+    if (ploidy == 2) {
+    /* given allele frequency we can determine how many of each
+     * genotype we have by HWE p=1-q PP=p^2 PQ&QP=2*p*q QQ=q^2 */
+        f3[0] = (1.-f0)*(1.-f0); f3[1] = 2.*f0*(1.-f0); f3[2] = f0*f0;
+    } else {
+        f3[0] = 1. - f0; f3[1] = 0; f3[2] = f0;
+    }
+    for (i = 0, sum = 0.; i < 3; ++i)
+        sum += (g[i] = pdg[i] * f3[i]);
+    /* normalise g and then determine max */
+    for (i = 0, max = -1., max_i = 0; i < 3; ++i) {
+        g[i] /= sum;
+        if (g[i] > max) max = g[i], max_i = i;
+    }
+    max = 1. - max;
+    if (max < 1e-308) max = 1e-308;
+    q = (int)(-4.343 * log(max) + .499);
+    if (q > 99) q = 99;
+    return q<<2|max_i;
+}
+
+// If likelihoods fall below this they get squashed to 0
+#define TINY 1e-20
+static void mc_cal_y_core(bcf_p1aux_t *ma, int beg)
+{
+    double *z[2], *tmp, *pdg;
+    int _j, last_min, last_max;
+    assert(beg == 0 || ma->M == ma->n*2);
+    z[0] = ma->z;
+    z[1] = ma->zswap;
+    pdg = ma->pdg;
+    memset(z[0], 0, sizeof(double) * (ma->M + 1));
+    memset(z[1], 0, sizeof(double) * (ma->M + 1));
+    z[0][0] = 1.;
+    last_min = last_max = 0;
+    ma->t = 0.;
+    if (ma->M == ma->n * 2) {
+        int M = 0;
+        for (_j = beg; _j < ma->n; ++_j) {
+            int k, j = _j - beg, _min = last_min, _max = last_max, M0;
+            double p[3], sum;
+            M0 = M; M += 2;
+            // Fetch P(D|g) for this sample
+            pdg = ma->pdg + _j * 3;
+            p[0] = pdg[0]; p[1] = 2. * pdg[1]; p[2] = pdg[2];
+            for (; _min < _max && z[0][_min] < TINY; ++_min) z[0][_min] = z[1][_min] = 0.;
+            for (; _max > _min && z[0][_max] < TINY; --_max) z[0][_max] = z[1][_max] = 0.;
+            _max += 2;
+            if (_min == 0) k = 0, z[1][k] = (M0-k+1) * (M0-k+2) * p[0] * z[0][k];
+            if (_min <= 1) k = 1, z[1][k] = (M0-k+1) * (M0-k+2) * p[0] * z[0][k] + k*(M0-k+2) * p[1] * z[0][k-1];
+            for (k = _min < 2? 2 : _min; k <= _max; ++k)
+                z[1][k] = (M0-k+1)*(M0-k+2) * p[0] * z[0][k] + k*(M0-k+2) * p[1] * z[0][k-1] + k*(k-1)* p[2] * z[0][k-2];
+            for (k = _min, sum = 0.; k <= _max; ++k) sum += z[1][k];
+            ma->t += log(sum / (M * (M - 1.)));
+            for (k = _min; k <= _max; ++k) z[1][k] /= sum;
+            if (_min >= 1) z[1][_min-1] = 0.;
+            if (_min >= 2) z[1][_min-2] = 0.;
+            // If we are not on the last sample
+            if (j < ma->n - 1) z[1][_max+1] = z[1][_max+2] = 0.;
+            if (_j == ma->n1 - 1) { // set pop1; ma->n1==-1 when unset
+                ma->t1 = ma->t;
+                memcpy(ma->z1, z[1], sizeof(double) * (ma->n1 * 2 + 1));
+            }
+            tmp = z[0]; z[0] = z[1]; z[1] = tmp;
+            last_min = _min; last_max = _max;
+        }
+        //for (_j = 0; _j < last_min; ++_j) z[0][_j] = 0.; // TODO: are these necessary?
+        //for (_j = last_max + 1; _j < ma->M; ++_j) z[0][_j] = 0.;
+    } else { // this block is very similar to the block above; these two might be merged in future
+        int j, M = 0;
+        for (j = 0; j < ma->n; ++j) {
+            int k, M0, _min = last_min, _max = last_max;
+            double p[3], sum;
+            // Fetch P(D|g) for this sample
+            pdg = ma->pdg + j * 3;
+            for (; _min < _max && z[0][_min] < TINY; ++_min) z[0][_min] = z[1][_min] = 0.;
+            for (; _max > _min && z[0][_max] < TINY; --_max) z[0][_max] = z[1][_max] = 0.;
+            M0 = M;
+            M += ma->ploidy[j];
+            if (ma->ploidy[j] == 1) {
+                p[0] = pdg[0]; p[1] = pdg[2];
+                _max++;
+                if (_min == 0) k = 0, z[1][k] = (M0+1-k) * p[0] * z[0][k];
+                for (k = _min < 1? 1 : _min; k <= _max; ++k)
+                    z[1][k] = (M0+1-k) * p[0] * z[0][k] + k * p[1] * z[0][k-1];
+                for (k = _min, sum = 0.; k <= _max; ++k) sum += z[1][k];
+                ma->t += log(sum / M);
+                for (k = _min; k <= _max; ++k) z[1][k] /= sum;
+                if (_min >= 1) z[1][_min-1] = 0.;
+                // If we are not on the last sample
+                if (j < ma->n - 1) z[1][_max+1] = 0.;
+            } else if (ma->ploidy[j] == 2) {
+                p[0] = pdg[0]; p[1] = 2 * pdg[1]; p[2] = pdg[2];
+                _max += 2;
+                if (_min == 0) k = 0, z[1][k] = (M0-k+1) * (M0-k+2) * p[0] * z[0][k];
+                if (_min <= 1) k = 1, z[1][k] = (M0-k+1) * (M0-k+2) * p[0] * z[0][k] + k*(M0-k+2) * p[1] * z[0][k-1];
+                for (k = _min < 2? 2 : _min; k <= _max; ++k)
+                    z[1][k] = (M0-k+1)*(M0-k+2) * p[0] * z[0][k] + k*(M0-k+2) * p[1] * z[0][k-1] + k*(k-1)* p[2] * z[0][k-2];
+                for (k = _min, sum = 0.; k <= _max; ++k) sum += z[1][k];
+                ma->t += log(sum / (M * (M - 1.)));
+                for (k = _min; k <= _max; ++k) z[1][k] /= sum;
+                if (_min >= 1) z[1][_min-1] = 0.;
+                if (_min >= 2) z[1][_min-2] = 0.;
+                // If we are not on the last sample
+                if (j < ma->n - 1) z[1][_max+1] = z[1][_max+2] = 0.;
+            }
+            tmp = z[0]; z[0] = z[1]; z[1] = tmp;
+            last_min = _min; last_max = _max;
+        }
+    }
+    if (z[0] != ma->z) memcpy(ma->z, z[0], sizeof(double) * (ma->M + 1));
+    if (bcf_p1_fp_lk)
+        gzwrite(bcf_p1_fp_lk, ma->z, sizeof(double) * (ma->M + 1));
+}
+
+static void mc_cal_y(bcf_p1aux_t *ma)
+{
+    if (ma->n1 > 0 && ma->n1 < ma->n && ma->M == ma->n * 2) { // NB: ma->n1 is ineffective when there are haploid samples
+        int k;
+        long double x;
+        memset(ma->z1, 0, sizeof(double) * (2 * ma->n1 + 1));
+        memset(ma->z2, 0, sizeof(double) * (2 * (ma->n - ma->n1) + 1));
+        ma->t1 = ma->t2 = 0.;
+        mc_cal_y_core(ma, ma->n1);
+        ma->t2 = ma->t;
+        memcpy(ma->z2, ma->z, sizeof(double) * (2 * (ma->n - ma->n1) + 1));
+        mc_cal_y_core(ma, 0);
+        // rescale z
+        x = expl(ma->t - (ma->t1 + ma->t2));
+        for (k = 0; k <= ma->M; ++k) ma->z[k] *= x;
+    } else mc_cal_y_core(ma, 0);
+}
+
+#define CONTRAST_TINY 1e-30
+
+extern double kf_gammaq(double s, double z); // incomplete gamma function for chi^2 test
+
+static inline double chi2_test(int a, int b, int c, int d)
+{
+    double x, z;
+    x = (double)(a+b) * (c+d) * (b+d) * (a+c);
+    if (x == 0.) return 1;
+    z = a * d - b * c;
+    return kf_gammaq(.5, .5 * z * z * (a+b+c+d) / x);
+}
+
+// chi2=(a+b+c+d)(ad-bc)^2/[(a+b)(c+d)(a+c)(b+d)]
+static inline double contrast2_aux(const bcf_p1aux_t *p1, double sum, int k1, int k2, double x[3])
+{
+    double p = p1->phi[k1+k2] * p1->z1[k1] * p1->z2[k2] / sum * p1->hg[k1][k2];
+    int n1 = p1->n1, n2 = p1->n - p1->n1;
+    if (p < CONTRAST_TINY) return -1;
+    if (.5*k1/n1 < .5*k2/n2) x[1] += p;
+    else if (.5*k1/n1 > .5*k2/n2) x[2] += p;
+    else x[0] += p;
+    return p * chi2_test(k1, k2, (n1<<1) - k1, (n2<<1) - k2);
+}
+
+static double contrast2(bcf_p1aux_t *p1, double ret[3])
+{
+    int k, k1, k2, k10, k20, n1, n2;
+    double sum;
+    // get n1 and n2
+    n1 = p1->n1; n2 = p1->n - p1->n1;
+    if (n1 <= 0 || n2 <= 0) return 0.;
+    if (p1->hg == 0) { // initialize the hypergeometric distribution
+        /* NB: the hg matrix may take a lot of memory when there are many samples. There is a way
+           to avoid precomputing this matrix, but it is slower and quite intricate. The following
+           computation in this block can be accelerated with a similar strategy, but perhaps this
+           is not a serious concern for now. */
+        double tmp = lgamma(2*(n1+n2)+1) - (lgamma(2*n1+1) + lgamma(2*n2+1));
+        p1->hg = (double**) calloc(2*n1+1, sizeof(double*));
+        for (k1 = 0; k1 <= 2*n1; ++k1) {
+            p1->hg[k1] = (double*)calloc(2*n2+1, sizeof(double));
+            for (k2 = 0; k2 <= 2*n2; ++k2)
+                p1->hg[k1][k2] = exp(lgamma(k1+k2+1) + lgamma(p1->M-k1-k2+1) - (lgamma(k1+1) + lgamma(k2+1) + lgamma(2*n1-k1+1) + lgamma(2*n2-k2+1) + tmp));
+        }
+    }
+    { // compute
+        long double suml = 0;
+        for (k = 0; k <= p1->M; ++k) suml += p1->phi[k] * p1->z[k];
+        sum = suml;
+    }
+    { // get the max k1 and k2
+        double max;
+        int max_k;
+        for (k = 0, max = 0, max_k = -1; k <= 2*n1; ++k) {
+            double x = p1->phi1[k] * p1->z1[k];
+            if (x > max) max = x, max_k = k;
+        }
+        k10 = max_k;
+        for (k = 0, max = 0, max_k = -1; k <= 2*n2; ++k) {
+            double x = p1->phi2[k] * p1->z2[k];
+            if (x > max) max = x, max_k = k;
+        }
+        k20 = max_k;
+    }
+    { // We can do the following with one nested loop, but that is an O(N^2) thing. The following code block is much faster for large N.
+        double x[3], y;
+        long double z = 0., L[2];
+        x[0] = x[1] = x[2] = 0; L[0] = L[1] = 0;
+        for (k1 = k10; k1 >= 0; --k1) {
+            for (k2 = k20; k2 >= 0; --k2) {
+                if ((y = contrast2_aux(p1, sum, k1, k2, x)) < 0) break;
+                else z += y;
+            }
+            for (k2 = k20 + 1; k2 <= 2*n2; ++k2) {
+                if ((y = contrast2_aux(p1, sum, k1, k2, x)) < 0) break;
+                else z += y;
+            }
+        }
+        ret[0] = x[0]; ret[1] = x[1]; ret[2] = x[2];
+        x[0] = x[1] = x[2] = 0;
+        for (k1 = k10 + 1; k1 <= 2*n1; ++k1) {
+            for (k2 = k20; k2 >= 0; --k2) {
+                if ((y = contrast2_aux(p1, sum, k1, k2, x)) < 0) break;
+                else z += y;
+            }
+            for (k2 = k20 + 1; k2 <= 2*n2; ++k2) {
+                if ((y = contrast2_aux(p1, sum, k1, k2, x)) < 0) break;
+                else z += y;
+            }
+        }
+        ret[0] += x[0]; ret[1] += x[1]; ret[2] += x[2];
+        if (ret[0] + ret[1] + ret[2] < 0.95) { // in case of bad things happened
+            ret[0] = ret[1] = ret[2] = 0; L[0] = L[1] = 0;
+            for (k1 = 0, z = 0.; k1 <= 2*n1; ++k1)
+                for (k2 = 0; k2 <= 2*n2; ++k2)
+                    if ((y = contrast2_aux(p1, sum, k1, k2, ret)) >= 0) z += y;
+            if (ret[0] + ret[1] + ret[2] < 0.95) // It seems that this may be caused by floating point errors. I do not really understand why...
+                z = 1.0, ret[0] = ret[1] = ret[2] = 1./3;
+        }
+        return (double)z;
+    }
+}
+
+static double mc_cal_afs(bcf_p1aux_t *ma, double *p_ref_folded, double *p_var_folded)
+{
+    int k;
+    long double sum = 0., sum2;
+    double *phi = ma->is_indel? ma->phi_indel : ma->phi;
+    memset(ma->afs1, 0, sizeof(double) * (ma->M + 1));
+    mc_cal_y(ma);
+    // compute AFS
+    // MP15: is this using equation 20 from doi:10.1093/bioinformatics/btr509?
+    for (k = 0, sum = 0.; k <= ma->M; ++k)
+        sum += (long double)phi[k] * ma->z[k];
+    for (k = 0; k <= ma->M; ++k) {
+        ma->afs1[k] = phi[k] * ma->z[k] / sum;
+        if (isnan(ma->afs1[k]) || isinf(ma->afs1[k])) return -1.;
+    }
+    // compute folded variant probability
+    for (k = 0, sum = 0.; k <= ma->M; ++k)
+        sum += (long double)(phi[k] + phi[ma->M - k]) / 2. * ma->z[k];
+    for (k = 1, sum2 = 0.; k < ma->M; ++k)
+        sum2 += (long double)(phi[k] + phi[ma->M - k]) / 2. * ma->z[k];
+    *p_var_folded = sum2 / sum;
+    *p_ref_folded = (phi[k] + phi[ma->M - k]) / 2. * (ma->z[ma->M] + ma->z[0]) / sum;
+    // the expected frequency
+    for (k = 0, sum = 0.; k <= ma->M; ++k) {
+        ma->afs[k] += ma->afs1[k];
+        sum += k * ma->afs1[k];
+    }
+    return sum / ma->M;
+}
+
+int bcf_p1_cal(call_t *call, bcf1_t *b, int do_contrast, bcf_p1aux_t *ma, bcf_p1rst_t *rst)
+{
+    int i, k;
+    long double sum = 0.;
+    ma->is_indel = bcf_is_snp(b) ? 0 : 1;
+    rst->perm_rank = -1;
+
+    ma->PL = call->PLs;
+    ma->PL_len = call->nPLs / b->n_sample;
+    if (b->n_allele < 2) return -1; // FIXME: find a better solution
+
+    rst->rank0 = cal_pdg(b, ma);
+    rst->f_exp = mc_cal_afs(ma, &rst->p_ref_folded, &rst->p_var_folded);
+    rst->p_ref = ma->afs1[ma->M];
+    for (k = 0, sum = 0.; k < ma->M; ++k)
+        sum += ma->afs1[k];
+    rst->p_var = (double)sum;
+    { // compute the allele count
+        double max = -1;
+        rst->ac = -1;
+        for (k = 0; k <= ma->M; ++k)
+            if (max < ma->z[k]) max = ma->z[k], rst->ac = k;
+        rst->ac = ma->M - rst->ac;
+    }
+    // calculate f_flat and f_em
+    for (k = 0, sum = 0.; k <= ma->M; ++k)
+        sum += (long double)ma->z[k];
+    rst->f_flat = 0.;
+    for (k = 0; k <= ma->M; ++k) {
+        double p = ma->z[k] / sum;
+        rst->f_flat += k * p;
+    }
+    rst->f_flat /= ma->M;
+    { // estimate equal-tail credible interval (95% level)
+        int l, h;
+        double p;
+        for (i = 0, p = 0.; i <= ma->M; ++i)
+            if (p + ma->afs1[i] > 0.025) break;
+            else p += ma->afs1[i];
+        l = i;
+        for (i = ma->M, p = 0.; i >= 0; --i)
+            if (p + ma->afs1[i] > 0.025) break;
+            else p += ma->afs1[i];
+        h = i;
+        rst->cil = (double)(ma->M - h) / ma->M; rst->cih = (double)(ma->M - l) / ma->M;
+    }
+    if (ma->n1 > 0) { // compute LRT
+        double max0, max1, max2;
+        for (k = 0, max0 = -1; k <= ma->M; ++k)
+            if (max0 < ma->z[k]) max0 = ma->z[k];
+        for (k = 0, max1 = -1; k <= ma->n1 * 2; ++k)
+            if (max1 < ma->z1[k]) max1 = ma->z1[k];
+        for (k = 0, max2 = -1; k <= ma->M - ma->n1 * 2; ++k)
+            if (max2 < ma->z2[k]) max2 = ma->z2[k];
+        rst->lrt = log(max1 * max2 / max0);
+        rst->lrt = rst->lrt < 0? 1 : kf_gammaq(.5, rst->lrt);
+    } else rst->lrt = -1.0;
+    rst->cmp[0] = rst->cmp[1] = rst->cmp[2] = rst->p_chi2 = -1.0;
+    if (do_contrast && rst->p_var > 0.5) // skip contrast2() if the locus is a strong non-variant
+        rst->p_chi2 = contrast2(ma, rst->cmp);
+    return 0;
+}
+
+void bcf_p1_dump_afs(bcf_p1aux_t *ma)
+{
+    int k;
+    fprintf(stderr, "[afs]");
+    for (k = 0; k <= ma->M; ++k)
+        fprintf(stderr, " %d:%.3lf", k, ma->afs[ma->M - k]);
+    fprintf(stderr, "\n");
+    memset(ma->afs, 0, sizeof(double) * (ma->M + 1));
+}
diff --git a/prob1.h b/prob1.h
new file mode 100644
index 0000000..1594d3f
--- /dev/null
+++ b/prob1.h
@@ -0,0 +1,93 @@
+/*  prob1.h -- mathematical utility functions.
+
+    Copyright (C) 2010, 2011 Broad Institute.
+    Copyright (C) 2012, 2013 Genome Research Ltd.
+
+    Author: Heng Li <lh3 at sanger.ac.uk>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.  */
+
+#ifndef BCF_PROB1_H
+#define BCF_PROB1_H
+
+#include <htslib/vcf.h>
+#include "call.h"
+
+typedef struct {
+    int n; // Number of samples
+    int M; // Total number of chromosomes across all samples (n*2 if all samples are diploid)
+    int n1;
+    int is_indel;
+    uint8_t *ploidy; // haploid or diploid ONLY
+    double *q2p, *pdg; // q2p maps from phread scaled to real likelihood, pdg -> P(D|g)
+    double *phi; // Probability of seeing k reference alleles
+    double *phi_indel;
+    double *z, *zswap; // aux for afs
+    double *z1, *z2, *phi1, *phi2; // only calculated when n1 is set
+    double **hg; // hypergeometric distribution
+    double *lf; // log factorial
+    double t, t1, t2;
+    double *afs, *afs1; // afs: accumulative allele frequency spectrum (AFS); afs1: site posterior distribution
+    const int *PL; // point to PL
+    int PL_len;
+    int cons_llr;       // pair and trio calling
+    int64_t cons_gt;
+} bcf_p1aux_t;
+
+typedef struct {
+    int rank0, perm_rank; // NB: perm_rank is always set to -1 by bcf_p1_cal()
+    int ac; // ML alternative allele count
+    double f_exp, f_flat, p_ref_folded, p_ref, p_var_folded, p_var;
+    double cil, cih;
+    double cmp[3], p_chi2, lrt; // used by contrast2()
+} bcf_p1rst_t;
+
+typedef struct {
+    double p[4];
+    double edb, mqb, bqb;   // end distance bias, mapQ bias, baseQ bias
+    int mq, depth, is_tested, d[4];
+} anno16_t;
+
+#define MC_PTYPE_FULL  1
+#define MC_PTYPE_COND2 2
+#define MC_PTYPE_FLAT  3
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+    bcf_p1aux_t *bcf_p1_init(int n_smpl, uint8_t *ploidy);
+    void bcf_p1_init_prior(bcf_p1aux_t *ma, int type, double theta);
+    void bcf_p1_init_subprior(bcf_p1aux_t *ma, int type, double theta);
+    void bcf_p1_destroy(bcf_p1aux_t *ma);
+    void bcf_p1_set_ploidy(bcf1_t *b, bcf_p1aux_t *ma);
+    int bcf_p1_cal(call_t *call, bcf1_t *b, int do_contrast, bcf_p1aux_t *ma, bcf_p1rst_t *rst);
+    int bcf_p1_call_gt(const bcf_p1aux_t *ma, double f0, int k);
+    void bcf_p1_dump_afs(bcf_p1aux_t *ma);
+    int bcf_p1_read_prior(bcf_p1aux_t *ma, const char *fn);
+    int bcf_p1_set_n1(bcf_p1aux_t *b, int n1);
+    void bcf_p1_set_folded(bcf_p1aux_t *p1a); // only effective when set_n1() is not called
+
+    int bcf_em1(call_t *call, const bcf1_t *b, int n1, int flag, double x[10]);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/rbuf.h b/rbuf.h
new file mode 100644
index 0000000..89ff9aa
--- /dev/null
+++ b/rbuf.h
@@ -0,0 +1,196 @@
+/*  rbuf.h -- round buffers.
+
+    Copyright (C) 2013-2014 Genome Research Ltd.
+
+    Author: Petr Danecek <pd3 at sanger.ac.uk>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.  */
+
+#ifndef __RBUF_H__
+#define __RBUF_H__
+
+#include <string.h>
+
+typedef struct
+{
+    int m,n,f;    // m: allocated size, n: number of elements in the buffer, f: first element
+}
+rbuf_t;
+
+/**
+ *  rbuf_init() - initialize round buffer
+ *  @rbuf:  the rbuf_t holder
+ *  @size:  the maximum number of elements
+ *
+ */
+static inline void rbuf_init(rbuf_t *rbuf, int size)
+{
+    rbuf->m = size; rbuf->n = rbuf->f = 0;
+}
+/**
+ *  rbuf_kth() - get index of the k-th element of the round buffer
+ *  @rbuf:  the rbuf_t holder
+ *  @k:     0-based index
+ */
+static inline int rbuf_kth(rbuf_t *rbuf, int k)
+{
+    if ( k >= rbuf->n || k<0 ) return -1;
+    int i = k + rbuf->f;
+    if ( i >= rbuf->m ) i -= rbuf->m;
+    return i;
+}
+/**
+ *  rbuf_last() - get index of the last element of the round buffer
+ *  @rbuf:  the rbuf_t holder
+ *
+ */
+#define rbuf_last(rbuf) rbuf_kth(rbuf, (rbuf)->n - 1)
+
+/**
+ *  rbuf_next() - get index of the next element in the round buffer
+ *  @rbuf:  the rbuf_t holder
+ *  @i:     pointer to the last rbuf index. Set to -1 before the first call.
+ *
+ *  Sets i to the next position in the buffer. The return value indicates if
+ *  the position points to a valid element (1) or if there are no more elements
+ *  after *i (0). When the end is reached, *i is set to the first element in the
+ *  buffer.
+ */
+static inline int rbuf_next(rbuf_t *rbuf, int *i)
+{
+    if ( !rbuf->n ) return 0;
+    if ( *i==-1 ) { *i = rbuf->f; return 1; }
+    int n = (rbuf->f <= *i) ? *i - rbuf->f + 1 : *i + rbuf->m - rbuf->f + 1;
+    if ( ++(*i) >= rbuf->m ) *i = 0;
+    if ( n < rbuf->n ) return 1;
+    *i = rbuf->f;
+    return 0;
+}
+/**
+ *  rbuf_prev() - get index of the previous element in the round buffer
+ *  @rbuf:  the rbuf_t holder
+ *  @i:     pointer to the last rbuf index. Set to -1 before the first call.
+ *
+ *  Sets i to the previous position in the buffer. The return value indicates if
+ *  the position points to a valid element (1) or if there are no more elements
+ *  before *i (0).
+ */
+static inline int rbuf_prev(rbuf_t *rbuf, int *i)
+{
+    if ( !rbuf->n || *i==rbuf->f ) return 0;
+    if ( *i==-1 )
+    {
+        *i = rbuf_last(rbuf);
+        return 1;
+    }
+    if ( --(*i) < 0 ) *i = rbuf->m - 1;
+    return 1;
+}
+/**
+ *  rbuf_prepend() - register new element at the start of the round buffer
+ *  @rbuf:  the rbuf_t holder
+ *
+ *  Returns index of the newly inserted element.
+ */
+static inline int rbuf_prepend(rbuf_t *rbuf)
+{
+    if ( rbuf->n < rbuf->m ) rbuf->n++;
+
+    rbuf->f = rbuf->f > 0 ? rbuf->f - 1 : rbuf->m - 1;
+    return rbuf->f;
+}
+/**
+ *  rbuf_append() - register new element at the end of the round buffer
+ *  @rbuf:  the rbuf_t holder
+ *
+ *  Returns index of the newly inserted element.
+ */
+static inline int rbuf_append(rbuf_t *rbuf)
+{
+    if ( rbuf->n < rbuf->m )
+    {
+        rbuf->n++;
+        int i = rbuf->f + rbuf->n;
+        return i <= rbuf->m ? i - 1 : i - rbuf->m - 1;
+    }
+
+    rbuf->f++;
+    if ( rbuf->f >= rbuf->m )
+    {
+        rbuf->f = 0;
+        return rbuf->m - 1;
+    }
+    return rbuf->f - 1;
+}
+/**
+ *  rbuf_shift() - removes first element from the buffer
+ *  @rbuf:  the rbuf_t holder
+ *
+ *  Returns index of the removed element.
+ */
+static inline int rbuf_shift(rbuf_t *rbuf)
+{
+    if ( !rbuf->n ) return -1;
+    int ret = rbuf->f;
+    rbuf->f++;
+    if ( rbuf->f >= rbuf->m ) rbuf->f = 0;
+    rbuf->n--;
+    return ret;
+}
+/**
+ *  rbuf_shift_n() - removes first n elements from the buffer
+ *  @rbuf:  the rbuf_t holder
+ *  @n:     number of elements to remove
+ */
+static inline void rbuf_shift_n(rbuf_t *rbuf, int n)
+{
+    if ( n >= rbuf->n )
+    {
+        rbuf->n = rbuf->f = 0;
+        return;
+    }
+    rbuf->n -= n;
+    rbuf->f += n;
+    if ( rbuf->f >= rbuf->m ) rbuf->f -= rbuf->m;
+}
+
+/**
+ *  rbuf_expand0() - expand round buffer and set the newly allocated elements to 0
+ *  @rbuf:      the rbuf holder
+ *  @type_t:    data type
+ *  @data:      data array to be realloced
+ *
+ *  Note: The new array is linearized and leaves the rbuf.f offset untouched,
+ *  thus the size of the new buffer is determined by the current position.
+ */
+#define rbuf_expand0(rbuf,type_t,data) { \
+    int m = (rbuf)->m + (rbuf)->f + 1; \
+    m--, m|=m>>1, m|=m>>2, m|=m>>4, m|=m>>8, m|=m>>16, m++; /* kroundup32 */ \
+    data = (type_t*) realloc(data, sizeof(type_t)*m); \
+    type_t *ptr = data; \
+    memset(ptr+(rbuf)->m,0,sizeof(type_t)*(m-(rbuf)->m)); \
+    if ( (rbuf)->f ) \
+    { \
+        memcpy(ptr+(rbuf)->m,ptr,sizeof(type_t)*(rbuf)->f); \
+        memset(ptr,0,sizeof(type_t)*(rbuf)->f); \
+    } \
+    (rbuf)->m = m; \
+}
+
+#endif
diff --git a/reheader.c b/reheader.c
new file mode 100644
index 0000000..f325188
--- /dev/null
+++ b/reheader.c
@@ -0,0 +1,505 @@
+/*  reheader.c -- reheader subcommand.
+
+    Copyright (C) 2014 Genome Research Ltd.
+
+    Author: Petr Danecek <pd3 at sanger.ac.uk>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.  */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <getopt.h>
+#include <ctype.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#include <math.h>
+#include <htslib/vcf.h>
+#include <htslib/bgzf.h>
+#include <htslib/kseq.h>
+#include "bcftools.h"
+#include "khash_str2str.h"
+
+typedef struct _args_t
+{
+    char **argv, *fname, *samples_fname, *header_fname, *output_fname;
+    htsFile *fp;
+    htsFormat type;
+    int argc;
+}
+args_t;
+
+static void read_header_file(char *fname, kstring_t *hdr)
+{
+    kstring_t tmp = {0,0,0};
+    hdr->l = 0;
+
+    htsFile *fp = hts_open(fname, "r");
+    if ( !fp ) error("Could not read: %s\n", fname);
+    while ( hts_getline(fp, KS_SEP_LINE, &tmp) > 0 )
+    {
+        kputsn(tmp.s,tmp.l,hdr);
+        kputc('\n',hdr);
+    }
+    if ( hts_close(fp) ) error("Close failed: %s\n", fname);
+    free(tmp.s);
+
+    while ( hdr->l>0 && isspace(hdr->s[hdr->l-1]) ) hdr->l--;  // remove trailing newlines
+    kputc('\n',hdr);
+}
+
+static int set_sample_pairs(char **samples, int nsamples, kstring_t *hdr, int idx)
+{
+    int i, j, n;
+
+    // Are these samples "old-name new-name" pairs?
+    void *hash = khash_str2str_init();
+    for (i=0; i<nsamples; i++)
+    {
+        char *key, *value;
+        key = value = samples[i];
+        while ( *value && !isspace(*value) ) value++;
+        if ( !*value ) break;
+        *value = 0; value++;
+        while ( isspace(*value) ) value++;
+        khash_str2str_set(hash,key,value);
+    }
+    if ( i!=nsamples )  // not "old-name new-name" pairs
+    {
+        khash_str2str_destroy(hash);
+        return 0;
+    }
+
+    while ( hdr->l>0 && isspace(hdr->s[hdr->l-1]) ) hdr->l--;  // remove trailing newlines
+    hdr->s[hdr->l] = 0;
+
+    kstring_t tmp = {0,0,0};
+    i = j = n = 0;
+    while ( hdr->s[idx+i] && hdr->s[idx+i])
+    {
+        if ( hdr->s[idx+i]=='\t' )
+        {
+            hdr->s[idx+i] = 0;
+
+            if ( ++n>9 )
+            {
+                char *ori = khash_str2str_get(hash,hdr->s+idx+j);
+                kputs(ori ? ori : hdr->s+idx+j, &tmp);
+            }
+            else
+                kputs(hdr->s+idx+j, &tmp);
+
+            kputc('\t',&tmp);
+
+            j = ++i;
+            continue;
+        }
+        i++;
+    }
+    char *ori = khash_str2str_get(hash,hdr->s+idx+j);
+    kputs(ori ? ori : hdr->s+idx+j, &tmp);
+
+    if ( hash ) khash_str2str_destroy(hash);
+
+    hdr->l = idx;
+    kputs(tmp.s, hdr);
+    kputc('\n', hdr);
+    free(tmp.s);
+
+    return 1;
+}
+
+static void set_samples(char **samples, int nsamples, kstring_t *hdr)
+{
+    // Find the beginning of the #CHROM line
+    int i = hdr->l - 2, ncols = 0;
+    while ( i>=0 && hdr->s[i]!='\n' )
+    {
+        if ( hdr->s[i]=='\t' ) ncols++;
+        i--;
+    }
+    if ( i<0 || strncmp(hdr->s+i+1,"#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT",45) ) error("Could not parse the header: %s\n", hdr->s);
+
+    // Are the samples "old-sample new-sample" pairs?
+    if ( set_sample_pairs(samples,nsamples,hdr, i+1) ) return;
+
+    // Replace all samples
+    if ( ncols!=nsamples+8 )
+        fprintf(stderr, "Warning: different number of samples: %d vs %d\n", nsamples,ncols-8);
+
+    ncols = 0;
+    while ( ncols!=9 )
+    {
+        i++;
+        if ( hdr->s[i]=='\t' ) ncols++;
+    }
+    hdr->l = i;
+
+    for (i=0; i<nsamples; i++)
+    {
+        kputc('\t', hdr);
+        kputs(samples[i], hdr);
+    }
+    kputc('\n', hdr);
+}
+
+BGZF *hts_get_bgzfp(htsFile *fp);
+static void reheader_vcf_gz(args_t *args)
+{
+    BGZF *fp = hts_get_bgzfp(args->fp);
+    if ( !fp || bgzf_read_block(fp) != 0 || !fp->block_length )
+        error("Failed to read %s: %s\n", args->fname, strerror(errno));
+
+    kstring_t hdr = {0,0,0};
+    char *buffer = (char*) fp->uncompressed_block;
+
+    // Read the header and find the position of the data block
+    if ( buffer[0]!='#' ) error("Could not parse the header, expected '#', found '%c'\n", buffer[0]);
+
+    int skip_until = 1;     // end of the header in the current uncompressed block
+    while (1)
+    {
+        if ( buffer[skip_until]=='\n' )
+        {
+            skip_until++;
+            if ( skip_until>=fp->block_length )
+            {
+                kputsn(buffer,skip_until,&hdr);
+                if ( bgzf_read_block(fp) != 0 || !fp->block_length ) error("FIXME: No body in the file: %s\n", args->fname);
+                skip_until = 0;
+            }
+            // The header has finished
+            if ( buffer[skip_until]!='#' )
+            {
+                kputsn(buffer,skip_until,&hdr);
+                break;
+            }
+        }
+        skip_until++;
+        if ( skip_until>=fp->block_length )
+        {
+            kputsn(buffer,fp->block_length,&hdr);
+            if (bgzf_read_block(fp) != 0 || !fp->block_length) error("FIXME: No body in the file: %s\n", args->fname);
+            skip_until = 0;
+        }
+    }
+
+    int nsamples = 0;
+    char **samples = NULL;
+    if ( args->samples_fname )
+        samples = hts_readlines(args->samples_fname, &nsamples);
+    if ( args->header_fname )
+    {
+        free(hdr.s); hdr.s = NULL; hdr.l = hdr.m = 0;
+        read_header_file(args->header_fname, &hdr);
+    }
+    if ( samples )
+    {
+        set_samples(samples, nsamples, &hdr);
+        int i;
+        for (i=0; i<nsamples; i++) free(samples[i]);
+        free(samples);
+    }
+
+    // Output the modified header
+    BGZF *bgzf_out;
+    if ( args->output_fname )
+        bgzf_out = bgzf_open(args->output_fname,"w");
+    else
+        bgzf_out = bgzf_dopen(fileno(stdout), "w");
+    bgzf_write(bgzf_out, hdr.s, hdr.l);
+    free(hdr.s);
+
+    // Output all remainig data read with the header block
+    if ( fp->block_length - skip_until > 0 )
+    {
+        if ( bgzf_write(bgzf_out, buffer+skip_until, fp->block_length-skip_until)<0 ) error("Error: %d\n",fp->errcode);
+    }
+    if ( bgzf_flush(bgzf_out)<0 ) error("Error: %d\n",bgzf_out->errcode);
+
+    // Stream the rest of the file without as it is, without decompressing
+    ssize_t nread;
+    int page_size = getpagesize();
+    char *buf = (char*) valloc(page_size);
+    while (1)
+    {
+        nread = bgzf_raw_read(fp, buf, page_size);
+        if ( nread<=0 ) break;
+
+        int count = bgzf_raw_write(bgzf_out, buf, nread);
+        if (count != nread) error("Write failed, wrote %d instead of %d bytes.\n", count,(int)nread);
+    }
+    if (bgzf_close(bgzf_out) < 0) error("Error: %d\n",bgzf_out->errcode);
+    if (bgzf_close(fp) < 0) error("Error: %d\n",fp->errcode);
+    free(buf);
+}
+static void reheader_vcf(args_t *args)
+{
+    kstring_t hdr = {0,0,0};
+    htsFile *fp = args->fp;
+    while ( hts_getline(fp, KS_SEP_LINE, &fp->line) >=0 )
+    {
+        kputc('\n',&fp->line);  // hts_getline eats the newline character
+        if ( fp->line.s[0]!='#' ) break;
+        kputsn(fp->line.s,fp->line.l,&hdr);
+    }
+
+    int nsamples = 0;
+    char **samples = NULL;
+    if ( args->samples_fname )
+        samples = hts_readlines(args->samples_fname, &nsamples);
+    if ( args->header_fname )
+    {
+        free(hdr.s); hdr.s = NULL; hdr.l = hdr.m = 0;
+        read_header_file(args->header_fname, &hdr);
+    }
+    if ( samples )
+    {
+        set_samples(samples, nsamples, &hdr);
+        int i;
+        for (i=0; i<nsamples; i++) free(samples[i]);
+        free(samples);
+    }
+
+    int out = args->output_fname ? open(args->output_fname, O_WRONLY|O_CREAT|O_TRUNC, 0666) : STDOUT_FILENO;
+    if ( out==-1 ) error("%s: %s\n", args->output_fname,strerror(errno));
+    if ( write(out, hdr.s, hdr.l)!=hdr.l ) error("Failed to write %d bytes\n", hdr.l);
+    free(hdr.s);
+    if ( fp->line.l )
+    {
+        if ( write(out, fp->line.s, fp->line.l)!=fp->line.l ) error("Failed to write %d bytes\n", fp->line.l);
+    }
+    while ( hts_getline(fp, KS_SEP_LINE, &fp->line) >=0 )   // uncompressed file implies small size, we don't worry about speed
+    {
+        kputc('\n',&fp->line);
+        if ( write(out, fp->line.s, fp->line.l)!=fp->line.l ) error("Failed to write %d bytes\n", fp->line.l);
+    }
+    hts_close(fp);
+    close(out);
+}
+
+static bcf_hdr_t *strip_header(bcf_hdr_t *src, bcf_hdr_t *dst)
+{
+    bcf_hrec_t *src_hrec, *dst_hrec, *tmp;
+    bcf_hdr_t *out = bcf_hdr_init("r");
+    int i;
+    for (i=0; i<dst->nhrec; i++)
+    {
+        // first insert lines which do not code BCF ids, their order does not matter
+        dst_hrec = dst->hrec[i];
+        if ( dst_hrec->type==BCF_HL_FLT || dst_hrec->type==BCF_HL_INFO || dst_hrec->type==BCF_HL_FMT || dst_hrec->type== BCF_HL_CTG ) continue;
+        bcf_hdr_add_hrec(out, bcf_hrec_dup(dst_hrec));
+    }
+    for (i=0; i<src->nhrec; i++)
+    {
+        // now transfer header lines which define BCF ids
+        src_hrec = src->hrec[i];
+
+        if ( src_hrec->type==BCF_HL_FLT || src_hrec->type==BCF_HL_INFO || src_hrec->type==BCF_HL_FMT || src_hrec->type== BCF_HL_CTG )
+        {
+            int j = bcf_hrec_find_key(src_hrec, "ID");
+            dst_hrec = bcf_hdr_get_hrec(dst, src_hrec->type, "ID", src_hrec->vals[j], NULL);
+            if ( !dst_hrec ) continue;
+
+            tmp = bcf_hrec_dup(dst_hrec);
+
+            j = bcf_hrec_find_key(src_hrec, "IDX");
+            if ( j>=0 )
+            {
+                j = atoi(src_hrec->vals[j]);
+                hrec_add_idx(tmp, j);
+            }
+            bcf_hdr_add_hrec(out, tmp);
+        }
+    }
+    bcf_hdr_sync(out);
+    for (i=0; i<dst->nhrec; i++)
+    {
+        // finally add new structured fields
+        dst_hrec = dst->hrec[i];
+        if ( dst_hrec->type==BCF_HL_FLT || dst_hrec->type==BCF_HL_INFO || dst_hrec->type==BCF_HL_FMT || dst_hrec->type== BCF_HL_CTG )
+        {
+            int j = bcf_hrec_find_key(dst_hrec, "ID");
+            tmp = bcf_hdr_get_hrec(out, dst_hrec->type, "ID", dst_hrec->vals[j], NULL);
+            if ( !tmp )
+                bcf_hdr_add_hrec(out, bcf_hrec_dup(dst_hrec));
+        }
+    }
+    for (i=0; i<dst->n[BCF_DT_SAMPLE]; i++) bcf_hdr_add_sample(out, dst->samples[i]);
+    bcf_hdr_destroy(dst);
+    return out;
+}
+
+static void reheader_bcf(args_t *args, int is_compressed)
+{
+    htsFile *fp = args->fp;
+    bcf_hdr_t *hdr = bcf_hdr_read(fp); if ( !hdr ) error("Failed to read the header: %s\n", args->fname);
+    kstring_t htxt = {0,0,0};
+    int hlen;
+    htxt.s = bcf_hdr_fmt_text(hdr, 1, &hlen);
+    htxt.l = hlen;
+
+    int i, nsamples = 0;
+    char **samples = NULL;
+    if ( args->samples_fname )
+        samples = hts_readlines(args->samples_fname, &nsamples);
+    if ( args->header_fname )
+    {
+        free(htxt.s); htxt.s = NULL; htxt.l = htxt.m = 0;
+        read_header_file(args->header_fname, &htxt);
+    }
+    if ( samples )
+    {
+        set_samples(samples, nsamples, &htxt);
+        for (i=0; i<nsamples; i++) free(samples[i]);
+        free(samples);
+    }
+
+    bcf_hdr_t *hdr_out = bcf_hdr_init("r");
+    if ( bcf_hdr_parse(hdr_out, htxt.s) < 0 ) error("An error occurred while parsing the header\n");
+    if ( args->header_fname ) hdr_out = strip_header(hdr, hdr_out);
+
+    // write the header and the body
+    htsFile *fp_out = hts_open(args->output_fname ? args->output_fname : "-",is_compressed ? "wb" : "wbu");
+    if ( !fp_out ) error("%s: %s\n", args->output_fname ? args->output_fname : "-", strerror(errno));
+    bcf_hdr_write(fp_out, hdr_out);
+
+    bcf1_t *rec = bcf_init();
+    while ( bcf_read(fp, hdr, rec)==0 )
+    {
+        // sanity checking, this slows things down. Make it optional?
+        bcf_unpack(rec, BCF_UN_ALL);
+        if ( rec->rid >= hdr_out->n[BCF_DT_CTG] || strcmp(bcf_hdr_int2id(hdr,BCF_DT_CTG,rec->rid),bcf_hdr_int2id(hdr_out,BCF_DT_CTG,rec->rid)) )
+            error("The CHROM is not defined: \"%s\"\n", bcf_hdr_int2id(hdr,BCF_DT_CTG,rec->rid));
+
+        for (i=0; i<rec->d.n_flt; i++)
+        {
+            int id = rec->d.flt[i];
+            if ( id >= hdr_out->n[BCF_DT_ID] ) break;
+            if ( !bcf_hdr_idinfo_exists(hdr_out,BCF_HL_FLT,id) ) break;
+            if ( strcmp(hdr->id[BCF_DT_ID][id].key,hdr_out->id[BCF_DT_ID][id].key) )
+                error("FIXME: Broken FILTER ids: %s vs %s\n", hdr->id[BCF_DT_ID][id].key,hdr_out->id[BCF_DT_ID][id].key);
+        }
+        if ( i!=rec->d.n_flt )
+            error("The FILTER is not defined: \"%s\"\n", bcf_hdr_int2id(hdr,BCF_DT_ID,rec->d.flt[i]));
+
+        for (i=0; i<rec->n_info; i++)
+        {
+            int id = rec->d.info[i].key;
+            if ( id >= hdr_out->n[BCF_DT_ID] ) break;
+            if ( !hdr_out->id[BCF_DT_ID][id].key ) break;
+            if ( !bcf_hdr_idinfo_exists(hdr_out,BCF_HL_INFO,id) ) break;
+            if ( strcmp(hdr->id[BCF_DT_ID][id].key,hdr_out->id[BCF_DT_ID][id].key) )
+                error("FIXME: Broken INFO ids: %s vs %s\n", hdr->id[BCF_DT_ID][id].key,hdr_out->id[BCF_DT_ID][id].key);
+        }
+        if ( i!=rec->n_info )
+            error("The INFO tag is not defined: \"%s\"\n", bcf_hdr_int2id(hdr,BCF_DT_ID,rec->d.info[i].key));
+
+        for (i=0; i<rec->n_fmt; i++)
+        {
+            int id = rec->d.fmt[i].id;
+            if ( id >= hdr_out->n[BCF_DT_ID] ) break;
+            if ( !hdr_out->id[BCF_DT_ID][id].key ) break;
+            if ( !bcf_hdr_idinfo_exists(hdr_out,BCF_HL_FMT,id) ) break;
+            if ( strcmp(hdr->id[BCF_DT_ID][id].key,hdr_out->id[BCF_DT_ID][id].key) )
+                error("FIXME: Broken FORMAT ids: %s vs %s\n", hdr->id[BCF_DT_ID][id].key,hdr_out->id[BCF_DT_ID][id].key);
+        }
+        if ( i!=rec->n_fmt )
+            error("The FORMAT tag is not defined: \"%s\"\n", bcf_hdr_int2id(hdr,BCF_DT_ID,rec->d.fmt[i].id));
+
+        bcf_write(fp_out,hdr_out,rec);
+    }
+    bcf_destroy(rec);
+
+    free(htxt.s);
+    hts_close(fp_out);
+    hts_close(fp);
+    bcf_hdr_destroy(hdr_out);
+    bcf_hdr_destroy(hdr);
+}
+
+
+static void usage(args_t *args)
+{
+    fprintf(stderr, "\n");
+    fprintf(stderr, "About:   Modify header of VCF/BCF files, change sample names.\n");
+    fprintf(stderr, "Usage:   bcftools reheader [OPTIONS] <in.vcf.gz>\n");
+    fprintf(stderr, "\n");
+    fprintf(stderr, "Options:\n");
+    fprintf(stderr, "    -h, --header <file>     new header\n");
+    fprintf(stderr, "    -o, --output <file>     write output to a file [standard output]\n");
+    fprintf(stderr, "    -s, --samples <file>    new sample names\n");
+    fprintf(stderr, "\n");
+    exit(1);
+}
+
+int main_reheader(int argc, char *argv[])
+{
+    int c;
+    args_t *args  = (args_t*) calloc(1,sizeof(args_t));
+    args->argc    = argc; args->argv = argv;
+
+    static struct option loptions[] =
+    {
+        {"output",1,0,'o'},
+        {"header",1,0,'h'},
+        {"samples",1,0,'s'},
+        {0,0,0,0}
+    };
+    while ((c = getopt_long(argc, argv, "s:h:o:",loptions,NULL)) >= 0)
+    {
+        switch (c)
+        {
+            case 'o': args->output_fname = optarg; break;
+            case 's': args->samples_fname = optarg; break;
+            case 'h': args->header_fname = optarg; break;
+            case '?': usage(args);
+            default: error("Unknown argument: %s\n", optarg);
+        }
+    }
+
+    if ( optind>=argc )
+    {
+        if ( !isatty(fileno((FILE *)stdin)) ) args->fname = "-";  // reading from stdin
+        else usage(args);
+    }
+    else args->fname = argv[optind];
+
+    if ( !args->samples_fname && !args->header_fname ) usage(args);
+    if ( !args->fname ) usage(args);
+
+    args->fp = hts_open(args->fname,"r");
+    if ( !args->fp ) error("Failed to open: %s\n", args->fname);
+    args->type = *hts_get_format(args->fp);
+
+    if ( args->type.format==vcf )
+    {
+        if ( args->type.compression==bgzf || args->type.compression==gzip )
+            reheader_vcf_gz(args);
+        else
+            reheader_vcf(args);
+    }
+    else
+        reheader_bcf(args, args->type.compression==bgzf || args->type.compression==gzip);
+
+    free(args);
+    return 0;
+}
diff --git a/tabix.c b/tabix.c
new file mode 100644
index 0000000..2f24b92
--- /dev/null
+++ b/tabix.c
@@ -0,0 +1,129 @@
+/*  tabix.c -- tabix subcommand.
+
+    Copyright (C) 2012 Broad Institute.
+    Copyright (C) 2013 Genome Research Ltd.
+
+    Author: Heng Li <lh3 at sanger.ac.uk>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.  */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <htslib/bgzf.h>
+#include <htslib/tbx.h>
+
+int main_tabix(int argc, char *argv[])
+{
+    int c, min_shift = -1, is_force = 0, is_all = 0;
+    tbx_conf_t conf = tbx_conf_gff, *conf_ptr = NULL;
+    while ((c = getopt(argc, argv, "0fap:s:b:e:S:c:m:")) >= 0)
+        if (c == '0') conf.preset |= TBX_UCSC;
+        else if (c == 'f') is_force = 1;
+        else if (c == 'a') is_all = 1;
+        else if (c == 'm') min_shift = atoi(optarg);
+        else if (c == 's') conf.sc = atoi(optarg);
+        else if (c == 'b') conf.bc = atoi(optarg);
+        else if (c == 'e') conf.ec = atoi(optarg);
+        else if (c == 'c') conf.meta_char = *optarg;
+        else if (c == 'S') conf.line_skip = atoi(optarg);
+        else if (c == 'p') {
+            if (strcmp(optarg, "gff") == 0) conf_ptr = &tbx_conf_gff;
+            else if (strcmp(optarg, "bed") == 0) conf_ptr = &tbx_conf_bed;
+            else if (strcmp(optarg, "sam") == 0) conf_ptr = &tbx_conf_sam;
+            else if (strcmp(optarg, "vcf") == 0) conf_ptr = &tbx_conf_vcf;
+            else {
+                fprintf(stderr, "The type '%s' not recognised\n", optarg);
+                return 1;
+            }
+
+        }
+    if (optind == argc) {
+        fprintf(stderr, "\nUsage: bcftools tabix [options] <in.gz> [reg1 [...]]\n\n");
+        fprintf(stderr, "Options: -p STR    preset: gff, bed, sam or vcf [gff]\n");
+        fprintf(stderr, "         -s INT    column number for sequence names (suppressed by -p) [1]\n");
+        fprintf(stderr, "         -b INT    column number for region start [4]\n");
+        fprintf(stderr, "         -e INT    column number for region end (if no end, set INT to -b) [5]\n");
+        fprintf(stderr, "         -0        specify coordinates are zero-based\n");
+        fprintf(stderr, "         -S INT    skip first INT lines [0]\n");
+        fprintf(stderr, "         -c CHAR   skip lines starting with CHAR [null]\n");
+        fprintf(stderr, "         -a        print all records\n");
+        fprintf(stderr, "         -f        force to overwrite existing index\n");
+        fprintf(stderr, "         -m INT    set the minimal interval size to 1<<INT; 0 for the old tabix index [0]\n");
+        fprintf(stderr, "\n");
+        return 1;
+    }
+    if (is_all) { // read without random access
+        kstring_t s;
+        BGZF *fp;
+        s.l = s.m = 0; s.s = 0;
+        fp = bgzf_open(argv[optind], "r");
+        while (bgzf_getline(fp, '\n', &s) >= 0) puts(s.s);
+        bgzf_close(fp);
+        free(s.s);
+    } else if (optind + 2 > argc) { // create index
+        if ( !conf_ptr )
+        {
+            // auto-detect file type by file name
+            int l = strlen(argv[optind]);
+            int strcasecmp(const char *s1, const char *s2);
+            if (l>=7 && strcasecmp(argv[optind]+l-7, ".gff.gz") == 0) conf_ptr = &tbx_conf_gff;
+            else if (l>=7 && strcasecmp(argv[optind]+l-7, ".bed.gz") == 0) conf_ptr = &tbx_conf_bed;
+            else if (l>=7 && strcasecmp(argv[optind]+l-7, ".sam.gz") == 0) conf_ptr = &tbx_conf_sam;
+            else if (l>=7 && strcasecmp(argv[optind]+l-7, ".vcf.gz") == 0) conf_ptr = &tbx_conf_vcf;
+        }
+        if ( conf_ptr ) conf = *conf_ptr;
+
+        if (!is_force) {
+            char *fn;
+            FILE *fp;
+            fn = (char*)alloca(strlen(argv[optind]) + 5);
+            strcat(strcpy(fn, argv[optind]), min_shift <= 0? ".tbi" : ".csi");
+            if ((fp = fopen(fn, "rb")) != 0) {
+                fclose(fp);
+                fprintf(stderr, "[E::%s] the index file exists; use option '-f' to overwrite\n", __func__);
+                return 1;
+            }
+        }
+        if ( tbx_index_build(argv[optind], min_shift, &conf) )
+        {
+            fprintf(stderr,"tbx_index_build failed: Is the file bgzip-compressed? Was wrong -p [type] option used?\n");
+            return 1;
+        }
+    } else { // read with random access
+        tbx_t *tbx;
+        BGZF *fp;
+        kstring_t s;
+        int i;
+        if ((tbx = tbx_index_load(argv[optind])) == 0) return 1;
+        if ((fp = bgzf_open(argv[optind], "r")) == 0) return 1;
+        s.s = 0; s.l = s.m = 0;
+        for (i = optind + 1; i < argc; ++i) {
+            hts_itr_t *itr;
+            if ((itr = tbx_itr_querys(tbx, argv[i])) == 0) continue;
+            while (tbx_bgzf_itr_next(fp, tbx, itr, &s) >= 0) puts(s.s);
+            tbx_itr_destroy(itr);
+        }
+        free(s.s);
+        bgzf_close(fp);
+        tbx_destroy(tbx);
+    }
+    return 0;
+}
diff --git a/test/23andme.fa b/test/23andme.fa
new file mode 100644
index 0000000..8a917f6
--- /dev/null
+++ b/test/23andme.fa
@@ -0,0 +1,14 @@
+>1
+CACGTNACGGCTGAAGTCCAAGGTAC
+CGTATCGAGTTCACAGTCGATAGCTC
+GATCGATAGCATCGCTAGCNNNACTA
+CGATCGATCGCTCTCCGTAACACTCA
+AAAACGATCGATCGACTGCTCTTTAG
+CGATGACTTTAGGGGAAAAA
+>2
+CGCTCAGCCGTACAGCCGAGCAGGAC
+ACGCTATTTTAGATCGACTGGCTNNG
+CGCTAGCTACGCTTTAGCACGAGAA
+>Y
+NNNGCATACGTGTCCATCACGATGAT
+AGCGATGATCGATC
diff --git a/test/23andme.fa.fai b/test/23andme.fa.fai
new file mode 100644
index 0000000..6489fa3
--- /dev/null
+++ b/test/23andme.fa.fai
@@ -0,0 +1,3 @@
+1	150	3	26	27
+2	77	162	26	27
+Y	40	245	26	27
diff --git a/test/annotate.hdr b/test/annotate.hdr
new file mode 100644
index 0000000..c2cbf73
--- /dev/null
+++ b/test/annotate.hdr
@@ -0,0 +1,4 @@
+##INFO=<ID=T_STR,Number=1,Type=String,Description="Test String">
+##INFO=<ID=T_INT,Number=.,Type=Integer,Description="Test Integer">
+##INFO=<ID=T_FLOAT,Number=.,Type=Float,Description="Test Float">
+##INFO=<ID=INDEL,Number=0,Type=Float,Description="Test Flag">
diff --git a/test/annotate.out b/test/annotate.out
new file mode 100644
index 0000000..582318e
--- /dev/null
+++ b/test/annotate.out
@@ -0,0 +1,43 @@
+##fileformat=VCFv4.1
+##FILTER=<ID=PASS,Description="All filters passed">
+##INFO=<ID=TEST,Number=1,Type=Integer,Description="Testing Tag">
+##FORMAT=<ID=TT,Number=A,Type=Integer,Description="Testing Tag, with commas and \"escapes\" and escaped escapes combined with \\\"quotes\\\\\"">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=GL,Number=G,Type=Float,Description="Genotype Likelihood">
+##FILTER=<ID=q10,Description="Quality below 10">
+##FILTER=<ID=test,Description="Testing filter">
+##contig=<ID=1,assembly=b37,length=249250621>
+##contig=<ID=2,assembly=b37,length=249250621>
+##contig=<ID=3,assembly=b37,length=198022430>
+##contig=<ID=4,assembly=b37,length=191154276>
+##test=<ID=4,IE=5>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##readme=AAAAAA
+##readme=BBBBBB
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##INFO=<ID=STR,Number=1,Type=String,Description="Test string type">
+##INFO=<ID=T_STR,Number=1,Type=String,Description="Test String">
+##INFO=<ID=T_INT,Number=.,Type=Integer,Description="Test Integer">
+##INFO=<ID=T_FLOAT,Number=.,Type=Float,Description="Test Float">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B
+1	3000150	snp_3000150	C	T	999	PASS	AN=4;AC=2;T_INT=1,2;T_FLOAT=1e-10,2e-10	GT:GQ	0/1:245	0/1:245
+1	3000151	snp_3000151	C	T	999	PASS	AN=4;AC=2;T_INT=1;T_FLOAT=2e-10	GT:DP:GQ	0/1:32:245	0/1:32:245
+1	3062915	indel_3062915	GTTT	G	12.9	q10	DP4=1,2,3,4;AN=4;AC=2;INDEL;STR=test	GT:GQ:DP:GL	0/1:409:35:-20,-5,-20	0/1:409:35:-20,-5,-20
+1	3062915	snp_3062915	G	T,C	999	test	TEST=5;DP4=1,2,3,4;AN=3;AC=1,1;T_INT=1;T_FLOAT=2e-10	GT:TT:GQ:DP:GL	0/1:0,1:409:35:-20,-5,-20,-20,-5,-20	2:0,1:409:35:-20,-5,-20
+1	3106154	indel_3106154	CAAA	C	342	PASS	AN=4;AC=2;INDEL	GT:GQ:DP	0/1:245:32	0/1:245:32
+1	3106154	indel_3106154	C	CT	59.2	PASS	AN=4;AC=2;INDEL	GT:GQ:DP	0/1:245:32	0/1:245:32
+1	3157410	indel_3157410	GA	G	90.6	q10	AN=4;AC=4;INDEL	GT:GQ:DP	1/1:21:21	1/1:21:21
+1	3162006	indel_3162006	GAA	G	60.2	PASS	AN=4;AC=2;INDEL	GT:GQ:DP	0/1:212:22	0/1:212:22
+1	3177144	snp_3177144	G	T	999	PASS	AN=4;AC=2;T_INT=1;T_FLOAT=2e-10	GT:GQ:DP	0/0:150:30	1/1:150:30
+1	3177144	ref_3177144	G	.	999	PASS	AN=4;AC=0;T_INT=1;T_FLOAT=2e-10	GT:GQ:DP	0/0:150:30	0/0:150:30
+1	3184885	indel_3184885	TAAAA	TA,T	61.5	PASS	AN=4;AC=2,2;INDEL	GT:GQ:DP	1/2:12:10	1/2:12:10
+2	3199812	indel_3199812	G	GTT,GT	82.7	PASS	AN=4;AC=2,2;INDEL	GT:GQ:DP	1/2:322:26	1/2:322:26
+3	3212016	indel_3212016	CTT	C,CT	79	PASS	AN=4;AC=2,2;INDEL	GT:GQ:DP	1/2:91:26	1/2:91:26
+4	3258448	indel_3258448	TACACACAC	T	59.9	PASS	AN=4;AC=2;INDEL	GT:GQ:DP	0/1:325:31	0/1:325:31
+4	4000000	id1	T	A,C	59.9	PASS	AN=4;AC=2;INDEL	GT:GQ:DP	0/1:325:31	0/1:325:31
+4	4000001	id2	T	A	59.9	PASS	AN=4;AC=2;INDEL	GT:GQ:DP	0/1:325:31	0/1:325:31
diff --git a/test/annotate.tab b/test/annotate.tab
new file mode 100644
index 0000000..1fc5582
--- /dev/null
+++ b/test/annotate.tab
@@ -0,0 +1,18 @@
+3	3212016	CTT	C,CT	indel_3212016	.	.	.	1
+4	3258448	TACACACAC	T	indel_3258448	.	.	.	1
+4	4000000	T	C	id1	.	.	.	1
+4	4000001	T	C,A	id2	.	.	.	1
+2	3199812	G	GTT,GT	indel_3199812	.	.	.	1
+1	3000150	C	CT	indel_3000150	.	.	.	1
+1	3000150	C	T	snp_3000150	999	1,2	1e-10,2e-10	.
+1	3000151	C	T	snp_3000151	999	1	2e-10	.
+1	3062915	G	T,C	snp_3062915	999	1	2e-10	.
+1	3062915	GTTT	G	indel_3062915	.	.	.	1
+1	3106154	A	C	snp_3106154	999	1	2e-10	.
+1	3106154	C	CT	indel_3106154	.	.	.	1
+1	3106154	CAAA	C	indel_3106154	.	.	.	1
+1	3157410	GA	G	indel_3157410	.	.	.	1
+1	3162006	GAA	G	indel_3162006	.	.	.	1
+1	3177144	G	.	ref_3177144	999	1	2e-10	.
+1	3177144	G	T	snp_3177144	999	1	2e-10	0
+1	3184885	TAAAA	TA,T	indel_3184885	.	.	.	1
diff --git a/test/annotate.vcf b/test/annotate.vcf
new file mode 100644
index 0000000..e85bc11
--- /dev/null
+++ b/test/annotate.vcf
@@ -0,0 +1,39 @@
+##fileformat=VCFv4.1
+##INFO=<ID=TEST,Number=1,Type=Integer,Description="Testing Tag">
+##FORMAT=<ID=TT,Number=A,Type=Integer,Description="Testing Tag, with commas and \"escapes\" and escaped escapes combined with \\\"quotes\\\\\"">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=GL,Number=G,Type=Float,Description="Genotype Likelihood">
+##FILTER=<ID=q10,Description="Quality below 10">
+##FILTER=<ID=test,Description="Testing filter">
+##contig=<ID=1,assembly=b37,length=249250621>
+##contig=<ID=2,assembly=b37,length=249250621>
+##contig=<ID=3,assembly=b37,length=198022430>
+##contig=<ID=4,assembly=b37,length=191154276>
+##test=<ID=4,IE=5>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##readme=AAAAAA
+##readme=BBBBBB
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##INFO=<ID=STR,Number=1,Type=String,Description="Test string type">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B
+1	3000150	.	C	T	59.2	PASS	AN=4;AC=2	GT:GQ	0/1:245	0/1:245
+1	3000151	.	C	T	59.2	PASS	AN=4;AC=2	GT:DP:GQ	0/1:32:245	0/1:32:245
+1	3062915	id3D	GTTT	G	12.9	q10	DP4=1,2,3,4;AN=4;AC=2;INDEL;STR=test	GT:GQ:DP:GL	0/1:409:35:-20,-5,-20	0/1:409:35:-20,-5,-20
+1	3062915	idSNP	G	T,C	12.6	test	TEST=5;DP4=1,2,3,4;AN=3;AC=1,1	GT:TT:GQ:DP:GL	0/1:0,1:409:35:-20,-5,-20,-20,-5,-20	2:0,1:409:35:-20,-5,-20
+1	3106154	.	CAAA	C	342	PASS	AN=4;AC=2	GT:GQ:DP	0/1:245:32	0/1:245:32
+1	3106154	.	C	CT	59.2	PASS	AN=4;AC=2	GT:GQ:DP	0/1:245:32	0/1:245:32
+1	3157410	.	GA	G	90.6	q10	AN=4;AC=4	GT:GQ:DP	1/1:21:21	1/1:21:21
+1	3162006	.	GAA	G	60.2	PASS	AN=4;AC=2	GT:GQ:DP	0/1:212:22	0/1:212:22
+1	3177144	.	G	T	45	PASS	AN=4;AC=2	GT:GQ:DP	0/0:150:30	1/1:150:30
+1	3177144	.	G	.	45	PASS	AN=4;AC=0	GT:GQ:DP	0/0:150:30	0/0:150:30
+1	3184885	.	TAAAA	TA,T	61.5	PASS	AN=4;AC=2,2	GT:GQ:DP	1/2:12:10	1/2:12:10
+2	3199812	.	G	GTT,GT	82.7	PASS	AN=4;AC=2,2	GT:GQ:DP	1/2:322:26	1/2:322:26
+3	3212016	.	CTT	C,CT	79	PASS	AN=4;AC=2,2	GT:GQ:DP	1/2:91:26	1/2:91:26
+4	3258448	.	TACACACAC	T	59.9	PASS	AN=4;AC=2	GT:GQ:DP	0/1:325:31	0/1:325:31
+4	4000000	.	T	A,C	59.9	PASS	AN=4;AC=2	GT:GQ:DP	0/1:325:31	0/1:325:31
+4	4000001	.	T	A	59.9	PASS	AN=4;AC=2	GT:GQ:DP	0/1:325:31	0/1:325:31
diff --git a/test/annotate2.out b/test/annotate2.out
new file mode 100644
index 0000000..42b819c
--- /dev/null
+++ b/test/annotate2.out
@@ -0,0 +1,43 @@
+##fileformat=VCFv4.1
+##FILTER=<ID=PASS,Description="All filters passed">
+##INFO=<ID=TEST,Number=1,Type=Integer,Description="Testing Tag">
+##FORMAT=<ID=TT,Number=A,Type=Integer,Description="Testing Tag, with commas and \"escapes\" and escaped escapes combined with \\\"quotes\\\\\"">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=GL,Number=G,Type=Float,Description="Genotype Likelihood">
+##FILTER=<ID=q10,Description="Quality below 10">
+##FILTER=<ID=test,Description="Testing filter">
+##contig=<ID=1,assembly=b37,length=249250621>
+##contig=<ID=2,assembly=b37,length=249250621>
+##contig=<ID=3,assembly=b37,length=198022430>
+##contig=<ID=4,assembly=b37,length=191154276>
+##test=<ID=4,IE=5>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##readme=AAAAAA
+##readme=BBBBBB
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##INFO=<ID=STR,Number=1,Type=String,Description="Test string type">
+##INFO=<ID=T_STR,Number=1,Type=String,Description="Test String">
+##INFO=<ID=T_INT,Number=.,Type=Integer,Description="Test Integer">
+##INFO=<ID=T_FLOAT,Number=.,Type=Float,Description="Test Float">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B
+1	3000150	.	C	T	59.2	PASS	AN=4;AC=2;T_STR=region_3000150_3106154	GT:GQ	0/1:245	0/1:245
+1	3000151	.	C	T	59.2	PASS	AN=4;AC=2	GT:DP:GQ	0/1:32:245	0/1:32:245
+1	3062915	id3D	GTTT	G	12.9	q10	DP4=1,2,3,4;AN=4;AC=2;INDEL;STR=test	GT:GQ:DP:GL	0/1:409:35:-20,-5,-20	0/1:409:35:-20,-5,-20
+1	3062915	idSNP	G	T,C	12.6	test	TEST=5;DP4=1,2,3,4;AN=3;AC=1,1	GT:TT:GQ:DP:GL	0/1:0,1:409:35:-20,-5,-20,-20,-5,-20	2:0,1:409:35:-20,-5,-20
+1	3106154	.	CAAA	C	342	PASS	AN=4;AC=2	GT:GQ:DP	0/1:245:32	0/1:245:32
+1	3106154	.	C	CT	59.2	PASS	AN=4;AC=2	GT:GQ:DP	0/1:245:32	0/1:245:32
+1	3157410	.	GA	G	90.6	q10	AN=4;AC=4	GT:GQ:DP	1/1:21:21	1/1:21:21
+1	3162006	.	GAA	G	60.2	PASS	AN=4;AC=2	GT:GQ:DP	0/1:212:22	0/1:212:22
+1	3177144	.	G	T	45	PASS	AN=4;AC=2	GT:GQ:DP	0/0:150:30	1/1:150:30
+1	3177144	.	G	.	45	PASS	AN=4;AC=0	GT:GQ:DP	0/0:150:30	0/0:150:30
+1	3184885	.	TAAAA	TA,T	61.5	PASS	AN=4;AC=2,2	GT:GQ:DP	1/2:12:10	1/2:12:10
+2	3199812	.	G	GTT,GT	82.7	PASS	AN=4;AC=2,2	GT:GQ:DP	1/2:322:26	1/2:322:26
+3	3212016	.	CTT	C,CT	79	PASS	AN=4;AC=2,2	GT:GQ:DP	1/2:91:26	1/2:91:26
+4	3258448	.	TACACACAC	T	59.9	PASS	AN=4;AC=2	GT:GQ:DP	0/1:325:31	0/1:325:31
+4	4000000	.	T	A,C	59.9	PASS	AN=4;AC=2	GT:GQ:DP	0/1:325:31	0/1:325:31
+4	4000001	.	T	A	59.9	PASS	AN=4;AC=2	GT:GQ:DP	0/1:325:31	0/1:325:31
diff --git a/test/annotate2.tab b/test/annotate2.tab
new file mode 100644
index 0000000..b8ef5c1
--- /dev/null
+++ b/test/annotate2.tab
@@ -0,0 +1,2 @@
+2	3000000	3199812	region_3000000_3199812
+1	3000150	3106154	region_3000150_3106154
diff --git a/test/annotate2.vcf b/test/annotate2.vcf
new file mode 100644
index 0000000..64385b2
--- /dev/null
+++ b/test/annotate2.vcf
@@ -0,0 +1,17 @@
+##fileformat=VCFv4.1
+##contig=<ID=1,assembly=b37,length=249250621>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##INFO=<ID=FLAG,Number=0,Type=Flag,Description="Test type">
+##INFO=<ID=IINT,Number=1,Type=Integer,Description="Test type">
+##INFO=<ID=IFLT,Number=1,Type=Float,Description="Test type">
+##INFO=<ID=ISTR,Number=1,Type=String,Description="Test type">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=FINT,Number=1,Type=Integer,Description="Test type">
+##FORMAT=<ID=FFLT,Number=1,Type=Float,Description="Test type">
+##FORMAT=<ID=FSTR,Number=1,Type=String,Description="Test type">
+##FILTER=<ID=q11,Description="Quality below 10">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B	C
+1	3000001	xx	C	T	11	PASS	FLAG;IINT=11;IFLT=1.1;ISTR=xxx	GT:FINT:FFLT:FSTR	0/0:11:1.1:xxx	0/0:11:1.1:x	0/0:11:1.1:x
+1	3000002	.	C	T	.	.	.	GT	.	.	.
+1	3000003	xx	C	T	11	q11	FLAG;IINT=.;IFLT=.;ISTR=.	GT:FINT:FFLT:FSTR	0/0:.:.:.	0/0:.:.:.	0/0:.:.:.
+1	3000004	xx	C	T	11	q11	FLAG;IINT=11;IFLT=1.1;ISTR=xxx	GT:FINT:FFLT:FSTR	0/0:11:1.1:x	0/0:11:1.1:xxx	0/0:11:1.1:xxx
diff --git a/test/annotate3.out b/test/annotate3.out
new file mode 100644
index 0000000..b799304
--- /dev/null
+++ b/test/annotate3.out
@@ -0,0 +1,40 @@
+##fileformat=VCFv4.1
+##FILTER=<ID=PASS,Description="All filters passed">
+##INFO=<ID=TEST,Number=1,Type=Integer,Description="Testing Tag">
+##FORMAT=<ID=TT,Number=A,Type=Integer,Description="Testing Tag, with commas and \"escapes\" and escaped escapes combined with \\\"quotes\\\\\"">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=GL,Number=G,Type=Float,Description="Genotype Likelihood">
+##FILTER=<ID=q10,Description="Quality below 10">
+##FILTER=<ID=test,Description="Testing filter">
+##contig=<ID=1,assembly=b37,length=249250621>
+##contig=<ID=2,assembly=b37,length=249250621>
+##contig=<ID=3,assembly=b37,length=198022430>
+##contig=<ID=4,assembly=b37,length=191154276>
+##test=<ID=4,IE=5>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##readme=AAAAAA
+##readme=BBBBBB
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##INFO=<ID=STR,Number=1,Type=String,Description="Test string type">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B
+1	3000150	id1	C	T	99	PASS	AN=4;AC=2;STR=id1	GT:GQ	0/1:245	0/1:245
+1	3000151	id2	C	T	99	PASS	AN=4;AC=2;STR=id2	GT:DP:GQ	0/1:32:245	0/1:32:245
+1	3062915	idIndel	GTTT	G	99	PASS	DP4=1,2,3,4;AN=4;AC=2;INDEL;STR=testIndel	GT:GQ:DP:GL	0/1:409:35:-20,-5,-20	0/1:409:35:-20,-5,-20
+1	3062915	idSNP	G	T,C	99	PASS	TEST=5;DP4=1,2,3,4;AN=3;AC=1,1;STR=testSNP	GT:TT:GQ:DP:GL	0/1:0,1:409:35:-20,-5,-20,-20,-5,-20	2:0,1:409:35:-20,-5,-20
+1	3106154	id4	CAAA	C	99	PASS	AN=4;AC=2;STR=id4	GT:GQ:DP	0/1:245:32	0/1:245:32
+1	3106154	id5	C	CT	99	PASS	AN=4;AC=2;STR=id5	GT:GQ:DP	0/1:245:32	0/1:245:32
+1	3157410	id6	GA	G	99	PASS	AN=4;AC=4;STR=id6	GT:GQ:DP	1/1:21:21	1/1:21:21
+1	3162006	.	GAA	G	60.2	PASS	AN=4;AC=2	GT:GQ:DP	0/1:212:22	0/1:212:22
+1	3177144	id8	G	T	99	PASS	AN=4;AC=2;STR=id8	GT:GQ:DP	0/0:150:30	1/1:150:30
+1	3177144	id9	G	.	99	PASS	AN=4;AC=0;STR=id9	GT:GQ:DP	0/0:150:30	0/0:150:30
+1	3184885	id10	TAAAA	TA,T	99	PASS	AN=4;AC=2,2;STR=id10	GT:GQ:DP	1/2:12:10	1/2:12:10
+2	3199812	id11	G	GTT,GT	99	PASS	AN=4;AC=2,2;STR=id11	GT:GQ:DP	1/2:322:26	1/2:322:26
+3	3212016	id12	CTT	C,CT	99	PASS	AN=4;AC=2,2;STR=id12	GT:GQ:DP	1/2:91:26	1/2:91:26
+4	3258448	id13	TACACACAC	T	99	PASS	AN=4;AC=2;STR=id13	GT:GQ:DP	0/1:325:31	0/1:325:31
+4	4000000	.	T	A,C	59.9	PASS	AN=4;AC=2	GT:GQ:DP	0/1:325:31	0/1:325:31
+4	4000001	.	T	A	59.9	PASS	AN=4;AC=2	GT:GQ:DP	0/1:325:31	0/1:325:31
diff --git a/test/annotate3.vcf b/test/annotate3.vcf
new file mode 100644
index 0000000..6eb2e90
--- /dev/null
+++ b/test/annotate3.vcf
@@ -0,0 +1,21 @@
+##fileformat=VCFv4.1
+##FILTER=<ID=PASS,Description="All filters passed">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=PL,Number=G,Type=Integer,Description="Genotype LK">
+##FORMAT=<ID=X,Number=1,Type=Integer,Description="rmme">
+##FORMAT=<ID=Y,Number=1,Type=Integer,Description="rmme">
+##FORMAT=<ID=AA,Number=1,Type=Integer,Description="rmme">
+##INFO=<ID=AA,Number=1,Type=Integer,Description="rmme">
+##INFO=<ID=BB,Number=1,Type=Integer,Description="rmme">
+##INFO=<ID=X,Number=1,Type=Integer,Description="rmme">
+##INFO=<ID=Y,Number=1,Type=Integer,Description="rmme">
+##FILTER=<ID=fltA,Description="rmme">
+##FILTER=<ID=fltB,Description="rmme">
+##FILTER=<ID=fltX,Description="rmme">
+##FILTER=<ID=fltY,Description="rmme">
+##contig=<ID=1,assembly=b37,length=249250621>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B
+1	3000000	id	C	.	20	.	AA=1;BB=2;X=3;Y=4	GT:X:PL:Y:AA	0/1:1:2:3:1	0/1:1:2:3:1
+1	3000001	id	C	.	20	PASS	AA=1;BB=2;X=3;Y=4	GT:X:PL:Y:AA	0/1:1:2:3:1	0/1:1:2:3:1
+1	3000002	id	C	.	20	fltY;fltA;fltB;fltX	BB=2;X=3;Y=4;AA=1	GT:Y:X:PL:AA	0/1:3:1:2:1	0/1:3:1:2:1
diff --git a/test/annotate4.hdr b/test/annotate4.hdr
new file mode 100644
index 0000000..73651f7
--- /dev/null
+++ b/test/annotate4.hdr
@@ -0,0 +1,2 @@
+##INFO=<ID=FR,Number=R,Type=Float,Description="test">
+##INFO=<ID=FA,Number=A,Type=Float,Description="test">
diff --git a/test/annotate4.out b/test/annotate4.out
new file mode 100644
index 0000000..6740242
--- /dev/null
+++ b/test/annotate4.out
@@ -0,0 +1,19 @@
+##fileformat=VCFv4.1
+##FILTER=<ID=PASS,Description="All filters passed">
+##contig=<ID=1,assembly=b37,length=249250621>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##INFO=<ID=FLAG,Number=0,Type=Flag,Description="Test type">
+##INFO=<ID=IINT,Number=1,Type=Integer,Description="Test type">
+##INFO=<ID=IFLT,Number=1,Type=Float,Description="Test type">
+##INFO=<ID=ISTR,Number=1,Type=String,Description="Test type">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=FINT,Number=1,Type=Integer,Description="Test type">
+##FORMAT=<ID=FFLT,Number=1,Type=Float,Description="Test type">
+##FORMAT=<ID=FSTR,Number=1,Type=String,Description="Test type">
+##FILTER=<ID=q11,Description="Quality below 10">
+##FILTER=<ID=q99,Description="Quality below 10">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B	C
+1	3000001	xx	C	T	11	.	IINT=11;IFLT=1.1;ISTR=xxx	GT:FINT:FFLT:FSTR	.:11:1.1:xxx	.:11:1.1:x	0/0:11:1.1:x
+1	3000002	id	C	T	99	q99	FLAG;IINT=88,99;IFLT=8.8,9.9;ISTR=888,999	GT:FINT:FFLT:FSTR	0|1:77:7.7:77	1|1:88,99:8.8,9.9:888,999	.:.:.:.
+1	3000003	id	C	T	99	q99	FLAG;IINT=88,99;IFLT=8.8,9.9;ISTR=888,999	GT:FINT:FFLT:FSTR	0|1:77:7.7:77	1|1:88,99:8.8,9.9:888,999	0/0:.:.:.
+1	3000004	id	C	T	99	q99	FLAG;IINT=88,99;IFLT=8.8,9.9;ISTR=888,999	GT:FINT:FFLT:FSTR	0|1:77:7.7:77	1|1:88,99:8.8,9.9:888,999	0/0:11:1.1:xxx
diff --git a/test/annotate4.vcf b/test/annotate4.vcf
new file mode 100644
index 0000000..5a2a1e9
--- /dev/null
+++ b/test/annotate4.vcf
@@ -0,0 +1,13 @@
+##fileformat=VCFv4.2
+##INFO=<ID=FR,Number=R,Type=Float,Description="test">
+##INFO=<ID=FA,Number=A,Type=Float,Description="test">
+##INFO=<ID=IA,Number=A,Type=Integer,Description="test">
+##INFO=<ID=IR,Number=R,Type=Integer,Description="test">
+##INFO=<ID=SA,Number=A,Type=String,Description="test">
+##INFO=<ID=SR,Number=R,Type=String,Description="test">
+##contig=<ID=1,assembly=b37,length=249250621>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO
+1	1	.	C	T	.	.	.
+1	2	.	C	T,G	.	.	FA=.,9.9;FR=.,9.9,.;IA=.,99;IR=.,99,.;SA=.,99;SR=.,99,.
+1	3	.	C	A,T	.	.	.
diff --git a/test/annotate5.out b/test/annotate5.out
new file mode 100644
index 0000000..d3ab764
--- /dev/null
+++ b/test/annotate5.out
@@ -0,0 +1,19 @@
+##fileformat=VCFv4.1
+##FILTER=<ID=PASS,Description="All filters passed">
+##contig=<ID=1,assembly=b37,length=249250621>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##INFO=<ID=FLAG,Number=0,Type=Flag,Description="Test type">
+##INFO=<ID=IINT,Number=1,Type=Integer,Description="Test type">
+##INFO=<ID=IFLT,Number=1,Type=Float,Description="Test type">
+##INFO=<ID=ISTR,Number=1,Type=String,Description="Test type">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=FINT,Number=1,Type=Integer,Description="Test type">
+##FORMAT=<ID=FFLT,Number=1,Type=Float,Description="Test type">
+##FORMAT=<ID=FSTR,Number=1,Type=String,Description="Test type">
+##FILTER=<ID=q11,Description="Quality below 10">
+##FILTER=<ID=q99,Description="Quality below 10">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B	C
+1	3000001	xx	C	T	11	PASS	IINT=11;IFLT=1.1;ISTR=xxx	GT:FINT:FFLT:FSTR	.:11:1.1:xxx	0/0:11:1.1:x	0/0:11:1.1:x
+1	3000002	id	C	T	99	q99	FLAG;IINT=88,99;IFLT=8.8,9.9;ISTR=888,999	GT	0|1	.	.
+1	3000003	id	C	T	99	q11;q99	FLAG;IINT=88,99;IFLT=8.8,9.9;ISTR=888,999	GT:FINT:FFLT:FSTR	0|1:.:.:.	0/0:.:.:.	0/0:.:.:.
+1	3000004	id	C	T	99	q11;q99	FLAG;IINT=11;IFLT=1.1;ISTR=xxx	GT:FINT:FFLT:FSTR	0|1:11:1.1:x	0/0:11:1.1:xxx	0/0:11:1.1:xxx
diff --git a/test/annotate6.out b/test/annotate6.out
new file mode 100644
index 0000000..f0e5d03
--- /dev/null
+++ b/test/annotate6.out
@@ -0,0 +1,14 @@
+##fileformat=VCFv4.1
+##FILTER=<ID=PASS,Description="All filters passed">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=PL,Number=G,Type=Integer,Description="Genotype LK">
+##INFO=<ID=AA,Number=1,Type=Integer,Description="rmme">
+##INFO=<ID=BB,Number=1,Type=Integer,Description="rmme">
+##FILTER=<ID=fltA,Description="rmme">
+##FILTER=<ID=fltB,Description="rmme">
+##contig=<ID=1,assembly=b37,length=249250621>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B
+1	3000000	.	C	.	.	.	AA=1;BB=2	GT:PL	0/1:2	0/1:2
+1	3000001	.	C	.	.	.	AA=1;BB=2	GT:PL	0/1:2	0/1:2
+1	3000002	.	C	.	.	fltA;fltB	BB=2;AA=1	GT:PL	0/1:2	0/1:2
diff --git a/test/annotate7.out b/test/annotate7.out
new file mode 100644
index 0000000..7a93d62
--- /dev/null
+++ b/test/annotate7.out
@@ -0,0 +1,17 @@
+##fileformat=VCFv4.1
+##FILTER=<ID=PASS,Description="All filters passed">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##INFO=<ID=AA,Number=1,Type=Integer,Description="rmme">
+##INFO=<ID=BB,Number=1,Type=Integer,Description="rmme">
+##INFO=<ID=X,Number=1,Type=Integer,Description="rmme">
+##INFO=<ID=Y,Number=1,Type=Integer,Description="rmme">
+##FILTER=<ID=fltA,Description="rmme">
+##FILTER=<ID=fltB,Description="rmme">
+##FILTER=<ID=fltX,Description="rmme">
+##FILTER=<ID=fltY,Description="rmme">
+##contig=<ID=1,assembly=b37,length=249250621>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B
+1	3000000	id	C	.	20	.	AA=1;BB=2;X=3;Y=4	GT	0/1	0/1
+1	3000001	id	C	.	20	PASS	AA=1;BB=2;X=3;Y=4	GT	0/1	0/1
+1	3000002	id	C	.	20	fltY;fltA;fltB;fltX	BB=2;X=3;Y=4;AA=1	GT	0/1	0/1
diff --git a/test/annotate8.out b/test/annotate8.out
new file mode 100644
index 0000000..232a31f
--- /dev/null
+++ b/test/annotate8.out
@@ -0,0 +1,14 @@
+##fileformat=VCFv4.2
+##FILTER=<ID=PASS,Description="All filters passed">
+##INFO=<ID=FR,Number=R,Type=Float,Description="test">
+##INFO=<ID=FA,Number=A,Type=Float,Description="test">
+##INFO=<ID=IA,Number=A,Type=Integer,Description="test">
+##INFO=<ID=IR,Number=R,Type=Integer,Description="test">
+##INFO=<ID=SA,Number=A,Type=String,Description="test">
+##INFO=<ID=SR,Number=R,Type=String,Description="test">
+##contig=<ID=1,assembly=b37,length=249250621>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO
+1	1	.	C	T	.	.	FA=1.1;FR=1.1,2.2;IA=1;IR=1,2;SA=11;SR=1,222
+1	2	.	C	T,G	.	.	FA=1.1,9.9;FR=1.1,9.9,3.3;IA=1,2;IR=1,2,3;SA=11,99;SR=111,99,3
+1	3	.	C	A,T	.	.	FA=.,1.1;FR=1.1,.,2.2;IA=.,1;IR=1,.,2;SA=.,11;SR=11,.,2
diff --git a/test/annots.vcf b/test/annots.vcf
new file mode 100644
index 0000000..cf2ae71
--- /dev/null
+++ b/test/annots.vcf
@@ -0,0 +1,37 @@
+##fileformat=VCFv4.1
+##INFO=<ID=TEST,Number=1,Type=Integer,Description="Testing Tag">
+##FORMAT=<ID=TT,Number=A,Type=Integer,Description="Testing Tag, with commas and \"escapes\" and escaped escapes combined with \\\"quotes\\\\\"">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=GL,Number=G,Type=Float,Description="Genotype Likelihood">
+##FILTER=<ID=q10,Description="Quality below 10">
+##FILTER=<ID=test,Description="Testing filter">
+##contig=<ID=1,assembly=b37,length=249250621>
+##contig=<ID=2,assembly=b37,length=249250621>
+##contig=<ID=3,assembly=b37,length=198022430>
+##contig=<ID=4,assembly=b37,length=191154276>
+##test=<ID=4,IE=5>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##readme=AAAAAA
+##readme=BBBBBB
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##INFO=<ID=STR,Number=1,Type=String,Description="Test string type">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B
+1	3000150	id1	C	T	99	PASS	STR=id1;AN=4;AC=0	GT:GQ	0|0:999	0|0:999
+1	3000151	id2	C	T	99	PASS	STR=id2;AN=4;AC=0	GT:DP:GQ	0|0:99:999	0|0:99:999
+1	3062915	idIndel	GTTT	G	99	PASS	DP4=1,2,3,4;AN=4;AC=0;INDEL;STR=testIndel	GT:GQ:DP:GL	0|0:999:99:-99,-9,-99	0|0:999:99:-99,-9,-99
+1	3062915	idSNP	G	T,C	99	PASS	STR=testSNP;TEST=5;DP4=1,2,3,4;AN=3;AC=0,0	GT:TT:GQ:DP:GL	0|0:9,9:999:99:-99,-9,-99,-99,-9,-99	0:9,9:999:99:-99,-9,-99
+1	3106154	id4	CAAA	C	99	PASS	STR=id4;AN=4;AC=0	GT:GQ:DP	0|0:999:99	0|0:999:99
+1	3106154	id5	C	CT	99	PASS	STR=id5;AN=4;AC=0	GT:GQ:DP	0|0:999:99	0|0:999:99
+1	3157410	id6	GA	GC,G	99	PASS	STR=id6;AN=4;AC=0	GT:GQ:DP	0|0:99:99	0|0:99:99
+1	3162006	id7	GAA	GG	99	PASS	STR=id7;AN=4;AC=0	GT:GQ:DP	0|0:999:99	0|0:999:99
+1	3177144	id8	G	T	99	PASS	STR=id8;AN=4;AC=0	GT:GQ:DP	0|0:999:99	0|0:999:99
+1	3177144	id9	G	.	99	PASS	STR=id9;AN=4;AC=0	GT:GQ:DP	0|0:999:99	0|0:999:99
+1	3184885	id10	TAAAA	TA,T	99	PASS	STR=id10;AN=4;AC=0,0	GT:GQ:DP	0|0:99:99	0|0:99:99
+2	3199812	id11	G	GTT,GT	99	PASS	STR=id11;AN=4;AC=0,0	GT:GQ:DP	0|0:999:99	0|0:999:99
+3	3212016	id12	CTT	C,CT	99	PASS	STR=id12;AN=4;AC=0,0	GT:GQ:DP	0|0:99:99	0|0:99:99
+4	3258448	id13	TACACACAC	T	99	PASS	STR=id13;AN=4;AC=0	GT:GQ:DP	0|0:999:99	0|0:999:99
diff --git a/test/annots2.vcf b/test/annots2.vcf
new file mode 100644
index 0000000..d54a8f6
--- /dev/null
+++ b/test/annots2.vcf
@@ -0,0 +1,17 @@
+##fileformat=VCFv4.1
+##FILTER=<ID=q99,Description="Quality below 10">
+##contig=<ID=1,assembly=b37,length=249250621>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##INFO=<ID=FLAG,Number=0,Type=Flag,Description="Test type">
+##INFO=<ID=IINT,Number=.,Type=Integer,Description="Test type">
+##INFO=<ID=IFLT,Number=.,Type=Float,Description="Test type">
+##INFO=<ID=ISTR,Number=.,Type=String,Description="Test type">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=FINT,Number=.,Type=Integer,Description="Test type">
+##FORMAT=<ID=FFLT,Number=.,Type=Float,Description="Test type">
+##FORMAT=<ID=FSTR,Number=.,Type=String,Description="Test type">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	B	A
+1	3000001	.	C	T	.	.	.	GT	.	.
+1	3000002	id	C	T	99	q99	FLAG;IINT=88,99;IFLT=8.8,9.9;ISTR=888,999	GT:FINT:FFLT:FSTR	1|1:88,99:8.8,9.9:888,999	0|1:77:7.7:77
+1	3000003	id	C	T	99	q99	FLAG;IINT=88,99;IFLT=8.8,9.9;ISTR=888,999	GT:FINT:FFLT:FSTR	1|1:88,99:8.8,9.9:888,999	0|1:77:7.7:77
+1	3000004	id	C	T	99	q99	FLAG;IINT=88,99;IFLT=8.8,9.9;ISTR=888,999	GT:FINT:FFLT:FSTR	1|1:88,99:8.8,9.9:888,999	0|1:77:7.7:77
diff --git a/test/annots4.tab b/test/annots4.tab
new file mode 100644
index 0000000..1674a40
--- /dev/null
+++ b/test/annots4.tab
@@ -0,0 +1,3 @@
+1	1	C	A,T,G	0,1.1,0	1.1,0,2.2,0	0,1,0	1,0,2,0	X,11,XXX	1,XX,222,XXX
+1	2	C	T,G	1.1,2.2	1.1,2.2,3.3	1,2	1,2,3	11,2	111,22,3
+1	3	C	T	1.1	1.1,2.2	1	1,2	11	11,2
diff --git a/test/annots4.vcf b/test/annots4.vcf
new file mode 100644
index 0000000..4f584d0
--- /dev/null
+++ b/test/annots4.vcf
@@ -0,0 +1,13 @@
+##fileformat=VCFv4.2
+##INFO=<ID=FA,Number=A,Type=Float,Description="test">
+##INFO=<ID=FR,Number=R,Type=Float,Description="test">
+##INFO=<ID=IA,Number=A,Type=Integer,Description="test">
+##INFO=<ID=IR,Number=R,Type=Integer,Description="test">
+##INFO=<ID=SA,Number=A,Type=String,Description="test">
+##INFO=<ID=SR,Number=R,Type=String,Description="test">
+##contig=<ID=1,assembly=b37,length=249250621>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO
+1	1	.	C	A,T,G	.	.	FA=0,1.1,0;FR=1.1,0,2.2,0;IA=0,1,0;IR=1,0,2,0;SA=X,11,XXX;SR=1,XX,222,XXX
+1	2	.	C	T,G	.	.	FA=1.1,2.2;FR=1.1,2.2,3.3;IA=1,2;IR=1,2,3;SA=11,2;SR=111,22,3
+1	3	.	C	T	.	.	FA=1.1;FR=1.1,2.2;IA=1;IR=1,2;SA=11;SR=11,2
diff --git a/test/check.chk b/test/check.chk
new file mode 100644
index 0000000..1012e5c
--- /dev/null
+++ b/test/check.chk
@@ -0,0 +1,80 @@
+#
+# Definition of sets:
+# ID	[2]id	[3]tab-separated file names
+# SN, Summary numbers:
+# SN	[2]id	[3]key	[4]value
+SN	0	number of samples:	2
+SN	0	number of records:	18
+SN	0	number of SNPs:	5
+SN	0	number of MNPs:	1
+SN	0	number of indels:	9
+SN	0	number of others:	2
+SN	0	number of multiallelic sites:	6
+SN	0	number of multiallelic SNP sites:	1
+# TSTV, transitions/transversions:
+# TSTV	[2]id	[3]ts	[4]tv	[5]ts/tv	[6]ts (1st ALT)	[7]tv (1st ALT)	[8]ts/tv (1st ALT)
+TSTV	0	3	2	1.50	3	1	3.00
+# SiS, Singleton stats:
+# SiS	[2]id	[3]allele count	[4]number of SNPs	[5]number of transitions	[6]number of transversions	[7]number of indels	[8]repeat-consistent	[9]repeat-inconsistent	[10]not applicable
+SiS	0	1	3	1	2	0	0	0	0
+# AF, Stats by non-reference allele frequency:
+# AF	[2]id	[3]allele frequency	[4]number of SNPs	[5]number of transitions	[6]number of transversions	[7]number of indels	[8]repeat-consistent	[9]repeat-inconsistent	[10]not applicable
+AF	0	0.000000	3	1	2	2	0	0	2
+AF	0	49.000000	0	0	0	12	0	0	12
+AF	0	74.000000	1	1	0	0	0	0	0
+AF	0	99.000000	1	1	0	0	0	0	0
+# QUAL, Stats by quality:
+# QUAL	[2]id	[3]Quality	[4]number of SNPs	[5]number of transitions (1st ALT)	[6]number of transversions (1st ALT)	[7]number of indels
+QUAL	0	12	1	0	1	1
+QUAL	0	45	0	0	0	1
+QUAL	0	59	2	1	0	3
+QUAL	0	60	1	1	0	0
+QUAL	0	61	0	0	0	1
+QUAL	0	79	0	0	0	1
+QUAL	0	82	0	0	0	1
+QUAL	0	90	1	1	0	0
+QUAL	0	342	0	0	0	1
+# IDD, InDel distribution:
+# IDD	[2]id	[3]length (deletions negative)	[4]count
+IDD	0	-10	1
+IDD	0	-8	1
+IDD	0	-4	3
+IDD	0	-3	4
+IDD	0	-2	1
+IDD	0	-1	2
+IDD	0	1	1
+IDD	0	2	1
+# ST, Substitution types:
+# ST	[2]id	[3]type	[4]count
+ST	0	A>C	0
+ST	0	A>G	0
+ST	0	A>T	0
+ST	0	C>A	0
+ST	0	C>G	0
+ST	0	C>T	0
+ST	0	G>A	3
+ST	0	G>C	1
+ST	0	G>T	1
+ST	0	T>A	0
+ST	0	T>C	0
+ST	0	T>G	0
+# DP, Depth distribution
+# DP	[2]id	[3]bin	[4]number of genotypes	[5]fraction of genotypes (%)	[6]number of sites	[7]fraction of sites (%)
+DP	0	10	2	5.555556	0	0.000000
+DP	0	21	2	5.555556	0	0.000000
+DP	0	22	2	5.555556	0	0.000000
+DP	0	26	4	11.111111	0	0.000000
+DP	0	30	2	5.555556	0	0.000000
+DP	0	31	16	44.444444	0	0.000000
+DP	0	32	4	11.111111	0	0.000000
+DP	0	35	4	11.111111	0	0.000000
+# PSC, Per-sample counts
+# PSC	[2]id	[3]sample	[4]nRefHom	[5]nNonRefHom	[6]nHets	[7]nTransitions	[8]nTransversions	[9]nIndels	[10]average depth	[11]nSingletons
+PSC	0	A	0	2	3	3	2	9	28.7	1
+PSC	0	B	1	1	3	2	2	9	28.7	0
+# HWE
+# HWE	[2]id	[3]1st ALT allele frequency	[4]Number of observations	[5]25th percentile	[6]median	[7]75th percentile
+HWE	0	0.000000	2	0.490000	0.490000	0.990000
+HWE	0	49.000000	14	0.990000	0.990000	0.990000
+HWE	0	74.000000	1	0.490000	0.490000	0.490000
+HWE	0	99.000000	1	0.000000	0.000000	0.000000
diff --git a/test/check.gs.chrom.gen b/test/check.gs.chrom.gen
new file mode 100644
index 0000000..7406028
--- /dev/null
+++ b/test/check.gs.chrom.gen
@@ -0,0 +1,10 @@
+1 1:3062915_GTTT_G 3062915 GTTT G 0 1 0 0 1 0
+1 1:3106154_CAAA_C 3106154 CAAA C 0 1 0 0 1 0
+1 1:3157410_G_A 3157410 G A 0 0 1 0 0 1
+1 1:3162006_G_A 3162006 G A 0 0 1 0 1 0
+1 1:3177144_GT_G 3177144 GT G 0 1 0 0 1 0
+4 4:3258448_TACACACAC_T 3258448 TACACACAC T 0 1 0 0 1 0
+4 4:3258451_AAA_AGT 3258451 AAA AGT 0 1 0 0 1 0
+4 4:3258452_AAA_AGA 3258452 AAA AGA 0 1 0 0 1 0
+4 4:3258453_AACA_AGA 3258453 AACA AGA 0 1 0 0 1 0
+4 4:3258454_AACA_AACA 3258454 AACA AACA 0 1 0 0 1 0
diff --git a/test/check.gs.chrom.samples b/test/check.gs.chrom.samples
new file mode 100644
index 0000000..dd870ec
--- /dev/null
+++ b/test/check.gs.chrom.samples
@@ -0,0 +1,4 @@
+ID_1 ID_2 missing
+0 0 0
+A A 0
+B B 0
diff --git a/test/check.gs.vcfids.gen b/test/check.gs.vcfids.gen
new file mode 100644
index 0000000..1d7387c
--- /dev/null
+++ b/test/check.gs.vcfids.gen
@@ -0,0 +1,10 @@
+1:3062915_GTTT_G id3D 3062915 GTTT G 0 1 0 0 1 0
+1:3106154_CAAA_C . 3106154 CAAA C 0 1 0 0 1 0
+1:3157410_G_A . 3157410 G A 0 0 1 0 0 1
+1:3162006_G_A . 3162006 G A 0 0 1 0 1 0
+1:3177144_GT_G . 3177144 GT G 0 1 0 0 1 0
+4:3258448_TACACACAC_T . 3258448 TACACACAC T 0 1 0 0 1 0
+4:3258451_AAA_AGT . 3258451 AAA AGT 0 1 0 0 1 0
+4:3258452_AAA_AGA . 3258452 AAA AGA 0 1 0 0 1 0
+4:3258453_AACA_AGA . 3258453 AACA AGA 0 1 0 0 1 0
+4:3258454_AACA_AACA . 3258454 AACA AACA 0 1 0 0 1 0
diff --git a/test/check.gs.vcfids.samples b/test/check.gs.vcfids.samples
new file mode 100644
index 0000000..dd870ec
--- /dev/null
+++ b/test/check.gs.vcfids.samples
@@ -0,0 +1,4 @@
+ID_1 ID_2 missing
+0 0 0
+A A 0
+B B 0
diff --git a/test/check.gs.vcfids_chrom.gen b/test/check.gs.vcfids_chrom.gen
new file mode 100644
index 0000000..80c12be
--- /dev/null
+++ b/test/check.gs.vcfids_chrom.gen
@@ -0,0 +1,10 @@
+1 id3D 3062915 GTTT G 0 1 0 0 1 0
+1 . 3106154 CAAA C 0 1 0 0 1 0
+1 . 3157410 G A 0 0 1 0 0 1
+1 . 3162006 G A 0 0 1 0 1 0
+1 . 3177144 GT G 0 1 0 0 1 0
+4 . 3258448 TACACACAC T 0 1 0 0 1 0
+4 . 3258451 AAA AGT 0 1 0 0 1 0
+4 . 3258452 AAA AGA 0 1 0 0 1 0
+4 . 3258453 AACA AGA 0 1 0 0 1 0
+4 . 3258454 AACA AACA 0 1 0 0 1 0
diff --git a/test/check.gs.vcfids_chrom.samples b/test/check.gs.vcfids_chrom.samples
new file mode 100644
index 0000000..dd870ec
--- /dev/null
+++ b/test/check.gs.vcfids_chrom.samples
@@ -0,0 +1,4 @@
+ID_1 ID_2 missing
+0 0 0
+A A 0
+B B 0
diff --git a/test/check.vcf b/test/check.vcf
new file mode 100644
index 0000000..8fe38e4
--- /dev/null
+++ b/test/check.vcf
@@ -0,0 +1,37 @@
+##fileformat=VCFv4.1
+##INFO=<ID=TEST,Number=1,Type=Integer,Description="Testing Tag">
+##FORMAT=<ID=TT,Number=A,Type=Integer,Description="Testing Tag, with commas and \"escapes\" and escaped escapes combined with \\\"quotes\\\\\"">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=GL,Number=G,Type=Float,Description="Genotype Likelihood">
+##FILTER=<ID=q10,Description="Quality below 10">
+##FILTER=<ID=test,Description="Testing filter">
+##contig=<ID=1,assembly=b37,length=249250621>
+##contig=<ID=3,assembly=b37,length=198022430>
+##contig=<ID=4,assembly=b37,length=191154276>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##readme=AAAAAA
+##readme=BBBBBB
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B
+1	3062915	id3D	GTTT	G	12.9	q10	DP4=1,2,3,4;AN=4;AC=2	GT:GQ:DP:GL	0/1:409:35:-20,-5,-20	0/1:409:35:-20,-5,-20
+1	3062915	idSNP	G	T,C	12.6	test	TEST=5;DP4=1,2,3,4;AN=4;AC=1,1	GT:TT:GQ:DP:GL	0/1:0,1:409:35:-20,-5,-20,-20,-5,-20	0/2:0,1:409:35:-20,-5,-20,-20,-5,-20
+1	3106154	.	CAAA	C	342	PASS	AN=4;AC=2	GT:GQ:DP	0/1:245:32	0/1:245:32
+1	3106154	.	G	A	59.2	PASS	AN=4;AC=1	GT:GQ:DP	0/1:245:32	0/0:245:32
+1	3157410	.	G	A	90.6	q10	AN=4;AC=4	GT:GQ:DP	1/1:21:21	1/1:21:21
+1	3162006	.	G	A	60.2	PASS	AN=4;AC=3	GT:GQ:DP	1/1:212:22	0/1:212:22
+1	3177144	.	GT	G	45	PASS	AN=4;AC=2	GT:GQ:DP	0/1:150:30	0/1:150:30
+1	3184885	.	TAAAA	TA,T	61.5	PASS	AN=4;AC=2,2	GT:GQ:DP	1/2:12:10	1/2:12:10
+2	3199812	.	G	GTT,GT	82.7	PASS	AN=4;AC=2,2	GT:GQ:DP	1/2:322:26	1/2:322:26
+3	3212016	.	CTT	C,CT	79	PASS	AN=4;AC=2,2	GT:GQ:DP	1/2:91:26	1/2:91:26
+4	3258448	.	TACACACAC	T	59.9	PASS	AN=4;AC=2	GT:GQ:DP	0/1:325:31	0/1:325:31
+4	3258449	.	GCAAA	GA,G	59.9	PASS	AN=4;AC=2	GT:GQ:DP	0/1:325:31	0/1:325:31
+4	3258450	.	AAAAGAAAAAG	A,AAAAAAG	59.9	PASS	AN=4;AC=2	GT:GQ:DP	0/1:325:31	0/1:325:31
+4	3258451	.	AAA	AGT	59.9	PASS	AN=4;AC=2	GT:GQ:DP	0/1:325:31	0/1:325:31
+4	3258452	.	AAA	AGA	59.9	PASS	AN=4;AC=2	GT:GQ:DP	0/1:325:31	0/1:325:31
+4	3258453	.	AACA	AGA	59.9	PASS	AN=4;AC=2	GT:GQ:DP	0/1:325:31	0/1:325:31
+4	3258453	.	ACA	AAGA	59.9	PASS	AN=4;AC=2	GT:GQ:DP	0/1:325:31	0/1:325:31
+4	3258454	.	AACA	AACA	59.9	PASS	AN=4;AC=2	GT:GQ:DP	0/1:325:31	0/1:325:31
diff --git a/test/concat.1.a.vcf b/test/concat.1.a.vcf
new file mode 100644
index 0000000..4e9f2f0
--- /dev/null
+++ b/test/concat.1.a.vcf
@@ -0,0 +1,32 @@
+##fileformat=VCFv4.0
+##FILTER=<ID=Fail,Description="Test">
+##FILTER=<ID=q10,Description="Quality below 10">
+##INFO=<ID=XX,Number=1,Type=Integer,Description="Test">
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##contig=<ID=2,length=62435964>
+##contig=<ID=1,length=62435964>
+##samtoolsVersion=0.2.0-rc10+htslib-0.2.0-rc10
+##samtoolsCommand=samtools mpileup -t INFO/DPR -C50 -pm3 -F0.2 -d10000 -ug -r 1:1-1000000 -b mpileup.2014-07-03//lists/chr1-pooled.list -f human_g1k_v37.fasta
+##ALT=<ID=X,Description="Represents allele(s) other than observed.">
+##bcftools_callVersion=0.2.0-rc10-2-gcd94fde+htslib-0.2.0-rc10
+##bcftools_callCommand=call -vm -f GQ -S mpileup.2014-07-03//pooled/1/1:1-1000000.samples -
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A
+1	100	.	GTTT	G	1806	q10	XX=11;DP=35	GT:GQ:DP	0/1:409:35
+1	110	.	C	T,G	1792	Fail	DP=32	GT:GQ:DP	0/1:245:32
+1	110	.	CAAA	C	1792	Fail	DP=32	GT:GQ:DP	0/1:245:32
+1	120	.	GA	G	628	q10	DP=21	GT:GQ:DP	1/1:21:21
+1	130	.	G	T	1016	Fail	DP=22	GT:GQ:DP	0/1:212:22
+1	130	.	GAA	GG	1016	Fail	DP=22	GT:GQ:DP	0/1:212:22
+1	140	.	GT	G	727	PASS	DP=30	GT:GQ:DP	0/1:150:30
+1	150	.	TAAAA	TA,T	246	Fail	DP=10	GT:GQ:DP	1/2:12:10
+1	160	.	TAAAA	TA,T	246	Fail	DP=10	GT:GQ:DP	1/2:12:10
+2	100	.	GTTT	G	1806	q10	DP=35	GT:GQ:DP	0/1:409:35
+2	110	.	CAAA	C	1792	PASS	DP=32	GT:GQ:DP	0/1:245:32
+2	120	.	GA	G	628	q10	DP=21	GT:GQ:DP	1/1:21:21
+2	130	.	GAA	G	1016	PASS	DP=22	GT:GQ:DP	0/1:212:22
+2	140	.	GT	G	727	PASS	DP=30	GT:GQ:DP	0/1:150:30
+2	150	.	TAAAA	TA,T	246	PASS	DP=10	GT:GQ:DP	1/2:12:10
+2	160	.	TAAAA	TA,TC,T	246	PASS	DP=10	GT:GQ:DP	0/2:12:10
diff --git a/test/concat.1.b.vcf b/test/concat.1.b.vcf
new file mode 100644
index 0000000..f21547e
--- /dev/null
+++ b/test/concat.1.b.vcf
@@ -0,0 +1,19 @@
+##fileformat=VCFv4.0
+##samtoolsVersion=0.2.0-rc10+htslib-0.2.0-rc10
+##samtoolsCommand=samtools mpileup -t INFO/DPR -C50 -pm3 -F0.2 -d10000 -ug -r 1:1-1000000 -b mpileup.2014-07-03//lists/chr1-pooled.list -f human_g1k_v37.fasta
+##ALT=<ID=X,Description="Represents allele(s) other than observed.">
+##bcftools_callVersion=0.2.0-rc10-2-gcd94fde+htslib-0.2.0-rc10
+##bcftools_callCommand=call -vm -f GQ -S mpileup.2014-07-03//pooled/1/1:1-1000000.samples -
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FILTER=<ID=q10,Description="Quality below 10">
+##contig=<ID=3,length=62435964>
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A
+3	142	.	GTTT	G	1806	q10	DP=35	GT:GQ:DP	0/1:409:35
+3	152	.	CAAA	C	1792	PASS	DP=32	GT:GQ:DP	0/1:245:32
+3	162	.	GA	G	628	q10	DP=21	GT:GQ:DP	1/1:21:21
+3	172	.	GAA	G	1016	PASS	DP=22	GT:GQ:DP	0/1:212:22
+3	182	.	GT	G	727	PASS	DP=30	GT:GQ:DP	0/1:150:30
+3	192	.	TAAAA	TA,T	246	PASS	DP=10	GT:GQ:DP	1/2:12:10
diff --git a/test/concat.1.bcf.out b/test/concat.1.bcf.out
new file mode 100644
index 0000000..8c31018
--- /dev/null
+++ b/test/concat.1.bcf.out
@@ -0,0 +1,38 @@
+##fileformat=VCFv4.0
+##FILTER=<ID=PASS,Description="All filters passed">
+##FILTER=<ID=Fail,Description="Test">
+##FILTER=<ID=q10,Description="Quality below 10">
+##INFO=<ID=XX,Number=1,Type=Integer,Description="Test">
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##contig=<ID=2,length=62435964>
+##contig=<ID=1,length=62435964>
+##samtoolsVersion=0.2.0-rc10+htslib-0.2.0-rc10
+##samtoolsCommand=samtools mpileup -t INFO/DPR -C50 -pm3 -F0.2 -d10000 -ug -r 1:1-1000000 -b mpileup.2014-07-03//lists/chr1-pooled.list -f human_g1k_v37.fasta
+##ALT=<ID=X,Description="Represents allele(s) other than observed.">
+##contig=<ID=3,length=62435964>
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A
+1	100	.	GTTT	G	1806	q10	XX=11;DP=35	GT:GQ:DP	0/1:409:35
+1	110	.	C	T,G	1792	Fail	DP=32	GT:GQ:DP	0/1:245:32
+1	110	.	CAAA	C	1792	Fail	DP=32	GT:GQ:DP	0/1:245:32
+1	120	.	GA	G	628	q10	DP=21	GT:GQ:DP	1/1:21:21
+1	130	.	G	T	1016	Fail	DP=22	GT:GQ:DP	0/1:212:22
+1	130	.	GAA	GG	1016	Fail	DP=22	GT:GQ:DP	0/1:212:22
+1	140	.	GT	G	727	PASS	DP=30	GT:GQ:DP	0/1:150:30
+1	150	.	TAAAA	TA,T	246	Fail	DP=10	GT:GQ:DP	1/2:12:10
+1	160	.	TAAAA	TA,T	246	Fail	DP=10	GT:GQ:DP	1/2:12:10
+2	100	.	GTTT	G	1806	q10	DP=35	GT:GQ:DP	0/1:409:35
+2	110	.	CAAA	C	1792	PASS	DP=32	GT:GQ:DP	0/1:245:32
+2	120	.	GA	G	628	q10	DP=21	GT:GQ:DP	1/1:21:21
+2	130	.	GAA	G	1016	PASS	DP=22	GT:GQ:DP	0/1:212:22
+2	140	.	GT	G	727	PASS	DP=30	GT:GQ:DP	0/1:150:30
+2	150	.	TAAAA	TA,T	246	PASS	DP=10	GT:GQ:DP	1/2:12:10
+2	160	.	TAAAA	TA,TC,T	246	PASS	DP=10	GT:GQ:DP	0/2:12:10
+3	142	.	GTTT	G	1806	q10	DP=35	GT:GQ:DP	0/1:409:35
+3	152	.	CAAA	C	1792	PASS	DP=32	GT:GQ:DP	0/1:245:32
+3	162	.	GA	G	628	q10	DP=21	GT:GQ:DP	1/1:21:21
+3	172	.	GAA	G	1016	PASS	DP=22	GT:GQ:DP	0/1:212:22
+3	182	.	GT	G	727	PASS	DP=30	GT:GQ:DP	0/1:150:30
+3	192	.	TAAAA	TA,T	246	PASS	DP=10	GT:GQ:DP	1/2:12:10
diff --git a/test/concat.1.vcf.out b/test/concat.1.vcf.out
new file mode 100644
index 0000000..8c31018
--- /dev/null
+++ b/test/concat.1.vcf.out
@@ -0,0 +1,38 @@
+##fileformat=VCFv4.0
+##FILTER=<ID=PASS,Description="All filters passed">
+##FILTER=<ID=Fail,Description="Test">
+##FILTER=<ID=q10,Description="Quality below 10">
+##INFO=<ID=XX,Number=1,Type=Integer,Description="Test">
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##contig=<ID=2,length=62435964>
+##contig=<ID=1,length=62435964>
+##samtoolsVersion=0.2.0-rc10+htslib-0.2.0-rc10
+##samtoolsCommand=samtools mpileup -t INFO/DPR -C50 -pm3 -F0.2 -d10000 -ug -r 1:1-1000000 -b mpileup.2014-07-03//lists/chr1-pooled.list -f human_g1k_v37.fasta
+##ALT=<ID=X,Description="Represents allele(s) other than observed.">
+##contig=<ID=3,length=62435964>
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A
+1	100	.	GTTT	G	1806	q10	XX=11;DP=35	GT:GQ:DP	0/1:409:35
+1	110	.	C	T,G	1792	Fail	DP=32	GT:GQ:DP	0/1:245:32
+1	110	.	CAAA	C	1792	Fail	DP=32	GT:GQ:DP	0/1:245:32
+1	120	.	GA	G	628	q10	DP=21	GT:GQ:DP	1/1:21:21
+1	130	.	G	T	1016	Fail	DP=22	GT:GQ:DP	0/1:212:22
+1	130	.	GAA	GG	1016	Fail	DP=22	GT:GQ:DP	0/1:212:22
+1	140	.	GT	G	727	PASS	DP=30	GT:GQ:DP	0/1:150:30
+1	150	.	TAAAA	TA,T	246	Fail	DP=10	GT:GQ:DP	1/2:12:10
+1	160	.	TAAAA	TA,T	246	Fail	DP=10	GT:GQ:DP	1/2:12:10
+2	100	.	GTTT	G	1806	q10	DP=35	GT:GQ:DP	0/1:409:35
+2	110	.	CAAA	C	1792	PASS	DP=32	GT:GQ:DP	0/1:245:32
+2	120	.	GA	G	628	q10	DP=21	GT:GQ:DP	1/1:21:21
+2	130	.	GAA	G	1016	PASS	DP=22	GT:GQ:DP	0/1:212:22
+2	140	.	GT	G	727	PASS	DP=30	GT:GQ:DP	0/1:150:30
+2	150	.	TAAAA	TA,T	246	PASS	DP=10	GT:GQ:DP	1/2:12:10
+2	160	.	TAAAA	TA,TC,T	246	PASS	DP=10	GT:GQ:DP	0/2:12:10
+3	142	.	GTTT	G	1806	q10	DP=35	GT:GQ:DP	0/1:409:35
+3	152	.	CAAA	C	1792	PASS	DP=32	GT:GQ:DP	0/1:245:32
+3	162	.	GA	G	628	q10	DP=21	GT:GQ:DP	1/1:21:21
+3	172	.	GAA	G	1016	PASS	DP=22	GT:GQ:DP	0/1:212:22
+3	182	.	GT	G	727	PASS	DP=30	GT:GQ:DP	0/1:150:30
+3	192	.	TAAAA	TA,T	246	PASS	DP=10	GT:GQ:DP	1/2:12:10
diff --git a/test/concat.2.a.vcf b/test/concat.2.a.vcf
new file mode 100644
index 0000000..5bdab92
--- /dev/null
+++ b/test/concat.2.a.vcf
@@ -0,0 +1,15 @@
+##fileformat=VCFv4.0
+##INFO=<ID=XX,Number=1,Type=Integer,Description="Test">
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FILTER=<ID=Fail,Description="Fail">
+##contig=<ID=1,length=62435964>
+##contig=<ID=2,length=62435964>
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A
+2	140	.	A	G	727	PASS	DP=30	GT:GQ:DP	0/1:150:30
+2	160	.	TAAAA	TA,TC,T	246	PASS	DP=10	GT:GQ:DP	0/2:12:10
+1	110	.	C	T,G	1792	Fail	XX=11;DP=32	GT:GQ:DP	0/1:245:32
+1	130	.	GAA	GG	1016	PASS	DP=22	GT:GQ:DP	0/1:212:22
+1	130	.	G	T	1016	PASS	DP=22	GT:GQ:DP	0/1:212:22
diff --git a/test/concat.2.b.vcf b/test/concat.2.b.vcf
new file mode 100644
index 0000000..4674dc2
--- /dev/null
+++ b/test/concat.2.b.vcf
@@ -0,0 +1,24 @@
+##fileformat=VCFv4.0
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FILTER=<ID=q10,Description="Quality below 10">
+##contig=<ID=1,length=62435964>
+##contig=<ID=2,length=62435964>
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A
+1	100	.	GTTT	G	1806	q10	DP=35	GT:GQ:DP	0/1:409:35
+1	110	.	CAAA	C	1792	PASS	DP=32	GT:GQ:DP	0/1:245:32
+1	120	.	GA	G	628	q10	DP=21	GT:GQ:DP	1/1:21:21
+1	130	.	G	T	1016	PASS	DP=22	GT:GQ:DP	0/1:212:22
+1	130	.	GAA	GG	1016	PASS	DP=22	GT:GQ:DP	0/1:212:22
+1	140	.	GT	G	727	PASS	DP=30	GT:GQ:DP	0/1:150:30
+1	150	.	TAAAA	TA,T	246	PASS	DP=10	GT:GQ:DP	1/2:12:10
+1	160	.	TAAAA	TA,T	246	PASS	DP=10	GT:GQ:DP	1/2:12:10
+2	100	.	GTTT	G	1806	q10	DP=35	GT:GQ:DP	0/1:409:35
+2	110	.	CAAA	C	1792	PASS	DP=32	GT:GQ:DP	0/1:245:32
+2	120	.	GA	G	628	q10	DP=21	GT:GQ:DP	1/1:21:21
+2	130	.	GAA	G	1016	PASS	DP=22	GT:GQ:DP	0/1:212:22
+2	140	.	GT	G	727	PASS	DP=30	GT:GQ:DP	0/1:150:30
+2	150	.	TAAAA	TA,T	246	PASS	DP=10	GT:GQ:DP	1/2:12:10
+2	160	.	TAAAA	TA,TC,T	246	PASS	DP=10	GT:GQ:DP	0/2:12:10
diff --git a/test/concat.2.bcf.out b/test/concat.2.bcf.out
new file mode 100644
index 0000000..384ee55
--- /dev/null
+++ b/test/concat.2.bcf.out
@@ -0,0 +1,32 @@
+##fileformat=VCFv4.0
+##FILTER=<ID=PASS,Description="All filters passed">
+##INFO=<ID=XX,Number=1,Type=Integer,Description="Test">
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FILTER=<ID=Fail,Description="Fail">
+##contig=<ID=1,length=62435964>
+##contig=<ID=2,length=62435964>
+##FILTER=<ID=q10,Description="Quality below 10">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A
+1	100	.	GTTT	G	1806	q10	DP=35	GT:GQ:DP	0/1:409:35
+1	110	.	C	T,G	1792	Fail	XX=11;DP=32	GT:GQ:DP	0/1:245:32
+1	110	.	CAAA	C	1792	PASS	DP=32	GT:GQ:DP	0/1:245:32
+1	120	.	GA	G	628	q10	DP=21	GT:GQ:DP	1/1:21:21
+1	130	.	GAA	GG	1016	PASS	DP=22	GT:GQ:DP	0/1:212:22
+1	130	.	GAA	GG	1016	PASS	DP=22	GT:GQ:DP	0/1:212:22
+1	130	.	G	T	1016	PASS	DP=22	GT:GQ:DP	0/1:212:22
+1	130	.	G	T	1016	PASS	DP=22	GT:GQ:DP	0/1:212:22
+1	140	.	GT	G	727	PASS	DP=30	GT:GQ:DP	0/1:150:30
+1	150	.	TAAAA	TA,T	246	PASS	DP=10	GT:GQ:DP	1/2:12:10
+1	160	.	TAAAA	TA,T	246	PASS	DP=10	GT:GQ:DP	1/2:12:10
+2	100	.	GTTT	G	1806	q10	DP=35	GT:GQ:DP	0/1:409:35
+2	110	.	CAAA	C	1792	PASS	DP=32	GT:GQ:DP	0/1:245:32
+2	120	.	GA	G	628	q10	DP=21	GT:GQ:DP	1/1:21:21
+2	130	.	GAA	G	1016	PASS	DP=22	GT:GQ:DP	0/1:212:22
+2	140	.	A	G	727	PASS	DP=30	GT:GQ:DP	0/1:150:30
+2	140	.	GT	G	727	PASS	DP=30	GT:GQ:DP	0/1:150:30
+2	150	.	TAAAA	TA,T	246	PASS	DP=10	GT:GQ:DP	1/2:12:10
+2	160	.	TAAAA	TA,TC,T	246	PASS	DP=10	GT:GQ:DP	0/2:12:10
+2	160	.	TAAAA	TA,TC,T	246	PASS	DP=10	GT:GQ:DP	0/2:12:10
diff --git a/test/concat.2.vcf.out b/test/concat.2.vcf.out
new file mode 100644
index 0000000..33600d1
--- /dev/null
+++ b/test/concat.2.vcf.out
@@ -0,0 +1,32 @@
+##fileformat=VCFv4.0
+##FILTER=<ID=PASS,Description="All filters passed">
+##INFO=<ID=XX,Number=1,Type=Integer,Description="Test">
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FILTER=<ID=Fail,Description="Fail">
+##contig=<ID=1,length=62435964>
+##contig=<ID=2,length=62435964>
+##FILTER=<ID=q10,Description="Quality below 10">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A
+2	100	.	GTTT	G	1806	q10	DP=35	GT:GQ:DP	0/1:409:35
+2	110	.	CAAA	C	1792	PASS	DP=32	GT:GQ:DP	0/1:245:32
+2	120	.	GA	G	628	q10	DP=21	GT:GQ:DP	1/1:21:21
+2	130	.	GAA	G	1016	PASS	DP=22	GT:GQ:DP	0/1:212:22
+2	140	.	A	G	727	PASS	DP=30	GT:GQ:DP	0/1:150:30
+2	140	.	GT	G	727	PASS	DP=30	GT:GQ:DP	0/1:150:30
+2	150	.	TAAAA	TA,T	246	PASS	DP=10	GT:GQ:DP	1/2:12:10
+2	160	.	TAAAA	TA,TC,T	246	PASS	DP=10	GT:GQ:DP	0/2:12:10
+2	160	.	TAAAA	TA,TC,T	246	PASS	DP=10	GT:GQ:DP	0/2:12:10
+1	100	.	GTTT	G	1806	q10	DP=35	GT:GQ:DP	0/1:409:35
+1	110	.	C	T,G	1792	Fail	XX=11;DP=32	GT:GQ:DP	0/1:245:32
+1	110	.	CAAA	C	1792	PASS	DP=32	GT:GQ:DP	0/1:245:32
+1	120	.	GA	G	628	q10	DP=21	GT:GQ:DP	1/1:21:21
+1	130	.	GAA	GG	1016	PASS	DP=22	GT:GQ:DP	0/1:212:22
+1	130	.	GAA	GG	1016	PASS	DP=22	GT:GQ:DP	0/1:212:22
+1	130	.	G	T	1016	PASS	DP=22	GT:GQ:DP	0/1:212:22
+1	130	.	G	T	1016	PASS	DP=22	GT:GQ:DP	0/1:212:22
+1	140	.	GT	G	727	PASS	DP=30	GT:GQ:DP	0/1:150:30
+1	150	.	TAAAA	TA,T	246	PASS	DP=10	GT:GQ:DP	1/2:12:10
+1	160	.	TAAAA	TA,T	246	PASS	DP=10	GT:GQ:DP	1/2:12:10
diff --git a/test/concat.3.0.vcf b/test/concat.3.0.vcf
new file mode 100644
index 0000000..e58a26a
--- /dev/null
+++ b/test/concat.3.0.vcf
@@ -0,0 +1,8 @@
+##fileformat=VCFv4.0
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FILTER=<ID=q10,Description="Quality below 10">
+##contig=<ID=2,length=62435964>
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B
diff --git a/test/concat.3.a.vcf b/test/concat.3.a.vcf
new file mode 100644
index 0000000..16d8da3
--- /dev/null
+++ b/test/concat.3.a.vcf
@@ -0,0 +1,27 @@
+##fileformat=VCFv4.0
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FILTER=<ID=q10,Description="Quality below 10">
+##contig=<ID=9,length=62435964>
+##contig=<ID=1,length=62435964>
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B
+9	202	.	GTTT	G	1806	q10	DP=35	GT:GQ:DP	0|1:409:35	0|1
+9	212	.	C	T,G	1792	PASS	DP=32	GT:GQ:DP	0|1:245:32	0|1
+9	212	.	CAAA	C	1792	PASS	DP=32	GT:GQ:DP	0|1:245:32	0|1
+9	222	.	GA	G	628	q10	DP=21	GT:GQ:DP	0|1:21:21	0|1
+9	232	.	G	T	1016	PASS	DP=22	GT:GQ:DP	0|1:212:22	0|1
+9	232	.	GAA	GG	1016	PASS	DP=22	GT:GQ:DP	0|1:212:22	0|1
+9	242	.	GT	G	727	PASS	DP=30	GT:GQ:DP	0|1:150:30	0|1
+9	252	.	TAAAA	TA,T	246	PASS	DP=10	GT:GQ:DP	0|1:12:10	0|1
+9	262	.	TAAAA	TA,T	246	PASS	DP=10	GT:GQ:DP	0|1:12:10	0|1
+1	100	.	GTTT	G	1806	q10	DP=35	GT:GQ:DP	0|1:409:35	0|1
+1	110	.	C	T,G	1792	PASS	DP=32	GT:GQ:DP	0|1:245:32	0|1
+1	110	.	CAAA	C	1792	PASS	DP=32	GT:GQ:DP	0|1:245:32	0|1
+1	120	.	GA	G	628	q10	DP=21	GT:GQ:DP	0|1:21:21	0|1
+1	130	.	G	T	1016	PASS	DP=22	GT:GQ:DP	0|1:212:22	0|1
+1	130	.	GAA	GG	1016	PASS	DP=22	GT:GQ:DP	0|1:212:22	0|1
+1	140	.	GT	G	727	PASS	DP=30	GT:GQ:DP	0|1:150:30	0|1
+1	150	.	TAAAA	TA,T	246	PASS	DP=10	GT:GQ:DP	0|1:12:10	0|1
+1	160	.	TAAAA	TA,T	246	PASS	DP=10	GT:GQ:DP	0|1:12:10	0|1
diff --git a/test/concat.3.b.vcf b/test/concat.3.b.vcf
new file mode 100644
index 0000000..45ee7c9
--- /dev/null
+++ b/test/concat.3.b.vcf
@@ -0,0 +1,223 @@
+##fileformat=VCFv4.0
+##INFO=<ID=T1,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T2,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T3,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T4,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T5,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T6,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T7,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T8,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T9,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T10,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T11,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T12,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T13,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T14,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T15,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T16,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T17,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T18,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T19,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T20,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T21,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T22,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T23,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T24,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T25,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T26,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T27,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T28,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T29,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T30,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T31,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T32,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T33,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T34,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T35,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T36,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T37,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T38,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T39,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T40,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T41,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T42,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T43,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T44,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T45,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T46,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T47,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T48,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T49,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T50,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T51,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T52,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T53,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T54,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T55,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T56,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T57,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T58,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T59,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T60,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T61,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T62,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T63,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T64,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T65,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T66,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T67,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T68,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T69,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T70,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T71,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T72,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T73,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T74,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T75,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T76,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T77,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T78,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T79,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T80,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T81,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T82,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T83,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T84,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T85,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T86,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T87,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T88,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T89,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T90,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T91,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T92,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T93,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T94,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T95,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T96,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T97,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T98,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T99,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T100,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T101,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T102,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T103,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T104,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T105,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T106,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T107,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T108,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T109,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T110,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T111,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T112,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T113,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T114,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T115,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T116,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T117,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T118,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T119,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T120,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T121,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T122,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T123,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T124,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T125,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T126,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T127,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T128,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T129,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T130,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T131,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T132,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T133,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T134,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T135,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T136,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T137,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T138,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T139,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T140,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T141,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T142,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T143,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T144,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T145,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T146,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T147,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T148,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T149,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T150,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T151,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T152,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T153,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T154,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T155,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T156,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T157,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T158,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T159,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T160,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T161,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T162,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T163,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T164,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T165,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T166,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T167,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T168,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T169,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T170,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T171,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T172,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T173,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T174,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T175,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T176,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T177,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T178,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T179,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T180,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T181,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T182,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T183,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T184,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T185,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T186,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T187,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T188,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T189,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T190,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T191,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T192,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T193,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T194,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T195,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T196,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T197,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T198,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T199,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FILTER=<ID=q10,Description="Quality below 10">
+##contig=<ID=2,length=62435964>
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B
+2	170	.	T	A	246	PASS	DP=10	GT	1|0	0|1
+2	180	.	T	A	246	PASS	DP=10	GT	1|0	0|1
+2	190	.	T	A	246	PASS	DP=10	GT	1|0	0|1
+2	200	.	T	A	246	PASS	DP=10	GT	1|0	0|1
+2	210	.	T	A	246	PASS	DP=10	GT	1|0	0|1
+2	220	.	T	A	246	PASS	DP=10	GT	1|0	0|1
+2	230	.	T	A	246	PASS	DP=10	GT	1|0	0|1
+2	240	.	T	A	246	PASS	DP=10	GT	1|0	0|1
+2	250	.	T	A	246	PASS	DP=10	GT	1|0	0|1
+2	260	.	T	A	246	PASS	DP=10	GT	1|0	0|1
+2	270	.	T	A	246	PASS	DP=10	GT	1|0	0|1
+2	280	.	T	A	246	PASS	DP=10	GT	1|0	0|1
+2	290	.	T	A	246	PASS	DP=10	GT	1|0	0|1
+2	300	.	T	A	246	PASS	DP=10	GT	1|0	0|1
+2	310	.	T	A	246	PASS	DP=10	GT	1|0	0|1
+2	320	.	T	A	246	PASS	DP=10	GT	1|0	0|1
diff --git a/test/concat.3.bcf.out b/test/concat.3.bcf.out
new file mode 100644
index 0000000..ff1dfd3
--- /dev/null
+++ b/test/concat.3.bcf.out
@@ -0,0 +1,269 @@
+##fileformat=VCFv4.0
+##FILTER=<ID=PASS,Description="All filters passed">
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FILTER=<ID=q10,Description="Quality below 10">
+##contig=<ID=9,length=62435964>
+##contig=<ID=1,length=62435964>
+##INFO=<ID=T1,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T2,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T3,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T4,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T5,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T6,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T7,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T8,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T9,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T10,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T11,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T12,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T13,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T14,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T15,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T16,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T17,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T18,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T19,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T20,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T21,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T22,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T23,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T24,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T25,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T26,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T27,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T28,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T29,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T30,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T31,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T32,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T33,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T34,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T35,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T36,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T37,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T38,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T39,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T40,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T41,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T42,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T43,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T44,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T45,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T46,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T47,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T48,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T49,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T50,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T51,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T52,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T53,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T54,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T55,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T56,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T57,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T58,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T59,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T60,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T61,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T62,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T63,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T64,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T65,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T66,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T67,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T68,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T69,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T70,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T71,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T72,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T73,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T74,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T75,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T76,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T77,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T78,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T79,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T80,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T81,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T82,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T83,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T84,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T85,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T86,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T87,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T88,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T89,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T90,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T91,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T92,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T93,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T94,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T95,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T96,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T97,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T98,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T99,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T100,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T101,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T102,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T103,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T104,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T105,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T106,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T107,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T108,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T109,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T110,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T111,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T112,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T113,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T114,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T115,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T116,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T117,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T118,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T119,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T120,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T121,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T122,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T123,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T124,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T125,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T126,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T127,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T128,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T129,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T130,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T131,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T132,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T133,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T134,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T135,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T136,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T137,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T138,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T139,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T140,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T141,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T142,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T143,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T144,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T145,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T146,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T147,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T148,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T149,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T150,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T151,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T152,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T153,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T154,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T155,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T156,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T157,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T158,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T159,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T160,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T161,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T162,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T163,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T164,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T165,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T166,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T167,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T168,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T169,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T170,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T171,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T172,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T173,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T174,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T175,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T176,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T177,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T178,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T179,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T180,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T181,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T182,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T183,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T184,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T185,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T186,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T187,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T188,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T189,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T190,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T191,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T192,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T193,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T194,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T195,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T196,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T197,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T198,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T199,Number=1,Type=Integer,Description="Test Tag: Big header">
+##contig=<ID=2,length=62435964>
+##contig=<ID=3,length=62435964>
+##FORMAT=<ID=PQ,Number=1,Type=Integer,Description="Phasing Quality (bigger is better)">
+##FORMAT=<ID=PS,Number=1,Type=Integer,Description="Phase Set">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B
+9	202	.	GTTT	G	1806	q10	DP=35	GT:GQ:DP:PS	0|1:409:35:202	0|1:.:.:202
+9	212	.	C	T,G	1792	PASS	DP=32	GT:GQ:DP:PS	0|1:245:32:202	0|1:.:.:202
+9	212	.	CAAA	C	1792	PASS	DP=32	GT:GQ:DP:PS	0|1:245:32:202	0|1:.:.:202
+9	222	.	GA	G	628	q10	DP=21	GT:GQ:DP:PS	0|1:21:21:202	0|1:.:.:202
+9	232	.	G	T	1016	PASS	DP=22	GT:GQ:DP:PS	0|1:212:22:202	0|1:.:.:202
+9	232	.	GAA	GG	1016	PASS	DP=22	GT:GQ:DP:PS	0|1:212:22:202	0|1:.:.:202
+9	242	.	GT	G	727	PASS	DP=30	GT:GQ:DP:PS	0|1:150:30:202	0|1:.:.:202
+9	252	.	TAAAA	TA,T	246	PASS	DP=10	GT:GQ:DP:PS	0|1:12:10:202	0|1:.:.:202
+9	262	.	TAAAA	TA,T	246	PASS	DP=10	GT:GQ:DP:PS	0|1:12:10:202	0|1:.:.:202
+1	100	.	GTTT	G	1806	q10	DP=35	GT:GQ:DP:PS	0|1:409:35:100	0|1:.:.:100
+1	110	.	C	T,G	1792	PASS	DP=32	GT:GQ:DP:PS	0|1:245:32:100	0|1:.:.:100
+1	110	.	CAAA	C	1792	PASS	DP=32	GT:GQ:DP:PS	0|1:245:32:100	0|1:.:.:100
+1	120	.	GA	G	628	q10	DP=21	GT:GQ:DP:PS	0|1:21:21:100	0|1:.:.:100
+1	130	.	G	T	1016	PASS	DP=22	GT:GQ:DP:PS	0|1:212:22:100	0|1:.:.:100
+1	130	.	GAA	GG	1016	PASS	DP=22	GT:GQ:DP:PS	0|1:212:22:100	0|1:.:.:100
+1	140	.	GT	G	727	PASS	DP=30	GT:GQ:DP:PS	0|1:150:30:100	0|1:.:.:100
+1	150	.	TAAAA	TA,T	246	PASS	DP=10	GT:GQ:DP:PS	0|1:12:10:100	0|1:.:.:100
+1	160	.	TAAAA	TA,T	246	PASS	DP=10	GT:GQ:DP:PS	0|1:12:10:100	0|1:.:.:100
+2	170	.	T	A	246	PASS	DP=10	GT:PS	1|0:170	0|1:170
+2	180	.	T	A	246	PASS	DP=10	GT:PS	1|0:170	0|1:170
+2	190	.	T	A	246	PASS	DP=10	GT:PS	1|0:170	0|1:170
+2	200	.	T	A	246	PASS	DP=10	GT:PS	1|0:170	0|1:170
+2	210	.	T	A	246	PASS	DP=10	GT:PS	1|0:170	0|1:170
+2	220	.	T	A	246	PASS	DP=10	GT:PS	1|0:170	0|1:170
+2	230	.	T	A	246	PASS	DP=10	GT:PS	1|0:170	0|1:170
+2	240	.	T	A	246	PASS	DP=10	GT:PS	1|0:170	0|1:170
+2	250	.	T	A	246	PASS	DP=10	GT:PS	1|0:170	0|1:170
+2	260	.	T	A	246	PASS	DP=10	GT:PS	1|0:170	0|1:170
+2	270	.	T	A	246	PASS	DP=10	GT:PS	1|0:170	0|1:170
+2	280	.	T	A	246	PASS	DP=10	GT:PS	1|0:170	0|1:170
+2	290	.	T	A	246	PASS	DP=10	GT:PS	1|0:170	0|1:170
+2	300	.	T	A	246	PASS	DP=10	GT:PS	1|0:170	0|1:170
+2	310	.	T	A	246	PASS	DP=10	GT:PQ:PS	1|0:3:310	0|1:28:310
+2	320	.	T	A	246	PASS	DP=10	GT:PS	1|0:310	0|1:310
+2	330	.	T	A	246	PASS	DP=10	GT:PS	1|0:310	0|1:310
+2	340	.	T	A	246	PASS	DP=10	GT:PS	1|0:310	0|1:310
+2	350	.	T	A	246	PASS	DP=10	GT:PS	1|0:310	0|1:310
+2	360	.	T	A	246	PASS	DP=10	GT:PS	1|0:310	0|1:310
+2	370	.	T	A	246	PASS	DP=10	GT:PQ:PS	1|0:99:310	0|1:99:310
+2	380	.	T	A	246	PASS	DP=10	GT:PS	1|0:310	0|1:310
+2	390	.	T	A	246	PASS	DP=10	GT:PS	1|0:310	0|1:310
+2	490	.	T	A	246	PASS	DP=10	GT:PS	1|0:310	0|1:310
+2	500	.	T	A	246	PASS	DP=10	GT:PS	1|0:310	0|1:310
+2	510	.	T	A	246	PASS	DP=10	GT:PQ:PS	1|0:99:310	0|1:99:310
+3	380	.	T	A	246	PASS	DP=10	GT:PS	0|1:380	1|0:380
+3	390	.	T	A	246	PASS	DP=10	GT:PS	0|1:380	1|0:380
+3	400	.	T	A	246	PASS	DP=10	GT:PS	0|1:380	1|0:380
+3	410	.	T	A	246	PASS	DP=10	GT:PS	0|1:380	1|0:380
+3	420	.	T	A	246	PASS	DP=10	GT:PS	0|1:380	1|0:380
+3	430	.	T	A	246	PASS	DP=10	GT:PS	0|1:380	1|0:380
+3	440	.	T	A	246	PASS	DP=10	GT:PS	0|1:380	1|0:380
+3	450	.	T	A	246	PASS	DP=10	GT:PS	0|1:380	1|0:380
+3	460	.	T	A	246	PASS	DP=10	GT:PS	0|1:380	1|0:380
+3	470	.	T	A	246	PASS	DP=10	GT:PS	0|1:380	1|0:380
+3	480	.	T	A	246	PASS	DP=10	GT:PS	0|1:380	1|0:380
+3	490	.	T	A	246	PASS	DP=10	GT:PS	0|1:380	1|0:380
diff --git a/test/concat.3.c.vcf b/test/concat.3.c.vcf
new file mode 100644
index 0000000..6b436dd
--- /dev/null
+++ b/test/concat.3.c.vcf
@@ -0,0 +1,22 @@
+##fileformat=VCFv4.0
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FILTER=<ID=q10,Description="Quality below 10">
+##contig=<ID=2,length=62435964>
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B
+2	280	.	T	A	246	PASS	DP=10	GT	1|0	0|1
+2	290	.	T	A	246	PASS	DP=10	GT	1|0	1|0
+2	300	.	T	A	246	PASS	DP=10	GT	0|1	1|0
+2	310	.	T	A	246	PASS	DP=10	GT	0|1	1|0
+2	320	.	T	A	246	PASS	DP=10	GT	0|1	1|0
+2	330	.	T	A	246	PASS	DP=10	GT	0|1	1|0
+2	340	.	T	A	246	PASS	DP=10	GT	0|1	1|0
+2	350	.	T	A	246	PASS	DP=10	GT	0|1	1|0
+2	360	.	T	A	246	PASS	DP=10	GT	0|1	1|0
+2	370	.	T	A	246	PASS	DP=10	GT	0|1	1|0
+2	380	.	T	A	246	PASS	DP=10	GT	0|1	1|0
+2	390	.	T	A	246	PASS	DP=10	GT	0|1	1|0
+2	400	.	T	A	246	PASS	DP=10	GT	0|1	1|0
+2	410	.	T	A	246	PASS	DP=10	GT	0|1	1|0
diff --git a/test/concat.3.d.vcf b/test/concat.3.d.vcf
new file mode 100644
index 0000000..3e0f9f4
--- /dev/null
+++ b/test/concat.3.d.vcf
@@ -0,0 +1,20 @@
+##fileformat=VCFv4.0
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FILTER=<ID=q10,Description="Quality below 10">
+##contig=<ID=2,length=62435964>
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B
+2	300	.	T	A	246	PASS	DP=10	GT	1|0	1|0
+2	320	.	T	A	246	PASS	DP=10	GT	1|0	1|0
+2	330	.	T	A	246	PASS	DP=10	GT	1|0	1|0
+2	340	.	T	A	246	PASS	DP=10	GT	1|0	1|0
+2	350	.	T	A	246	PASS	DP=10	GT	1|0	1|0
+2	360	.	T	A	246	PASS	DP=10	GT	1|0	1|0
+2	370	.	T	A	246	PASS	DP=10	GT	1|0	1|0
+2	380	.	T	A	246	PASS	DP=10	GT	1|0	1|0
+2	390	.	T	A	246	PASS	DP=10	GT	1|0	1|0
+2	490	.	T	A	246	PASS	DP=10	GT	1|0	1|0
+2	500	.	T	A	246	PASS	DP=10	GT	1|0	1|0
+2	510	.	T	A	246	PASS	DP=10	GT	1|0	1|0
diff --git a/test/concat.3.e.vcf b/test/concat.3.e.vcf
new file mode 100644
index 0000000..380cb99
--- /dev/null
+++ b/test/concat.3.e.vcf
@@ -0,0 +1,20 @@
+##fileformat=VCFv4.0
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FILTER=<ID=q10,Description="Quality below 10">
+##contig=<ID=2,length=62435964>
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B
+2	310	.	T	A	246	PASS	DP=10	GT	0|1	0|1
+2	320	.	T	A	246	PASS	DP=10	GT	0|1	0|1
+2	330	.	T	A	246	PASS	DP=10	GT	0|1	0|1
+2	340	.	T	A	246	PASS	DP=10	GT	0|1	0|1
+2	350	.	T	A	246	PASS	DP=10	GT	0|1	0|1
+2	360	.	T	A	246	PASS	DP=10	GT	0|1	0|1
+2	370	.	T	A	246	PASS	DP=10	GT	0|1	0|1
+2	380	.	T	A	246	PASS	DP=10	GT	0|1	0|1
+2	390	.	T	A	246	PASS	DP=10	GT	0|1	0|1
+2	490	.	T	A	246	PASS	DP=10	GT	0|1	0|1
+2	500	.	T	A	246	PASS	DP=10	GT	0|1	0|1
+2	510	.	T	A	246	PASS	DP=10	GT	0|1	0|1
diff --git a/test/concat.3.f.vcf b/test/concat.3.f.vcf
new file mode 100644
index 0000000..0e44436
--- /dev/null
+++ b/test/concat.3.f.vcf
@@ -0,0 +1,20 @@
+##fileformat=VCFv4.0
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FILTER=<ID=q10,Description="Quality below 10">
+##contig=<ID=3,length=62435964>
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B
+3	380	.	T	A	246	PASS	DP=10	GT	1|0	1|0
+3	390	.	T	A	246	PASS	DP=10	GT	1|0	1|0
+3	400	.	T	A	246	PASS	DP=10	GT	1|0	1|0
+3	410	.	T	A	246	PASS	DP=10	GT	1|0	1|0
+3	420	.	T	A	246	PASS	DP=10	GT	1|0	1|0
+3	430	.	T	A	246	PASS	DP=10	GT	1|0	1|0
+3	440	.	T	A	246	PASS	DP=10	GT	1|0	1|0
+3	450	.	T	A	246	PASS	DP=10	GT	1|0	1|0
+3	460	.	T	A	246	PASS	DP=10	GT	1|0	1|0
+3	470	.	T	A	246	PASS	DP=10	GT	1|0	1|0
+3	480	.	T	A	246	PASS	DP=10	GT	1|0	1|0
+3	490	.	T	A	246	PASS	DP=10	GT	1|0	1|0
diff --git a/test/concat.3.vcf.out b/test/concat.3.vcf.out
new file mode 100644
index 0000000..ff1dfd3
--- /dev/null
+++ b/test/concat.3.vcf.out
@@ -0,0 +1,269 @@
+##fileformat=VCFv4.0
+##FILTER=<ID=PASS,Description="All filters passed">
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FILTER=<ID=q10,Description="Quality below 10">
+##contig=<ID=9,length=62435964>
+##contig=<ID=1,length=62435964>
+##INFO=<ID=T1,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T2,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T3,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T4,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T5,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T6,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T7,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T8,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T9,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T10,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T11,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T12,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T13,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T14,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T15,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T16,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T17,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T18,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T19,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T20,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T21,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T22,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T23,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T24,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T25,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T26,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T27,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T28,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T29,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T30,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T31,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T32,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T33,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T34,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T35,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T36,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T37,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T38,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T39,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T40,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T41,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T42,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T43,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T44,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T45,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T46,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T47,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T48,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T49,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T50,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T51,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T52,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T53,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T54,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T55,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T56,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T57,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T58,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T59,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T60,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T61,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T62,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T63,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T64,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T65,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T66,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T67,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T68,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T69,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T70,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T71,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T72,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T73,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T74,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T75,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T76,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T77,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T78,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T79,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T80,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T81,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T82,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T83,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T84,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T85,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T86,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T87,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T88,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T89,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T90,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T91,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T92,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T93,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T94,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T95,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T96,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T97,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T98,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T99,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T100,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T101,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T102,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T103,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T104,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T105,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T106,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T107,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T108,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T109,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T110,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T111,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T112,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T113,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T114,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T115,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T116,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T117,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T118,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T119,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T120,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T121,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T122,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T123,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T124,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T125,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T126,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T127,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T128,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T129,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T130,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T131,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T132,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T133,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T134,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T135,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T136,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T137,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T138,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T139,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T140,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T141,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T142,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T143,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T144,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T145,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T146,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T147,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T148,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T149,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T150,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T151,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T152,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T153,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T154,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T155,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T156,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T157,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T158,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T159,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T160,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T161,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T162,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T163,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T164,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T165,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T166,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T167,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T168,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T169,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T170,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T171,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T172,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T173,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T174,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T175,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T176,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T177,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T178,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T179,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T180,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T181,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T182,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T183,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T184,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T185,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T186,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T187,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T188,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T189,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T190,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T191,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T192,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T193,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T194,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T195,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T196,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T197,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T198,Number=1,Type=Integer,Description="Test Tag: Big header">
+##INFO=<ID=T199,Number=1,Type=Integer,Description="Test Tag: Big header">
+##contig=<ID=2,length=62435964>
+##contig=<ID=3,length=62435964>
+##FORMAT=<ID=PQ,Number=1,Type=Integer,Description="Phasing Quality (bigger is better)">
+##FORMAT=<ID=PS,Number=1,Type=Integer,Description="Phase Set">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B
+9	202	.	GTTT	G	1806	q10	DP=35	GT:GQ:DP:PS	0|1:409:35:202	0|1:.:.:202
+9	212	.	C	T,G	1792	PASS	DP=32	GT:GQ:DP:PS	0|1:245:32:202	0|1:.:.:202
+9	212	.	CAAA	C	1792	PASS	DP=32	GT:GQ:DP:PS	0|1:245:32:202	0|1:.:.:202
+9	222	.	GA	G	628	q10	DP=21	GT:GQ:DP:PS	0|1:21:21:202	0|1:.:.:202
+9	232	.	G	T	1016	PASS	DP=22	GT:GQ:DP:PS	0|1:212:22:202	0|1:.:.:202
+9	232	.	GAA	GG	1016	PASS	DP=22	GT:GQ:DP:PS	0|1:212:22:202	0|1:.:.:202
+9	242	.	GT	G	727	PASS	DP=30	GT:GQ:DP:PS	0|1:150:30:202	0|1:.:.:202
+9	252	.	TAAAA	TA,T	246	PASS	DP=10	GT:GQ:DP:PS	0|1:12:10:202	0|1:.:.:202
+9	262	.	TAAAA	TA,T	246	PASS	DP=10	GT:GQ:DP:PS	0|1:12:10:202	0|1:.:.:202
+1	100	.	GTTT	G	1806	q10	DP=35	GT:GQ:DP:PS	0|1:409:35:100	0|1:.:.:100
+1	110	.	C	T,G	1792	PASS	DP=32	GT:GQ:DP:PS	0|1:245:32:100	0|1:.:.:100
+1	110	.	CAAA	C	1792	PASS	DP=32	GT:GQ:DP:PS	0|1:245:32:100	0|1:.:.:100
+1	120	.	GA	G	628	q10	DP=21	GT:GQ:DP:PS	0|1:21:21:100	0|1:.:.:100
+1	130	.	G	T	1016	PASS	DP=22	GT:GQ:DP:PS	0|1:212:22:100	0|1:.:.:100
+1	130	.	GAA	GG	1016	PASS	DP=22	GT:GQ:DP:PS	0|1:212:22:100	0|1:.:.:100
+1	140	.	GT	G	727	PASS	DP=30	GT:GQ:DP:PS	0|1:150:30:100	0|1:.:.:100
+1	150	.	TAAAA	TA,T	246	PASS	DP=10	GT:GQ:DP:PS	0|1:12:10:100	0|1:.:.:100
+1	160	.	TAAAA	TA,T	246	PASS	DP=10	GT:GQ:DP:PS	0|1:12:10:100	0|1:.:.:100
+2	170	.	T	A	246	PASS	DP=10	GT:PS	1|0:170	0|1:170
+2	180	.	T	A	246	PASS	DP=10	GT:PS	1|0:170	0|1:170
+2	190	.	T	A	246	PASS	DP=10	GT:PS	1|0:170	0|1:170
+2	200	.	T	A	246	PASS	DP=10	GT:PS	1|0:170	0|1:170
+2	210	.	T	A	246	PASS	DP=10	GT:PS	1|0:170	0|1:170
+2	220	.	T	A	246	PASS	DP=10	GT:PS	1|0:170	0|1:170
+2	230	.	T	A	246	PASS	DP=10	GT:PS	1|0:170	0|1:170
+2	240	.	T	A	246	PASS	DP=10	GT:PS	1|0:170	0|1:170
+2	250	.	T	A	246	PASS	DP=10	GT:PS	1|0:170	0|1:170
+2	260	.	T	A	246	PASS	DP=10	GT:PS	1|0:170	0|1:170
+2	270	.	T	A	246	PASS	DP=10	GT:PS	1|0:170	0|1:170
+2	280	.	T	A	246	PASS	DP=10	GT:PS	1|0:170	0|1:170
+2	290	.	T	A	246	PASS	DP=10	GT:PS	1|0:170	0|1:170
+2	300	.	T	A	246	PASS	DP=10	GT:PS	1|0:170	0|1:170
+2	310	.	T	A	246	PASS	DP=10	GT:PQ:PS	1|0:3:310	0|1:28:310
+2	320	.	T	A	246	PASS	DP=10	GT:PS	1|0:310	0|1:310
+2	330	.	T	A	246	PASS	DP=10	GT:PS	1|0:310	0|1:310
+2	340	.	T	A	246	PASS	DP=10	GT:PS	1|0:310	0|1:310
+2	350	.	T	A	246	PASS	DP=10	GT:PS	1|0:310	0|1:310
+2	360	.	T	A	246	PASS	DP=10	GT:PS	1|0:310	0|1:310
+2	370	.	T	A	246	PASS	DP=10	GT:PQ:PS	1|0:99:310	0|1:99:310
+2	380	.	T	A	246	PASS	DP=10	GT:PS	1|0:310	0|1:310
+2	390	.	T	A	246	PASS	DP=10	GT:PS	1|0:310	0|1:310
+2	490	.	T	A	246	PASS	DP=10	GT:PS	1|0:310	0|1:310
+2	500	.	T	A	246	PASS	DP=10	GT:PS	1|0:310	0|1:310
+2	510	.	T	A	246	PASS	DP=10	GT:PQ:PS	1|0:99:310	0|1:99:310
+3	380	.	T	A	246	PASS	DP=10	GT:PS	0|1:380	1|0:380
+3	390	.	T	A	246	PASS	DP=10	GT:PS	0|1:380	1|0:380
+3	400	.	T	A	246	PASS	DP=10	GT:PS	0|1:380	1|0:380
+3	410	.	T	A	246	PASS	DP=10	GT:PS	0|1:380	1|0:380
+3	420	.	T	A	246	PASS	DP=10	GT:PS	0|1:380	1|0:380
+3	430	.	T	A	246	PASS	DP=10	GT:PS	0|1:380	1|0:380
+3	440	.	T	A	246	PASS	DP=10	GT:PS	0|1:380	1|0:380
+3	450	.	T	A	246	PASS	DP=10	GT:PS	0|1:380	1|0:380
+3	460	.	T	A	246	PASS	DP=10	GT:PS	0|1:380	1|0:380
+3	470	.	T	A	246	PASS	DP=10	GT:PS	0|1:380	1|0:380
+3	480	.	T	A	246	PASS	DP=10	GT:PS	0|1:380	1|0:380
+3	490	.	T	A	246	PASS	DP=10	GT:PS	0|1:380	1|0:380
diff --git a/test/concat.4.bcf.out b/test/concat.4.bcf.out
new file mode 100644
index 0000000..48166fc
--- /dev/null
+++ b/test/concat.4.bcf.out
@@ -0,0 +1,29 @@
+##fileformat=VCFv4.0
+##FILTER=<ID=PASS,Description="All filters passed">
+##INFO=<ID=XX,Number=1,Type=Integer,Description="Test">
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FILTER=<ID=Fail,Description="Fail">
+##contig=<ID=1,length=62435964>
+##contig=<ID=2,length=62435964>
+##FILTER=<ID=q10,Description="Quality below 10">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A
+1	100	.	GTTT	G	1806	q10	DP=35	GT:GQ:DP	0/1:409:35
+1	110	.	C	T,G	1792	Fail	XX=11;DP=32	GT:GQ:DP	0/1:245:32
+1	110	.	CAAA	C	1792	PASS	DP=32	GT:GQ:DP	0/1:245:32
+1	120	.	GA	G	628	q10	DP=21	GT:GQ:DP	1/1:21:21
+1	130	.	GAA	GG	1016	PASS	DP=22	GT:GQ:DP	0/1:212:22
+1	130	.	G	T	1016	PASS	DP=22	GT:GQ:DP	0/1:212:22
+1	140	.	GT	G	727	PASS	DP=30	GT:GQ:DP	0/1:150:30
+1	150	.	TAAAA	TA,T	246	PASS	DP=10	GT:GQ:DP	1/2:12:10
+1	160	.	TAAAA	TA,T	246	PASS	DP=10	GT:GQ:DP	1/2:12:10
+2	100	.	GTTT	G	1806	q10	DP=35	GT:GQ:DP	0/1:409:35
+2	110	.	CAAA	C	1792	PASS	DP=32	GT:GQ:DP	0/1:245:32
+2	120	.	GA	G	628	q10	DP=21	GT:GQ:DP	1/1:21:21
+2	130	.	GAA	G	1016	PASS	DP=22	GT:GQ:DP	0/1:212:22
+2	140	.	A	G	727	PASS	DP=30	GT:GQ:DP	0/1:150:30
+2	140	.	GT	G	727	PASS	DP=30	GT:GQ:DP	0/1:150:30
+2	150	.	TAAAA	TA,T	246	PASS	DP=10	GT:GQ:DP	1/2:12:10
+2	160	.	TAAAA	TA,TC,T	246	PASS	DP=10	GT:GQ:DP	0/2:12:10
diff --git a/test/concat.4.vcf.out b/test/concat.4.vcf.out
new file mode 100644
index 0000000..a1553bc
--- /dev/null
+++ b/test/concat.4.vcf.out
@@ -0,0 +1,29 @@
+##fileformat=VCFv4.0
+##FILTER=<ID=PASS,Description="All filters passed">
+##INFO=<ID=XX,Number=1,Type=Integer,Description="Test">
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FILTER=<ID=Fail,Description="Fail">
+##contig=<ID=1,length=62435964>
+##contig=<ID=2,length=62435964>
+##FILTER=<ID=q10,Description="Quality below 10">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A
+2	100	.	GTTT	G	1806	q10	DP=35	GT:GQ:DP	0/1:409:35
+2	110	.	CAAA	C	1792	PASS	DP=32	GT:GQ:DP	0/1:245:32
+2	120	.	GA	G	628	q10	DP=21	GT:GQ:DP	1/1:21:21
+2	130	.	GAA	G	1016	PASS	DP=22	GT:GQ:DP	0/1:212:22
+2	140	.	A	G	727	PASS	DP=30	GT:GQ:DP	0/1:150:30
+2	140	.	GT	G	727	PASS	DP=30	GT:GQ:DP	0/1:150:30
+2	150	.	TAAAA	TA,T	246	PASS	DP=10	GT:GQ:DP	1/2:12:10
+2	160	.	TAAAA	TA,TC,T	246	PASS	DP=10	GT:GQ:DP	0/2:12:10
+1	100	.	GTTT	G	1806	q10	DP=35	GT:GQ:DP	0/1:409:35
+1	110	.	C	T,G	1792	Fail	XX=11;DP=32	GT:GQ:DP	0/1:245:32
+1	110	.	CAAA	C	1792	PASS	DP=32	GT:GQ:DP	0/1:245:32
+1	120	.	GA	G	628	q10	DP=21	GT:GQ:DP	1/1:21:21
+1	130	.	GAA	GG	1016	PASS	DP=22	GT:GQ:DP	0/1:212:22
+1	130	.	G	T	1016	PASS	DP=22	GT:GQ:DP	0/1:212:22
+1	140	.	GT	G	727	PASS	DP=30	GT:GQ:DP	0/1:150:30
+1	150	.	TAAAA	TA,T	246	PASS	DP=10	GT:GQ:DP	1/2:12:10
+1	160	.	TAAAA	TA,T	246	PASS	DP=10	GT:GQ:DP	1/2:12:10
diff --git a/test/consensus.1.chain b/test/consensus.1.chain
new file mode 100644
index 0000000..2aef343
--- /dev/null
+++ b/test/consensus.1.chain
@@ -0,0 +1,12 @@
+chain 497 1 501 + 1 501 1 502 + 1 502 1
+11 3 1
+1 0 3
+485
+
+chain 485 2 501 + 0 501 2 495 + 0 495 2
+61 3 1
+54 3 1
+58 0 8
+21 10 0
+291
+
diff --git a/test/consensus.1.out b/test/consensus.1.out
new file mode 100644
index 0000000..df1a7c4
--- /dev/null
+++ b/test/consensus.1.out
@@ -0,0 +1,20 @@
+>1:2-501
+TACAAAATATGATAAAATCAAAAAGAACATAACCTACGTATCAACTAAAGTGGTTGTTTG
+AAGAAAAGGAAGACTTAAAAAGAGTCAGTACTAACCTACATAATATATACAATGTTCATT
+AAATAATAAAATGAGCTCATCATACTTAGGTCATCATAAATATATCTGAAATTCACAAAT
+ATTGATCAAATGGTAAAATAGACAAGTAGATTTTAATAGGTTAAACAATTACTGATTCTC
+TTGAAAGAATAAATTTAATATGAGACCTATTTCATTATAATGAACTCACAAATTAGAAAC
+TTCACACTGGGGGCTGGAGAGATGGCTCAGTAGTTAAGAACACTGACTGCTCTTCTGAAG
+GTCCTGAGTTCAAATCCCAGCAACCACATGGTGACTTACAACCATCTGTAATGACATCTG
+NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
+TTTAAAAACAAAAAAAAAGAA
+>2
+NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
+AAATTAGTGATTTTCCATATTCTTTAAGTCATTTTAGAGTAATGTGTTCTTAAGATTTCA
+GAAAAACAAAAACTTGTGCTTTCCTGTTTGAAAAACAAACAGCTGTGGGGAATGGACGTA
+CGTTGTCGGGACAGCCTTTTTATAAAATAATGTTGAGGCTTTGATACGTCAAAGNNNNNN
+NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNTTTGCT
+GCTGCCAATGACAGCACACCCTGGGAATGCCCCAACTACTTACTACAAAGCAGTGTTACA
+TGGAGAAGATCTTCAAGAGTCTTTTTGCTAGATCTTTCCTTGGCTTTTGATGTGACTCCT
+CTCAATAAAATCCACAGTAATATAGTGAGTGGTCTCCTGCTCCAAACCAGTATTCCAGAC
+ACAGTTAATCCAGAC
diff --git a/test/consensus.2.chain b/test/consensus.2.chain
new file mode 100644
index 0000000..b98f99b
--- /dev/null
+++ b/test/consensus.2.chain
@@ -0,0 +1,8 @@
+chain 500 1 501 + 1 501 1 504 + 1 504 1
+15 0 3
+485
+
+chain 491 2 501 + 0 501 2 491 + 0 491 2
+200 10 0
+291
+
diff --git a/test/consensus.2.out b/test/consensus.2.out
new file mode 100644
index 0000000..392ff77
--- /dev/null
+++ b/test/consensus.2.out
@@ -0,0 +1,20 @@
+>1:2-501
+TACCATATGTGACATAAAATAAAAAAGAACATAACCTACGTATCAACTAAAGTGGTTGTT
+TGCAGAAAAGGAAGACTTAAAAAGAGTCAGTACTAACCTACATAATATATACAATGTTCA
+TTAAATAATAAAATGAGCTCATCATACTTAGGTCATCATAAATATATCTGAAATTCACAA
+ATATTGATCAAATGGTAAAATAGACAAGTAGATTTTAATAGGTTAAACAATTACTGATTC
+TCTTGAAAGAATAAATTTAATATGAGACCTATTTCATTATAATGAACTCACAAATTAGAA
+ACTTCACACTGGGGGCTGGAGAGATGGCTCAGTAGTTAAGAACACTGACTGCTCTTCTGA
+AGGTCCTGAGTTCAAATCCCAGCAACCACATGGTGACTTACAACCATCTGTAATGACATC
+TGNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
+NNTTTAAAAACAAAAAAAAAGAA
+>2
+NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
+AGAGATTAGTGATTTTCCATATTCTTTAAGTCATTTTAGAGTAATGTGTTCTTAAGATAA
+ATCAGAAAAACAAAAACTTGTGCTTTCCTGTTTGAAAAACAAACAGCTGTGGGGAATGGT
+GTCGGGACAGCCTTTTTATAAAATAATGTTGAGGCTTTGATACGTCAAAGNNNNNNNNNN
+NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNTTTGCTGCTG
+CCAATGACAGCACACCCTGGGAATGCCCCAACTACTTACTACAAAGCAGTGTTACATGGA
+GAAGATCTTCAAGAGTCTTTTTGCTAGATCTTTCCTTGGCTTTTGATGTGACTCCTCTCA
+ATAAAATCCACAGTAATATAGTGAGTGGTCTCCTGCTCCAAACCAGTATTTCAGACACAG
+TTAATCCAGAC
diff --git a/test/consensus.3.chain b/test/consensus.3.chain
new file mode 100644
index 0000000..2aef343
--- /dev/null
+++ b/test/consensus.3.chain
@@ -0,0 +1,12 @@
+chain 497 1 501 + 1 501 1 502 + 1 502 1
+11 3 1
+1 0 3
+485
+
+chain 485 2 501 + 0 501 2 495 + 0 495 2
+61 3 1
+54 3 1
+58 0 8
+21 10 0
+291
+
diff --git a/test/consensus.3.out b/test/consensus.3.out
new file mode 100644
index 0000000..b3bfc3f
--- /dev/null
+++ b/test/consensus.3.out
@@ -0,0 +1,20 @@
+>1:2-501
+TACMAWATRTGATAAAATMAAAAAGAACATAACCTACGTATCAACTAAAGTGGTTGTTTG
+MAGAAAAGGAAGACTTAAAAAGAGTCAGTACTAACCTACATAATATATACAATGTTCATT
+AAATAATAAAATGAGCTCATCATACTTAGGTCATCATAAATATATCTGAAATTCACAAAT
+ATTGATCAAATGGTAAAATAGACAAGTAGATTTTAATAGGTTAAACAATTACTGATTCTC
+TTGAAAGAATAAATTTAATATGAGACCTATTTCATTATAATGAACTCACAAATTAGAAAC
+TTCACACTGGGGGCTGGAGAGATGGCTCAGTAGTTAAGAACACTGACTGCTCTTCTGAAG
+GTCCTGAGTTCAAATCCCAGCAACCACATGGTGACTTACAACCATCTGTAATGACATCTG
+NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
+TTTAAAAACAAAAAAAAAGAA
+>2
+NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
+AAATTAGTGATTTTCCATATTCTTTAAGTCATTTTAGAGTAATGTGTTCTTAAGATTTCA
+GAAAAACAAAAACTTGTGCTTTCCTGTTTGAAAAACAAACAGCTGTGGGGAATGGACGTA
+CGTTGTCGGGACAGCCTTTTTATAAAATAATGTTGAGGCTTTGATACGTCAAAGNNNNNN
+NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNTTTGCT
+GCTGCCAATGACAGCACACCCTGGGAATGCCCCAACTACTTACTACAAAGCAGTGTTACA
+TGGAGAAGATCTTCAAGAGTCTTTTTGCTAGATCTTTCCTTGGCTTTTGATGTGACTCCT
+CTCAATAAAATCCACAGTAATATAGTGAGTGGTCTCCTGCTCCAAACCAGTATTYCAGAC
+ACAGTTAATCCAGAC
diff --git a/test/consensus.4.chain b/test/consensus.4.chain
new file mode 100644
index 0000000..b98f99b
--- /dev/null
+++ b/test/consensus.4.chain
@@ -0,0 +1,8 @@
+chain 500 1 501 + 1 501 1 504 + 1 504 1
+15 0 3
+485
+
+chain 491 2 501 + 0 501 2 491 + 0 491 2
+200 10 0
+291
+
diff --git a/test/consensus.4.out b/test/consensus.4.out
new file mode 100644
index 0000000..c3983f8
--- /dev/null
+++ b/test/consensus.4.out
@@ -0,0 +1,20 @@
+>1:2-501
+TACCATATGTGACATAAAATAAAAAAGAACATAACCTACGTATCAACTAAAGTGGTTGTT
+TGCAGAAAAGGAAGACTTAAAAAGAGTCAGTACTAACCTACATAATATATACAATGTTCA
+TTAAATAATAAAATGAGCTCATCATACTTAGGTCATCATAAATATATCTGAAATTCACAA
+ATATTGATCAAATGGTAAAATAGACAAGTAGATTTTAATAGGTTAAACAATTACTGATTC
+TCTTGAAAGAATAAATTTAATATGAGACCTATTTCATTATAATGAACTCACAAATTAGAA
+ACTTCACACTGGGGGCTGGAGAGATGGCTCAGTAGTTAAGAACACTGACTGCTCTTCTGA
+AGGTCCTGAGTTCAAATCCCAGCAACCACATGGTGACTTACAACCATCTGTAATGACATC
+TGATGCCCTCTGGTGTGTCTGAAGACAGCTACAGTGTACTTACATAAAATAATAAATAAA
+TCTTTAAAAACAAAAAAAAAGAA
+>2
+GAAGATCTTTTCCTTATTAAGGATCTGAAGCTCTGTAGATTTGTATTCTATTAAACATGG
+AGAGATTAGTGATTTTCCATATTCTTTAAGTCATTTTAGAGTAATGTGTTCTTAAGATAA
+ATCAGAAAAACAAAAACTTGTGCTTTCCTGTTTGAAAAACAAACAGCTGTGGGGAATGGT
+GTCGGGACAGCCTTTTTATAAAATAATGTTGAGGCTTTGATACGTCAAAGTTATATTTCA
+AATGGAATCACTTAGACCTCGTTTCTGAGTGTCAATGGCCATATTGGGGATTTGCTGCTG
+CCAATGACAGCACACCCTGGGAATGCCCCAACTACTTACTACAAAGCAGTGTTACATGGA
+GAAGATCTTCAAGAGTCTTTTTGCTAGATCTTTCCTTGGCTTTTGATGTGACTCCTCTCA
+ATAAAATCCACAGTAATATAGTGAGTGGTCTCCTGCTCCAAACCAGTATTTCAGACACAG
+TTAATCCAGAC
diff --git a/test/consensus.fa b/test/consensus.fa
new file mode 100644
index 0000000..5522e02
--- /dev/null
+++ b/test/consensus.fa
@@ -0,0 +1,20 @@
+>1:2-501
+TACCATATGTGACATATAAAAAAGAACATAACCTACGTATCAACTAAAGTGGTTGTTTG
+CAGAAAAGGAAGACTTAAAAAGAGTCAGTACTAACCTACATAATATATACAATGTTCATT
+AAATAATAAAATGAGCTCATCATACTTAGGTCATCATAAATATATCTGAAATTCACAAAT
+ATTGATCAAATGGTAAAATAGACAAGTAGATTTTAATAGGTTAAACAATTACTGATTCTC
+TTGAAAGAATAAATTTAATATGAGACCTATTTCATTATAATGAACTCACAAATTAGAAAC
+TTCACACTGGGGGCTGGAGAGATGGCTCAGTAGTTAAGAACACTGACTGCTCTTCTGAAG
+GTCCTGAGTTCAAATCCCAGCAACCACATGGTGACTTACAACCATCTGTAATGACATCTG
+ATGCCCTCTGGTGTGTCTGAAGACAGCTACAGTGTACTTACATAAAATAATAAATAAATC
+TTTAAAAACAAAAAAAAAGAA
+>2
+GAAGATCTTTTCCTTATTAAGGATCTGAAGCTCTGTAGATTTGTATTCTATTAAACATGG
+AGAGATTAGTGATTTTCCATATTCTTTAAGTCATTTTAGAGTAATGTGTTCTTAAGATAA
+ATCAGAAAAACAAAAACTTGTGCTTTCCTGTTTGAAAAACAAACAGCTGTGGGGAATGGT
+GTCGGGACAGCCTTTTTATAAAATTTTTCTAAATAATGTTGAGGCTTTGATACGTCAAAG
+TTATATTTCAAATGGAATCACTTAGACCTCGTTTCTGAGTGTCAATGGCCATATTGGGGA
+TTTGCTGCTGCCAATGACAGCACACCCTGGGAATGCCCCAACTACTTACTACAAAGCAGT
+GTTACATGGAGAAGATCTTCAAGAGTCTTTTTGCTAGATCTTTCCTTGGCTTTTGATGTG
+ACTCCTCTCAATAAAATCCACAGTAATATAGTGAGTGGTCTCCTGCTCCAAACCAGTATT
+TCAGACACAGTTAATCCAGAC
diff --git a/test/consensus.tab b/test/consensus.tab
new file mode 100644
index 0000000..a913c02
--- /dev/null
+++ b/test/consensus.tab
@@ -0,0 +1,3 @@
+1	421	480
+2	1   60
+2	241   300
diff --git a/test/consensus.vcf b/test/consensus.vcf
new file mode 100644
index 0000000..007aabf
--- /dev/null
+++ b/test/consensus.vcf
@@ -0,0 +1,18 @@
+##fileformat=VCFv4.2
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##INFO=<ID=END,Number=1,Type=Integer,Description="End position of the variant described in this record">
+##ALT=<ID=DEL,Description="Deletion">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	NA001
+1	5	.	C	a	.	PASS	.	GT	0/1
+1	5	.	C	t	.	PASS	.	GT	0/1
+1	7	.	T	a	.	PASS	.	GT	.
+1	10	.	G	a	.	PASS	.	GT	0/1
+1	12	.	GACA	ga	.	PASS	.	GT	0/1
+1	16	.	T	taaa	.	PASS	.	GT	1/1
+1	19	.	A	c	.	PASS	.	GT	0/1
+1	61	.	C	a	.	PASS	.	GT	0/1
+2	61	.	AGAG	aa	.	PASS	.	GT	0/1
+2	119	.	AAA	t	.	PASS	.	GT	0/1
+2	179	.	G	gacgtacgt	.	PASS	.	GT	0/1
+2	200	.	A	<DEL>	.	PASS	END=210	GT	1/0
+2	481	.	T	c,a	.	PASS	.	GT	0/2
diff --git a/test/convert.23andme b/test/convert.23andme
new file mode 100644
index 0000000..8439bb2
--- /dev/null
+++ b/test/convert.23andme
@@ -0,0 +1,28 @@
+# rsid	chromosome	position	genotype
+rs001	1	2	AA
+rs002	1	10	AG
+rs003	1	14	AG
+rs004	1	24	TC
+rs005	1	44	CG
+rs006	1	53	GG
+rs007	1	60	GG
+rs008	1	62	CC
+rs009	1	75	AA
+rs010	1	80	GG
+rs011	1	89	TT
+rs012	1	96	--
+rs013	1	99	CC
+rs014	1	102	GG
+rs015	1	112	TT
+rs016	2	5	CC
+rs017	2	11	CT
+rs018	2	16	CC
+rs019	2	20	GG
+rs020	2	33	CT
+rs021	2	39	AA
+rs022	2	44	CC
+rs023	2	48	CC
+rs024	2	55	AA
+rs025	2	59	CT
+rs026	Y	12	T
+rs027	Y	20	C
diff --git a/test/convert.23andme.vcf b/test/convert.23andme.vcf
new file mode 100644
index 0000000..c936a42
--- /dev/null
+++ b/test/convert.23andme.vcf
@@ -0,0 +1,34 @@
+##fileformat=VCFv4.2
+##FILTER=<ID=PASS,Description="All filters passed">
+##contig=<ID=1,length=150>
+##contig=<ID=2,length=77>
+##contig=<ID=Y,length=40>
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	SAMPLE1
+1	2	rs001	A	.	.	.	.	GT	0/0
+1	10	rs002	G	A	.	.	.	GT	1/0
+1	14	rs003	A	G	.	.	.	GT	0/1
+1	24	rs004	T	C	.	.	.	GT	0/1
+1	44	rs005	C	G	.	.	.	GT	0/1
+1	53	rs006	G	.	.	.	.	GT	0/0
+1	60	rs007	A	G	.	.	.	GT	1/1
+1	62	rs008	C	.	.	.	.	GT	0/0
+1	75	rs009	A	.	.	.	.	GT	0/0
+1	80	rs010	G	.	.	.	.	GT	0/0
+1	89	rs011	C	T	.	.	.	GT	1/1
+1	96	rs012	T	.	.	.	.	GT	.
+1	99	rs013	C	.	.	.	.	GT	0/0
+1	102	rs014	T	G	.	.	.	GT	1/1
+1	112	rs015	T	.	.	.	.	GT	0/0
+2	5	rs016	C	.	.	.	.	GT	0/0
+2	11	rs017	T	C	.	.	.	GT	1/0
+2	16	rs018	C	.	.	.	.	GT	0/0
+2	20	rs019	G	.	.	.	.	GT	0/0
+2	33	rs020	T	C	.	.	.	GT	1/0
+2	39	rs021	A	.	.	.	.	GT	0/0
+2	44	rs022	C	.	.	.	.	GT	0/0
+2	48	rs023	C	.	.	.	.	GT	0/0
+2	55	rs024	C	A	.	.	.	GT	1/1
+2	59	rs025	C	T	.	.	.	GT	0/1
+Y	12	rs026	G	T	.	.	.	GT	1
+Y	20	rs027	C	.	.	.	.	GT	0
diff --git a/test/convert.gs.gt.gen b/test/convert.gs.gt.gen
new file mode 100644
index 0000000..01e8a73
--- /dev/null
+++ b/test/convert.gs.gt.gen
@@ -0,0 +1,32 @@
+X:2698560_G_A X:2698560_G_A 2698560 G A 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0
+X:2698630_A_G X:2698630_A_G 2698630 A G 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0
+X:2698758_CAA_C X:2698758_CAA_C 2698758 CAA C 1 0 0 0 1 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0
+X:2698769_AAG_A X:2698769_AAG_A 2698769 AAG A 0 1 0 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0
+X:2698789_C_G X:2698789_C_G 2698789 C G 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0
+X:2698822_A_C X:2698822_A_C 2698822 A C 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0
+X:2698831_G_A X:2698831_G_A 2698831 G A 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0
+X:2698889_T_C X:2698889_T_C 2698889 T C 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0
+X:2698923_G_A X:2698923_G_A 2698923 G A 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0
+X:2698953_A_AGG X:2698953_A_AGG 2698953 A AGG 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0
+X:2698954_G_A X:2698954_G_A 2698954 G A 0 1 0 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 1 0 0 0 1 0 1 0 0 1 0 0
+X:2699002_C_A X:2699002_C_A 2699002 C A 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0
+X:2699025_T_C X:2699025_T_C 2699025 T C 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0
+X:2699091_G_A X:2699091_G_A 2699091 G A 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0
+X:2699187_T_C X:2699187_T_C 2699187 T C 1 0 0 1 0 0 0 1 0 1 0 0 0 1 0 0 1 0 0 1 0 1 0 0 1 0 0 0 1 0
+X:2699188_G_C X:2699188_G_C 2699188 G C 1 0 0 1 0 0 0 1 0 1 0 0 0 1 0 0 1 0 0 1 0 1 0 0 1 0 0 0 1 0
+X:2699189_T_C X:2699189_T_C 2699189 T C 1 0 0 1 0 0 0 1 0 1 0 0 0 1 0 0 1 0 0 1 0 1 0 0 1 0 0 0 1 0
+X:2699217_C_T X:2699217_C_T 2699217 C T 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0
+X:2699246_C_A X:2699246_C_A 2699246 C A 0 1 0 0 0 1 0 1 0 0 0 1 0 1 0 0 1 0 1 0 0 0 1 0 1 0 0 0 1 0
+X:2699275_T_G X:2699275_T_G 2699275 T G 1 0 0 1 0 0 0 1 0 1 0 0 0 1 0 0 0 1 0 1 0 1 0 0 1 0 0 0 1 0
+X:2699350_A_T X:2699350_A_T 2699350 A T 1 0 0 1 0 0 0 1 0 1 0 0 0 1 0 0 1 0 0 1 0 1 0 0 1 0 0 0 1 0
+X:2699360_T_C X:2699360_T_C 2699360 T C 1 0 0 1 0 0 0 1 0 1 0 0 0 1 0 0 1 0 0 1 0 1 0 0 1 0 0 0 1 0
+X:2699450_A_C X:2699450_A_C 2699450 A C 1 0 0 1 0 0 0 1 0 1 0 0 0 1 0 0 1 0 0 1 0 1 0 0 1 0 0 0 1 0
+X:2699507_T_C X:2699507_T_C 2699507 T C 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0
+X:2699555_C_A X:2699555_C_A 2699555 C A 1 0 0 0 0 1 0 0 1 1 0 0 0 0 1 0 0 1 0 1 0 0 1 0 1 0 0 0 1 0
+X:2699645_G_T X:2699645_G_T 2699645 G T 1 0 0 0 0 1 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 0 1 0 1 0 0 1 0 0
+X:2699676_G_A X:2699676_G_A 2699676 G A 1 0 0 1 0 0 0 0 1 1 0 0 0 0 1 0 1 0 0 1 0 1 0 0 1 0 0 0 1 0
+X:2699728_C_T X:2699728_C_T 2699728 C T 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0
+X:2699775_C_A X:2699775_C_A 2699775 C A 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0
+X:2699898_C_CT X:2699898_C_CT 2699898 C CT 1 0 0 1 0 0 0 0 1 1 0 0 0 0 1 0 1 0 0 1 0 1 0 0 1 0 0 0 1 0
+X:2699968_A_G X:2699968_A_G 2699968 A G 0.5 0.0 0.5 1 0 0 1 0 0 0 0 1 1 0 0 0 1 0 1 0 0 1 0 0 0 1 0 0 1 0
+X:2699970_T_C X:2699970_T_C 2699970 T C 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0
diff --git a/test/convert.gs.gt.samples b/test/convert.gs.gt.samples
new file mode 100644
index 0000000..080f72a
--- /dev/null
+++ b/test/convert.gs.gt.samples
@@ -0,0 +1,12 @@
+ID_1 ID_2 missing
+0 0 0
+NA00001 NA00001 0
+NA00002 NA00002 0
+NA00003 NA00003 0
+NA00004 NA00004 0
+NA00005 NA00005 0
+NA00006 NA00006 0
+NA00007 NA00007 0
+NA00008 NA00008 0
+NA00009 NA00009 0
+NA00010 NA00010 0
diff --git a/test/convert.gs.pl.gen b/test/convert.gs.pl.gen
new file mode 100644
index 0000000..30a4172
--- /dev/null
+++ b/test/convert.gs.pl.gen
@@ -0,0 +1,32 @@
+X:2698560_G_A X:2698560_G_A 2698560 G A 0.992119 0.007881 0.000000 0.999001 0.000999 0.000000 0.992119 0.007881 0.000000 0.969347 0.030653 0.000000 0.888184 0.111816 0.000000 0.969347 0.030653 0.000000 0.969347 0.030653 0.000000 0.969347 0.030653 0.000000 0.969347 0.030653 0.000000 0.996035 0.003965 0.000000
+X:2698630_A_G X:2698630_A_G 2698630 A G 0.992119 0.007881 0.000000 0.992119 0.007881 0.000000 0.969347 0.030653 0.000000 0.984398 0.015602 0.000000 0.799240 0.200760 0.000001 0.969347 0.030653 0.000000 0.984398 0.015602 0.000000 0.992119 0.007881 0.000000 0.940649 0.059351 0.000000 0.969347 0.030653 0.000000
+X:2698758_CAA_C X:2698758_CAA_C 2698758 CAA C 0.783510 0.196809 0.019681 0.333333 0.333333 0.333333 0.333333 0.333333 0.333333 0.602527 0.301979 0.095494 0.463287 0.463287 0.073426 0.875855 0.110264 0.013881 0.884248 0.111320 0.004432 0.863919 0.108761 0.027320 0.740089 0.185902 0.074009 0.991626 0.007877 0.000497
+X:2698769_AAG_A X:2698769_AAG_A 2698769 AAG A 0.016362 0.820022 0.163616 0.333333 0.333333 0.333333 0.013117 0.329481 0.657402 0.046441 0.584662 0.368897 0.071493 0.900045 0.028462 0.969253 0.030650 0.000097 0.884248 0.111320 0.004432 0.966384 0.030560 0.003056 0.968973 0.030642 0.000386 0.999497 0.000501 0.000003
+X:2698789_C_G X:2698789_C_G 2698789 C G 0.992119 0.007881 0.000000 0.992119 0.007881 0.000000 0.940649 0.059351 0.000000 0.940649 0.059351 0.000000 0.992119 0.007881 0.000000 0.969347 0.030653 0.000000 0.969347 0.030653 0.000000 0.996035 0.003965 0.000000 0.984398 0.015602 0.000000 0.999499 0.000501 0.000000
+X:2698822_A_C X:2698822_A_C 2698822 A C 0.992119 0.007881 0.000000 0.992119 0.007881 0.000000 0.992119 0.007881 0.000000 0.984398 0.015602 0.000000 0.969347 0.030653 0.000000 0.969347 0.030653 0.000000 0.992119 0.007881 0.000000 0.992119 0.007881 0.000000 0.969347 0.030653 0.000000 0.992119 0.007881 0.000000
+X:2698831_G_A X:2698831_G_A 2698831 G A 0.969347 0.030653 0.000000 0.998009 0.001991 0.000000 0.996035 0.003965 0.000000 0.992119 0.007881 0.000000 0.984398 0.015602 0.000000 0.940649 0.059351 0.000000 0.996035 0.003965 0.000000 0.992119 0.007881 0.000000 0.888184 0.111816 0.000000 0.992119 0.007881 0.000000
+X:2698889_T_C X:2698889_T_C 2698889 T C 0.998009 0.001991 0.000000 0.999968 0.000032 0.000000 0.992119 0.007881 0.000000 0.999749 0.000251 0.000000 0.999001 0.000999 0.000000 0.999749 0.000251 0.000000 0.984398 0.015602 0.000000 0.888184 0.111816 0.000000 0.888184 0.111816 0.000000 0.996035 0.003965 0.000000
+X:2698923_G_A X:2698923_G_A 2698923 G A 0.000001 0.999999 0.000000 0.000000 1.000000 0.000000 0.000316 0.999684 0.000000 0.000000 1.000000 0.000000 0.000000 1.000000 0.000000 0.999001 0.000999 0.000000 0.888184 0.111816 0.000000 0.940649 0.059351 0.000000 0.984398 0.015602 0.000000 0.984398 0.015602 0.000000
+X:2698953_A_AGG X:2698953_A_AGG 2698953 A AGG 0.998009 0.001991 0.000000 0.999499 0.000501 0.000000 0.940649 0.059351 0.000001 0.969347 0.030653 0.000000 0.940648 0.059351 0.000001 0.969346 0.030653 0.000000 0.798986 0.200696 0.000318 0.984398 0.015602 0.000000 0.984398 0.015602 0.000000 0.969347 0.030653 0.000000
+X:2698954_G_A X:2698954_G_A 2698954 G A 0.000000 1.000000 0.000000 0.000000 0.003965 0.996035 0.030653 0.969347 0.000000 0.000631 0.999369 0.000000 0.024503 0.975497 0.000000 0.969347 0.030653 0.000000 0.799239 0.200760 0.000001 0.000000 0.999874 0.000126 0.984398 0.015602 0.000000 0.969347 0.030653 0.000000
+X:2699002_C_A X:2699002_C_A 2699002 C A 0.984398 0.015602 0.000000 0.940649 0.059351 0.000000 0.940649 0.059351 0.000000 0.969347 0.030653 0.000000 0.798437 0.200558 0.001005 0.888184 0.111816 0.000000 0.888184 0.111816 0.000000 0.996035 0.003965 0.000000 0.969347 0.030653 0.000000 0.888184 0.111816 0.000000
+X:2699025_T_C X:2699025_T_C 2699025 T C 0.996035 0.003965 0.000000 0.940649 0.059351 0.000000 0.969347 0.030653 0.000000 0.969347 0.030653 0.000000 0.799240 0.200760 0.000000 0.996035 0.003965 0.000000 0.940649 0.059351 0.000000 0.996035 0.003965 0.000000 0.888184 0.111816 0.000000 0.940649 0.059351 0.000000
+X:2699091_G_A X:2699091_G_A 2699091 G A 0.984398 0.015602 0.000000 0.992119 0.007881 0.000000 0.940649 0.059351 0.000000 0.940649 0.059351 0.000000 0.996035 0.003965 0.000000 0.996035 0.003965 0.000000 0.969347 0.030653 0.000000 0.992119 0.007881 0.000000 0.969347 0.030653 0.000000 0.992119 0.007881 0.000000
+X:2699187_T_C X:2699187_T_C 2699187 T C 0.996035 0.003965 0.000000 0.996035 0.003965 0.000000 0.000016 0.999984 0.000000 0.969347 0.030653 0.000000 0.000002 0.999967 0.000032 0.000001 0.999989 0.000010 0.006270 0.993722 0.000008 0.998009 0.001991 0.000000 0.888184 0.111816 0.000000 0.004987 0.995013 0.000000
+X:2699188_G_C X:2699188_G_C 2699188 G C 0.996035 0.003965 0.000000 0.996035 0.003965 0.000000 0.000016 0.999984 0.000000 0.969347 0.030653 0.000000 0.000001 0.999900 0.000100 0.000010 0.999950 0.000040 0.006270 0.993714 0.000016 0.998009 0.001991 0.000000 0.888184 0.111816 0.000000 0.004987 0.995013 0.000000
+X:2699189_T_C X:2699189_T_C 2699189 T C 0.996035 0.003965 0.000000 0.996035 0.003965 0.000000 0.000040 0.999960 0.000000 0.969347 0.030653 0.000000 0.000001 0.999974 0.000025 0.000001 0.999974 0.000025 0.006270 0.993717 0.000013 0.998009 0.001991 0.000000 0.888184 0.111816 0.000000 0.004987 0.995013 0.000000
+X:2699217_C_T X:2699217_C_T 2699217 C T 0.984398 0.015602 0.000000 0.984398 0.015602 0.000000 0.992119 0.007881 0.000000 0.992119 0.007881 0.000000 0.940649 0.059351 0.000000 0.984398 0.015602 0.000000 0.940649 0.059351 0.000000 0.984398 0.015602 0.000000 0.940649 0.059351 0.000000 0.984398 0.015602 0.000000
+X:2699246_C_A X:2699246_C_A 2699246 C A 0.000000 0.969347 0.030653 0.000000 0.007881 0.992119 0.000000 0.759747 0.240253 0.000000 0.000501 0.999499 0.000032 0.999968 0.000000 0.000000 0.999987 0.000013 0.969347 0.030653 0.000000 0.047727 0.952273 0.000000 0.999001 0.000999 0.000000 0.000000 0.999998 0.000002
+X:2699275_T_G X:2699275_T_G 2699275 T G 0.984398 0.015602 0.000000 0.984398 0.015602 0.000000 0.888184 0.111816 0.000000 0.999499 0.000501 0.000000 0.000000 0.999900 0.000100 0.000000 0.001991 0.998009 0.000000 0.999950 0.000050 0.969347 0.030653 0.000000 0.999001 0.000999 0.000000 0.000000 0.999996 0.000004
+X:2699350_A_T X:2699350_A_T 2699350 A T 0.998009 0.001991 0.000000 0.969347 0.030653 0.000000 0.000004 0.996844 0.003152 0.940649 0.059351 0.000000 0.000000 1.000000 0.000000 0.000016 0.999984 0.000000 0.000000 0.999968 0.000032 0.999001 0.000999 0.000000 0.998009 0.001991 0.000000 0.000016 0.999984 0.000000
+X:2699360_T_C X:2699360_T_C 2699360 T C 0.992119 0.007881 0.000000 0.969347 0.030653 0.000000 0.000005 0.992114 0.007881 0.940649 0.059351 0.000000 0.009901 0.990099 0.000000 0.000100 0.999900 0.000000 0.000006 0.999993 0.000000 0.999001 0.000999 0.000000 0.992119 0.007881 0.000000 0.009901 0.990099 0.000000
+X:2699450_A_C X:2699450_A_C 2699450 A C 0.940649 0.059351 0.000000 0.799238 0.200759 0.000003 0.000000 0.999937 0.000063 0.992119 0.007881 0.000000 0.000000 1.000000 0.000000 0.000158 0.999841 0.000000 0.024503 0.975497 0.000000 0.996035 0.003965 0.000000 0.940649 0.059351 0.000000 0.000000 1.000000 0.000000
+X:2699507_T_C X:2699507_T_C 2699507 T C 0.969347 0.030653 0.000000 0.940649 0.059351 0.000000 0.799239 0.200760 0.000001 0.984398 0.015602 0.000000 0.969347 0.030653 0.000000 0.992119 0.007881 0.000000 0.992119 0.007881 0.000000 0.996035 0.003965 0.000000 0.940649 0.059351 0.000000 0.996035 0.003965 0.000000
+X:2699555_C_A X:2699555_C_A 2699555 C A 1.000000 0 0.000000 0.000126 0 0.999874 0.000008 0 0.999992 1.000000 0 0.000000 0.000000 0 1.000000 0.000000 0.030653 0.969347 0.000000 1.000000 0.000000 0.000000 1.000000 0.000000 0.984398 0.015602 0.000000 0.000000 1.000000 0.000000
+X:2699645_G_T X:2699645_G_T 2699645 G T 1.000000 0 0.000000 0.000013 0 0.999987 0.999998 0 0.000002 1.000000 0 0.000000 1.000000 0 0.000000 0.984398 0.015602 0.000000 0.984398 0.015602 0.000000 0.000000 1.000000 0.000000 0.999001 0.000999 0.000000 0.998009 0.001991 0.000000
+X:2699676_G_A X:2699676_G_A 2699676 G A 1.000000 0 0.000000 1.000000 0 0.000000 0.000316 0 0.999684 0.998418 0 0.001582 0.000000 0 1.000000 0.000000 1.000000 0.000000 0.000016 0.999984 0.000000 0.984398 0.015602 0.000000 0.996035 0.003965 0.000000 0.000000 0.999999 0.000001
+X:2699728_C_T X:2699728_C_T 2699728 C T 0.999998 0 0.000002 1.000000 0 0.000000 0.999499 0 0.000501 1.000000 0 0.000000 1.000000 0 0.000000 0.998009 0.001991 0.000000 0.999968 0.000032 0.000000 0.999001 0.000999 0.000000 0.969347 0.030653 0.000000 0.992119 0.007881 0.000000
+X:2699775_C_A X:2699775_C_A 2699775 C A 0.999999 0 0.000001 1.000000 0 0.000000 1.000000 0 0.000000 1.000000 0 0.000000 0.999996 0 0.000004 0.999001 0.000999 0.000000 0.999874 0.000126 0.000000 0.999001 0.000999 0.000000 0.984398 0.015602 0.000000 0.969347 0.030653 0.000000
+X:2699898_C_CT X:2699898_C_CT 2699898 C CT 0.999369 0 0.000631 0.926412 0 0.073588 0.073588 0 0.926412 0.926412 0 0.073588 0.000794 0 0.999206 0.073317 0.923008 0.003675 0.134491 0.848578 0.016931 0.999499 0.000501 0.000000 0.998009 0.001991 0.000000 0.146925 0.736369 0.116707
+X:2699968_A_G X:2699968_A_G 2699968 A G 1.000000 0 0.000000 0.999369 0 0.000631 0.999998 0 0.000002 0.000000 0 1.000000 1.000000 0 0.000000 0.000000 0.999960 0.000040 0.984398 0.015602 0.000000 0.999968 0.000032 0.000000 0.000000 1.000000 0.000000 0.000000 0.999999 0.000001
+X:2699970_T_C X:2699970_T_C 2699970 T C 1.000000 0 0.000000 0.999602 0 0.000398 0.999369 0 0.000631 1.000000 0 0.000000 1.000000 0 0.000001 0.969347 0.030653 0.000000 0.992119 0.007881 0.000000 0.999968 0.000032 0.000000 0.998009 0.001991 0.000000 0.996035 0.003965 0.000000
diff --git a/test/convert.gs.pl.samples b/test/convert.gs.pl.samples
new file mode 100644
index 0000000..080f72a
--- /dev/null
+++ b/test/convert.gs.pl.samples
@@ -0,0 +1,12 @@
+ID_1 ID_2 missing
+0 0 0
+NA00001 NA00001 0
+NA00002 NA00002 0
+NA00003 NA00003 0
+NA00004 NA00004 0
+NA00005 NA00005 0
+NA00006 NA00006 0
+NA00007 NA00007 0
+NA00008 NA00008 0
+NA00009 NA00009 0
+NA00010 NA00010 0
diff --git a/test/convert.gvcf.out b/test/convert.gvcf.out
new file mode 100644
index 0000000..f86e74d
--- /dev/null
+++ b/test/convert.gvcf.out
@@ -0,0 +1,414 @@
+##fileformat=VCFv4.1
+##FILTER=<ID=PASS,Description="All filters passed">
+##FORMAT=<ID=GQX,Number=1,Type=Integer,Description="Minimum of {Genotype quality assuming variant position,Genotype quality assuming non-variant position}">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Float,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Filtered basecall depth used for site genotyping">
+##FORMAT=<ID=DPF,Number=1,Type=Integer,Description="Basecalls filtered from input prior to site genotyping">
+##FORMAT=<ID=AD,Number=.,Type=Integer,Description="Allelic depths for the ref and alt alleles in the order listed. For indels this value only includes reads which confidently support each allele (posterior prob 0.999 or higher that read contains indicated allele vs all other intersecting indel alleles)">
+##FORMAT=<ID=DPI,Number=1,Type=Integer,Description="Read depth associated with indel, taken from the site preceding the indel.">
+##INFO=<ID=END,Number=1,Type=Integer,Description="End position of the region described in this record">
+##INFO=<ID=BLOCKAVG_min30p3a,Number=0,Type=Flag,Description="Non-variant site block. All sites in a block are constrained to be non-variant, have the same filter value, and have all sample values in range [x,y], y <= max(x+3,(x*1.3)). All printed site block sample values are the minimum observed in the region spanned by the block">
+##INFO=<ID=SNVSB,Number=1,Type=Float,Description="SNV site strand bias">
+##INFO=<ID=SNVHPOL,Number=1,Type=Integer,Description="SNV contextual homopolymer length">
+##INFO=<ID=CIGAR,Number=A,Type=String,Description="CIGAR alignment for each alternate indel allele">
+##INFO=<ID=RU,Number=A,Type=String,Description="Smallest repeating sequence unit extended or contracted in the indel allele relative to the reference. RUs are not reported if longer than 20 bases.">
+##INFO=<ID=REFREP,Number=A,Type=Integer,Description="Number of times RU is repeated in reference.">
+##INFO=<ID=IDREP,Number=A,Type=Integer,Description="Number of times RU is repeated in indel allele.">
+##FILTER=<ID=IndelConflict,Description="Locus is in region with conflicting indel calls">
+##FILTER=<ID=SiteConflict,Description="Site genotype conflicts with proximal indel call. This is typically a heterozygous SNV call made inside of a heterozygous deletion">
+##FILTER=<ID=LowGQX,Description="Locus GQX is less than 30 or not present">
+##FILTER=<ID=HighDPFRatio,Description="The fraction of basecalls filtered out at a site is greater than 0.3">
+##FILTER=<ID=HighSNVSB,Description="SNV strand bias value (SNVSB) exceeds 10">
+##FILTER=<ID=HighREFREP,Description="Locus contains an indel allele occurring in a homopolymer or dinucleotide track with a reference repeat greater than 8">
+##FILTER=<ID=HighDepth,Description="Locus depth is greater than 3x the mean chromosome depth">
+##reference=file:///illumina/scripts/clia/Genomes/Homo_sapiens/UCSC/hg19_rCRS/Sequence/WholeGenomeFasta/genome.fa
+##contig=<ID=chr22,length=51304566>
+##SnvTheta=0.001
+##IndelTheta=0.0001
+##MaxDepth_chr1=114.18
+##MaxDepth_chr10=131.73
+##MaxDepth_chr11=117.27
+##MaxDepth_chr12=116.97
+##MaxDepth_chr13=102.24
+##MaxDepth_chr14=101.55
+##MaxDepth_chr15=95.22
+##MaxDepth_chr16=111.33
+##MaxDepth_chr17=112.59
+##MaxDepth_chr18=121.86
+##MaxDepth_chr19=111.12
+##MaxDepth_chr2=121.83
+##MaxDepth_chr20=111.24
+##MaxDepth_chr21=98.43
+##MaxDepth_chr22=76.23
+##MaxDepth_chr3=120.09
+##MaxDepth_chr4=124.50
+##MaxDepth_chr5=119.82
+##MaxDepth_chr6=122.22
+##MaxDepth_chr7=120.27
+##MaxDepth_chr8=120.45
+##MaxDepth_chr9=102.48
+##MaxDepth_chrM=7005.66
+##MaxDepth_chrX=61.05
+##MaxDepth_chrY=37.17
+##FILTER=<ID=IndelSizeFilter,Description="Indel is outside reportable size range. Insertion range: [1,3], Deletion range: [1,11]">
+##gvcftools_version="0.16"
+##gvcftools_cmdline="/illumina/scripts/clia/workflows/IsisWorkflow/IsisWorkflow_v2.0.13/bin/set_haploid_region --ref /illumina/scripts/clia/Genomes/Homo_sapiens/UCSC/hg19_rCRS/Sequence/WholeGenomeFasta/genome.fa --region-file /illumina/scripts/clia/workflows/IsisWorkflow/IsisWorkflow_v2.0.13/bin/../data/het_mask/ncbi37/male.bed"
+##FILTER=<ID=HAPLOID_CONFLICT,Description="Locus has heterozygous genotype in a haploid region.">
+##FORMAT=<ID=OPL,Number=.,Type=Integer,Description="Original PL value before ploidy correction">
+##INFO=<ID=phastCons,Number=0,Type=Flag,Description="overlaps a phastCons element">
+##INFO=<ID=AA,Number=1,Type=String,Description="Ancestral Allele, ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/pilot_data/technical/reference/ancestral_alignments/README">
+##INFO=<ID=AF,Number=A,Type=String,Description="1000 Genomes Allele Frequency based on AC/AN; Format: Allele:AlleleFrequency">
+##INFO=<ID=AMR_AF,Number=A,Type=String,Description="1000 Genomes Allele Frequency for samples from AMR population based on AC/AN; Format: Allele:AlleleFrequency">
+##INFO=<ID=ASN_AF,Number=A,Type=String,Description="1000 Genomes Allele Frequency for samples from ASN population based on AC/AN; Format: Allele:AlleleFrequency">
+##INFO=<ID=AFR_AF,Number=A,Type=String,Description="1000 Genomes Allele Frequency for samples from AFR population based on AC/AN; Format: Allele:AlleleFrequency">
+##INFO=<ID=EUR_AF,Number=A,Type=String,Description="1000 Genomes Allele Frequency for samples from EUR population based on AC/AN; Format: Allele:AlleleFrequency">
+##INFO=<ID=CLNACC,Number=.,Type=String,Description="Accession and version number assigned by ClinVar to the genotype/phenotype relationship. Multiple entries for an allele are pipe-delimited">
+##INFO=<ID=CLNSIG,Number=.,Type=String,Description="String that describes the clinical significance. Possible values: unknown, untested, non-pathogenic, probable-non-pathogenic, probable-pathogenic, pathogenic, drug-response, histocompatibility, other. Multiple values are pipe-delimited">
+##INFO=<ID=CLNORIGIN,Number=.,Type=String,Description="String that describes the origin of the variant allele. Possible values: unknown, germline, somatic, inherited, paternal, maternal, de-novo, biparental, uniparental, not-tested, test-inconclusive, other. Multiple values for an allele are pipe-delimited">
+##INFO=<ID=CLNSRC,Number=.,Type=String,Description="Variant clinical source or channel. Multiple values for an allele are pipe-delimited">
+##INFO=<ID=CLNSRCID,Number=.,Type=String,Description="Identifier used by source defined in CLNSRC. Multiple values are pipe-delimited">
+##INFO=<ID=CLNGENEINFO,Number=.,Type=String,Description="Gene symbol(s) and NCBI GeneID(s). The gene symbol and ID are delimited by a colon and multiple such pairs are pipe-delimited, Example SYMBOL1:GeneID1|SYMBOL2:GeneID2">
+##INFO=<ID=CLNDBN,Number=.,Type=String,Description="Disease name used by the database specified by CLNSRC. Values corresponding to each CLNACC entry are pipe-delimited">
+##INFO=<ID=CLNDSDB,Number=.,Type=String,Description="Colon-delimited list of variant disease database name(s). Multiple values from a single database are pipe-delimited">
+##INFO=<ID=CLNDSDBID,Number=.,Type=String,Description="Colon-delimited list of variant disease database identifier(s). Multiple values from a single database are pipe-delimited">
+##INFO=<ID=CSQ,Number=A,Type=String,Description="Consequence type as predicted by VEP. Format: Allele|Gene|Feature|Feature_type|Consequence|cDNA_position|CDS_position|Protein_position|Amino_acids|Codons|Existing_variation|EXON|INTRON|HGNC|MOTIF_NAME|MOTIF_POS|HIGH_INF_POS|MOTIF_SCORE_CHANGE|DISTANCE|CANONICAL|SIFT|PolyPhen|GMAF|ENSP|DOMAINS|CCDS|HGVSc|HGVSp|CELL_TYPE">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	SAMPLE99
+chr22	1	.	N	.	0	LowGQX	END=16050039;BLOCKAVG_min30p3a	GT:GQX:DP:DPF	.:.:0:0
+chr22	16050040	.	C	.	0	LowGQX	END=16050050;BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:5:2:0
+chr22	16050051	.	C	.	0	LowGQX	END=16050056;BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:10:4:0
+chr22	16050057	.	C	.	0	LowGQX	END=16050072;BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:15:6:0
+chr22	16050073	.	G	.	0	LowGQX	END=16050080;BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:21:8:0
+chr22	16050081	.	C	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:30:11:0
+chr22	16050082	.	C	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:30:11:0
+chr22	16050083	.	C	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:30:11:0
+chr22	16050084	.	C	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:30:11:0
+chr22	16050085	.	C	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:30:11:0
+chr22	16050086	.	C	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:30:11:0
+chr22	16050086	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:42:15:0
+chr22	16050087	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:42:15:0
+chr22	16050088	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:42:15:0
+chr22	16050089	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:42:15:0
+chr22	16050090	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:42:15:0
+chr22	16050091	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:42:15:0
+chr22	16050092	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:42:15:0
+chr22	16050093	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:42:15:0
+chr22	16050094	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:42:15:0
+chr22	16050095	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:42:15:0
+chr22	16050096	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:42:15:0
+chr22	16050097	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:42:15:0
+chr22	16050098	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:42:15:0
+chr22	16050099	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:42:15:0
+chr22	16050100	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:42:15:0
+chr22	16050101	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:42:15:0
+chr22	16050102	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:42:15:0
+chr22	16050103	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:42:15:0
+chr22	16050103	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:54:19:0
+chr22	16050104	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:54:19:0
+chr22	16050105	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:54:19:0
+chr22	16050106	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:54:19:0
+chr22	16050107	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:54:19:0
+chr22	16050108	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:54:19:0
+chr22	16050109	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:54:19:0
+chr22	16050110	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:54:19:0
+chr22	16050111	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:54:19:0
+chr22	16050112	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:54:19:0
+chr22	16050113	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:54:19:0
+chr22	16050114	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:54:19:0
+chr22	16050115	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:54:19:0
+chr22	16050116	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:54:19:0
+chr22	16050116	.	G	C	23	LowGQX	SNVSB=0;SNVHPOL=2	GT:GQ:GQX:DP:DPF:AD	0/1:56:23:22:0:16,6
+chr22	16050117	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:69:24:0
+chr22	16050118	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:69:24:0
+chr22	16050119	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:69:24:0
+chr22	16050120	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:69:24:0
+chr22	16050121	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:69:24:0
+chr22	16050122	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:69:24:0
+chr22	16050123	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:69:24:0
+chr22	16050124	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:69:24:0
+chr22	16050125	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:69:24:0
+chr22	16050126	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:69:24:0
+chr22	16050127	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:69:24:0
+chr22	16050128	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:69:24:0
+chr22	16050129	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:69:24:0
+chr22	16050130	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:69:24:0
+chr22	16050131	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:69:24:0
+chr22	16050132	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:69:24:0
+chr22	16050132	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:84:29:0
+chr22	16050133	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:84:29:0
+chr22	16050134	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:84:29:0
+chr22	16050135	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:84:29:0
+chr22	16050136	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:84:29:0
+chr22	16050137	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:84:29:0
+chr22	16050138	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:84:29:0
+chr22	16050139	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:84:29:0
+chr22	16050140	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:84:29:0
+chr22	16050141	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:84:29:0
+chr22	16050142	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:84:29:0
+chr22	16050143	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:84:29:0
+chr22	16050144	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:84:29:0
+chr22	16050145	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:84:29:0
+chr22	16050146	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:84:29:0
+chr22	16050147	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:84:29:0
+chr22	16050148	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:84:29:0
+chr22	16050149	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:84:29:0
+chr22	16050150	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:84:29:0
+chr22	16050151	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:84:29:0
+chr22	16050152	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:84:29:0
+chr22	16050153	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:84:29:0
+chr22	16050154	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:84:29:0
+chr22	16050155	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:84:29:0
+chr22	16050156	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:84:29:0
+chr22	16050157	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:84:29:0
+chr22	16050158	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:84:29:0
+chr22	16050159	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:84:29:0
+chr22	16050160	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:84:29:0
+chr22	16050161	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:84:29:0
+chr22	16050162	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:84:29:0
+chr22	16050163	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:84:29:0
+chr22	16050164	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:84:29:0
+chr22	16050165	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:84:29:0
+chr22	16050166	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:84:29:0
+chr22	16050167	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:84:29:0
+chr22	16050168	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:84:29:0
+chr22	16050169	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:84:29:0
+chr22	16050170	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:84:29:0
+chr22	16050171	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:84:29:0
+chr22	16050171	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:90:31:0
+chr22	16050172	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:90:31:0
+chr22	16050173	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:90:31:0
+chr22	16050174	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:90:31:0
+chr22	16050175	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:90:31:0
+chr22	16050176	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:90:31:0
+chr22	16050177	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:90:31:0
+chr22	16050178	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:90:31:0
+chr22	16050179	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:90:31:0
+chr22	16050180	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:90:31:0
+chr22	16050181	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:90:31:0
+chr22	16050182	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:90:31:0
+chr22	16050183	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:90:31:0
+chr22	16050184	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:90:31:0
+chr22	16050185	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:90:31:0
+chr22	16050186	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:90:31:0
+chr22	16050187	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:90:31:0
+chr22	16050188	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:90:31:0
+chr22	16050189	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:90:31:0
+chr22	16050190	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:90:31:0
+chr22	16050191	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:90:31:0
+chr22	16050192	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:90:31:0
+chr22	16050193	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:90:31:0
+chr22	16050194	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:90:31:0
+chr22	16050195	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:90:31:0
+chr22	16050196	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:90:31:0
+chr22	16050197	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:90:31:0
+chr22	16050198	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:90:31:0
+chr22	16050199	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:90:31:0
+chr22	16050200	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:90:31:0
+chr22	16050201	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:90:31:0
+chr22	16050202	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:90:31:0
+chr22	16050203	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:90:31:0
+chr22	16050204	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:90:31:0
+chr22	16050205	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:90:31:0
+chr22	16050206	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:90:31:0
+chr22	16050207	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:90:31:0
+chr22	16050208	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:90:31:0
+chr22	16050209	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:90:31:0
+chr22	16050210	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:90:31:0
+chr22	16050211	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:90:31:0
+chr22	16050212	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:90:31:0
+chr22	16050213	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:90:31:0
+chr22	16050214	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:90:31:0
+chr22	16050215	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:90:31:0
+chr22	16050216	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:90:31:0
+chr22	16050216	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:93:32:2
+chr22	16050217	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:93:32:2
+chr22	16050218	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:93:32:2
+chr22	16050218	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:102:35:0
+chr22	16050219	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:102:35:0
+chr22	16050220	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:102:35:0
+chr22	16050221	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:102:35:0
+chr22	16050222	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:102:35:0
+chr22	16050223	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:102:35:0
+chr22	16050224	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:102:35:0
+chr22	16050225	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:102:35:0
+chr22	16050226	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:102:35:0
+chr22	16050227	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:102:35:0
+chr22	16050228	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:102:35:0
+chr22	16050229	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:102:35:0
+chr22	16050230	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:102:35:0
+chr22	16050231	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:102:35:0
+chr22	16050232	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:102:35:0
+chr22	16050233	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:102:35:0
+chr22	16050234	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:102:35:0
+chr22	16050235	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:102:35:0
+chr22	16050235	.	T	.	0	PASS	.	GT:GQX:DP:DPF	0/0:72:36:0
+chr22	16050236	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:87:30:0
+chr22	16050237	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:87:30:0
+chr22	16050238	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:87:30:0
+chr22	16050239	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:87:30:0
+chr22	16050240	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:87:30:0
+chr22	16050241	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:87:30:0
+chr22	16050242	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:87:30:0
+chr22	16050243	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:87:30:0
+chr22	16050244	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:87:30:0
+chr22	16050245	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:87:30:0
+chr22	16050246	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:87:30:0
+chr22	16050247	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:87:30:0
+chr22	16050248	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:87:30:0
+chr22	16050249	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:87:30:0
+chr22	16050250	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:87:30:0
+chr22	16050251	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:87:30:0
+chr22	16050252	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:87:30:0
+chr22	16050253	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:87:30:0
+chr22	16050254	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:87:30:0
+chr22	16050255	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:87:30:0
+chr22	16050256	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:87:30:0
+chr22	16050257	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:87:30:0
+chr22	16050258	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:87:30:0
+chr22	16050259	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:87:30:0
+chr22	16050260	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:87:30:0
+chr22	16050261	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:87:30:0
+chr22	16050262	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:87:30:0
+chr22	16050262	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:66:23:0
+chr22	16050263	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:66:23:0
+chr22	16050264	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:66:23:0
+chr22	16050265	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:66:23:0
+chr22	16050266	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:66:23:0
+chr22	16050267	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:66:23:0
+chr22	16050268	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:66:23:0
+chr22	16050269	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:66:23:0
+chr22	16050270	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:66:23:0
+chr22	16050271	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:66:23:0
+chr22	16050272	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:66:23:0
+chr22	16050273	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:66:23:0
+chr22	16050274	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:66:23:0
+chr22	16050275	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:66:23:0
+chr22	16050276	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:66:23:0
+chr22	16050277	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:66:23:0
+chr22	16050278	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:66:23:0
+chr22	16050279	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:66:23:0
+chr22	16050280	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:66:23:0
+chr22	16050280	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:87:30:0
+chr22	16050281	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:87:30:0
+chr22	16050282	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:87:30:0
+chr22	16050283	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:87:30:0
+chr22	16050284	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:87:30:0
+chr22	16050285	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:87:30:0
+chr22	16050286	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:87:30:0
+chr22	16050287	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:87:30:0
+chr22	16050288	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:87:30:0
+chr22	16050288	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:114:39:0
+chr22	16050289	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:114:39:0
+chr22	16050290	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:114:39:0
+chr22	16050291	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:114:39:0
+chr22	16050292	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:114:39:0
+chr22	16050293	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:114:39:0
+chr22	16050294	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:114:39:0
+chr22	16050295	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:114:39:0
+chr22	16050296	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:114:39:0
+chr22	16050297	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:114:39:0
+chr22	16050298	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:114:39:0
+chr22	16050299	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:114:39:0
+chr22	16050300	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:114:39:0
+chr22	16050300	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:150:51:0
+chr22	16050301	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:150:51:0
+chr22	16050302	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:150:51:0
+chr22	16050303	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:150:51:0
+chr22	16050304	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:150:51:0
+chr22	16050305	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:150:51:0
+chr22	16050306	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:150:51:0
+chr22	16050307	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:150:51:0
+chr22	16050308	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:150:51:0
+chr22	16050309	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:150:51:0
+chr22	16050310	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:150:51:0
+chr22	16050310	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:166:63:0
+chr22	16050311	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:166:63:0
+chr22	16050312	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:166:63:0
+chr22	16050313	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:166:63:0
+chr22	16050314	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:166:63:0
+chr22	16050315	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:166:63:0
+chr22	16050316	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:166:63:0
+chr22	16050317	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:166:63:0
+chr22	16050318	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:166:63:0
+chr22	16050319	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:166:63:0
+chr22	16050320	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:166:63:0
+chr22	16050321	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:166:63:0
+chr22	16050322	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:166:63:0
+chr22	16050323	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:166:63:0
+chr22	16050324	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:166:63:0
+chr22	16050325	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:166:63:0
+chr22	16050326	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:166:63:0
+chr22	16050327	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:166:63:0
+chr22	16050328	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:166:63:0
+chr22	16050329	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:166:63:0
+chr22	16050330	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:166:63:0
+chr22	16050331	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:166:63:0
+chr22	16050332	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:166:63:0
+chr22	16050333	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:166:63:0
+chr22	16050334	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:166:63:0
+chr22	16050335	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:166:63:0
+chr22	16050336	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:166:63:0
+chr22	16050337	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:166:63:0
+chr22	16050338	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:166:63:0
+chr22	16050339	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:166:63:0
+chr22	16050340	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:166:63:0
+chr22	16050341	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:166:63:0
+chr22	16050342	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:166:63:0
+chr22	16050343	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:166:63:0
+chr22	16050344	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:166:63:0
+chr22	16050345	.	A	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:166:63:0
+chr22	16050345	.	C	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:220:74:0
+chr22	16050346	.	C	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:220:74:0
+chr22	16050347	.	C	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:220:74:0
+chr22	16050347	.	T	.	0	HighDepth	END=16050372;BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:229:77:0
+chr22	16050373	.	T	.	0	HighDepth	END=16050407;BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:241:81:0
+chr22	16050408	.	T	.	0	HighDepth	END=16050414;BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:200:75:0
+chr22	16050415	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:217:73:0
+chr22	16050416	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:217:73:0
+chr22	16050417	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:217:73:0
+chr22	16050418	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:217:73:0
+chr22	16050419	.	G	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:217:73:0
+chr22	16050419	.	C	.	0	HighDepth	END=16050420;BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:223:75:0
+chr22	16050421	.	T	.	0	PASS	.	GT:GQX:DP:DPF	0/0:223:75:1
+chr22	16050422	.	T	.	0	HighDepth	END=16050427;BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:223:75:0
+chr22	16050428	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:178:60:0
+chr22	16050429	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:178:60:0
+chr22	16050430	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:178:60:0
+chr22	16050431	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:178:60:0
+chr22	16050432	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:178:60:0
+chr22	16050433	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:178:60:0
+chr22	16050434	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:178:60:0
+chr22	16050435	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:178:60:0
+chr22	16050436	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:178:60:0
+chr22	16050437	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:178:60:0
+chr22	16050438	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:178:60:0
+chr22	16050439	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:178:60:0
+chr22	16050440	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:178:60:0
+chr22	16050441	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:178:60:0
+chr22	16050442	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:178:60:0
+chr22	16050443	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:178:60:0
+chr22	16050444	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:178:60:0
+chr22	16050445	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:178:60:0
+chr22	16050446	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:178:60:0
+chr22	16050447	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:178:60:0
+chr22	16050448	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:178:60:0
+chr22	16050449	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:178:60:0
+chr22	16050450	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:178:60:0
+chr22	16050451	.	T	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:178:60:0
+chr22	16050451	.	C	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:142:54:0
+chr22	16050452	.	C	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:142:54:0
+chr22	16050453	.	C	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:142:54:0
+chr22	16050454	.	C	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:142:54:0
+chr22	16050455	.	C	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:142:54:0
+chr22	16050456	.	C	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:142:54:0
+chr22	16050457	.	C	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:142:54:0
+chr22	16050458	.	C	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:142:54:0
+chr22	16050459	.	C	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:142:54:0
+chr22	16050460	.	C	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:142:54:0
+chr22	16050461	.	C	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:142:54:0
+chr22	16050462	.	C	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:142:54:0
+chr22	16050463	.	C	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:142:54:0
+chr22	16050464	.	C	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:142:54:0
+chr22	16050465	.	C	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:142:54:0
+chr22	16050466	.	C	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:142:54:0
+chr22	16050467	.	C	.	0	PASS	BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:142:54:0
diff --git a/test/convert.gvcf.vcf b/test/convert.gvcf.vcf
new file mode 100644
index 0000000..402d57f
--- /dev/null
+++ b/test/convert.gvcf.vcf
@@ -0,0 +1,107 @@
+##fileformat=VCFv4.1
+##FILTER=<ID=PASS,Description="All filters passed">
+##FORMAT=<ID=GQX,Number=1,Type=Integer,Description="Minimum of {Genotype quality assuming variant position,Genotype quality assuming non-variant position}">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Float,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Filtered basecall depth used for site genotyping">
+##FORMAT=<ID=DPF,Number=1,Type=Integer,Description="Basecalls filtered from input prior to site genotyping">
+##FORMAT=<ID=AD,Number=.,Type=Integer,Description="Allelic depths for the ref and alt alleles in the order listed. For indels this value only includes reads which confidently support each allele (posterior prob 0.999 or higher that read contains indicated allele vs all other intersecting indel alleles)">
+##FORMAT=<ID=DPI,Number=1,Type=Integer,Description="Read depth associated with indel, taken from the site preceding the indel.">
+##INFO=<ID=END,Number=1,Type=Integer,Description="End position of the region described in this record">
+##INFO=<ID=BLOCKAVG_min30p3a,Number=0,Type=Flag,Description="Non-variant site block. All sites in a block are constrained to be non-variant, have the same filter value, and have all sample values in range [x,y], y <= max(x+3,(x*1.3)). All printed site block sample values are the minimum observed in the region spanned by the block">
+##INFO=<ID=SNVSB,Number=1,Type=Float,Description="SNV site strand bias">
+##INFO=<ID=SNVHPOL,Number=1,Type=Integer,Description="SNV contextual homopolymer length">
+##INFO=<ID=CIGAR,Number=A,Type=String,Description="CIGAR alignment for each alternate indel allele">
+##INFO=<ID=RU,Number=A,Type=String,Description="Smallest repeating sequence unit extended or contracted in the indel allele relative to the reference. RUs are not reported if longer than 20 bases.">
+##INFO=<ID=REFREP,Number=A,Type=Integer,Description="Number of times RU is repeated in reference.">
+##INFO=<ID=IDREP,Number=A,Type=Integer,Description="Number of times RU is repeated in indel allele.">
+##FILTER=<ID=IndelConflict,Description="Locus is in region with conflicting indel calls">
+##FILTER=<ID=SiteConflict,Description="Site genotype conflicts with proximal indel call. This is typically a heterozygous SNV call made inside of a heterozygous deletion">
+##FILTER=<ID=LowGQX,Description="Locus GQX is less than 30 or not present">
+##FILTER=<ID=HighDPFRatio,Description="The fraction of basecalls filtered out at a site is greater than 0.3">
+##FILTER=<ID=HighSNVSB,Description="SNV strand bias value (SNVSB) exceeds 10">
+##FILTER=<ID=HighREFREP,Description="Locus contains an indel allele occurring in a homopolymer or dinucleotide track with a reference repeat greater than 8">
+##FILTER=<ID=HighDepth,Description="Locus depth is greater than 3x the mean chromosome depth">
+##reference=file:///illumina/scripts/clia/Genomes/Homo_sapiens/UCSC/hg19_rCRS/Sequence/WholeGenomeFasta/genome.fa
+##contig=<ID=chr22,length=51304566>
+##SnvTheta=0.001
+##IndelTheta=0.0001
+##MaxDepth_chr1=114.18
+##MaxDepth_chr10=131.73
+##MaxDepth_chr11=117.27
+##MaxDepth_chr12=116.97
+##MaxDepth_chr13=102.24
+##MaxDepth_chr14=101.55
+##MaxDepth_chr15=95.22
+##MaxDepth_chr16=111.33
+##MaxDepth_chr17=112.59
+##MaxDepth_chr18=121.86
+##MaxDepth_chr19=111.12
+##MaxDepth_chr2=121.83
+##MaxDepth_chr20=111.24
+##MaxDepth_chr21=98.43
+##MaxDepth_chr22=76.23
+##MaxDepth_chr3=120.09
+##MaxDepth_chr4=124.50
+##MaxDepth_chr5=119.82
+##MaxDepth_chr6=122.22
+##MaxDepth_chr7=120.27
+##MaxDepth_chr8=120.45
+##MaxDepth_chr9=102.48
+##MaxDepth_chrM=7005.66
+##MaxDepth_chrX=61.05
+##MaxDepth_chrY=37.17
+##FILTER=<ID=IndelSizeFilter,Description="Indel is outside reportable size range. Insertion range: [1,3], Deletion range: [1,11]">
+##gvcftools_version="0.16"
+##gvcftools_cmdline="/illumina/scripts/clia/workflows/IsisWorkflow/IsisWorkflow_v2.0.13/bin/set_haploid_region --ref /illumina/scripts/clia/Genomes/Homo_sapiens/UCSC/hg19_rCRS/Sequence/WholeGenomeFasta/genome.fa --region-file /illumina/scripts/clia/workflows/IsisWorkflow/IsisWorkflow_v2.0.13/bin/../data/het_mask/ncbi37/male.bed"
+##FILTER=<ID=HAPLOID_CONFLICT,Description="Locus has heterozygous genotype in a haploid region.">
+##FORMAT=<ID=OPL,Number=.,Type=Integer,Description="Original PL value before ploidy correction">
+##INFO=<ID=phastCons,Number=0,Type=Flag,Description="overlaps a phastCons element">
+##INFO=<ID=AA,Number=1,Type=String,Description="Ancestral Allele, ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/pilot_data/technical/reference/ancestral_alignments/README">
+##INFO=<ID=AF,Number=A,Type=String,Description="1000 Genomes Allele Frequency based on AC/AN; Format: Allele:AlleleFrequency">
+##INFO=<ID=AMR_AF,Number=A,Type=String,Description="1000 Genomes Allele Frequency for samples from AMR population based on AC/AN; Format: Allele:AlleleFrequency">
+##INFO=<ID=ASN_AF,Number=A,Type=String,Description="1000 Genomes Allele Frequency for samples from ASN population based on AC/AN; Format: Allele:AlleleFrequency">
+##INFO=<ID=AFR_AF,Number=A,Type=String,Description="1000 Genomes Allele Frequency for samples from AFR population based on AC/AN; Format: Allele:AlleleFrequency">
+##INFO=<ID=EUR_AF,Number=A,Type=String,Description="1000 Genomes Allele Frequency for samples from EUR population based on AC/AN; Format: Allele:AlleleFrequency">
+##INFO=<ID=CLNACC,Number=.,Type=String,Description="Accession and version number assigned by ClinVar to the genotype/phenotype relationship. Multiple entries for an allele are pipe-delimited">
+##INFO=<ID=CLNSIG,Number=.,Type=String,Description="String that describes the clinical significance. Possible values: unknown, untested, non-pathogenic, probable-non-pathogenic, probable-pathogenic, pathogenic, drug-response, histocompatibility, other. Multiple values are pipe-delimited">
+##INFO=<ID=CLNORIGIN,Number=.,Type=String,Description="String that describes the origin of the variant allele. Possible values: unknown, germline, somatic, inherited, paternal, maternal, de-novo, biparental, uniparental, not-tested, test-inconclusive, other. Multiple values for an allele are pipe-delimited">
+##INFO=<ID=CLNSRC,Number=.,Type=String,Description="Variant clinical source or channel. Multiple values for an allele are pipe-delimited">
+##INFO=<ID=CLNSRCID,Number=.,Type=String,Description="Identifier used by source defined in CLNSRC. Multiple values are pipe-delimited">
+##INFO=<ID=CLNGENEINFO,Number=.,Type=String,Description="Gene symbol(s) and NCBI GeneID(s). The gene symbol and ID are delimited by a colon and multiple such pairs are pipe-delimited, Example SYMBOL1:GeneID1|SYMBOL2:GeneID2">
+##INFO=<ID=CLNDBN,Number=.,Type=String,Description="Disease name used by the database specified by CLNSRC. Values corresponding to each CLNACC entry are pipe-delimited">
+##INFO=<ID=CLNDSDB,Number=.,Type=String,Description="Colon-delimited list of variant disease database name(s). Multiple values from a single database are pipe-delimited">
+##INFO=<ID=CLNDSDBID,Number=.,Type=String,Description="Colon-delimited list of variant disease database identifier(s). Multiple values from a single database are pipe-delimited">
+##INFO=<ID=CSQ,Number=A,Type=String,Description="Consequence type as predicted by VEP. Format: Allele|Gene|Feature|Feature_type|Consequence|cDNA_position|CDS_position|Protein_position|Amino_acids|Codons|Existing_variation|EXON|INTRON|HGNC|MOTIF_NAME|MOTIF_POS|HIGH_INF_POS|MOTIF_SCORE_CHANGE|DISTANCE|CANONICAL|SIFT|PolyPhen|GMAF|ENSP|DOMAINS|CCDS|HGVSc|HGVSp|CELL_TYPE">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	SAMPLE99
+chr22	1	.	N	.	0	LowGQX	END=16050039;BLOCKAVG_min30p3a	GT:GQX:DP:DPF	.:.:0:0
+chr22	16050040	.	C	.	0	LowGQX	END=16050050;BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:5:2:0
+chr22	16050051	.	C	.	0	LowGQX	END=16050056;BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:10:4:0
+chr22	16050057	.	C	.	0	LowGQX	END=16050072;BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:15:6:0
+chr22	16050073	.	G	.	0	LowGQX	END=16050080;BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:21:8:0
+chr22	16050081	.	C	.	0	PASS	END=16050085;BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:30:11:0
+chr22	16050086	.	G	.	0	PASS	END=16050102;BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:42:15:0
+chr22	16050103	.	T	.	0	PASS	END=16050115;BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:54:19:0
+chr22	16050116	.	G	C	23	LowGQX	SNVSB=0;SNVHPOL=2	GT:GQ:GQX:DP:DPF:AD	0/1:56:23:22:0:16,6
+chr22	16050117	.	T	.	0	PASS	END=16050131;BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:69:24:0
+chr22	16050132	.	A	.	0	PASS	END=16050170;BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:84:29:0
+chr22	16050171	.	G	.	0	PASS	END=16050215;BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:90:31:0
+chr22	16050216	.	T	.	0	PASS	END=16050217;BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:93:32:2
+chr22	16050218	.	T	.	0	PASS	END=16050234;BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:102:35:0
+chr22	16050235	.	T	.	0	PASS	.	GT:GQX:DP:DPF	0/0:72:36:0
+chr22	16050236	.	T	.	0	PASS	END=16050261;BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:87:30:0
+chr22	16050262	.	A	.	0	PASS	END=16050279;BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:66:23:0
+chr22	16050280	.	G	.	0	PASS	END=16050287;BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:87:30:0
+chr22	16050288	.	A	.	0	PASS	END=16050299;BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:114:39:0
+chr22	16050300	.	G	.	0	PASS	END=16050309;BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:150:51:0
+chr22	16050310	.	A	.	0	PASS	END=16050344;BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:166:63:0
+chr22	16050345	.	C	.	0	PASS	END=16050346;BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:220:74:0
+chr22	16050347	.	T	.	0	HighDepth	END=16050372;BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:229:77:0
+chr22	16050373	.	T	.	0	HighDepth	END=16050407;BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:241:81:0
+chr22	16050408	.	T	.	0	HighDepth	END=16050414;BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:200:75:0
+chr22	16050415	.	G	.	0	PASS	END=16050418;BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:217:73:0
+chr22	16050419	.	C	.	0	HighDepth	END=16050420;BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:223:75:0
+chr22	16050421	.	T	.	0	PASS	.	GT:GQX:DP:DPF	0/0:223:75:1
+chr22	16050422	.	T	.	0	HighDepth	END=16050427;BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:223:75:0
+chr22	16050428	.	T	.	0	PASS	END=16050450;BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:178:60:0
+chr22	16050451	.	C	.	0	PASS	END=16050466;BLOCKAVG_min30p3a	GT:GQX:DP:DPF	0/0:142:54:0
diff --git a/test/convert.hls.haps b/test/convert.hls.haps
new file mode 100644
index 0000000..5b0198e
--- /dev/null
+++ b/test/convert.hls.haps
@@ -0,0 +1,32 @@
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+1 0 1 1 0 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+1 0 0 1 0 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+1 0 1 1 0 1 1 0 1 0 0 0 0 0 0 1 0 0 0 0
+0 0 0 0 ? ? 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 1 0 0 0 0 1 1 0 1 0 0 0 0 0 0* 1*
+0 0 0 0 1 0 0 0 0 1 1 0 1 0 0 0 0 0 0 1
+0 0 0 0 1 0 0 0 0 1 1 0 1 0 0 0 0 0 0 1
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+1 0 1 1 0 1 1 1 1 0 0 1 0 0 0 1 0 0 1 0
+0 0 0 0 1 0 0 0 0 1 1 1 1 0 0 0 0 0 0 1
+0 0 0 0 1 0 0 0 0 1 1 0 1 0 0 0 0 0 0 1
+0 0 0 0 1 0 0 0 0 1 1 0 1 0 0 0 0 0 0 1
+0 0 0 0 1 0 0 0 0 1 1 0 1 0 0 0 0 0 0 1
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 - 1 - 1 - 0 - 1 - 1 1 1 0 0 1 0 0 0 1
+0 - 1 - 0 - 0 - 0 - 0 0 0 0 0 1 0 0 0 0
+0 - 0 - 1 - 0 - 1 - 1 0 1 0 0 0 0 0 0 1
+0 - 0 - 0 - 0 - 0 - 0 0 0 0 0 0 0 0 0 0
+0 - 0 - 0 - 0 - 0 - 0 0 0 0 0 0 0 0 0 0
+0 - 0 - 1 - 0 - 1 - 1 0 1 0 0 0 0 0 0 1
+? - 0 - 0 - 1 - 0 - 0 1 0 0 0 0 0 1 1 0
+0 - 0 - 0 - 0 - 0 - 0 0 0 0 0 0 0 0 0 0
diff --git a/test/convert.hls.legend b/test/convert.hls.legend
new file mode 100644
index 0000000..71d2e4c
--- /dev/null
+++ b/test/convert.hls.legend
@@ -0,0 +1,33 @@
+id position a0 a1
+X:2698560_G_A 2698560 G A
+X:2698630_A_G 2698630 A G
+X:2698758_CAA_C 2698758 CAA C
+X:2698769_AAG_A 2698769 AAG A
+X:2698789_C_G 2698789 C G
+X:2698822_A_C 2698822 A C
+X:2698831_G_A 2698831 G A
+X:2698889_T_C 2698889 T C
+X:2698923_G_A 2698923 G A
+X:2698953_A_AGG 2698953 A AGG
+X:2698954_G_A 2698954 G A
+X:2699002_C_A 2699002 C A
+X:2699025_T_C 2699025 T C
+X:2699091_G_A 2699091 G A
+X:2699187_T_C 2699187 T C
+X:2699188_G_C 2699188 G C
+X:2699189_T_C 2699189 T C
+X:2699217_C_T 2699217 C T
+X:2699246_C_A 2699246 C A
+X:2699275_T_G 2699275 T G
+X:2699350_A_T 2699350 A T
+X:2699360_T_C 2699360 T C
+X:2699450_A_C 2699450 A C
+X:2699507_T_C 2699507 T C
+X:2699555_C_A 2699555 C A
+X:2699645_G_T 2699645 G T
+X:2699676_G_A 2699676 G A
+X:2699728_C_T 2699728 C T
+X:2699775_C_A 2699775 C A
+X:2699898_C_CT 2699898 C CT
+X:2699968_A_G 2699968 A G
+X:2699970_T_C 2699970 T C
diff --git a/test/convert.hls.samples b/test/convert.hls.samples
new file mode 100644
index 0000000..c1eea1a
--- /dev/null
+++ b/test/convert.hls.samples
@@ -0,0 +1,11 @@
+sample population group sex
+NA00001 NA00001 NA00001 2
+NA00002 NA00002 NA00002 2
+NA00003 NA00003 NA00003 2
+NA00004 NA00004 NA00004 2
+NA00005 NA00005 NA00005 2
+NA00006 NA00006 NA00006 2
+NA00007 NA00007 NA00007 2
+NA00008 NA00008 NA00008 2
+NA00009 NA00009 NA00009 2
+NA00010 NA00010 NA00010 2
diff --git a/test/convert.hs.hap b/test/convert.hs.hap
new file mode 100644
index 0000000..a9cbbdd
--- /dev/null
+++ b/test/convert.hs.hap
@@ -0,0 +1,32 @@
+X X:2698560_G_A 2698560 G A 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+X X:2698630_A_G 2698630 A G 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+X X:2698758_CAA_C 2698758 CAA C 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+X X:2698769_AAG_A 2698769 AAG A 1 0 1 1 0 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0
+X X:2698789_C_G 2698789 C G 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+X X:2698822_A_C 2698822 A C 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+X X:2698831_G_A 2698831 G A 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+X X:2698889_T_C 2698889 T C 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+X X:2698923_G_A 2698923 G A 1 0 0 1 0 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0
+X X:2698953_A_AGG 2698953 A AGG 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+X X:2698954_G_A 2698954 G A 1 0 1 1 0 1 1 0 1 0 0 0 0 0 0 1 0 0 0 0
+X X:2699002_C_A 2699002 C A 0 0 0 0 ? ? 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+X X:2699025_T_C 2699025 T C 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+X X:2699091_G_A 2699091 G A 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+X X:2699187_T_C 2699187 T C 0 0 0 0 1 0 0 0 0 1 1 0 1 0 0 0 0 0 0* 1*
+X X:2699188_G_C 2699188 G C 0 0 0 0 1 0 0 0 0 1 1 0 1 0 0 0 0 0 0 1
+X X:2699189_T_C 2699189 T C 0 0 0 0 1 0 0 0 0 1 1 0 1 0 0 0 0 0 0 1
+X X:2699217_C_T 2699217 C T 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+X X:2699246_C_A 2699246 C A 1 0 1 1 0 1 1 1 1 0 0 1 0 0 0 1 0 0 1 0
+X X:2699275_T_G 2699275 T G 0 0 0 0 1 0 0 0 0 1 1 1 1 0 0 0 0 0 0 1
+X X:2699350_A_T 2699350 A T 0 0 0 0 1 0 0 0 0 1 1 0 1 0 0 0 0 0 0 1
+X X:2699360_T_C 2699360 T C 0 0 0 0 1 0 0 0 0 1 1 0 1 0 0 0 0 0 0 1
+X X:2699450_A_C 2699450 A C 0 0 0 0 1 0 0 0 0 1 1 0 1 0 0 0 0 0 0 1
+X X:2699507_T_C 2699507 T C 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+X X:2699555_C_A 2699555 C A 0 - 1 - 1 - 0 - 1 - 1 1 1 0 0 1 0 0 0 1
+X X:2699645_G_T 2699645 G T 0 - 1 - 0 - 0 - 0 - 0 0 0 0 0 1 0 0 0 0
+X X:2699676_G_A 2699676 G A 0 - 0 - 1 - 0 - 1 - 1 0 1 0 0 0 0 0 0 1
+X X:2699728_C_T 2699728 C T 0 - 0 - 0 - 0 - 0 - 0 0 0 0 0 0 0 0 0 0
+X X:2699775_C_A 2699775 C A 0 - 0 - 0 - 0 - 0 - 0 0 0 0 0 0 0 0 0 0
+X X:2699898_C_CT 2699898 C CT 0 - 0 - 1 - 0 - 1 - 1 0 1 0 0 0 0 0 0 1
+X X:2699968_A_G 2699968 A G ? - 0 - 0 - 1 - 0 - 0 1 0 0 0 0 0 1 1 0
+X X:2699970_T_C 2699970 T C 0 - 0 - 0 - 0 - 0 - 0 0 0 0 0 0 0 0 0 0
diff --git a/test/convert.hs.sample b/test/convert.hs.sample
new file mode 100644
index 0000000..080f72a
--- /dev/null
+++ b/test/convert.hs.sample
@@ -0,0 +1,12 @@
+ID_1 ID_2 missing
+0 0 0
+NA00001 NA00001 0
+NA00002 NA00002 0
+NA00003 NA00003 0
+NA00004 NA00004 0
+NA00005 NA00005 0
+NA00006 NA00006 0
+NA00007 NA00007 0
+NA00008 NA00008 0
+NA00009 NA00009 0
+NA00010 NA00010 0
diff --git a/test/convert.vcf b/test/convert.vcf
new file mode 100644
index 0000000..c80278b
--- /dev/null
+++ b/test/convert.vcf
@@ -0,0 +1,40 @@
+##fileformat=VCFv4.1
+##FILTER=<ID=PASS,Description="All filters passed">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=PL,Number=G,Type=Integer,Description="List of Phred-scaled genotype likelihoods">
+##FORMAT=<ID=GP,Number=G,Type=Float,Description="Estimated Genotype Probability">
+##contig=<ID=X,assembly=b37,length=155270560>
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	NA00001	NA00002	NA00003	NA00004	NA00005	NA00006	NA00007	NA00008	NA00009	NA00010
+X	2698560	.	G	A	102	.	.	GT:PL:GP	0|0:0,21,177:1,0,0	0|0:0,30,206:1,0,0	0|0:0,21,177:1,0,0	0|0:0,15,132:1,0,0	0|0:0,9,90:1,0,0	0|0:0,15,114:1,0,0	0|0:0,15,118:1,0,0	0|0:0,15,133:1,0,0	0|0:0,15,144:1,0,0	0|0:0,24,191:1,0,0
+X	2698630	.	A	G	537	.	.	GT:PL:GP	0|0:0,21,186:1,0,0	0|0:0,21,176:1,0,0	0|0:0,15,106:1,0,0	0|0:0,18,127:1,0,0	0|0:0,6,62:1,0,0	0|0:0,15,146:1,0,0	0|0:0,18,141:1,0,0	0|0:0,21,173:1,0,0	0|0:0,12,119:1,0,0	0|0:0,15,145:1,0,0
+X	2698758	.	CAA	C	999	.	.	GT:PL:GP	0|0:0,6,16:0.8292,0.1708,0	0|1:0,0,0:0.0278,0.5743,0.3979	0|0:0,0,0:0.6336,0.3664,0	0|0:0,3,8:0.8611,0.1389,0	0|0:0,0,8:0.7628,0.2372,0	0|0:0,9,18:1,0,0	0|0:0,9,23:1,0,0	0|0:0,9,15:0.9855,0.0145,0	0|0:0,6,10:1,0,0	0|0:0,21,33:1,0,0
+X	2698769	.	AAG	A	999	.	.	GT:PL:GP	1|0:17,0,7:0.0069,0.9931,0	1|1:0,0,0:0.0004,0.0892,0.9104	0|1:17,3,0:0.0045,0.9954,0.0001	1|0:11,0,2:0.0085,0.9915,0	1|0:11,0,15:0.0003,0.9997,0	0|0:0,15,40:1,0,0	0|0:0,9,23:1,0,0	0|0:0,15,25:0.8474,0.1526,0	0|0:0,15,34:1,0,0	0|0:0,33,56:1,0,0
+X	2698770	.	AG	A,AAGG	999	.	.	GT:PL:GP	0|0:0,12,103,12,103,103:0.925,0.0717,0,0.0033,0,0	0|1:0,3,21,3,21,21:0.4944,0.368,0.0018,0.1343,0.0013,0.0002	0|0:0,0,0,0,0,0:0.5458,0.4085,0,0.0457,0,0	0|0:0,3,36,3,36,36:0.8126,0.1758,0,0.0116,0,0	1|0:37,0,86,49,92,130:0,1,0,0,0,0	0|0:0,15,125,15,125,125:1,0,0,0,0,0	0|0:0,9,105,9,105,105:1,0,0,0,0,0	0|0:0,15,109,15,109,109:0.9964,0.0034,0,0.0002,0,0	0|0:0,15,137,15,137,137:1,0,0,0,0,0	0|0:0,33,215,33,215,215:1,0,0,0,0,0
+X	2698789	.	C	G	153	.	.	GT:PL:GP	0|0:0,21,152:1,0,0	0|0:0,21,131:1,0,0	0|0:0,12,113:1,0,0	0|0:0,12,104:1,0,0	0|0:0,21,137:1,0,0	0|0:0,15,118:0.9999,0.0001,0	0|0:0,15,111:1,0,0	0|0:0,24,152:1,0,0	0|0:0,18,147:1,0,0	0|0:0,33,183:1,0,0
+X	2698822	.	A	C	85.2	.	.	GT:PL:GP	0|0:0,21,167:1,0,0	0|0:0,21,171:1,0,0	0|0:0,21,158:1,0,0	0|0:0,18,154:1,0,0	0|0:0,15,135:1,0,0	0|0:0,15,132:1,0,0	0|0:0,21,168:1,0,0	0|0:0,21,175:1,0,0	0|0:0,15,142:1,0,0	0|0:0,21,172:1,0,0
+X	2698831	.	G	A	303	.	.	GT:PL:GP	0|0:0,15,129:1,0,0	0|0:0,27,179:1,0,0	0|0:0,24,196:1,0,0	0|0:0,21,158:1,0,0	0|0:0,18,154:1,0,0	0|0:0,12,112:1,0,0	0|0:0,24,162:1,0,0	0|0:0,21,168:1,0,0	0|0:0,9,95:1,0,0	0|0:0,21,164:1,0,0
+X	2698889	.	T	C	74.4	.	.	GT:PL:GP	0|0:0,27,193:1,0,0	0|0:0,45,255:1,0,0	0|0:0,21,190:1,0,0	0|0:0,36,254:1,0,0	0|0:0,30,226:1,0,0	0|0:0,36,253:1,0,0	0|0:0,18,156:1,0,0	0|0:0,9,87:1,0,0	0|0:0,9,98:1,0,0	0|0:0,24,205:1,0,0
+X	2698923	.	G	A	999	.	.	GT:PL:GP	1|0:62,0,133:0,1,0	0|1:164,0,91:0,1,0	0|1:35,0,73:0,1,0	1|0:91,0,108:0,1,0	1|0:67,0,71:0,1,0	0|0:0,30,187:1,0,0	0|0:0,9,73:1,0,0	0|0:0,12,99:1,0,0	0|0:0,18,153:1,0,0	0|0:0,18,138:1,0,0
+X	2698953	.	A	AGG	267	.	.	GT:PL:GP	0|0:0,27,111:1,0,0	0|0:0,33,124:1,0,0	0|0:0,12,62:1,0,0	0|0:0,15,86:1,0,0	0|0:0,12,58:1,0,0	0|0:0,15,69:1,0,0	0|0:0,6,34:1,0,0	0|0:0,18,83:1,0,0	0|0:0,18,80:1,0,0	0|0:0,15,74:1,0,0
+X	2698954	.	G	A	999	.	.	GT:PL:GP	1|0:69,0,139:0,1,0	1|1:199,24,0:0,0,1	0|1:15,0,82:0,1,0	1|0:32,0,76:0,1,0	1|0:16,0,80:0,1,0	0|0:0,15,131:1,0,0	0|0:0,6,58:1,0,0	0|1:99,0,39:0,1,0	0|0:0,18,163:1,0,0	0|0:0,15,136:1,0,0
+X	2699002	.	C	A	65.1	.	.	GT:PL:GP	0|0:0,18,144:1,0,0	0|0:0,12,115:1,0,0	.|.:0,12,120:1,0,0	0|0:0,15,131:1,0,0	0|0:0,6,29:1,0,0	0|0:0,9,95:1,0,0	0|0:0,9,79:1,0,0	0|0:0,24,188:1,0,0	0|0:0,15,124:1,0,0	0|0:0,9,93:1,0,0
+X	2699025	.	T	C	44.9	.	.	GT:PL:GP	0|0:0,24,189:1,0,0	0|0:0,12,98:1,0,0	0|0:0,15,130:1,0,0	0|0:0,15,113:1,0,0	0|0:0,6,63:1,0,0	0|0:0,24,198:1,0,0	0|0:0,12,92:1,0,0	0|0:0,24,197:1,0,0	0|0:0,9,97:1,0,0	0|0:0,12,108:1,0,0
+X	2699091	.	G	A	45	.	.	GT:PL:GP	0|0:0,18,162:1,0,0	0|0:0,21,153:1,0,0	0|0:0,12,101:1,0,0	0|0:0,12,97:1,0,0	0|0:0,24,188:1,0,0	0|0:0,24,194:1,0,0	0|0:0,15,127:1,0,0	0|0:0,21,169:1,0,0	0|0:0,15,129:1,0,0	0|0:0,21,171:1,0,0
+X	2699187	.	T	C	999	.	.	GT:PL:GP	0|0:0,24,200:1,0,0	0|0:0,24,191:1,0,0	1|0:48,0,85:0,1,0	0|0:0,15,145:1,0,0	0|1:58,0,45:0,1,0	1|0:61,0,50:0,1,0	1|0:22,0,51:0,1,0	0|0:0,27,211:1,0,0	0|0:0,9,96:0.9999,0.0001,0	0/1:23,0,160:0,1,0
+X	2699188	.	G	C	999	.	.	GT:PL:GP	0|0:0,24,194:1,0,0	0|0:0,24,167:1,0,0	1|0:48,0,78:0,1,0	0|0:0,15,131:1,0,0	0|1:63,0,40:0,1,0	1|0:50,0,44:0,1,0	1|0:22,0,48:0,1,0	0|0:0,27,212:1,0,0	0|0:0,9,87:0.9999,0.0001,0	0|1:23,0,154:0,1,0
+X	2699189	.	T	C	999	.	.	GT:PL:GP	0|0:0,24,199:1,0,0	0|0:0,24,176:1,0,0	1|0:44,0,87:0,1,0	0|0:0,15,136:1,0,0	0|1:62,0,46:0,1,0	1|0:61,0,46:0,1,0	1|0:22,0,49:0,1,0	0|0:0,27,212:1,0,0	0|0:0,9,93:0.9999,0.0001,0	0|1:23,0,164:0,1,0
+X	2699217	.	C	T	60.3	.	.	GT:PL:GP	0|0:0,18,158:1,0,0	0|0:0,18,119:1,0,0	0|0:0,21,152:1,0,0	0|0:0,21,162:1,0,0	0|0:0,12,102:1,0,0	0|0:0,18,144:1,0,0	0|0:0,12,108:1,0,0	0|0:0,18,146:1,0,0	0|0:0,12,98:1,0,0	0|0:0,18,155:1,0,0
+X	2699246	.	C	A	999	.	.	GT:PL:GP	1|0:128,0,15:0,0.9998,0.0002	1|1:147,21,0:0,0.0001,0.9999	0|1:130,0,5:0,0.9977,0.0023	1|1:237,33,0:0,0,1	1|0:45,0,75:0,1,0	0|1:145,0,49:0,1,0	0|0:0,15,109:1,0,0	0|1:13,0,63:0.0002,0.9998,0	0|0:0,30,178:0.9953,0.0047,0	1|0:120,0,57:0,1,0
+X	2699275	.	T	G	999	.	.	GT:PL:GP	0|0:0,18,165:0.9998,0.0002,0	0|0:0,18,152:1,0,0	1|0:0,9,95:0.0023,0.9977,0	0|0:0,33,239:1,0,0	0|1:125,0,40:0,1,0	1|1:205,27,0:0,0,1	1|0:69,0,43:0,1,0	0|0:0,15,139:1,0,0	0|0:0,30,219:1,0,0	0|1:96,0,54:0,1,0
+X	2699350	.	A	T	999	.	.	GT:PL:GP	0|0:0,27,206:1,0,0	0|0:0,15,139:1,0,0	1|0:54,0,25:0,1,0	0|0:0,12,117:0.9996,0.0004,0	0|1:79,0,73:0,1,0	1|0:48,0,82:0,1,0	1|0:68,0,45:0,1,0	0|0:0,30,216:1,0,0	0|0:0,27,224:1,0,0	0|1:48,0,80:0,1,0
+X	2699360	.	T	C	999	.	.	GT:PL:GP	0|0:0,21,184:1,0,0	0|0:0,15,133:1,0,0	1|0:53,0,21:0,1,0	0|0:0,12,114:0.9996,0.0004,0	0|1:20,0,66:0,1,0	1|0:40,0,93:0,1,0	1|0:52,0,66:0,1,0	0|0:0,30,220:1,0,0	0|0:0,21,191:1,0,0	0|1:20,0,83:0,1,0
+X	2699450	.	A	C	999	.	.	GT:PL:GP	0|0:0,12,124:1,0,0	0|0:0,6,55:0.9976,0.0024,0	1|0:99,0,42:0,1,0	0|0:0,21,186:0.9999,0.0001,0	0|1:64,0,100:0,1,0	1|0:38,0,177:0,1,0	1|0:16,0,103:0,1,0	0|0:0,24,202:1,0,0	0|0:0,12,119:1,0,0	0|1:75,0,115:0,1,0
+X	2699507	.	T	C	195	.	.	GT:PL:GP	0|0:0,15,133:1,0,0	0|0:0,12,122:1,0,0	0|0:0,6,60:1,0,0	0|0:0,18,123:1,0,0	0|0:0,15,145:1,0,0	0|0:0,21,173:1,0,0	0|0:0,21,178:1,0,0	0|0:0,24,200:1,0,0	0|0:0,12,125:1,0,0	0|0:0,24,189:1,0,0
+X	2699555	.	C	A	999	.	.	GT:PL:GP	0:0,156:1,0	1:58,19:0,1	1:51,0:0,1	0:0,91:1,0	1:89,0:0,1	1|1:132,15,0:0,0,1	1|0:99,0,68:0,1,0	0|1:101,0,101:0,1,0	0|0:0,18,161:0.9998,0.0002,0	0|1:118,0,72:0,1,0
+X	2699645	.	G	T	999	.	.	GT:PL:GP	0:0,95:1,0	1:49,0:0,1	0:0,58:1,0	0:0,64:1,0	0:0,113:1,0	0|0:0,18,158:1,0,0	0|0:0,18,146:1,0,0	0|1:68,0,136:0,1,0	0|0:0,30,210:1,0,0	0|0:0,27,186:1,0,0
+X	2699676	.	G	A	999	.	.	GT:PL:GP	0:0,84:1,0	0:0,87:1,0	1:35,0:0,1	0:0,28:1,0	1:114,0:0,1	1|0:99,0,72:0,1,0	1|0:48,0,89:0,1,0	0|0:0,18,155:1,0,0	0|0:0,24,191:1,0,0	0|1:99,0,61:0,1,0
+X	2699728	.	C	T	69.7	.	.	GT:PL:GP	0:0,58:1,0	0:0,64:1,0	0:0,33:1,0	0:0,69:1,0	0:0,81:1,0	0|0:0,27,183:1,0,0	0|0:0,45,220:1,0,0	0|0:0,30,161:1,0,0	0|0:0,15,110:1,0,0	0|0:0,21,156:1,0,0
+X	2699775	.	C	A	71.1	.	.	GT:PL:GP	0:0,62:1,0	0:0,101:1,0	0:0,130:1,0	0:0,141:1,0	0:0,54:1,0	0|0:0,30,203:1,0,0	0|0:0,39,208:1,0,0	0|0:0,30,177:1,0,0	0|0:0,18,132:1,0,0	0|0:0,15,103:1,0,0
+X	2699898	.	C	CT	999	.	.	GT:PL:GP	0:0,32:1,0	0:0,11:1,0	1:11,0:0,1	0:0,11:1,0	1:31,0:0,1	1|0:11,0,24:0.0438,0.9562,0	1|0:8,0,17:0,1,0	0|0:0,33,72:1,0,0	0|0:0,27,69:1,0,0	0|1:11,4,12:0.0003,0.9997,0
+X	2699968	.	A	G	999	.	.	GT:PL:GP	.:0,84:1,0	0:0,32:1,0	0:0,57:1,0	1:131,0:0,1	0:0,66:1,0	0|1:89,0,44:0,1,0	0|0:0,18,157:1,0,0	0|0:0,45,255:1,0,0	0|1:75,0,109:0,1,0	1|0:98,0,62:0,1,0
+X	2699970	.	T	C	55.3	.	.	GT:PL:GP	0:0,68:1,0	0:0,34:1,0	0:0,32:1,0	0:0,162:1,0	0:0,63:1,0	0|0:0,15,149:1,0,0	0|0:0,21,181:1,0,0	0|0:0,45,255:1,0,0	0|0:0,27,207:1,0,0	0|0:0,24,196:1,0,0
diff --git a/test/dosage.out b/test/dosage.out
new file mode 100644
index 0000000..e3cab1d
--- /dev/null
+++ b/test/dosage.out
@@ -0,0 +1,15 @@
+#[1]CHROM	[2]POS	[3]REF	[4]ALT	[5]A	[6]B
+1	3000150	C	T	-1.0	-1.0
+1	3000151	C	T	-1.0	-1.0
+1	3062915	GTTT	G	1.0	1.0
+1	3062915	G	T	1.0	1.0
+1	3106154	CAAA	C	-1.0	-1.0
+1	3106154	C	CT	-1.0	-1.0
+1	3157410	GA	G	2.0	2.0
+1	3162006	GAA	G	-1.0	-1.0
+1	3177144	G	T	-1.0	-1.0
+1	3177144	G	.	0.0	0.0
+1	3184885	TAAAA	TA	-1.0	-1.0
+2	3199812	G	GTT	-1.0	-1.0
+3	3212016	CTT	C	-1.0	-1.0
+4	3258448	TACACACAC	T	-1.0	-1.0
diff --git a/test/empty.idx.out b/test/empty.idx.out
new file mode 100644
index 0000000..e69de29
diff --git a/test/empty.idx_count.out b/test/empty.idx_count.out
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/test/empty.idx_count.out
@@ -0,0 +1 @@
+0
diff --git a/test/empty.vcf b/test/empty.vcf
new file mode 100644
index 0000000..def4e42
--- /dev/null
+++ b/test/empty.vcf
@@ -0,0 +1,6 @@
+##fileformat=VCFv4.1
+##contig=<ID=11,length=135006516>
+##contig=<ID=20,length=63025520>
+##contig=<ID=X,length=155270560>
+##contig=<ID=Y,length=59373566>
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	NA00001	NA00002	NA00003
diff --git a/test/ex1.gtf.gz b/test/ex1.gtf.gz
new file mode 100644
index 0000000..693db0c
Binary files /dev/null and b/test/ex1.gtf.gz differ
diff --git a/test/ex2.vcf b/test/ex2.vcf
new file mode 100644
index 0000000..17b1896
--- /dev/null
+++ b/test/ex2.vcf
@@ -0,0 +1,23 @@
+##fileformat=VCFv4.1
+##reference=file:///seq/references/1000GenomesPilot-NCBI36.fasta
+##contig=<ID=20,length=62435964,assembly=B36,md5=f126cdf8a6e0c7f379d618ff66beb2da,species="Homo sapiens">
+##INFO=<ID=NS,Number=1,Type=Integer,Description="Number of Samples With Data">
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##INFO=<ID=AF,Number=A,Type=Float,Description="Allele Frequency">
+##INFO=<ID=AA,Number=1,Type=String,Description="Ancestral Allele">
+##INFO=<ID=DB,Number=0,Type=Flag,Description="dbSNP membership, build 129">
+##INFO=<ID=H2,Number=0,Type=Flag,Description="HapMap2 membership">
+##INFO=<ID=HOMSEQ,Number=.,Type=String>
+##FILTER=<ID=q10,Description="Quality below 10">
+##FILTER=<ID=s50,Description="Less than 50% of samples have data">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=HQ,Number=2,Type=Integer,Description="Haplotype Quality">
+##FORMAT=<ID=CNL,Number=.,Type=Integer>
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	NA00001	NA00002	NA00003
+20	14370	rs6054257	G	A	29.1	.	NS=3;DP=14;AF=0.5;HOMSEQ;DB	GT:GQ:DP:HQ:CNL	0|0:48:1:25,30:10,20	1|0:48:8:49,51:.	./.:43:5:.,.:1
+20	17330	.	T	A	.	q10;s50	NS=3;DP=11;AF=0.017;H2	GT:GQ:DP:HQ	0|0:49:3:58,50	0|1:3:5:65,3	0/0:41:3:4,5
+20	1110696	rs6040355	A	G,T	67	PASS	NS=2;DP=10;AF=0.333,0.667;AA=T;DB	GT:GQ:DP:HQ	1|2:21:6:23,27	2|1:2:0:18,2	2/2:35:4:10,20
+20	1230237	.	T	.	47	PASS	NS=3;DP=13;AA=T	GT:GQ:DP:HQ	0|0:54:7:56,60	0|0:48:4:51,51	./.
+20	1234567	microsat1	GTC	G,GTCT	50	PASS	NS=3;DP=9;AA=G	GT:GQ:DP	0/1:35:4	0/2:17:2	1/1:40:3
diff --git a/test/ex3.sam b/test/ex3.sam
new file mode 100644
index 0000000..974aa80
--- /dev/null
+++ b/test/ex3.sam
@@ -0,0 +1,14 @@
+ at SQ	SN:ref	LN:45
+ at SQ	SN:ref2	LN:40
+r001	163	ref	7	30	8M4I4M1D3M	=	37	39	TTAGATAAAGAGGATACTG	*	XX:B:S,12561,2,20,112	YY:i:100
+r002	0	ref	9	30	1S2I6M1P1I1P1I4M2I	*	0	0	AAAAGATAAGGGATAAA	*	XA:Z:abc	XB:i:-10
+r003	0	ref	9	30	5H6M	*	0	0	AGCTAA	*
+r004	0	ref	16	30	6M14N1I5M	*	0	0	ATAGCTCTCAGC	*
+r003	16	ref	29	30	6H5M	*	0	0	TAGGC	*
+r001	83	ref	37	30	9M	=	7	-39	CAGCGCCAT	*
+x1	0	ref2	1	30	20M	*	0	0	aggttttataaaacaaataa	*
+x2	0	ref2	2	30	21M	*	0	0	ggttttataaaacaaataatt	?????????????????????
+x3	0	ref2	6	30	9M4I13M	*	0	0	ttataaaacAAATaattaagtctaca	??????????????????????????
+x4	0	ref2	10	30	25M	*	0	0	CaaaTaattaagtctacagagcaac	?????????????????????????
+x5	0	ref2	12	30	24M	*	0	0	aaTaattaagtctacagagcaact	????????????????????????
+x6	0	ref2	14	30	23M	*	0	0	Taattaagtctacagagcaacta	???????????????????????
diff --git a/test/fill-AN-AC.out b/test/fill-AN-AC.out
new file mode 100644
index 0000000..82fc827
--- /dev/null
+++ b/test/fill-AN-AC.out
@@ -0,0 +1,38 @@
+##fileformat=VCFv4.1
+##FILTER=<ID=PASS,Description="All filters passed">
+##INFO=<ID=TEST,Number=1,Type=Integer,Description="Testing Tag">
+##FORMAT=<ID=TT,Number=A,Type=Integer,Description="Testing Tag, with commas and \"escapes\" and escaped escapes combined with \\\"quotes\\\\\"">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=GL,Number=G,Type=Float,Description="Genotype Likelihood">
+##FILTER=<ID=q10,Description="Quality below 10">
+##FILTER=<ID=test,Description="Testing filter">
+##contig=<ID=1,assembly=b37,length=249250621>
+##contig=<ID=2,assembly=b37,length=249250621>
+##contig=<ID=3,assembly=b37,length=198022430>
+##contig=<ID=4,assembly=b37,length=191154276>
+##test=<ID=4,IE=5>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##readme=AAAAAA
+##readme=BBBBBB
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##INFO=<ID=STR,Number=1,Type=String,Description="Test string type">
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B
+1	3000150	.	C	T	59.2	PASS	AN=0;AC=0	GT:GQ	./.:245	./.:245
+1	3000151	.	C	T	59.2	PASS	AN=0;AC=0	GT:DP:GQ	./.:32:245	./.:32:245
+1	3062915	id3D	GTTT	G	12.9	q10	DP4=1,2,3,4;INDEL;STR=test;AN=4;AC=2	GT:GQ:DP:GL	0/1:409:35:-20,-5,-20	0/1:409:35:-20,-5,-20
+1	3062915	idSNP	G	T,C	12.6	test	TEST=5;DP4=1,2,3,4;AN=3;AC=1,1	GT:TT:GQ:DP:GL	0/1:0,1:409:35:-20,-5,-20,-20,-5,-20	2:0,1:409:35:-20,-5,-20
+1	3106154	.	CAAA	C	342	PASS	AN=0;AC=0	GT:GQ:DP	./.:245:32	./.:245:32
+1	3106154	.	C	CT	59.2	PASS	AN=0;AC=0	GT:GQ:DP	./.:245:32	./.:245:32
+1	3157410	.	GA	G	90.6	q10	AN=4;AC=4	GT:GQ:DP	1/1:21:21	1/1:21:21
+1	3162006	.	GAA	G	60.2	PASS	AN=0;AC=0	GT:GQ:DP	./.:212:22	./.:212:22
+1	3177144	.	G	T	45	PASS	AN=0;AC=0	GT:GQ:DP	./.:150:30	./.:150:30
+1	3177144	.	G	.	45	PASS	AN=0	GT:GQ:DP	./.:150:30	./.:150:30
+1	3184885	.	TAAAA	TA,T	61.5	PASS	AN=0;AC=0,0	GT:GQ:DP	./.:12:10	./.:12:10
+2	3199812	.	G	GTT,GT	82.7	PASS	AN=0;AC=0,0	GT:GQ:DP	./.:322:26	./.:322:26
+3	3212016	.	CTT	C,CT	79	PASS	AN=0;AC=0,0	GT:GQ:DP	./.:91:26	./.:91:26
+4	3258448	.	TACACACAC	T	59.9	PASS	AN=0;AC=0	GT:GQ:DP	./.:325:31	./.:325:31
diff --git a/test/filter.1.out b/test/filter.1.out
new file mode 100644
index 0000000..bc2218a
--- /dev/null
+++ b/test/filter.1.out
@@ -0,0 +1,30 @@
+##fileformat=VCFv4.1
+##FILTER=<ID=PASS,Description="All filters passed">
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=GL,Number=G,Type=Float,Description="Genotype Likelihood">
+##FILTER=<ID=q10,Description="Quality below 10">
+##test=<xx=A,yy=B,zz=C>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##contig=<ID=1,assembly=b37,length=249250621>
+##contig=<ID=2,assembly=b37,length=249250621>
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##readme=AAAAAA
+##readme=BBBBBB
+##FILTER=<ID=SnpGap,Description="SNP within 2 bp of an indel">
+##FILTER=<ID=IndelGap,Description="Indel within 2 bp of an indel">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A
+1	1000	.	G	A	1806	PASS	DP=35;DP4=1,2,3,4;AN=2;AC=1	GT:GQ:DP:GL	0/1:409:35:-20,-5,-20
+1	1003	.	GT	G	1806	PASS	DP=35;DP4=1,2,3,4;AN=2;AC=1	GT:GQ:DP:GL	0/1:409:35:-20,-5,-20
+1	1007	.	G	A	1806	PASS	DP=35;DP4=1,2,3,4;AN=2;AC=1	GT:GQ:DP:GL	0/1:409:35:-20,-5,-20
+1	2000	.	T	C	1806	PASS	DP=35;DP4=1,2,3,4;AN=2;AC=1	GT:GQ:DP:GL	0/1:409:35:-20,-5,-20
+1	2003	.	T	TC	1806	PASS	DP=35;DP4=1,2,3,4;AN=2;AC=1	GT:GQ:DP:GL	0/1:409:35:-20,-5,-20
+1	2006	.	T	C	1806	PASS	DP=35;DP4=1,2,3,4;AN=2;AC=1	GT:GQ:DP:GL	0/1:409:35:-20,-5,-20
+2	1001	.	GT	G	1806	PASS	DP=35;DP4=1,2,3,4;AN=2;AC=1	GT:GQ:DP:GL	0/1:409:35:-20,-5,-20
+2	1008	.	GT	G	1806	PASS	DP=35;DP4=1,2,3,4;AN=2;AC=1	GT:GQ:DP:GL	0/1:409:35:-20,-5,-20
+2	2001	.	A	AT	1806	PASS	DP=35;DP4=1,2,3,4;AN=2;AC=1	GT:GQ:DP:GL	0/1:409:35:-20,-5,-20
+2	2006	.	A	AT	1806	PASS	DP=35;DP4=1,2,3,4;AN=2;AC=1	GT:GQ:DP:GL	0/1:409:35:-20,-5,-20
diff --git a/test/filter.1.vcf b/test/filter.1.vcf
new file mode 100644
index 0000000..de41bc6
--- /dev/null
+++ b/test/filter.1.vcf
@@ -0,0 +1,33 @@
+##fileformat=VCFv4.1
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=GL,Number=G,Type=Float,Description="Genotype Likelihood">
+##FILTER=<ID=q10,Description="Quality below 10">
+##test=<xx=A,yy=B,zz=C>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##contig=<ID=1,assembly=b37,length=249250621>
+##contig=<ID=2,assembly=b37,length=249250621>
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##readme=AAAAAA
+##readme=BBBBBB
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A
+1	1000	.	G	A	1806	.	DP=35;DP4=1,2,3,4;AN=2;AC=1	GT:GQ:DP:GL	0/1:409:35:-20,-5,-20
+1	1001	.	G	A	1806	.	DP=35;DP4=1,2,3,4;AN=2;AC=1	GT:GQ:DP:GL	0/1:409:35:-20,-5,-20
+1	1003	.	GT	G	1806	.	DP=35;DP4=1,2,3,4;AN=2;AC=1	GT:GQ:DP:GL	0/1:409:35:-20,-5,-20
+1	1006	.	G	A	1806	.	DP=35;DP4=1,2,3,4;AN=2;AC=1	GT:GQ:DP:GL	0/1:409:35:-20,-5,-20
+1	1007	.	G	A	1806	.	DP=35;DP4=1,2,3,4;AN=2;AC=1	GT:GQ:DP:GL	0/1:409:35:-20,-5,-20
+1	2000	.	T	C	1806	.	DP=35;DP4=1,2,3,4;AN=2;AC=1	GT:GQ:DP:GL	0/1:409:35:-20,-5,-20
+1	2001	.	T	C	1806	.	DP=35;DP4=1,2,3,4;AN=2;AC=1	GT:GQ:DP:GL	0/1:409:35:-20,-5,-20
+1	2003	.	T	TC	1806	.	DP=35;DP4=1,2,3,4;AN=2;AC=1	GT:GQ:DP:GL	0/1:409:35:-20,-5,-20
+1	2005	.	T	C	1806	.	DP=35;DP4=1,2,3,4;AN=2;AC=1	GT:GQ:DP:GL	0/1:409:35:-20,-5,-20
+1	2006	.	T	C	1806	.	DP=35;DP4=1,2,3,4;AN=2;AC=1	GT:GQ:DP:GL	0/1:409:35:-20,-5,-20
+2	1001	.	GT	G	1806	.	DP=35;DP4=1,2,3,4;AN=2;AC=1	GT:GQ:DP:GL	0/1:409:35:-20,-5,-20
+2	1004	.	GT	G	1806	.	DP=35;DP4=1,2,3,4;AN=2;AC=1	GT:GQ:DP:GL	0/1:409:35:-20,-5,-20
+2	1008	.	GT	G	1806	.	DP=35;DP4=1,2,3,4;AN=2;AC=1	GT:GQ:DP:GL	0/1:409:35:-20,-5,-20
+2	2001	.	A	AT	1806	.	DP=35;DP4=1,2,3,4;AN=2;AC=1	GT:GQ:DP:GL	0/1:409:35:-20,-5,-20
+2	2003	.	A	AT	1806	.	DP=35;DP4=1,2,3,4;AN=2;AC=1	GT:GQ:DP:GL	0/1:409:35:-20,-5,-20
+2	2006	.	A	AT	1806	.	DP=35;DP4=1,2,3,4;AN=2;AC=1	GT:GQ:DP:GL	0/1:409:35:-20,-5,-20
diff --git a/test/filter.2.out b/test/filter.2.out
new file mode 100644
index 0000000..0a53bf3
--- /dev/null
+++ b/test/filter.2.out
@@ -0,0 +1,38 @@
+##fileformat=VCFv4.1
+##FILTER=<ID=PASS,Description="All filters passed">
+##INFO=<ID=TEST,Number=1,Type=Integer,Description="Testing Tag">
+##FORMAT=<ID=TT,Number=A,Type=Integer,Description="Testing Tag, with commas and \"escapes\" and escaped escapes combined with \\\"quotes\\\\\"">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=GL,Number=G,Type=Float,Description="Genotype Likelihood">
+##FILTER=<ID=q10,Description="Quality below 10">
+##FILTER=<ID=test,Description="Testing filter">
+##contig=<ID=1,assembly=b37,length=249250621>
+##contig=<ID=2,assembly=b37,length=249250621>
+##contig=<ID=3,assembly=b37,length=198022430>
+##contig=<ID=4,assembly=b37,length=191154276>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##readme=AAAAAA
+##readme=BBBBBB
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##INFO=<ID=STR,Number=1,Type=String,Description="Test string type">
+##FILTER=<ID=Modified,Description="Set if true: QUAL==59.2 || (INDEL=0 & (FMT/GQ=25 | FMT/DP=10))">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B
+1	3000150	.	C	T	59.2	Modified	AN=0;AC=0	GT:GQ	./.:245	./.:245
+1	3000151	.	C	T	59.2	Modified	AN=0;AC=0	GT:DP:GQ	./.:32:245	./.:32:245
+1	3062915	id3D	GTTT	G	12.9	q10	DP4=1,2,3,4;AN=4;AC=2;INDEL;STR=test	GT:GQ:DP:GL	0/1:25:35:-20,-5,-20	0/1:45:11:-20,-5,-20
+1	3062915	idSNP	G	T,C	12.6	test	TEST=5;DP4=1,2,3,4;AN=3;AC=1,1	GT:TT:GQ:DP:GL	0/1:0,1:409:35:-20,-5,-20,-20,-5,-20	2:0,1:409:35:-20,-5,-20
+1	3106154	.	CAAA	C	342	Modified	AN=2;AC=1	GT:GQ:DP	0/1:245:32	./.:25:300
+1	3106154	.	C	CT	59.2	Modified	AN=0;AC=0	GT:GQ:DP	./.:25:12	./.:245:310
+1	3157410	.	GA	G	90.6	q10	AN=4;AC=4	GT:GQ:DP	1/1:21:21	1/1:21:21
+1	3162006	.	GAA	G	60.2	PASS	AN=4;AC=2	GT:GQ:DP	0/1:212:22	0/1:212:22
+1	3177144	.	G	T	45	PASS	AN=4;AC=2	GT:GQ:DP	0/0:150:30	1/1:150:30
+1	3177144	.	G	.	45	PASS	AN=4;AC=0	GT:GQ:DP	0/0:150:30	0/0:150:30
+1	3184885	.	TAAAA	TA,T	61.5	Modified	AN=2;AC=1,1	GT:GQ:DP	./.:12:10	1/2:12:20
+2	3199812	.	G	GTT,GT	82.7	Modified	AN=2;AC=1,1	GT:GQ:DP	1/2:322:20	./.:322:10
+3	3212016	.	CTT	C,CT	79	PASS	AN=4;AC=2,2	GT:GQ:DP	1/2:91:26	1/2:91:26
+4	3258448	.	TACACACAC	T	59.9	PASS	AN=4;AC=2	GT	0/1	0/1
diff --git a/test/filter.2.vcf b/test/filter.2.vcf
new file mode 100644
index 0000000..b86a64b
--- /dev/null
+++ b/test/filter.2.vcf
@@ -0,0 +1,36 @@
+##fileformat=VCFv4.1
+##INFO=<ID=TEST,Number=1,Type=Integer,Description="Testing Tag">
+##FORMAT=<ID=TT,Number=A,Type=Integer,Description="Testing Tag, with commas and \"escapes\" and escaped escapes combined with \\\"quotes\\\\\"">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=GL,Number=G,Type=Float,Description="Genotype Likelihood">
+##FILTER=<ID=q10,Description="Quality below 10">
+##FILTER=<ID=test,Description="Testing filter">
+##contig=<ID=1,assembly=b37,length=249250621>
+##contig=<ID=2,assembly=b37,length=249250621>
+##contig=<ID=3,assembly=b37,length=198022430>
+##contig=<ID=4,assembly=b37,length=191154276>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##readme=AAAAAA
+##readme=BBBBBB
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##INFO=<ID=STR,Number=1,Type=String,Description="Test string type">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B
+1	3000150	.	C	T	59.2	PASS	AN=4;AC=2	GT:GQ	0/1:245	0/1:245
+1	3000151	.	C	T	59.2	PASS	AN=4;AC=2	GT:DP:GQ	0/1:32:245	0/1:32:245
+1	3062915	id3D	GTTT	G	12.9	q10	DP4=1,2,3,4;AN=4;AC=2;INDEL;STR=test	GT:GQ:DP:GL	0/1:25:35:-20,-5,-20	0/1:45:11:-20,-5,-20
+1	3062915	idSNP	G	T,C	12.6	test	TEST=5;DP4=1,2,3,4;AN=3;AC=1,1	GT:TT:GQ:DP:GL	0/1:0,1:409:35:-20,-5,-20,-20,-5,-20	2:0,1:409:35:-20,-5,-20
+1	3106154	.	CAAA	C	342	PASS	AN=4;AC=2	GT:GQ:DP	0/1:245:32	0/1:25:300
+1	3106154	.	C	CT	59.2	PASS	AN=4;AC=2	GT:GQ:DP	0/1:25:12	0/1:245:310
+1	3157410	.	GA	G	90.6	q10	AN=4;AC=4	GT:GQ:DP	1/1:21:21	1/1:21:21
+1	3162006	.	GAA	G	60.2	PASS	AN=4;AC=2	GT:GQ:DP	0/1:212:22	0/1:212:22
+1	3177144	.	G	T	45	PASS	AN=4;AC=2	GT:GQ:DP	0/0:150:30	1/1:150:30
+1	3177144	.	G	.	45	PASS	AN=4;AC=0	GT:GQ:DP	0/0:150:30	0/0:150:30
+1	3184885	.	TAAAA	TA,T	61.5	PASS	AN=4;AC=2,2	GT:GQ:DP	1/2:12:10	1/2:12:20
+2	3199812	.	G	GTT,GT	82.7	PASS	AN=4;AC=2,2	GT:GQ:DP	1/2:322:20	1/2:322:10
+3	3212016	.	CTT	C,CT	79	PASS	AN=4;AC=2,2	GT:GQ:DP	1/2:91:26	1/2:91:26
+4	3258448	.	TACACACAC	T	59.9	PASS	AN=4;AC=2	GT	0/1	0/1
diff --git a/test/filter.3.out b/test/filter.3.out
new file mode 100644
index 0000000..1663d0f
--- /dev/null
+++ b/test/filter.3.out
@@ -0,0 +1 @@
+3162007	q20	.	0/1	2
diff --git a/test/filter.3.vcf b/test/filter.3.vcf
new file mode 100644
index 0000000..24c57e8
--- /dev/null
+++ b/test/filter.3.vcf
@@ -0,0 +1,42 @@
+##fileformat=VCFv4.2
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##INFO=<ID=STR,Number=A,Type=String,Description="Testing string and Number=A in INFO">
+##INFO=<ID=TXT0,Number=1,Type=String,Description="Testing in INFO">
+##INFO=<ID=TXT,Number=.,Type=String,Description="Testing in INFO">
+##INFO=<ID=XRF,Number=R,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAF,Number=A,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGF,Number=G,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XRI,Number=R,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAI,Number=A,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGI,Number=G,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XRS,Number=R,Type=String,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAS,Number=A,Type=String,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGS,Number=G,Type=String,Description="Test Number=AGR in INFO">
+##SAMPLE=<ID=NORMAL,SampleName=B,Description="Less-than (\"<\") and greater-than (\">\") quoting nonsense where double brackets would do just fine",softwareName=<Nonsense,Software>,softwareVer=<119,65>,softwareParam=<.>,MetadataResource=http://somewhere.com/path>
+##INFO=<ID=CIGAR,Number=A,Type=String,Description="test">
+##INFO=<ID=AO,Number=A,Type=Integer,Description="Alternate allele observations, with partial observations recorded fractionally">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=FGS,Number=G,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FGI,Number=G,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FGF,Number=G,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAS,Number=A,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAI,Number=A,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAF,Number=A,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRS,Number=R,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRI,Number=R,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRF,Number=R,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=STR,Number=1,Type=String,Description="Test">
+##FILTER=<ID=q20,Description="Mapping quality below 20">
+##contig=<ID=1,assembly=b37,length=249250621>
+##contig=<ID=2,assembly=b37,length=243199373>
+##contig=<ID=3,assembly=b37,length=198022430>
+##contig=<ID=4,assembly=b37,length=191154276>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B
+1	3162006	.	GAA	G,GA	238	q20	DP=19;AN=4;AC=1,1;XRF=1e6,2e6,3e6;XRI=1111,2222,3333;XRS=ABC,DEF,GHI;XAF=1e6,2e6;XAI=1111,2222;XAS=ABC,DEF;XGF=1e6,2e6,3e6,4e6,5e6,6e6;XGI=11,22,33,44,55,66;XGS=ABC,DEF,GHI,JKL,MNO,PQR;TXT=ABC,DEF,GHI	GT:GQ:DP:STR	0/1:589:19:XX	0/2:1:1:YY
+1	3162007	.	TAGGG	CAGGG,CAGGT	238	q20	AO=52101,113;CIGAR=1X4M,1X3M1X;TXT0=text	GT:FGS:FGI:FGF:FAS:FAI:FAF:FRS:FRI:FRF	0/1:AAAAAA,BBBBB,CCCC,DDD,EE,F:1,2,3,4,5,6:1e-1,2e-2,3e-3,4e-4,5e-5,6e-6:AAA,B:1,2:1e-1,2e-2:A,BB,CCC:1,2,3:1e-1,2e-2,3e-3	2:AAAAAA,BBB,C:1,2,3:1e-1,2e-2,3e-3:AAA,B:1,2:1e-1,2e-2:A,BB,CCC:1,2,3:1e-1,2e-2,3e-3
diff --git a/test/filter.4.out b/test/filter.4.out
new file mode 100644
index 0000000..4184aea
--- /dev/null
+++ b/test/filter.4.out
@@ -0,0 +1,2 @@
+3162006	XX	19	0/1	0/2
+3162007	q20	.	0/1	2
diff --git a/test/filter.5.out b/test/filter.5.out
new file mode 100644
index 0000000..311562e
--- /dev/null
+++ b/test/filter.5.out
@@ -0,0 +1,2 @@
+3162006	q20;XX	19	0/1	0/2
+3162007	q20	.	0/1	2
diff --git a/test/filter.6.out b/test/filter.6.out
new file mode 100644
index 0000000..0cb0aa4
--- /dev/null
+++ b/test/filter.6.out
@@ -0,0 +1,2 @@
+3162006	XX	19	0/1	0/2
+3162007	PASS	.	0/1	2
diff --git a/test/filter.7.out b/test/filter.7.out
new file mode 100644
index 0000000..00a3c15
--- /dev/null
+++ b/test/filter.7.out
@@ -0,0 +1,2 @@
+3162006	q20;XX	19	0/1	0/2
+3162007	PASS	.	0/1	2
diff --git a/test/filter.8.out b/test/filter.8.out
new file mode 100644
index 0000000..bb8cac6
--- /dev/null
+++ b/test/filter.8.out
@@ -0,0 +1 @@
+3177144	2	0/0	1/1
diff --git a/test/fixploidy.out b/test/fixploidy.out
new file mode 100644
index 0000000..07e7cd8
--- /dev/null
+++ b/test/fixploidy.out
@@ -0,0 +1,18 @@
+##fileformat=VCFv4.1
+##FILTER=<ID=PASS,Description="All filters passed">
+##contig=<ID=1,assembly=b37,length=249250621>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##INFO=<ID=FLAG,Number=0,Type=Flag,Description="Test type">
+##INFO=<ID=IINT,Number=1,Type=Integer,Description="Test type">
+##INFO=<ID=IFLT,Number=1,Type=Float,Description="Test type">
+##INFO=<ID=ISTR,Number=1,Type=String,Description="Test type">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=FINT,Number=1,Type=Integer,Description="Test type">
+##FORMAT=<ID=FFLT,Number=1,Type=Float,Description="Test type">
+##FORMAT=<ID=FSTR,Number=1,Type=String,Description="Test type">
+##FILTER=<ID=q11,Description="Quality below 10">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B	C
+1	3000001	xx	C	CT	11	PASS	FLAG;IINT=11;IFLT=1.1;ISTR=xxx	GT:FINT:FFLT:FSTR	.:11:1.1:xxx	0:11:1.1:x	0|0:11:1.1:x
+1	3000002	.	C	CTT	.	.	.	GT	././.	./././.	.|.|.|.|.
+1	3000003	xx	C	CTTT	11	q11	FLAG;IINT=.;IFLT=.;ISTR=.	GT:FINT:FFLT:FSTR	0/0:.:.:.	0/0:.:.:.	0|0:.:.:.
+1	3000004	xx	C	CTTTT	11	q11	FLAG;IINT=11;IFLT=1.1;ISTR=xxx	GT:FINT:FFLT:FSTR	0/0/0/0/0/0:11:1.1:x	0/0/0/0/0/0/0:11:1.1:xxx	0|0|0|0|0|0|0|0:11:1.1:xxx
diff --git a/test/fixploidy.ploidy b/test/fixploidy.ploidy
new file mode 100644
index 0000000..268c616
--- /dev/null
+++ b/test/fixploidy.ploidy
@@ -0,0 +1,9 @@
+1   3000001 3000001 X 0
+1   3000001 3000001 Y 1
+1   3000001 3000001 Z 2
+1   3000002 3000002 X 3
+1   3000002 3000002 Y 4
+1   3000002 3000002 Z 5
+1   3000004 3000004 X 6
+1   3000004 3000004 Y 7
+1   3000004 3000004 Z 8
diff --git a/test/fixploidy.samples b/test/fixploidy.samples
new file mode 100644
index 0000000..f364918
--- /dev/null
+++ b/test/fixploidy.samples
@@ -0,0 +1,3 @@
+A X
+B Y
+C Z
diff --git a/test/fixploidy.vcf b/test/fixploidy.vcf
new file mode 100644
index 0000000..0c789b2
--- /dev/null
+++ b/test/fixploidy.vcf
@@ -0,0 +1,17 @@
+##fileformat=VCFv4.1
+##contig=<ID=1,assembly=b37,length=249250621>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##INFO=<ID=FLAG,Number=0,Type=Flag,Description="Test type">
+##INFO=<ID=IINT,Number=1,Type=Integer,Description="Test type">
+##INFO=<ID=IFLT,Number=1,Type=Float,Description="Test type">
+##INFO=<ID=ISTR,Number=1,Type=String,Description="Test type">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=FINT,Number=1,Type=Integer,Description="Test type">
+##FORMAT=<ID=FFLT,Number=1,Type=Float,Description="Test type">
+##FORMAT=<ID=FSTR,Number=1,Type=String,Description="Test type">
+##FILTER=<ID=q11,Description="Quality below 10">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B	C
+1	3000001	xx	C	CT	11	PASS	FLAG;IINT=11;IFLT=1.1;ISTR=xxx	GT:FINT:FFLT:FSTR	0/0:11:1.1:xxx	0/0:11:1.1:x	0|0:11:1.1:x
+1	3000002	.	C	CTT	.	.	.	GT	./.	./.	.|.
+1	3000003	xx	C	CTTT	11	q11	FLAG;IINT=.;IFLT=.;ISTR=.	GT:FINT:FFLT:FSTR	0/0:.:.:.	0/0:.:.:.	0|0:.:.:.
+1	3000004	xx	C	CTTTT	11	q11	FLAG;IINT=11;IFLT=1.1;ISTR=xxx	GT:FINT:FFLT:FSTR	0/0:11:1.1:x	0/0:11:1.1:xxx	0|0:11:1.1:xxx
diff --git a/test/idx.out b/test/idx.out
new file mode 100644
index 0000000..66889bc
--- /dev/null
+++ b/test/idx.out
@@ -0,0 +1,4 @@
+11	135006516	2
+20	63025520	7
+X	155270560	4
+Y	59373566	2
diff --git a/test/idx.vcf b/test/idx.vcf
new file mode 100644
index 0000000..ba8772d
--- /dev/null
+++ b/test/idx.vcf
@@ -0,0 +1,22 @@
+##fileformat=VCFv4.1
+##contig=<ID=1,length=249250621>
+##contig=<ID=11,length=135006516>
+##contig=<ID=20,length=63025520>
+##contig=<ID=X,length=155270560>
+##contig=<ID=Y,length=59373566>
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO
+11	2343543	.	A	.	999	PASS	.
+11	5464562	.	C	T	999	PASS	.
+20	76962	.	T	C	999	PASS	.
+20	126310	.	ACC	A	999	PASS	.
+20	138125	.	G	T	999	PASS	.
+20	138148	.	C	T	999	PASS	.
+20	271225	.	T	TTTA,TA	999	PASS	.
+20	304568	.	C	T	999	PASS	.
+20	326891	.	A	AC	999	PASS	.
+X	2928329	.	C	T	999	PASS	.
+X	2933066	.	G	C	999	PASS	.
+X	2942109	.	T	C	999	PASS	.
+X	3048719	.	T	C	999	PASS	.
+Y	8657215	.	C	A	999	PASS	.
+Y	10011673	.	G	A	999	PASS	.
diff --git a/test/idx_count.out b/test/idx_count.out
new file mode 100644
index 0000000..60d3b2f
--- /dev/null
+++ b/test/idx_count.out
@@ -0,0 +1 @@
+15
diff --git a/test/isec.a.vcf b/test/isec.a.vcf
new file mode 100644
index 0000000..fe7f872
--- /dev/null
+++ b/test/isec.a.vcf
@@ -0,0 +1,27 @@
+##fileformat=VCFv4.1
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=GL,Number=G,Type=Float,Description="Genotype Likelihood">
+##FILTER=<ID=q10,Description="Quality below 10">
+##test=<xx=A,yy=B,zz=C>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##readme=AAAAAA
+##readme=BBBBBB
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A
+1	3062915	.	GTTT	G	1806	q10	DP=35;DP4=1,2,3,4;AN=2;AC=1	GT:GQ:DP:GL	0/1:409:35:-20,-5,-20
+1	3062915	.	G	T	1806	q10	DP=35;DP4=1,2,3,4;AN=2;AC=1	GT:GQ:DP:GL	0/1:409:35:-20,-5,-20
+1	3106154	.	CAAA	C	1792	PASS	DP=32;AN=2;AC=1	GT:GQ:DP	0/1:245:32
+1	3106154	.	C	T,CT	1792	PASS	DP=32;AN=2;AC=1	GT:GQ:DP	0/1:245:32
+1	3157410	.	GA	G	628	q10	DP=21;AN=2;AC=2	GT:GQ:DP	1/1:21:21
+1	3162006	.	GAA	G	1016	PASS	DP=22;AN=2;AC=1	GT:GQ:DP	0/1:212:22
+1	3177144	.	GT	G	727	PASS	DP=30;AN=2;AC=1	GT:GQ:DP	0/1:150:30
+1	3184885	.	TAAAA	TA,T	246	PASS	DP=10;AN=2;AC=1,1	GT:GQ:DP	1/2:12:10
+2	3199812	.	G	GTT,GT	481	PASS	DP=26;AN=2;AC=1,1	GT:GQ:DP	1/2:322:26
+3	3212016	.	CTT	C,CT	565	PASS	DP=26;AN=2;AC=1,1	GT:GQ:DP	1/2:91:26
+4	3212016	.	TACACACAC	T	325	PASS	DP=31;AN=2;AC=1	GT:GQ:DP	0/1:325:31
+4	3258448	.	TACACACAC	T	325	PASS	DP=31;AN=2;AC=1	GT:GQ:DP	0/1:325:31
diff --git a/test/isec.ab.C.out b/test/isec.ab.C.out
new file mode 100644
index 0000000..fdf3eff
--- /dev/null
+++ b/test/isec.ab.C.out
@@ -0,0 +1,3 @@
+2	3199812	G	GTT,GT	10
+3	3212016	CTT	C,CT	10
+4	3258448	TACACACAC	T	10
diff --git a/test/isec.ab.any.out b/test/isec.ab.any.out
new file mode 100644
index 0000000..bb5f957
--- /dev/null
+++ b/test/isec.ab.any.out
@@ -0,0 +1,7 @@
+1	3062915	GTTT	G	11
+1	3106154	CAAA	C	11
+1	3157410	GA	G	11
+1	3162006	GAA	G	11
+1	3177144	GT	G	11
+1	3184885	TAAAA	TA,T	11
+4	3212016	TACACACAC	T	11
diff --git a/test/isec.ab.both.out b/test/isec.ab.both.out
new file mode 100644
index 0000000..48d113d
--- /dev/null
+++ b/test/isec.ab.both.out
@@ -0,0 +1,8 @@
+1	3062915	GTTT	G	11
+1	3062915	G	T	11
+1	3106154	CAAA	C	11
+1	3157410	GA	G	11
+1	3162006	GAA	G	11
+1	3177144	GT	G	11
+1	3184885	TAAAA	TA,T	11
+4	3212016	TACACACAC	T	11
diff --git a/test/isec.ab.flt.out b/test/isec.ab.flt.out
new file mode 100644
index 0000000..26dc93d
--- /dev/null
+++ b/test/isec.ab.flt.out
@@ -0,0 +1,2 @@
+1	3157410	GA	G	11
+1	3177144	GT	G	11
diff --git a/test/isec.ab.out b/test/isec.ab.out
new file mode 100644
index 0000000..20cbac6
--- /dev/null
+++ b/test/isec.ab.out
@@ -0,0 +1,3 @@
+1	3157410	GA	G	11
+1	3162006	GAA	G	11
+1	3177144	GT	G	11
diff --git a/test/isec.b.vcf b/test/isec.b.vcf
new file mode 100644
index 0000000..2255325
--- /dev/null
+++ b/test/isec.b.vcf
@@ -0,0 +1,27 @@
+##fileformat=VCFv4.1
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=GL,Number=G,Type=Float,Description="Genotype Likelihood">
+##FILTER=<ID=q20,Description="Mapping quality below 20">
+##contig=<ID=1,assembly=b37,length=249250621>
+##contig=<ID=2,assembly=b37,length=243199373>
+##contig=<ID=3,assembly=b37,length=198022430>
+##contig=<ID=4,assembly=b37,length=191154276>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	B
+1	3062915	.	G	A	376	q20	DP=14;DP4=1,2,3,4;AN=2;AC=1	GT:GQ:DP:GL	0/1:376:14:-10,0,-10
+1	3062915	.	GTTT	GT	376	q20	DP=14;DP4=1,2,3,4;AN=2;AC=1	GT:GQ:DP:GL	0/1:376:14:-10,0,-10
+1	3106154	.	C	T	677	PASS	DP=15;AN=2;AC=1	GT:GQ:DP:GL	0/1:277:15:-10,0,-10
+1	3106154	.	CAAAA	C	677	PASS	DP=15;AN=2;AC=1	GT:GQ:DP:GL	0/1:277:15:-10,0,-10
+1	3157410	.	GA	G	249	PASS	DP=11;AN=2;AC=1	GT:GQ:DP	0/1:49:11
+1	3162006	.	GAA	G	663	PASS	DP=19;AN=2;AC=1	GT:GQ:DP	0/1:589:19
+1	3177144	.	GT	G	460	PASS	DP=24;AN=2;AC=1	GT:GQ:DP	0/1:236:24
+1	3184885	.	TAAA	T	598	PASS	DP=16;AN=2;AC=1	GT:GQ:DP	0/1:435:16
+2	3188209	.	GA	G	162	.	DP=15;AN=2;AC=1	GT:GQ:DP	0/1:162:15
+3	3199812	.	G	GTT,GT	353	PASS	DP=19;AN=2;AC=1,1	GT:GQ:DP	1/2:188:19
+4	3212016	.	CTT	C	677	q20	DP=15;AN=2;AC=1	GT:GQ:DP	0/1:158:15
diff --git a/test/isec.tab b/test/isec.tab
new file mode 100644
index 0000000..6093291
--- /dev/null
+++ b/test/isec.tab
@@ -0,0 +1,5 @@
+1	3062915	3062915
+1	3106154	3106154
+1	3157410	3162006
+1	3177144	3177144
+4	3212016	3212016
diff --git a/test/isec.tab.out b/test/isec.tab.out
new file mode 100644
index 0000000..1b2e0ed
--- /dev/null
+++ b/test/isec.tab.out
@@ -0,0 +1,28 @@
+##fileformat=VCFv4.1
+##FILTER=<ID=PASS,Description="All filters passed">
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=GL,Number=G,Type=Float,Description="Genotype Likelihood">
+##FILTER=<ID=q10,Description="Quality below 10">
+##test=<xx=A,yy=B,zz=C>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##readme=AAAAAA
+##readme=BBBBBB
+##contig=<ID=1>
+##contig=<ID=2>
+##contig=<ID=3>
+##contig=<ID=4>
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A
+1	3062915	.	GTTT	G	1806	q10	DP=35;DP4=1,2,3,4;AN=2;AC=1	GT:GQ:DP:GL	0/1:409:35:-20,-5,-20
+1	3062915	.	G	T	1806	q10	DP=35;DP4=1,2,3,4;AN=2;AC=1	GT:GQ:DP:GL	0/1:409:35:-20,-5,-20
+1	3106154	.	CAAA	C	1792	PASS	DP=32;AN=2;AC=1	GT:GQ:DP	0/1:245:32
+1	3106154	.	C	T,CT	1792	PASS	DP=32;AN=2;AC=1	GT:GQ:DP	0/1:245:32
+1	3157410	.	GA	G	628	q10	DP=21;AN=2;AC=2	GT:GQ:DP	1/1:21:21
+1	3162006	.	GAA	G	1016	PASS	DP=22;AN=2;AC=1	GT:GQ:DP	0/1:212:22
+1	3177144	.	GT	G	727	PASS	DP=30;AN=2;AC=1	GT:GQ:DP	0/1:150:30
+4	3212016	.	TACACACAC	T	325	PASS	DP=31;AN=2;AC=1	GT:GQ:DP	0/1:325:31
diff --git a/test/large_chrom.20.1.2147483647.out b/test/large_chrom.20.1.2147483647.out
new file mode 100644
index 0000000..637e62c
--- /dev/null
+++ b/test/large_chrom.20.1.2147483647.out
@@ -0,0 +1,9 @@
+chr20	76962	.	T	C	999	PASS	.
+chr20	126310	.	ACC	A	999	PASS	.
+chr20	138125	.	G	T	999	PASS	.
+chr20	138148	.	C	T	999	PASS	.
+chr20	271225	.	T	TTTA,TA	999	PASS	.
+chr20	304568	.	C	T	999	PASS	.
+chr20	620255100	.	AG	T	999	PASS	.
+chr20	630255200	.	G	C	999	PASS	.
+chr20	2147483647	.	A	T	999	PASS	.
diff --git a/test/large_chrom_csi_limit.20.1.2147483647.out b/test/large_chrom_csi_limit.20.1.2147483647.out
new file mode 100644
index 0000000..637e62c
--- /dev/null
+++ b/test/large_chrom_csi_limit.20.1.2147483647.out
@@ -0,0 +1,9 @@
+chr20	76962	.	T	C	999	PASS	.
+chr20	126310	.	ACC	A	999	PASS	.
+chr20	138125	.	G	T	999	PASS	.
+chr20	138148	.	C	T	999	PASS	.
+chr20	271225	.	T	TTTA,TA	999	PASS	.
+chr20	304568	.	C	T	999	PASS	.
+chr20	620255100	.	AG	T	999	PASS	.
+chr20	630255200	.	G	C	999	PASS	.
+chr20	2147483647	.	A	T	999	PASS	.
diff --git a/test/large_chrom_csi_limit.vcf b/test/large_chrom_csi_limit.vcf
new file mode 100644
index 0000000..f8a3661
--- /dev/null
+++ b/test/large_chrom_csi_limit.vcf
@@ -0,0 +1,18 @@
+##fileformat=VCFv4.2
+##reference=file:///seq/references/long_chrom.fasta
+##FILTER=<ID=PASS,Description="All filters passed">
+##contig=<ID=chr11,length=116870911>
+##contig=<ID=chr20,length=2147483647>
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO
+chr11	2343543	.	A	.	999	PASS	.
+chr11	5464562	.	C	T	999	PASS	.
+chr11	116870911	.	C	G	999	PASS	.
+chr20	76962	.	T	C	999	PASS	.
+chr20	126310	.	ACC	A	999	PASS	.
+chr20	138125	.	G	T	999	PASS	.
+chr20	138148	.	C	T	999	PASS	.
+chr20	271225	.	T	TTTA,TA	999	PASS	.
+chr20	304568	.	C	T	999	PASS	.
+chr20	620255100	.	AG	T	999	PASS	.
+chr20	630255200	.	G	C	999	PASS	.
+chr20	2147483647	.	A	T	999	PASS	.
diff --git a/test/large_chrom_tbi_limit.20.1.536870912.out b/test/large_chrom_tbi_limit.20.1.536870912.out
new file mode 100644
index 0000000..35cdfe8
--- /dev/null
+++ b/test/large_chrom_tbi_limit.20.1.536870912.out
@@ -0,0 +1,3 @@
+chr11	2343543	.	A	.	999	PASS	.
+chr11	5464562	.	C	T	999	PASS	.
+chr11	116870911	.	C	G	999	PASS	.
diff --git a/test/large_chrom_tbi_limit.vcf b/test/large_chrom_tbi_limit.vcf
new file mode 100644
index 0000000..2ce490a
--- /dev/null
+++ b/test/large_chrom_tbi_limit.vcf
@@ -0,0 +1,20 @@
+##fileformat=VCFv4.2
+##reference=file:///seq/references/long_chrom.fasta
+##FILTER=<ID=PASS,Description="All filters passed">
+##FILTER=<ID=TABIX,Description="Bigger than 2^29-1, not indexable with tabix">
+##contig=<ID=chr11,length=116870911>
+##contig=<ID=chr20,length=536870913>
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO
+chr11	2343543	.	A	.	999	PASS	.
+chr11	5464562	.	C	T	999	PASS	.
+chr11	116870911	.	C	G	999	PASS	.
+chr20	76962	.	T	C	999	PASS	.
+chr20	126310	.	ACC	A	999	PASS	.
+chr20	138125	.	G	T	999	PASS	.
+chr20	138148	.	C	T	999	PASS	.
+chr20	271225	.	T	TTTA,TA	999	PASS	.
+chr20	304568	.	C	T	999	PASS	.
+chr20	220255100	.	AG	T	999	PASS	.
+chr20	230255200	.	G	C	999	PASS	.
+chr20	536870912	.	A	T	999	PASS	.
+chr20	536870913	.	A	T	999	TABIX	.
diff --git a/test/merge.2.a.vcf b/test/merge.2.a.vcf
new file mode 100644
index 0000000..c048c08
--- /dev/null
+++ b/test/merge.2.a.vcf
@@ -0,0 +1,30 @@
+##fileformat=VCFv4.1
+##INFO=<ID=TEST,Number=1,Type=Integer,Description="Testing Tag">
+##FORMAT=<ID=TT,Number=A,Type=Integer,Description="Testing Tag, with commas and \"escapes\" and escaped escapes combined with \\\"quotes\\\\\"">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=GL,Number=G,Type=Float,Description="Genotype Likelihood">
+##FILTER=<ID=q10,Description="Quality below 10">
+##FILTER=<ID=test,Description="Testing filter">
+##contig=<ID=1,assembly=b37,length=249250621>
+##contig=<ID=2,assembly=b37,length=249250621>
+##contig=<ID=3,assembly=b37,length=198022430>
+##contig=<ID=4,assembly=b37,length=191154276>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##readme=AAAAAA
+##readme=BBBBBB
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##INFO=<ID=STR,Number=1,Type=String,Description="Test string type">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B
+1	3000000	.	C	CCG	59.2	PASS	AN=4;AC=2	GT:GQ	0/1:245	0/1:245
+1	3000150	.	C	A	59.2	PASS	AN=4;AC=2	GT:GQ	0/1:245	0/1:245
+1	3000151	.	C	A	59.2	PASS	AN=4;AC=2	GT:DP:GQ	0/1:32:245	0/1:32:245
+1	3106154	.	C	CC	342	PASS	AN=4;AC=2	GT:GQ:DP	0/1:245:32	0/1:245:32
+1	3106154	.	C	A	59.2	PASS	AN=4;AC=2	GT:GQ:DP	0/1:245:32	0/1:245:32
+1	3200000	.	C	T	59.2	PASS	AN=4;AC=2	GT:GQ:DP	0/1:245:32	0/1:245:32
+1	3200010	.	C	T	59.2	PASS	AN=4;AC=2	GT:GQ:DP	0/1:245:32	0/1:245:32
+1	3200020	.	C	G,T	59.2	PASS	AN=4;AC=2	GT:GL	./.:1,2,3,4,5,6	.:1,2,3
diff --git a/test/merge.2.all.out b/test/merge.2.all.out
new file mode 100644
index 0000000..915773e
--- /dev/null
+++ b/test/merge.2.all.out
@@ -0,0 +1,31 @@
+##fileformat=VCFv4.1
+##FILTER=<ID=PASS,Description="All filters passed">
+##INFO=<ID=TEST,Number=1,Type=Integer,Description="Testing Tag">
+##FORMAT=<ID=TT,Number=A,Type=Integer,Description="Testing Tag, with commas and \"escapes\" and escaped escapes combined with \\\"quotes\\\\\"">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=GL,Number=G,Type=Float,Description="Genotype Likelihood">
+##FILTER=<ID=q10,Description="Quality below 10">
+##FILTER=<ID=test,Description="Testing filter">
+##contig=<ID=1,assembly=b37,length=249250621>
+##contig=<ID=2,assembly=b37,length=249250621>
+##contig=<ID=3,assembly=b37,length=198022430>
+##contig=<ID=4,assembly=b37,length=191154276>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##readme=AAAAAA
+##readme=BBBBBB
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##INFO=<ID=STR,Number=1,Type=String,Description="Test string type">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B	2:A	2:B
+1	3000000	.	C	CCG,G	59.2	PASS	AN=8;AC=2,2	GT:GQ	0/1:245	0/1:245	0/2:245	0/2:245
+1	3000150	.	C	A,G	59.2	PASS	AN=8;AC=2,2	GT:GQ	0/1:245	0/1:245	0/2:245	0/2:245
+1	3000151	.	C	A,G	59.2	PASS	AN=8;AC=2,2	GT:DP:GQ	0/1:32:245	0/1:32:245	0/2:32:245	0/2:32:245
+1	3106154	.	C	CC,CCC	342	PASS	AN=8;AC=2,2	GT:GQ:DP	0/1:245:32	0/1:245:32	0/2:245:32	0/2:245:32
+1	3106154	.	C	A,T	59.2	PASS	AN=8;AC=2,2	GT:GQ:DP	0/1:245:32	0/1:245:32	0/2:245:32	0/2:245:32
+1	3200000	.	C	T	59.2	PASS	AN=8;AC=4	GT:GQ:DP	0/1:245:32	0/1:245:32	0/1:245:32	0/1:245:32
+1	3200010	.	C	T,A	59.2	PASS	AN=8;AC=2,2	GT:GQ:DP	0/1:245:32	0/1:245:32	0/2:245:32	0/2:245:32
+1	3200020	.	C	G,T	59.2	PASS	AN=0;AC=0,0	GT:GL	./.:1,2,3,4,5,6	.:1,2,3	./.:1,2,3,4,5,6	.:1,2,3
diff --git a/test/merge.2.b.vcf b/test/merge.2.b.vcf
new file mode 100644
index 0000000..fab439f
--- /dev/null
+++ b/test/merge.2.b.vcf
@@ -0,0 +1,30 @@
+##fileformat=VCFv4.1
+##INFO=<ID=TEST,Number=1,Type=Integer,Description="Testing Tag">
+##FORMAT=<ID=TT,Number=A,Type=Integer,Description="Testing Tag, with commas and \"escapes\" and escaped escapes combined with \\\"quotes\\\\\"">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=GL,Number=G,Type=Float,Description="Genotype Likelihood">
+##FILTER=<ID=q10,Description="Quality below 10">
+##FILTER=<ID=test,Description="Testing filter">
+##contig=<ID=1,assembly=b37,length=249250621>
+##contig=<ID=2,assembly=b37,length=249250621>
+##contig=<ID=3,assembly=b37,length=198022430>
+##contig=<ID=4,assembly=b37,length=191154276>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##readme=AAAAAA
+##readme=BBBBBB
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##INFO=<ID=STR,Number=1,Type=String,Description="Test string type">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B
+1	3000000	.	C	G	59.2	PASS	AN=4;AC=2	GT:GQ	0/1:245	0/1:245
+1	3000150	.	C	G	59.2	PASS	AN=4;AC=2	GT:GQ	0/1:245	0/1:245
+1	3000151	.	C	G	59.2	PASS	AN=4;AC=2	GT:DP:GQ	0/1:32:245	0/1:32:245
+1	3106154	.	C	CCC	342	PASS	AN=4;AC=2	GT:GQ:DP	0/1:245:32	0/1:245:32
+1	3106154	.	C	T	59.2	PASS	AN=4;AC=2	GT:GQ:DP	0/1:245:32	0/1:245:32
+1	3200000	.	C	T	59.2	PASS	AN=4;AC=2	GT:GQ:DP	0/1:245:32	0/1:245:32
+1	3200010	.	C	A,T	59.2	PASS	AN=4;AC=2	GT:GQ:DP	0/1:245:32	0/1:245:32
+1	3200020	.	C	T,G	59.2	PASS	AN=4;AC=2	GT:GL	./.:1,4,6,2,5,3	.:1,3,2
diff --git a/test/merge.2.both.out b/test/merge.2.both.out
new file mode 100644
index 0000000..15225f3
--- /dev/null
+++ b/test/merge.2.both.out
@@ -0,0 +1,32 @@
+##fileformat=VCFv4.1
+##FILTER=<ID=PASS,Description="All filters passed">
+##INFO=<ID=TEST,Number=1,Type=Integer,Description="Testing Tag">
+##FORMAT=<ID=TT,Number=A,Type=Integer,Description="Testing Tag, with commas and \"escapes\" and escaped escapes combined with \\\"quotes\\\\\"">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=GL,Number=G,Type=Float,Description="Genotype Likelihood">
+##FILTER=<ID=q10,Description="Quality below 10">
+##FILTER=<ID=test,Description="Testing filter">
+##contig=<ID=1,assembly=b37,length=249250621>
+##contig=<ID=2,assembly=b37,length=249250621>
+##contig=<ID=3,assembly=b37,length=198022430>
+##contig=<ID=4,assembly=b37,length=191154276>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##readme=AAAAAA
+##readme=BBBBBB
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##INFO=<ID=STR,Number=1,Type=String,Description="Test string type">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B	2:A	2:B
+1	3000000	.	C	CCG	59.2	PASS	AN=4;AC=2	GT:GQ	0/1:245	0/1:245	./.:.	./.:.
+1	3000000	.	C	G	59.2	PASS	AN=4;AC=2	GT:GQ	./.:.	./.:.	0/1:245	0/1:245
+1	3000150	.	C	A,G	59.2	PASS	AN=8;AC=2,2	GT:GQ	0/1:245	0/1:245	0/2:245	0/2:245
+1	3000151	.	C	A,G	59.2	PASS	AN=8;AC=2,2	GT:DP:GQ	0/1:32:245	0/1:32:245	0/2:32:245	0/2:32:245
+1	3106154	.	C	CC,CCC	342	PASS	AN=8;AC=2,2	GT:GQ:DP	0/1:245:32	0/1:245:32	0/2:245:32	0/2:245:32
+1	3106154	.	C	A,T	59.2	PASS	AN=8;AC=2,2	GT:GQ:DP	0/1:245:32	0/1:245:32	0/2:245:32	0/2:245:32
+1	3200000	.	C	T	59.2	PASS	AN=8;AC=4	GT:GQ:DP	0/1:245:32	0/1:245:32	0/1:245:32	0/1:245:32
+1	3200010	.	C	T,A	59.2	PASS	AN=8;AC=2,2	GT:GQ:DP	0/1:245:32	0/1:245:32	0/2:245:32	0/2:245:32
+1	3200020	.	C	G,T	59.2	PASS	AN=0;AC=0,0	GT:GL	./.:1,2,3,4,5,6	.:1,2,3	./.:1,2,3,4,5,6	.:1,2,3
diff --git a/test/merge.2.none.out b/test/merge.2.none.out
new file mode 100644
index 0000000..4eee819
--- /dev/null
+++ b/test/merge.2.none.out
@@ -0,0 +1,36 @@
+##fileformat=VCFv4.1
+##FILTER=<ID=PASS,Description="All filters passed">
+##INFO=<ID=TEST,Number=1,Type=Integer,Description="Testing Tag">
+##FORMAT=<ID=TT,Number=A,Type=Integer,Description="Testing Tag, with commas and \"escapes\" and escaped escapes combined with \\\"quotes\\\\\"">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=GL,Number=G,Type=Float,Description="Genotype Likelihood">
+##FILTER=<ID=q10,Description="Quality below 10">
+##FILTER=<ID=test,Description="Testing filter">
+##contig=<ID=1,assembly=b37,length=249250621>
+##contig=<ID=2,assembly=b37,length=249250621>
+##contig=<ID=3,assembly=b37,length=198022430>
+##contig=<ID=4,assembly=b37,length=191154276>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##readme=AAAAAA
+##readme=BBBBBB
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##INFO=<ID=STR,Number=1,Type=String,Description="Test string type">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B	2:A	2:B
+1	3000000	.	C	CCG	59.2	PASS	AN=4;AC=2	GT:GQ	0/1:245	0/1:245	./.:.	./.:.
+1	3000000	.	C	G	59.2	PASS	AN=4;AC=2	GT:GQ	./.:.	./.:.	0/1:245	0/1:245
+1	3000150	.	C	A	59.2	PASS	AN=4;AC=2	GT:GQ	0/1:245	0/1:245	./.:.	./.:.
+1	3000150	.	C	G	59.2	PASS	AN=4;AC=2	GT:GQ	./.:.	./.:.	0/1:245	0/1:245
+1	3000151	.	C	A	59.2	PASS	AN=4;AC=2	GT:DP:GQ	0/1:32:245	0/1:32:245	./.:.:.	./.:.:.
+1	3000151	.	C	G	59.2	PASS	AN=4;AC=2	GT:DP:GQ	./.:.:.	./.:.:.	0/1:32:245	0/1:32:245
+1	3106154	.	C	CC	342	PASS	AN=4;AC=2	GT:GQ:DP	0/1:245:32	0/1:245:32	./.:.:.	./.:.:.
+1	3106154	.	C	A	59.2	PASS	AN=4;AC=2	GT:GQ:DP	0/1:245:32	0/1:245:32	./.:.:.	./.:.:.
+1	3106154	.	C	CCC	342	PASS	AN=4;AC=2	GT:GQ:DP	./.:.:.	./.:.:.	0/1:245:32	0/1:245:32
+1	3106154	.	C	T	59.2	PASS	AN=4;AC=2	GT:GQ:DP	./.:.:.	./.:.:.	0/1:245:32	0/1:245:32
+1	3200000	.	C	T	59.2	PASS	AN=8;AC=4	GT:GQ:DP	0/1:245:32	0/1:245:32	0/1:245:32	0/1:245:32
+1	3200010	.	C	T,A	59.2	PASS	AN=8;AC=2,2	GT:GQ:DP	0/1:245:32	0/1:245:32	0/2:245:32	0/2:245:32
+1	3200020	.	C	G,T	59.2	PASS	AN=0;AC=0,0	GT:GL	./.:1,2,3,4,5,6	.:1,2,3	./.:1,2,3,4,5,6	.:1,2,3
diff --git a/test/merge.3.a.vcf b/test/merge.3.a.vcf
new file mode 100644
index 0000000..2f2af22
--- /dev/null
+++ b/test/merge.3.a.vcf
@@ -0,0 +1,26 @@
+##fileformat=VCFv4.1
+##INFO=<ID=TEST,Number=1,Type=Integer,Description="Testing Tag">
+##FORMAT=<ID=TT,Number=A,Type=Integer,Description="Testing Tag, with commas and \"escapes\" and escaped escapes combined with \\\"quotes\\\\\"">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##INFO=<ID=TR,Number=R,Type=Float,Description="Test tag">
+##INFO=<ID=TA,Number=A,Type=Float,Description="Test tag">
+##INFO=<ID=TG,Number=G,Type=Float,Description="Test tag">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=GL,Number=G,Type=Float,Description="Genotype Likelihood">
+##FILTER=<ID=q10,Description="Quality below 10">
+##FILTER=<ID=test,Description="Testing filter">
+##contig=<ID=1,assembly=b37,length=249250621>
+##contig=<ID=2,assembly=b37,length=249250621>
+##contig=<ID=3,assembly=b37,length=198022430>
+##contig=<ID=4,assembly=b37,length=191154276>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##readme=AAAAAA
+##readme=BBBBBB
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##INFO=<ID=STR,Number=1,Type=String,Description="Test string type">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B
+1	3000000	.	C	CCG	59.2	PASS	AN=4;AC=2;TR=1,2;TA=1;TG=1,2,3	GT:GQ	0/1:245	0/1:245
diff --git a/test/merge.3.b.vcf b/test/merge.3.b.vcf
new file mode 100644
index 0000000..05c2385
--- /dev/null
+++ b/test/merge.3.b.vcf
@@ -0,0 +1,26 @@
+##fileformat=VCFv4.1
+##INFO=<ID=TEST,Number=1,Type=Integer,Description="Testing Tag">
+##FORMAT=<ID=TT,Number=A,Type=Integer,Description="Testing Tag, with commas and \"escapes\" and escaped escapes combined with \\\"quotes\\\\\"">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##INFO=<ID=TR,Number=R,Type=Float,Description="Test tag">
+##INFO=<ID=TA,Number=A,Type=Float,Description="Test tag">
+##INFO=<ID=TG,Number=G,Type=Float,Description="Test tag">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=GL,Number=G,Type=Float,Description="Genotype Likelihood">
+##FILTER=<ID=q10,Description="Quality below 10">
+##FILTER=<ID=test,Description="Testing filter">
+##contig=<ID=1,assembly=b37,length=249250621>
+##contig=<ID=2,assembly=b37,length=249250621>
+##contig=<ID=3,assembly=b37,length=198022430>
+##contig=<ID=4,assembly=b37,length=191154276>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##readme=AAAAAA
+##readme=BBBBBB
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##INFO=<ID=STR,Number=1,Type=String,Description="Test string type">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B
+1	3000000	.	C	CG	59.2	PASS	AN=4;AC=2;TR=10,20;TA=10;TG=10,20,30	GT:GQ	0/1:245	0/1:245
diff --git a/test/merge.3.out b/test/merge.3.out
new file mode 100644
index 0000000..bcb9f2f
--- /dev/null
+++ b/test/merge.3.out
@@ -0,0 +1,27 @@
+##fileformat=VCFv4.1
+##FILTER=<ID=PASS,Description="All filters passed">
+##INFO=<ID=TEST,Number=1,Type=Integer,Description="Testing Tag">
+##FORMAT=<ID=TT,Number=A,Type=Integer,Description="Testing Tag, with commas and \"escapes\" and escaped escapes combined with \\\"quotes\\\\\"">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##INFO=<ID=TR,Number=R,Type=Float,Description="Test tag">
+##INFO=<ID=TA,Number=A,Type=Float,Description="Test tag">
+##INFO=<ID=TG,Number=G,Type=Float,Description="Test tag">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=GL,Number=G,Type=Float,Description="Genotype Likelihood">
+##FILTER=<ID=q10,Description="Quality below 10">
+##FILTER=<ID=test,Description="Testing filter">
+##contig=<ID=1,assembly=b37,length=249250621>
+##contig=<ID=2,assembly=b37,length=249250621>
+##contig=<ID=3,assembly=b37,length=198022430>
+##contig=<ID=4,assembly=b37,length=191154276>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##readme=AAAAAA
+##readme=BBBBBB
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##INFO=<ID=STR,Number=1,Type=String,Description="Test string type">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B	2:A	2:B
+1	3000000	.	C	CCG,CG	59.2	PASS	TA=1,10;TG=11,2,3,20,0,30;TR=11,2,20;AN=8;AC=2,2	GT:GQ	0/1:245	0/1:245	0/2:245	0/2:245
diff --git a/test/merge.4.a.vcf b/test/merge.4.a.vcf
new file mode 100644
index 0000000..d7bbd33
--- /dev/null
+++ b/test/merge.4.a.vcf
@@ -0,0 +1,33 @@
+##fileformat=VCFv4.1
+##INFO=<ID=TEST,Number=1,Type=Integer,Description="Testing Tag">
+##FORMAT=<ID=TT,Number=A,Type=Integer,Description="Testing Tag, with commas and \"escapes\" and escaped escapes combined with \\\"quotes\\\\\"">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##INFO=<ID=TR,Number=R,Type=Float,Description="Test tag">
+##INFO=<ID=TA,Number=A,Type=Float,Description="Test tag">
+##INFO=<ID=TG,Number=G,Type=Float,Description="Test tag">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=XR,Number=R,Type=Integer,Description="Some description">
+##FORMAT=<ID=XA,Number=A,Type=Integer,Description="Some description">
+##FORMAT=<ID=XG,Number=G,Type=Integer,Description="Some description">
+##FORMAT=<ID=GL,Number=G,Type=Float,Description="Genotype Likelihood">
+##FILTER=<ID=q10,Description="Quality below 10">
+##FILTER=<ID=test,Description="Testing filter">
+##contig=<ID=1,assembly=b37,length=249250621>
+##contig=<ID=2,assembly=b37,length=249250621>
+##contig=<ID=3,assembly=b37,length=198022430>
+##contig=<ID=4,assembly=b37,length=191154276>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##readme=AAAAAA
+##readme=BBBBBB
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##INFO=<ID=STR,Number=1,Type=String,Description="Test string type">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B
+1	3000000	id1	C	CCG	59.2	PASS	AN=4;AC=2;TR=1,2;TA=1;TG=1,2,3	GT:GQ:XR:XA:XG	0/1:245:0,1:1:0,1,2	0/1:245:1,2:2:0,1,2
+1	3000000	.	C	CCG	59.2	PASS	AN=4;AC=2	GT:GQ:XR:XA:XG	0/1:245:1,2:2:0,1,2	0/1:245:2,3:3:1,2,3
+1	3000002	.	C	CCG	59.2	PASS	AN=4;AC=2	GT:GQ	0/1:245	0/1:245
+1	3000002	id2	C	CCG	59.2	PASS	AN=4;AC=2;TR=1,2;TA=1;TG=1,2,3	GT:GL:XR:XA:XG	0/1:245:.:.:.	0/1:245:.:.:.
+1	3000002	id3	C	CCG	59.2	PASS	AN=4;AC=2;TR=1,2;TA=1;TG=1,2,3	GT:GL:XR:XA:XG	0/1:245:.:.:.	0/1:245:.
diff --git a/test/merge.4.b.vcf b/test/merge.4.b.vcf
new file mode 100644
index 0000000..461661b
--- /dev/null
+++ b/test/merge.4.b.vcf
@@ -0,0 +1,33 @@
+##fileformat=VCFv4.1
+##INFO=<ID=TEST,Number=1,Type=Integer,Description="Testing Tag">
+##FORMAT=<ID=TT,Number=A,Type=Integer,Description="Testing Tag, with commas and \"escapes\" and escaped escapes combined with \\\"quotes\\\\\"">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##INFO=<ID=TR,Number=R,Type=Float,Description="Test tag">
+##INFO=<ID=TA,Number=A,Type=Float,Description="Test tag">
+##INFO=<ID=TG,Number=G,Type=Float,Description="Test tag">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=GL,Number=G,Type=Float,Description="Genotype Likelihood">
+##FORMAT=<ID=XR,Number=R,Type=Integer,Description="Some description">
+##FORMAT=<ID=XA,Number=A,Type=Integer,Description="Some description">
+##FORMAT=<ID=XG,Number=G,Type=Integer,Description="Some description">
+##FILTER=<ID=q10,Description="Quality below 10">
+##FILTER=<ID=test,Description="Testing filter">
+##contig=<ID=1,assembly=b37,length=249250621>
+##contig=<ID=2,assembly=b37,length=249250621>
+##contig=<ID=3,assembly=b37,length=198022430>
+##contig=<ID=4,assembly=b37,length=191154276>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##readme=AAAAAA
+##readme=BBBBBB
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##INFO=<ID=STR,Number=1,Type=String,Description="Test string type">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	C	D
+1	3000000	.	C	A	59.2	PASS	AN=4;AC=2	GT:GQ	0/1:245	0/1:245
+1	3000000	id1	C	A	59.2	PASS	AN=4;AC=2;TR=1,2;TA=1;TG=1,2,3	GT:GQ:XR:XG:XA	0/1:245:4,5:3,4,5:5	0/1:245:6,7:6,7,8:7
+1	3000002	id3	C	A	59.2	PASS	AN=4;AC=2;TR=1,2;TA=1;TG=1,2,3	GT:GQ:XR:XG:XA	0/1:245:.	0/1:245:1,2:1,2,3:2
+1	3000002	id2	C	A	59.2	PASS	AN=4;AC=2;TR=1,2;TA=1;TG=1,2,3	GT:GQ:XR:XG:XA	0/1:245:.	0/1:245:.:.:.
+1	3000002	.	C	A	59.2	PASS	AN=4;AC=2	GT:GQ	0/1:245	0/1:245
diff --git a/test/merge.4.out b/test/merge.4.out
new file mode 100644
index 0000000..8b69f2b
--- /dev/null
+++ b/test/merge.4.out
@@ -0,0 +1,34 @@
+##fileformat=VCFv4.1
+##FILTER=<ID=PASS,Description="All filters passed">
+##INFO=<ID=TEST,Number=1,Type=Integer,Description="Testing Tag">
+##FORMAT=<ID=TT,Number=A,Type=Integer,Description="Testing Tag, with commas and \"escapes\" and escaped escapes combined with \\\"quotes\\\\\"">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##INFO=<ID=TR,Number=R,Type=Float,Description="Test tag">
+##INFO=<ID=TA,Number=A,Type=Float,Description="Test tag">
+##INFO=<ID=TG,Number=G,Type=Float,Description="Test tag">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=XR,Number=R,Type=Integer,Description="Some description">
+##FORMAT=<ID=XA,Number=A,Type=Integer,Description="Some description">
+##FORMAT=<ID=XG,Number=G,Type=Integer,Description="Some description">
+##FORMAT=<ID=GL,Number=G,Type=Float,Description="Genotype Likelihood">
+##FILTER=<ID=q10,Description="Quality below 10">
+##FILTER=<ID=test,Description="Testing filter">
+##contig=<ID=1,assembly=b37,length=249250621>
+##contig=<ID=2,assembly=b37,length=249250621>
+##contig=<ID=3,assembly=b37,length=198022430>
+##contig=<ID=4,assembly=b37,length=191154276>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##readme=AAAAAA
+##readme=BBBBBB
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##INFO=<ID=STR,Number=1,Type=String,Description="Test string type">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B	C	D
+1	3000000	id1	C	CCG,A	59.2	PASS	TR=1,2,2;TA=1,1;TG=1,2,3,2,.,3;AN=8;AC=2,2	GT:GQ:XR:XA:XG	0/1:245:0,1,.:1,.:0,1,2,.,.,.	0/1:245:1,2,.:2,.:0,1,2,.,.,.	0/2:245:4,.,5:.,5:3,.,.,4,.,5	0/2:245:6,.,7:.,7:6,.,.,7,.,8
+1	3000000	.	C	CCG,A	59.2	PASS	AN=8;AC=2,2	GT:GQ:XR:XA:XG	0/1:245:1,2,.:2,.:0,1,2,.,.,.	0/1:245:2,3,.:3,.:1,2,3,.,.,.	0/2:245:.:.:.	0/2:245:.:.:.
+1	3000002	.	C	CCG,A	59.2	PASS	AN=8;AC=2,2	GT:GQ	0/1:245	0/1:245	0/2:245	0/2:245
+1	3000002	id2	C	CCG,A	59.2	PASS	TR=1,2,2;TA=1,1;TG=1,2,3,2,.,3;AN=8;AC=2,2	GT:GL:XR:XA:XG:GQ	0/1:245,245,-1.56481e-39,.,.,.:.:.:.:.	0/1:245,-1.56481e-39,1.09706e-28,.,.,.:.:.:.:.	0/2:.:.:.:.:245	0/2:.:.:.:.:245
+1	3000002	id3	C	CCG,A	59.2	PASS	TR=1,2,2;TA=1,1;TG=1,2,3,2,.,3;AN=8;AC=2,2	GT:GL:XR:XA:XG:GQ	0/1:245,245,-1.56481e-39,.,.,.:.:.:.:.	0/1:245,-1.56481e-39,1.09706e-28,.,.,.:.:.:.:.	0/2:.:.:.:.:245	0/2:.:1,.,2:.,2:1,.,.,2,.,3:245
diff --git a/test/merge.a.chk b/test/merge.a.chk
new file mode 100644
index 0000000..e88112d
--- /dev/null
+++ b/test/merge.a.chk
@@ -0,0 +1,58 @@
+# This file was produced by vcfcheck and can be plotted using plot-vcfcheck.
+#
+# Definition of sets:
+# ID	[2]id	[3]tab-separated file names
+# SN, Summary numbers:
+# SN	[2]id	[3]key	[4]value
+SN	0	number of samples:	2
+SN	0	number of SNPs:	1
+SN	0	number of MNPs:	0
+SN	0	number of indels:	10
+SN	0	number of others:	0
+SN	0	number of multiallelic sites:	4
+SN	0	ts/tv:	0.00
+# Sis, Singleton stats:
+# SiS	[2]id	[3]allele count	[4]number of SNPs	[5]number of transitions	[6]number of transversions	[7]number of indels
+SiS	0	1	2	0	2	0
+# AF, Stats by non-reference allele frequency:
+# AF	[2]id	[3]allele frequency	[4]number of SNPs	[5]number of transitions	[6]number of transversions	[7]number of indels
+AF	0	0.000000	2	0	2	0
+AF	0	49.494949	0	0	0	12
+AF	0	100.000000	0	0	0	1
+# IDD, InDel distribution:
+# IDD	[2]id	[3]length (deletions negative)	[4]count
+IDD	0	-8	1
+IDD	0	-4	1
+IDD	0	-3	3
+IDD	0	-2	2
+IDD	0	-1	3
+IDD	0	1	2
+IDD	0	2	1
+# ST, Substitution types:
+# ST	[2]id	[3]type	[4]count
+ST	0	A>C	0
+ST	0	A>G	0
+ST	0	A>T	0
+ST	0	C>A	0
+ST	0	C>G	0
+ST	0	C>T	0
+ST	0	G>A	0
+ST	0	G>C	1
+ST	0	G>T	1
+ST	0	T>A	0
+ST	0	T>C	0
+ST	0	T>G	0
+# PSC, Per-sample counts
+# PSC	[2]id	[3]sample	[4]nRefHom	[5]nNonRefHom	[6]nHets	[7]nTransitions	[8]nTransversions	[9]nIndels	[10]average depth
+PSC	0	A	0	0	1	0	1	10	27
+PSC	0	B	0	0	1	0	1	10	27
+# DP, Depth distribution
+# DP	[2]id	[3]bin	[4]number of genotypes	[5]fraction of genotypes (%)
+DP	0	10	2	9.090909
+DP	0	21	2	9.090909
+DP	0	22	2	9.090909
+DP	0	26	4	18.181818
+DP	0	30	2	9.090909
+DP	0	31	2	9.090909
+DP	0	32	4	18.181818
+DP	0	35	4	18.181818
diff --git a/test/merge.a.vcf b/test/merge.a.vcf
new file mode 100644
index 0000000..02923ae
--- /dev/null
+++ b/test/merge.a.vcf
@@ -0,0 +1,36 @@
+##fileformat=VCFv4.1
+##INFO=<ID=TEST,Number=1,Type=Integer,Description="Testing Tag">
+##FORMAT=<ID=TT,Number=A,Type=Integer,Description="Testing Tag, with commas and \"escapes\" and escaped escapes combined with \\\"quotes\\\\\"">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=GL,Number=G,Type=Float,Description="Genotype Likelihood">
+##FILTER=<ID=q10,Description="Quality below 10">
+##FILTER=<ID=test,Description="Testing filter">
+##contig=<ID=1,assembly=b37,length=249250621>
+##contig=<ID=2,assembly=b37,length=249250621>
+##contig=<ID=3,assembly=b37,length=198022430>
+##contig=<ID=4,assembly=b37,length=191154276>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##readme=AAAAAA
+##readme=BBBBBB
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##INFO=<ID=STR,Number=1,Type=String,Description="Test string type">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B
+1	3000150	.	C	T	59.2	PASS	AN=4;AC=2	GT:GQ	0/1:245	0/1:245
+1	3000151	.	C	T	59.2	PASS	AN=4;AC=2	GT:DP:GQ	0/1:32:245	0/1:32:245
+1	3062915	id3D	GTTT	G	12.9	q10	DP4=1,2,3,4;AN=4;AC=2;INDEL;STR=test	GT:GQ:DP:GL	0/1:409:35:-20,-5,-20	0/1:409:35:-20,-5,-20
+1	3062915	idSNP	G	T,C	12.6	test	TEST=5;DP4=1,2,3,4;AN=3;AC=1,1	GT:TT:GQ:DP:GL	0/1:0,1:409:35:-20,-5,-20,-20,-5,-20	2:0,1:409:35:-20,-5,-20
+1	3106154	.	CAAA	C	342	PASS	AN=4;AC=2	GT:GQ:DP	0/1:245:32	0/1:245:32
+1	3106154	.	C	CT	59.2	PASS	AN=4;AC=2	GT:GQ:DP	0/1:245:32	0/1:245:32
+1	3157410	.	GA	G	90.6	q10	AN=4;AC=4	GT:GQ:DP	1/1:21:21	1/1:21:21
+1	3162006	.	GAA	G	60.2	PASS	AN=4;AC=2	GT:GQ:DP	0/1:212:22	0/1:212:22
+1	3177144	.	G	T	45	PASS	AN=4;AC=2	GT:GQ:DP	0/0:150:30	1/1:150:30
+1	3177144	.	G	.	45	PASS	AN=4;AC=0	GT:GQ:DP	0/0:150:30	0/0:150:30
+1	3184885	.	TAAAA	TA,T	61.5	PASS	AN=4;AC=2,2	GT:GQ:DP	1/2:12:10	1/2:12:10
+2	3199812	.	G	GTT,GT	82.7	PASS	AN=4;AC=2,2	GT:GQ:DP	1/2:322:26	1/2:322:26
+3	3212016	.	CTT	C,CT	79	PASS	AN=4;AC=2,2	GT:GQ:DP	1/2:91:26	1/2:91:26
+4	3258448	.	TACACACAC	T	.	PASS	AN=4;AC=2	GT:GQ:DP	0/1:325:31	0/1:325:31
diff --git a/test/merge.abc.out b/test/merge.abc.out
new file mode 100644
index 0000000..70b95b4
--- /dev/null
+++ b/test/merge.abc.out
@@ -0,0 +1,59 @@
+##fileformat=VCFv4.1
+##FILTER=<ID=PASS,Description="All filters passed">
+##INFO=<ID=TEST,Number=1,Type=Integer,Description="Testing Tag">
+##FORMAT=<ID=TT,Number=A,Type=Integer,Description="Testing Tag, with commas and \"escapes\" and escaped escapes combined with \\\"quotes\\\\\"">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=GL,Number=G,Type=Float,Description="Genotype Likelihood">
+##FILTER=<ID=q10,Description="Quality below 10">
+##FILTER=<ID=test,Description="Testing filter">
+##contig=<ID=1,assembly=b37,length=249250621>
+##contig=<ID=2,assembly=b37,length=249250621>
+##contig=<ID=3,assembly=b37,length=198022430>
+##contig=<ID=4,assembly=b37,length=191154276>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##readme=AAAAAA
+##readme=BBBBBB
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##INFO=<ID=STR,Number=1,Type=String,Description="Test string type">
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##INFO=<ID=TXT,Number=.,Type=String,Description="Testing in INFO">
+##INFO=<ID=XRF,Number=R,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAF,Number=A,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGF,Number=G,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XRI,Number=R,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAI,Number=A,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGI,Number=G,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XRS,Number=R,Type=String,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAS,Number=A,Type=String,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGS,Number=G,Type=String,Description="Test Number=AGR in INFO">
+##SAMPLE=<ID=NORMAL,SampleName=B,Description="Less-than (\"<\") and greater-than (\">\") quoting nonsense where double brackets would do just fine",softwareName=<Nonsense,Software>,softwareVer=<119,65>,softwareParam=<.>,MetadataResource=http://somewhere.com/path>
+##FORMAT=<ID=STR,Number=1,Type=String,Description="Testing string in format">
+##FILTER=<ID=q20,Description="Mapping quality below 20">
+##INFO=<ID=INTA,Number=A,Type=Integer,Description="Testing Number=A in INFO">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B	2:B	C	D
+1	3000150	.	C	T	59.2	PASS	AN=4;AC=2	GT:GQ	0/1:245	0/1:245	./.:.	./.:.	./.:.
+1	3000151	.	C	T	59.2	PASS	AN=4;AC=2	GT:DP:GQ	0/1:32:245	0/1:32:245	./.:.:.	./.:.:.	./.:.:.
+1	3062915	id3D	GTTT	G	84.6	q10;q20	INDEL;STR=test;TXT=AA;DP=1013;DP4=6,7,8,9;AN=10;AC=5	GT:GQ:DP:GL	0/1:409:35:-20,-5,-20	0/1:409:35:-20,-5,-20	0/1:376:14:-10,0,-10	0/1:409:35:-20,-5,-20	0/1:409:35:-20,-5,-20
+1	3062915	id1D;id2D	GTT	GT,G	999	q20;q10	DP=14;DP4=2,4,6,8;AN=6;AC=1,2	GT:GQ:DP:GL:STR	./.:.:.:.:.	./.:.:.:.:.	0/1:376:14:-10,0,-10,.,.,.:DEF	0/2:409:35:-20,.,.,-5,.,-20:.	0/2:409:35:-20,.,.,-5,.,-20:.
+1	3062915	idSNP	G	T,C,A	419	test;q20	TEST=5;STR=.;DP=14;DP4=3,6,9,12;INTA=2,1,.;AN=9;AC=2,2,1	GT:TT:GQ:DP:GL:STR	0/1:0,1,.:409:35:-20,-5,-20,-20,-5,-20,.,.,.,.:.	2:0,1,.:409:35:-20,-5,-20,.:.	0/3:.:376:14:-10,.,.,.,.,.,0,.,.,-10:ABC	0/2:1,0,.:409:35:-20,-20,-20,-5,-5,-20,.,.,.,.:.	0/1:1,0,.:409:35:-20,-20,-20,-5,-5,-20,.,.,.,.:.
+1	3106154	.	CAAAA	CA,C	342	PASS	DP=15;AN=6;AC=2,1	GT:GQ:DP:GL	0/1:245:32:.	0/1:245:32:.	0/2:277:15:-10,.,.,0,.,-10	.:245:32:.	./.:245:32:.
+1	3106154	.	C	CT	459	PASS	AN=8;AC=4	GT:GQ:DP	0/1:245:32	0/1:245:32	./.:.:.	0/1:245:32	0/1:245:32
+1	3106154	.	C	T	999	PASS	DP=15;AN=2;AC=1	GT:GQ:DP:GL	./.:.:.:.	./.:.:.:.	0/1:277:15:-10,0,-10	./.:.:.:.	./.:.:.:.
+1	3157410	.	GAC	GC,G	90.6	q10	DP=11;AN=6;AC=4,1	GT:GQ:DP	1/1:21:21	1/1:21:21	0/2:49:11	./.:.:.	./.:.:.
+1	3157410	.	G	T	46.7	q10	AN=4;AC=4	GT:GQ:DP	./.:.:.	./.:.:.	./.:.:.	1/1:21:21	1/1:21:21
+1	3162006	.	GAA	G,GA	238	PASS	DP=19;XRF=1e+06,2e+06,500000;XRI=1111,2222,5555;XRS=AAA,BBB,DDD;XAF=1e+06,500000;XAI=1111,5555;XAS=AAA,DDD;XGF=1e+06,2e+06,3e+06,500000,.,9e+09;XGI=1111,2222,3333,5555,.,9999;XGS=A,B,C,E,.,F;AN=10;AC=3,2	GT:GQ:DP	0/1:212:22	0/1:212:22	0/1:589:19	0/2:212:22	0/2:212:22
+1	3177144	.	G	T	999	PASS	DP=24;AN=10;AC=3	GT:GQ:DP	0/0:150:30	1/1:150:30	0/1:236:24	0/0:150:30	0/0:150:30
+1	3177144	.	G	.	45	PASS	AN=4	GT:GQ:DP	0/0:150:30	0/0:150:30	./.:.:.	./.:.:.	./.:.:.
+1	3177144	.	GT	G	999	PASS	DP=24;AN=2;AC=1	GT:GQ:DP	./.:.:.	./.:.:.	0/1:236:24	./.:.:.	./.:.:.
+1	3184885	.	TAAAA	TA,T	61.5	PASS	DP=16;AN=10;AC=5,4	GT:GQ:DP	1/2:12:10	1/2:12:10	0/1:435:16	1/2:12:10	1/2:12:10
+2	3188209	.	GA	G	41.5	.	DP=15;AN=2;AC=1	GT:GQ:DP	./.:.:.	./.:.:.	0/1:162:15	./.:.:.	./.:.:.
+2	3199812	.	G	GTT,GT	291	PASS	AN=8;AC=4,4	GT:GQ:DP	1/2:322:26	1/2:322:26	./.:.:.	1/2:322:26	1/2:322:26
+3	3199812	.	GA	GTT,GT	17.5	PASS	DP=19;AN=2;AC=1,1	GT:GQ:DP	./.:.:.	./.:.:.	1/2:188:19	./.:.:.	./.:.:.
+3	3212016	.	CTT	C,CT	79	PASS	AN=8;AC=4,4	GT:GQ:DP	1/2:91:26	1/2:91:26	./.:.:.	1/2:91:26	1/2:91:26
+4	3212016	.	CTT	C	999	q20	DP=15;AN=2;AC=1	GT:GQ:DP	./.:.:.	./.:.:.	0/1:158:15	./.:.:.	./.:.:.
+4	3258448	.	TACACACAC	T	.	PASS	AN=8;AC=4	GT:GQ:DP	0/1:325:31	0/1:325:31	./.:.:.	0/1:325:31	0/1:325:31
diff --git a/test/merge.b.vcf b/test/merge.b.vcf
new file mode 100644
index 0000000..48cc56f
--- /dev/null
+++ b/test/merge.b.vcf
@@ -0,0 +1,42 @@
+##fileformat=VCFv4.1
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##INFO=<ID=STR,Number=1,Type=String,Description="Testing string and Number=A in INFO">
+##INFO=<ID=TXT,Number=.,Type=String,Description="Testing in INFO">
+##INFO=<ID=XRF,Number=R,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAF,Number=A,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGF,Number=G,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XRI,Number=R,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAI,Number=A,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGI,Number=G,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XRS,Number=R,Type=String,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAS,Number=A,Type=String,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGS,Number=G,Type=String,Description="Test Number=AGR in INFO">
+##SAMPLE=<ID=NORMAL,SampleName=B,Description="Less-than (\"<\") and greater-than (\">\") quoting nonsense where double brackets would do just fine",softwareName=<Nonsense,Software>,softwareVer=<119,65>,softwareParam=<.>,MetadataResource=http://somewhere.com/path>
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=GL,Number=G,Type=Float,Description="Genotype Likelihood">
+##FORMAT=<ID=STR,Number=1,Type=String,Description="Testing string in format">
+##FILTER=<ID=q20,Description="Mapping quality below 20">
+##contig=<ID=1,assembly=b37,length=249250621>
+##contig=<ID=2,assembly=b37,length=243199373>
+##contig=<ID=3,assembly=b37,length=198022430>
+##contig=<ID=4,assembly=b37,length=191154276>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	B
+1	3062915	idSNP	G	A	24.6	q20	DP=14;DP4=1,2,3,4;AN=2;STR=.;AC=1	GT:GQ:DP:STR:GL	0/1:376:14:ABC:-10,0,-10
+1	3062915	id1D	GTT	GT	101	q20	DP=14;DP4=1,2,3,4;AN=2;AC=1	GT:GQ:DP:GL:STR	0/1:376:14:-10,0,-10:DEF
+1	3062915	id3D	GTTT	G	84.6	q20	TXT=AA;DP=14;DP4=1,2,3,4;AN=2;AC=1	GT:GQ:DP:GL	0/1:376:14:-10,0,-10
+1	3106154	.	C	T	999	PASS	DP=15;AN=2;AC=1	GT:GQ:DP:GL	0/1:277:15:-10,0,-10
+1	3106154	.	CAAAA	C	15.4	PASS	DP=15;AN=2;AC=1	GT:GQ:DP:GL	0/1:277:15:-10,0,-10
+1	3157410	.	GAC	G	36.8	PASS	DP=11;AN=2;AC=1	GT:GQ:DP	0/1:49:11
+1	3162006	.	GAA	G	238	PASS	DP=19;AN=2;AC=1;XRF=1e6,2e6;XRI=1111,2222;XRS=AAA,BBB;XAF=1e6;XAI=1111;XAS=AAA;XGF=1e6,2e6,3e6;XGI=1111,2222,3333;XGS=A,B,C	GT:GQ:DP	0/1:589:19
+1	3177144	.	G	T	999	PASS	DP=24;AN=2;AC=1	GT:GQ:DP	0/1:236:24
+1	3177144	.	GT	G	999	PASS	DP=24;AN=2;AC=1	GT:GQ:DP	0/1:236:24
+1	3184885	.	TAAA	T	25.8	PASS	DP=16;AN=2;AC=1	GT:GQ:DP	0/1:435:16
+2	3188209	.	GA	G	41.5	.	DP=15;AN=2;AC=1	GT:GQ:DP	0/1:162:15
+3	3199812	.	GA	GTT,GT	17.5	PASS	DP=19;AN=2;AC=1,1	GT:GQ:DP	1/2:188:19
+4	3212016	.	CTT	C	999	q20	DP=15;AN=2;AC=1	GT:GQ:DP	0/1:158:15
diff --git a/test/merge.c.vcf b/test/merge.c.vcf
new file mode 100644
index 0000000..7f0d0ee
--- /dev/null
+++ b/test/merge.c.vcf
@@ -0,0 +1,43 @@
+##fileformat=VCFv4.1
+##INFO=<ID=TEST,Number=1,Type=Integer,Description="Testing Tag">
+##INFO=<ID=TXT,Number=.,Type=String,Description="Testing in INFO">
+##FORMAT=<ID=TT,Number=A,Type=Integer,Description="Testing Tag, with commas and \"escapes\" and escaped escapes combined with \\\"quotes\\\\\"">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##INFO=<ID=INTA,Number=A,Type=Integer,Description="Testing Number=A in INFO">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=GL,Number=G,Type=Float,Description="Genotype Likelihood">
+##FILTER=<ID=q10,Description="Quality below 10">
+##FILTER=<ID=test,Description="Testing filter">
+##INFO=<ID=XRF,Number=R,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAF,Number=A,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGF,Number=G,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XRI,Number=R,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAI,Number=A,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGI,Number=G,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XRS,Number=R,Type=String,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAS,Number=A,Type=String,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGS,Number=G,Type=String,Description="Test Number=AGR in INFO">
+##contig=<ID=1,assembly=b37,length=249250621>
+##contig=<ID=3,assembly=b37,length=198022430>
+##contig=<ID=4,assembly=b37,length=191154276>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##readme=AAAAAA
+##readme=BBBBBB
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	C	D
+1	3062915	id3D	GTTT	G	48.7	q10	TXT=BB;DP=999;DP4=4,3,2,1;AN=4;AC=2	GT:GQ:DP:GL	0/1:409:35:-20,-5,-20	0/1:409:35:-20,-5,-20
+1	3062915	idSNP	G	C,T	419	test	TEST=5;DP4=1,2,3,4;AN=4;AC=1,1;INTA=1,2	GT:TT:GQ:DP:GL	0/1:0,1:409:35:-20,-5,-20,-20,-5,-20	0/2:0,1:409:35:-20,-5,-20,-20,-5,-20
+1	3062915	id2D	GTT	G	999	q10	DP4=1,2,3,4;AN=4;AC=2	GT:GQ:DP:GL	0/1:409:35:-20,-5,-20	0/1:409:35:-20,-5,-20
+1	3106154	.	CAAA	C	72.6	PASS	AN=0;AC=0	GT:GQ:DP	.:245:32	./.:245:32
+1	3106154	.	C	CT	459	PASS	AN=4;AC=2	GT:GQ:DP	0/1:245:32	0/1:245:32
+1	3157410	.	G	T	46.7	q10	AN=4;AC=4	GT:GQ:DP	1/1:21:21	1/1:21:21
+1	3162006	.	GAA	GA	206	PASS	AN=4;AC=2;XRF=1e6,5e5;XRI=1111,5555;XRS=AAA,DDD;XAF=5e5;XAI=5555;XAS=DDD;XGF=1e6,5e5,9e9;XGI=1111,5555,9999;XGS=A,E,F	GT:GQ:DP	0/1:212:22	0/1:212:22
+1	3177144	.	G	.	364	PASS	AN=4;AC=0	GT:GQ:DP	0/0:150:30	0/0:150:30
+1	3184885	.	TAAAA	TA,T	8.42	PASS	AN=4;AC=2,2	GT:GQ:DP	1/2:12:10	1/2:12:10
+2	3199812	.	G	GTT,GT	291	PASS	AN=4;AC=2,2	GT:GQ:DP	1/2:322:26	1/2:322:26
+3	3212016	.	CTT	C,CT	52.5	PASS	AN=4;AC=2,2	GT:GQ:DP	1/2:91:26	1/2:91:26
+4	3258448	.	TACACACAC	T	.	PASS	AN=4;AC=2	GT:GQ:DP	0/1:325:31	0/1:325:31
diff --git a/test/missing2ref.out b/test/missing2ref.out
new file mode 100644
index 0000000..9b4d7cf
--- /dev/null
+++ b/test/missing2ref.out
@@ -0,0 +1,36 @@
+##fileformat=VCFv4.1
+##FILTER=<ID=PASS,Description="All filters passed">
+##INFO=<ID=TEST,Number=1,Type=Integer,Description="Testing Tag">
+##FORMAT=<ID=TT,Number=A,Type=Integer,Description="Testing Tag, with commas and \"escapes\" and escaped escapes combined with \\\"quotes\\\\\"">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=GL,Number=G,Type=Float,Description="Genotype Likelihood">
+##FILTER=<ID=q10,Description="Quality below 10">
+##FILTER=<ID=test,Description="Testing filter">
+##contig=<ID=1,assembly=b37,length=249250621>
+##contig=<ID=2,assembly=b37,length=249250621>
+##contig=<ID=3,assembly=b37,length=198022430>
+##contig=<ID=4,assembly=b37,length=191154276>
+##test=<ID=4,IE=5>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##readme=AAAAAA
+##readme=BBBBBB
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##INFO=<ID=STR,Number=1,Type=String,Description="Test string type">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B
+1	3000150	.	C	T	59.2	PASS	.	GT:GQ	0/0:245	0/0:245
+1	3000151	.	C	T	59.2	PASS	.	GT:DP:GQ	0/0:32:245	0/0:32:245
+1	3062915	id3D	GTTT	G	12.9	q10	DP4=1,2,3,4;INDEL;STR=test	GT:GQ:DP:GL	0/1:409:35:-20,-5,-20	0/1:409:35:-20,-5,-20
+1	3062915	idSNP	G	T,C	12.6	test	TEST=5;DP4=1,2,3,4	GT:TT:GQ:DP:GL	0/1:0,1:409:35:-20,-5,-20,-20,-5,-20	2:0,1:409:35:-20,-5,-20
+1	3106154	.	CAAA	C	342	PASS	.	GT:GQ:DP	0/0:245:32	0/0:245:32
+1	3106154	.	C	CT	59.2	PASS	.	GT:GQ:DP	0/0:245:32	0/0:245:32
+1	3157410	.	GA	G	90.6	q10	.	GT:GQ:DP	1/1:21:21	1/1:21:21
+1	3162006	.	GAA	G	60.2	PASS	.	GT:GQ:DP	0/0:212:22	0/0:212:22
+1	3177144	.	G	T	45	PASS	.	GT:GQ:DP	0/0:150:30	0/0:150:30
+1	3177144	.	G	.	45	PASS	.	GT:GQ:DP	0/0:150:30	0/0:150:30
+1	3184885	.	TAAAA	TA,T	61.5	PASS	.	GT:GQ:DP	0/0:12:10	0/0:12:10
+2	3199812	.	G	GTT,GT	82.7	PASS	.	GT:GQ:DP	0/0:322:26	0/0:322:26
+3	3212016	.	CTT	C,CT	79	PASS	.	GT:GQ:DP	0/0:91:26	0/0:91:26
+4	3258448	.	TACACACAC	T	59.9	PASS	.	GT:GQ:DP	0/0:325:31	0/0:325:31
diff --git a/test/mpileup.1.out b/test/mpileup.1.out
new file mode 100644
index 0000000..8cedcb3
--- /dev/null
+++ b/test/mpileup.1.out
@@ -0,0 +1,40 @@
+##fileformat=VCFv4.2
+##FILTER=<ID=PASS,Description="All filters passed">
+##samtoolsVersion=1.1-19-g6b249e2+htslib-1.1-74-g845c515
+##samtoolsCommand=samtools mpileup -uvDV -b xxx//mpileup.bam.list -f xxx//mpileup.ref.fa.gz
+##reference=file://xxx//mpileup.ref.fa.gz
+##contig=<ID=17,length=81195210>
+##ALT=<ID=X,Description="Represents allele(s) other than observed.">
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##INFO=<ID=IDV,Number=1,Type=Integer,Description="Maximum number of reads supporting an indel">
+##INFO=<ID=IMF,Number=1,Type=Float,Description="Maximum fraction of reads supporting an indel">
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Raw read depth">
+##INFO=<ID=VDB,Number=1,Type=Float,Description="Variant Distance Bias for filtering splice-site artefacts in RNA-seq data (bigger is better)",Version="3">
+##INFO=<ID=RPB,Number=1,Type=Float,Description="Mann-Whitney U test of Read Position Bias (bigger is better)">
+##INFO=<ID=MQB,Number=1,Type=Float,Description="Mann-Whitney U test of Mapping Quality Bias (bigger is better)">
+##INFO=<ID=BQB,Number=1,Type=Float,Description="Mann-Whitney U test of Base Quality Bias (bigger is better)">
+##INFO=<ID=MQSB,Number=1,Type=Float,Description="Mann-Whitney U test of Mapping Quality vs Strand Bias (bigger is better)">
+##INFO=<ID=SGB,Number=1,Type=Float,Description="Segregation based metric.">
+##INFO=<ID=MQ0F,Number=1,Type=Float,Description="Fraction of MQ0 reads (smaller is better)">
+##FORMAT=<ID=PL,Number=G,Type=Integer,Description="List of Phred-scaled genotype likelihoods">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Number of high-quality bases">
+##FORMAT=<ID=DV,Number=1,Type=Integer,Description="Number of high-quality non-reference bases">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##INFO=<ID=ICB,Number=1,Type=Float,Description="Inbreeding Coefficient Binomial test (bigger is better)">
+##INFO=<ID=HOB,Number=1,Type=Float,Description="Bias in the number of HOMs number (smaller is better)">
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes for each ALT allele, in the same order as listed">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="Number of high-quality ref-forward , ref-reverse, alt-forward and alt-reverse bases">
+##INFO=<ID=MQ,Number=1,Type=Integer,Description="Average mapping quality">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	HG00100	HG00101	HG00102
+17	302	.	T	TA	488	.	INDEL;IDV=7;IMF=1;DP=25;VDB=0.27613;SGB=-4.22417;MQSB=0.0443614;MQ0F=0;ICB=0.8;HOB=0.222222;AC=4;AN=6;DP4=2,4,8,11;MQ=49	GT:PL:DP:DV	0/1:167,0,96:11:6	0/1:157,0,9:7:6	1/1:201,21,0:7:7
+17	828	.	T	C	409	.	DP=25;VDB=0.842082;SGB=-4.20907;RPB=0.950652;MQB=1;MQSB=1;BQB=0.929717;MQ0F=0;ICB=0.8;HOB=0.222222;AC=4;AN=6;DP4=2,4,8,11;MQ=60	GT:PL:DP:DV	0/1:211,0,35:12:10	0/1:116,0,91:9:5	1/1:120,12,0:4:4
+17	834	.	G	A	364	.	DP=25;VDB=0.788006;SGB=-4.01214;RPB=0.999233;MQB=1;MQSB=1;BQB=0.821668;MQ0F=0;ICB=0.8;HOB=0.222222;AC=4;AN=6;DP4=2,3,7,10;MQ=60	GT:PL:DP:DV	0/1:185,0,46:11:9	0/1:128,0,59:8:5	1/1:89,9,0:3:3
+17	1665	.	T	C	3.10665	.	DP=20;VDB=0.1;SGB=0.346553;RPB=0.222222;MQB=0.611111;MQSB=0.988166;BQB=0.944444;MQ0F=0;ICB=0.128205;HOB=0.0555556;AC=1;AN=6;DP4=7,11,1,1;MQ=55	GT:PL:DP:DV	0/0:0,21,185:7:0	0/0:0,27,222:9:0	0/1:35,0,51:4:2
+17	1869	.	A	T	138	.	DP=24;VDB=0.928022;SGB=-11.9537;RPB=0.984127;MQB=0.96464;MQSB=0.931547;BQB=0.359155;MQ0F=0;ICB=0.8;HOB=0.222222;AC=4;AN=6;DP4=6,9,5,4;MQ=58	GT:PL:DP:DV	0/1:115,0,224:18:7	0/1:16,0,104:5:1	1/1:42,3,0:1:1
+17	2041	.	G	A	447	.	DP=31;VDB=0.816435;SGB=-4.18892;RPB=0.88473;MQB=0.972375;MQSB=0.968257;BQB=0.311275;MQ0F=0;ICB=0.8;HOB=0.222222;AC=4;AN=6;DP4=6,5,12,7;MQ=58	GT:PL:DP:DV	0/1:229,0,212:21:11	0/1:32,0,24:2:1	1/1:223,21,0:7:7
+17	2220	.	G	A	303	.	DP=21;VDB=0.532753;SGB=-3.51597;RPB=0.964198;MQB=0.898397;MQSB=0.875769;BQB=0.0354359;MQ0F=0;ICB=0.8;HOB=0.222222;AC=4;AN=6;DP4=6,2,1,11;MQ=58	GT:PL:DP:DV	0/1:139,0,130:12:6	0/1:69,0,46:4:2	1/1:131,12,0:4:4
+17	2564	.	A	G	233	.	DP=15;VDB=0.690812;SGB=-3.20711;RPB=0.197899;MQB=1;MQSB=1;BQB=0.965069;MQ0F=0;ICB=0.8;HOB=0.222222;AC=4;AN=6;DP4=1,4,4,5;MQ=60	GT:PL:DP:DV	0/1:88,0,78:6:3	0/1:57,0,56:4:2	1/1:124,12,0:4:4
+17	3104	.	C	T	24.2837	.	DP=25;VDB=0.8;SGB=0.346553;RPB=0.717391;MQB=0.956522;MQSB=0.962269;BQB=0.978261;MQ0F=0;ICB=0.128205;HOB=0.0555556;AC=1;AN=6;DP4=8,15,2,0;MQ=58	GT:PL:DP:DV	0/0:0,48,255:16:0	0/0:0,12,144:4:0	0/1:59,0,93:5:2
+17	3587	.	G	A	358	.	DP=29;VDB=0.902044;SGB=-3.91326;RPB=0.800999;MQB=1;MQSB=1;BQB=0.156944;MQ0F=0;ICB=0.8;HOB=0.222222;AC=4;AN=6;DP4=4,7,10,6;MQ=60	GT:PL:DP:DV	0/1:161,0,184:14:7	0/1:22,0,118:5:1	1/1:212,24,0:8:8
+17	3936	.	A	G	469	.	DP=37;VDB=0.0574114;SGB=-4.60123;RPB=0.741697;MQB=0.812605;MQSB=0.143788;BQB=0.883831;MQ0F=0;ICB=0.8;HOB=0.222222;AC=4;AN=6;DP4=5,6,6,17;MQ=56	GT:PL:DP:DV	0/1:233,0,206:20:11	0/1:77,0,58:6:4	1/1:196,24,0:8:8
diff --git a/test/mpileup.2.out b/test/mpileup.2.out
new file mode 100644
index 0000000..4a415ea
--- /dev/null
+++ b/test/mpileup.2.out
@@ -0,0 +1,53 @@
+##fileformat=VCFv4.2
+##FILTER=<ID=PASS,Description="All filters passed">
+##samtoolsVersion=1.1-19-g6b249e2+htslib-1.1-74-g845c515
+##samtoolsCommand=samtools mpileup -uvDV -b xxx//mpileup.bam.list -f xxx//mpileup.ref.fa.gz
+##reference=file://xxx//mpileup.ref.fa.gz
+##contig=<ID=17,length=81195210>
+##ALT=<ID=X,Description="Represents allele(s) other than observed.">
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##INFO=<ID=IDV,Number=1,Type=Integer,Description="Maximum number of reads supporting an indel">
+##INFO=<ID=IMF,Number=1,Type=Float,Description="Maximum fraction of reads supporting an indel">
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Raw read depth">
+##INFO=<ID=VDB,Number=1,Type=Float,Description="Variant Distance Bias for filtering splice-site artefacts in RNA-seq data (bigger is better)",Version="3">
+##INFO=<ID=RPB,Number=1,Type=Float,Description="Mann-Whitney U test of Read Position Bias (bigger is better)">
+##INFO=<ID=MQB,Number=1,Type=Float,Description="Mann-Whitney U test of Mapping Quality Bias (bigger is better)">
+##INFO=<ID=BQB,Number=1,Type=Float,Description="Mann-Whitney U test of Base Quality Bias (bigger is better)">
+##INFO=<ID=MQSB,Number=1,Type=Float,Description="Mann-Whitney U test of Mapping Quality vs Strand Bias (bigger is better)">
+##INFO=<ID=SGB,Number=1,Type=Float,Description="Segregation based metric.">
+##INFO=<ID=MQ0F,Number=1,Type=Float,Description="Fraction of MQ0 reads (smaller is better)">
+##FORMAT=<ID=PL,Number=G,Type=Integer,Description="List of Phred-scaled genotype likelihoods">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Number of high-quality bases">
+##FORMAT=<ID=DV,Number=1,Type=Integer,Description="Number of high-quality non-reference bases">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##INFO=<ID=ICB,Number=1,Type=Float,Description="Inbreeding Coefficient Binomial test (bigger is better)">
+##INFO=<ID=HOB,Number=1,Type=Float,Description="Bias in the number of HOMs number (smaller is better)">
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes for each ALT allele, in the same order as listed">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="Number of high-quality ref-forward , ref-reverse, alt-forward and alt-reverse bases">
+##INFO=<ID=MQ,Number=1,Type=Integer,Description="Average mapping quality">
+##INFO=<ID=END,Number=1,Type=Integer,Description="End position of the variant described in this record">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	HG00100	HG00101	HG00102
+17	1	.	A	.	.	.	END=301	GT	0/0	0/0	0/0
+17	302	.	T	TA	488	.	INDEL;IDV=7;IMF=1;DP=25;VDB=0.27613;SGB=-4.22417;MQSB=0.0443614;MQ0F=0;ICB=0.8;HOB=0.222222;AC=4;AN=6;DP4=2,4,8,11;MQ=49	GT:PL:DP:DV	0/1:167,0,96:11:6	0/1:157,0,9:7:6	1/1:201,21,0:7:7
+17	303	.	G	.	.	.	END=827	GT	0/0	0/0	0/0
+17	828	.	T	C	409	.	DP=25;VDB=0.842082;SGB=-4.20907;RPB=0.950652;MQB=1;MQSB=1;BQB=0.929717;MQ0F=0;ICB=0.8;HOB=0.222222;AC=4;AN=6;DP4=2,4,8,11;MQ=60	GT:PL:DP:DV	0/1:211,0,35:12:10	0/1:116,0,91:9:5	1/1:120,12,0:4:4
+17	829	.	T	.	.	.	END=833	GT	0/0	0/0	0/0
+17	834	.	G	A	364	.	DP=25;VDB=0.788006;SGB=-4.01214;RPB=0.999233;MQB=1;MQSB=1;BQB=0.821668;MQ0F=0;ICB=0.8;HOB=0.222222;AC=4;AN=6;DP4=2,3,7,10;MQ=60	GT:PL:DP:DV	0/1:185,0,46:11:9	0/1:128,0,59:8:5	1/1:89,9,0:3:3
+17	835	.	T	.	.	.	END=1664	GT	0/0	0/0	0/0
+17	1665	.	T	C	3.10665	.	DP=20;VDB=0.1;SGB=0.346553;RPB=0.222222;MQB=0.611111;MQSB=0.988166;BQB=0.944444;MQ0F=0;ICB=0.128205;HOB=0.0555556;AC=1;AN=6;DP4=7,11,1,1;MQ=55	GT:PL:DP:DV	0/0:0,21,185:7:0	0/0:0,27,222:9:0	0/1:35,0,51:4:2
+17	1666	.	G	.	.	.	END=1868	GT	0/0	0/0	0/0
+17	1869	.	A	T	138	.	DP=24;VDB=0.928022;SGB=-11.9537;RPB=0.984127;MQB=0.96464;MQSB=0.931547;BQB=0.359155;MQ0F=0;ICB=0.8;HOB=0.222222;AC=4;AN=6;DP4=6,9,5,4;MQ=58	GT:PL:DP:DV	0/1:115,0,224:18:7	0/1:16,0,104:5:1	1/1:42,3,0:1:1
+17	1870	.	C	.	.	.	END=2040	GT	0/0	0/0	0/0
+17	2041	.	G	A	447	.	DP=31;VDB=0.816435;SGB=-4.18892;RPB=0.88473;MQB=0.972375;MQSB=0.968257;BQB=0.311275;MQ0F=0;ICB=0.8;HOB=0.222222;AC=4;AN=6;DP4=6,5,12,7;MQ=58	GT:PL:DP:DV	0/1:229,0,212:21:11	0/1:32,0,24:2:1	1/1:223,21,0:7:7
+17	2042	.	G	.	.	.	END=2219	GT	0/0	0/0	0/0
+17	2220	.	G	A	303	.	DP=21;VDB=0.532753;SGB=-3.51597;RPB=0.964198;MQB=0.898397;MQSB=0.875769;BQB=0.0354359;MQ0F=0;ICB=0.8;HOB=0.222222;AC=4;AN=6;DP4=6,2,1,11;MQ=58	GT:PL:DP:DV	0/1:139,0,130:12:6	0/1:69,0,46:4:2	1/1:131,12,0:4:4
+17	2221	.	G	.	.	.	END=2563	GT	0/0	0/0	0/0
+17	2564	.	A	G	233	.	DP=15;VDB=0.690812;SGB=-3.20711;RPB=0.197899;MQB=1;MQSB=1;BQB=0.965069;MQ0F=0;ICB=0.8;HOB=0.222222;AC=4;AN=6;DP4=1,4,4,5;MQ=60	GT:PL:DP:DV	0/1:88,0,78:6:3	0/1:57,0,56:4:2	1/1:124,12,0:4:4
+17	2565	.	A	.	.	.	END=3103	GT	0/0	0/0	0/0
+17	3104	.	C	T	24.2837	.	DP=25;VDB=0.8;SGB=0.346553;RPB=0.717391;MQB=0.956522;MQSB=0.962269;BQB=0.978261;MQ0F=0;ICB=0.128205;HOB=0.0555556;AC=1;AN=6;DP4=8,15,2,0;MQ=58	GT:PL:DP:DV	0/0:0,48,255:16:0	0/0:0,12,144:4:0	0/1:59,0,93:5:2
+17	3105	.	T	.	.	.	END=3586	GT	0/0	0/0	0/0
+17	3587	.	G	A	358	.	DP=29;VDB=0.902044;SGB=-3.91326;RPB=0.800999;MQB=1;MQSB=1;BQB=0.156944;MQ0F=0;ICB=0.8;HOB=0.222222;AC=4;AN=6;DP4=4,7,10,6;MQ=60	GT:PL:DP:DV	0/1:161,0,184:14:7	0/1:22,0,118:5:1	1/1:212,24,0:8:8
+17	3588	.	A	.	.	.	END=3935	GT	0/0	0/0	0/0
+17	3936	.	A	G	469	.	DP=37;VDB=0.0574114;SGB=-4.60123;RPB=0.741697;MQB=0.812605;MQSB=0.143788;BQB=0.883831;MQ0F=0;ICB=0.8;HOB=0.222222;AC=4;AN=6;DP4=5,6,6,17;MQ=56	GT:PL:DP:DV	0/1:233,0,206:20:11	0/1:77,0,58:6:4	1/1:196,24,0:8:8
+17	3937	.	C	.	.	.	END=4101	GT	0/0	0/0	0/0
diff --git a/test/mpileup.cAls.out b/test/mpileup.cAls.out
new file mode 100644
index 0000000..660e7f5
--- /dev/null
+++ b/test/mpileup.cAls.out
@@ -0,0 +1,33 @@
+##fileformat=VCFv4.2
+##FILTER=<ID=PASS,Description="All filters passed">
+##samtoolsVersion=1.1-19-g6b249e2+htslib-1.1-74-g845c515
+##samtoolsCommand=samtools mpileup -uvDV -b xxx//mpileup.bam.list -f xxx//mpileup.ref.fa.gz
+##reference=file://xxx//mpileup.ref.fa.gz
+##contig=<ID=17,length=81195210>
+##ALT=<ID=X,Description="Represents allele(s) other than observed.">
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##INFO=<ID=IDV,Number=1,Type=Integer,Description="Maximum number of reads supporting an indel">
+##INFO=<ID=IMF,Number=1,Type=Float,Description="Maximum fraction of reads supporting an indel">
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Raw read depth">
+##INFO=<ID=VDB,Number=1,Type=Float,Description="Variant Distance Bias for filtering splice-site artefacts in RNA-seq data (bigger is better)",Version="3">
+##INFO=<ID=RPB,Number=1,Type=Float,Description="Mann-Whitney U test of Read Position Bias (bigger is better)">
+##INFO=<ID=MQB,Number=1,Type=Float,Description="Mann-Whitney U test of Mapping Quality Bias (bigger is better)">
+##INFO=<ID=BQB,Number=1,Type=Float,Description="Mann-Whitney U test of Base Quality Bias (bigger is better)">
+##INFO=<ID=MQSB,Number=1,Type=Float,Description="Mann-Whitney U test of Mapping Quality vs Strand Bias (bigger is better)">
+##INFO=<ID=SGB,Number=1,Type=Float,Description="Segregation based metric.">
+##INFO=<ID=MQ0F,Number=1,Type=Float,Description="Fraction of MQ0 reads (smaller is better)">
+##FORMAT=<ID=PL,Number=G,Type=Integer,Description="List of Phred-scaled genotype likelihoods">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Number of high-quality bases">
+##FORMAT=<ID=DV,Number=1,Type=Integer,Description="Number of high-quality non-reference bases">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##INFO=<ID=ICB,Number=1,Type=Float,Description="Inbreeding Coefficient Binomial test (bigger is better)">
+##INFO=<ID=HOB,Number=1,Type=Float,Description="Bias in the number of HOMs number (smaller is better)">
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes for each ALT allele, in the same order as listed">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="Number of high-quality ref-forward , ref-reverse, alt-forward and alt-reverse bases">
+##INFO=<ID=MQ,Number=1,Type=Integer,Description="Average mapping quality">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	HG00100	HG00101	HG00102
+17	828	.	T	C	409	.	DP=25;VDB=0.842082;SGB=-4.20907;RPB=0.950652;MQB=1;MQSB=1;BQB=0.929717;MQ0F=0;ICB=0.8;HOB=0.222222;AC=4;AN=6;DP4=2,4,8,11;MQ=60	GT:PL:DP:DV	0/1:211,0,35:12:10	0/1:116,0,91:9:5	1/1:120,12,0:4:4
+17	1665	.	T	C	3.10665	.	DP=20;VDB=0.1;SGB=0.346553;RPB=0.222222;MQB=0.611111;MQSB=0.988166;BQB=0.944444;MQ0F=0;ICB=0.128205;HOB=0.0555556;AC=1;AN=6;DP4=7,11,1,1;MQ=55	GT:PL:DP:DV	0/0:0,21,185:7:0	0/0:0,27,222:9:0	0/1:35,0,51:4:2
+17	2220	.	G	C	999	.	DP=21;VDB=0.532753;SGB=-3.51597;RPB=0.964198;MQB=0.898397;MQSB=0.875769;BQB=0.0354359;MQ0F=0;AC=0;AN=6;DP4=6,2,1,11;MQ=58	GT:PL:DP:DV	0/0:139,157,255:12:6	0/0:69,75,119:4:2	0/0:131,131,131:4:4
+17	2564	.	A	AG	999	.	DP=15;VDB=0.690812;SGB=-3.20711;RPB=0.197899;MQB=1;MQSB=1;BQB=0.965069;MQ0F=0;AC=0;AN=6;DP4=1,4,4,5;MQ=60	GT:PL:DP:DV	0/0:88,98,171:6:3	0/0:57,63,117:4:2	0/0:124,124,124:4:4
diff --git a/test/mpileup.tab b/test/mpileup.tab
new file mode 100644
index 0000000..c585dad
--- /dev/null
+++ b/test/mpileup.tab
@@ -0,0 +1,4 @@
+17	828	T,C
+17	1665	T,C
+17	2220	G,C
+17	2564	A,AG
diff --git a/test/mpileup.vcf b/test/mpileup.vcf
new file mode 100644
index 0000000..13c0132
--- /dev/null
+++ b/test/mpileup.vcf
@@ -0,0 +1,4127 @@
+##fileformat=VCFv4.2
+##FILTER=<ID=PASS,Description="All filters passed">
+##samtoolsVersion=1.1-19-g6b249e2+htslib-1.1-74-g845c515
+##samtoolsCommand=samtools mpileup -uvDV -b xxx//mpileup.bam.list -f xxx//mpileup.ref.fa.gz
+##reference=file://xxx//mpileup.ref.fa.gz
+##contig=<ID=17,length=81195210>
+##ALT=<ID=X,Description="Represents allele(s) other than observed.">
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##INFO=<ID=IDV,Number=1,Type=Integer,Description="Maximum number of reads supporting an indel">
+##INFO=<ID=IMF,Number=1,Type=Float,Description="Maximum fraction of reads supporting an indel">
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Raw read depth">
+##INFO=<ID=VDB,Number=1,Type=Float,Description="Variant Distance Bias for filtering splice-site artefacts in RNA-seq data (bigger is better)",Version="3">
+##INFO=<ID=RPB,Number=1,Type=Float,Description="Mann-Whitney U test of Read Position Bias (bigger is better)">
+##INFO=<ID=MQB,Number=1,Type=Float,Description="Mann-Whitney U test of Mapping Quality Bias (bigger is better)">
+##INFO=<ID=BQB,Number=1,Type=Float,Description="Mann-Whitney U test of Base Quality Bias (bigger is better)">
+##INFO=<ID=MQSB,Number=1,Type=Float,Description="Mann-Whitney U test of Mapping Quality vs Strand Bias (bigger is better)">
+##INFO=<ID=SGB,Number=1,Type=Float,Description="Segregation based metric.">
+##INFO=<ID=MQ0F,Number=1,Type=Float,Description="Fraction of MQ0 reads (smaller is better)">
+##INFO=<ID=I16,Number=16,Type=Float,Description="Auxiliary tag used for calling, see description of bcf_callret1_t in bam2bcf.h">
+##INFO=<ID=QS,Number=R,Type=Float,Description="Auxiliary tag used for calling">
+##FORMAT=<ID=PL,Number=G,Type=Integer,Description="List of Phred-scaled genotype likelihoods">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Number of high-quality bases">
+##FORMAT=<ID=DV,Number=1,Type=Integer,Description="Number of high-quality non-reference bases">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	HG00100	HG00101	HG00102
+17	1	.	A	<X>	0	.	DP=11;I16=11,0,0,0,452,18594,0,0,319,9251,0,0,223,4959,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,15,100:5:0	0,9,72:3:0	0,9,72:3:0
+17	2	.	A	<X>	0	.	DP=11;I16=11,0,0,0,439,17587,0,0,319,9251,0,0,226,5030,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,15,100:5:0	0,9,72:3:0	0,9,72:3:0
+17	3	.	G	<X>	0	.	DP=11;I16=11,0,0,0,431,16971,0,0,319,9251,0,0,229,5111,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,15,100:5:0	0,9,72:3:0	0,9,72:3:0
+17	4	.	C	<X>	0	.	DP=11;I16=11,0,0,0,423,16417,0,0,319,9251,0,0,232,5202,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,15,100:5:0	0,9,72:3:0	0,9,71:3:0
+17	5	.	T	<X>	0	.	DP=11;I16=11,0,0,0,450,18520,0,0,319,9251,0,0,234,5252,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,15,100:5:0	0,9,72:3:0	0,9,72:3:0
+17	6	.	T	<X>	0	.	DP=11;I16=11,0,0,0,403,14847,0,0,319,9251,0,0,236,5310,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,15,100:5:0	0,9,72:3:0	0,9,72:3:0
+17	7	.	C	<X>	0	.	DP=11;I16=11,0,0,0,446,18114,0,0,319,9251,0,0,237,5327,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,15,100:5:0	0,9,72:3:0	0,9,72:3:0
+17	8	.	T	<X>	0	.	DP=11;I16=11,0,0,0,465,19677,0,0,319,9251,0,0,238,5354,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,15,100:5:0	0,9,72:3:0	0,9,72:3:0
+17	9	.	C	<X>	0	.	DP=11;I16=11,0,0,0,447,18205,0,0,319,9251,0,0,239,5391,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,15,100:5:0	0,9,72:3:0	0,9,72:3:0
+17	10	.	A	<X>	0	.	DP=11;I16=11,0,0,0,426,16756,0,0,319,9251,0,0,240,5438,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,15,100:5:0	0,9,72:3:0	0,9,69:3:0
+17	11	.	C	<X>	0	.	DP=11;I16=11,0,0,0,413,15603,0,0,319,9251,0,0,241,5495,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,15,100:5:0	0,9,72:3:0	0,9,72:3:0
+17	12	.	C	<X>	0	.	DP=11;I16=11,0,0,0,438,17506,0,0,319,9251,0,0,242,5562,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,15,100:5:0	0,9,72:3:0	0,9,72:3:0
+17	13	.	C	<X>	0	.	DP=11;I16=11,0,0,0,437,17463,0,0,319,9251,0,0,243,5639,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,15,100:5:0	0,9,72:3:0	0,9,72:3:0
+17	14	.	T	<X>	0	.	DP=11;I16=11,0,0,0,453,18715,0,0,319,9251,0,0,242,5628,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,15,100:5:0	0,9,72:3:0	0,9,72:3:0
+17	15	.	G	<X>	0	.	DP=11;I16=11,0,0,0,439,17599,0,0,319,9251,0,0,240,5580,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,15,100:5:0	0,9,72:3:0	0,9,72:3:0
+17	16	.	T	<X>	0	.	DP=11;I16=11,0,0,0,426,16546,0,0,319,9251,0,0,238,5544,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,15,100:5:0	0,9,72:3:0	0,9,72:3:0
+17	17	.	T	<X>	0	.	DP=11;I16=11,0,0,0,407,15195,0,0,319,9251,0,0,235,5469,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,15,100:5:0	0,9,72:3:0	0,9,72:3:0
+17	18	.	C	<X>	0	.	DP=12;I16=12,0,0,0,450,17136,0,0,379,12851,0,0,231,5353,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,18,113:6:0	0,9,72:3:0	0,9,72:3:0
+17	19	.	C	<X>	0	.	DP=13;I16=13,0,0,0,502,19652,0,0,439,16451,0,0,228,5246,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,18,112:6:0	0,12,89:4:0	0,9,72:3:0
+17	20	.	T	<X>	0	.	DP=13;I16=13,0,0,0,532,21878,0,0,439,16451,0,0,226,5150,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,18,116:6:0	0,12,98:4:0	0,9,72:3:0
+17	21	.	G	<X>	0	.	DP=13;I16=13,0,0,0,498,19254,0,0,439,16451,0,0,224,5066,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,18,117:6:0	0,12,94:4:0	0,9,72:3:0
+17	22	.	C	<X>	0	.	DP=13;I16=13,0,0,0,511,20289,0,0,470,19210,0,0,223,4993,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,18,115:6:0	0,12,91:4:0	0,9,76:3:0
+17	23	.	A	<X>	0	.	DP=14;I16=14,0,0,0,513,19399,0,0,530,22810,0,0,223,4931,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,21,133:7:0	0,12,82:4:0	0,9,82:3:0
+17	24	.	T	<X>	0	.	DP=14;I16=14,0,0,0,534,20540,0,0,530,22810,0,0,224,4882,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,21,131:7:0	0,12,96:4:0	0,9,80:3:0
+17	25	.	A	<X>	0	.	DP=15;I16=15,0,0,0,561,21133,0,0,590,26410,0,0,225,4847,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,140:8:0	0,12,96:4:0	0,9,81:3:0
+17	26	.	G	<X>	0	.	DP=15;I16=15,0,0,0,591,23429,0,0,590,26410,0,0,227,4827,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,151:8:0	0,12,96:4:0	0,9,81:3:0
+17	27	.	A	<X>	0	.	DP=15;I16=15,0,0,0,588,23120,0,0,590,26410,0,0,229,4823,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,146:8:0	0,12,98:4:0	0,9,83:3:0
+17	28	.	T	<X>	0	.	DP=16;I16=16,0,0,0,605,23001,0,0,650,30010,0,0,231,4835,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,147:8:0	0,12,97:4:0	0,12,101:4:0
+17	29	.	A	<X>	0	.	DP=17;I16=17,0,0,0,615,22533,0,0,710,33610,0,0,234,4864,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,146:8:0	0,15,102:5:0	0,12,104:4:0
+17	30	.	A	<X>	0	.	DP=17;I16=17,0,0,0,660,25914,0,0,710,33610,0,0,238,4912,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,149:8:0	0,15,115:5:0	0,12,108:4:0
+17	31	.	T	<X>	0	.	DP=17;I16=17,0,0,0,656,25392,0,0,710,33610,0,0,242,4980,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,150:8:0	0,15,113:5:0	0,12,105:4:0
+17	32	.	T	<X>	0	.	DP=17;I16=17,0,0,0,605,21789,0,0,741,36369,0,0,247,5067,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,143:8:0	0,15,104:5:0	0,12,104:4:0
+17	33	.	G	<X>	0	.	DP=17;I16=17,0,0,0,659,25757,0,0,741,36369,0,0,252,5124,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,158:8:0	0,15,118:5:0	0,12,105:4:0
+17	34	.	C	<X>	0	.	DP=17;I16=17,0,0,0,658,25704,0,0,741,36369,0,0,257,5203,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,151:8:0	0,15,121:5:0	0,12,106:4:0
+17	35	.	A	<X>	0	.	DP=18;I16=18,0,0,0,677,25881,0,0,801,39969,0,0,262,5304,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,152:8:0	0,15,109:5:0	0,15,121:5:0
+17	36	.	T	<X>	0	.	DP=18;I16=18,0,0,0,678,25796,0,0,801,39969,0,0,268,5428,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,151:8:0	0,15,114:5:0	0,15,125:5:0
+17	37	.	G	<X>	0	.	DP=18;I16=18,0,0,0,685,26291,0,0,801,39969,0,0,274,5576,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,157:8:0	0,15,116:5:0	0,15,126:5:0
+17	38	.	A	<X>	0	.	DP=18;I16=18,0,0,0,697,27245,0,0,801,39969,0,0,280,5748,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,152:8:0	0,15,116:5:0	0,15,129:5:0
+17	39	.	C	<X>	0	.	DP=16;I16=16,0,0,0,591,22311,0,0,743,38287,0,0,288,5942,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,21,148:7:0	0,12,94:4:0	0,15,123:5:0
+17	40	.	A	<X>	0	.	DP=16;I16=16,0,0,0,630,24896,0,0,743,38287,0,0,295,6107,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,21,146:7:0	0,12,104:4:0	0,15,127:5:0
+17	41	.	A	<X>	0	.	DP=17;I16=17,0,0,0,645,24685,0,0,803,41887,0,0,302,6294,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,151:8:0	0,12,104:4:0	0,15,131:5:0
+17	42	.	T	<X>	0	.	DP=17;I16=17,0,0,0,618,23118,0,0,803,41887,0,0,310,6504,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,155:8:0	0,12,82:4:0	0,15,127:5:0
+17	43	.	T	<X>	0	.	DP=17;I16=17,0,0,0,631,23689,0,0,803,41887,0,0,318,6738,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,151:8:0	0,12,101:4:0	0,15,129:5:0
+17	44	.	G	<X>	0	.	DP=17;I16=17,0,0,0,664,26162,0,0,803,41887,0,0,324,6896,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,164:8:0	0,12,100:4:0	0,15,129:5:0
+17	45	.	C	<X>	0	.	DP=17;I16=17,0,0,0,657,25525,0,0,803,41887,0,0,329,7027,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,163:8:0	0,12,108:4:0	0,15,125:5:0
+17	46	.	C	<X>	0	.	DP=17;I16=17,0,0,0,646,25244,0,0,803,41887,0,0,334,7180,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,161:8:0	0,12,98:4:0	0,15,131:5:0
+17	47	.	T	<X>	0	.	DP=17;I16=17,0,0,0,700,28998,0,0,803,41887,0,0,339,7355,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,165:8:0	0,12,110:4:0	0,15,136:5:0
+17	48	.	T	<X>	0	.	DP=17;I16=17,0,0,0,648,25020,0,0,803,41887,0,0,343,7501,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,155:8:0	0,12,105:4:0	0,15,131:5:0
+17	49	.	G	<X>	0	.	DP=18;I16=18,0,0,0,686,26674,0,0,832,42728,0,0,346,7616,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,158:8:0	0,15,119:5:0	0,15,128:5:0
+17	50	.	T	<X>	0	.	DP=18;I16=17,0,0,0,650,24972,0,0,772,39128,0,0,332,7426,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,155:8:0	0,12,101:4:0	0,15,128:5:0
+17	51	.	C	<X>	0	.	DP=18;I16=18,0,0,0,681,26529,0,0,832,42728,0,0,353,7853,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,167:8:0	0,15,99:5:0	0,15,127:5:0
+17	52	.	C	<X>	0	.	DP=18;I16=17,0,0,0,645,24983,0,0,803,41887,0,0,353,7965,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,164:8:0	0,12,99:4:0	0,15,128:5:0
+17	53	.	C	<X>	0	.	DP=18;I16=18,0,0,0,687,26735,0,0,832,42728,0,0,359,8113,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,164:8:0	0,15,113:5:0	0,15,132:5:0
+17	54	.	T	<X>	0	.	DP=18;I16=18,0,0,0,736,30194,0,0,832,42728,0,0,361,8219,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,163:8:0	0,15,128:5:0	0,15,136:5:0
+17	55	.	G	<X>	0	.	DP=18;I16=18,0,0,0,674,26082,0,0,832,42728,0,0,362,8290,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,168:8:0	0,15,112:5:0	0,15,122:5:0
+17	56	.	C	<X>	0	.	DP=18;I16=18,0,0,0,701,27645,0,0,832,42728,0,0,363,8375,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,162:8:0	0,15,121:5:0	0,15,131:5:0
+17	57	.	T	<X>	0	.	DP=18;I16=17,0,0,0,694,29118,0,0,803,41887,0,0,356,8410,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,163:8:0	0,12,117:4:0	0,15,138:5:0
+17	58	.	G	<X>	0	.	DP=17;I16=16,0,0,0,616,24356,0,0,774,41046,0,0,356,8454,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,21,159:7:0	0,12,95:4:0	0,15,131:5:0
+17	59	.	A	<X>	0	.	DP=17;I16=17,0,0,0,656,26038,0,0,803,41887,0,0,366,8606,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,21,155:7:0	0,15,116:5:0	0,15,134:5:0
+17	60	.	A	<X>	0	.	DP=17;I16=17,0,0,0,663,26463,0,0,803,41887,0,0,367,8687,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,21,151:7:0	0,15,127:5:0	0,15,138:5:0
+17	61	.	T	<X>	0	.	DP=17;I16=16,0,0,0,605,23215,0,0,774,41046,0,0,355,8583,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,21,152:7:0	0,12,101:4:0	0,15,131:5:0
+17	62	.	G	<X>	0	.	DP=18;I16=17,0,0,0,646,24868,0,0,834,44646,0,0,353,8557,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,21,158:7:0	0,12,103:4:0	0,18,141:6:0
+17	63	.	T	<X>	0	.	DP=18;I16=17,0,0,0,590,21682,0,0,803,41887,0,0,341,8111,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,21,148:7:0	0,12,80:4:0	0,18,144:6:0
+17	64	.	G	<X>	0	.	DP=19;I16=19,0,0,0,696,26416,0,0,923,49087,0,0,366,8758,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,169:8:0	0,15,103:5:0	0,18,142:6:0
+17	65	.	C	<X>	0	.	DP=18;I16=18,0,0,0,686,26512,0,0,894,48246,0,0,367,8743,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,21,163:7:0	0,15,116:5:0	0,18,147:6:0
+17	66	.	T	<X>	0	.	DP=18;I16=17,0,0,0,691,28315,0,0,834,44646,0,0,342,8068,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,21,164:7:0	0,12,110:4:0	0,18,153:6:0
+17	67	.	C	<X>	0	.	DP=17;I16=17,0,0,0,645,25313,0,0,834,44646,0,0,341,7983,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,21,163:7:0	0,12,94:4:0	0,18,147:6:0
+17	68	.	T	<X>	0	.	DP=17;I16=17,0,0,0,691,28307,0,0,834,44646,0,0,339,7863,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,21,165:7:0	0,12,108:4:0	0,18,151:6:0
+17	69	.	G	<X>	0	.	DP=17;I16=17,0,0,0,657,25721,0,0,865,47405,0,0,338,7758,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,172:8:0	0,9,93:3:0	0,18,142:6:0
+17	70	.	G	<X>	0	.	DP=17;I16=16,0,0,0,575,21391,0,0,836,46564,0,0,317,7227,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,162:8:0	0,6,64:2:0	0,18,141:6:0
+17	71	.	G	<X>	0	.	DP=17;I16=15,0,0,0,571,21975,0,0,776,42964,0,0,307,7029,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,170:8:0	0,6,72:2:0	0,15,130:5:0
+17	72	.	G	<X>	0	.	DP=17;I16=15,0,0,0,572,22002,0,0,776,42964,0,0,305,6907,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,171:8:0	0,6,65:2:0	0,15,131:5:0
+17	73	.	T	<X>	0	.	DP=18;I16=16,0,0,0,623,25301,0,0,836,46564,0,0,314,6918,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,158:8:0	0,6,94:2:0	0,18,143:6:0
+17	74	.	C	<X>	0	.	DP=18;I16=17,0,0,0,674,28110,0,0,865,47405,0,0,338,7468,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,176:8:0	0,9,106:3:0	0,18,141:6:0
+17	75	.	T	<X>	0	.	DP=18;I16=16,0,0,0,685,30675,0,0,836,46564,0,0,312,6782,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,175:8:0	0,6,90:2:0	0,18,150:6:0
+17	76	.	C	<X>	0	.	DP=18;I16=17,0,0,0,683,29481,0,0,865,47405,0,0,336,7360,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,174:8:0	0,9,98:3:0	0,18,148:6:0
+17	77	.	T	<X>	0	.	DP=18;I16=16,0,0,0,710,33072,0,0,836,46564,0,0,310,6702,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,179:8:0	0,6,92:2:0	0,18,154:6:0
+17	78	.	G	<X>	0	.	DP=18;I16=16,0,0,0,692,31158,0,0,836,46564,0,0,309,6683,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,180:8:0	0,6,94:2:0	0,18,149:6:0
+17	79	.	G	<X>	0	.	DP=18;I16=15,0,0,0,605,26629,0,0,776,42964,0,0,283,6053,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,168:8:0	0,3,60:1:0	0,18,149:6:0
+17	80	.	G	<X>	0	.	DP=18;I16=17,0,0,0,688,30128,0,0,865,47405,0,0,332,7312,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,173:8:0	0,9,106:3:0	0,18,151:6:0
+17	81	.	G	<X>	0	.	DP=18;I16=16,0,0,0,631,27429,0,0,836,46564,0,0,326,7310,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,21,165:7:0	0,9,97:3:0	0,18,145:6:0
+17	82	.	T	<X>	0	.	DP=18;I16=15,0,0,0,559,22735,0,0,776,42964,0,0,280,6122,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,154:8:0	0,3,60:1:0	0,18,131:6:0
+17	83	.	C	<X>	0	.	DP=18;I16=16,0,0,0,622,27146,0,0,836,46564,0,0,304,6798,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,170:8:0	0,6,75:2:0	0,18,145:6:0
+17	84	.	T	<X>	0	.	DP=18;I16=17,0,0,0,705,32445,0,0,865,47405,0,0,328,7488,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,181:8:0	0,9,85:3:0	0,18,154:6:0
+17	85	.	C	<X>	0	.	DP=18;I16=17,0,0,0,708,31222,0,0,865,47405,0,0,327,7567,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,181:8:0	0,9,108:3:0	0,18,153:6:0
+17	86	.	A	<X>	0	.	DP=18;I16=17,0,0,0,692,29540,0,0,865,47405,0,0,326,7660,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,169:8:0	0,9,111:3:0	0,18,149:6:0
+17	87	.	C	<X>	0	.	DP=18;I16=17,0,0,0,683,29493,0,0,896,50164,0,0,326,7766,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,174:8:0	0,9,103:3:0	0,18,148:6:0
+17	88	.	C	<X>	0	.	DP=18;I16=17,0,0,0,703,31005,0,0,896,50164,0,0,326,7834,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,174:8:0	0,9,113:3:0	0,18,153:6:0
+17	89	.	C	<X>	0	.	DP=18;I16=17,0,0,0,697,30875,0,0,896,50164,0,0,326,7914,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,176:8:0	0,9,103:3:0	0,18,154:6:0
+17	90	.	A	<X>	0	.	DP=17;I16=16,0,0,0,668,29732,0,0,867,49323,0,0,326,7954,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,173:8:0	0,9,114:3:0	0,15,138:5:0
+17	91	.	C	<X>	0	.	DP=16;I16=15,0,0,0,613,26409,0,0,838,48482,0,0,327,8001,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,21,170:7:0	0,9,113:3:0	0,15,133:5:0
+17	92	.	G	<X>	0	.	DP=16;I16=15,0,0,0,499,18731,0,0,838,48482,0,0,328,8054,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,21,143:7:0	0,9,100:3:0	0,15,96:5:0
+17	93	.	A	<X>	0	.	DP=16;I16=15,0,0,0,635,28655,0,0,869,51241,0,0,329,8063,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,21,167:7:0	0,9,108:3:0	0,15,145:5:0
+17	94	.	C	<X>	0	.	DP=16;I16=15,0,0,0,607,25893,0,0,869,51241,0,0,331,8079,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,21,166:7:0	0,9,105:3:0	0,15,135:5:0
+17	95	.	C	<X>	0	.	DP=17;I16=15,0,0,0,615,26761,0,0,900,54000,0,0,306,7378,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,178:8:0	0,6,91:2:0	0,15,135:5:0
+17	96	.	A	<X>	0	.	DP=17;I16=16,0,0,0,625,26705,0,0,929,54841,0,0,332,7936,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,172:8:0	0,9,99:3:0	0,15,134:5:0
+17	97	.	A	<X>	0	.	DP=18;I16=17,0,0,0,675,29017,0,0,958,55682,0,0,333,7879,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,27,179:9:0	0,9,104:3:0	0,15,145:5:0
+17	98	.	C	<X>	0	.	DP=18;I16=17,0,0,0,655,27231,0,0,958,55682,0,0,333,7735,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,27,179:9:0	0,9,105:3:0	0,15,131:5:0
+17	99	.	T	<X>	0	.	DP=18;I16=17,0,0,0,720,32840,0,0,958,55682,0,0,333,7607,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,27,186:9:0	0,9,115:3:0	0,15,153:5:0
+17	100	.	C	<X>	0	.	DP=18;I16=17,0,0,0,688,29762,0,0,958,55682,0,0,332,7446,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,27,189:9:0	0,9,108:3:0	0,15,134:5:0
+17	101	.	C	<X>	0	.	DP=18;I16=17,0,0,0,650,27530,0,0,958,55682,0,0,331,7303,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,27,182:9:0	0,9,99:3:0	0,15,132:5:0
+17	102	.	C	<X>	0	.	DP=18;I16=17,0,0,0,695,30453,0,0,958,55682,0,0,330,7178,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,27,188:9:0	0,9,111:3:0	0,15,139:5:0
+17	103	.	T	<X>	0	.	DP=18;I16=16,0,0,0,692,31998,0,0,929,54841,0,0,323,7035,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,189:8:0	0,9,108:3:0	0,15,147:5:0
+17	104	.	G	<X>	0	.	DP=18;I16=15,0,0,0,611,26723,0,0,900,54000,0,0,295,6259,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,24,178:8:0	0,6,89:2:0	0,15,133:5:0
+17	105	.	G	<X>	0	.	DP=19;I16=17,0,0,0,604,23936,0,0,989,58441,0,0,317,6751,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,27,170:9:0	0,9,97:3:0	0,15,125:5:0
+17	106	.	G	<X>	0	.	DP=19;I16=17,0,0,0,644,26574,0,0,989,58441,0,0,299,6093,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,30,190:10:0	0,6,85:2:0	0,15,124:5:0
+17	107	.	C	<X>	0	.	DP=19;I16=17,0,0,0,694,30064,0,0,989,58441,0,0,313,6543,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,27,192:9:0	0,9,108:3:0	0,15,136:5:0
+17	108	.	C	<X>	0	.	DP=19;I16=17,0,0,0,692,30148,0,0,989,58441,0,0,310,6420,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,27,190:9:0	0,9,108:3:0	0,15,135:5:0
+17	109	.	T	<X>	0	.	DP=19;I16=17,0,0,0,741,34273,0,0,989,58441,0,0,307,6319,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,27,195:9:0	0,9,110:3:0	0,15,150:5:0
+17	110	.	G	<X>	0	.	DP=19;I16=17,0,0,0,704,31276,0,0,989,58441,0,0,304,6240,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,27,194:9:0	0,9,104:3:0	0,15,136:5:0
+17	111	.	G	<X>	0	.	DP=19;I16=16,0,0,0,584,24362,0,0,929,54841,0,0,272,5416,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,30,167:10:0	0,6,88:2:0	0,12,118:4:0
+17	112	.	C	<X>	0	.	DP=19;I16=17,0,0,0,680,29854,0,0,989,58441,0,0,296,6052,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,27,191:9:0	0,9,95:3:0	0,15,135:5:0
+17	113	.	A	<X>	0	.	DP=19;I16=16,0,0,0,645,28035,0,0,960,57600,0,0,266,5318,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,27,176:9:0	0,6,87:2:0	0,15,139:5:0
+17	114	.	C	<X>	0	.	DP=19;I16=17,0,0,0,674,28788,0,0,989,58441,0,0,286,5856,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,27,182:9:0	0,9,103:3:0	0,15,133:5:0
+17	115	.	C	<X>	0	.	DP=21;I16=18,0,0,0,708,30546,0,0,1049,62041,0,0,274,5490,0,0;QS=3,0;MQ0F=0	PL:DP:DV	0,30,189:10:0	0,6,89:2:0	0,18,147:6:0
+17	116	.	A	<X>	0	.	DP=21;I16=17,1,0,0,727,31755,0,0,1049,62041,0,0,253,5079,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,183:9:0	0,6,90:2:0	0,21,175:7:0
+17	117	.	G	<X>	0	.	DP=21;I16=17,1,0,0,723,31221,0,0,1049,62041,0,0,249,5019,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,186:9:0	0,6,86:2:0	0,21,177:7:0
+17	118	.	G	<X>	0	.	DP=20;I16=16,1,0,0,636,26574,0,0,958,55682,0,0,266,5426,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,175:9:0	0,3,60:1:0	0,21,162:7:0
+17	119	.	G	<X>	0	.	DP=19;I16=16,1,0,0,629,26439,0,0,958,55682,0,0,267,5553,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,175:8:0	0,6,73:2:0	0,21,160:7:0
+17	120	.	A	<X>	0	.	DP=19;I16=16,1,0,0,672,29188,0,0,958,55682,0,0,264,5518,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,175:8:0	0,6,83:2:0	0,21,171:7:0
+17	121	.	G	<X>	0	.	DP=19;I16=16,1,0,0,662,28460,0,0,958,55682,0,0,260,5454,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,181:8:0	0,6,80:2:0	0,21,168:7:0
+17	122	.	C	<X>	0	.	DP=20;I16=17,1,0,0,716,31224,0,0,1018,59282,0,0,256,5410,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,181:8:0	0,9,99:3:0	0,21,178:7:0
+17	123	.	T	<X>	0	.	DP=18;I16=15,1,0,0,661,29997,0,0,898,52082,0,0,255,5385,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,167:7:0	0,9,112:3:0	0,18,166:6:0
+17	124	.	T	<X>	0	.	DP=19;I16=17,1,0,0,626,24802,0,0,987,56523,0,0,279,6003,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,154:9:0	0,9,104:3:0	0,18,154:6:0
+17	125	.	A	<X>	0	.	DP=18;I16=15,1,0,0,611,25689,0,0,898,52082,0,0,254,5340,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,154:7:0	0,9,104:3:0	0,18,162:6:0
+17	126	.	A	<X>	0	.	DP=18;I16=16,1,0,0,648,27366,0,0,927,52923,0,0,279,5947,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,162:8:0	0,9,107:3:0	0,18,174:6:0
+17	127	.	C	<X>	0	.	DP=18;I16=16,1,0,0,646,26972,0,0,927,52923,0,0,279,5949,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,163:8:0	0,9,109:3:0	0,18,160:6:0
+17	128	.	A	<X>	0	.	DP=18;I16=16,1,0,0,673,28797,0,0,927,52923,0,0,279,5971,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,169:8:0	0,9,111:3:0	0,18,162:6:0
+17	129	.	A	<X>	0	.	DP=17;I16=15,1,0,0,645,27891,0,0,867,49323,0,0,280,6012,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,168:8:0	0,9,113:3:0	0,15,159:5:0
+17	130	.	A	<X>	0	.	DP=17;I16=15,1,0,0,641,27295,0,0,867,49323,0,0,281,6071,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,169:8:0	0,9,113:3:0	0,15,152:5:0
+17	131	.	C	<X>	0	.	DP=16;I16=14,1,0,0,606,25732,0,0,838,48482,0,0,256,5472,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,167:7:0	0,9,110:3:0	0,15,147:5:0
+17	132	.	A	<X>	0	.	DP=16;I16=14,1,0,0,627,27579,0,0,838,48482,0,0,256,5514,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,169:7:0	0,9,110:3:0	0,15,151:5:0
+17	133	.	T	<X>	0	.	DP=15;I16=13,2,0,0,584,22816,0,0,838,48482,0,0,282,6196,0,0;QS=3,0;MQSB=0.576923;MQ0F=0	PL:DP:DV	0,21,163:7:0	0,9,105:3:0	0,15,150:5:0
+17	134	.	C	<X>	0	.	DP=15;I16=13,2,0,0,607,24653,0,0,838,48482,0,0,283,6267,0,0;QS=3,0;MQSB=0.576923;MQ0F=0	PL:DP:DV	0,21,177:7:0	0,9,105:3:0	0,15,152:5:0
+17	135	.	T	<X>	0	.	DP=15;I16=13,2,0,0,600,24178,0,0,838,48482,0,0,284,6352,0,0;QS=3,0;MQSB=0.576923;MQ0F=0	PL:DP:DV	0,21,173:7:0	0,9,106:3:0	0,15,156:5:0
+17	136	.	G	<X>	0	.	DP=15;I16=13,2,0,0,574,22258,0,0,838,48482,0,0,286,6450,0,0;QS=3,0;MQSB=0.576923;MQ0F=0	PL:DP:DV	0,21,172:7:0	0,9,105:3:0	0,15,134:5:0
+17	137	.	T	<X>	0	.	DP=15;I16=13,2,0,0,563,21377,0,0,838,48482,0,0,289,6561,0,0;QS=3,0;MQSB=0.576923;MQ0F=0	PL:DP:DV	0,21,160:7:0	0,9,104:3:0	0,15,139:5:0
+17	138	.	C	<X>	0	.	DP=15;I16=13,2,0,0,584,23088,0,0,838,48482,0,0,291,6637,0,0;QS=3,0;MQSB=0.576923;MQ0F=0	PL:DP:DV	0,21,172:7:0	0,9,108:3:0	0,15,142:5:0
+17	139	.	C	<X>	0	.	DP=15;I16=13,2,0,0,554,20790,0,0,838,48482,0,0,292,6680,0,0;QS=3,0;MQSB=0.576923;MQ0F=0	PL:DP:DV	0,21,161:7:0	0,9,106:3:0	0,15,143:5:0
+17	140	.	A	<X>	0	.	DP=15;I16=13,2,0,0,583,22789,0,0,838,48482,0,0,292,6690,0,0;QS=3,0;MQSB=0.576923;MQ0F=0	PL:DP:DV	0,21,163:7:0	0,9,107:3:0	0,15,153:5:0
+17	141	.	G	<X>	0	.	DP=14;I16=12,2,0,0,534,20750,0,0,778,44882,0,0,292,6664,0,0;QS=3,0;MQSB=0.583333;MQ0F=0	PL:DP:DV	0,18,158:6:0	0,9,108:3:0	0,15,142:5:0
+17	142	.	C	<X>	0	.	DP=14;I16=12,2,0,0,503,18593,0,0,778,44882,0,0,292,6650,0,0;QS=3,0;MQSB=0.583333;MQ0F=0	PL:DP:DV	0,18,157:6:0	0,9,97:3:0	0,15,129:5:0
+17	143	.	G	<X>	0	.	DP=14;I16=11,2,0,0,415,13657,0,0,718,41282,0,0,285,6599,0,0;QS=3,0;MQSB=0.590909;MQ0F=0	PL:DP:DV	0,18,128:6:0	0,9,95:3:0	0,12,97:4:0
+17	144	.	A	<X>	0	.	DP=14;I16=12,2,0,0,519,19725,0,0,778,44882,0,0,291,6609,0,0;QS=3,0;MQSB=0.583333;MQ0F=0	PL:DP:DV	0,18,152:6:0	0,9,105:3:0	0,15,129:5:0
+17	145	.	A	<X>	0	.	DP=14;I16=12,2,0,0,527,20289,0,0,778,44882,0,0,290,6584,0,0;QS=3,0;MQSB=0.583333;MQ0F=0	PL:DP:DV	0,18,153:6:0	0,9,106:3:0	0,15,138:5:0
+17	146	.	T	<X>	0	.	DP=14;I16=12,2,0,0,514,19484,0,0,778,44882,0,0,289,6573,0,0;QS=3,0;MQSB=0.583333;MQ0F=0	PL:DP:DV	0,18,152:6:0	0,9,103:3:0	0,15,128:5:0
+17	147	.	A	<X>	0	.	DP=14;I16=12,2,0,0,515,19213,0,0,778,44882,0,0,288,6576,0,0;QS=3,0;MQSB=0.583333;MQ0F=0	PL:DP:DV	0,18,150:6:0	0,9,99:3:0	0,15,140:5:0
+17	148	.	C	<X>	0	.	DP=14;I16=12,2,0,0,541,21019,0,0,778,44882,0,0,286,6542,0,0;QS=3,0;MQSB=0.583333;MQ0F=0	PL:DP:DV	0,18,157:6:0	0,9,106:3:0	0,15,146:5:0
+17	149	.	C	<X>	0	.	DP=14;I16=12,2,0,0,512,19326,0,0,778,44882,0,0,283,6471,0,0;QS=3,0;MQSB=0.583333;MQ0F=0	PL:DP:DV	0,18,148:6:0	0,9,109:3:0	0,15,140:5:0
+17	150	.	T	<X>	0	.	DP=13;I16=11,2,0,0,511,20251,0,0,749,44041,0,0,280,6362,0,0;QS=3,0;MQSB=0.5;MQ0F=0	PL:DP:DV	0,18,153:6:0	0,6,84:2:0	0,15,152:5:0
+17	151	.	G	<X>	0	.	DP=13;I16=11,2,0,0,506,19826,0,0,749,44041,0,0,277,6263,0,0;QS=3,0;MQSB=0.5;MQ0F=0	PL:DP:DV	0,18,157:6:0	0,6,84:2:0	0,15,144:5:0
+17	152	.	C	<X>	0	.	DP=14;I16=12,2,0,0,543,21283,0,0,809,47641,0,0,274,6174,0,0;QS=3,0;MQSB=0.5;MQ0F=0	PL:DP:DV	0,21,168:7:0	0,6,84:2:0	0,15,146:5:0
+17	153	.	A	<X>	0	.	DP=14;I16=12,2,0,0,536,20594,0,0,809,47641,0,0,272,6096,0,0;QS=3,0;MQSB=0.5;MQ0F=0	PL:DP:DV	0,21,156:7:0	0,6,81:2:0	0,15,153:5:0
+17	154	.	T	<X>	0	.	DP=14;I16=12,2,0,0,523,20051,0,0,809,47641,0,0,270,6030,0,0;QS=3,0;MQSB=0.5;MQ0F=0	PL:DP:DV	0,21,159:7:0	0,6,83:2:0	0,15,139:5:0
+17	155	.	C	<X>	0	.	DP=14;I16=12,2,0,0,542,21254,0,0,809,47641,0,0,268,5976,0,0;QS=3,0;MQSB=0.5;MQ0F=0	PL:DP:DV	0,21,172:7:0	0,6,85:2:0	0,15,139:5:0
+17	156	.	C	<X>	0	.	DP=14;I16=12,2,0,0,536,20884,0,0,809,47641,0,0,266,5934,0,0;QS=3,0;MQSB=0.5;MQ0F=0	PL:DP:DV	0,21,163:7:0	0,6,84:2:0	0,15,150:5:0
+17	157	.	C	<X>	0	.	DP=14;I16=12,2,0,0,555,22081,0,0,809,47641,0,0,264,5904,0,0;QS=3,0;MQSB=0.5;MQ0F=0	PL:DP:DV	0,21,169:7:0	0,6,85:2:0	0,15,149:5:0
+17	158	.	T	<X>	0	.	DP=14;I16=12,2,0,0,568,23154,0,0,809,47641,0,0,262,5886,0,0;QS=3,0;MQSB=0.5;MQ0F=0	PL:DP:DV	0,21,170:7:0	0,6,84:2:0	0,15,159:5:0
+17	159	.	A	<X>	0	.	DP=15;I16=12,2,0,0,519,19467,0,0,809,47641,0,0,260,5880,0,0;QS=3,0;MQSB=0.5;MQ0F=0	PL:DP:DV	0,21,157:7:0	0,6,83:2:0	0,15,135:5:0
+17	160	.	G	<X>	0	.	DP=15;I16=13,2,0,0,547,20633,0,0,869,51241,0,0,259,5887,0,0;QS=3,0;MQSB=0.5;MQ0F=0	PL:DP:DV	0,21,165:7:0	0,6,85:2:0	0,18,139:6:0
+17	161	.	A	<X>	0	.	DP=15;I16=13,2,0,0,568,21610,0,0,869,51241,0,0,258,5908,0,0;QS=3,0;MQSB=0.5;MQ0F=0	PL:DP:DV	0,21,157:7:0	0,6,83:2:0	0,18,162:6:0
+17	162	.	A	<X>	0	.	DP=15;I16=13,2,0,0,557,21139,0,0,869,51241,0,0,255,5843,0,0;QS=3,0;MQSB=0.5;MQ0F=0	PL:DP:DV	0,21,147:7:0	0,6,87:2:0	0,18,167:6:0
+17	163	.	G	<X>	0	.	DP=14;I16=12,2,0,0,503,18645,0,0,809,47641,0,0,253,5791,0,0;QS=3,0;MQSB=0.5;MQ0F=0	PL:DP:DV	0,21,153:7:0	0,6,79:2:0	0,15,138:5:0
+17	164	.	T	<X>	0	.	DP=14;I16=12,2,0,0,460,15968,0,0,809,47641,0,0,252,5750,0,0;QS=3,0;MQSB=0.5;MQ0F=0	PL:DP:DV	0,18,131:6:0	0,6,79:2:0	0,18,136:6:0
+17	165	.	G	<X>	0	.	DP=14;I16=10,2,0,0,456,17460,0,0,689,40441,0,0,226,5094,0,0;QS=3,0;MQSB=0.5;MQ0F=0	PL:DP:DV	0,18,149:6:0	0,6,80:2:0	0,12,122:4:0
+17	166	.	A	<X>	0	.	DP=14;I16=11,2,0,0,496,19138,0,0,749,44041,0,0,227,5077,0,0;QS=3,0;MQSB=0.5;MQ0F=0	PL:DP:DV	0,18,145:6:0	0,6,82:2:0	0,15,148:5:0
+17	167	.	A	<X>	0	.	DP=14;I16=11,2,0,0,477,17851,0,0,749,44041,0,0,227,5071,0,0;QS=3,0;MQSB=0.5;MQ0F=0	PL:DP:DV	0,18,132:6:0	0,6,86:2:0	0,15,147:5:0
+17	168	.	G	<X>	0	.	DP=14;I16=12,2,0,0,481,18015,0,0,809,47641,0,0,252,5702,0,0;QS=3,0;MQSB=0.5;MQ0F=0	PL:DP:DV	0,18,145:6:0	0,6,82:2:0	0,18,140:6:0
+17	169	.	C	<X>	0	.	DP=13;I16=10,2,0,0,402,14224,0,0,689,40441,0,0,227,5045,0,0;QS=3,0;MQSB=0.5;MQ0F=0	PL:DP:DV	0,15,106:5:0	0,6,76:2:0	0,15,145:5:0
+17	170	.	C	<X>	0	.	DP=13;I16=11,2,0,0,447,16383,0,0,749,44041,0,0,251,5601,0,0;QS=3,0;MQSB=0.5;MQ0F=0	PL:DP:DV	0,15,128:5:0	0,6,80:2:0	0,18,143:6:0
+17	171	.	A	<X>	0	.	DP=13;I16=11,2,0,0,500,19366,0,0,749,44041,0,0,250,5546,0,0;QS=3,0;MQSB=0.5;MQ0F=0	PL:DP:DV	0,15,134:5:0	0,6,81:2:0	0,18,166:6:0
+17	172	.	C	<X>	0	.	DP=13;I16=10,2,0,0,439,16395,0,0,689,40441,0,0,241,5441,0,0;QS=3,0;MQSB=0.5;MQ0F=0	PL:DP:DV	0,15,138:5:0	0,6,75:2:0	0,15,129:5:0
+17	173	.	C	<X>	0	.	DP=13;I16=11,2,0,0,435,15225,0,0,749,44041,0,0,248,5478,0,0;QS=3,0;MQSB=0.5;MQ0F=0	PL:DP:DV	0,15,121:5:0	0,6,76:2:0	0,18,146:6:0
+17	174	.	G	<X>	0	.	DP=13;I16=11,1,0,0,351,10685,0,0,689,40441,0,0,238,5364,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,15,111:5:0	0,3,27:1:0	0,18,117:6:0
+17	175	.	C	<X>	0	.	DP=14;I16=13,1,0,0,511,19161,0,0,809,47641,0,0,249,5463,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,18,143:6:0	0,3,41:1:0	0,21,175:7:0
+17	176	.	C	<X>	0	.	DP=14;I16=13,1,0,0,489,17733,0,0,809,47641,0,0,251,5477,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,18,146:6:0	0,3,44:1:0	0,21,152:7:0
+17	177	.	C	<X>	0	.	DP=14;I16=13,1,0,0,488,17328,0,0,809,47641,0,0,253,5507,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,18,138:6:0	0,3,44:1:0	0,21,158:7:0
+17	178	.	A	<X>	0	.	DP=14;I16=13,1,0,0,519,19485,0,0,809,47641,0,0,254,5502,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,18,147:6:0	0,3,42:1:0	0,21,172:7:0
+17	179	.	A	<X>	0	.	DP=14;I16=13,1,0,0,478,17278,0,0,809,47641,0,0,255,5511,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,18,134:6:0	0,3,44:1:0	0,21,170:7:0
+17	180	.	A	<X>	0	.	DP=14;I16=12,1,0,0,425,14653,0,0,749,44041,0,0,250,5498,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,18,126:6:0	0,3,43:1:0	0,18,148:6:0
+17	181	.	G	<X>	0	.	DP=14;I16=11,1,0,0,450,17152,0,0,689,40441,0,0,233,5233,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,18,156:6:0	0,3,41:1:0	0,15,138:5:0
+17	182	.	A	<X>	0	.	DP=15;I16=14,1,0,0,515,18235,0,0,869,51241,0,0,258,5622,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,150:7:0	0,3,43:1:0	0,21,159:7:0
+17	183	.	C	<X>	0	.	DP=15;I16=13,1,0,0,483,17419,0,0,809,47641,0,0,235,5063,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,159:7:0	0,3,40:1:0	0,18,139:6:0
+17	184	.	A	<X>	0	.	DP=15;I16=14,1,0,0,535,19667,0,0,869,51241,0,0,262,5770,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,158:7:0	0,3,41:1:0	0,21,163:7:0
+17	185	.	C	<X>	0	.	DP=15;I16=13,1,0,0,487,17295,0,0,809,47641,0,0,238,5192,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,150:7:0	0,3,38:1:0	0,18,160:6:0
+17	186	.	G	<X>	0	.	DP=15;I16=12,1,0,0,381,11429,0,0,749,44041,0,0,239,5253,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,18,117:6:0	0,3,32:1:0	0,18,124:6:0
+17	187	.	C	<X>	0	.	DP=14;I16=13,1,0,0,511,18979,0,0,809,47641,0,0,266,5952,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,18,147:6:0	0,3,38:1:0	0,21,172:7:0
+17	188	.	C	<X>	0	.	DP=14;I16=13,1,0,0,496,18042,0,0,809,47641,0,0,267,5989,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,18,147:6:0	0,3,37:1:0	0,21,162:7:0
+17	189	.	C	<X>	0	.	DP=15;I16=13,2,0,0,552,20504,0,0,838,48482,0,0,268,6040,0,0;QS=3,0;MQSB=0;MQ0F=0	PL:DP:DV	0,18,152:6:0	0,6,67:2:0	0,21,167:7:0
+17	190	.	A	<X>	0	.	DP=15;I16=12,2,0,0,500,18230,0,0,778,44882,0,0,243,5381,0,0;QS=3,0;MQSB=0;MQ0F=0	PL:DP:DV	0,18,138:6:0	0,6,68:2:0	0,18,159:6:0
+17	191	.	T	<X>	0	.	DP=15;I16=13,2,0,0,534,19276,0,0,838,48482,0,0,267,5939,0,0;QS=3,0;MQSB=0;MQ0F=0	PL:DP:DV	0,18,143:6:0	0,6,67:2:0	0,21,169:7:0
+17	192	.	G	<X>	0	.	DP=15;I16=13,2,0,0,499,17439,0,0,838,48482,0,0,266,5890,0,0;QS=3,0;MQSB=0;MQ0F=0	PL:DP:DV	0,18,143:6:0	0,6,67:2:0	0,21,151:7:0
+17	193	.	T	<X>	0	.	DP=15;I16=13,2,0,0,505,17811,0,0,838,48482,0,0,265,5859,0,0;QS=3,0;MQSB=0;MQ0F=0	PL:DP:DV	0,18,140:6:0	0,6,63:2:0	0,21,157:7:0
+17	194	.	C	<X>	0	.	DP=14;I16=12,2,0,0,467,16569,0,0,778,44882,0,0,265,5845,0,0;QS=3,0;MQSB=0;MQ0F=0	PL:DP:DV	0,18,142:6:0	0,6,67:2:0	0,18,145:6:0
+17	195	.	C	<X>	0	.	DP=14;I16=11,3,0,0,503,18647,0,0,747,42123,0,0,266,5846,0,0;QS=3,0;MQSB=0.0368832;MQ0F=0	PL:DP:DV	0,18,159:6:0	0,6,71:2:0	0,18,160:6:0
+17	196	.	A	<X>	0	.	DP=14;I16=11,3,0,0,482,17400,0,0,747,42123,0,0,268,5862,0,0;QS=3,0;MQSB=0.0368832;MQ0F=0	PL:DP:DV	0,18,166:6:0	0,6,69:2:0	0,18,138:6:0
+17	197	.	G	<X>	0	.	DP=14;I16=11,3,0,0,481,17391,0,0,747,42123,0,0,270,5894,0,0;QS=3,0;MQSB=0.0368832;MQ0F=0	PL:DP:DV	0,18,164:6:0	0,6,68:2:0	0,18,134:6:0
+17	198	.	C	<X>	0	.	DP=14;I16=11,3,0,0,539,20957,0,0,747,42123,0,0,271,5893,0,0;QS=3,0;MQSB=0.0368832;MQ0F=0	PL:DP:DV	0,18,172:6:0	0,6,70:2:0	0,18,164:6:0
+17	199	.	T	<X>	0	.	DP=14;I16=11,3,0,0,505,19197,0,0,747,42123,0,0,271,5861,0,0;QS=3,0;MQSB=0.0368832;MQ0F=0	PL:DP:DV	0,18,162:6:0	0,6,73:2:0	0,18,154:6:0
+17	200	.	T	<X>	0	.	DP=15;I16=11,4,0,0,544,19918,0,0,776,42964,0,0,270,5798,0,0;QS=3,0;MQSB=0.0161635;MQ0F=0	PL:DP:DV	0,18,161:6:0	0,9,89:3:0	0,18,154:6:0
+17	201	.	A	<X>	0	.	DP=16;I16=12,4,0,0,568,20416,0,0,836,46564,0,0,269,5703,0,0;QS=3,0;MQSB=0.0144756;MQ0F=0	PL:DP:DV	0,21,171:7:0	0,9,89:3:0	0,18,157:6:0
+17	202	.	A	<X>	0	.	DP=16;I16=12,4,0,0,566,20590,0,0,836,46564,0,0,269,5627,0,0;QS=3,0;MQSB=0.0144756;MQ0F=0	PL:DP:DV	0,21,178:7:0	0,9,84:3:0	0,18,163:6:0
+17	203	.	C	<X>	0	.	DP=16;I16=12,4,0,0,557,20119,0,0,836,46564,0,0,269,5571,0,0;QS=3,0;MQSB=0.0144756;MQ0F=0	PL:DP:DV	0,21,166:7:0	0,9,90:3:0	0,18,153:6:0
+17	204	.	C	<X>	0	.	DP=16;I16=12,4,0,0,591,22379,0,0,836,46564,0,0,269,5535,0,0;QS=3,0;MQSB=0.0144756;MQ0F=0	PL:DP:DV	0,21,173:7:0	0,9,91:3:0	0,18,163:6:0
+17	205	.	T	<X>	0	.	DP=16;I16=12,4,0,0,635,25281,0,0,836,46564,0,0,269,5519,0,0;QS=3,0;MQSB=0.0144756;MQ0F=0	PL:DP:DV	0,21,188:7:0	0,9,95:3:0	0,18,173:6:0
+17	206	.	G	<X>	0	.	DP=16;I16=12,4,0,0,577,21337,0,0,836,46564,0,0,269,5523,0,0;QS=3,0;MQSB=0.0144756;MQ0F=0	PL:DP:DV	0,21,180:7:0	0,9,89:3:0	0,18,143:6:0
+17	207	.	C	<X>	0	.	DP=16;I16=12,4,0,0,574,21076,0,0,836,46564,0,0,269,5547,0,0;QS=3,0;MQSB=0.0144756;MQ0F=0	PL:DP:DV	0,21,179:7:0	0,9,93:3:0	0,18,151:6:0
+17	208	.	A	<X>	0	.	DP=16;I16=12,4,0,0,576,21486,0,0,836,46564,0,0,268,5540,0,0;QS=3,0;MQSB=0.0144756;MQ0F=0	PL:DP:DV	0,21,184:7:0	0,9,93:3:0	0,18,154:6:0
+17	209	.	T	<X>	0	.	DP=16;I16=12,4,0,0,567,20475,0,0,836,46564,0,0,267,5551,0,0;QS=3,0;MQSB=0.0144756;MQ0F=0	PL:DP:DV	0,21,173:7:0	0,9,91:3:0	0,18,146:6:0
+17	210	.	C	<X>	0	.	DP=16;I16=12,4,0,0,577,21109,0,0,836,46564,0,0,266,5580,0,0;QS=3,0;MQSB=0.0144756;MQ0F=0	PL:DP:DV	0,21,185:7:0	0,9,92:3:0	0,18,151:6:0
+17	211	.	C	<X>	0	.	DP=16;I16=12,4,0,0,563,20227,0,0,836,46564,0,0,265,5627,0,0;QS=3,0;MQSB=0.0144756;MQ0F=0	PL:DP:DV	0,21,172:7:0	0,9,92:3:0	0,18,153:6:0
+17	212	.	C	<X>	0	.	DP=16;I16=12,4,0,0,589,22179,0,0,836,46564,0,0,263,5643,0,0;QS=3,0;MQSB=0.0144756;MQ0F=0	PL:DP:DV	0,21,181:7:0	0,9,92:3:0	0,18,152:6:0
+17	213	.	T	<X>	0	.	DP=16;I16=12,4,0,0,598,22838,0,0,836,46564,0,0,262,5678,0,0;QS=3,0;MQSB=0.0144756;MQ0F=0	PL:DP:DV	0,21,181:7:0	0,9,95:3:0	0,18,165:6:0
+17	214	.	A	<X>	0	.	DP=16;I16=11,4,0,0,529,19401,0,0,776,42964,0,0,240,5248,0,0;QS=3,0;MQSB=0.0161635;MQ0F=0	PL:DP:DV	0,21,176:7:0	0,9,92:3:0	0,15,118:5:0
+17	215	.	G	<X>	0	.	DP=15;I16=12,3,0,0,521,19073,0,0,807,45723,0,0,262,5754,0,0;QS=3,0;MQSB=0.0342181;MQ0F=0	PL:DP:DV	0,21,185:7:0	0,9,90:3:0	0,15,105:5:0
+17	216	.	A	<X>	0	.	DP=14;I16=10,3,0,0,464,16900,0,0,687,38523,0,0,238,5166,0,0;QS=3,0;MQSB=0.040184;MQ0F=0	PL:DP:DV	0,21,173:7:0	0,9,92:3:0	0,9,81:3:0
+17	217	.	A	<X>	0	.	DP=14;I16=11,3,0,0,515,19433,0,0,747,42123,0,0,264,5842,0,0;QS=3,0;MQSB=0.0368832;MQ0F=0	PL:DP:DV	0,21,181:7:0	0,9,90:3:0	0,12,97:4:0
+17	218	.	G	<X>	0	.	DP=14;I16=11,3,0,0,507,18957,0,0,747,42123,0,0,265,5907,0,0;QS=3,0;MQSB=0.0368832;MQ0F=0	PL:DP:DV	0,21,178:7:0	0,9,90:3:0	0,12,110:4:0
+17	219	.	T	<X>	0	.	DP=14;I16=11,3,0,0,470,16286,0,0,747,42123,0,0,266,5986,0,0;QS=3,0;MQSB=0.0368832;MQ0F=0	PL:DP:DV	0,21,173:7:0	0,9,88:3:0	0,12,89:4:0
+17	220	.	G	<X>	0	.	DP=14;I16=10,3,0,0,485,18307,0,0,687,38523,0,0,242,5454,0,0;QS=3,0;MQSB=0.040184;MQ0F=0	PL:DP:DV	0,21,188:7:0	0,9,88:3:0	0,9,80:3:0
+17	221	.	A	<X>	0	.	DP=14;I16=11,3,0,0,487,17615,0,0,747,42123,0,0,267,6135,0,0;QS=3,0;MQSB=0.0368832;MQ0F=0	PL:DP:DV	0,21,176:7:0	0,9,88:3:0	0,12,101:4:0
+17	222	.	A	<X>	0	.	DP=14;I16=10,3,0,0,465,17367,0,0,687,38523,0,0,242,5578,0,0;QS=3,0;MQSB=0.040184;MQ0F=0	PL:DP:DV	0,21,186:7:0	0,9,85:3:0	0,9,69:3:0
+17	223	.	G	<X>	0	.	DP=13;I16=9,3,0,0,405,14327,0,0,627,34923,0,0,243,5657,0,0;QS=3,0;MQSB=0.0443614;MQ0F=0	PL:DP:DV	0,18,168:6:0	0,6,53:2:0	0,12,81:4:0
+17	224	.	G	<X>	0	.	DP=12;I16=9,3,0,0,379,12759,0,0,627,34923,0,0,270,6370,0,0;QS=3,0;MQSB=0.0443614;MQ0F=0	PL:DP:DV	0,18,168:6:0	0,6,50:2:0	0,12,70:4:0
+17	225	.	C	<X>	0	.	DP=12;I16=8,3,0,0,382,13896,0,0,567,31323,0,0,261,6345,0,0;QS=3,0;MQSB=0.0497871;MQ0F=0	PL:DP:DV	0,18,165:6:0	0,6,48:2:0	0,9,83:3:0
+17	226	.	A	<X>	0	.	DP=13;I16=8,3,0,0,381,13669,0,0,567,31323,0,0,248,5894,0,0;QS=3,0;MQSB=0.0497871;MQ0F=0	PL:DP:DV	0,18,166:6:0	0,6,53:2:0	0,9,84:3:0
+17	227	.	C	<X>	0	.	DP=13;I16=8,4,0,0,406,14306,0,0,596,32164,0,0,267,6253,0,0;QS=3,0;MQSB=0.0249144;MQ0F=0	PL:DP:DV	0,21,190:7:0	0,6,53:2:0	0,9,73:3:0
+17	228	.	C	<X>	0	.	DP=13;I16=9,4,0,0,417,14381,0,0,656,35764,0,0,292,6884,0,0;QS=3,0;MQSB=0.0211283;MQ0F=0	PL:DP:DV	0,21,187:7:0	0,6,45:2:0	0,12,96:4:0
+17	229	.	G	<X>	0	.	DP=13;I16=9,3,0,0,358,11424,0,0,627,34923,0,0,270,6414,0,0;QS=3,0;MQSB=0.0443614;MQ0F=0	PL:DP:DV	0,18,136:6:0	0,6,53:2:0	0,12,70:4:0
+17	230	.	C	<X>	0	.	DP=13;I16=9,4,0,0,461,16861,0,0,656,35764,0,0,292,6920,0,0;QS=3,0;MQSB=0.0211283;MQ0F=0	PL:DP:DV	0,21,186:7:0	0,6,53:2:0	0,12,100:4:0
+17	231	.	C	<X>	0	.	DP=13;I16=7,4,0,0,414,15832,0,0,536,28564,0,0,247,5925,0,0;QS=3,0;MQSB=0.0401934;MQ0F=0	PL:DP:DV	0,18,184:6:0	0,6,53:2:0	0,9,82:3:0
+17	232	.	C	<X>	0	.	DP=14;I16=9,4,0,0,471,17371,0,0,656,35764,0,0,267,6363,0,0;QS=3,0;MQSB=0.0211283;MQ0F=0	PL:DP:DV	0,21,198:7:0	0,6,53:2:0	0,12,101:4:0
+17	233	.	A	<X>	0	.	DP=14;I16=10,4,0,0,496,18142,0,0,716,39364,0,0,292,6984,0,0;QS=3,0;MQSB=0.0183156;MQ0F=0	PL:DP:DV	0,21,192:7:0	0,6,53:2:0	0,15,119:5:0
+17	234	.	A	<X>	0	.	DP=14;I16=10,4,0,0,502,18390,0,0,716,39364,0,0,292,6988,0,0;QS=3,0;MQSB=0.0183156;MQ0F=0	PL:DP:DV	0,21,185:7:0	0,6,53:2:0	0,15,123:5:0
+17	235	.	A	<X>	0	.	DP=14;I16=9,4,0,0,476,17652,0,0,656,35764,0,0,267,6375,0,0;QS=3,0;MQSB=0.0211283;MQ0F=0	PL:DP:DV	0,21,186:7:0	0,6,53:2:0	0,12,111:4:0
+17	236	.	G	<X>	0	.	DP=15;I16=11,4,0,0,501,17481,0,0,776,42964,0,0,290,6924,0,0;QS=3,0;MQSB=0.0161635;MQ0F=0	PL:DP:DV	0,24,206:8:0	0,6,53:2:0	0,15,103:5:0
+17	237	.	A	<X>	0	.	DP=14;I16=9,4,0,0,465,16877,0,0,656,35764,0,0,266,6282,0,0;QS=3,0;MQSB=0.0211283;MQ0F=0	PL:DP:DV	0,24,206:8:0	0,6,53:2:0	0,9,92:3:0
+17	238	.	C	<X>	0	.	DP=14;I16=10,4,0,0,482,17238,0,0,716,39364,0,0,292,6900,0,0;QS=3,0;MQSB=0.0183156;MQ0F=0	PL:DP:DV	0,24,211:8:0	0,6,53:2:0	0,12,82:4:0
+17	239	.	A	<X>	0	.	DP=15;I16=10,5,0,0,525,19155,0,0,776,42964,0,0,292,6852,0,0;QS=3,0;MQSB=0.0497871;MQ0F=0	PL:DP:DV	0,27,223:9:0	0,6,50:2:0	0,12,108:4:0
+17	240	.	C	<X>	0	.	DP=15;I16=10,5,0,0,512,17930,0,0,776,42964,0,0,292,6764,0,0;QS=3,0;MQSB=0.0497871;MQ0F=0	PL:DP:DV	0,27,220:9:0	0,6,53:2:0	0,12,106:4:0
+17	241	.	G	<X>	0	.	DP=15;I16=9,5,0,0,444,14636,0,0,716,39364,0,0,269,6159,0,0;QS=3,0;MQSB=0.0561348;MQ0F=0	PL:DP:DV	0,27,203:9:0	0,6,53:2:0	0,9,59:3:0
+17	242	.	C	<X>	0	.	DP=15;I16=10,5,0,0,555,21177,0,0,776,42964,0,0,292,6624,0,0;QS=3,0;MQSB=0.0497871;MQ0F=0	PL:DP:DV	0,27,242:9:0	0,6,53:2:0	0,12,94:4:0
+17	243	.	C	<X>	0	.	DP=16;I16=9,5,0,0,523,19737,0,0,716,39364,0,0,284,6508,0,0;QS=3,0;MQSB=0.0561348;MQ0F=0	PL:DP:DV	0,24,220:8:0	0,6,53:2:0	0,12,104:4:0
+17	244	.	C	<X>	0	.	DP=16;I16=10,6,0,0,620,24272,0,0,805,43805,0,0,298,6568,0,0;QS=3,0;MQSB=0.0253122;MQ0F=0	PL:DP:DV	0,27,245:9:0	0,9,72:3:0	0,12,106:4:0
+17	245	.	A	<X>	0	.	DP=17;I16=10,7,0,0,649,24843,0,0,865,47405,0,0,299,6553,0,0;QS=3,0;MQSB=0.0509867;MQ0F=0	PL:DP:DV	0,27,236:9:0	0,12,93:4:0	0,12,115:4:0
+17	246	.	T	<X>	0	.	DP=18;I16=10,8,0,0,649,23833,0,0,894,48246,0,0,301,6553,0,0;QS=3,0;MQSB=0.0286491;MQ0F=0	PL:DP:DV	0,30,247:10:0	0,12,94:4:0	0,12,98:4:0
+17	247	.	G	<X>	0	.	DP=18;I16=10,8,0,0,642,23610,0,0,894,48246,0,0,304,6570,0,0;QS=3,0;MQSB=0.0286491;MQ0F=0	PL:DP:DV	0,30,252:10:0	0,12,83:4:0	0,12,103:4:0
+17	248	.	T	<X>	0	.	DP=18;I16=10,8,0,0,636,22944,0,0,894,48246,0,0,307,6605,0,0;QS=3,0;MQSB=0.0286491;MQ0F=0	PL:DP:DV	0,30,234:10:0	0,12,86:4:0	0,12,114:4:0
+17	249	.	C	<X>	0	.	DP=18;I16=10,8,0,0,656,24846,0,0,894,48246,0,0,310,6658,0,0;QS=3,0;MQSB=0.0286491;MQ0F=0	PL:DP:DV	0,30,253:10:0	0,12,79:4:0	0,12,112:4:0
+17	250	.	C	<X>	0	.	DP=19;I16=10,9,0,0,694,26160,0,0,923,49087,0,0,311,6631,0,0;QS=3,0;MQSB=0.0168512;MQ0F=0	PL:DP:DV	0,30,248:10:0	0,12,89:4:0	0,15,142:5:0
+17	251	.	A	<X>	0	.	DP=19;I16=9,9,0,0,688,26506,0,0,863,45487,0,0,313,6627,0,0;QS=3,0;MQSB=0.0208913;MQ0F=0	PL:DP:DV	0,27,233:9:0	0,12,97:4:0	0,15,148:5:0
+17	252	.	G	<X>	0	.	DP=18;I16=8,9,0,0,641,24631,0,0,803,41887,0,0,304,6502,0,0;QS=3,0;MQSB=0.026526;MQ0F=0	PL:DP:DV	0,27,243:9:0	0,12,91:4:0	0,12,121:4:0
+17	253	.	C	<X>	0	.	DP=19;I16=9,10,0,0,705,26921,0,0,892,46328,0,0,319,6687,0,0;QS=3,0;MQSB=0.0132999;MQ0F=0	PL:DP:DV	0,27,247:9:0	0,12,86:4:0	0,18,155:6:0
+17	254	.	T	<X>	0	.	DP=20;I16=10,9,0,0,719,27517,0,0,892,46328,0,0,314,6670,0,0;QS=3,0;MQSB=0.00482795;MQ0F=0	PL:DP:DV	0,30,254:10:0	0,9,72:3:0	0,18,164:6:0
+17	255	.	T	<X>	0	.	DP=21;I16=11,10,0,0,750,27076,0,0,1012,53528,0,0,328,6840,0,0;QS=3,0;MQSB=0.00822975;MQ0F=0	PL:DP:DV	0,33,241:11:0	0,12,95:4:0	0,18,161:6:0
+17	256	.	A	<X>	0	.	DP=22;I16=11,11,0,0,811,30063,0,0,1049,54897,0,0,334,6956,0,0;QS=3,0;MQSB=0.00507916;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,110:5:0	0,18,166:6:0
+17	257	.	T	<X>	0	.	DP=22;I16=11,11,0,0,814,30420,0,0,1049,54897,0,0,341,7101,0,0;QS=3,0;MQSB=0.00507916;MQ0F=0	PL:DP:DV	0,33,247:11:0	0,15,113:5:0	0,18,168:6:0
+17	258	.	T	<X>	0	.	DP=22;I16=11,11,0,0,791,28943,0,0,1049,54897,0,0,347,7225,0,0;QS=3,0;MQSB=0.00507916;MQ0F=0	PL:DP:DV	0,33,254:11:0	0,15,116:5:0	0,18,155:6:0
+17	259	.	C	<X>	0	.	DP=22;I16=11,10,0,0,785,29809,0,0,1020,54056,0,0,332,6936,0,0;QS=3,0;MQSB=0.00822975;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,90:4:0	0,18,170:6:0
+17	260	.	T	<X>	0	.	DP=21;I16=10,11,0,0,829,32899,0,0,989,51297,0,0,360,7556,0,0;QS=3,0;MQSB=0.00660016;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,118:5:0	0,15,156:5:0
+17	261	.	G	<X>	0	.	DP=21;I16=10,11,0,0,735,27379,0,0,989,51297,0,0,367,7761,0,0;QS=3,0;MQSB=0.00660016;MQ0F=0	PL:DP:DV	0,33,254:11:0	0,15,111:5:0	0,15,122:5:0
+17	262	.	C	<X>	0	.	DP=22;I16=10,12,0,0,806,30278,0,0,1049,54897,0,0,373,7941,0,0;QS=3,0;MQSB=0.0122507;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,99:5:0	0,18,164:6:0
+17	263	.	C	<X>	0	.	DP=22;I16=10,12,0,0,799,29717,0,0,1049,54897,0,0,380,8146,0,0;QS=3,0;MQSB=0.0122507;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,98:5:0	0,18,168:6:0
+17	264	.	C	<X>	0	.	DP=22;I16=10,12,0,0,821,31325,0,0,1049,54897,0,0,386,8326,0,0;QS=3,0;MQSB=0.0122507;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,104:5:0	0,18,172:6:0
+17	265	.	A	<X>	0	.	DP=21;I16=9,12,0,0,800,31906,0,0,989,51297,0,0,390,8380,0,0;QS=3,0;MQSB=0.0158903;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,114:5:0	0,15,129:5:0
+17	266	.	G	<X>	0	.	DP=21;I16=9,11,0,0,747,28155,0,0,960,50456,0,0,369,7833,0,0;QS=3,0;MQSB=0.0237479;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,97:4:0	0,15,138:5:0
+17	267	.	T	<X>	0	.	DP=21;I16=9,11,0,0,739,27465,0,0,960,50456,0,0,373,7935,0,0;QS=3,0;MQSB=0.0237479;MQ0F=0	PL:DP:DV	0,33,254:11:0	0,12,101:4:0	0,15,149:5:0
+17	268	.	T	<X>	0	.	DP=21;I16=9,12,0,0,748,27708,0,0,989,51297,0,0,402,8686,0,0;QS=3,0;MQSB=0.0158903;MQ0F=0	PL:DP:DV	0,33,238:11:0	0,15,110:5:0	0,15,156:5:0
+17	269	.	C	<X>	0	.	DP=22;I16=9,12,0,0,764,28632,0,0,989,51297,0,0,381,8211,0,0;QS=3,0;MQSB=0.0158903;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,91:4:0	0,15,154:5:0
+17	270	.	C	<X>	0	.	DP=22;I16=9,12,0,0,758,28146,0,0,989,51297,0,0,385,8337,0,0;QS=3,0;MQSB=0.0158903;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,96:4:0	0,15,143:5:0
+17	271	.	T	<X>	0	.	DP=22;I16=9,13,0,0,847,32935,0,0,1018,52138,0,0,413,9065,0,0;QS=3,0;MQSB=0.0109431;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,113:5:0	0,15,152:5:0
+17	272	.	C	<X>	0	.	DP=22;I16=9,12,0,0,809,31413,0,0,989,51297,0,0,390,8518,0,0;QS=3,0;MQSB=0.0158903;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,96:4:0	0,15,149:5:0
+17	273	.	T	<X>	0	.	DP=22;I16=9,12,0,0,798,30664,0,0,989,51297,0,0,392,8620,0,0;QS=3,0;MQSB=0.0158903;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,95:4:0	0,15,161:5:0
+17	274	.	C	<X>	0	.	DP=22;I16=9,12,0,0,763,28177,0,0,989,51297,0,0,394,8746,0,0;QS=3,0;MQSB=0.0158903;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,101:4:0	0,15,144:5:0
+17	275	.	C	<X>	0	.	DP=20;I16=7,13,0,0,768,29994,0,0,898,44938,0,0,423,9519,0,0;QS=3,0;MQSB=0.0213617;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,114:5:0	0,12,122:4:0
+17	276	.	A	<X>	0	.	DP=20;I16=7,13,0,0,805,32931,0,0,898,44938,0,0,424,9538,0,0;QS=3,0;MQSB=0.0213617;MQ0F=0	PL:DP:DV	0,33,253:11:0	0,15,122:5:0	0,12,124:4:0
+17	277	.	G	<X>	0	.	DP=20;I16=7,13,0,0,764,29732,0,0,898,44938,0,0,425,9579,0,0;QS=3,0;MQSB=0.0213617;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,114:5:0	0,12,121:4:0
+17	278	.	A	<X>	0	.	DP=21;I16=6,14,0,0,722,26452,0,0,867,42179,0,0,415,9521,0,0;QS=3,0;MQSB=0.0246228;MQ0F=0	PL:DP:DV	0,30,238:10:0	0,18,123:6:0	0,12,121:4:0
+17	279	.	A	<X>	0	.	DP=22;I16=7,15,0,0,786,28694,0,0,956,46620,0,0,427,9677,0,0;QS=3,0;MQSB=0.0124927;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,123:6:0	0,12,122:4:0
+17	280	.	A	<X>	0	.	DP=22;I16=7,15,0,0,815,31561,0,0,956,46620,0,0,428,9684,0,0;QS=3,0;MQSB=0.0124927;MQ0F=0	PL:DP:DV	0,36,253:12:0	0,18,130:6:0	0,12,129:4:0
+17	281	.	G	<X>	0	.	DP=22;I16=7,15,0,0,820,31416,0,0,956,46620,0,0,428,9662,0,0;QS=3,0;MQSB=0.0124927;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,122:6:0	0,12,123:4:0
+17	282	.	G	<X>	0	.	DP=22;I16=7,15,0,0,806,30420,0,0,956,46620,0,0,427,9609,0,0;QS=3,0;MQSB=0.0124927;MQ0F=0	PL:DP:DV	0,36,253:12:0	0,18,124:6:0	0,12,119:4:0
+17	283	.	C	<X>	0	.	DP=23;I16=7,15,0,0,827,31785,0,0,956,46620,0,0,426,9574,0,0;QS=3,0;MQSB=0.0124927;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,125:6:0	0,12,122:4:0
+17	284	.	T	<X>	0	.	DP=23;I16=7,16,0,0,901,35479,0,0,1016,50220,0,0,431,9593,0,0;QS=3,0;MQSB=0.0194969;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,126:6:0	0,15,144:5:0
+17	285	.	G	<X>	0	.	DP=23;I16=7,16,0,0,860,32856,0,0,1016,50220,0,0,431,9607,0,0;QS=3,0;MQSB=0.0194969;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,119:6:0	0,15,132:5:0
+17	286	.	C	<X>	0	.	DP=24;I16=8,16,0,0,875,32883,0,0,1076,53820,0,0,431,9641,0,0;QS=3,0;MQSB=0.0132999;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,21,150:7:0	0,15,134:5:0
+17	287	.	A	<X>	0	.	DP=25;I16=9,16,0,0,895,32957,0,0,1136,57420,0,0,432,9696,0,0;QS=3,0;MQSB=0.00934348;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,24,178:8:0	0,15,133:5:0
+17	288	.	T	<X>	0	.	DP=25;I16=9,16,0,0,931,35011,0,0,1136,57420,0,0,432,9674,0,0;QS=3,0;MQSB=0.00934348;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,24,184:8:0	0,15,146:5:0
+17	289	.	G	<X>	0	.	DP=25;I16=9,16,0,0,939,36117,0,0,1136,57420,0,0,432,9676,0,0;QS=3,0;MQSB=0.00934348;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,24,185:8:0	0,15,136:5:0
+17	290	.	G	<X>	0	.	DP=23;I16=8,15,0,0,805,29157,0,0,1047,52979,0,0,433,9651,0,0;QS=3,0;MQSB=0.0177152;MQ0F=0	PL:DP:DV	0,33,240:11:0	0,21,164:7:0	0,15,126:5:0
+17	291	.	T	<X>	0	.	DP=24;I16=8,15,0,0,840,31616,0,0,1047,52979,0,0,421,9479,0,0;QS=3,0;MQSB=0.0177152;MQ0F=0	PL:DP:DV	0,33,244:11:0	0,21,168:7:0	0,15,136:5:0
+17	292	.	T	<X>	0	.	DP=25;I16=9,16,0,0,888,32274,0,0,1167,60179,0,0,436,9668,0,0;QS=3,0;MQSB=0.0197089;MQ0F=0	PL:DP:DV	0,33,253:11:0	0,24,181:8:0	0,18,156:6:0
+17	293	.	G	<X>	0	.	DP=26;I16=10,15,0,0,934,35232,0,0,1167,60179,0,0,424,9488,0,0;QS=3,0;MQSB=0.0095249;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,24,196:8:0	0,15,145:5:0
+17	294	.	A	<X>	0	.	DP=26;I16=10,16,0,0,931,33937,0,0,1227,63779,0,0,443,9785,0,0;QS=3,0;MQSB=0.0149748;MQ0F=0	PL:DP:DV	0,36,252:12:0	0,24,201:8:0	0,18,161:6:0
+17	295	.	C	<X>	0	.	DP=25;I16=10,14,0,0,897,33973,0,0,1169,62097,0,0,430,9544,0,0;QS=3,0;MQSB=0.0310726;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,21,180:7:0	0,18,159:6:0
+17	296	.	A	<X>	0	.	DP=25;I16=10,15,0,0,874,31846,0,0,1198,62938,0,0,451,9905,0,0;QS=3,0;MQSB=0.0213617;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,24,169:8:0	0,18,169:6:0
+17	297	.	C	<X>	0	.	DP=25;I16=9,15,0,0,901,34305,0,0,1138,59338,0,0,445,9901,0,0;QS=3,0;MQSB=0.0273237;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,21,174:7:0	0,18,161:6:0
+17	298	.	A	<X>	0	.	DP=26;I16=11,15,0,0,936,34652,0,0,1258,66538,0,0,459,10121,0,0;QS=3,0;MQSB=0.017008;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,24,184:8:0	0,21,191:7:0
+17	299	.	C	<X>	0	.	DP=27;I16=11,15,0,0,971,36863,0,0,1258,66538,0,0,464,10266,0,0;QS=3,0;MQSB=0.017008;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,24,193:8:0	0,21,189:7:0
+17	300	.	A	<X>	0	.	DP=27;I16=11,15,0,0,1001,39455,0,0,1258,66538,0,0,469,10437,0,0;QS=3,0;MQSB=0.017008;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,24,204:8:0	0,21,210:7:0
+17	301	.	G	<X>	0	.	DP=25;I16=10,14,0,0,928,36116,0,0,1169,62097,0,0,476,10632,0,0;QS=3,0;MQSB=0.0310726;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,21,195:7:0	0,21,196:7:0
+17	302	.	T	<X>	0	.	DP=25;I16=10,14,0,0,879,32885,0,0,1169,62097,0,0,483,10849,0,0;QS=3,0;MQSB=0.0310726;MQ0F=0	PL:DP:DV	0,30,231:10:0	0,21,172:7:0	0,21,202:7:0
+17	302	.	T	TA	0	.	INDEL;IDV=7;IMF=1;DP=25;I16=2,4,8,11,214,7674,793,33369,236,10564,993,55133,109,2229,377,8629;QS=0.511212,2.48879;VDB=0.27613;SGB=-4.22417;MQSB=0.0443614;MQ0F=0	PL:DP:DV	167,0,96:11:6	157,0,9:7:6	201,21,0:7:7
+17	303	.	G	<X>	0	.	DP=25;I16=10,15,0,0,976,38516,0,0,1229,65697,0,0,497,11181,0,0;QS=3,0;MQSB=0.0443614;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,21,197:7:0	0,21,195:7:0
+17	304	.	C	<X>	0	.	DP=27;I16=11,16,0,0,991,37005,0,0,1318,70138,0,0,503,11359,0,0;QS=3,0;MQSB=0.129164;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,24,206:8:0	0,24,200:8:0
+17	305	.	C	<X>	0	.	DP=27;I16=11,16,0,0,1057,41761,0,0,1318,70138,0,0,510,11508,0,0;QS=3,0;MQSB=0.129164;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,24,213:8:0	0,24,211:8:0
+17	306	.	T	<X>	0	.	DP=27;I16=11,16,0,0,1033,40253,0,0,1318,70138,0,0,517,11679,0,0;QS=3,0;MQSB=0.129164;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,24,207:8:0	0,24,217:8:0
+17	307	.	G	<X>	0	.	DP=27;I16=11,15,0,0,984,37886,0,0,1289,69297,0,0,498,11198,0,0;QS=3,0;MQSB=0.174566;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,21,189:7:0	0,24,203:8:0
+17	308	.	C	<X>	0	.	DP=27;I16=11,16,0,0,892,30810,0,0,1318,70138,0,0,529,11991,0,0;QS=3,0;MQSB=0.129164;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,24,178:8:0	0,24,185:8:0
+17	309	.	G	<X>	0	.	DP=27;I16=11,16,0,0,951,34599,0,0,1318,70138,0,0,535,12183,0,0;QS=3,0;MQSB=0.129164;MQ0F=0	PL:DP:DV	0,33,243:11:0	0,24,183:8:0	0,24,205:8:0
+17	310	.	A	<X>	0	.	DP=27;I16=11,16,0,0,1001,38063,0,0,1318,70138,0,0,540,12350,0,0;QS=3,0;MQSB=0.129164;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,24,200:8:0	0,24,217:8:0
+17	311	.	C	<X>	0	.	DP=27;I16=11,16,0,0,1037,40263,0,0,1318,70138,0,0,544,12492,0,0;QS=3,0;MQSB=0.129164;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,24,215:8:0	0,24,210:8:0
+17	312	.	A	<X>	0	.	DP=26;I16=10,16,0,0,985,38043,0,0,1258,66538,0,0,549,12657,0,0;QS=3,0;MQSB=0.157183;MQ0F=0	PL:DP:DV	0,30,237:10:0	0,24,215:8:0	0,24,218:8:0
+17	313	.	A	<X>	0	.	DP=26;I16=10,16,0,0,983,37969,0,0,1258,66538,0,0,551,12695,0,0;QS=3,0;MQSB=0.157183;MQ0F=0	PL:DP:DV	0,30,235:10:0	0,24,219:8:0	0,24,215:8:0
+17	314	.	A	<X>	0	.	DP=27;I16=10,17,0,0,1050,41798,0,0,1318,70138,0,0,553,12757,0,0;QS=3,0;MQSB=0.195223;MQ0F=0	PL:DP:DV	0,33,250:11:0	0,24,217:8:0	0,24,227:8:0
+17	315	.	G	<X>	0	.	DP=26;I16=10,16,0,0,1025,40941,0,0,1289,69297,0,0,557,12843,0,0;QS=3,0;MQSB=0.252051;MQ0F=0	PL:DP:DV	0,30,252:10:0	0,24,216:8:0	0,24,225:8:0
+17	316	.	C	<X>	0	.	DP=27;I16=10,15,0,0,983,39393,0,0,1252,67928,0,0,535,12277,0,0;QS=3,0;MQSB=0.312403;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,21,183:7:0	0,24,224:8:0
+17	317	.	T	<X>	0	.	DP=27;I16=10,16,0,0,1028,41392,0,0,1320,72056,0,0,547,12557,0,0;QS=3,0;MQSB=0.377061;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,24,230:8:0	0,24,206:8:0
+17	318	.	G	<X>	0	.	DP=27;I16=10,17,0,0,1038,40546,0,0,1349,72897,0,0,570,13018,0,0;QS=3,0;MQSB=0.297797;MQ0F=0	PL:DP:DV	0,30,249:10:0	0,27,235:9:0	0,24,208:8:0
+17	319	.	A	<X>	0	.	DP=27;I16=9,17,0,0,994,38654,0,0,1289,69297,0,0,560,12906,0,0;QS=3,0;MQSB=0.346864;MQ0F=0	PL:DP:DV	0,30,249:10:0	0,27,228:9:0	0,21,185:7:0
+17	320	.	A	<X>	0	.	DP=27;I16=10,17,0,0,1022,39418,0,0,1349,72897,0,0,573,13053,0,0;QS=3,0;MQSB=0.297797;MQ0F=0	PL:DP:DV	0,30,247:10:0	0,27,230:9:0	0,24,211:8:0
+17	321	.	T	<X>	0	.	DP=27;I16=10,17,0,0,1026,39772,0,0,1349,72897,0,0,573,13029,0,0;QS=3,0;MQSB=0.297797;MQ0F=0	PL:DP:DV	0,30,253:10:0	0,27,214:9:0	0,24,218:8:0
+17	322	.	G	<X>	0	.	DP=28;I16=10,18,0,0,1091,43151,0,0,1409,76497,0,0,573,13029,0,0;QS=3,0;MQSB=0.343265;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,27,226:9:0	0,27,223:9:0
+17	323	.	C	<X>	0	.	DP=28;I16=9,18,0,0,1067,42619,0,0,1349,72897,0,0,565,12939,0,0;QS=3,0;MQSB=0.394987;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,27,225:9:0	0,24,198:8:0
+17	324	.	T	<X>	0	.	DP=30;I16=12,18,0,0,1145,44221,0,0,1529,83697,0,0,573,13001,0,0;QS=3,0;MQSB=0.264959;MQ0F=0	PL:DP:DV	0,30,253:10:0	0,27,237:9:0	0,33,255:11:0
+17	325	.	A	<X>	0	.	DP=31;I16=13,18,0,0,1132,42058,0,0,1589,87297,0,0,573,12925,0,0;QS=3,0;MQSB=0.235201;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,27,208:9:0	0,33,255:11:0
+17	326	.	T	<X>	0	.	DP=31;I16=13,18,0,0,1157,44193,0,0,1589,87297,0,0,574,12878,0,0;QS=3,0;MQSB=0.235201;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,27,216:9:0	0,33,255:11:0
+17	327	.	C	<X>	0	.	DP=31;I16=13,18,0,0,1147,43895,0,0,1589,87297,0,0,575,12861,0,0;QS=3,0;MQSB=0.235201;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,27,198:9:0	0,33,255:11:0
+17	328	.	A	<X>	0	.	DP=31;I16=13,18,0,0,1167,44531,0,0,1589,87297,0,0,574,12776,0,0;QS=3,0;MQSB=0.235201;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,27,226:9:0	0,33,255:11:0
+17	329	.	T	<X>	0	.	DP=31;I16=13,18,0,0,1210,47742,0,0,1589,87297,0,0,572,12676,0,0;QS=3,0;MQSB=0.235201;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,27,237:9:0	0,33,255:11:0
+17	330	.	T	<X>	0	.	DP=31;I16=13,18,0,0,1185,45839,0,0,1589,87297,0,0,568,12510,0,0;QS=3,0;MQSB=0.235201;MQ0F=0	PL:DP:DV	0,33,254:11:0	0,27,231:9:0	0,33,255:11:0
+17	331	.	T	<X>	0	.	DP=32;I16=14,18,0,0,1154,42510,0,0,1649,90897,0,0,563,12327,0,0;QS=3,0;MQSB=0.210122;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,27,222:9:0	0,36,255:12:0
+17	332	.	A	<X>	0	.	DP=32;I16=14,18,0,0,1156,42666,0,0,1649,90897,0,0,560,12178,0,0;QS=3,0;MQSB=0.210122;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,27,214:9:0	0,33,255:11:0
+17	333	.	A	<X>	0	.	DP=32;I16=14,18,0,0,1141,41987,0,0,1649,90897,0,0,558,12064,0,0;QS=3,0;MQSB=0.210122;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,27,223:9:0	0,33,255:11:0
+17	334	.	A	<X>	0	.	DP=32;I16=14,18,0,0,1162,43328,0,0,1649,90897,0,0,556,11986,0,0;QS=3,0;MQSB=0.210122;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,27,221:9:0	0,33,255:11:0
+17	335	.	A	<X>	0	.	DP=32;I16=12,18,0,0,1077,40287,0,0,1529,83697,0,0,552,11934,0,0;QS=3,0;MQSB=0.264959;MQ0F=0	PL:DP:DV	0,30,250:10:0	0,27,219:9:0	0,33,251:11:0
+17	336	.	A	<X>	0	.	DP=32;I16=14,17,0,0,1088,39758,0,0,1612,89528,0,0,536,11574,0,0;QS=3,0;MQSB=0.274662;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,24,211:8:0	0,36,255:12:0
+17	337	.	C	<X>	0	.	DP=32;I16=13,17,0,0,1115,42381,0,0,1552,85928,0,0,531,11565,0,0;QS=3,0;MQSB=0.301511;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,24,202:8:0	0,36,255:12:0
+17	338	.	T	<X>	0	.	DP=30;I16=14,16,0,0,1191,47979,0,0,1560,86456,0,0,554,11878,0,0;QS=3,0;MQSB=0.242376;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,24,226:8:0	0,36,255:12:0
+17	339	.	C	<X>	0	.	DP=31;I16=14,17,0,0,1130,43210,0,0,1589,87297,0,0,554,11874,0,0;QS=3,0;MQSB=0.175471;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,24,185:8:0	0,36,255:12:0
+17	340	.	C	<X>	0	.	DP=31;I16=14,17,0,0,1196,47044,0,0,1589,87297,0,0,554,11852,0,0;QS=3,0;MQSB=0.175471;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,24,221:8:0	0,36,255:12:0
+17	341	.	T	<X>	0	.	DP=31;I16=14,17,0,0,1227,48995,0,0,1589,87297,0,0,554,11862,0,0;QS=3,0;MQSB=0.175471;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,24,216:8:0	0,36,255:12:0
+17	342	.	T	<X>	0	.	DP=31;I16=14,17,0,0,1162,43942,0,0,1589,87297,0,0,554,11904,0,0;QS=3,0;MQSB=0.175471;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,24,210:8:0	0,36,255:12:0
+17	343	.	G	<X>	0	.	DP=32;I16=14,17,0,0,1150,43702,0,0,1620,90056,0,0,550,11962,0,0;QS=3,0;MQSB=0.283511;MQ0F=0	PL:DP:DV	0,30,249:10:0	0,27,218:9:0	0,36,255:12:0
+17	344	.	C	<X>	0	.	DP=32;I16=14,18,0,0,1181,45169,0,0,1649,90897,0,0,554,12036,0,0;QS=3,0;MQSB=0.210122;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,27,217:9:0	0,36,255:12:0
+17	345	.	T	<X>	0	.	DP=31;I16=14,17,0,0,1205,47259,0,0,1589,87297,0,0,555,12129,0,0;QS=3,0;MQSB=0.175471;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,24,221:8:0	0,36,255:12:0
+17	346	.	G	<X>	0	.	DP=31;I16=15,16,0,0,1147,43597,0,0,1620,90056,0,0,557,12255,0,0;QS=3,0;MQSB=0.220358;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,24,212:8:0	0,36,255:12:0
+17	347	.	G	<X>	0	.	DP=31;I16=14,16,0,0,1119,42227,0,0,1560,86456,0,0,545,12189,0,0;QS=3,0;MQSB=0.242376;MQ0F=0	PL:DP:DV	0,30,251:10:0	0,24,207:8:0	0,36,255:12:0
+17	348	.	T	<X>	0	.	DP=32;I16=15,16,0,0,1145,43007,0,0,1620,90056,0,0,546,12300,0,0;QS=3,0;MQSB=0.220358;MQ0F=0	PL:DP:DV	0,30,243:10:0	0,27,228:9:0	0,36,255:12:0
+17	349	.	T	<X>	0	.	DP=32;I16=16,16,0,0,1194,45350,0,0,1680,93656,0,0,565,12731,0,0;QS=3,0;MQSB=0.201402;MQ0F=0	PL:DP:DV	0,33,246:11:0	0,27,230:9:0	0,36,255:12:0
+17	350	.	T	<X>	0	.	DP=31;I16=16,15,0,0,1142,43072,0,0,1651,92815,0,0,567,12837,0,0;QS=3,0;MQSB=0.286505;MQ0F=0	PL:DP:DV	0,33,249:11:0	0,27,230:9:0	0,33,255:11:0
+17	351	.	G	<X>	0	.	DP=31;I16=16,15,0,0,1146,43750,0,0,1651,92815,0,0,568,12920,0,0;QS=3,0;MQSB=0.286505;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,27,212:9:0	0,33,255:11:0
+17	352	.	A	<X>	0	.	DP=31;I16=16,14,0,0,1150,45520,0,0,1591,89215,0,0,544,12404,0,0;QS=3,0;MQSB=0.242376;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,24,224:8:0	0,33,255:11:0
+17	353	.	G	<X>	0	.	DP=29;I16=15,14,0,0,1109,43095,0,0,1562,88374,0,0,570,13064,0,0;QS=3,0;MQSB=0.424373;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,27,231:9:0	0,30,255:10:0
+17	354	.	A	<X>	0	.	DP=28;I16=14,14,0,0,1078,42938,0,0,1502,84774,0,0,571,13075,0,0;QS=3,0;MQSB=0.450096;MQ0F=0	PL:DP:DV	0,27,225:9:0	0,27,244:9:0	0,30,255:10:0
+17	355	.	G	T,<X>	0	.	DP=28;I16=14,13,0,1,1001,37907,41,1681,1442,81174,60,3600,547,12487,25,625;QS=2.875,0.125,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.450096;BQB=1;MQ0F=0	PL:DP:DV	14,0,200,38,203,231:9:1	0,27,222,27,222,222:9:0	0,30,255,30,255,255:10:0
+17	356	.	G	<X>	0	.	DP=27;I16=14,13,0,0,993,37481,0,0,1465,83405,0,0,574,13174,0,0;QS=3,0;MQSB=0.580277;MQ0F=0	PL:DP:DV	0,27,228:9:0	0,24,201:8:0	0,30,255:10:0
+17	357	.	C	<X>	0	.	DP=28;I16=14,13,0,0,1021,39471,0,0,1465,83405,0,0,550,12584,0,0;QS=3,0;MQSB=0.580277;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,24,205:8:0	0,27,251:9:0
+17	358	.	A	<X>	0	.	DP=28;I16=15,13,0,0,1050,40518,0,0,1525,87005,0,0,576,13216,0,0;QS=3,0;MQSB=0.556581;MQ0F=0	PL:DP:DV	0,30,254:10:0	0,24,197:8:0	0,30,255:10:0
+17	359	.	G	<X>	0	.	DP=29;I16=15,13,0,0,1085,42761,0,0,1525,87005,0,0,552,12620,0,0;QS=3,0;MQSB=0.556581;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,21,187:7:0	0,33,255:11:0
+17	360	.	A	<X>	0	.	DP=29;I16=15,14,0,0,1111,43259,0,0,1585,90605,0,0,579,13297,0,0;QS=3,0;MQSB=0.604224;MQ0F=0	PL:DP:DV	0,30,252:10:0	0,24,220:8:0	0,33,255:11:0
+17	361	.	A	<X>	0	.	DP=29;I16=15,14,0,0,1116,43442,0,0,1585,90605,0,0,579,13273,0,0;QS=3,0;MQSB=0.604224;MQ0F=0	PL:DP:DV	0,30,252:10:0	0,24,219:8:0	0,33,255:11:0
+17	362	.	A	<X>	0	.	DP=29;I16=16,13,0,0,1104,42700,0,0,1585,90605,0,0,580,13272,0,0;QS=3,0;MQSB=0.535133;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,24,218:8:0	0,30,255:10:0
+17	363	.	A	<X>	0	.	DP=29;I16=16,13,0,0,1087,41437,0,0,1585,90605,0,0,581,13245,0,0;QS=3,0;MQSB=0.535133;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,24,213:8:0	0,30,255:10:0
+17	364	.	T	<X>	0	.	DP=29;I16=16,13,0,0,1032,37960,0,0,1585,90605,0,0,582,13244,0,0;QS=3,0;MQSB=0.535133;MQ0F=0	PL:DP:DV	0,33,250:11:0	0,24,205:8:0	0,30,255:10:0
+17	365	.	G	<X>	0	.	DP=29;I16=16,13,0,0,1105,43079,0,0,1585,90605,0,0,582,13218,0,0;QS=3,0;MQSB=0.535133;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,24,211:8:0	0,30,255:10:0
+17	366	.	A	<X>	0	.	DP=29;I16=16,13,0,0,1090,41562,0,0,1585,90605,0,0,581,13167,0,0;QS=3,0;MQSB=0.535133;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,24,211:8:0	0,30,255:10:0
+17	367	.	T	<X>	0	.	DP=29;I16=16,13,0,0,1055,39149,0,0,1585,90605,0,0,579,13093,0,0;QS=3,0;MQSB=0.535133;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,24,204:8:0	0,30,255:10:0
+17	368	.	A	<X>	0	.	DP=29;I16=16,13,0,0,1054,39632,0,0,1585,90605,0,0,576,12998,0,0;QS=3,0;MQSB=0.535133;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,24,208:8:0	0,30,255:10:0
+17	369	.	T	<X>	0	.	DP=28;I16=16,11,0,0,1037,40275,0,0,1496,86164,0,0,548,12256,0,0;QS=3,0;MQSB=0.659218;MQ0F=0	PL:DP:DV	0,30,250:10:0	0,21,196:7:0	0,30,255:10:0
+17	370	.	C	<X>	0	.	DP=28;I16=16,12,0,0,1045,40219,0,0,1556,89764,0,0,570,12790,0,0;QS=3,0;MQSB=0.705296;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,24,201:8:0	0,30,255:10:0
+17	371	.	T	<X>	0	.	DP=29;I16=16,13,0,0,1155,46591,0,0,1616,93364,0,0,567,12725,0,0;QS=3,0;MQSB=0.744925;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,24,227:8:0	0,33,255:11:0
+17	372	.	C	<X>	0	.	DP=30;I16=16,14,0,0,1139,44019,0,0,1676,96964,0,0,564,12636,0,0;QS=3,0;MQSB=0.779025;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,24,215:8:0	0,33,255:11:0
+17	373	.	A	<X>	0	.	DP=30;I16=16,14,0,0,1142,44118,0,0,1676,96964,0,0,561,12525,0,0;QS=3,0;MQSB=0.779025;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,24,220:8:0	0,33,255:11:0
+17	374	.	T	<X>	0	.	DP=30;I16=16,14,0,0,1098,41180,0,0,1676,96964,0,0,556,12344,0,0;QS=3,0;MQSB=0.779025;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,24,221:8:0	0,33,255:11:0
+17	375	.	A	T,<X>	0	.	DP=31;I16=17,13,0,1,1138,43798,14,196,1676,96964,60,3600,547,12177,4,16;QS=2.9661,0.0338983,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.763662;BQB=1;MQ0F=0	PL:DP:DV	0,36,255,36,255,255:12:0	0,24,218,24,218,218:8:0	0,18,255,30,255,255:11:1
+17	376	.	G	<X>	0	.	DP=31;I16=17,14,0,0,1131,42581,0,0,1736,100564,0,0,547,12073,0,0;QS=3,0;MQSB=0.763662;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,24,220:8:0	0,33,255:11:0
+17	377	.	T	<X>	0	.	DP=31;I16=16,14,0,0,1105,41629,0,0,1676,96964,0,0,518,11360,0,0;QS=3,0;MQSB=0.779025;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,24,211:8:0	0,33,255:11:0
+17	378	.	T	<X>	0	.	DP=30;I16=18,12,0,0,1098,41066,0,0,1707,99723,0,0,541,11927,0,0;QS=3,0;MQSB=0.878946;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,21,186:7:0	0,30,255:10:0
+17	379	.	G	<X>	0	.	DP=29;I16=18,10,0,0,1053,40181,0,0,1618,95282,0,0,534,11848,0,0;QS=3,0;MQSB=0.981777;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,21,187:7:0	0,30,255:10:0
+17	380	.	C	<X>	0	.	DP=29;I16=18,10,0,0,1087,42743,0,0,1618,95282,0,0,514,11172,0,0;QS=3,0;MQSB=0.981777;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,177:6:0	0,30,255:10:0
+17	381	.	T	<X>	0	.	DP=29;I16=18,11,0,0,1168,47412,0,0,1678,98882,0,0,537,11729,0,0;QS=3,0;MQSB=0.987702;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,21,212:7:0	0,30,255:10:0
+17	382	.	T	<X>	0	.	DP=29;I16=17,11,0,0,1054,40450,0,0,1618,95282,0,0,510,11068,0,0;QS=3,0;MQSB=0.990092;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,21,182:7:0	0,30,255:10:0
+17	383	.	T	<X>	0	.	DP=29;I16=18,10,0,0,1052,39798,0,0,1618,95282,0,0,507,11013,0,0;QS=3,0;MQSB=0.981777;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,165:6:0	0,30,255:10:0
+17	384	.	A	<X>	0	.	DP=31;I16=19,11,0,0,1077,39885,0,0,1738,102482,0,0,504,10988,0,0;QS=3,0;MQSB=0.985292;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,21,176:7:0	0,30,255:10:0
+17	385	.	C	<X>	0	.	DP=31;I16=19,12,0,0,1118,41180,0,0,1798,106082,0,0,527,11569,0,0;QS=3,0;MQSB=0.989977;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,24,186:8:0	0,30,255:10:0
+17	386	.	T	<X>	0	.	DP=30;I16=18,12,0,0,1158,45592,0,0,1738,102482,0,0,526,11556,0,0;QS=3,0;MQSB=0.991968;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,21,191:7:0	0,30,255:10:0
+17	387	.	T	<X>	0	.	DP=30;I16=18,12,0,0,1105,41821,0,0,1738,102482,0,0,525,11573,0,0;QS=3,0;MQSB=0.991968;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,21,187:7:0	0,30,255:10:0
+17	388	.	T	<X>	0	.	DP=29;I16=17,12,0,0,1089,41577,0,0,1678,98882,0,0,523,11519,0,0;QS=3,0;MQSB=0.993891;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,18,180:6:0	0,30,255:10:0
+17	389	.	G	<X>	0	.	DP=29;I16=17,12,0,0,1067,40095,0,0,1678,98882,0,0,520,11444,0,0;QS=3,0;MQSB=0.993891;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,18,171:6:0	0,30,255:10:0
+17	390	.	C	<X>	0	.	DP=29;I16=17,12,0,0,1071,40423,0,0,1678,98882,0,0,517,11399,0,0;QS=3,0;MQSB=0.993891;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,18,162:6:0	0,30,255:10:0
+17	391	.	A	<X>	0	.	DP=29;I16=18,11,0,0,1091,41603,0,0,1647,96123,0,0,515,11383,0,0;QS=3,0;MQSB=0.995968;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,18,163:6:0	0,30,255:10:0
+17	392	.	T	<X>	0	.	DP=29;I16=18,11,0,0,1046,38838,0,0,1647,96123,0,0,515,11395,0,0;QS=3,0;MQSB=0.995968;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,153:5:0	0,33,255:11:0
+17	393	.	A	<X>	0	.	DP=28;I16=17,11,0,0,1014,37582,0,0,1587,92523,0,0,517,11435,0,0;QS=3,0;MQSB=0.993109;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,133:5:0	0,33,255:11:0
+17	394	.	T	<X>	0	.	DP=28;I16=17,11,0,0,1022,38342,0,0,1587,92523,0,0,519,11503,0,0;QS=3,0;MQSB=0.993109;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,141:5:0	0,33,255:11:0
+17	395	.	T	<X>	0	.	DP=28;I16=17,11,0,0,1060,40596,0,0,1587,92523,0,0,521,11599,0,0;QS=3,0;MQSB=0.993109;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,164:5:0	0,33,255:11:0
+17	396	.	T	<X>	0	.	DP=28;I16=17,11,0,0,1032,39228,0,0,1587,92523,0,0,523,11723,0,0;QS=3,0;MQSB=0.993109;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,158:5:0	0,33,255:11:0
+17	397	.	T	<X>	0	.	DP=28;I16=17,11,0,0,1046,39510,0,0,1587,92523,0,0,524,11824,0,0;QS=3,0;MQSB=0.993109;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,149:5:0	0,33,255:11:0
+17	398	.	A	<X>	0	.	DP=28;I16=17,11,0,0,1021,38105,0,0,1587,92523,0,0,524,11850,0,0;QS=3,0;MQSB=0.993109;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,144:5:0	0,30,255:10:0
+17	399	.	A	<X>	0	.	DP=28;I16=17,11,0,0,1015,38469,0,0,1587,92523,0,0,526,11900,0,0;QS=3,0;MQSB=0.993109;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,140:5:0	0,30,255:10:0
+17	400	.	A	<X>	0	.	DP=29;I16=17,12,0,0,1056,39702,0,0,1647,96123,0,0,526,11828,0,0;QS=3,0;MQSB=0.988062;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,159:5:0	0,33,255:11:0
+17	401	.	A	<X>	0	.	DP=29;I16=17,11,0,0,1052,40302,0,0,1587,92523,0,0,501,11113,0,0;QS=3,0;MQSB=0.993109;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,160:5:0	0,30,255:10:0
+17	402	.	T	<X>	0	.	DP=29;I16=17,12,0,0,1082,41232,0,0,1647,96123,0,0,526,11680,0,0;QS=3,0;MQSB=0.988062;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,149:5:0	0,33,255:11:0
+17	403	.	T	<X>	0	.	DP=29;I16=17,12,0,0,1085,40985,0,0,1647,96123,0,0,526,11654,0,0;QS=3,0;MQSB=0.988062;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,148:5:0	0,33,255:11:0
+17	404	.	G	<X>	0	.	DP=29;I16=17,12,0,0,1074,40524,0,0,1647,96123,0,0,525,11609,0,0;QS=3,0;MQSB=0.988062;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,131:5:0	0,33,255:11:0
+17	405	.	T	<X>	0	.	DP=27;I16=16,10,0,0,988,37870,0,0,1498,88082,0,0,519,11543,0,0;QS=3,0;MQSB=0.987578;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,9,103:3:0	0,30,255:10:0
+17	406	.	G	<X>	0	.	DP=27;I16=16,11,0,0,976,36752,0,0,1558,91682,0,0,527,11601,0,0;QS=3,0;MQSB=0.992419;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,125:4:0	0,30,247:10:0
+17	407	.	A	<X>	0	.	DP=27;I16=16,11,0,0,1007,38355,0,0,1558,91682,0,0,526,11538,0,0;QS=3,0;MQSB=0.992419;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,125:4:0	0,30,255:10:0
+17	408	.	C	<X>	0	.	DP=28;I16=16,11,0,0,1006,38136,0,0,1558,91682,0,0,521,11489,0,0;QS=3,0;MQSB=0.992419;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,9,110:3:0	0,30,244:10:0
+17	409	.	T	<X>	0	.	DP=29;I16=17,12,0,0,1100,42734,0,0,1678,98882,0,0,525,11503,0,0;QS=3,0;MQSB=0.993891;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,131:4:0	0,33,255:11:0
+17	410	.	T	<X>	0	.	DP=29;I16=17,12,0,0,1035,38325,0,0,1678,98882,0,0,524,11432,0,0;QS=3,0;MQSB=0.993891;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,125:4:0	0,33,255:11:0
+17	411	.	T	<X>	0	.	DP=29;I16=17,10,0,0,1003,37747,0,0,1558,91682,0,0,496,10716,0,0;QS=3,0;MQSB=0.984677;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,9,104:3:0	0,30,255:10:0
+17	412	.	C	T,<X>	0	.	DP=30;I16=17,12,1,0,1094,42458,14,196,1678,98882,60,3600,495,10659,25,625;QS=2.97455,0.0254545,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.991968;BQB=1;MQ0F=0	PL:DP:DV	0,30,255,42,255,255:15:1	0,12,124,12,124,124:4:0	0,33,255,33,255,255:11:0
+17	413	.	A	<X>	0	.	DP=31;I16=18,13,0,0,1189,45985,0,0,1798,106082,0,0,520,11258,0,0;QS=3,0;MQSB=0.995005;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,9,102:3:0	0,33,255:11:0
+17	414	.	T	<X>	0	.	DP=30;I16=18,12,0,0,1151,44355,0,0,1738,102482,0,0,523,11265,0,0;QS=3,0;MQSB=0.991968;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,109:3:0	0,33,255:11:0
+17	415	.	G	<X>	0	.	DP=30;I16=18,12,0,0,1131,43175,0,0,1738,102482,0,0,526,11306,0,0;QS=3,0;MQSB=0.991968;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,110:3:0	0,33,255:11:0
+17	416	.	G	<X>	0	.	DP=30;I16=17,12,0,0,1083,41273,0,0,1678,98882,0,0,514,11156,0,0;QS=3,0;MQSB=0.993891;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,114:3:0	0,30,253:10:0
+17	417	.	C	<X>	0	.	DP=30;I16=18,12,0,0,1114,42244,0,0,1738,102482,0,0,531,11439,0,0;QS=3,0;MQSB=0.991968;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,108:3:0	0,33,255:11:0
+17	418	.	A	<X>	0	.	DP=30;I16=18,12,0,0,1146,44248,0,0,1738,102482,0,0,532,11478,0,0;QS=3,0;MQSB=0.991968;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,111:3:0	0,33,255:11:0
+17	419	.	T	<X>	0	.	DP=30;I16=18,12,0,0,1117,42327,0,0,1738,102482,0,0,532,11498,0,0;QS=3,0;MQSB=0.991968;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,112:3:0	0,33,255:11:0
+17	420	.	A	<X>	0	.	DP=31;I16=18,13,0,0,1117,41011,0,0,1798,106082,0,0,532,11550,0,0;QS=3,0;MQSB=0.995005;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,108:3:0	0,36,255:12:0
+17	421	.	A	<X>	0	.	DP=33;I16=19,14,0,0,1208,45398,0,0,1887,110523,0,0,533,11635,0,0;QS=3,0;MQSB=0.986656;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,113:3:0	0,42,255:14:0
+17	422	.	A	<X>	0	.	DP=33;I16=19,13,0,0,1205,46441,0,0,1827,106923,0,0,510,11082,0,0;QS=3,0;MQSB=0.991023;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,116:3:0	0,39,255:13:0
+17	423	.	T	<X>	0	.	DP=32;I16=19,13,0,0,1202,45416,0,0,1827,106923,0,0,538,11818,0,0;QS=3,0;MQSB=0.991023;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,110:3:0	0,39,255:13:0
+17	424	.	A	<X>	0	.	DP=32;I16=19,13,0,0,1147,41685,0,0,1827,106923,0,0,539,11867,0,0;QS=3,0;MQSB=0.991023;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,106:3:0	0,39,255:13:0
+17	425	.	A	<X>	0	.	DP=29;I16=16,13,0,0,1070,40616,0,0,1647,96123,0,0,542,11900,0,0;QS=3,0;MQSB=0.976248;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,9,111:3:0	0,33,249:11:0
+17	426	.	T	<X>	0	.	DP=29;I16=16,12,0,0,997,36561,0,0,1587,92523,0,0,519,11287,0,0;QS=3,0;MQSB=0.982906;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,9,105:3:0	0,30,225:10:0
+17	427	.	A	<X>	0	.	DP=29;I16=16,13,0,0,1024,37266,0,0,1647,96123,0,0,546,11952,0,0;QS=3,0;MQSB=0.976248;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,9,111:3:0	0,33,242:11:0
+17	428	.	C	<X>	0	.	DP=29;I16=16,13,0,0,1064,39706,0,0,1647,96123,0,0,548,12020,0,0;QS=3,0;MQSB=0.976248;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,9,111:3:0	0,33,254:11:0
+17	429	.	T	<X>	0	.	DP=30;I16=16,14,0,0,1150,44918,0,0,1707,99723,0,0,549,12067,0,0;QS=3,0;MQSB=0.969373;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,115:3:0	0,33,255:11:0
+17	430	.	G	<X>	0	.	DP=30;I16=16,14,0,0,1113,42443,0,0,1707,99723,0,0,551,12145,0,0;QS=3,0;MQSB=0.969373;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,112:3:0	0,33,246:11:0
+17	431	.	G	<X>	0	.	DP=30;I16=14,14,0,0,1003,36953,0,0,1587,92523,0,0,553,12255,0,0;QS=3,0;MQSB=0.949591;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,9,101:3:0	0,30,225:10:0
+17	432	.	T	<X>	0	.	DP=28;I16=14,14,0,0,1049,39621,0,0,1587,92523,0,0,556,12346,0,0;QS=3,0;MQSB=0.949591;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,9,114:3:0	0,30,255:10:0
+17	433	.	T	<X>	0	.	DP=28;I16=14,12,0,0,949,35443,0,0,1467,85323,0,0,509,11217,0,0;QS=3,0;MQSB=0.967472;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,9,112:3:0	0,27,227:9:0
+17	434	.	T	<X>	0	.	DP=29;I16=15,14,0,0,1036,37654,0,0,1647,96123,0,0,561,12567,0,0;QS=3,0;MQSB=0.960561;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,98:3:0	0,30,243:10:0
+17	435	.	A	<X>	0	.	DP=29;I16=15,13,0,0,1024,37970,0,0,1587,92523,0,0,556,12560,0,0;QS=3,0;MQSB=0.968414;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,9,103:3:0	0,30,237:10:0
+17	436	.	T	<X>	0	.	DP=28;I16=14,14,0,0,998,36220,0,0,1587,92523,0,0,564,12654,0,0;QS=3,0;MQSB=0.949591;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,110:3:0	0,27,223:9:0
+17	437	.	T	<X>	0	.	DP=28;I16=13,14,0,0,990,36832,0,0,1558,91682,0,0,549,12435,0,0;QS=3,0;MQSB=0.999706;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,109:3:0	0,24,207:8:0
+17	438	.	A	<X>	0	.	DP=28;I16=14,13,0,0,972,35640,0,0,1527,88923,0,0,540,12082,0,0;QS=3,0;MQSB=0.9585;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,107:3:0	0,24,216:8:0
+17	439	.	C	<X>	0	.	DP=28;I16=14,14,0,0,1055,40273,0,0,1587,92523,0,0,563,12649,0,0;QS=3,0;MQSB=0.949591;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,107:3:0	0,27,224:9:0
+17	440	.	A	<X>	0	.	DP=28;I16=14,14,0,0,1095,43251,0,0,1587,92523,0,0,561,12615,0,0;QS=3,0;MQSB=0.949591;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,115:3:0	0,27,247:9:0
+17	441	.	G	<X>	0	.	DP=29;I16=15,14,0,0,1068,40344,0,0,1647,96123,0,0,559,12605,0,0;QS=3,0;MQSB=0.960561;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,9,104:3:0	0,27,198:9:0
+17	442	.	A	<X>	0	.	DP=29;I16=15,14,0,0,1091,41507,0,0,1647,96123,0,0,558,12620,0,0;QS=3,0;MQSB=0.960561;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,9,112:3:0	0,27,233:9:0
+17	443	.	A	<X>	0	.	DP=30;I16=15,14,0,0,1173,49439,0,0,1647,96123,0,0,557,12661,0,0;QS=3,0;MQSB=0.960561;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,9,129:3:0	0,27,246:9:0
+17	444	.	G	<X>	0	.	DP=29;I16=15,13,0,0,1095,44661,0,0,1587,92523,0,0,557,12727,0,0;QS=3,0;MQSB=0.968414;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,6,91:2:0	0,27,227:9:0
+17	445	.	C	<X>	0	.	DP=30;I16=16,13,0,0,1100,43706,0,0,1647,96123,0,0,557,12817,0,0;QS=3,0;MQSB=0.976248;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,9,111:3:0	0,27,219:9:0
+17	446	.	A	<X>	0	.	DP=30;I16=16,13,0,0,1107,44265,0,0,1647,96123,0,0,557,12881,0,0;QS=3,0;MQSB=0.976248;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,9,115:3:0	0,27,232:9:0
+17	447	.	C	<X>	0	.	DP=29;I16=16,12,0,0,1108,45364,0,0,1618,95282,0,0,555,12817,0,0;QS=3,0;MQSB=0.856268;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,114:3:0	0,27,235:9:0
+17	448	.	T	<X>	0	.	DP=29;I16=16,12,0,0,1125,47237,0,0,1618,95282,0,0,553,12773,0,0;QS=3,0;MQSB=0.856268;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,118:3:0	0,27,240:9:0
+17	449	.	A	<X>	0	.	DP=28;I16=15,12,0,0,1091,45981,0,0,1558,91682,0,0,552,12748,0,0;QS=3,0;MQSB=0.84246;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,90:2:0	0,27,245:9:0
+17	450	.	G	<X>	0	.	DP=28;I16=15,12,0,0,1069,44603,0,0,1558,91682,0,0,551,12741,0,0;QS=3,0;MQSB=0.84246;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,91:2:0	0,27,233:9:0
+17	451	.	A	<X>	0	.	DP=28;I16=15,12,0,0,1021,41371,0,0,1558,91682,0,0,550,12752,0,0;QS=3,0;MQSB=0.84246;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,93:2:0	0,27,244:9:0
+17	452	.	A	<X>	0	.	DP=31;I16=18,11,0,0,1079,43353,0,0,1678,98882,0,0,530,12420,0,0;QS=3,0;MQSB=0.884952;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,9,110:3:0	0,24,225:8:0
+17	453	.	A	<X>	0	.	DP=31;I16=17,11,0,0,1037,41069,0,0,1649,98041,0,0,508,11882,0,0;QS=3,0;MQSB=0.967085;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,9,111:3:0	0,21,221:7:0
+17	454	.	A	<X>	0	.	DP=31;I16=18,12,0,0,1158,47028,0,0,1738,102482,0,0,554,12904,0,0;QS=3,0;MQSB=0.878946;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,9,113:3:0	0,30,255:10:0
+17	455	.	T	<X>	0	.	DP=32;I16=17,13,0,0,1148,46574,0,0,1715,100251,0,0,550,12864,0,0;QS=3,0;MQSB=0.973855;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,113:3:0	0,33,255:11:0
+17	456	.	G	<X>	0	.	DP=32;I16=17,13,0,0,1161,47287,0,0,1746,103010,0,0,534,12296,0,0;QS=3,0;MQSB=0.998031;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,9,116:3:0	0,30,245:10:0
+17	457	.	C	<X>	0	.	DP=33;I16=19,13,0,0,1218,48642,0,0,1835,107451,0,0,563,12967,0,0;QS=3,0;MQSB=0.985204;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,9,118:3:0	0,33,255:11:0
+17	458	.	A	<X>	0	.	DP=33;I16=19,13,0,0,1226,49034,0,0,1835,107451,0,0,568,12990,0,0;QS=3,0;MQSB=0.985204;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,9,111:3:0	0,33,255:11:0
+17	459	.	T	<X>	0	.	DP=33;I16=18,13,0,0,1167,46981,0,0,1775,103851,0,0,565,12945,0,0;QS=3,0;MQSB=0.980167;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,6,92:2:0	0,33,255:11:0
+17	460	.	G	<X>	0	.	DP=32;I16=19,12,0,0,1219,50105,0,0,1775,103851,0,0,575,12929,0,0;QS=3,0;MQSB=0.989977;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,9,116:3:0	0,30,255:10:0
+17	461	.	T	<X>	0	.	DP=32;I16=19,12,0,0,1213,49819,0,0,1775,103851,0,0,577,12845,0,0;QS=3,0;MQSB=0.989977;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,9,115:3:0	0,30,255:10:0
+17	462	.	G	<X>	0	.	DP=32;I16=19,12,0,0,1190,48962,0,0,1775,103851,0,0,580,12792,0,0;QS=3,0;MQSB=0.989977;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,12,119:4:0	0,30,241:10:0
+17	463	.	G	<X>	0	.	DP=32;I16=19,12,0,0,1114,44214,0,0,1775,103851,0,0,584,12770,0,0;QS=3,0;MQSB=0.989977;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,12,114:4:0	0,30,221:10:0
+17	464	.	A	<X>	0	.	DP=32;I16=18,11,0,0,1100,43908,0,0,1686,99410,0,0,556,12106,0,0;QS=3,0;MQSB=0.99095;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,12,133:4:0	0,24,213:8:0
+17	465	.	C	<X>	0	.	DP=33;I16=20,11,0,0,1191,48085,0,0,1775,103851,0,0,586,12786,0,0;QS=3,0;MQSB=0.996597;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,15,140:5:0	0,27,231:9:0
+17	466	.	A	<X>	0	.	DP=34;I16=21,12,0,0,1293,53311,0,0,1895,111051,0,0,597,12897,0,0;QS=3,0;MQSB=0.995633;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,15,154:5:0	0,30,255:10:0
+17	467	.	A	<X>	0	.	DP=34;I16=21,11,0,0,1256,51450,0,0,1835,107451,0,0,597,12891,0,0;QS=3,0;MQSB=0.998231;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,15,157:5:0	0,27,248:9:0
+17	468	.	A	<X>	0	.	DP=35;I16=22,12,0,0,1274,51268,0,0,1955,114651,0,0,604,12904,0,0;QS=3,0;MQSB=0.997406;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,15,154:5:0	0,30,251:10:0
+17	469	.	A	<X>	0	.	DP=35;I16=22,12,0,0,1285,52989,0,0,1955,114651,0,0,608,12940,0,0;QS=3,0;MQSB=0.997406;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,15,146:5:0	0,30,255:10:0
+17	470	.	G	<X>	0	.	DP=35;I16=22,12,0,0,1281,51055,0,0,1955,114651,0,0,612,13016,0,0;QS=3,0;MQSB=0.997406;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,15,148:5:0	0,30,238:10:0
+17	471	.	T	<X>	0	.	DP=36;I16=22,11,0,0,1239,49021,0,0,1918,113282,0,0,599,12825,0,0;QS=3,0;MQSB=0.915545;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,15,150:5:0	0,27,232:9:0
+17	472	.	T	<X>	0	.	DP=35;I16=21,12,0,0,1245,48915,0,0,1926,113810,0,0,595,12559,0,0;QS=3,0;MQSB=0.988858;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,15,153:5:0	0,27,237:9:0
+17	473	.	G	<X>	0	.	DP=35;I16=21,12,0,0,1307,53473,0,0,1926,113810,0,0,599,12651,0,0;QS=3,0;MQSB=0.988858;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,15,141:5:0	0,27,249:9:0
+17	474	.	G	<X>	0	.	DP=36;I16=22,12,0,0,1284,51708,0,0,1986,117410,0,0,602,12734,0,0;QS=3,0;MQSB=0.986937;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,15,131:5:0	0,30,255:10:0
+17	475	.	G	<X>	0	.	DP=36;I16=23,12,0,0,1311,51609,0,0,2015,118251,0,0,631,13485,0,0;QS=3,0;MQSB=0.998642;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,15,141:5:0	0,33,252:11:0
+17	476	.	A	<X>	0	.	DP=36;I16=23,12,0,0,1312,52078,0,0,2015,118251,0,0,634,13606,0,0;QS=3,0;MQSB=0.998642;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,15,157:5:0	0,33,255:11:0
+17	477	.	T	<X>	0	.	DP=36;I16=23,12,0,0,1318,52668,0,0,2015,118251,0,0,637,13773,0,0;QS=3,0;MQSB=0.998642;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,15,148:5:0	0,33,255:11:0
+17	478	.	T	<X>	0	.	DP=38;I16=25,12,0,0,1338,51774,0,0,2135,125451,0,0,637,13833,0,0;QS=3,0;MQSB=0.999868;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,18,154:6:0	0,33,255:11:0
+17	479	.	A	<X>	0	.	DP=38;I16=25,12,0,0,1420,57788,0,0,2135,125451,0,0,639,13935,0,0;QS=3,0;MQSB=0.999868;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,18,163:6:0	0,33,255:11:0
+17	480	.	G	<X>	0	.	DP=37;I16=25,11,0,0,1438,60172,0,0,2075,121851,0,0,641,14029,0,0;QS=3,0;MQSB=0.999853;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,18,165:6:0	0,33,255:11:0
+17	481	.	G	<X>	0	.	DP=37;I16=25,11,0,0,1392,55824,0,0,2075,121851,0,0,642,14112,0,0;QS=3,0;MQSB=0.999853;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,18,165:6:0	0,33,255:11:0
+17	482	.	A	<X>	0	.	DP=37;I16=24,11,0,0,1352,55134,0,0,2015,118251,0,0,618,13608,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,15,143:5:0	0,33,255:11:0
+17	483	.	G	<X>	0	.	DP=37;I16=24,12,0,0,1417,57747,0,0,2075,121851,0,0,642,14240,0,0;QS=3,0;MQSB=0.999437;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,18,165:6:0	0,33,255:11:0
+17	484	.	A	<X>	0	.	DP=36;I16=24,11,0,0,1340,53992,0,0,2015,118251,0,0,643,14281,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,18,168:6:0	0,33,255:11:0
+17	485	.	G	<X>	0	.	DP=35;I16=23,12,0,0,1329,51411,0,0,2015,118251,0,0,669,14931,0,0;QS=3,0;MQSB=0.998642;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,18,160:6:0	0,33,255:11:0
+17	486	.	A	<X>	0	.	DP=34;I16=22,12,0,0,1311,51523,0,0,1955,114651,0,0,671,14989,0,0;QS=3,0;MQSB=0.997406;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,18,173:6:0	0,33,255:11:0
+17	487	.	G	<X>	0	.	DP=34;I16=22,12,0,0,1306,50760,0,0,1955,114651,0,0,672,15030,0,0;QS=3,0;MQSB=0.997406;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,18,169:6:0	0,33,255:11:0
+17	488	.	A	<X>	0	.	DP=35;I16=22,12,0,0,1274,48140,0,0,1986,117410,0,0,646,14380,0,0;QS=3,0;MQSB=0.986937;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,18,177:6:0	0,30,255:10:0
+17	489	.	A	<X>	0	.	DP=35;I16=23,12,0,0,1264,46916,0,0,2015,118251,0,0,671,15015,0,0;QS=3,0;MQSB=0.998642;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,18,175:6:0	0,33,255:11:0
+17	490	.	A	<X>	0	.	DP=36;I16=24,12,0,0,1332,50280,0,0,2075,121851,0,0,671,15061,0,0;QS=3,0;MQSB=0.999437;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,21,188:7:0	0,33,255:11:0
+17	491	.	T	<X>	0	.	DP=36;I16=24,12,0,0,1284,46802,0,0,2075,121851,0,0,671,15093,0,0;QS=3,0;MQSB=0.999437;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,21,178:7:0	0,33,255:11:0
+17	492	.	G	<X>	0	.	DP=35;I16=21,12,0,0,1252,48326,0,0,1926,113810,0,0,621,13859,0,0;QS=3,0;MQSB=0.988858;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,18,172:6:0	0,30,251:10:0
+17	493	.	A	<X>	0	.	DP=34;I16=22,11,0,0,1273,49481,0,0,1926,113810,0,0,650,14672,0,0;QS=3,0;MQSB=0.981935;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,21,186:7:0	0,24,240:8:0
+17	494	.	A	<X>	0	.	DP=34;I16=22,12,0,0,1326,52604,0,0,1986,117410,0,0,672,15182,0,0;QS=3,0;MQSB=0.986937;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,21,196:7:0	0,27,255:9:0
+17	495	.	G	<X>	0	.	DP=34;I16=21,12,0,0,1255,48577,0,0,1926,113810,0,0,647,14611,0,0;QS=3,0;MQSB=0.988858;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,18,168:6:0	0,27,244:9:0
+17	496	.	A	<X>	0	.	DP=34;I16=22,12,0,0,1250,46926,0,0,1986,117410,0,0,670,15220,0,0;QS=3,0;MQSB=0.986937;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,21,186:7:0	0,27,249:9:0
+17	497	.	C	<X>	0	.	DP=34;I16=22,12,0,0,1250,47006,0,0,1986,117410,0,0,665,15087,0,0;QS=3,0;MQSB=0.986937;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,21,164:7:0	0,27,239:9:0
+17	498	.	A	<X>	0	.	DP=34;I16=22,12,0,0,1286,49158,0,0,1986,117410,0,0,661,14987,0,0;QS=3,0;MQSB=0.986937;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,21,185:7:0	0,27,252:9:0
+17	499	.	T	<X>	0	.	DP=34;I16=23,11,0,0,1224,45284,0,0,1986,117410,0,0,659,14919,0,0;QS=3,0;MQSB=0.979712;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,21,183:7:0	0,30,255:10:0
+17	500	.	A	<X>	0	.	DP=34;I16=23,11,0,0,1230,45152,0,0,1986,117410,0,0,657,14833,0,0;QS=3,0;MQSB=0.979712;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,21,179:7:0	0,30,255:10:0
+17	501	.	T	<X>	0	.	DP=33;I16=23,10,0,0,1241,47167,0,0,1926,113810,0,0,656,14778,0,0;QS=3,0;MQSB=0.972757;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,21,186:7:0	0,27,241:9:0
+17	502	.	G	<X>	0	.	DP=33;I16=23,10,0,0,1215,45829,0,0,1926,113810,0,0,655,14753,0,0;QS=3,0;MQSB=0.972757;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,21,183:7:0	0,27,235:9:0
+17	503	.	T	<X>	0	.	DP=34;I16=23,11,0,0,1194,43366,0,0,1986,117410,0,0,654,14758,0,0;QS=3,0;MQSB=0.979712;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,21,177:7:0	0,27,234:9:0
+17	504	.	C	<X>	0	.	DP=34;I16=23,11,0,0,1218,45552,0,0,1986,117410,0,0,651,14643,0,0;QS=3,0;MQSB=0.979712;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,21,183:7:0	0,27,219:9:0
+17	505	.	C	<X>	0	.	DP=35;I16=23,11,0,0,1207,44321,0,0,1986,117410,0,0,641,14509,0,0;QS=3,0;MQSB=0.979712;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,21,189:7:0	0,27,221:9:0
+17	506	.	A	<X>	0	.	DP=35;I16=24,11,0,0,1266,46776,0,0,2046,121010,0,0,646,14504,0,0;QS=3,0;MQSB=0.977529;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,21,188:7:0	0,27,231:9:0
+17	507	.	C	<X>	0	.	DP=35;I16=23,11,0,0,1220,45016,0,0,1986,117410,0,0,635,14401,0,0;QS=3,0;MQSB=0.979712;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,21,183:7:0	0,27,226:9:0
+17	508	.	A	<X>	0	.	DP=34;I16=24,10,0,0,1204,44542,0,0,1986,117410,0,0,643,14491,0,0;QS=3,0;MQSB=0.970272;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,21,189:7:0	0,27,220:9:0
+17	509	.	C	<X>	0	.	DP=34;I16=24,10,0,0,1272,48272,0,0,1986,117410,0,0,640,14430,0,0;QS=3,0;MQSB=0.970272;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,21,186:7:0	0,27,241:9:0
+17	510	.	A	<X>	0	.	DP=34;I16=22,11,0,0,1194,44196,0,0,1926,113810,0,0,613,13773,0,0;QS=3,0;MQSB=0.981935;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,21,187:7:0	0,24,221:8:0
+17	511	.	A	<X>	0	.	DP=34;I16=23,11,0,0,1222,45562,0,0,1986,117410,0,0,637,14395,0,0;QS=3,0;MQSB=0.979712;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,21,195:7:0	0,24,233:8:0
+17	512	.	A	C,<X>	0	.	DP=33;I16=22,10,0,1,1121,40793,13,169,1866,110210,60,3600,628,14340,9,81;QS=2.97719,0.022807,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.981935;BQB=1;MQ0F=0	PL:DP:DV	0,39,255,51,255,255:18:1	0,21,183,21,183,183:7:0	0,24,231,24,231,231:8:0
+17	513	.	A	<X>	0	.	DP=32;I16=20,10,0,0,1115,42183,0,0,1746,103010,0,0,598,13624,0,0;QS=3,0;MQSB=0.980594;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,18,175:6:0	0,24,233:8:0
+17	514	.	A	T,<X>	0	.	DP=32;I16=20,9,0,1,1066,40004,16,256,1686,99410,60,3600,586,13500,11,121;QS=2.97075,0.0292505,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.980594;BQB=1;MQ0F=0	PL:DP:DV	0,31,255,45,255,255:16:1	0,18,171,18,171,171:6:0	0,24,235,24,235,235:8:0
+17	515	.	C	<X>	0	.	DP=32;I16=18,10,0,0,1010,37294,0,0,1626,95810,0,0,561,12915,0,0;QS=3,0;MQSB=0.986018;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,18,167:6:0	0,24,211:8:0
+17	516	.	C	<X>	0	.	DP=32;I16=21,10,0,0,1100,40570,0,0,1806,106610,0,0,612,13954,0,0;QS=3,0;MQSB=0.977926;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,21,187:7:0	0,24,215:8:0
+17	517	.	T	<X>	0	.	DP=33;I16=23,10,0,0,1269,49995,0,0,1926,113810,0,0,636,14626,0,0;QS=3,0;MQSB=0.972757;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,21,201:7:0	0,24,242:8:0
+17	518	.	G	<X>	0	.	DP=34;I16=24,10,0,0,1247,46839,0,0,1986,117410,0,0,636,14696,0,0;QS=3,0;MQSB=0.970272;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,21,182:7:0	0,24,220:8:0
+17	519	.	T	<X>	0	.	DP=36;I16=25,11,0,0,1283,46693,0,0,2106,124610,0,0,636,14742,0,0;QS=3,0;MQSB=0.975394;MQ0F=0	PL:DP:DV	0,63,255:21:0	0,21,177:7:0	0,24,224:8:0
+17	520	.	T	<X>	0	.	DP=36;I16=24,11,0,0,1238,44894,0,0,2046,121010,0,0,613,14193,0,0;QS=3,0;MQSB=0.977529;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,21,180:7:0	0,24,223:8:0
+17	521	.	C	<X>	0	.	DP=34;I16=25,9,0,0,1280,49454,0,0,1986,117410,0,0,641,14875,0,0;QS=3,0;MQSB=0.958048;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,21,191:7:0	0,21,204:7:0
+17	522	.	A	<X>	0	.	DP=32;I16=24,8,0,0,1158,43228,0,0,1897,112969,0,0,646,14960,0,0;QS=3,0;MQSB=0.872525;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,21,185:7:0	0,15,170:5:0
+17	523	.	T	G,<X>	0	.	DP=32;I16=23,8,1,0,1184,45708,15,225,1837,109369,60,3600,626,14446,25,625;QS=2.9794,0.0206044,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.872525;BQB=1;MQ0F=0	PL:DP:DV	0,44,255,57,255,255:20:1	0,21,191,21,191,191:7:0	0,15,166,15,166,166:5:0
+17	524	.	T	<X>	0	.	DP=32;I16=24,7,0,0,1084,39474,0,0,1837,109369,0,0,629,14483,0,0;QS=3,0;MQSB=0.851535;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,21,194:7:0	0,12,140:4:0
+17	525	.	G	<X>	0	.	DP=32;I16=24,7,0,0,1181,45669,0,0,1837,109369,0,0,631,14495,0,0;QS=3,0;MQSB=0.851535;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,21,188:7:0	0,12,129:4:0
+17	526	.	C	<X>	0	.	DP=32;I16=24,7,0,0,1146,43950,0,0,1860,111600,0,0,633,14531,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,21,185:7:0	0,12,131:4:0
+17	527	.	A	<X>	0	.	DP=33;I16=24,8,0,0,1209,46265,0,0,1897,112969,0,0,636,14634,0,0;QS=3,0;MQSB=0.872525;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,21,194:7:0	0,18,181:6:0
+17	528	.	G	<X>	0	.	DP=33;I16=24,8,0,0,1256,49824,0,0,1897,112969,0,0,634,14484,0,0;QS=3,0;MQSB=0.872525;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,18,169:6:0	0,18,193:6:0
+17	529	.	C	<X>	0	.	DP=32;I16=24,7,0,0,1148,44362,0,0,1837,109369,0,0,633,14357,0,0;QS=3,0;MQSB=0.851535;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,21,187:7:0	0,18,184:6:0
+17	530	.	T	<X>	0	.	DP=32;I16=25,7,0,0,1244,49168,0,0,1897,112969,0,0,657,14883,0,0;QS=3,0;MQSB=0.850154;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,21,196:7:0	0,18,202:6:0
+17	531	.	T	<X>	0	.	DP=32;I16=25,7,0,0,1177,44171,0,0,1897,112969,0,0,654,14714,0,0;QS=3,0;MQSB=0.850154;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,21,181:7:0	0,18,193:6:0
+17	532	.	T	<X>	0	.	DP=32;I16=24,7,0,0,1153,43543,0,0,1837,109369,0,0,630,14116,0,0;QS=3,0;MQSB=0.851535;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,21,181:7:0	0,18,192:6:0
+17	533	.	C	<X>	0	.	DP=32;I16=24,7,0,0,1142,43940,0,0,1837,109369,0,0,619,13649,0,0;QS=3,0;MQSB=0.851535;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,21,178:7:0	0,18,180:6:0
+17	534	.	T	<X>	0	.	DP=31;I16=24,6,0,0,1212,49426,0,0,1777,105769,0,0,615,13479,0,0;QS=3,0;MQSB=0.82403;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,21,205:7:0	0,18,205:6:0
+17	535	.	A	<X>	0	.	DP=31;I16=24,6,0,0,1080,39870,0,0,1777,105769,0,0,611,13341,0,0;QS=3,0;MQSB=0.82403;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,21,194:7:0	0,18,189:6:0
+17	536	.	C	<X>	0	.	DP=31;I16=24,7,0,0,1097,40707,0,0,1837,109369,0,0,631,13809,0,0;QS=3,0;MQSB=0.851535;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,21,184:7:0	0,18,157:6:0
+17	537	.	C	<X>	0	.	DP=31;I16=22,7,0,0,1034,38564,0,0,1717,102169,0,0,587,12861,0,0;QS=3,0;MQSB=0.854582;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,21,172:7:0	0,18,183:6:0
+17	538	.	A	<X>	0	.	DP=31;I16=24,7,0,0,1138,42478,0,0,1837,109369,0,0,620,13536,0,0;QS=3,0;MQSB=0.851535;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,21,189:7:0	0,18,181:6:0
+17	539	.	T	<X>	0	.	DP=31;I16=24,7,0,0,1134,42070,0,0,1837,109369,0,0,614,13422,0,0;QS=3,0;MQSB=0.851535;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,21,178:7:0	0,18,181:6:0
+17	540	.	C	<X>	0	.	DP=31;I16=24,7,0,0,1148,43768,0,0,1837,109369,0,0,608,13340,0,0;QS=3,0;MQSB=0.851535;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,21,177:7:0	0,18,178:6:0
+17	541	.	A	<X>	0	.	DP=32;I16=24,6,0,0,1083,40483,0,0,1777,105769,0,0,551,11991,0,0;QS=3,0;MQSB=0.82403;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,24,180:8:0	0,15,150:5:0
+17	542	.	C	<X>	0	.	DP=33;I16=25,6,0,0,1123,41759,0,0,1837,109369,0,0,570,12552,0,0;QS=3,0;MQSB=0.822578;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,24,172:8:0	0,18,174:6:0
+17	543	.	C	<X>	0	.	DP=34;I16=25,9,0,0,1219,45959,0,0,1986,117410,0,0,601,13245,0,0;QS=3,0;MQSB=0.621145;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,27,194:9:0	0,18,188:6:0
+17	544	.	A	<X>	0	.	DP=33;I16=24,8,0,0,1170,43898,0,0,1866,110210,0,0,570,12506,0,0;QS=3,0;MQSB=0.579578;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,24,192:8:0	0,18,180:6:0
+17	545	.	A	<X>	0	.	DP=33;I16=25,8,0,0,1174,43602,0,0,1926,113810,0,0,587,12951,0,0;QS=3,0;MQSB=0.576102;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,24,190:8:0	0,18,184:6:0
+17	546	.	A	<X>	0	.	DP=32;I16=24,8,0,0,1126,41444,0,0,1866,110210,0,0,580,12802,0,0;QS=3,0;MQSB=0.579578;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,21,166:7:0	0,18,193:6:0
+17	547	.	A	<X>	0	.	DP=32;I16=24,7,0,0,1129,42381,0,0,1806,106610,0,0,547,12009,0,0;QS=3,0;MQSB=0.525788;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,21,180:7:0	0,18,195:6:0
+17	548	.	A	<X>	0	.	DP=33;I16=23,9,0,0,1153,42673,0,0,1866,110210,0,0,561,12489,0,0;QS=3,0;MQSB=0.628357;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,21,181:7:0	0,21,211:7:0
+17	549	.	T	G,<X>	0	.	DP=32;I16=22,8,0,1,1101,40987,20,400,1746,103010,60,3600,530,11716,25,625;QS=2.96748,0.0325203,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.632337;BQB=1;MQ0F=0	PL:DP:DV	0,31,255,48,255,255:17:1	0,21,168,21,168,168:7:0	0,21,208,21,208,208:7:0
+17	550	.	T	<X>	0	.	DP=32;I16=22,9,0,0,1052,37298,0,0,1806,106610,0,0,548,12176,0,0;QS=3,0;MQSB=0.632337;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,21,150:7:0	0,21,220:7:0
+17	551	.	G	<X>	0	.	DP=31;I16=22,9,0,0,1121,41639,0,0,1806,106610,0,0,541,12045,0,0;QS=3,0;MQSB=0.632337;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,21,172:7:0	0,21,208:7:0
+17	552	.	C	<X>	0	.	DP=30;I16=21,9,0,0,1093,41365,0,0,1746,103010,0,0,535,11947,0,0;QS=3,0;MQSB=0.636601;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,21,167:7:0	0,21,208:7:0
+17	553	.	A	<X>	0	.	DP=30;I16=20,8,0,0,981,35387,0,0,1626,95810,0,0,485,10831,0,0;QS=3,0;MQSB=0.596163;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,18,150:6:0	0,21,194:7:0
+17	554	.	A	<X>	0	.	DP=30;I16=19,9,0,0,975,35601,0,0,1626,95810,0,0,488,10906,0,0;QS=3,0;MQSB=0.646113;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,139:5:0	0,24,211:8:0
+17	555	.	A	<X>	0	.	DP=30;I16=20,10,0,0,1024,36526,0,0,1746,103010,0,0,514,11392,0,0;QS=3,0;MQSB=0.679025;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,18,150:6:0	0,21,211:7:0
+17	556	.	C	<X>	0	.	DP=29;I16=20,9,0,0,1055,39195,0,0,1709,101641,0,0,509,11219,0,0;QS=3,0;MQSB=0.894839;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,18,158:6:0	0,18,186:6:0
+17	557	.	A	<X>	0	.	DP=27;I16=18,9,0,0,987,36749,0,0,1589,94441,0,0,506,11074,0,0;QS=3,0;MQSB=0.898397;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,18,157:6:0	0,18,186:6:0
+17	558	.	A	<X>	0	.	DP=27;I16=18,8,0,0,948,35808,0,0,1560,93600,0,0,477,10281,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,143:5:0	0,18,177:6:0
+17	559	.	C	A,<X>	0	.	DP=27;I16=17,8,0,1,908,33726,14,196,1500,90000,29,841,448,9516,25,625;QS=2.92708,0.0729167,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.90038;BQB=1;MQ0F=0	PL:DP:DV	0,42,255,42,255,255:14:0	0,4,116,15,119,123:6:1	0,18,169,18,169,169:6:0
+17	560	.	C	<X>	0	.	DP=28;I16=19,9,0,0,992,36552,0,0,1649,98041,0,0,494,10654,0,0;QS=3,0;MQSB=0.896555;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,18,160:6:0	0,21,181:7:0
+17	561	.	A	<X>	0	.	DP=28;I16=18,9,0,0,963,35455,0,0,1589,94441,0,0,466,9946,0,0;QS=3,0;MQSB=0.898397;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,18,158:6:0	0,21,194:7:0
+17	562	.	C	<X>	0	.	DP=28;I16=18,9,0,0,1006,38392,0,0,1589,94441,0,0,463,9893,0,0;QS=3,0;MQSB=0.898397;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,18,153:6:0	0,21,187:7:0
+17	563	.	A	<X>	0	.	DP=27;I16=17,9,0,0,893,32413,0,0,1529,90841,0,0,460,9820,0,0;QS=3,0;MQSB=0.90038;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,149:5:0	0,21,179:7:0
+17	564	.	C	<X>	0	.	DP=27;I16=18,9,0,0,859,28747,0,0,1589,94441,0,0,482,10402,0,0;QS=3,0;MQSB=0.898397;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,121:5:0	0,21,182:7:0
+17	565	.	G	<X>	0	.	DP=30;I16=17,9,0,0,818,26928,0,0,1560,93600,0,0,454,9764,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,12,96:4:0	0,21,154:7:0
+17	566	.	C	<X>	0	.	DP=29;I16=15,11,0,0,903,33405,0,0,1529,90841,0,0,424,9084,0,0;QS=3,0;MQSB=0.927041;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,155:5:0	0,18,167:6:0
+17	567	.	C	<X>	0	.	DP=30;I16=15,12,0,0,932,33774,0,0,1589,94441,0,0,462,10178,0,0;QS=3,0;MQSB=0.935229;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,155:5:0	0,21,196:7:0
+17	568	.	C	<X>	0	.	DP=29;I16=15,13,0,0,1057,40817,0,0,1649,98041,0,0,482,10438,0,0;QS=3,0;MQSB=0.942064;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,18,183:6:0	0,18,189:6:0
+17	569	.	T	<X>	0	.	DP=30;I16=16,12,0,0,1056,41296,0,0,1649,98041,0,0,493,10655,0,0;QS=3,0;MQSB=0.933359;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,18,190:6:0	0,21,213:7:0
+17	570	.	T	<X>	0	.	DP=30;I16=16,12,0,0,954,34972,0,0,1680,100800,0,0,472,10086,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,15,157:5:0	0,21,195:7:0
+17	571	.	C	<X>	0	.	DP=31;I16=17,12,0,0,1061,40675,0,0,1740,104400,0,0,472,10158,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,15,155:5:0	0,21,193:7:0
+17	572	.	A	<X>	0	.	DP=31;I16=18,12,0,0,1102,42642,0,0,1769,105241,0,0,499,10887,0,0;QS=3,0;MQSB=0.929991;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,21,203:7:0	0,18,175:6:0
+17	573	.	A	<X>	0	.	DP=31;I16=18,12,0,0,1057,38473,0,0,1769,105241,0,0,501,10975,0,0;QS=3,0;MQSB=0.929991;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,21,199:7:0	0,18,178:6:0
+17	574	.	C	A,<X>	0	.	DP=31;I16=18,11,0,1,1088,41328,15,225,1740,104400,29,841,478,10422,25,625;QS=2.94071,0.0592885,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.929991;BQB=1;MQ0F=0	PL:DP:DV	0,48,255,48,255,255:16:0	0,9,170,21,173,177:8:1	0,18,173,18,173,173:6:0
+17	575	.	T	<X>	0	.	DP=30;I16=16,10,0,0,1024,41260,0,0,1560,93600,0,0,448,9842,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,21,209:7:0	0,15,163:5:0
+17	576	.	G	<X>	0	.	DP=30;I16=17,12,0,0,1047,40077,0,0,1709,101641,0,0,507,11087,0,0;QS=3,0;MQSB=0.931617;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,24,208:8:0	0,15,151:5:0
+17	577	.	G	<X>	0	.	DP=30;I16=16,12,0,0,999,37747,0,0,1649,98041,0,0,489,10755,0,0;QS=3,0;MQSB=0.933359;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,24,204:8:0	0,15,146:5:0
+17	578	.	G	<X>	0	.	DP=29;I16=16,13,0,0,975,34803,0,0,1709,101641,0,0,520,11286,0,0;QS=3,0;MQSB=0.940317;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,24,198:8:0	0,15,151:5:0
+17	579	.	G	<X>	0	.	DP=30;I16=15,13,0,0,1028,38752,0,0,1649,98041,0,0,484,10514,0,0;QS=3,0;MQSB=0.942064;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,24,224:8:0	0,12,145:4:0
+17	580	.	A	C,<X>	0	.	DP=30;I16=15,14,1,0,1060,39178,16,256,1709,101641,60,3600,510,11078,17,289;QS=2.97338,0.0266223,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.946202;BQB=1;MQ0F=0	PL:DP:DV	0,34,255,48,255,255:17:1	0,24,221,24,221,221:8:0	0,15,155,15,155,155:5:0
+17	581	.	A	<X>	0	.	DP=31;I16=16,15,0,0,1083,39215,0,0,1829,108841,0,0,530,11384,0,0;QS=3,0;MQSB=0.951229;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,24,223:8:0	0,15,153:5:0
+17	582	.	C	<X>	0	.	DP=31;I16=15,15,0,0,1080,39870,0,0,1769,105241,0,0,519,11211,0,0;QS=3,0;MQSB=0.952765;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,24,207:8:0	0,15,151:5:0
+17	583	.	T	<X>	0	.	DP=30;I16=16,14,0,0,1136,43996,0,0,1769,105241,0,0,539,11523,0,0;QS=3,0;MQSB=0.946202;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,24,238:8:0	0,15,163:5:0
+17	584	.	C	<X>	0	.	DP=31;I16=16,13,0,0,1051,39351,0,0,1709,101641,0,0,499,10619,0,0;QS=3,0;MQSB=0.960189;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,21,207:7:0	0,15,157:5:0
+17	585	.	A	<X>	0	.	DP=31;I16=17,14,0,0,1096,39866,0,0,1798,106082,0,0,549,11751,0,0;QS=3,0;MQSB=0.998229;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,24,211:8:0	0,15,157:5:0
+17	586	.	T	<X>	0	.	DP=31;I16=16,14,0,0,1081,39839,0,0,1738,102482,0,0,546,11796,0,0;QS=3,0;MQSB=0.999136;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,24,212:8:0	0,15,156:5:0
+17	587	.	C	<X>	0	.	DP=31;I16=17,13,0,0,1070,39402,0,0,1769,105241,0,0,532,11350,0,0;QS=3,0;MQSB=0.963674;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,21,201:7:0	0,15,155:5:0
+17	588	.	A	<X>	0	.	DP=31;I16=17,14,0,0,1126,41642,0,0,1798,106082,0,0,562,12140,0,0;QS=3,0;MQSB=0.998229;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,24,222:8:0	0,15,164:5:0
+17	589	.	A	<X>	0	.	DP=31;I16=17,14,0,0,1157,43973,0,0,1798,106082,0,0,568,12340,0,0;QS=3,0;MQSB=0.998229;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,24,236:8:0	0,15,165:5:0
+17	590	.	C	<X>	0	.	DP=32;I16=16,14,0,0,1094,41302,0,0,1769,105241,0,0,549,11951,0,0;QS=3,0;MQSB=0.958545;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,18,192:6:0	0,18,175:6:0
+17	591	.	A	<X>	0	.	DP=31;I16=16,15,0,0,1165,44163,0,0,1798,106082,0,0,579,12695,0,0;QS=3,0;MQSB=0.999805;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,21,209:7:0	0,18,188:6:0
+17	592	.	A	<X>	0	.	DP=31;I16=15,15,0,0,1114,42144,0,0,1738,102482,0,0,571,12651,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,21,215:7:0	0,18,182:6:0
+17	593	.	C	<X>	0	.	DP=31;I16=15,14,0,0,1065,39889,0,0,1709,101641,0,0,550,12132,0,0;QS=3,0;MQSB=0.954405;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,18,191:6:0	0,18,174:6:0
+17	594	.	A	<X>	0	.	DP=33;I16=16,16,0,0,1163,42917,0,0,1858,109682,0,0,572,12672,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,21,205:7:0	0,24,212:8:0
+17	595	.	A	<X>	0	.	DP=33;I16=17,16,0,0,1130,39996,0,0,1918,113282,0,0,589,12905,0,0;QS=3,0;MQSB=0.999838;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,21,198:7:0	0,24,213:8:0
+17	596	.	A	<X>	0	.	DP=33;I16=16,16,0,0,1059,37039,0,0,1858,109682,0,0,590,12952,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,21,169:7:0	0,24,230:8:0
+17	597	.	C	<X>	0	.	DP=33;I16=17,16,0,0,1196,44890,0,0,1918,113282,0,0,592,12990,0,0;QS=3,0;MQSB=0.999838;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,21,204:7:0	0,24,220:8:0
+17	598	.	T	<X>	0	.	DP=33;I16=16,16,0,0,1214,47104,0,0,1858,109682,0,0,593,13013,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,21,217:7:0	0,24,239:8:0
+17	599	.	T	<X>	0	.	DP=33;I16=16,17,0,0,1183,43669,0,0,1918,113282,0,0,599,13095,0,0;QS=3,0;MQSB=0.999838;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,21,197:7:0	0,27,247:9:0
+17	600	.	G	<X>	0	.	DP=32;I16=15,17,0,0,1174,44066,0,0,1858,109682,0,0,601,13145,0,0;QS=3,0;MQSB=0.999287;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,21,194:7:0	0,24,232:8:0
+17	601	.	T	<X>	0	.	DP=32;I16=15,17,0,0,1114,39954,0,0,1858,109682,0,0,603,13227,0,0;QS=3,0;MQSB=0.999287;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,21,188:7:0	0,24,235:8:0
+17	602	.	G	<X>	0	.	DP=32;I16=15,15,0,0,1090,40326,0,0,1769,105241,0,0,555,12091,0,0;QS=3,0;MQSB=0.952765;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,18,185:6:0	0,24,229:8:0
+17	603	.	G	<X>	0	.	DP=31;I16=15,16,0,0,1052,37460,0,0,1798,106082,0,0,607,13437,0,0;QS=3,0;MQSB=0.999805;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,21,186:7:0	0,24,219:8:0
+17	604	.	T	<X>	0	.	DP=31;I16=14,16,0,0,1009,35893,0,0,1769,105241,0,0,564,12540,0,0;QS=3,0;MQSB=0.958545;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,24,195:8:0	0,21,212:7:0
+17	605	.	T	<X>	0	.	DP=31;I16=12,15,0,0,1001,37741,0,0,1589,94441,0,0,514,11258,0,0;QS=3,0;MQSB=0.958048;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,21,200:7:0	0,21,214:7:0
+17	606	.	T	<X>	0	.	DP=31;I16=13,16,0,0,992,35202,0,0,1709,101641,0,0,587,13125,0,0;QS=3,0;MQSB=0.960189;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,21,189:7:0	0,24,217:8:0
+17	607	.	A	<X>	0	.	DP=31;I16=14,16,0,0,1027,36129,0,0,1738,102482,0,0,607,13577,0,0;QS=3,0;MQSB=0.999136;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,21,176:7:0	0,24,222:8:0
+17	608	.	C	<X>	0	.	DP=32;I16=15,15,0,0,983,33775,0,0,1769,105241,0,0,564,12564,0,0;QS=3,0;MQSB=0.952765;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,21,178:7:0	0,27,214:9:0
+17	609	.	C	<X>	0	.	DP=32;I16=14,17,0,0,1074,38220,0,0,1798,106082,0,0,606,13678,0,0;QS=3,0;MQSB=0.998229;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,21,190:7:0	0,27,238:9:0
+17	610	.	C	<X>	0	.	DP=32;I16=15,16,0,0,1158,44218,0,0,1829,108841,0,0,594,13444,0,0;QS=3,0;MQSB=0.951229;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,24,211:8:0	0,27,246:9:0
+17	611	.	A	<X>	0	.	DP=32;I16=15,16,0,0,1080,39204,0,0,1798,106082,0,0,590,13260,0,0;QS=3,0;MQSB=0.999805;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,27,220:9:0	0,27,246:9:0
+17	612	.	C	<X>	0	.	DP=33;I16=16,17,0,0,1175,43305,0,0,1918,113282,0,0,617,13993,0,0;QS=3,0;MQSB=0.999838;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,27,214:9:0	0,27,250:9:0
+17	613	.	A	<X>	0	.	DP=34;I16=16,17,0,0,1131,40011,0,0,1949,116041,0,0,604,13874,0,0;QS=3,0;MQSB=0.954207;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,27,223:9:0	0,27,239:9:0
+17	614	.	C	<X>	0	.	DP=34;I16=16,17,0,0,1183,43743,0,0,1949,116041,0,0,608,14022,0,0;QS=3,0;MQSB=0.954207;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,27,223:9:0	0,27,245:9:0
+17	615	.	A	<X>	0	.	DP=34;I16=16,18,0,0,1199,43809,0,0,1978,116882,0,0,626,14394,0,0;QS=3,0;MQSB=0.999405;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,30,240:10:0	0,27,254:9:0
+17	616	.	A	<X>	0	.	DP=34;I16=16,17,0,0,1190,44024,0,0,1949,116041,0,0,615,14351,0,0;QS=3,0;MQSB=0.954207;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,27,247:9:0	0,27,255:9:0
+17	617	.	T	<X>	0	.	DP=33;I16=15,18,0,0,1170,43066,0,0,1918,113282,0,0,630,14624,0,0;QS=3,0;MQSB=0.998531;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,30,241:10:0	0,27,255:9:0
+17	618	.	G	<X>	0	.	DP=34;I16=15,19,0,0,1166,41452,0,0,1978,116882,0,0,632,14706,0,0;QS=3,0;MQSB=0.997597;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,30,248:10:0	0,27,240:9:0
+17	619	.	G	<X>	0	.	DP=32;I16=14,18,0,0,1153,42591,0,0,1858,109682,0,0,638,14816,0,0;QS=3,0;MQSB=0.997118;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,30,254:10:0	0,27,247:9:0
+17	620	.	A	<X>	0	.	DP=32;I16=14,17,0,0,1083,39757,0,0,1798,106082,0,0,616,14176,0,0;QS=3,0;MQSB=0.998229;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,30,248:10:0	0,27,255:9:0
+17	621	.	A	<X>	0	.	DP=32;I16=13,18,0,0,1170,45248,0,0,1798,106082,0,0,627,14519,0,0;QS=3,0;MQSB=0.995005;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,27,255:9:0	0,27,255:9:0
+17	622	.	G	<X>	0	.	DP=32;I16=12,18,0,0,1060,39160,0,0,1769,105241,0,0,604,13888,0,0;QS=3,0;MQSB=0.968257;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,27,236:9:0	0,27,249:9:0
+17	623	.	A	T,<X>	0	.	DP=32;I16=10,18,1,0,1010,37414,15,225,1649,98041,60,3600,563,12953,25,625;QS=2.96144,0.0385604,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.969907;BQB=1;MQ0F=0	PL:DP:DV	0,20,241,33,244,246:12:1	0,24,213,24,213,213:8:0	0,27,255,27,255,255:9:0
+17	624	.	C	<X>	0	.	DP=32;I16=13,17,0,0,1034,37292,0,0,1738,102482,0,0,607,13887,0,0;QS=3,0;MQSB=0.996503;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,27,220:9:0	0,27,242:9:0
+17	625	.	C	<X>	0	.	DP=32;I16=13,18,0,0,1108,41138,0,0,1798,106082,0,0,632,14470,0,0;QS=3,0;MQSB=0.995005;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,27,234:9:0	0,27,249:9:0
+17	626	.	A	<X>	0	.	DP=32;I16=13,17,0,0,1090,40718,0,0,1738,102482,0,0,607,13827,0,0;QS=3,0;MQSB=0.996503;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,27,237:9:0	0,27,247:9:0
+17	627	.	C	<X>	0	.	DP=32;I16=12,18,0,0,1146,44452,0,0,1769,105241,0,0,607,13833,0,0;QS=3,0;MQSB=0.968257;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,27,244:9:0	0,27,255:9:0
+17	628	.	T	<X>	0	.	DP=32;I16=11,19,0,0,1124,43114,0,0,1769,105241,0,0,608,13862,0,0;QS=3,0;MQSB=0.972375;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,27,249:9:0	0,24,249:8:0
+17	629	.	T	<X>	0	.	DP=32;I16=12,19,0,0,1114,41138,0,0,1798,106082,0,0,634,14490,0,0;QS=3,0;MQSB=0.989977;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,27,247:9:0	0,24,226:8:0
+17	630	.	A	<X>	0	.	DP=31;I16=11,18,0,0,1101,42885,0,0,1740,104400,0,0,610,13844,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,24,242:8:0	0,24,235:8:0
+17	631	.	G	<X>	0	.	DP=31;I16=12,18,0,0,1083,40525,0,0,1769,105241,0,0,636,14474,0,0;QS=3,0;MQSB=0.929991;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,24,233:8:0	0,24,223:8:0
+17	632	.	C	<X>	0	.	DP=31;I16=11,18,0,0,1105,42665,0,0,1740,104400,0,0,612,13880,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,24,233:8:0	0,24,224:8:0
+17	633	.	A	<X>	0	.	DP=31;I16=12,18,0,0,1056,38190,0,0,1769,105241,0,0,638,14562,0,0;QS=3,0;MQSB=0.929991;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,24,218:8:0	0,24,214:8:0
+17	634	.	A	<X>	0	.	DP=31;I16=12,18,0,0,1110,42208,0,0,1769,105241,0,0,638,14594,0,0;QS=3,0;MQSB=0.929991;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,24,238:8:0	0,24,229:8:0
+17	635	.	C	<X>	0	.	DP=31;I16=11,18,0,0,1031,37871,0,0,1740,104400,0,0,613,14025,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,24,220:8:0	0,24,229:8:0
+17	636	.	A	<X>	0	.	DP=31;I16=11,18,0,0,1115,43327,0,0,1740,104400,0,0,611,14005,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,24,228:8:0	0,24,243:8:0
+17	637	.	A	<X>	0	.	DP=31;I16=12,18,0,0,1152,44602,0,0,1769,105241,0,0,634,14634,0,0;QS=3,0;MQSB=0.929991;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,24,238:8:0	0,24,242:8:0
+17	638	.	A	<X>	0	.	DP=31;I16=12,18,0,0,1118,42406,0,0,1769,105241,0,0,631,14611,0,0;QS=3,0;MQSB=0.929991;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,24,235:8:0	0,24,238:8:0
+17	639	.	A	<X>	0	.	DP=30;I16=11,18,0,0,1037,38233,0,0,1709,101641,0,0,602,13934,0,0;QS=3,0;MQSB=0.921439;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,24,230:8:0	0,24,227:8:0
+17	640	.	A	<X>	0	.	DP=31;I16=11,19,0,0,1154,45368,0,0,1769,105241,0,0,596,13804,0,0;QS=3,0;MQSB=0.91982;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,24,242:8:0	0,24,240:8:0
+17	641	.	G	<X>	0	.	DP=31;I16=11,19,0,0,1018,36496,0,0,1769,105241,0,0,590,13650,0,0;QS=3,0;MQSB=0.91982;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,24,214:8:0	0,24,218:8:0
+17	642	.	G	<X>	0	.	DP=30;I16=11,19,0,0,1057,38459,0,0,1769,105241,0,0,610,14148,0,0;QS=3,0;MQSB=0.91982;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,21,187:7:0	0,24,221:8:0
+17	643	.	A	<X>	0	.	DP=29;I16=11,17,0,0,969,35477,0,0,1649,98041,0,0,585,13605,0,0;QS=3,0;MQSB=0.923174;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,21,199:7:0	0,24,237:8:0
+17	644	.	C	A,<X>	0	.	DP=29;I16=9,18,1,0,898,30864,17,289,1620,97200,60,3600,549,12567,25,625;QS=2.95685,0.0431472,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=1;BQB=1;MQ0F=0	PL:DP:DV	0,22,236,36,239,243:13:1	0,21,195,21,195,195:7:0	0,24,204,24,204,204:8:0
+17	645	.	C	<X>	0	.	DP=30;I16=10,19,0,0,1067,40337,0,0,1709,101641,0,0,584,13274,0,0;QS=3,0;MQSB=0.909373;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,21,198:7:0	0,24,226:8:0
+17	646	.	A	T,<X>	0	.	DP=31;I16=9,20,1,0,1044,38174,14,196,1740,104400,60,3600,553,12499,25,625;QS=2.97113,0.028866,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=1;BQB=1;MQ0F=0	PL:DP:DV	0,27,255,39,255,255:14:1	0,21,197,21,197,197:7:0	0,27,229,27,229,229:9:0
+17	647	.	A	<X>	0	.	DP=33;I16=10,21,0,0,1041,35883,0,0,1829,108841,0,0,573,12999,0,0;QS=3,0;MQSB=0.906252;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,21,189:7:0	0,30,213:10:0
+17	648	.	A	<X>	0	.	DP=33;I16=11,22,0,0,1030,34122,0,0,1949,116041,0,0,594,13478,0,0;QS=3,0;MQSB=0.915545;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,21,188:7:0	0,30,194:10:0
+17	649	.	C	<X>	0	.	DP=32;I16=10,21,0,0,1099,39879,0,0,1860,111600,0,0,566,12738,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,21,188:7:0	0,27,217:9:0
+17	650	.	T	<X>	0	.	DP=31;I16=11,18,0,0,1006,37114,0,0,1709,101641,0,0,549,12407,0,0;QS=3,0;MQSB=0.921439;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,18,187:6:0	0,24,226:8:0
+17	651	.	C	<X>	0	.	DP=32;I16=11,20,0,0,1117,41181,0,0,1829,108841,0,0,581,13107,0,0;QS=3,0;MQSB=0.918304;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,18,186:6:0	0,27,229:9:0
+17	652	.	C	<X>	0	.	DP=32;I16=9,21,0,0,1126,43084,0,0,1769,105241,0,0,557,12423,0,0;QS=3,0;MQSB=0.893237;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,18,196:6:0	0,24,213:8:0
+17	653	.	T	<X>	0	.	DP=33;I16=9,23,0,0,1141,42631,0,0,1889,112441,0,0,556,12382,0,0;QS=3,0;MQSB=0.890331;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,18,198:6:0	0,24,225:8:0
+17	654	.	G	<X>	0	.	DP=33;I16=10,23,0,0,1171,43025,0,0,1949,116041,0,0,578,12798,0,0;QS=3,0;MQSB=0.903508;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,18,191:6:0	0,24,223:8:0
+17	655	.	G	<X>	0	.	DP=32;I16=10,22,0,0,1118,40202,0,0,1889,112441,0,0,575,12573,0,0;QS=3,0;MQSB=0.904837;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,18,181:6:0	0,24,213:8:0
+17	656	.	T	<X>	0	.	DP=32;I16=10,22,0,0,1090,38566,0,0,1889,112441,0,0,571,12333,0,0;QS=3,0;MQSB=0.904837;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,18,185:6:0	0,24,213:8:0
+17	657	.	A	<X>	0	.	DP=32;I16=10,21,0,0,1100,40006,0,0,1829,108841,0,0,557,12029,0,0;QS=3,0;MQSB=0.906252;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,18,183:6:0	0,24,191:8:0
+17	658	.	C	<X>	0	.	DP=32;I16=10,21,0,0,1115,41039,0,0,1829,108841,0,0,542,11520,0,0;QS=3,0;MQSB=0.906252;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,15,168:5:0	0,24,211:8:0
+17	659	.	A	<X>	0	.	DP=32;I16=10,21,0,0,1141,42897,0,0,1829,108841,0,0,547,11685,0,0;QS=3,0;MQSB=0.906252;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,18,191:6:0	0,24,216:8:0
+17	660	.	T	<X>	0	.	DP=33;I16=10,22,0,0,1139,41887,0,0,1889,112441,0,0,553,11659,0,0;QS=3,0;MQSB=0.904837;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,18,186:6:0	0,24,214:8:0
+17	661	.	G	<X>	0	.	DP=32;I16=9,22,0,0,1107,41531,0,0,1829,108841,0,0,549,11549,0,0;QS=3,0;MQSB=0.891738;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,18,191:6:0	0,21,188:7:0
+17	662	.	C	<X>	0	.	DP=32;I16=8,22,0,0,1087,40811,0,0,1800,108000,0,0,523,10991,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,18,192:6:0	0,21,187:7:0
+17	663	.	A	<X>	0	.	DP=32;I16=9,22,0,0,1036,36816,0,0,1829,108841,0,0,540,11388,0,0;QS=3,0;MQSB=0.891738;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,18,192:6:0	0,21,186:7:0
+17	664	.	A	<X>	0	.	DP=32;I16=9,23,0,0,1125,40759,0,0,1889,112441,0,0,552,11628,0,0;QS=3,0;MQSB=0.890331;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,18,188:6:0	0,21,184:7:0
+17	665	.	C	<X>	0	.	DP=30;I16=9,21,0,0,1075,39697,0,0,1769,105241,0,0,550,11650,0,0;QS=3,0;MQSB=0.893237;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,18,186:6:0	0,21,184:7:0
+17	666	.	T	<X>	0	.	DP=29;I16=9,20,0,0,1096,41946,0,0,1709,101641,0,0,547,11607,0,0;QS=3,0;MQSB=0.894839;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,15,171:5:0	0,21,194:7:0
+17	667	.	G	<X>	0	.	DP=31;I16=11,19,0,0,1037,37627,0,0,1769,105241,0,0,524,11198,0,0;QS=3,0;MQSB=0.91982;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,18,189:6:0	0,21,188:7:0
+17	668	.	A	<X>	0	.	DP=31;I16=11,20,0,0,1102,39980,0,0,1829,108841,0,0,543,11625,0,0;QS=3,0;MQSB=0.918304;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,18,190:6:0	0,21,187:7:0
+17	669	.	C	<X>	0	.	DP=30;I16=10,19,0,0,1051,38869,0,0,1740,104400,0,0,528,11464,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,18,182:6:0	0,21,189:7:0
+17	670	.	A	<X>	0	.	DP=30;I16=11,19,0,0,1121,43423,0,0,1769,105241,0,0,540,11642,0,0;QS=3,0;MQSB=0.91982;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,18,194:6:0	0,21,205:7:0
+17	671	.	G	<X>	0	.	DP=30;I16=11,19,0,0,1101,41035,0,0,1769,105241,0,0,537,11637,0,0;QS=3,0;MQSB=0.91982;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,18,181:6:0	0,21,191:7:0
+17	672	.	A	<X>	0	.	DP=30;I16=10,19,0,0,1031,37795,0,0,1740,104400,0,0,521,11479,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,18,185:6:0	0,21,185:7:0
+17	673	.	T	<X>	0	.	DP=29;I16=8,19,0,0,954,34984,0,0,1589,94441,0,0,497,10885,0,0;QS=3,0;MQSB=0.880529;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,12,126:4:0	0,21,192:7:0
+17	674	.	G	<X>	0	.	DP=29;I16=10,18,0,0,974,35736,0,0,1649,98041,0,0,497,10827,0,0;QS=3,0;MQSB=0.911099;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,15,146:5:0	0,21,185:7:0
+17	675	.	A	<X>	0	.	DP=28;I16=9,19,0,0,996,36338,0,0,1649,98041,0,0,517,11389,0,0;QS=3,0;MQSB=0.896555;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,12,124:4:0	0,21,189:7:0
+17	676	.	A	<X>	0	.	DP=29;I16=8,19,0,0,988,36578,0,0,1589,94441,0,0,462,10106,0,0;QS=3,0;MQSB=0.880529;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,12,128:4:0	0,21,186:7:0
+17	677	.	T	<X>	0	.	DP=29;I16=9,20,0,0,1006,36126,0,0,1709,101641,0,0,507,11303,0,0;QS=3,0;MQSB=0.894839;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,12,120:4:0	0,21,192:7:0
+17	678	.	C	<X>	0	.	DP=29;I16=9,20,0,0,1020,36984,0,0,1709,101641,0,0,502,11280,0,0;QS=3,0;MQSB=0.894839;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,12,117:4:0	0,21,191:7:0
+17	679	.	T	<X>	0	.	DP=27;I16=6,19,0,0,902,33612,0,0,1469,87241,0,0,460,10414,0,0;QS=3,0;MQSB=0.833024;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,9,96:3:0	0,21,195:7:0
+17	680	.	C	<X>	0	.	DP=26;I16=7,18,0,0,879,32295,0,0,1469,87241,0,0,468,10482,0,0;QS=3,0;MQSB=0.862128;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,9,98:3:0	0,21,181:7:0
+17	681	.	A	<X>	0	.	DP=27;I16=7,17,0,0,844,30190,0,0,1409,83641,0,0,465,10425,0,0;QS=3,0;MQSB=0.864405;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,9,106:3:0	0,21,174:7:0
+17	682	.	A	<X>	0	.	DP=27;I16=7,20,0,0,919,32179,0,0,1589,94441,0,0,500,11096,0,0;QS=3,0;MQSB=0.858077;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,145:5:0	0,21,176:7:0
+17	683	.	A	<X>	0	.	DP=29;I16=8,21,0,0,949,32735,0,0,1709,101641,0,0,499,11103,0,0;QS=3,0;MQSB=0.876998;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,18,172:6:0	0,21,167:7:0
+17	684	.	C	<X>	0	.	DP=29;I16=6,21,0,0,802,24468,0,0,1589,94441,0,0,473,10459,0,0;QS=3,0;MQSB=0.829029;MQ0F=0	PL:DP:DV	0,45,251:15:0	0,15,118:5:0	0,21,145:7:0
+17	685	.	G	<X>	0	.	DP=28;I16=6,21,0,0,908,32092,0,0,1620,97200,0,0,498,11090,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,130:5:0	0,21,175:7:0
+17	686	.	C	<X>	0	.	DP=28;I16=7,21,0,0,977,35493,0,0,1680,100800,0,0,500,11080,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,18,170:6:0	0,21,180:7:0
+17	687	.	A	<X>	0	.	DP=28;I16=6,20,0,0,900,31952,0,0,1560,93600,0,0,475,10469,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,18,175:6:0	0,21,174:7:0
+17	688	.	T	<X>	0	.	DP=27;I16=6,21,0,0,937,33971,0,0,1620,97200,0,0,501,11135,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,18,153:6:0	0,21,187:7:0
+17	689	.	T	A,<X>	0	.	DP=27;I16=5,20,1,0,829,28967,13,169,1500,90000,60,3600,463,10359,25,625;QS=2.97105,0.0289532,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=1;BQB=1;MQ0F=0	PL:DP:DV	0,28,231,39,234,234:14:1	0,15,116,15,116,116:5:0	0,21,185,21,185,185:7:0
+17	690	.	C	<X>	0	.	DP=27;I16=6,20,0,0,935,34553,0,0,1560,93600,0,0,486,10974,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,146:5:0	0,21,165:7:0
+17	691	.	C	<X>	0	.	DP=26;I16=5,18,0,0,842,31906,0,0,1380,82800,0,0,446,10166,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,129:4:0	0,18,161:6:0
+17	692	.	T	<X>	0	.	DP=26;I16=6,19,0,0,886,32434,0,0,1500,90000,0,0,486,11082,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,146:5:0	0,18,164:6:0
+17	693	.	C	<X>	0	.	DP=27;I16=6,20,0,0,891,31839,0,0,1560,93600,0,0,483,11007,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,141:5:0	0,21,172:7:0
+17	694	.	C	<X>	0	.	DP=27;I16=6,21,0,0,808,25004,0,0,1620,97200,0,0,498,11248,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,242:14:0	0,18,136:6:0	0,21,146:7:0
+17	695	.	G	<X>	0	.	DP=25;I16=4,20,0,0,807,28037,0,0,1440,86400,0,0,476,10692,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,246:13:0	0,18,145:6:0	0,15,124:5:0
+17	696	.	T	<X>	0	.	DP=25;I16=5,20,0,0,896,32870,0,0,1500,90000,0,0,499,11129,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,18,150:6:0	0,15,141:5:0
+17	697	.	G	<X>	0	.	DP=26;I16=5,19,0,0,852,30594,0,0,1409,83641,0,0,450,9858,0,0;QS=3,0;MQSB=0.796124;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,142:5:0	0,15,120:5:0
+17	698	.	T	<X>	0	.	DP=27;I16=6,20,0,0,917,33201,0,0,1529,90841,0,0,502,11114,0,0;QS=3,0;MQSB=0.83095;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,18,154:6:0	0,15,131:5:0
+17	699	.	G	<X>	0	.	DP=28;I16=5,21,0,0,923,34103,0,0,1529,90841,0,0,498,10884,0,0;QS=3,0;MQSB=0.79189;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,18,163:6:0	0,15,132:5:0
+17	700	.	A	<X>	0	.	DP=28;I16=6,22,0,0,989,35833,0,0,1618,95282,0,0,530,11626,0,0;QS=3,0;MQSB=0.904554;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,21,169:7:0	0,18,148:6:0
+17	701	.	A	<X>	0	.	DP=29;I16=5,23,0,0,992,35956,0,0,1618,95282,0,0,517,11459,0,0;QS=3,0;MQSB=0.864394;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,21,186:7:0	0,18,144:6:0
+17	702	.	A	<X>	0	.	DP=29;I16=5,23,0,0,1103,44105,0,0,1618,95282,0,0,520,11508,0,0;QS=3,0;MQSB=0.864394;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,21,204:7:0	0,18,159:6:0
+17	703	.	G	<X>	0	.	DP=29;I16=5,23,0,0,1014,37508,0,0,1618,95282,0,0,522,11534,0,0;QS=3,0;MQSB=0.864394;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,21,172:7:0	0,18,144:6:0
+17	704	.	A	T,<X>	0	.	DP=29;I16=4,23,1,0,954,34200,16,256,1558,91682,60,3600,499,10963,13,169;QS=2.97064,0.0293578,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.864394;BQB=1;MQ0F=0	PL:DP:DV	0,31,255,45,255,255:16:1	0,18,154,18,154,154:6:0	0,18,139,18,139,139:6:0
+17	705	.	A	<X>	0	.	DP=29;I16=6,22,0,0,1042,39930,0,0,1618,95282,0,0,513,11189,0,0;QS=3,0;MQSB=0.904554;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,21,189:7:0	0,18,157:6:0
+17	706	.	G	<X>	0	.	DP=30;I16=6,23,0,0,1029,37763,0,0,1678,98882,0,0,513,11225,0,0;QS=3,0;MQSB=0.900586;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,21,170:7:0	0,18,131:6:0
+17	707	.	C	<X>	0	.	DP=30;I16=5,22,0,0,944,34494,0,0,1558,91682,0,0,464,10040,0,0;QS=3,0;MQSB=0.868709;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,15,131:5:0	0,18,134:6:0
+17	708	.	C	<X>	0	.	DP=30;I16=6,24,0,0,898,27574,0,0,1738,102482,0,0,540,12010,0,0;QS=3,0;MQSB=0.896846;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,24,153:8:0	0,18,110:6:0
+17	709	.	G	<X>	0	.	DP=29;I16=5,22,0,0,968,36130,0,0,1558,91682,0,0,507,11343,0,0;QS=3,0;MQSB=0.868709;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,24,178:8:0	0,15,132:5:0
+17	710	.	G	<X>	0	.	DP=29;I16=5,23,0,0,961,34825,0,0,1618,95282,0,0,533,12029,0,0;QS=3,0;MQSB=0.864394;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,24,174:8:0	0,15,122:5:0
+17	711	.	A	<X>	0	.	DP=29;I16=6,23,0,0,996,35700,0,0,1647,96123,0,0,565,12723,0,0;QS=3,0;MQSB=0.957107;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,21,171:7:0	0,18,142:6:0
+17	712	.	C	<X>	0	.	DP=29;I16=6,23,0,0,1069,40863,0,0,1647,96123,0,0,565,12767,0,0;QS=3,0;MQSB=0.957107;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,21,156:7:0	0,18,146:6:0
+17	713	.	T	<X>	0	.	DP=29;I16=6,23,0,0,1072,40426,0,0,1647,96123,0,0,565,12835,0,0;QS=3,0;MQSB=0.957107;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,21,187:7:0	0,18,149:6:0
+17	714	.	C	<X>	0	.	DP=28;I16=6,21,0,0,988,37236,0,0,1558,91682,0,0,541,12301,0,0;QS=3,0;MQSB=0.90877;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,18,153:6:0	0,15,125:5:0
+17	715	.	A	<X>	0	.	DP=28;I16=6,20,0,0,884,31414,0,0,1498,88082,0,0,522,12004,0,0;QS=3,0;MQSB=0.913254;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,18,138:6:0	0,15,120:5:0
+17	716	.	C	<X>	0	.	DP=29;I16=4,23,0,0,998,37756,0,0,1527,88923,0,0,547,12501,0,0;QS=3,0;MQSB=0.877203;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,15,141:5:0	0,18,145:6:0
+17	717	.	A	<X>	0	.	DP=31;I16=8,23,0,0,1136,42928,0,0,1767,103323,0,0,574,13254,0,0;QS=3,0;MQSB=0.987595;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,24,212:8:0	0,18,153:6:0
+17	718	.	G	<X>	0	.	DP=29;I16=7,22,0,0,1066,40006,0,0,1647,96123,0,0,579,13407,0,0;QS=3,0;MQSB=0.979435;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,24,223:8:0	0,18,139:6:0
+17	719	.	G	<X>	0	.	DP=29;I16=7,19,0,0,952,35868,0,0,1529,90841,0,0,510,11756,0,0;QS=3,0;MQSB=0.860025;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,24,204:8:0	0,12,120:4:0
+17	720	.	G	<X>	0	.	DP=28;I16=6,20,0,0,986,37838,0,0,1467,85323,0,0,552,12940,0,0;QS=3,0;MQSB=0.970805;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,24,216:8:0	0,18,147:6:0
+17	721	.	C	<X>	0	.	DP=28;I16=6,21,0,0,989,36901,0,0,1527,88923,0,0,567,13183,0,0;QS=3,0;MQSB=0.966147;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,24,197:8:0	0,18,147:6:0
+17	722	.	A	<X>	0	.	DP=28;I16=6,21,0,0,949,33837,0,0,1527,88923,0,0,569,13225,0,0;QS=3,0;MQSB=0.966147;MQ0F=0	PL:DP:DV	0,39,244:13:0	0,24,205:8:0	0,18,143:6:0
+17	723	.	A	<X>	0	.	DP=28;I16=6,19,0,0,925,34825,0,0,1438,84482,0,0,530,12366,0,0;QS=3,0;MQSB=0.918029;MQ0F=0	PL:DP:DV	0,36,253:12:0	0,24,206:8:0	0,15,135:5:0
+17	724	.	C	<X>	0	.	DP=28;I16=5,22,0,0,967,35983,0,0,1527,88923,0,0,566,13028,0,0;QS=3,0;MQSB=0.932273;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,21,161:7:0	0,18,140:6:0
+17	725	.	A	<X>	0	.	DP=28;I16=6,21,0,0,911,31971,0,0,1527,88923,0,0,565,12987,0,0;QS=3,0;MQSB=0.966147;MQ0F=0	PL:DP:DV	0,42,246:14:0	0,21,168:7:0	0,18,137:6:0
+17	726	.	C	<X>	0	.	DP=28;I16=6,21,0,0,947,34531,0,0,1527,88923,0,0,563,12919,0,0;QS=3,0;MQSB=0.966147;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,21,166:7:0	0,18,136:6:0
+17	727	.	A	C,<X>	0	.	DP=28;I16=6,20,0,1,904,32194,17,289,1498,88082,29,841,535,12199,25,625;QS=2.90811,0.0918919,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.966147;BQB=1;MQ0F=0	PL:DP:DV	0,42,247,42,247,247:14:0	0,21,191,21,191,191:7:0	0,1,109,15,112,119:6:1
+17	728	.	C	<X>	0	.	DP=29;I16=6,22,0,0,1018,37990,0,0,1587,92523,0,0,557,12701,0,0;QS=3,0;MQSB=0.961573;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,24,208:8:0	0,18,142:6:0
+17	729	.	T	<X>	0	.	DP=29;I16=7,22,0,0,1063,39315,0,0,1647,96123,0,0,581,13227,0,0;QS=3,0;MQSB=0.979435;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,27,244:9:0	0,18,142:6:0
+17	730	.	A	<X>	0	.	DP=29;I16=7,21,0,0,993,35883,0,0,1618,95282,0,0,555,12529,0,0;QS=3,0;MQSB=0.933359;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,27,219:9:0	0,15,135:5:0
+17	731	.	T	<X>	0	.	DP=29;I16=7,22,0,0,1024,37312,0,0,1647,96123,0,0,578,13058,0,0;QS=3,0;MQSB=0.979435;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,27,210:9:0	0,18,148:6:0
+17	732	.	C	<X>	0	.	DP=29;I16=7,21,0,0,1006,37058,0,0,1618,95282,0,0,550,12314,0,0;QS=3,0;MQSB=0.933359;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,27,219:9:0	0,15,129:5:0
+17	733	.	T	<X>	0	.	DP=29;I16=7,21,0,0,985,35497,0,0,1618,95282,0,0,547,12221,0,0;QS=3,0;MQSB=0.933359;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,27,222:9:0	0,15,134:5:0
+17	734	.	G	<X>	0	.	DP=29;I16=7,21,0,0,997,36453,0,0,1587,92523,0,0,544,12154,0,0;QS=3,0;MQSB=0.982906;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,24,204:8:0	0,18,139:6:0
+17	735	.	A	<X>	0	.	DP=30;I16=7,21,0,0,963,33993,0,0,1618,95282,0,0,515,11437,0,0;QS=3,0;MQSB=0.933359;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,24,190:8:0	0,18,148:6:0
+17	736	.	C	<X>	0	.	DP=30;I16=8,20,0,0,1042,39326,0,0,1618,95282,0,0,512,11320,0,0;QS=3,0;MQSB=0.954515;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,24,218:8:0	0,18,152:6:0
+17	737	.	T	<X>	0	.	DP=30;I16=8,22,0,0,1071,39825,0,0,1707,99723,0,0,560,12480,0,0;QS=3,0;MQSB=0.990151;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,27,243:9:0	0,21,149:7:0
+17	738	.	G	<X>	0	.	DP=30;I16=8,21,0,0,1016,36816,0,0,1678,98882,0,0,533,11793,0,0;QS=3,0;MQSB=0.950946;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,27,210:9:0	0,18,141:6:0
+17	739	.	T	<X>	0	.	DP=30;I16=7,22,0,0,1020,37326,0,0,1647,96123,0,0,534,11900,0,0;QS=3,0;MQSB=0.979435;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,24,202:8:0	0,21,155:7:0
+17	740	.	T	<X>	0	.	DP=29;I16=7,21,0,0,1011,37465,0,0,1587,92523,0,0,532,11848,0,0;QS=3,0;MQSB=0.982906;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,24,232:8:0	0,21,155:7:0
+17	741	.	T	<X>	0	.	DP=29;I16=7,21,0,0,984,36052,0,0,1587,92523,0,0,528,11722,0,0;QS=3,0;MQSB=0.982906;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,24,224:8:0	0,21,151:7:0
+17	742	.	C	<X>	0	.	DP=30;I16=8,21,0,0,1046,39056,0,0,1678,98882,0,0,525,11671,0,0;QS=3,0;MQSB=0.950946;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,27,243:9:0	0,18,136:6:0
+17	743	.	A	<X>	0	.	DP=30;I16=8,21,0,0,1026,37156,0,0,1678,98882,0,0,520,11500,0,0;QS=3,0;MQSB=0.950946;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,27,239:9:0	0,18,131:6:0
+17	744	.	T	<X>	0	.	DP=30;I16=8,22,0,0,1100,41010,0,0,1707,99723,0,0,540,11984,0,0;QS=3,0;MQSB=0.990151;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,27,247:9:0	0,21,154:7:0
+17	745	.	G	<X>	0	.	DP=31;I16=9,22,0,0,1078,38890,0,0,1767,103323,0,0,535,11873,0,0;QS=3,0;MQSB=0.996219;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,27,227:9:0	0,24,178:8:0
+17	746	.	G	<X>	0	.	DP=31;I16=9,21,0,0,1001,35191,0,0,1707,99723,0,0,531,11793,0,0;QS=3,0;MQSB=0.997698;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,27,201:9:0	0,24,178:8:0
+17	747	.	G	<X>	0	.	DP=30;I16=9,20,0,0,1017,36831,0,0,1647,96123,0,0,509,11343,0,0;QS=3,0;MQSB=0.99889;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,24,201:8:0	0,21,174:7:0
+17	748	.	A	<X>	0	.	DP=30;I16=10,20,0,0,1046,37438,0,0,1707,99723,0,0,529,11721,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,27,242:9:0	0,18,159:6:0
+17	749	.	A	<X>	0	.	DP=31;I16=10,21,0,0,1077,38303,0,0,1767,103323,0,0,530,11728,0,0;QS=3,0;MQSB=0.999777;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,27,240:9:0	0,18,164:6:0
+17	750	.	A	<X>	0	.	DP=32;I16=10,20,0,0,1129,43093,0,0,1738,102482,0,0,500,11252,0,0;QS=3,0;MQSB=0.976097;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,24,232:8:0	0,15,161:5:0
+17	751	.	G	<X>	0	.	DP=31;I16=11,20,0,0,1065,37955,0,0,1767,103323,0,0,535,11787,0,0;QS=3,0;MQSB=0.999148;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,27,206:9:0	0,18,150:6:0
+17	752	.	T	<X>	0	.	DP=31;I16=11,20,0,0,1034,35786,0,0,1767,103323,0,0,537,11793,0,0;QS=3,0;MQSB=0.999148;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,27,223:9:0	0,18,143:6:0
+17	753	.	C	<X>	0	.	DP=31;I16=12,19,0,0,1073,38779,0,0,1767,103323,0,0,540,11834,0,0;QS=3,0;MQSB=0.994873;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,30,227:10:0	0,18,158:6:0
+17	754	.	T	<X>	0	.	DP=31;I16=12,19,0,0,1135,42527,0,0,1767,103323,0,0,542,11808,0,0;QS=3,0;MQSB=0.994873;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,30,255:10:0	0,18,172:6:0
+17	755	.	G	<X>	0	.	DP=31;I16=12,19,0,0,1157,43695,0,0,1767,103323,0,0,544,11814,0,0;QS=3,0;MQSB=0.994873;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,30,255:10:0	0,18,162:6:0
+17	756	.	G	<X>	0	.	DP=30;I16=12,17,0,0,1002,35566,0,0,1647,96123,0,0,539,11753,0,0;QS=3,0;MQSB=0.988062;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,30,242:10:0	0,18,157:6:0
+17	757	.	A	<X>	0	.	DP=30;I16=12,17,0,0,1035,37723,0,0,1678,98882,0,0,523,11197,0,0;QS=3,0;MQSB=0.993891;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,30,248:10:0	0,15,152:5:0
+17	758	.	A	<X>	0	.	DP=30;I16=12,18,0,0,1015,35685,0,0,1707,99723,0,0,549,11825,0,0;QS=3,0;MQSB=0.991968;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,30,247:10:0	0,18,156:6:0
+17	759	.	A	<X>	0	.	DP=30;I16=12,16,0,0,998,36498,0,0,1618,95282,0,0,526,11472,0,0;QS=3,0;MQSB=0.995699;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,27,242:9:0	0,15,151:5:0
+17	760	.	C	<X>	0	.	DP=31;I16=12,18,0,0,916,29466,0,0,1707,99723,0,0,547,11741,0,0;QS=3,0;MQSB=0.991968;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,30,217:10:0	0,18,128:6:0
+17	761	.	G	<X>	0	.	DP=30;I16=11,16,0,0,932,32884,0,0,1589,94441,0,0,512,11028,0,0;QS=3,0;MQSB=0.925036;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,27,220:9:0	0,15,153:5:0
+17	762	.	G	<X>	0	.	DP=29;I16=11,18,0,0,1012,36984,0,0,1647,96123,0,0,541,11629,0,0;QS=3,0;MQSB=0.995968;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,27,220:9:0	0,21,173:7:0
+17	763	.	C	A,<X>	0	.	DP=29;I16=11,16,0,1,948,35124,15,225,1558,91682,29,841,527,11473,2,4;QS=2.93697,0.0630252,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.993109;BQB=1;MQ0F=0	PL:DP:DV	0,39,255,39,255,255:13:0	0,24,193,24,193,193:8:0	0,6,158,18,161,165:7:1
+17	764	.	A	<X>	0	.	DP=31;I16=12,18,0,0,1051,37737,0,0,1738,102482,0,0,516,11020,0,0;QS=3,0;MQSB=0.991968;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,30,250:10:0	0,18,163:6:0
+17	765	.	A	<X>	0	.	DP=32;I16=12,18,0,0,1071,39369,0,0,1738,102482,0,0,525,11379,0,0;QS=3,0;MQSB=0.991968;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,30,254:10:0	0,18,169:6:0
+17	766	.	C	<X>	0	.	DP=31;I16=13,18,0,0,1065,38285,0,0,1798,106082,0,0,547,11797,0,0;QS=3,0;MQSB=0.995005;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,33,235:11:0	0,18,164:6:0
+17	767	.	A	<X>	0	.	DP=30;I16=12,18,0,0,996,34692,0,0,1738,102482,0,0,552,11926,0,0;QS=3,0;MQSB=0.991968;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,33,244:11:0	0,18,148:6:0
+17	768	.	C	<X>	0	.	DP=30;I16=12,18,0,0,1095,40739,0,0,1738,102482,0,0,556,12038,0,0;QS=3,0;MQSB=0.991968;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,33,255:11:0	0,18,173:6:0
+17	769	.	C	<X>	0	.	DP=30;I16=12,18,0,0,1110,42272,0,0,1738,102482,0,0,559,12133,0,0;QS=3,0;MQSB=0.991968;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,33,255:11:0	0,18,173:6:0
+17	770	.	A	<X>	0	.	DP=30;I16=12,18,0,0,1098,40852,0,0,1738,102482,0,0,562,12262,0,0;QS=3,0;MQSB=0.991968;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,33,255:11:0	0,18,171:6:0
+17	771	.	T	<X>	0	.	DP=30;I16=12,18,0,0,1111,41771,0,0,1738,102482,0,0,563,12325,0,0;QS=3,0;MQSB=0.991968;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,33,255:11:0	0,18,177:6:0
+17	772	.	T	<X>	0	.	DP=30;I16=12,18,0,0,1107,41429,0,0,1738,102482,0,0,563,12373,0,0;QS=3,0;MQSB=0.991968;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,33,255:11:0	0,18,176:6:0
+17	773	.	G	<X>	0	.	DP=30;I16=12,18,0,0,1123,42761,0,0,1738,102482,0,0,562,12406,0,0;QS=3,0;MQSB=0.991968;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,33,255:11:0	0,18,175:6:0
+17	774	.	A	<X>	0	.	DP=30;I16=12,18,0,0,1151,44801,0,0,1738,102482,0,0,560,12422,0,0;QS=3,0;MQSB=0.991968;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,33,255:11:0	0,18,179:6:0
+17	775	.	G	<X>	0	.	DP=30;I16=12,18,0,0,1136,43766,0,0,1738,102482,0,0,557,12419,0,0;QS=3,0;MQSB=0.991968;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,33,255:11:0	0,18,177:6:0
+17	776	.	A	<X>	0	.	DP=29;I16=12,17,0,0,1053,38865,0,0,1678,98882,0,0,553,12345,0,0;QS=3,0;MQSB=0.993891;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,30,255:10:0	0,18,169:6:0
+17	777	.	C	<X>	0	.	DP=28;I16=12,16,0,0,1019,37631,0,0,1618,95282,0,0,550,12298,0,0;QS=3,0;MQSB=0.995699;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,27,229:9:0	0,18,165:6:0
+17	778	.	A	<X>	0	.	DP=28;I16=12,16,0,0,1079,42041,0,0,1618,95282,0,0,547,12277,0,0;QS=3,0;MQSB=0.995699;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,27,241:9:0	0,18,181:6:0
+17	779	.	G	<X>	0	.	DP=28;I16=12,16,0,0,1025,38825,0,0,1618,95282,0,0,543,12231,0,0;QS=3,0;MQSB=0.995699;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,27,231:9:0	0,18,170:6:0
+17	780	.	A	<X>	0	.	DP=28;I16=12,16,0,0,1005,36773,0,0,1618,95282,0,0,538,12160,0,0;QS=3,0;MQSB=0.995699;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,27,242:9:0	0,18,166:6:0
+17	781	.	A	<X>	0	.	DP=28;I16=12,15,0,0,965,35857,0,0,1589,94441,0,0,519,11889,0,0;QS=3,0;MQSB=0.935229;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,24,222:8:0	0,15,159:5:0
+17	782	.	A	<X>	0	.	DP=28;I16=12,16,0,0,1003,37315,0,0,1618,95282,0,0,530,12044,0,0;QS=3,0;MQSB=0.995699;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,24,229:8:0	0,18,171:6:0
+17	783	.	A	<X>	0	.	DP=28;I16=12,16,0,0,989,36477,0,0,1618,95282,0,0,527,12001,0,0;QS=3,0;MQSB=0.995699;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,24,230:8:0	0,21,178:7:0
+17	784	.	C	<X>	0	.	DP=26;I16=11,15,0,0,967,36387,0,0,1498,88082,0,0,527,11983,0,0;QS=3,0;MQSB=0.994627;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,21,207:7:0	0,21,178:7:0
+17	785	.	A	<X>	0	.	DP=26;I16=11,15,0,0,989,38499,0,0,1498,88082,0,0,527,11989,0,0;QS=3,0;MQSB=0.994627;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,21,213:7:0	0,21,187:7:0
+17	786	.	G	<X>	0	.	DP=26;I16=11,14,0,0,938,35698,0,0,1438,84482,0,0,501,11343,0,0;QS=3,0;MQSB=0.996634;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,21,211:7:0	0,21,180:7:0
+17	787	.	G	<X>	0	.	DP=26;I16=11,15,0,0,914,33428,0,0,1498,88082,0,0,525,11969,0,0;QS=3,0;MQSB=0.994627;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,21,189:7:0	0,21,175:7:0
+17	788	.	T	<X>	0	.	DP=26;I16=11,15,0,0,913,33357,0,0,1498,88082,0,0,524,11992,0,0;QS=3,0;MQSB=0.994627;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,21,180:7:0	0,21,188:7:0
+17	789	.	G	<X>	0	.	DP=26;I16=11,15,0,0,963,36645,0,0,1498,88082,0,0,523,12037,0,0;QS=3,0;MQSB=0.994627;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,21,193:7:0	0,21,183:7:0
+17	790	.	A	<X>	0	.	DP=26;I16=11,15,0,0,999,39113,0,0,1498,88082,0,0,520,12002,0,0;QS=3,0;MQSB=0.994627;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,21,198:7:0	0,21,201:7:0
+17	791	.	G	<X>	0	.	DP=26;I16=11,15,0,0,934,34208,0,0,1498,88082,0,0,516,11934,0,0;QS=3,0;MQSB=0.994627;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,21,180:7:0	0,21,172:7:0
+17	792	.	T	<X>	0	.	DP=26;I16=11,15,0,0,895,32009,0,0,1498,88082,0,0,511,11833,0,0;QS=3,0;MQSB=0.994627;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,21,184:7:0	0,21,172:7:0
+17	793	.	G	<X>	0	.	DP=27;I16=11,15,0,0,965,36389,0,0,1498,88082,0,0,504,11652,0,0;QS=3,0;MQSB=0.994627;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,21,193:7:0	0,21,170:7:0
+17	794	.	G	<X>	0	.	DP=26;I16=11,15,0,0,888,31804,0,0,1498,88082,0,0,508,11592,0,0;QS=3,0;MQSB=0.994627;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,24,198:8:0	0,18,161:6:0
+17	795	.	T	<X>	0	.	DP=26;I16=9,15,0,0,859,31399,0,0,1409,83641,0,0,472,10908,0,0;QS=3,0;MQSB=0.96464;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,21,211:7:0	0,18,160:6:0
+17	796	.	T	<X>	0	.	DP=27;I16=11,16,0,0,907,31641,0,0,1558,91682,0,0,499,11375,0,0;QS=3,0;MQSB=0.992419;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,27,221:9:0	0,15,150:5:0
+17	797	.	G	<X>	0	.	DP=26;I16=11,15,0,0,882,31700,0,0,1529,90841,0,0,498,11298,0,0;QS=3,0;MQSB=0.927041;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,27,215:9:0	0,12,135:4:0
+17	798	.	C	<X>	0	.	DP=26;I16=9,15,0,0,806,28552,0,0,1440,86400,0,0,466,10582,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,24,207:8:0	0,12,126:4:0
+17	799	.	C	<X>	0	.	DP=26;I16=10,15,0,0,947,36407,0,0,1500,90000,0,0,491,11185,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,27,234:9:0	0,12,137:4:0
+17	800	.	T	<X>	0	.	DP=26;I16=11,15,0,0,993,38475,0,0,1529,90841,0,0,495,11199,0,0;QS=3,0;MQSB=0.927041;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,27,255:9:0	0,12,139:4:0
+17	801	.	G	<X>	0	.	DP=25;I16=11,14,0,0,938,35854,0,0,1469,87241,0,0,495,11209,0,0;QS=3,0;MQSB=0.929204;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,27,240:9:0	0,12,145:4:0
+17	802	.	G	<X>	0	.	DP=25;I16=11,14,0,0,892,32802,0,0,1469,87241,0,0,495,11239,0,0;QS=3,0;MQSB=0.929204;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,27,229:9:0	0,12,137:4:0
+17	803	.	G	<X>	0	.	DP=25;I16=11,14,0,0,906,33502,0,0,1469,87241,0,0,495,11289,0,0;QS=3,0;MQSB=0.929204;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,27,237:9:0	0,12,136:4:0
+17	804	.	G	<X>	0	.	DP=25;I16=11,12,0,0,868,33326,0,0,1349,80041,0,0,466,10846,0,0;QS=3,0;MQSB=0.934091;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,24,223:8:0	0,12,138:4:0
+17	805	.	C	<X>	0	.	DP=24;I16=9,14,0,0,810,29684,0,0,1380,82800,0,0,482,11208,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,24,220:8:0	0,12,128:4:0
+17	806	.	C	<X>	0	.	DP=25;I16=9,14,0,0,814,29856,0,0,1380,82800,0,0,483,11293,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,24,214:8:0	0,12,122:4:0
+17	807	.	A	<X>	0	.	DP=25;I16=10,15,0,0,939,35997,0,0,1500,90000,0,0,503,11525,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,27,242:9:0	0,12,146:4:0
+17	808	.	G	<X>	0	.	DP=25;I16=10,15,0,0,918,34720,0,0,1500,90000,0,0,505,11591,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,27,238:9:0	0,12,136:4:0
+17	809	.	G	<X>	0	.	DP=25;I16=10,15,0,0,926,34932,0,0,1500,90000,0,0,506,11626,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,27,226:9:0	0,12,136:4:0
+17	810	.	G	C,<X>	0	.	DP=25;I16=10,13,0,1,824,30436,14,196,1380,82800,60,3600,480,11288,14,196;QS=2.96552,0.0344828,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=1;BQB=1;MQ0F=0	PL:DP:DV	0,21,255,33,255,255:12:1	0,24,216,24,216,216:8:0	0,12,132,12,132,132:4:0
+17	811	.	A	<X>	0	.	DP=25;I16=9,14,0,0,808,29404,0,0,1380,82800,0,0,484,11294,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,21,204:7:0	0,12,139:4:0
+17	812	.	A	<X>	0	.	DP=25;I16=10,15,0,0,831,29515,0,0,1500,90000,0,0,500,11392,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,27,216:9:0	0,12,139:4:0
+17	813	.	C	<X>	0	.	DP=25;I16=10,15,0,0,915,34093,0,0,1500,90000,0,0,497,11307,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,27,239:9:0	0,12,138:4:0
+17	814	.	T	<X>	0	.	DP=25;I16=10,15,0,0,987,39343,0,0,1500,90000,0,0,494,11244,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,27,255:9:0	0,12,148:4:0
+17	815	.	T	<X>	0	.	DP=25;I16=10,15,0,0,894,32670,0,0,1500,90000,0,0,491,11203,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,27,235:9:0	0,12,143:4:0
+17	816	.	T	<X>	0	.	DP=25;I16=10,15,0,0,898,32990,0,0,1500,90000,0,0,488,11184,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,27,239:9:0	0,12,136:4:0
+17	817	.	C	<X>	0	.	DP=24;I16=10,14,0,0,898,34256,0,0,1440,86400,0,0,485,11137,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,27,235:9:0	0,12,124:4:0
+17	818	.	T	<X>	0	.	DP=23;I16=9,14,0,0,883,34371,0,0,1380,82800,0,0,484,11110,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,24,225:8:0	0,12,143:4:0
+17	819	.	G	<X>	0	.	DP=23;I16=9,13,0,0,832,31932,0,0,1320,79200,0,0,461,10573,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,24,217:8:0	0,12,142:4:0
+17	820	.	G	<X>	0	.	DP=24;I16=10,14,0,0,844,30848,0,0,1440,86400,0,0,484,11114,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,27,230:9:0	0,12,135:4:0
+17	821	.	G	<X>	0	.	DP=24;I16=10,14,0,0,852,31572,0,0,1440,86400,0,0,484,11098,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,27,234:9:0	0,12,142:4:0
+17	822	.	G	<X>	0	.	DP=25;I16=10,15,0,0,879,31785,0,0,1500,90000,0,0,481,10955,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,27,220:9:0	0,12,127:4:0
+17	823	.	T	<X>	0	.	DP=25;I16=10,15,0,0,844,29686,0,0,1500,90000,0,0,478,10786,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,27,217:9:0	0,12,127:4:0
+17	824	.	C	<X>	0	.	DP=25;I16=9,14,0,0,824,30252,0,0,1380,82800,0,0,427,9477,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,27,215:9:0	0,9,98:3:0
+17	825	.	A	<X>	0	.	DP=25;I16=10,15,0,0,881,31665,0,0,1500,90000,0,0,467,10277,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,27,234:9:0	0,12,116:4:0
+17	826	.	T	<X>	0	.	DP=25;I16=10,15,0,0,826,28364,0,0,1500,90000,0,0,461,10039,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,250:12:0	0,27,232:9:0	0,12,117:4:0
+17	827	.	A	<X>	0	.	DP=25;I16=10,15,0,0,851,29477,0,0,1500,90000,0,0,455,9829,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,27,227:9:0	0,12,123:4:0
+17	828	.	T	C,<X>	0	.	DP=25;I16=2,4,8,11,199,6917,656,23340,360,21600,1140,68400,116,2716,333,6931;QS=0.597777,2.40222,0;VDB=0.842082;SGB=-4.20907;RPB=0.950652;MQB=1;MQSB=1;BQB=0.929717;MQ0F=0	PL:DP:DV	211,0,35,217,65,255:12:10	116,0,91,128,106,213:9:5	120,12,0,120,12,120:4:4
+17	829	.	T	<X>	0	.	DP=24;I16=10,13,0,0,863,32931,0,0,1380,82800,0,0,418,8818,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,24,242:8:0	0,12,132:4:0
+17	830	.	C	<X>	0	.	DP=24;I16=10,14,0,0,910,34966,0,0,1440,86400,0,0,437,9267,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,24,220:8:0	0,12,134:4:0
+17	831	.	T	<X>	0	.	DP=24;I16=10,14,0,0,906,34886,0,0,1440,86400,0,0,431,9119,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,24,243:8:0	0,12,133:4:0
+17	832	.	C	<X>	0	.	DP=24;I16=10,14,0,0,888,33634,0,0,1440,86400,0,0,425,8999,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,24,220:8:0	0,12,123:4:0
+17	833	.	T	<X>	0	.	DP=25;I16=10,14,0,0,820,29920,0,0,1440,86400,0,0,418,8856,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,24,224:8:0	0,12,113:4:0
+17	834	.	G	A,<X>	0	.	DP=25;I16=2,3,7,10,164,5898,590,21124,300,18000,1020,61200,104,2296,305,6441;QS=0.520056,2.47994,0;VDB=0.788006;SGB=-4.01214;RPB=0.999233;MQB=1;MQSB=1;BQB=0.821668;MQ0F=0	PL:DP:DV	185,0,46,191,73,246:11:9	128,0,59,137,74,193:8:5	89,9,0,89,9,89:3:3
+17	835	.	T	<X>	0	.	DP=26;I16=9,15,0,0,767,26675,0,0,1440,86400,0,0,406,8652,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,240:12:0	0,24,213:8:0	0,12,98:4:0
+17	836	.	G	<X>	0	.	DP=23;I16=8,15,0,0,833,30561,0,0,1380,82800,0,0,403,8541,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,243:11:0	0,24,214:8:0	0,12,130:4:0
+17	837	.	T	<X>	0	.	DP=23;I16=8,15,0,0,843,31499,0,0,1380,82800,0,0,400,8456,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,241:11:0	0,24,221:8:0	0,12,143:4:0
+17	838	.	T	<X>	0	.	DP=23;I16=8,15,0,0,870,33172,0,0,1380,82800,0,0,397,8397,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,252:11:0	0,24,224:8:0	0,12,134:4:0
+17	839	.	G	<X>	0	.	DP=24;I16=8,15,0,0,862,32774,0,0,1380,82800,0,0,393,8315,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,249:11:0	0,24,212:8:0	0,12,142:4:0
+17	840	.	A	<X>	0	.	DP=25;I16=9,15,0,0,876,32682,0,0,1440,86400,0,0,375,7731,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,243:11:0	0,21,196:7:0	0,18,180:6:0
+17	841	.	T	<X>	0	.	DP=25;I16=9,16,0,0,861,30879,0,0,1500,90000,0,0,396,8260,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,213:11:0	0,24,226:8:0	0,18,185:6:0
+17	842	.	T	<X>	0	.	DP=24;I16=9,15,0,0,872,31990,0,0,1440,86400,0,0,393,8199,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,227:10:0	0,24,231:8:0	0,18,175:6:0
+17	843	.	C	<X>	0	.	DP=24;I16=9,15,0,0,844,30604,0,0,1440,86400,0,0,390,8172,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,228:10:0	0,24,229:8:0	0,18,160:6:0
+17	844	.	T	<X>	0	.	DP=24;I16=9,15,0,0,900,34094,0,0,1440,86400,0,0,386,8128,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,227:10:0	0,24,238:8:0	0,18,189:6:0
+17	845	.	G	<X>	0	.	DP=25;I16=10,15,0,0,916,33866,0,0,1500,90000,0,0,382,8116,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,239:10:0	0,24,225:8:0	0,21,196:7:0
+17	846	.	G	<X>	0	.	DP=24;I16=9,14,0,0,802,28414,0,0,1380,82800,0,0,354,7460,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,223:9:0	0,24,208:8:0	0,18,164:6:0
+17	847	.	T	<X>	0	.	DP=24;I16=8,15,0,0,809,29007,0,0,1380,82800,0,0,377,8083,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,210:9:0	0,24,219:8:0	0,18,149:6:0
+17	848	.	G	<X>	0	.	DP=23;I16=8,15,0,0,829,30351,0,0,1380,82800,0,0,384,8138,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,199:8:0	0,27,243:9:0	0,18,167:6:0
+17	849	.	G	<X>	0	.	DP=22;I16=8,12,0,0,684,23844,0,0,1200,72000,0,0,349,7517,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,18,160:6:0	0,27,233:9:0	0,15,140:5:0
+17	850	.	T	<X>	0	.	DP=21;I16=6,14,0,0,706,25508,0,0,1200,72000,0,0,360,7568,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,18,153:6:0	0,24,226:8:0	0,18,147:6:0
+17	851	.	G	<X>	0	.	DP=21;I16=7,14,0,0,707,24667,0,0,1260,75600,0,0,386,8254,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,18,140:6:0	0,27,233:9:0	0,18,156:6:0
+17	852	.	G	<X>	0	.	DP=21;I16=7,13,0,0,687,24223,0,0,1200,72000,0,0,368,7976,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,18,147:6:0	0,27,222:9:0	0,15,146:5:0
+17	853	.	A	<X>	0	.	DP=21;I16=7,14,0,0,721,25603,0,0,1260,75600,0,0,388,8442,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,18,146:6:0	0,27,223:9:0	0,18,166:6:0
+17	854	.	A	<X>	0	.	DP=21;I16=7,14,0,0,725,25843,0,0,1260,75600,0,0,389,8517,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,179:7:0	0,24,209:8:0	0,18,168:6:0
+17	855	.	A	<X>	0	.	DP=21;I16=7,14,0,0,683,23803,0,0,1260,75600,0,0,391,8611,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,171:7:0	0,24,204:8:0	0,18,152:6:0
+17	856	.	C	<X>	0	.	DP=21;I16=7,14,0,0,763,28293,0,0,1260,75600,0,0,392,8676,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,192:7:0	0,24,222:8:0	0,18,172:6:0
+17	857	.	A	<X>	0	.	DP=22;I16=8,14,0,0,786,28480,0,0,1320,79200,0,0,393,8763,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,182:7:0	0,24,220:8:0	0,21,194:7:0
+17	858	.	A	<X>	0	.	DP=22;I16=8,14,0,0,816,31358,0,0,1320,79200,0,0,395,8873,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,192:7:0	0,24,236:8:0	0,21,198:7:0
+17	859	.	G	<X>	0	.	DP=22;I16=8,14,0,0,824,31356,0,0,1320,79200,0,0,395,8907,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,202:7:0	0,24,223:8:0	0,21,203:7:0
+17	860	.	A	<X>	0	.	DP=22;I16=8,13,0,0,743,26985,0,0,1260,75600,0,0,369,8291,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,184:7:0	0,21,202:7:0	0,21,190:7:0
+17	861	.	C	<X>	0	.	DP=22;I16=8,14,0,0,770,28376,0,0,1320,79200,0,0,393,8899,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,206:8:0	0,24,216:8:0	0,18,161:6:0
+17	862	.	T	<X>	0	.	DP=22;I16=8,14,0,0,762,27500,0,0,1320,79200,0,0,393,8905,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,188:8:0	0,24,213:8:0	0,18,177:6:0
+17	863	.	G	<X>	0	.	DP=23;I16=9,14,0,0,836,30660,0,0,1380,82800,0,0,393,8935,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,228:9:0	0,24,221:8:0	0,18,180:6:0
+17	864	.	T	<X>	0	.	DP=22;I16=9,13,0,0,795,29085,0,0,1320,79200,0,0,395,8989,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,215:8:0	0,24,221:8:0	0,18,180:6:0
+17	865	.	C	<X>	0	.	DP=22;I16=8,14,0,0,785,28475,0,0,1320,79200,0,0,397,9015,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,227:9:0	0,21,193:7:0	0,18,177:6:0
+17	866	.	C	<X>	0	.	DP=21;I16=7,13,0,0,694,24890,0,0,1200,72000,0,0,395,8985,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,220:8:0	0,18,149:6:0	0,18,177:6:0
+17	867	.	C	<X>	0	.	DP=21;I16=7,14,0,0,761,28443,0,0,1260,75600,0,0,403,9023,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,223:9:0	0,18,182:6:0	0,18,187:6:0
+17	868	.	A	<X>	0	.	DP=21;I16=7,14,0,0,799,31183,0,0,1260,75600,0,0,406,9054,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,228:9:0	0,18,189:6:0	0,18,202:6:0
+17	869	.	G	<X>	0	.	DP=21;I16=7,14,0,0,795,30733,0,0,1260,75600,0,0,409,9103,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,236:9:0	0,18,190:6:0	0,18,187:6:0
+17	870	.	C	<X>	0	.	DP=21;I16=7,13,0,0,758,29080,0,0,1200,72000,0,0,403,9089,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,226:8:0	0,18,183:6:0	0,18,187:6:0
+17	871	.	C	<X>	0	.	DP=21;I16=7,14,0,0,769,29383,0,0,1260,75600,0,0,413,9155,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,232:9:0	0,18,176:6:0	0,18,192:6:0
+17	872	.	T	<X>	0	.	DP=21;I16=7,14,0,0,785,29879,0,0,1260,75600,0,0,413,9109,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,228:9:0	0,18,187:6:0	0,18,188:6:0
+17	873	.	G	<X>	0	.	DP=21;I16=7,14,0,0,768,28506,0,0,1260,75600,0,0,413,9083,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,233:9:0	0,18,172:6:0	0,18,182:6:0
+17	874	.	G	<X>	0	.	DP=21;I16=7,12,0,0,700,26434,0,0,1140,68400,0,0,374,8234,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,227:8:0	0,15,143:5:0	0,18,189:6:0
+17	875	.	G	<X>	0	.	DP=21;I16=7,14,0,0,717,25659,0,0,1260,75600,0,0,411,8995,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,227:9:0	0,18,163:6:0	0,18,159:6:0
+17	876	.	T	<X>	0	.	DP=21;I16=7,14,0,0,719,25261,0,0,1260,75600,0,0,410,8984,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,222:9:0	0,18,156:6:0	0,18,173:6:0
+17	877	.	G	<X>	0	.	DP=21;I16=7,14,0,0,747,27419,0,0,1260,75600,0,0,409,8995,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,235:9:0	0,18,162:6:0	0,18,176:6:0
+17	878	.	A	<X>	0	.	DP=21;I16=7,13,0,0,738,27650,0,0,1200,72000,0,0,391,8739,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,216:8:0	0,18,172:6:0	0,18,191:6:0
+17	879	.	T	<X>	0	.	DP=21;I16=7,13,0,0,731,26927,0,0,1200,72000,0,0,389,8759,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,214:8:0	0,18,175:6:0	0,18,184:6:0
+17	880	.	A	<X>	0	.	DP=21;I16=7,14,0,0,737,26481,0,0,1260,75600,0,0,405,9109,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,227:9:0	0,18,165:6:0	0,18,172:6:0
+17	881	.	C	<X>	0	.	DP=20;I16=7,13,0,0,742,27898,0,0,1200,72000,0,0,404,9154,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,231:8:0	0,18,164:6:0	0,18,183:6:0
+17	882	.	A	<X>	0	.	DP=20;I16=7,13,0,0,776,30564,0,0,1200,72000,0,0,403,9217,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,225:8:0	0,18,188:6:0	0,18,200:6:0
+17	883	.	G	<X>	0	.	DP=20;I16=7,13,0,0,702,25898,0,0,1200,72000,0,0,401,9247,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,214:8:0	0,18,175:6:0	0,18,176:6:0
+17	884	.	C	<X>	0	.	DP=19;I16=7,12,0,0,629,21449,0,0,1140,68400,0,0,400,9292,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,201:8:0	0,18,155:6:0	0,15,144:5:0
+17	885	.	G	<X>	0	.	DP=18;I16=7,11,0,0,605,20851,0,0,1080,64800,0,0,400,9350,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,215:8:0	0,15,140:5:0	0,15,130:5:0
+17	886	.	A	<X>	0	.	DP=18;I16=7,11,0,0,681,26145,0,0,1080,64800,0,0,400,9420,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,222:8:0	0,15,164:5:0	0,15,163:5:0
+17	887	.	G	<X>	0	.	DP=18;I16=7,11,0,0,631,22891,0,0,1080,64800,0,0,399,9451,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,222:8:0	0,15,138:5:0	0,15,149:5:0
+17	888	.	A	<X>	0	.	DP=18;I16=7,10,0,0,593,21563,0,0,1020,61200,0,0,373,8867,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,216:8:0	0,15,132:5:0	0,12,127:4:0
+17	889	.	C	<X>	0	.	DP=18;I16=7,11,0,0,624,22732,0,0,1080,64800,0,0,396,9492,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,213:8:0	0,15,134:5:0	0,15,160:5:0
+17	890	.	C	<X>	0	.	DP=19;I16=7,11,0,0,616,22426,0,0,1080,64800,0,0,368,8826,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,215:8:0	0,15,138:5:0	0,15,152:5:0
+17	891	.	C	<X>	0	.	DP=19;I16=7,11,0,0,661,24891,0,0,1080,64800,0,0,365,8745,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,227:8:0	0,15,141:5:0	0,15,165:5:0
+17	892	.	C	<X>	0	.	DP=19;I16=7,12,0,0,691,25761,0,0,1140,68400,0,0,387,9299,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,230:9:0	0,15,146:5:0	0,15,167:5:0
+17	893	.	A	<X>	0	.	DP=19;I16=7,12,0,0,673,24521,0,0,1140,68400,0,0,384,9238,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,221:9:0	0,15,142:5:0	0,15,166:5:0
+17	894	.	T	<X>	0	.	DP=19;I16=7,12,0,0,670,24268,0,0,1140,68400,0,0,380,9138,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,225:9:0	0,15,134:5:0	0,15,165:5:0
+17	895	.	C	<X>	0	.	DP=20;I16=8,12,0,0,712,26186,0,0,1200,72000,0,0,376,9050,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,248:10:0	0,15,149:5:0	0,15,162:5:0
+17	896	.	T	<X>	0	.	DP=19;I16=8,10,0,0,684,26696,0,0,1080,64800,0,0,348,8300,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,238:9:0	0,12,141:4:0	0,15,180:5:0
+17	897	.	C	<X>	0	.	DP=18;I16=8,10,0,0,693,27001,0,0,1080,64800,0,0,370,8764,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,255:9:0	0,12,131:4:0	0,15,166:5:0
+17	898	.	T	<X>	0	.	DP=18;I16=8,10,0,0,674,25656,0,0,1080,64800,0,0,367,8617,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,243:9:0	0,12,125:4:0	0,15,172:5:0
+17	899	.	A	<X>	0	.	DP=18;I16=9,8,0,0,597,21451,0,0,1020,61200,0,0,340,7858,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,239:9:0	0,9,99:3:0	0,15,145:5:0
+17	900	.	C	<X>	0	.	DP=18;I16=9,9,0,0,658,24550,0,0,1080,64800,0,0,364,8362,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,9,98:3:0	0,15,166:5:0
+17	901	.	C	<X>	0	.	DP=18;I16=9,9,0,0,680,26004,0,0,1080,64800,0,0,363,8255,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,9,99:3:0	0,15,169:5:0
+17	902	.	A	<X>	0	.	DP=18;I16=9,9,0,0,681,26253,0,0,1080,64800,0,0,362,8162,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,253:10:0	0,9,115:3:0	0,15,174:5:0
+17	903	.	A	<X>	0	.	DP=18;I16=9,8,0,0,645,24625,0,0,1020,61200,0,0,336,7458,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,250:9:0	0,9,101:3:0	0,15,171:5:0
+17	904	.	A	<X>	0	.	DP=18;I16=9,9,0,0,640,23412,0,0,1080,64800,0,0,359,7969,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,249:10:0	0,9,85:3:0	0,15,174:5:0
+17	905	.	A	<X>	0	.	DP=18;I16=9,9,0,0,675,25673,0,0,1080,64800,0,0,357,7871,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,9,103:3:0	0,15,172:5:0
+17	906	.	A	<X>	0	.	DP=18;I16=9,9,0,0,669,25193,0,0,1080,64800,0,0,355,7789,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,9,102:3:0	0,15,166:5:0
+17	907	.	A	<X>	0	.	DP=18;I16=9,9,0,0,661,24541,0,0,1080,64800,0,0,353,7723,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,9,94:3:0	0,15,165:5:0
+17	908	.	T	<X>	0	.	DP=18;I16=9,9,0,0,673,25579,0,0,1080,64800,0,0,351,7673,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,9,83:3:0	0,15,168:5:0
+17	909	.	T	<X>	0	.	DP=18;I16=9,9,0,0,653,23847,0,0,1080,64800,0,0,348,7590,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,9,95:3:0	0,15,161:5:0
+17	910	.	A	<X>	0	.	DP=18;I16=9,9,0,0,652,23790,0,0,1080,64800,0,0,344,7476,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,248:10:0	0,9,104:3:0	0,15,162:5:0
+17	911	.	A	<X>	0	.	DP=18;I16=9,9,0,0,688,26440,0,0,1080,64800,0,0,340,7382,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,9,109:3:0	0,15,168:5:0
+17	912	.	A	<X>	0	.	DP=18;I16=9,9,0,0,691,26705,0,0,1080,64800,0,0,336,7308,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,9,115:3:0	0,15,173:5:0
+17	913	.	A	<X>	0	.	DP=19;I16=9,10,0,0,692,25762,0,0,1140,68400,0,0,332,7254,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,9,109:3:0	0,15,171:5:0
+17	914	.	A	<X>	0	.	DP=19;I16=9,10,0,0,712,26966,0,0,1140,68400,0,0,329,7221,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,9,109:3:0	0,15,164:5:0
+17	915	.	T	<X>	0	.	DP=18;I16=9,9,0,0,638,23228,0,0,1080,64800,0,0,326,7160,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,247:10:0	0,9,99:3:0	0,15,163:5:0
+17	916	.	T	<X>	0	.	DP=19;I16=9,8,0,0,626,23136,0,0,1020,61200,0,0,296,6396,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,241:9:0	0,9,103:3:0	0,15,164:5:0
+17	917	.	A	<X>	0	.	DP=19;I16=9,10,0,0,726,27962,0,0,1117,66169,0,0,318,6908,0,0;QS=3,0;MQSB=0.934728;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,12,125:4:0	0,15,171:5:0
+17	918	.	G	<X>	0	.	DP=19;I16=9,10,0,0,688,25456,0,0,1117,66169,0,0,314,6818,0,0;QS=3,0;MQSB=0.934728;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,12,129:4:0	0,15,147:5:0
+17	919	.	C	<X>	0	.	DP=18;I16=8,10,0,0,672,25786,0,0,1057,62569,0,0,311,6751,0,0;QS=3,0;MQSB=0.938795;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,9,92:3:0	0,15,152:5:0
+17	920	.	T	<X>	0	.	DP=18;I16=8,10,0,0,681,26113,0,0,1057,62569,0,0,308,6706,0,0;QS=3,0;MQSB=0.938795;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,9,95:3:0	0,15,171:5:0
+17	921	.	G	<X>	0	.	DP=17;I16=7,10,0,0,617,22841,0,0,997,58969,0,0,304,6582,0,0;QS=3,0;MQSB=0.943335;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,6,47:2:0	0,15,164:5:0
+17	922	.	G	<X>	0	.	DP=16;I16=7,8,0,0,560,21156,0,0,877,51769,0,0,276,5852,0,0;QS=3,0;MQSB=0.921243;MQ0F=0	PL:DP:DV	0,24,243:8:0	0,6,64:2:0	0,15,151:5:0
+17	923	.	G	<X>	0	.	DP=16;I16=7,8,0,0,562,21350,0,0,877,51769,0,0,273,5765,0,0;QS=3,0;MQSB=0.921243;MQ0F=0	PL:DP:DV	0,24,245:8:0	0,6,65:2:0	0,15,144:5:0
+17	924	.	C	<X>	0	.	DP=16;I16=7,9,0,0,603,22955,0,0,937,55369,0,0,295,6321,0,0;QS=3,0;MQSB=0.933674;MQ0F=0	PL:DP:DV	0,27,255:9:0	0,6,57:2:0	0,15,157:5:0
+17	925	.	A	<X>	0	.	DP=16;I16=7,9,0,0,576,21618,0,0,937,55369,0,0,291,6219,0,0;QS=3,0;MQSB=0.933674;MQ0F=0	PL:DP:DV	0,27,244:9:0	0,6,58:2:0	0,15,163:5:0
+17	926	.	T	<X>	0	.	DP=16;I16=7,9,0,0,585,22015,0,0,937,55369,0,0,287,6133,0,0;QS=3,0;MQSB=0.933674;MQ0F=0	PL:DP:DV	0,27,241:9:0	0,6,63:2:0	0,15,161:5:0
+17	927	.	G	<X>	0	.	DP=17;I16=7,10,0,0,641,24481,0,0,997,58969,0,0,283,6063,0,0;QS=3,0;MQSB=0.943335;MQ0F=0	PL:DP:DV	0,27,255:9:0	0,9,82:3:0	0,15,158:5:0
+17	928	.	G	<X>	0	.	DP=17;I16=7,10,0,0,625,23195,0,0,997,58969,0,0,280,6010,0,0;QS=3,0;MQSB=0.943335;MQ0F=0	PL:DP:DV	0,27,255:9:0	0,9,84:3:0	0,15,150:5:0
+17	929	.	T	<X>	0	.	DP=16;I16=7,9,0,0,580,21580,0,0,937,55369,0,0,277,5925,0,0;QS=3,0;MQSB=0.933674;MQ0F=0	PL:DP:DV	0,27,248:9:0	0,9,79:3:0	0,12,128:4:0
+17	930	.	G	<X>	0	.	DP=16;I16=7,8,0,0,565,21561,0,0,877,51769,0,0,249,5233,0,0;QS=3,0;MQSB=0.921243;MQ0F=0	PL:DP:DV	0,24,247:8:0	0,9,82:3:0	0,12,127:4:0
+17	931	.	G	<X>	0	.	DP=16;I16=7,9,0,0,553,19935,0,0,937,55369,0,0,271,5809,0,0;QS=3,0;MQSB=0.933674;MQ0F=0	PL:DP:DV	0,27,244:9:0	0,9,80:3:0	0,12,113:4:0
+17	932	.	T	<X>	0	.	DP=16;I16=7,9,0,0,558,20128,0,0,937,55369,0,0,268,5778,0,0;QS=3,0;MQSB=0.933674;MQ0F=0	PL:DP:DV	0,27,229:9:0	0,9,89:3:0	0,12,122:4:0
+17	933	.	G	<X>	0	.	DP=16;I16=7,8,0,0,558,20926,0,0,877,51769,0,0,239,5091,0,0;QS=3,0;MQSB=0.921243;MQ0F=0	PL:DP:DV	0,24,241:8:0	0,9,94:3:0	0,12,116:4:0
+17	934	.	C	<X>	0	.	DP=15;I16=7,8,0,0,548,20256,0,0,877,51769,0,0,261,5673,0,0;QS=3,0;MQSB=0.921243;MQ0F=0	PL:DP:DV	0,27,244:9:0	0,9,83:3:0	0,9,99:3:0
+17	935	.	A	<X>	0	.	DP=15;I16=7,8,0,0,534,19780,0,0,846,49010,0,0,259,5647,0,0;QS=3,0;MQSB=0.720273;MQ0F=0	PL:DP:DV	0,27,233:9:0	0,9,86:3:0	0,9,101:3:0
+17	936	.	T	<X>	0	.	DP=15;I16=7,8,0,0,579,22499,0,0,846,49010,0,0,257,5589,0,0;QS=3,0;MQSB=0.720273;MQ0F=0	PL:DP:DV	0,27,252:9:0	0,9,91:3:0	0,9,100:3:0
+17	937	.	G	<X>	0	.	DP=16;I16=8,7,0,0,550,20650,0,0,846,49010,0,0,232,5022,0,0;QS=3,0;MQSB=0.651439;MQ0F=0	PL:DP:DV	0,24,228:8:0	0,9,84:3:0	0,12,115:4:0
+17	938	.	C	<X>	0	.	DP=16;I16=8,7,0,0,553,20669,0,0,846,49010,0,0,231,5001,0,0;QS=3,0;MQSB=0.651439;MQ0F=0	PL:DP:DV	0,24,234:8:0	0,9,77:3:0	0,12,119:4:0
+17	939	.	C	<X>	0	.	DP=16;I16=8,8,0,0,582,22100,0,0,906,52610,0,0,250,5392,0,0;QS=3,0;MQSB=0.702619;MQ0F=0	PL:DP:DV	0,27,255:9:0	0,9,71:3:0	0,12,115:4:0
+17	940	.	T	<X>	0	.	DP=15;I16=8,7,0,0,583,23339,0,0,846,49010,0,0,248,5320,0,0;QS=3,0;MQSB=0.651439;MQ0F=0	PL:DP:DV	0,27,252:9:0	0,6,71:2:0	0,12,124:4:0
+17	941	.	G	<X>	0	.	DP=14;I16=7,7,0,0,501,18707,0,0,786,45410,0,0,246,5216,0,0;QS=3,0;MQSB=0.714506;MQ0F=0	PL:DP:DV	0,27,240:9:0	0,6,59:2:0	0,9,93:3:0
+17	942	.	T	<X>	0	.	DP=14;I16=7,7,0,0,525,19799,0,0,786,45410,0,0,244,5128,0,0;QS=3,0;MQSB=0.714506;MQ0F=0	PL:DP:DV	0,27,237:9:0	0,6,70:2:0	0,9,94:3:0
+17	943	.	A	<X>	0	.	DP=14;I16=7,7,0,0,545,21399,0,0,786,45410,0,0,242,5056,0,0;QS=3,0;MQSB=0.714506;MQ0F=0	PL:DP:DV	0,27,248:9:0	0,6,71:2:0	0,9,93:3:0
+17	944	.	G	<X>	0	.	DP=14;I16=7,7,0,0,529,20143,0,0,786,45410,0,0,240,5000,0,0;QS=3,0;MQSB=0.714506;MQ0F=0	PL:DP:DV	0,27,249:9:0	0,6,65:2:0	0,9,95:3:0
+17	945	.	T	<X>	0	.	DP=14;I16=7,7,0,0,523,19621,0,0,786,45410,0,0,238,4960,0,0;QS=3,0;MQSB=0.714506;MQ0F=0	PL:DP:DV	0,27,239:9:0	0,6,70:2:0	0,9,95:3:0
+17	946	.	C	<X>	0	.	DP=13;I16=6,6,0,0,455,17581,0,0,666,38210,0,0,223,4739,0,0;QS=3,0;MQSB=0.660716;MQ0F=0	PL:DP:DV	0,24,240:8:0	0,6,56:2:0	0,6,70:2:0
+17	947	.	C	<X>	0	.	DP=14;I16=7,7,0,0,509,19007,0,0,755,42651,0,0,238,4928,0,0;QS=3,0;MQSB=0.925999;MQ0F=0	PL:DP:DV	0,27,251:9:0	0,9,83:3:0	0,6,66:2:0
+17	948	.	C	<X>	0	.	DP=14;I16=7,7,0,0,520,20050,0,0,755,42651,0,0,237,4887,0,0;QS=3,0;MQSB=0.925999;MQ0F=0	PL:DP:DV	0,27,254:9:0	0,9,78:3:0	0,6,69:2:0
+17	949	.	A	<X>	0	.	DP=15;I16=7,8,0,0,547,20705,0,0,815,46251,0,0,236,4864,0,0;QS=3,0;MQSB=0.959011;MQ0F=0	PL:DP:DV	0,30,250:10:0	0,9,90:3:0	0,6,72:2:0
+17	950	.	G	<X>	0	.	DP=15;I16=6,8,0,0,563,22871,0,0,786,45410,0,0,231,4835,0,0;QS=3,0;MQSB=0.740818;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,6,71:2:0	0,6,72:2:0
+17	951	.	C	<X>	0	.	DP=16;I16=7,8,0,0,554,21080,0,0,846,49010,0,0,230,4840,0,0;QS=3,0;MQSB=0.720273;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,6,65:2:0	0,6,73:2:0
+17	952	.	T	<X>	0	.	DP=16;I16=8,8,0,0,595,22565,0,0,875,49851,0,0,237,4913,0,0;QS=3,0;MQSB=0.934676;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,9,93:3:0	0,6,73:2:0
+17	953	.	A	<X>	0	.	DP=16;I16=8,8,0,0,567,20515,0,0,875,49851,0,0,237,4921,0,0;QS=3,0;MQSB=0.934676;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,9,91:3:0	0,6,69:2:0
+17	954	.	T	<X>	0	.	DP=15;I16=7,8,0,0,544,20412,0,0,815,46251,0,0,238,4948,0,0;QS=3,0;MQSB=0.959011;MQ0F=0	PL:DP:DV	0,30,249:10:0	0,9,94:3:0	0,6,69:2:0
+17	955	.	T	<X>	0	.	DP=15;I16=7,8,0,0,543,19953,0,0,815,46251,0,0,239,4993,0,0;QS=3,0;MQSB=0.959011;MQ0F=0	PL:DP:DV	0,30,246:10:0	0,9,95:3:0	0,6,68:2:0
+17	956	.	C	<X>	0	.	DP=15;I16=6,8,0,0,543,21255,0,0,786,45410,0,0,229,4935,0,0;QS=3,0;MQSB=0.740818;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,6,62:2:0	0,6,70:2:0
+17	957	.	A	<X>	0	.	DP=15;I16=7,8,0,0,504,17684,0,0,815,46251,0,0,241,5137,0,0;QS=3,0;MQSB=0.959011;MQ0F=0	PL:DP:DV	0,30,240:10:0	0,9,74:3:0	0,6,67:2:0
+17	958	.	C	<X>	0	.	DP=14;I16=6,8,0,0,505,18981,0,0,755,42651,0,0,243,5235,0,0;QS=3,0;MQSB=0.981425;MQ0F=0	PL:DP:DV	0,30,253:10:0	0,9,78:3:0	0,3,39:1:0
+17	959	.	A	<X>	0	.	DP=14;I16=5,8,0,0,519,20885,0,0,726,41810,0,0,231,5153,0,0;QS=3,0;MQSB=0.765017;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,6,72:2:0	0,3,38:1:0
+17	960	.	G	<X>	0	.	DP=15;I16=6,9,0,0,539,19901,0,0,815,46251,0,0,247,5479,0,0;QS=3,0;MQSB=0.99308;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,12,106:4:0	0,3,41:1:0
+17	961	.	T	<X>	0	.	DP=14;I16=6,8,0,0,523,19835,0,0,755,42651,0,0,250,5574,0,0;QS=3,0;MQSB=0.981425;MQ0F=0	PL:DP:DV	0,27,248:9:0	0,12,114:4:0	0,3,39:1:0
+17	962	.	G	<X>	0	.	DP=14;I16=5,8,0,0,498,19194,0,0,726,41810,0,0,236,5394,0,0;QS=3,0;MQSB=0.765017;MQ0F=0	PL:DP:DV	0,27,253:9:0	0,9,91:3:0	0,3,36:1:0
+17	963	.	C	<X>	0	.	DP=13;I16=5,8,0,0,500,19610,0,0,695,39051,0,0,256,5754,0,0;QS=3,0;MQSB=0.997325;MQ0F=0	PL:DP:DV	0,24,234:8:0	0,12,118:4:0	0,3,40:1:0
+17	964	.	T	<X>	0	.	DP=13;I16=5,8,0,0,512,20430,0,0,695,39051,0,0,259,5835,0,0;QS=3,0;MQSB=0.997325;MQ0F=0	PL:DP:DV	0,24,227:8:0	0,12,128:4:0	0,3,42:1:0
+17	965	.	G	<X>	0	.	DP=13;I16=4,8,0,0,467,18429,0,0,666,38210,0,0,241,5477,0,0;QS=3,0;MQSB=0.793923;MQ0F=0	PL:DP:DV	0,24,228:8:0	0,9,93:3:0	0,3,40:1:0
+17	966	.	A	<X>	0	.	DP=13;I16=4,8,0,0,443,16785,0,0,666,38210,0,0,242,5490,0,0;QS=3,0;MQSB=0.793923;MQ0F=0	PL:DP:DV	0,24,212:8:0	0,9,95:3:0	0,3,40:1:0
+17	967	.	G	<X>	0	.	DP=13;I16=4,8,0,0,464,18036,0,0,666,38210,0,0,243,5513,0,0;QS=3,0;MQSB=0.793923;MQ0F=0	PL:DP:DV	0,24,230:8:0	0,9,91:3:0	0,3,41:1:0
+17	968	.	G	<X>	0	.	DP=13;I16=4,8,0,0,441,16549,0,0,666,38210,0,0,244,5546,0,0;QS=3,0;MQSB=0.793923;MQ0F=0	PL:DP:DV	0,24,218:8:0	0,9,87:3:0	0,3,42:1:0
+17	969	.	T	<X>	0	.	DP=13;I16=4,8,0,0,450,16970,0,0,666,38210,0,0,245,5589,0,0;QS=3,0;MQSB=0.793923;MQ0F=0	PL:DP:DV	0,24,220:8:0	0,9,98:3:0	0,3,31:1:0
+17	970	.	G	<X>	0	.	DP=13;I16=4,7,0,0,413,15579,0,0,629,36841,0,0,220,4968,0,0;QS=3,0;MQSB=0.924449;MQ0F=0	PL:DP:DV	0,24,221:8:0	0,6,71:2:0	0,3,33:1:0
+17	971	.	G	<X>	0	.	DP=13;I16=4,8,0,0,459,17711,0,0,666,38210,0,0,245,5609,0,0;QS=3,0;MQSB=0.793923;MQ0F=0	PL:DP:DV	0,24,223:8:0	0,9,93:3:0	0,3,38:1:0
+17	972	.	G	<X>	0	.	DP=13;I16=4,8,0,0,446,17192,0,0,666,38210,0,0,245,5637,0,0;QS=3,0;MQSB=0.793923;MQ0F=0	PL:DP:DV	0,24,210:8:0	0,9,96:3:0	0,3,39:1:0
+17	973	.	A	<X>	0	.	DP=12;I16=4,7,0,0,402,15018,0,0,606,34610,0,0,246,5676,0,0;QS=3,0;MQSB=0.763675;MQ0F=0	PL:DP:DV	0,21,192:7:0	0,9,89:3:0	0,3,42:1:0
+17	974	.	A	<X>	0	.	DP=12;I16=4,7,0,0,417,16273,0,0,606,34610,0,0,247,5725,0,0;QS=3,0;MQSB=0.763675;MQ0F=0	PL:DP:DV	0,21,198:7:0	0,9,96:3:0	0,3,42:1:0
+17	975	.	G	<X>	0	.	DP=13;I16=4,8,0,0,454,17560,0,0,666,38210,0,0,247,5733,0,0;QS=3,0;MQSB=0.793923;MQ0F=0	PL:DP:DV	0,24,213:8:0	0,9,95:3:0	0,3,42:1:0
+17	976	.	A	<X>	0	.	DP=13;I16=4,8,0,0,431,16083,0,0,666,38210,0,0,248,5750,0,0;QS=3,0;MQSB=0.793923;MQ0F=0	PL:DP:DV	0,24,227:8:0	0,9,70:3:0	0,3,41:1:0
+17	977	.	T	<X>	0	.	DP=13;I16=4,8,0,0,438,16316,0,0,666,38210,0,0,248,5726,0,0;QS=3,0;MQSB=0.793923;MQ0F=0	PL:DP:DV	0,24,210:8:0	0,9,93:3:0	0,3,37:1:0
+17	978	.	G	<X>	0	.	DP=12;I16=4,8,0,0,430,16060,0,0,666,38210,0,0,248,5710,0,0;QS=3,0;MQSB=0.793923;MQ0F=0	PL:DP:DV	0,24,224:8:0	0,9,75:3:0	0,3,40:1:0
+17	979	.	C	<X>	0	.	DP=13;I16=4,8,0,0,453,17461,0,0,689,40441,0,0,223,5077,0,0;QS=3,0;MQSB=0.94394;MQ0F=0	PL:DP:DV	0,27,232:9:0	0,6,72:2:0	0,3,41:1:0
+17	980	.	T	<X>	0	.	DP=13;I16=4,8,0,0,438,16412,0,0,689,40441,0,0,224,5078,0,0;QS=3,0;MQSB=0.94394;MQ0F=0	PL:DP:DV	0,27,220:9:0	0,6,76:2:0	0,3,43:1:0
+17	981	.	T	<X>	0	.	DP=13;I16=4,9,0,0,484,18602,0,0,726,41810,0,0,250,5714,0,0;QS=3,0;MQSB=0.826565;MQ0F=0	PL:DP:DV	0,27,224:9:0	0,9,97:3:0	0,3,41:1:0
+17	982	.	G	<X>	0	.	DP=14;I16=4,10,0,0,520,20128,0,0,786,45410,0,0,250,5686,0,0;QS=3,0;MQSB=0.852144;MQ0F=0	PL:DP:DV	0,30,237:10:0	0,9,99:3:0	0,3,40:1:0
+17	983	.	A	<X>	0	.	DP=14;I16=4,10,0,0,570,23360,0,0,786,45410,0,0,251,5671,0,0;QS=3,0;MQSB=0.852144;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,9,101:3:0	0,3,42:1:0
+17	984	.	G	<X>	0	.	DP=15;I16=4,10,0,0,529,20459,0,0,786,45410,0,0,252,5670,0,0;QS=3,0;MQSB=0.852144;MQ0F=0	PL:DP:DV	0,30,253:10:0	0,9,88:3:0	0,3,43:1:0
+17	985	.	C	<X>	0	.	DP=17;I16=4,13,0,0,580,20280,0,0,966,56210,0,0,261,5747,0,0;QS=3,0;MQSB=0.90252;MQ0F=0	PL:DP:DV	0,33,246:11:0	0,12,100:4:0	0,6,65:2:0
+17	986	.	C	A,<X>	0	.	DP=17;I16=3,12,0,1,519,18353,13,169,846,49010,60,3600,235,5101,4,16;QS=2.95873,0.0412698,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.921781;BQB=1;MQ0F=0	PL:DP:DV	0,16,197,27,200,201:10:1	0,12,108,12,108,108:4:0	0,6,69,6,69,69:2:0
+17	987	.	C	<X>	0	.	DP=17;I16=4,13,0,0,634,23914,0,0,966,56210,0,0,267,5755,0,0;QS=3,0;MQSB=0.90252;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,107:4:0	0,6,69:2:0
+17	988	.	A	<X>	0	.	DP=17;I16=4,13,0,0,633,24341,0,0,966,56210,0,0,269,5737,0,0;QS=3,0;MQSB=0.90252;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,111:4:0	0,6,82:2:0
+17	989	.	G	<X>	0	.	DP=17;I16=4,13,0,0,635,24149,0,0,966,56210,0,0,271,5739,0,0;QS=3,0;MQSB=0.90252;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,114:4:0	0,6,80:2:0
+17	990	.	G	<X>	0	.	DP=16;I16=4,12,0,0,591,22177,0,0,906,52610,0,0,274,5760,0,0;QS=3,0;MQSB=0.88901;MQ0F=0	PL:DP:DV	0,30,246:10:0	0,12,105:4:0	0,6,83:2:0
+17	991	.	A	<X>	0	.	DP=16;I16=3,11,0,0,548,21542,0,0,809,47641,0,0,227,4549,0,0;QS=3,0;MQSB=0.973096;MQ0F=0	PL:DP:DV	0,27,232:9:0	0,9,100:3:0	0,6,80:2:0
+17	992	.	G	<X>	0	.	DP=16;I16=4,12,0,0,562,20436,0,0,906,52610,0,0,278,5760,0,0;QS=3,0;MQSB=0.88901;MQ0F=0	PL:DP:DV	0,30,240:10:0	0,12,102:4:0	0,6,76:2:0
+17	993	.	T	<X>	0	.	DP=16;I16=4,12,0,0,564,20752,0,0,906,52610,0,0,280,5790,0,0;QS=3,0;MQSB=0.88901;MQ0F=0	PL:DP:DV	0,30,222:10:0	0,12,121:4:0	0,6,73:2:0
+17	994	.	T	<X>	0	.	DP=17;I16=5,11,0,0,597,22625,0,0,906,52610,0,0,270,5696,0,0;QS=3,0;MQSB=0.851779;MQ0F=0	PL:DP:DV	0,27,227:9:0	0,12,123:4:0	0,9,103:3:0
+17	995	.	C	<X>	0	.	DP=16;I16=4,11,0,0,588,23228,0,0,846,49010,0,0,273,5741,0,0;QS=3,0;MQSB=0.872525;MQ0F=0	PL:DP:DV	0,24,216:8:0	0,12,119:4:0	0,9,110:3:0
+17	996	.	A	<X>	0	.	DP=16;I16=4,12,0,0,562,20416,0,0,906,52610,0,0,290,6000,0,0;QS=3,0;MQSB=0.88901;MQ0F=0	PL:DP:DV	0,27,207:9:0	0,12,107:4:0	0,9,113:3:0
+17	997	.	A	<X>	0	.	DP=16;I16=4,12,0,0,600,23520,0,0,906,52610,0,0,294,6110,0,0;QS=3,0;MQSB=0.88901;MQ0F=0	PL:DP:DV	0,27,209:9:0	0,12,123:4:0	0,9,121:3:0
+17	998	.	G	<X>	0	.	DP=17;I16=4,13,0,0,603,22299,0,0,966,56210,0,0,298,6240,0,0;QS=3,0;MQSB=0.90252;MQ0F=0	PL:DP:DV	0,30,226:10:0	0,12,99:4:0	0,9,115:3:0
+17	999	.	G	<X>	0	.	DP=17;I16=4,12,0,0,575,21519,0,0,906,52610,0,0,302,6390,0,0;QS=3,0;MQSB=0.88901;MQ0F=0	PL:DP:DV	0,27,202:9:0	0,12,118:4:0	0,9,111:3:0
+17	1000	.	C	<X>	0	.	DP=17;I16=4,13,0,0,637,24465,0,0,966,56210,0,0,308,6564,0,0;QS=3,0;MQSB=0.90252;MQ0F=0	PL:DP:DV	0,30,235:10:0	0,12,118:4:0	0,9,109:3:0
+17	1001	.	T	<X>	0	.	DP=17;I16=4,13,0,0,647,24907,0,0,966,56210,0,0,312,6708,0,0;QS=3,0;MQSB=0.90252;MQ0F=0	PL:DP:DV	0,30,228:10:0	0,12,120:4:0	0,9,122:3:0
+17	1002	.	G	<X>	0	.	DP=17;I16=4,13,0,0,627,23691,0,0,966,56210,0,0,316,6872,0,0;QS=3,0;MQSB=0.90252;MQ0F=0	PL:DP:DV	0,30,220:10:0	0,12,123:4:0	0,9,109:3:0
+17	1003	.	C	T,<X>	0	.	DP=18;I16=4,13,0,1,633,23953,22,484,966,56210,60,3600,297,6515,21,441;QS=2.9375,0.0625,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.913725;BQB=1;MQ0F=0	PL:DP:DV	0,8,207,27,211,220:10:1	0,15,132,15,132,132:5:0	0,9,102,9,102,102:3:0
+17	1004	.	A	<X>	0	.	DP=19;I16=5,14,0,0,653,23107,0,0,1086,63410,0,0,321,7061,0,0;QS=3,0;MQSB=0.898397;MQ0F=0	PL:DP:DV	0,33,231:11:0	0,15,131:5:0	0,9,98:3:0
+17	1005	.	A	<X>	0	.	DP=19;I16=5,14,0,0,670,24380,0,0,1086,63410,0,0,324,7138,0,0;QS=3,0;MQSB=0.898397;MQ0F=0	PL:DP:DV	0,33,231:11:0	0,15,132:5:0	0,9,113:3:0
+17	1006	.	T	<X>	0	.	DP=19;I16=4,14,0,0,659,24869,0,0,1026,59810,0,0,327,7237,0,0;QS=3,0;MQSB=0.913725;MQ0F=0	PL:DP:DV	0,30,220:10:0	0,15,134:5:0	0,9,115:3:0
+17	1007	.	G	<X>	0	.	DP=18;I16=4,13,0,0,651,25373,0,0,966,56210,0,0,306,6732,0,0;QS=3,0;MQSB=0.90252;MQ0F=0	PL:DP:DV	0,27,225:9:0	0,15,138:5:0	0,9,113:3:0
+17	1008	.	A	<X>	0	.	DP=18;I16=4,13,0,0,667,27041,0,0,966,56210,0,0,309,6821,0,0;QS=3,0;MQSB=0.90252;MQ0F=0	PL:DP:DV	0,27,222:9:0	0,15,147:5:0	0,9,118:3:0
+17	1009	.	G	<X>	0	.	DP=18;I16=4,13,0,0,635,24431,0,0,966,56210,0,0,312,6928,0,0;QS=3,0;MQSB=0.90252;MQ0F=0	PL:DP:DV	0,27,213:9:0	0,15,139:5:0	0,9,116:3:0
+17	1010	.	C	<X>	0	.	DP=18;I16=4,14,0,0,661,25289,0,0,1026,59810,0,0,339,7629,0,0;QS=3,0;MQSB=0.913725;MQ0F=0	PL:DP:DV	0,30,234:10:0	0,15,126:5:0	0,9,114:3:0
+17	1011	.	T	<X>	0	.	DP=18;I16=4,14,0,0,671,25325,0,0,1026,59810,0,0,339,7623,0,0;QS=3,0;MQSB=0.913725;MQ0F=0	PL:DP:DV	0,30,226:10:0	0,15,131:5:0	0,9,118:3:0
+17	1012	.	A	<X>	0	.	DP=19;I16=5,14,0,0,639,22891,0,0,1063,61179,0,0,339,7633,0,0;QS=3,0;MQSB=0.990403;MQ0F=0	PL:DP:DV	0,30,201:10:0	0,18,154:6:0	0,9,113:3:0
+17	1013	.	T	<X>	0	.	DP=18;I16=5,12,0,0,623,23913,0,0,943,53979,0,0,325,7385,0,0;QS=3,0;MQSB=0.998612;MQ0F=0	PL:DP:DV	0,24,202:8:0	0,18,161:6:0	0,9,115:3:0
+17	1014	.	G	<X>	0	.	DP=18;I16=5,13,0,0,656,24596,0,0,1003,57579,0,0,341,7605,0,0;QS=3,0;MQSB=0.995153;MQ0F=0	PL:DP:DV	0,27,218:9:0	0,18,159:6:0	0,9,113:3:0
+17	1015	.	A	<X>	0	.	DP=18;I16=5,13,0,0,646,23878,0,0,1003,57579,0,0,342,7618,0,0;QS=3,0;MQSB=0.995153;MQ0F=0	PL:DP:DV	0,27,209:9:0	0,18,164:6:0	0,9,109:3:0
+17	1016	.	T	<X>	0	.	DP=17;I16=4,12,0,0,588,22114,0,0,929,54841,0,0,340,7632,0,0;QS=3,0;MQSB=0.971017;MQ0F=0	PL:DP:DV	0,27,212:9:0	0,12,124:4:0	0,9,101:3:0
+17	1017	.	T	<X>	0	.	DP=18;I16=5,13,0,0,635,23433,0,0,1026,59810,0,0,346,7694,0,0;QS=3,0;MQSB=0.942222;MQ0F=0	PL:DP:DV	0,27,213:9:0	0,18,155:6:0	0,9,105:3:0
+17	1018	.	G	<X>	0	.	DP=18;I16=5,13,0,0,650,24550,0,0,1026,59810,0,0,349,7757,0,0;QS=3,0;MQSB=0.942222;MQ0F=0	PL:DP:DV	0,27,215:9:0	0,18,179:6:0	0,9,91:3:0
+17	1019	.	C	<X>	0	.	DP=18;I16=5,12,0,0,555,18561,0,0,966,56210,0,0,327,7213,0,0;QS=3,0;MQSB=0.951229;MQ0F=0	PL:DP:DV	0,24,181:8:0	0,18,143:6:0	0,9,104:3:0
+17	1020	.	G	<X>	0	.	DP=19;I16=6,12,0,0,625,22287,0,0,1026,59810,0,0,332,7402,0,0;QS=3,0;MQSB=0.97296;MQ0F=0	PL:DP:DV	0,27,228:9:0	0,18,157:6:0	0,9,87:3:0
+17	1021	.	C	<X>	0	.	DP=19;I16=5,13,0,0,625,22761,0,0,1026,59810,0,0,332,7326,0,0;QS=3,0;MQSB=0.942222;MQ0F=0	PL:DP:DV	0,27,220:9:0	0,18,153:6:0	0,9,92:3:0
+17	1022	.	C	<X>	0	.	DP=19;I16=6,13,0,0,727,27975,0,0,1086,63410,0,0,360,8034,0,0;QS=3,0;MQSB=0.965977;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,18,168:6:0	0,9,110:3:0
+17	1023	.	A	<X>	0	.	DP=19;I16=6,12,0,0,647,23997,0,0,1026,59810,0,0,338,7510,0,0;QS=3,0;MQSB=0.97296;MQ0F=0	PL:DP:DV	0,27,216:9:0	0,18,168:6:0	0,9,112:3:0
+17	1024	.	C	<X>	0	.	DP=20;I16=7,13,0,0,729,27471,0,0,1146,67010,0,0,364,8154,0,0;QS=3,0;MQSB=0.980568;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,169:6:0	0,9,106:3:0
+17	1025	.	T	<X>	0	.	DP=20;I16=7,13,0,0,757,29387,0,0,1146,67010,0,0,366,8192,0,0;QS=3,0;MQSB=0.980568;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,181:6:0	0,9,117:3:0
+17	1026	.	G	<X>	0	.	DP=20;I16=7,13,0,0,747,28435,0,0,1146,67010,0,0,367,8201,0,0;QS=3,0;MQSB=0.980568;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,169:6:0	0,9,113:3:0
+17	1027	.	C	<X>	0	.	DP=20;I16=7,13,0,0,720,26688,0,0,1146,67010,0,0,368,8232,0,0;QS=3,0;MQSB=0.980568;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,145:6:0	0,9,110:3:0
+17	1028	.	A	<X>	0	.	DP=19;I16=6,12,0,0,645,23681,0,0,1026,59810,0,0,348,7800,0,0;QS=3,0;MQSB=0.97296;MQ0F=0	PL:DP:DV	0,30,238:10:0	0,15,146:5:0	0,9,99:3:0
+17	1029	.	C	<X>	0	.	DP=19;I16=7,12,0,0,699,26817,0,0,1086,63410,0,0,371,8305,0,0;QS=3,0;MQSB=0.985816;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,138:5:0	0,9,111:3:0
+17	1030	.	T	<X>	0	.	DP=19;I16=7,12,0,0,749,29789,0,0,1086,63410,0,0,371,8293,0,0;QS=3,0;MQSB=0.985816;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,158:5:0	0,9,122:3:0
+17	1031	.	T	<X>	0	.	DP=21;I16=9,12,0,0,748,27726,0,0,1206,70610,0,0,371,8297,0,0;QS=3,0;MQSB=0.997478;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,144:5:0	0,9,113:3:0
+17	1032	.	T	<X>	0	.	DP=21;I16=9,12,0,0,761,28033,0,0,1206,70610,0,0,373,8319,0,0;QS=3,0;MQSB=0.997478;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,156:5:0	0,9,111:3:0
+17	1033	.	G	<X>	0	.	DP=22;I16=10,12,0,0,773,28227,0,0,1266,74210,0,0,375,8361,0,0;QS=3,0;MQSB=0.999457;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,18,169:6:0	0,9,101:3:0
+17	1034	.	G	<X>	0	.	DP=22;I16=8,12,0,0,703,25617,0,0,1169,69241,0,0,340,7684,0,0;QS=3,0;MQSB=0.953497;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,149:5:0	0,9,102:3:0
+17	1035	.	C	<X>	0	.	DP=21;I16=10,11,0,0,719,26103,0,0,1237,73369,0,0,382,8508,0,0;QS=3,0;MQSB=0.927743;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,163:6:0	0,9,94:3:0
+17	1036	.	C	<X>	0	.	DP=22;I16=11,10,0,0,756,28390,0,0,1237,73369,0,0,360,7938,0,0;QS=3,0;MQSB=0.939898;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,175:6:0	0,12,135:4:0
+17	1037	.	T	<X>	0	.	DP=22;I16=11,11,0,0,839,32737,0,0,1297,76969,0,0,389,8641,0,0;QS=3,0;MQSB=0.936864;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,188:6:0	0,12,138:4:0
+17	1038	.	G	<X>	0	.	DP=21;I16=10,10,0,0,752,28750,0,0,1177,69769,0,0,368,8066,0,0;QS=3,0;MQSB=0.931063;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,184:6:0	0,9,107:3:0
+17	1039	.	G	<X>	0	.	DP=21;I16=10,11,0,0,775,29373,0,0,1237,73369,0,0,397,8761,0,0;QS=3,0;MQSB=0.927743;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,189:6:0	0,9,111:3:0
+17	1040	.	A	<X>	0	.	DP=21;I16=10,11,0,0,759,28007,0,0,1237,73369,0,0,401,8851,0,0;QS=3,0;MQSB=0.927743;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,177:6:0	0,9,107:3:0
+17	1041	.	C	<X>	0	.	DP=21;I16=8,11,0,0,713,27117,0,0,1140,68400,0,0,371,8255,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,155:5:0	0,9,110:3:0
+17	1042	.	A	<X>	0	.	DP=23;I16=12,10,0,0,800,29464,0,0,1297,76969,0,0,384,8466,0,0;QS=3,0;MQSB=0.947103;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,185:6:0	0,15,145:5:0
+17	1043	.	A	<X>	0	.	DP=23;I16=12,11,0,0,850,32160,0,0,1357,80569,0,0,414,9192,0,0;QS=3,0;MQSB=0.944319;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,188:6:0	0,15,159:5:0
+17	1044	.	C	<X>	0	.	DP=23;I16=12,10,0,0,812,30758,0,0,1297,76969,0,0,394,8690,0,0;QS=3,0;MQSB=0.947103;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,181:6:0	0,15,150:5:0
+17	1045	.	A	<X>	0	.	DP=23;I16=12,11,0,0,887,34519,0,0,1357,80569,0,0,424,9460,0,0;QS=3,0;MQSB=0.944319;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,197:6:0	0,15,156:5:0
+17	1046	.	G	<X>	0	.	DP=23;I16=12,11,0,0,862,33240,0,0,1357,80569,0,0,428,9576,0,0;QS=3,0;MQSB=0.944319;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,183:6:0	0,15,158:5:0
+17	1047	.	A	<X>	0	.	DP=23;I16=12,11,0,0,890,34804,0,0,1357,80569,0,0,432,9712,0,0;QS=3,0;MQSB=0.944319;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,198:6:0	0,15,165:5:0
+17	1048	.	G	<X>	0	.	DP=23;I16=12,10,0,0,846,33054,0,0,1297,76969,0,0,411,9243,0,0;QS=3,0;MQSB=0.947103;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,195:6:0	0,15,156:5:0
+17	1049	.	C	<X>	0	.	DP=22;I16=12,10,0,0,808,30644,0,0,1297,76969,0,0,441,10043,0,0;QS=3,0;MQSB=0.947103;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,182:6:0	0,15,160:5:0
+17	1050	.	A	<X>	0	.	DP=22;I16=11,10,0,0,808,31334,0,0,1237,73369,0,0,430,9940,0,0;QS=3,0;MQSB=0.939898;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,193:6:0	0,12,138:4:0
+17	1051	.	A	<X>	0	.	DP=21;I16=11,9,0,0,731,27495,0,0,1177,69769,0,0,423,9621,0,0;QS=3,0;MQSB=0.943233;MQ0F=0	PL:DP:DV	0,27,238:9:0	0,18,187:6:0	0,15,150:5:0
+17	1052	.	A	<X>	0	.	DP=21;I16=11,9,0,0,759,29327,0,0,1177,69769,0,0,427,9747,0,0;QS=3,0;MQSB=0.943233;MQ0F=0	PL:DP:DV	0,27,247:9:0	0,18,190:6:0	0,15,150:5:0
+17	1053	.	A	<X>	0	.	DP=21;I16=11,8,0,0,674,25210,0,0,1117,66169,0,0,406,9264,0,0;QS=3,0;MQSB=0.946915;MQ0F=0	PL:DP:DV	0,24,224:8:0	0,18,161:6:0	0,15,149:5:0
+17	1054	.	C	<X>	0	.	DP=21;I16=11,10,0,0,791,30157,0,0,1237,73369,0,0,459,10623,0,0;QS=3,0;MQSB=0.939898;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,18,189:6:0	0,15,153:5:0
+17	1055	.	C	<X>	0	.	DP=22;I16=12,10,0,0,818,31448,0,0,1297,76969,0,0,462,10750,0,0;QS=3,0;MQSB=0.947103;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,191:6:0	0,15,157:5:0
+17	1056	.	C	<X>	0	.	DP=22;I16=12,9,0,0,793,31265,0,0,1237,73369,0,0,441,10271,0,0;QS=3,0;MQSB=0.950149;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,18,195:6:0	0,15,161:5:0
+17	1057	.	T	<X>	0	.	DP=23;I16=12,10,0,0,821,31667,0,0,1297,76969,0,0,467,10911,0,0;QS=3,0;MQSB=0.947103;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,196:6:0	0,15,159:5:0
+17	1058	.	G	<X>	0	.	DP=23;I16=12,11,0,0,863,32871,0,0,1357,80569,0,0,493,11569,0,0;QS=3,0;MQSB=0.944319;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,21,197:7:0	0,15,155:5:0
+17	1059	.	T	<X>	0	.	DP=23;I16=12,10,0,0,797,29803,0,0,1297,76969,0,0,468,10944,0,0;QS=3,0;MQSB=0.947103;MQ0F=0	PL:DP:DV	0,30,249:10:0	0,21,202:7:0	0,15,152:5:0
+17	1060	.	C	<X>	0	.	DP=23;I16=12,11,0,0,829,31041,0,0,1357,80569,0,0,492,11536,0,0;QS=3,0;MQSB=0.944319;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,21,178:7:0	0,15,163:5:0
+17	1061	.	T	<X>	0	.	DP=22;I16=12,9,0,0,810,31840,0,0,1237,73369,0,0,465,10797,0,0;QS=3,0;MQSB=0.950149;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,175:5:0	0,15,158:5:0
+17	1062	.	C	A,<X>	0	.	DP=22;I16=12,9,0,1,826,32780,33,1089,1237,73369,60,3600,462,10652,25,625;QS=2.85398,0.146018,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.947103;BQB=1;MQ0F=0	PL:DP:DV	0,33,255,33,255,255:11:0	15,0,151,30,154,176:6:1	0,15,164,15,164,164:5:0
+17	1063	.	T	<X>	0	.	DP=22;I16=12,9,0,0,820,32460,0,0,1237,73369,0,0,459,10525,0,0;QS=3,0;MQSB=0.950149;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,18,183:6:0	0,15,166:5:0
+17	1064	.	A	<X>	0	.	DP=23;I16=12,9,0,0,793,30355,0,0,1237,73369,0,0,464,10752,0,0;QS=3,0;MQSB=0.950149;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,18,180:6:0	0,15,162:5:0
+17	1065	.	A	<X>	0	.	DP=23;I16=12,9,0,0,814,31978,0,0,1237,73369,0,0,462,10694,0,0;QS=3,0;MQSB=0.950149;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,18,186:6:0	0,15,174:5:0
+17	1066	.	A	<X>	0	.	DP=27;I16=15,9,0,0,890,34378,0,0,1417,84169,0,0,460,10652,0,0;QS=3,0;MQSB=0.96464;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,21,198:7:0	0,18,181:6:0
+17	1067	.	A	<X>	0	.	DP=27;I16=15,10,0,0,913,35031,0,0,1477,87769,0,0,470,10600,0,0;QS=3,0;MQSB=0.962269;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,21,208:7:0	0,18,182:6:0
+17	1068	.	A	<X>	0	.	DP=27;I16=15,9,0,0,898,34580,0,0,1417,84169,0,0,456,10342,0,0;QS=3,0;MQSB=0.96464;MQ0F=0	PL:DP:DV	0,30,253:10:0	0,24,218:8:0	0,18,181:6:0
+17	1069	.	A	<X>	0	.	DP=28;I16=16,10,0,0,914,33888,0,0,1537,91369,0,0,481,10925,0,0;QS=3,0;MQSB=0.965874;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,24,207:8:0	0,21,177:7:0
+17	1070	.	A	<X>	0	.	DP=28;I16=15,11,0,0,955,36445,0,0,1537,91369,0,0,467,10351,0,0;QS=3,0;MQSB=0.960078;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,24,223:8:0	0,21,188:7:0
+17	1071	.	G	<X>	0	.	DP=28;I16=16,10,0,0,974,37570,0,0,1537,91369,0,0,466,10284,0,0;QS=3,0;MQSB=0.965874;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,21,192:7:0	0,21,191:7:0
+17	1072	.	A	<X>	0	.	DP=28;I16=16,11,0,0,1007,38205,0,0,1597,94969,0,0,490,10868,0,0;QS=3,0;MQSB=0.96384;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,24,239:8:0	0,21,195:7:0
+17	1073	.	A	<X>	0	.	DP=28;I16=16,10,0,0,976,37822,0,0,1537,91369,0,0,463,10177,0,0;QS=3,0;MQSB=0.965874;MQ0F=0	PL:DP:DV	0,33,254:11:0	0,24,236:8:0	0,21,199:7:0
+17	1074	.	A	<X>	0	.	DP=28;I16=16,11,0,0,1003,38097,0,0,1597,94969,0,0,484,10664,0,0;QS=3,0;MQSB=0.96384;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,24,232:8:0	0,21,203:7:0
+17	1075	.	A	<X>	0	.	DP=28;I16=16,10,0,0,964,36762,0,0,1537,91369,0,0,476,10564,0,0;QS=3,0;MQSB=0.965874;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,24,222:8:0	0,21,200:7:0
+17	1076	.	G	<X>	0	.	DP=28;I16=16,10,0,0,966,37048,0,0,1537,91369,0,0,476,10536,0,0;QS=3,0;MQSB=0.965874;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,24,209:8:0	0,21,183:7:0
+17	1077	.	A	<X>	0	.	DP=29;I16=17,11,0,0,1038,39240,0,0,1657,98569,0,0,480,10548,0,0;QS=3,0;MQSB=0.967085;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,24,231:8:0	0,24,209:8:0
+17	1078	.	A	<X>	0	.	DP=29;I16=17,11,0,0,1053,40425,0,0,1657,98569,0,0,480,10562,0,0;QS=3,0;MQSB=0.967085;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,24,234:8:0	0,24,214:8:0
+17	1079	.	A	<X>	0	.	DP=28;I16=17,10,0,0,1019,39007,0,0,1597,94969,0,0,479,10505,0,0;QS=3,0;MQSB=0.968979;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,24,223:8:0	0,24,206:8:0
+17	1080	.	A	<X>	0	.	DP=29;I16=18,10,0,0,1049,40827,0,0,1657,98569,0,0,478,10478,0,0;QS=3,0;MQSB=0.971673;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,27,246:9:0	0,24,218:8:0
+17	1081	.	G	<X>	0	.	DP=30;I16=19,8,0,0,988,37392,0,0,1597,94969,0,0,436,9550,0,0;QS=3,0;MQSB=0.977696;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,24,210:8:0	0,27,210:9:0
+17	1082	.	A	<X>	0	.	DP=30;I16=20,7,0,0,989,37109,0,0,1597,94969,0,0,438,9564,0,0;QS=3,0;MQSB=0.981425;MQ0F=0	PL:DP:DV	0,27,224:9:0	0,27,226:9:0	0,27,217:9:0
+17	1083	.	A	<X>	0	.	DP=30;I16=20,8,0,0,1039,39827,0,0,1657,98569,0,0,455,9803,0,0;QS=3,0;MQSB=0.979523;MQ0F=0	PL:DP:DV	0,30,246:10:0	0,27,233:9:0	0,27,217:9:0
+17	1084	.	A	<X>	0	.	DP=31;I16=21,8,0,0,1049,39097,0,0,1717,102169,0,0,457,9849,0,0;QS=3,0;MQSB=0.981133;MQ0F=0	PL:DP:DV	0,33,253:11:0	0,27,226:9:0	0,27,215:9:0
+17	1085	.	A	<X>	0	.	DP=30;I16=21,8,0,0,1052,39534,0,0,1717,102169,0,0,486,10552,0,0;QS=3,0;MQSB=0.981133;MQ0F=0	PL:DP:DV	0,30,232:10:0	0,30,247:10:0	0,27,214:9:0
+17	1086	.	A	<X>	0	.	DP=28;I16=21,6,0,0,969,36223,0,0,1597,94969,0,0,492,10660,0,0;QS=3,0;MQSB=0.98481;MQ0F=0	PL:DP:DV	0,30,219:10:0	0,27,236:9:0	0,24,179:8:0
+17	1087	.	C	<X>	0	.	DP=28;I16=22,6,0,0,984,36046,0,0,1657,98569,0,0,498,10796,0,0;QS=3,0;MQSB=0.985992;MQ0F=0	PL:DP:DV	0,30,234:10:0	0,27,229:9:0	0,27,173:9:0
+17	1088	.	T	<X>	0	.	DP=29;I16=23,6,0,0,1133,45203,0,0,1717,102169,0,0,503,10863,0,0;QS=3,0;MQSB=0.987041;MQ0F=0	PL:DP:DV	0,30,252:10:0	0,30,250:10:0	0,27,198:9:0
+17	1089	.	C	<X>	0	.	DP=29;I16=23,6,0,0,1093,42347,0,0,1717,102169,0,0,509,10965,0,0;QS=3,0;MQSB=0.987041;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,30,237:10:0	0,27,188:9:0
+17	1090	.	A	<X>	0	.	DP=29;I16=23,6,0,0,1061,39845,0,0,1717,102169,0,0,515,11103,0,0;QS=3,0;MQSB=0.987041;MQ0F=0	PL:DP:DV	0,30,221:10:0	0,30,250:10:0	0,27,183:9:0
+17	1091	.	C	<X>	0	.	DP=29;I16=23,6,0,0,1063,39713,0,0,1717,102169,0,0,521,11277,0,0;QS=3,0;MQSB=0.987041;MQ0F=0	PL:DP:DV	0,30,247:10:0	0,30,244:10:0	0,27,177:9:0
+17	1092	.	T	<X>	0	.	DP=29;I16=23,6,0,0,1121,44489,0,0,1717,102169,0,0,524,11334,0,0;QS=3,0;MQSB=0.987041;MQ0F=0	PL:DP:DV	0,30,244:10:0	0,30,251:10:0	0,27,198:9:0
+17	1093	.	G	<X>	0	.	DP=29;I16=23,6,0,0,1085,41377,0,0,1717,102169,0,0,526,11372,0,0;QS=3,0;MQSB=0.987041;MQ0F=0	PL:DP:DV	0,30,249:10:0	0,30,243:10:0	0,27,184:9:0
+17	1094	.	G	<X>	0	.	DP=29;I16=22,6,0,0,1018,38808,0,0,1657,98569,0,0,521,11393,0,0;QS=3,0;MQSB=0.985992;MQ0F=0	PL:DP:DV	0,30,243:10:0	0,30,232:10:0	0,24,185:8:0
+17	1095	.	A	<X>	0	.	DP=28;I16=22,6,0,0,1023,38551,0,0,1657,98569,0,0,529,11443,0,0;QS=3,0;MQSB=0.985992;MQ0F=0	PL:DP:DV	0,30,236:10:0	0,30,244:10:0	0,24,178:8:0
+17	1096	.	T	<X>	0	.	DP=30;I16=24,5,0,0,1020,37168,0,0,1717,102169,0,0,505,10849,0,0;QS=3,0;MQSB=0.989637;MQ0F=0	PL:DP:DV	0,33,234:11:0	0,27,220:9:0	0,27,178:9:0
+17	1097	.	A	<X>	0	.	DP=30;I16=24,6,0,0,1056,38166,0,0,1777,105769,0,0,533,11537,0,0;QS=3,0;MQSB=0.987976;MQ0F=0	PL:DP:DV	0,33,230:11:0	0,30,237:10:0	0,27,177:9:0
+17	1098	.	T	<X>	0	.	DP=29;I16=24,5,0,0,1081,40557,0,0,1717,102169,0,0,537,11633,0,0;QS=3,0;MQSB=0.989637;MQ0F=0	PL:DP:DV	0,30,210:10:0	0,30,251:10:0	0,27,186:9:0
+17	1099	.	G	<X>	0	.	DP=29;I16=24,5,0,0,1091,41719,0,0,1717,102169,0,0,540,11712,0,0;QS=3,0;MQSB=0.989637;MQ0F=0	PL:DP:DV	0,30,229:10:0	0,30,242:10:0	0,27,182:9:0
+17	1100	.	A	<X>	0	.	DP=29;I16=24,5,0,0,1106,42976,0,0,1717,102169,0,0,543,11825,0,0;QS=3,0;MQSB=0.989637;MQ0F=0	PL:DP:DV	0,30,210:10:0	0,30,255:10:0	0,27,191:9:0
+17	1101	.	A	<X>	0	.	DP=29;I16=24,5,0,0,1154,46420,0,0,1717,102169,0,0,545,11921,0,0;QS=3,0;MQSB=0.989637;MQ0F=0	PL:DP:DV	0,30,222:10:0	0,30,255:10:0	0,27,198:9:0
+17	1102	.	T	<X>	0	.	DP=29;I16=24,4,0,0,1046,39520,0,0,1657,98569,0,0,522,11424,0,0;QS=3,0;MQSB=0.991416;MQ0F=0	PL:DP:DV	0,30,210:10:0	0,27,233:9:0	0,27,186:9:0
+17	1103	.	G	<X>	0	.	DP=30;I16=24,6,0,0,1134,43486,0,0,1777,105769,0,0,548,12158,0,0;QS=3,0;MQSB=0.987976;MQ0F=0	PL:DP:DV	0,30,223:10:0	0,30,255:10:0	0,30,222:10:0
+17	1104	.	A	<X>	0	.	DP=28;I16=23,5,0,0,1089,43067,0,0,1657,98569,0,0,552,12296,0,0;QS=3,0;MQSB=0.988819;MQ0F=0	PL:DP:DV	0,27,213:9:0	0,27,233:9:0	0,30,233:10:0
+17	1105	.	T	<X>	0	.	DP=28;I16=23,5,0,0,1035,38743,0,0,1657,98569,0,0,556,12462,0,0;QS=3,0;MQSB=0.988819;MQ0F=0	PL:DP:DV	0,27,203:9:0	0,27,227:9:0	0,30,222:10:0
+17	1106	.	A	<X>	0	.	DP=29;I16=23,5,0,0,1003,36715,0,0,1657,98569,0,0,532,11882,0,0;QS=3,0;MQSB=0.988819;MQ0F=0	PL:DP:DV	0,30,227:10:0	0,24,198:8:0	0,30,217:10:0
+17	1107	.	C	<X>	0	.	DP=29;I16=23,6,0,0,1093,41509,0,0,1717,102169,0,0,558,12532,0,0;QS=3,0;MQSB=0.987041;MQ0F=0	PL:DP:DV	0,30,244:10:0	0,27,233:9:0	0,30,220:10:0
+17	1108	.	A	<X>	0	.	DP=29;I16=23,6,0,0,1138,44908,0,0,1717,102169,0,0,558,12536,0,0;QS=3,0;MQSB=0.987041;MQ0F=0	PL:DP:DV	0,30,239:10:0	0,27,253:9:0	0,30,227:10:0
+17	1109	.	G	<X>	0	.	DP=29;I16=23,6,0,0,1140,45200,0,0,1717,102169,0,0,557,12519,0,0;QS=3,0;MQSB=0.987041;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,27,240:9:0	0,30,224:10:0
+17	1110	.	G	<X>	0	.	DP=29;I16=23,6,0,0,1086,41054,0,0,1717,102169,0,0,555,12481,0,0;QS=3,0;MQSB=0.987041;MQ0F=0	PL:DP:DV	0,30,242:10:0	0,27,229:9:0	0,30,224:10:0
+17	1111	.	T	<X>	0	.	DP=29;I16=22,6,0,0,1025,37919,0,0,1680,100800,0,0,552,12470,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,227:10:0	0,24,227:8:0	0,30,211:10:0
+17	1112	.	T	<X>	0	.	DP=28;I16=22,6,0,0,1034,38986,0,0,1680,100800,0,0,550,12440,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,226:10:0	0,24,221:8:0	0,30,221:10:0
+17	1113	.	G	<X>	0	.	DP=28;I16=23,5,0,0,1085,42273,0,0,1680,100800,0,0,548,12386,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,21,202:7:0	0,33,222:11:0
+17	1114	.	A	<X>	0	.	DP=28;I16=23,5,0,0,1079,42279,0,0,1680,100800,0,0,546,12306,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,235:10:0	0,21,209:7:0	0,33,238:11:0
+17	1115	.	G	<X>	0	.	DP=28;I16=23,5,0,0,1114,44550,0,0,1680,100800,0,0,544,12250,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,21,208:7:0	0,33,234:11:0
+17	1116	.	G	<X>	0	.	DP=29;I16=24,5,0,0,1059,39531,0,0,1740,104400,0,0,542,12218,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,236:10:0	0,24,204:8:0	0,33,226:11:0
+17	1117	.	A	<X>	0	.	DP=29;I16=24,5,0,0,1124,43896,0,0,1740,104400,0,0,541,12211,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,235:10:0	0,24,227:8:0	0,33,234:11:0
+17	1118	.	T	<X>	0	.	DP=29;I16=24,4,0,0,1100,44802,0,0,1680,100800,0,0,539,12131,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,230:10:0	0,21,188:7:0	0,33,248:11:0
+17	1119	.	C	<X>	0	.	DP=29;I16=23,4,0,0,1078,44864,0,0,1620,97200,0,0,526,11958,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,224:9:0	0,21,191:7:0	0,33,255:11:0
+17	1120	.	C	<X>	0	.	DP=29;I16=23,5,0,0,1113,46071,0,0,1680,100800,0,0,536,12054,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,227:9:0	0,24,214:8:0	0,33,255:11:0
+17	1121	.	A	<X>	0	.	DP=30;I16=24,5,0,0,1167,48549,0,0,1740,104400,0,0,536,12056,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,233:9:0	0,24,220:8:0	0,36,255:12:0
+17	1122	.	T	<X>	0	.	DP=32;I16=26,5,0,0,1235,50967,0,0,1860,111600,0,0,535,11985,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,230:10:0	0,27,238:9:0	0,36,255:12:0
+17	1123	.	T	<X>	0	.	DP=32;I16=26,5,0,0,1219,50121,0,0,1860,111600,0,0,535,11893,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,221:10:0	0,27,236:9:0	0,36,255:12:0
+17	1124	.	A	<X>	0	.	DP=31;I16=25,5,0,0,1187,48827,0,0,1800,108000,0,0,536,11832,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,218:9:0	0,27,235:9:0	0,36,255:12:0
+17	1125	.	T	<X>	0	.	DP=31;I16=25,5,0,0,1211,51001,0,0,1800,108000,0,0,537,11801,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,228:9:0	0,27,235:9:0	0,36,255:12:0
+17	1126	.	C	<X>	0	.	DP=31;I16=25,5,0,0,1225,52001,0,0,1800,108000,0,0,538,11800,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,234:9:0	0,27,241:9:0	0,36,255:12:0
+17	1127	.	T	<X>	0	.	DP=31;I16=25,5,0,0,1257,55245,0,0,1800,108000,0,0,539,11829,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,231:9:0	0,27,252:9:0	0,36,255:12:0
+17	1128	.	G	<X>	0	.	DP=31;I16=25,5,0,0,1217,51743,0,0,1800,108000,0,0,540,11888,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,236:9:0	0,27,229:9:0	0,36,255:12:0
+17	1129	.	A	G,<X>	0	.	DP=31;I16=24,4,0,1,1101,45631,32,1024,1680,100800,60,3600,514,11300,25,625;QS=2.93535,0.0646465,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=1;BQB=1;MQ0F=0	PL:DP:DV	0,24,204,24,204,204:8:0	0,27,229,27,229,229:9:0	0,4,198,33,201,219:12:1
+17	1130	.	A	<X>	0	.	DP=31;I16=25,5,0,0,1189,49509,0,0,1800,108000,0,0,539,11943,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,215:9:0	0,27,236:9:0	0,36,255:12:0
+17	1131	.	A	<X>	0	.	DP=29;I16=23,5,0,0,1156,49362,0,0,1680,100800,0,0,540,11988,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,206:7:0	0,27,250:9:0	0,36,255:12:0
+17	1132	.	T	<X>	0	.	DP=29;I16=23,5,0,0,1123,47359,0,0,1680,100800,0,0,540,12008,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,198:7:0	0,27,229:9:0	0,36,255:12:0
+17	1133	.	G	<X>	0	.	DP=30;I16=23,5,0,0,1148,48796,0,0,1680,100800,0,0,540,12052,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,214:7:0	0,27,232:9:0	0,36,255:12:0
+17	1134	.	C	<X>	0	.	DP=29;I16=22,6,0,0,1162,50224,0,0,1680,100800,0,0,547,12155,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,209:7:0	0,27,254:9:0	0,36,255:12:0
+17	1135	.	T	<X>	0	.	DP=29;I16=22,6,0,0,1214,55020,0,0,1680,100800,0,0,549,12257,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,209:7:0	0,27,255:9:0	0,36,255:12:0
+17	1136	.	T	<X>	0	.	DP=29;I16=22,6,0,0,1148,49270,0,0,1680,100800,0,0,551,12383,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,200:7:0	0,27,255:9:0	0,36,255:12:0
+17	1137	.	G	<X>	0	.	DP=28;I16=21,6,0,0,1087,46051,0,0,1620,97200,0,0,554,12532,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,214:7:0	0,27,234:9:0	0,33,254:11:0
+17	1138	.	G	<X>	0	.	DP=28;I16=21,6,0,0,1040,42504,0,0,1620,97200,0,0,557,12703,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,197:7:0	0,27,234:9:0	0,33,246:11:0
+17	1139	.	A	<X>	0	.	DP=28;I16=21,6,0,0,1103,47389,0,0,1620,97200,0,0,559,12845,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,200:7:0	0,27,254:9:0	0,33,255:11:0
+17	1140	.	C	<X>	0	.	DP=28;I16=21,6,0,0,1072,44372,0,0,1620,97200,0,0,561,13007,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,214:7:0	0,27,234:9:0	0,33,250:11:0
+17	1141	.	C	<X>	0	.	DP=28;I16=21,6,0,0,1106,47298,0,0,1620,97200,0,0,562,13140,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,212:7:0	0,27,245:9:0	0,33,255:11:0
+17	1142	.	A	<X>	0	.	DP=28;I16=21,6,0,0,1114,47788,0,0,1620,97200,0,0,560,13146,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,212:7:0	0,27,255:9:0	0,33,251:11:0
+17	1143	.	G	<X>	0	.	DP=26;I16=19,7,0,0,1041,42249,0,0,1560,93600,0,0,585,13799,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,222:7:0	0,27,249:9:0	0,30,253:10:0
+17	1144	.	A	<X>	0	.	DP=26;I16=19,7,0,0,1018,40154,0,0,1560,93600,0,0,585,13847,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,205:7:0	0,27,250:9:0	0,30,255:10:0
+17	1145	.	T	<X>	0	.	DP=26;I16=19,7,0,0,1016,39852,0,0,1560,93600,0,0,584,13866,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,206:7:0	0,27,250:9:0	0,30,249:10:0
+17	1146	.	G	<X>	0	.	DP=26;I16=19,7,0,0,1011,39743,0,0,1560,93600,0,0,582,13856,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,210:7:0	0,27,246:9:0	0,30,254:10:0
+17	1147	.	T	<X>	0	.	DP=27;I16=20,6,0,0,1010,39730,0,0,1560,93600,0,0,579,13815,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,207:8:0	0,24,234:8:0	0,30,255:10:0
+17	1148	.	T	<X>	0	.	DP=26;I16=20,6,0,0,1002,39214,0,0,1560,93600,0,0,576,13690,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,196:8:0	0,24,237:8:0	0,30,255:10:0
+17	1149	.	T	<X>	0	.	DP=26;I16=20,6,0,0,1022,40532,0,0,1560,93600,0,0,573,13579,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,205:8:0	0,24,231:8:0	0,30,255:10:0
+17	1150	.	T	<X>	0	.	DP=26;I16=20,6,0,0,1032,41212,0,0,1560,93600,0,0,569,13433,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,208:8:0	0,24,236:8:0	0,30,255:10:0
+17	1151	.	G	<X>	0	.	DP=26;I16=20,6,0,0,1021,40285,0,0,1560,93600,0,0,565,13303,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,220:8:0	0,24,231:8:0	0,30,248:10:0
+17	1152	.	A	<X>	0	.	DP=27;I16=20,7,0,0,1040,40772,0,0,1620,97200,0,0,561,13189,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,202:8:0	0,24,230:8:0	0,33,255:11:0
+17	1153	.	A	<X>	0	.	DP=27;I16=20,7,0,0,1039,40717,0,0,1620,97200,0,0,557,13043,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,202:8:0	0,24,233:8:0	0,33,255:11:0
+17	1154	.	T	<X>	0	.	DP=28;I16=21,7,0,0,1073,41861,0,0,1680,100800,0,0,552,12866,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,212:9:0	0,24,236:8:0	0,33,255:11:0
+17	1155	.	T	<X>	0	.	DP=27;I16=20,7,0,0,1074,43046,0,0,1620,97200,0,0,549,12707,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,211:8:0	0,24,236:8:0	0,33,255:11:0
+17	1156	.	T	<X>	0	.	DP=28;I16=19,8,0,0,1065,42533,0,0,1620,97200,0,0,520,11892,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,210:8:0	0,24,239:8:0	0,33,255:11:0
+17	1157	.	T	<X>	0	.	DP=28;I16=20,8,0,0,1094,43108,0,0,1680,100800,0,0,541,12299,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,230:9:0	0,24,230:8:0	0,33,255:11:0
+17	1158	.	G	<X>	0	.	DP=28;I16=20,8,0,0,1098,43584,0,0,1680,100800,0,0,536,12056,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,240:9:0	0,24,224:8:0	0,33,255:11:0
+17	1159	.	G	<X>	0	.	DP=28;I16=20,8,0,0,1096,43222,0,0,1680,100800,0,0,530,11790,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,249:9:0	0,24,229:8:0	0,33,255:11:0
+17	1160	.	A	<X>	0	.	DP=30;I16=20,10,0,0,1146,44510,0,0,1800,108000,0,0,524,11552,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,229:9:0	0,24,242:8:0	0,39,255:13:0
+17	1161	.	T	<X>	0	.	DP=30;I16=20,10,0,0,1136,43548,0,0,1800,108000,0,0,520,11344,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,221:9:0	0,24,230:8:0	0,39,255:13:0
+17	1162	.	T	<X>	0	.	DP=30;I16=20,10,0,0,1147,44365,0,0,1800,108000,0,0,516,11168,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,232:9:0	0,24,229:8:0	0,39,255:13:0
+17	1163	.	T	<X>	0	.	DP=31;I16=20,11,0,0,1176,45394,0,0,1860,111600,0,0,511,10975,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,243:10:0	0,24,231:8:0	0,39,255:13:0
+17	1164	.	T	<X>	0	.	DP=31;I16=20,11,0,0,1166,44864,0,0,1860,111600,0,0,506,10768,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,235:10:0	0,24,234:8:0	0,39,255:13:0
+17	1165	.	T	<X>	0	.	DP=31;I16=20,11,0,0,1189,46635,0,0,1860,111600,0,0,501,10599,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,240:10:0	0,24,231:8:0	0,39,255:13:0
+17	1166	.	T	<X>	0	.	DP=30;I16=19,11,0,0,1137,43791,0,0,1800,108000,0,0,497,10467,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,231:9:0	0,24,228:8:0	0,39,255:13:0
+17	1167	.	C	<X>	0	.	DP=28;I16=17,11,0,0,1114,44588,0,0,1680,100800,0,0,495,10369,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,255:9:0	0,21,216:7:0	0,36,255:12:0
+17	1168	.	A	<X>	0	.	DP=28;I16=17,11,0,0,1074,41862,0,0,1680,100800,0,0,493,10303,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,238:9:0	0,21,203:7:0	0,36,255:12:0
+17	1169	.	T	<X>	0	.	DP=28;I16=17,11,0,0,1089,42589,0,0,1680,100800,0,0,491,10269,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,247:9:0	0,21,212:7:0	0,36,255:12:0
+17	1170	.	A	<X>	0	.	DP=27;I16=16,11,0,0,1033,39891,0,0,1620,97200,0,0,490,10266,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,244:9:0	0,21,214:7:0	0,33,255:11:0
+17	1171	.	T	<X>	0	.	DP=28;I16=17,11,0,0,1086,42472,0,0,1680,100800,0,0,488,10244,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,249:9:0	0,24,223:8:0	0,33,255:11:0
+17	1172	.	T	<X>	0	.	DP=28;I16=17,11,0,0,1086,42598,0,0,1680,100800,0,0,486,10206,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,235:9:0	0,24,228:8:0	0,33,255:11:0
+17	1173	.	T	<X>	0	.	DP=29;I16=18,11,0,0,1126,44348,0,0,1740,104400,0,0,483,10153,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,241:9:0	0,27,241:9:0	0,33,255:11:0
+17	1174	.	T	<X>	0	.	DP=29;I16=18,11,0,0,1098,42352,0,0,1740,104400,0,0,481,10135,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,230:9:0	0,27,238:9:0	0,33,255:11:0
+17	1175	.	G	<X>	0	.	DP=28;I16=18,10,0,0,1063,40975,0,0,1680,100800,0,0,480,10152,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,234:8:0	0,27,234:9:0	0,33,255:11:0
+17	1176	.	T	<X>	0	.	DP=28;I16=18,10,0,0,1045,39823,0,0,1680,100800,0,0,479,10203,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,221:8:0	0,27,233:9:0	0,33,255:11:0
+17	1177	.	A	<X>	0	.	DP=28;I16=18,10,0,0,1040,39006,0,0,1680,100800,0,0,478,10288,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,220:8:0	0,27,228:9:0	0,33,255:11:0
+17	1178	.	A	<X>	0	.	DP=27;I16=17,10,0,0,1006,38238,0,0,1620,97200,0,0,477,10355,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,221:8:0	0,27,227:9:0	0,30,255:10:0
+17	1179	.	T	<X>	0	.	DP=27;I16=17,10,0,0,1012,38396,0,0,1620,97200,0,0,475,10403,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,223:8:0	0,27,224:9:0	0,30,255:10:0
+17	1180	.	C	<X>	0	.	DP=27;I16=16,10,0,0,1006,39508,0,0,1560,93600,0,0,469,10423,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,222:7:0	0,27,224:9:0	0,30,255:10:0
+17	1181	.	T	<X>	0	.	DP=26;I16=16,10,0,0,1021,40581,0,0,1560,93600,0,0,469,10441,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,236:8:0	0,24,229:8:0	0,30,255:10:0
+17	1182	.	T	<X>	0	.	DP=26;I16=14,11,0,0,939,35915,0,0,1500,90000,0,0,457,10347,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,236:9:0	0,21,209:7:0	0,27,255:9:0
+17	1183	.	T	<X>	0	.	DP=25;I16=13,11,0,0,899,34555,0,0,1440,86400,0,0,455,10341,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,239:9:0	0,18,192:6:0	0,27,255:9:0
+17	1184	.	G	<X>	0	.	DP=24;I16=13,11,0,0,916,35398,0,0,1440,86400,0,0,465,10479,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,234:8:0	0,21,201:7:0	0,27,255:9:0
+17	1185	.	C	<X>	0	.	DP=24;I16=13,11,0,0,908,35014,0,0,1440,86400,0,0,465,10541,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,246:8:0	0,21,191:7:0	0,27,250:9:0
+17	1186	.	A	<X>	0	.	DP=24;I16=13,11,0,0,946,37648,0,0,1440,86400,0,0,463,10525,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,240:8:0	0,21,205:7:0	0,27,255:9:0
+17	1187	.	G	<X>	0	.	DP=25;I16=14,11,0,0,908,33870,0,0,1500,90000,0,0,461,10529,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,240:9:0	0,21,205:7:0	0,27,240:9:0
+17	1188	.	T	<X>	0	.	DP=25;I16=14,11,0,0,886,32138,0,0,1500,90000,0,0,461,10553,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,248:10:0	0,21,196:7:0	0,24,216:8:0
+17	1189	.	A	<X>	0	.	DP=25;I16=14,11,0,0,920,34392,0,0,1500,90000,0,0,461,10497,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,18,174:6:0	0,27,252:9:0
+17	1190	.	T	<X>	0	.	DP=26;I16=14,12,0,0,960,35876,0,0,1560,93600,0,0,462,10462,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,185:6:0	0,27,252:9:0
+17	1191	.	A	<X>	0	.	DP=26;I16=14,12,0,0,928,33922,0,0,1560,93600,0,0,464,10450,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,173:6:0	0,27,245:9:0
+17	1192	.	T	<X>	0	.	DP=26;I16=14,12,0,0,981,37505,0,0,1560,93600,0,0,465,10413,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,191:6:0	0,27,255:9:0
+17	1193	.	T	<X>	0	.	DP=26;I16=14,12,0,0,976,37054,0,0,1560,93600,0,0,466,10402,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,191:6:0	0,27,255:9:0
+17	1194	.	T	<X>	0	.	DP=26;I16=14,12,0,0,951,35219,0,0,1560,93600,0,0,466,10368,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,178:6:0	0,27,249:9:0
+17	1195	.	A	<X>	0	.	DP=26;I16=14,12,0,0,917,33253,0,0,1560,93600,0,0,466,10362,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,177:6:0	0,27,235:9:0
+17	1196	.	C	<X>	0	.	DP=25;I16=13,12,0,0,921,34209,0,0,1500,90000,0,0,466,10334,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,18,187:6:0	0,27,236:9:0
+17	1197	.	C	<X>	0	.	DP=24;I16=12,12,0,0,906,34862,0,0,1440,86400,0,0,464,10184,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,18,186:6:0	0,24,233:8:0
+17	1198	.	A	<X>	0	.	DP=24;I16=12,12,0,0,937,36815,0,0,1440,86400,0,0,461,10013,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,18,190:6:0	0,24,245:8:0
+17	1199	.	G	<X>	0	.	DP=24;I16=12,12,0,0,879,33035,0,0,1440,86400,0,0,457,9821,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,18,163:6:0	0,24,221:8:0
+17	1200	.	T	<X>	0	.	DP=24;I16=11,12,0,0,895,35141,0,0,1380,82800,0,0,428,9032,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,15,176:5:0	0,24,247:8:0
+17	1201	.	T	<X>	0	.	DP=24;I16=12,12,0,0,889,33727,0,0,1440,86400,0,0,449,9521,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,18,177:6:0	0,24,238:8:0
+17	1202	.	C	<X>	0	.	DP=25;I16=13,12,0,0,929,35121,0,0,1500,90000,0,0,445,9413,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,175:6:0	0,24,230:8:0
+17	1203	.	A	<X>	0	.	DP=25;I16=13,12,0,0,943,36107,0,0,1500,90000,0,0,442,9334,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,184:6:0	0,24,241:8:0
+17	1204	.	G	<X>	0	.	DP=24;I16=13,11,0,0,876,33106,0,0,1440,86400,0,0,439,9235,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,174:6:0	0,21,218:7:0
+17	1205	.	C	<X>	0	.	DP=24;I16=13,11,0,0,891,33869,0,0,1440,86400,0,0,436,9166,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,176:6:0	0,21,217:7:0
+17	1206	.	A	<X>	0	.	DP=23;I16=13,10,0,0,846,31744,0,0,1380,82800,0,0,434,9126,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,18,179:6:0	0,21,212:7:0
+17	1207	.	T	<X>	0	.	DP=23;I16=13,9,0,0,819,30877,0,0,1320,79200,0,0,407,8489,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,254:10:0	0,18,189:6:0	0,18,194:6:0
+17	1208	.	C	<X>	0	.	DP=24;I16=14,10,0,0,910,35236,0,0,1440,86400,0,0,429,9079,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,21,190:7:0	0,21,217:7:0
+17	1209	.	C	T,<X>	0	.	DP=24;I16=14,9,0,1,869,33481,21,441,1380,82800,60,3600,408,8710,19,361;QS=2.91393,0.0860656,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=1;BQB=1;MQ0F=0	PL:DP:DV	0,30,255,30,255,255:10:0	0,0,153,18,156,166:7:1	0,21,209,21,209,209:7:0
+17	1210	.	C	<X>	0	.	DP=24;I16=14,10,0,0,915,35713,0,0,1440,86400,0,0,425,9091,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,21,199:7:0	0,21,209:7:0
+17	1211	.	T	<X>	0	.	DP=24;I16=14,10,0,0,905,34669,0,0,1440,86400,0,0,423,9139,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,21,213:7:0	0,21,214:7:0
+17	1212	.	A	<X>	0	.	DP=24;I16=14,10,0,0,850,30690,0,0,1440,86400,0,0,421,9215,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,246:10:0	0,21,190:7:0	0,21,204:7:0
+17	1213	.	A	<X>	0	.	DP=24;I16=14,10,0,0,852,31192,0,0,1440,86400,0,0,418,9268,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,253:10:0	0,21,197:7:0	0,21,195:7:0
+17	1214	.	C	<X>	0	.	DP=23;I16=13,10,0,0,851,32099,0,0,1380,82800,0,0,415,9295,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,21,186:7:0	0,18,184:6:0
+17	1215	.	T	<X>	0	.	DP=23;I16=13,9,0,0,839,32475,0,0,1320,79200,0,0,386,8668,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,21,211:7:0	0,15,172:5:0
+17	1216	.	C	<X>	0	.	DP=23;I16=13,10,0,0,863,32923,0,0,1380,82800,0,0,406,9260,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,21,196:7:0	0,18,172:6:0
+17	1217	.	A	<X>	0	.	DP=22;I16=12,10,0,0,820,30926,0,0,1320,79200,0,0,402,9244,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,18,172:6:0	0,18,191:6:0
+17	1218	.	A	<X>	0	.	DP=22;I16=12,10,0,0,764,27286,0,0,1320,79200,0,0,398,9244,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,18,145:6:0	0,18,184:6:0
+17	1219	.	A	<X>	0	.	DP=21;I16=12,9,0,0,803,31119,0,0,1260,75600,0,0,395,9259,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,18,175:6:0	0,15,173:5:0
+17	1220	.	A	<X>	0	.	DP=21;I16=12,9,0,0,752,27700,0,0,1260,75600,0,0,392,9288,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,253:10:0	0,18,167:6:0	0,15,167:5:0
+17	1221	.	A	<X>	0	.	DP=20;I16=12,8,0,0,722,26564,0,0,1200,72000,0,0,390,9330,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,15,147:5:0	0,15,157:5:0
+17	1222	.	T	<X>	0	.	DP=18;I16=10,8,0,0,666,25034,0,0,1080,64800,0,0,389,9333,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,245:9:0	0,15,143:5:0	0,12,142:4:0
+17	1223	.	T	<X>	0	.	DP=17;I16=9,7,0,0,574,21262,0,0,960,57600,0,0,364,8720,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,232:9:0	0,12,122:4:0	0,9,120:3:0
+17	1224	.	C	<X>	0	.	DP=19;I16=10,7,0,0,639,24429,0,0,1020,61200,0,0,364,8740,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,12,128:4:0	0,9,112:3:0
+17	1225	.	A	<X>	0	.	DP=19;I16=10,9,0,0,713,27139,0,0,1109,65641,0,0,395,9419,0,0;QS=3,0;MQSB=0.920044;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,15,137:5:0	0,12,145:4:0
+17	1226	.	A	<X>	0	.	DP=19;I16=10,9,0,0,688,25468,0,0,1109,65641,0,0,397,9469,0,0;QS=3,0;MQSB=0.920044;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,15,127:5:0	0,12,147:4:0
+17	1227	.	A	<X>	0	.	DP=19;I16=10,9,0,0,698,26104,0,0,1109,65641,0,0,399,9531,0,0;QS=3,0;MQSB=0.920044;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,15,133:5:0	0,12,146:4:0
+17	1228	.	A	<X>	0	.	DP=19;I16=10,9,0,0,705,26721,0,0,1109,65641,0,0,399,9505,0,0;QS=3,0;MQSB=0.920044;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,15,143:5:0	0,12,145:4:0
+17	1229	.	A	<X>	0	.	DP=18;I16=10,8,0,0,693,26891,0,0,1049,62041,0,0,400,9490,0,0;QS=3,0;MQSB=0.906029;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,12,123:4:0	0,12,138:4:0
+17	1230	.	T	<X>	0	.	DP=18;I16=10,8,0,0,643,23601,0,0,1049,62041,0,0,401,9485,0,0;QS=3,0;MQSB=0.906029;MQ0F=0	PL:DP:DV	0,30,245:10:0	0,12,115:4:0	0,12,144:4:0
+17	1231	.	C	<X>	0	.	DP=18;I16=10,7,0,0,663,26041,0,0,1020,61200,0,0,390,9320,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,9,98:3:0	0,12,138:4:0
+17	1232	.	T	<X>	0	.	DP=18;I16=10,8,0,0,683,26261,0,0,1049,62041,0,0,401,9409,0,0;QS=3,0;MQSB=0.906029;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,12,133:4:0	0,12,129:4:0
+17	1233	.	G	<X>	0	.	DP=18;I16=10,8,0,0,657,24509,0,0,1049,62041,0,0,401,9389,0,0;QS=3,0;MQSB=0.906029;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,12,124:4:0	0,12,129:4:0
+17	1234	.	A	<X>	0	.	DP=19;I16=10,8,0,0,677,26177,0,0,1080,64800,0,0,386,9134,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,9,101:3:0	0,12,144:4:0
+17	1235	.	A	<X>	0	.	DP=19;I16=10,9,0,0,697,26363,0,0,1109,65641,0,0,400,9282,0,0;QS=3,0;MQSB=0.920044;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,129:4:0	0,12,140:4:0
+17	1236	.	A	<X>	0	.	DP=19;I16=10,9,0,0,671,24693,0,0,1109,65641,0,0,398,9148,0,0;QS=3,0;MQSB=0.920044;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,103:4:0	0,12,136:4:0
+17	1237	.	T	<X>	0	.	DP=19;I16=9,9,0,0,649,24061,0,0,1049,62041,0,0,370,8356,0,0;QS=3,0;MQSB=0.924089;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,9,98:3:0	0,12,135:4:0
+17	1238	.	C	<X>	0	.	DP=20;I16=11,9,0,0,733,27709,0,0,1169,69241,0,0,391,8783,0,0;QS=3,0;MQSB=0.916401;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,104:4:0	0,12,145:4:0
+17	1239	.	C	<X>	0	.	DP=20;I16=10,9,0,0,672,24596,0,0,1109,65641,0,0,363,7981,0,0;QS=3,0;MQSB=0.920044;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,9,76:3:0	0,12,124:4:0
+17	1240	.	C	<X>	0	.	DP=20;I16=11,9,0,0,723,26895,0,0,1169,69241,0,0,385,8451,0,0;QS=3,0;MQSB=0.916401;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,118:4:0	0,12,129:4:0
+17	1241	.	A	<X>	0	.	DP=20;I16=11,9,0,0,719,26575,0,0,1169,69241,0,0,382,8318,0,0;QS=3,0;MQSB=0.916401;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,104:4:0	0,12,141:4:0
+17	1242	.	A	<X>	0	.	DP=21;I16=12,9,0,0,749,27599,0,0,1229,72841,0,0,379,8207,0,0;QS=3,0;MQSB=0.913101;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,109:4:0	0,15,153:5:0
+17	1243	.	A	<X>	0	.	DP=21;I16=12,9,0,0,738,26862,0,0,1229,72841,0,0,377,8119,0,0;QS=3,0;MQSB=0.913101;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,110:4:0	0,15,158:5:0
+17	1244	.	C	<X>	0	.	DP=21;I16=12,8,0,0,670,22952,0,0,1169,69241,0,0,365,7955,0,0;QS=3,0;MQSB=0.898397;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,101:4:0	0,15,148:5:0
+17	1245	.	G	<X>	0	.	DP=21;I16=12,9,0,0,657,21627,0,0,1229,72841,0,0,373,8015,0,0;QS=3,0;MQSB=0.913101;MQ0F=0	PL:DP:DV	0,36,245:12:0	0,12,95:4:0	0,15,158:5:0
+17	1246	.	C	<X>	0	.	DP=21;I16=12,9,0,0,652,21348,0,0,1229,72841,0,0,370,7948,0,0;QS=3,0;MQSB=0.913101;MQ0F=0	PL:DP:DV	0,36,252:12:0	0,12,95:4:0	0,15,146:5:0
+17	1247	.	G	<X>	0	.	DP=20;I16=11,9,0,0,655,22291,0,0,1169,69241,0,0,367,7853,0,0;QS=3,0;MQSB=0.916401;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,87:4:0	0,15,150:5:0
+17	1248	.	C	<X>	0	.	DP=20;I16=10,8,0,0,659,25037,0,0,1080,64800,0,0,314,6530,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,9,90:3:0	0,15,156:5:0
+17	1249	.	C	<X>	0	.	DP=21;I16=12,9,0,0,772,28954,0,0,1229,72841,0,0,360,7680,0,0;QS=3,0;MQSB=0.913101;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,111:4:0	0,15,166:5:0
+17	1250	.	A	<X>	0	.	DP=21;I16=12,9,0,0,757,27599,0,0,1229,72841,0,0,356,7554,0,0;QS=3,0;MQSB=0.913101;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,114:4:0	0,15,161:5:0
+17	1251	.	A	<X>	0	.	DP=21;I16=12,9,0,0,758,27890,0,0,1229,72841,0,0,352,7452,0,0;QS=3,0;MQSB=0.913101;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,115:4:0	0,15,174:5:0
+17	1252	.	T	<X>	0	.	DP=21;I16=12,9,0,0,758,27574,0,0,1229,72841,0,0,348,7374,0,0;QS=3,0;MQSB=0.913101;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,124:4:0	0,15,159:5:0
+17	1253	.	A	<X>	0	.	DP=20;I16=12,8,0,0,718,26292,0,0,1169,69241,0,0,345,7319,0,0;QS=3,0;MQSB=0.898397;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,127:4:0	0,12,144:4:0
+17	1254	.	A	<X>	0	.	DP=20;I16=12,8,0,0,781,30817,0,0,1169,69241,0,0,342,7286,0,0;QS=3,0;MQSB=0.898397;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,134:4:0	0,12,156:4:0
+17	1255	.	G	<X>	0	.	DP=21;I16=12,9,0,0,785,30039,0,0,1229,72841,0,0,339,7275,0,0;QS=3,0;MQSB=0.913101;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,128:4:0	0,15,169:5:0
+17	1256	.	C	<X>	0	.	DP=20;I16=12,8,0,0,742,27910,0,0,1169,69241,0,0,338,7286,0,0;QS=3,0;MQSB=0.898397;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,116:4:0	0,15,165:5:0
+17	1257	.	A	<X>	0	.	DP=20;I16=12,8,0,0,745,28017,0,0,1169,69241,0,0,337,7319,0,0;QS=3,0;MQSB=0.898397;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,132:4:0	0,15,167:5:0
+17	1258	.	T	<X>	0	.	DP=20;I16=12,8,0,0,753,28507,0,0,1169,69241,0,0,336,7374,0,0;QS=3,0;MQSB=0.898397;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,126:4:0	0,15,170:5:0
+17	1259	.	T	<X>	0	.	DP=20;I16=12,8,0,0,690,24762,0,0,1169,69241,0,0,335,7451,0,0;QS=3,0;MQSB=0.898397;MQ0F=0	PL:DP:DV	0,33,236:11:0	0,12,128:4:0	0,15,170:5:0
+17	1260	.	C	<X>	0	.	DP=20;I16=12,8,0,0,719,26541,0,0,1169,69241,0,0,333,7499,0,0;QS=3,0;MQSB=0.898397;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,127:4:0	0,15,155:5:0
+17	1261	.	C	<X>	0	.	DP=18;I16=11,6,0,0,602,22374,0,0,989,58441,0,0,308,6940,0,0;QS=3,0;MQSB=0.85832;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,12,117:4:0	0,9,109:3:0
+17	1262	.	C	<X>	0	.	DP=18;I16=12,6,0,0,653,24345,0,0,1049,62041,0,0,333,7597,0,0;QS=3,0;MQSB=0.85394;MQ0F=0	PL:DP:DV	0,30,253:10:0	0,15,145:5:0	0,9,114:3:0
+17	1263	.	T	<X>	0	.	DP=17;I16=12,5,0,0,654,25656,0,0,989,58441,0,0,335,7645,0,0;QS=3,0;MQSB=0.818731;MQ0F=0	PL:DP:DV	0,27,238:9:0	0,15,158:5:0	0,9,118:3:0
+17	1264	.	T	<X>	0	.	DP=17;I16=12,5,0,0,615,22855,0,0,989,58441,0,0,336,7658,0,0;QS=3,0;MQSB=0.818731;MQ0F=0	PL:DP:DV	0,27,226:9:0	0,15,149:5:0	0,9,114:3:0
+17	1265	.	T	<X>	0	.	DP=17;I16=12,5,0,0,620,23176,0,0,989,58441,0,0,334,7538,0,0;QS=3,0;MQSB=0.818731;MQ0F=0	PL:DP:DV	0,27,232:9:0	0,15,144:5:0	0,9,114:3:0
+17	1266	.	G	<X>	0	.	DP=18;I16=13,5,0,0,675,25765,0,0,1049,62041,0,0,332,7438,0,0;QS=3,0;MQSB=0.814433;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,15,145:5:0	0,9,114:3:0
+17	1267	.	A	<X>	0	.	DP=18;I16=13,5,0,0,663,24799,0,0,1049,62041,0,0,331,7359,0,0;QS=3,0;MQSB=0.814433;MQ0F=0	PL:DP:DV	0,30,253:10:0	0,15,138:5:0	0,9,114:3:0
+17	1268	.	G	<X>	0	.	DP=18;I16=13,5,0,0,638,23584,0,0,1049,62041,0,0,329,7251,0,0;QS=3,0;MQSB=0.814433;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,15,112:5:0	0,9,108:3:0
+17	1269	.	C	<X>	0	.	DP=18;I16=13,5,0,0,592,20458,0,0,1049,62041,0,0,327,7163,0,0;QS=3,0;MQSB=0.814433;MQ0F=0	PL:DP:DV	0,30,224:10:0	0,15,130:5:0	0,9,107:3:0
+17	1270	.	G	<X>	0	.	DP=18;I16=13,5,0,0,537,16775,0,0,1049,62041,0,0,325,7095,0,0;QS=3,0;MQSB=0.814433;MQ0F=0	PL:DP:DV	0,30,206:10:0	0,15,104:5:0	0,9,98:3:0
+17	1271	.	T	<X>	0	.	DP=18;I16=12,5,0,0,620,22824,0,0,989,58441,0,0,298,6422,0,0;QS=3,0;MQSB=0.818731;MQ0F=0	PL:DP:DV	0,27,240:9:0	0,15,138:5:0	0,9,109:3:0
+17	1272	.	C	<X>	0	.	DP=17;I16=11,5,0,0,597,22587,0,0,929,54841,0,0,297,6393,0,0;QS=3,0;MQSB=0.823561;MQ0F=0	PL:DP:DV	0,27,251:9:0	0,12,113:4:0	0,9,110:3:0
+17	1273	.	A	<X>	0	.	DP=18;I16=12,6,0,0,633,23063,0,0,1049,62041,0,0,318,6866,0,0;QS=3,0;MQSB=0.85394;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,109:4:0	0,9,113:3:0
+17	1274	.	T	<X>	0	.	DP=17;I16=10,6,0,0,609,23335,0,0,929,54841,0,0,293,6205,0,0;QS=3,0;MQSB=0.863243;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,6,67:2:0	0,9,115:3:0
+17	1275	.	G	<X>	0	.	DP=17;I16=11,6,0,0,602,21976,0,0,989,58441,0,0,317,6763,0,0;QS=3,0;MQSB=0.85832;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,9,87:3:0	0,9,112:3:0
+17	1276	.	T	<X>	0	.	DP=17;I16=11,6,0,0,587,20925,0,0,989,58441,0,0,316,6714,0,0;QS=3,0;MQSB=0.85832;MQ0F=0	PL:DP:DV	0,33,248:11:0	0,9,94:3:0	0,9,110:3:0
+17	1277	.	C	<X>	0	.	DP=18;I16=11,7,0,0,590,20126,0,0,1049,62041,0,0,314,6634,0,0;QS=3,0;MQSB=0.883327;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,9,85:3:0	0,9,106:3:0
+17	1278	.	G	<X>	0	.	DP=18;I16=11,7,0,0,603,20675,0,0,1049,62041,0,0,313,6575,0,0;QS=3,0;MQSB=0.883327;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,9,77:3:0	0,9,96:3:0
+17	1279	.	G	<X>	0	.	DP=18;I16=11,7,0,0,646,23662,0,0,1049,62041,0,0,312,6538,0,0;QS=3,0;MQSB=0.883327;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,9,85:3:0	0,9,113:3:0
+17	1280	.	T	<X>	0	.	DP=18;I16=10,7,0,0,558,19192,0,0,989,58441,0,0,296,6298,0,0;QS=3,0;MQSB=0.887766;MQ0F=0	PL:DP:DV	0,33,249:11:0	0,9,86:3:0	0,9,97:3:0
+17	1281	.	G	<X>	0	.	DP=17;I16=10,6,0,0,564,21244,0,0,929,54841,0,0,270,5658,0,0;QS=3,0;MQSB=0.863243;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,9,85:3:0	0,9,103:3:0
+17	1282	.	C	<X>	0	.	DP=18;I16=10,8,0,0,654,24308,0,0,1049,62041,0,0,294,6286,0,0;QS=3,0;MQSB=0.906029;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,9,94:3:0	0,12,131:4:0
+17	1283	.	T	<X>	0	.	DP=18;I16=10,8,0,0,677,26313,0,0,1049,62041,0,0,294,6308,0,0;QS=3,0;MQSB=0.906029;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,9,83:3:0	0,12,154:4:0
+17	1284	.	T	<X>	0	.	DP=18;I16=10,8,0,0,631,22949,0,0,1049,62041,0,0,293,6301,0,0;QS=3,0;MQSB=0.906029;MQ0F=0	PL:DP:DV	0,33,254:11:0	0,9,92:3:0	0,12,145:4:0
+17	1285	.	G	<X>	0	.	DP=18;I16=10,7,0,0,657,25545,0,0,989,58441,0,0,267,5691,0,0;QS=3,0;MQSB=0.887766;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,9,94:3:0	0,12,145:4:0
+17	1286	.	G	<X>	0	.	DP=18;I16=10,8,0,0,650,24684,0,0,1049,62041,0,0,291,6353,0,0;QS=3,0;MQSB=0.906029;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,9,78:3:0	0,12,148:4:0
+17	1287	.	A	<X>	0	.	DP=17;I16=9,8,0,0,609,22229,0,0,989,58441,0,0,291,6411,0,0;QS=3,0;MQSB=0.91051;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,9,91:3:0	0,12,137:4:0
+17	1288	.	A	<X>	0	.	DP=17;I16=9,8,0,0,605,22315,0,0,989,58441,0,0,290,6438,0,0;QS=3,0;MQSB=0.91051;MQ0F=0	PL:DP:DV	0,30,245:10:0	0,9,103:3:0	0,12,140:4:0
+17	1289	.	T	<X>	0	.	DP=18;I16=10,8,0,0,637,23207,0,0,1049,62041,0,0,289,6483,0,0;QS=3,0;MQSB=0.906029;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,9,99:3:0	0,12,141:4:0
+17	1290	.	G	<X>	0	.	DP=15;I16=9,6,0,0,559,21163,0,0,869,51241,0,0,292,6544,0,0;QS=3,0;MQSB=0.868815;MQ0F=0	PL:DP:DV	0,27,242:9:0	0,9,97:3:0	0,9,106:3:0
+17	1291	.	T	<X>	0	.	DP=15;I16=9,6,0,0,547,20303,0,0,869,51241,0,0,295,6619,0,0;QS=3,0;MQSB=0.868815;MQ0F=0	PL:DP:DV	0,27,225:9:0	0,9,91:3:0	0,9,117:3:0
+17	1292	.	T	<X>	0	.	DP=15;I16=9,6,0,0,559,21121,0,0,869,51241,0,0,297,6657,0,0;QS=3,0;MQSB=0.868815;MQ0F=0	PL:DP:DV	0,27,236:9:0	0,9,95:3:0	0,9,113:3:0
+17	1293	.	T	<X>	0	.	DP=15;I16=9,6,0,0,578,22428,0,0,869,51241,0,0,299,6707,0,0;QS=3,0;MQSB=0.868815;MQ0F=0	PL:DP:DV	0,27,242:9:0	0,9,100:3:0	0,9,116:3:0
+17	1294	.	G	<X>	0	.	DP=16;I16=9,7,0,0,606,23572,0,0,929,54841,0,0,301,6769,0,0;QS=3,0;MQSB=0.892753;MQ0F=0	PL:DP:DV	0,27,254:9:0	0,12,110:4:0	0,9,119:3:0
+17	1295	.	G	<X>	0	.	DP=16;I16=9,7,0,0,567,21419,0,0,929,54841,0,0,304,6844,0,0;QS=3,0;MQSB=0.892753;MQ0F=0	PL:DP:DV	0,27,244:9:0	0,12,102:4:0	0,9,114:3:0
+17	1296	.	G	<X>	0	.	DP=16;I16=8,7,0,0,518,19300,0,0,869,51241,0,0,294,6740,0,0;QS=3,0;MQSB=0.898397;MQ0F=0	PL:DP:DV	0,27,227:9:0	0,9,89:3:0	0,9,114:3:0
+17	1297	.	G	<X>	0	.	DP=18;I16=9,8,0,0,551,19323,0,0,958,55682,0,0,322,7444,0,0;QS=3,0;MQSB=0.998843;MQ0F=0	PL:DP:DV	0,30,219:10:0	0,9,86:3:0	0,12,133:4:0
+17	1298	.	T	<X>	0	.	DP=18;I16=10,8,0,0,615,22371,0,0,1018,59282,0,0,336,7638,0,0;QS=3,0;MQSB=0.99606;MQ0F=0	PL:DP:DV	0,30,233:10:0	0,12,105:4:0	0,12,138:4:0
+17	1299	.	T	<X>	0	.	DP=18;I16=9,8,0,0,619,23135,0,0,958,55682,0,0,328,7548,0,0;QS=3,0;MQSB=0.998843;MQ0F=0	PL:DP:DV	0,30,242:10:0	0,9,97:3:0	0,12,136:4:0
+17	1300	.	T	<X>	0	.	DP=18;I16=10,8,0,0,631,23107,0,0,1018,59282,0,0,338,7638,0,0;QS=3,0;MQSB=0.99606;MQ0F=0	PL:DP:DV	0,30,235:10:0	0,12,121:4:0	0,12,136:4:0
+17	1301	.	T	G,<X>	0	.	DP=18;I16=8,8,1,0,599,22623,18,324,929,54841,29,841,314,7040,25,625;QS=2.9434,0.0566038,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.998843;BQB=1;MQ0F=0	PL:DP:DV	0,9,213,24,216,222:9:1	0,12,126,12,126,126:4:0	0,12,135,12,135,135:4:0
+17	1302	.	G	<X>	0	.	DP=17;I16=9,8,0,0,624,23544,0,0,958,55682,0,0,341,7709,0,0;QS=3,0;MQSB=0.998843;MQ0F=0	PL:DP:DV	0,27,240:9:0	0,12,127:4:0	0,12,140:4:0
+17	1303	.	G	<X>	0	.	DP=17;I16=9,8,0,0,582,21200,0,0,958,55682,0,0,342,7718,0,0;QS=3,0;MQSB=0.998843;MQ0F=0	PL:DP:DV	0,27,217:9:0	0,12,125:4:0	0,12,138:4:0
+17	1304	.	A	<X>	0	.	DP=18;I16=10,8,0,0,652,24124,0,0,1018,59282,0,0,343,7741,0,0;QS=3,0;MQSB=0.99606;MQ0F=0	PL:DP:DV	0,27,218:9:0	0,12,131:4:0	0,15,169:5:0
+17	1305	.	T	<X>	0	.	DP=18;I16=10,8,0,0,685,26381,0,0,1018,59282,0,0,345,7779,0,0;QS=3,0;MQSB=0.99606;MQ0F=0	PL:DP:DV	0,27,241:9:0	0,12,122:4:0	0,15,174:5:0
+17	1306	.	T	<X>	0	.	DP=18;I16=9,8,0,0,644,24628,0,0,958,55682,0,0,345,7829,0,0;QS=3,0;MQSB=0.998843;MQ0F=0	PL:DP:DV	0,27,236:9:0	0,9,106:3:0	0,15,168:5:0
+17	1307	.	T	<X>	0	.	DP=17;I16=9,8,0,0,628,23746,0,0,958,55682,0,0,348,7902,0,0;QS=3,0;MQSB=0.998843;MQ0F=0	PL:DP:DV	0,27,226:9:0	0,9,104:3:0	0,15,167:5:0
+17	1308	.	A	<X>	0	.	DP=19;I16=9,10,0,0,690,25500,0,0,1078,62882,0,0,350,7938,0,0;QS=3,0;MQSB=0.999167;MQ0F=0	PL:DP:DV	0,30,236:10:0	0,12,127:4:0	0,15,173:5:0
+17	1309	.	C	<X>	0	.	DP=19;I16=9,9,0,0,698,27148,0,0,1049,62041,0,0,342,7818,0,0;QS=3,0;MQSB=0.924089;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,9,106:3:0	0,15,169:5:0
+17	1310	.	A	<X>	0	.	DP=19;I16=9,10,0,0,751,29953,0,0,1078,62882,0,0,356,7958,0,0;QS=3,0;MQSB=0.999167;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,12,132:4:0	0,15,183:5:0
+17	1311	.	G	<X>	0	.	DP=19;I16=9,10,0,0,742,29384,0,0,1078,62882,0,0,359,7995,0,0;QS=3,0;MQSB=0.999167;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,12,128:4:0	0,15,174:5:0
+17	1312	.	C	<X>	0	.	DP=19;I16=9,10,0,0,717,27783,0,0,1078,62882,0,0,362,8050,0,0;QS=3,0;MQSB=0.999167;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,12,115:4:0	0,15,166:5:0
+17	1313	.	T	<X>	0	.	DP=19;I16=9,10,0,0,751,30061,0,0,1078,62882,0,0,364,8074,0,0;QS=3,0;MQSB=0.999167;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,12,135:4:0	0,15,175:5:0
+17	1314	.	T	<X>	0	.	DP=19;I16=9,10,0,0,707,26983,0,0,1078,62882,0,0,366,8118,0,0;QS=3,0;MQSB=0.999167;MQ0F=0	PL:DP:DV	0,30,245:10:0	0,12,134:4:0	0,15,174:5:0
+17	1315	.	T	<X>	0	.	DP=19;I16=9,10,0,0,717,27491,0,0,1078,62882,0,0,367,8131,0,0;QS=3,0;MQSB=0.999167;MQ0F=0	PL:DP:DV	0,30,250:10:0	0,12,132:4:0	0,15,174:5:0
+17	1316	.	G	<X>	0	.	DP=21;I16=10,11,0,0,776,29502,0,0,1198,70082,0,0,368,8162,0,0;QS=3,0;MQSB=0.99938;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,128:4:0	0,18,188:6:0
+17	1317	.	G	<X>	0	.	DP=21;I16=10,11,0,0,751,27855,0,0,1198,70082,0,0,371,8213,0,0;QS=3,0;MQSB=0.99938;MQ0F=0	PL:DP:DV	0,33,253:11:0	0,12,130:4:0	0,18,179:6:0
+17	1318	.	G	<X>	0	.	DP=21;I16=10,11,0,0,749,27663,0,0,1198,70082,0,0,372,8188,0,0;QS=3,0;MQSB=0.99938;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,130:4:0	0,18,184:6:0
+17	1319	.	A	<X>	0	.	DP=21;I16=10,11,0,0,768,28390,0,0,1198,70082,0,0,373,8189,0,0;QS=3,0;MQSB=0.99938;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,124:4:0	0,18,186:6:0
+17	1320	.	C	<X>	0	.	DP=21;I16=10,11,0,0,728,25496,0,0,1198,70082,0,0,373,8165,0,0;QS=3,0;MQSB=0.99938;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,113:4:0	0,18,161:6:0
+17	1321	.	G	<X>	0	.	DP=22;I16=10,12,0,0,762,27412,0,0,1289,76441,0,0,374,8164,0,0;QS=3,0;MQSB=0.924723;MQ0F=0	PL:DP:DV	0,33,244:11:0	0,9,104:3:0	0,24,208:8:0
+17	1322	.	C	<X>	0	.	DP=22;I16=10,12,0,0,852,33528,0,0,1289,76441,0,0,377,8187,0,0;QS=3,0;MQSB=0.924723;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,9,111:3:0	0,24,225:8:0
+17	1323	.	T	<X>	0	.	DP=22;I16=10,12,0,0,874,35152,0,0,1289,76441,0,0,379,8185,0,0;QS=3,0;MQSB=0.924723;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,9,112:3:0	0,24,237:8:0
+17	1324	.	C	<X>	0	.	DP=21;I16=9,12,0,0,793,30585,0,0,1229,72841,0,0,381,8157,0,0;QS=3,0;MQSB=0.913101;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,9,109:3:0	0,24,218:8:0
+17	1325	.	A	<X>	0	.	DP=21;I16=9,12,0,0,782,29430,0,0,1229,72841,0,0,383,8153,0,0;QS=3,0;MQSB=0.913101;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,9,105:3:0	0,24,218:8:0
+17	1326	.	A	<X>	0	.	DP=21;I16=9,12,0,0,791,30479,0,0,1229,72841,0,0,385,8173,0,0;QS=3,0;MQSB=0.913101;MQ0F=0	PL:DP:DV	0,30,249:10:0	0,9,108:3:0	0,24,230:8:0
+17	1327	.	C	<X>	0	.	DP=23;I16=11,12,0,0,834,31048,0,0,1349,80041,0,0,387,8217,0,0;QS=3,0;MQSB=0.934091;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,9,99:3:0	0,27,237:9:0
+17	1328	.	C	<X>	0	.	DP=23;I16=11,12,0,0,878,33972,0,0,1349,80041,0,0,391,8287,0,0;QS=3,0;MQSB=0.934091;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,9,105:3:0	0,27,254:9:0
+17	1329	.	T	<X>	0	.	DP=23;I16=11,12,0,0,882,34756,0,0,1349,80041,0,0,395,8385,0,0;QS=3,0;MQSB=0.934091;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,9,112:3:0	0,27,255:9:0
+17	1330	.	G	<X>	0	.	DP=23;I16=11,12,0,0,856,32638,0,0,1349,80041,0,0,398,8460,0,0;QS=3,0;MQSB=0.934091;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,9,101:3:0	0,27,241:9:0
+17	1331	.	T	<X>	0	.	DP=23;I16=11,12,0,0,847,31785,0,0,1349,80041,0,0,400,8512,0,0;QS=3,0;MQSB=0.934091;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,9,106:3:0	0,27,247:9:0
+17	1332	.	A	<X>	0	.	DP=23;I16=11,12,0,0,826,30264,0,0,1349,80041,0,0,402,8592,0,0;QS=3,0;MQSB=0.934091;MQ0F=0	PL:DP:DV	0,33,252:11:0	0,9,104:3:0	0,27,238:9:0
+17	1333	.	C	<X>	0	.	DP=23;I16=11,12,0,0,836,30928,0,0,1349,80041,0,0,404,8700,0,0;QS=3,0;MQSB=0.934091;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,9,101:3:0	0,27,236:9:0
+17	1334	.	C	<X>	0	.	DP=22;I16=11,11,0,0,830,32380,0,0,1289,76441,0,0,405,8733,0,0;QS=3,0;MQSB=0.936864;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,9,107:3:0	0,27,238:9:0
+17	1335	.	T	<X>	0	.	DP=22;I16=11,11,0,0,877,35371,0,0,1289,76441,0,0,406,8788,0,0;QS=3,0;MQSB=0.936864;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,9,113:3:0	0,27,253:9:0
+17	1336	.	C	<X>	0	.	DP=25;I16=12,12,0,0,890,33648,0,0,1378,80882,0,0,398,8784,0,0;QS=3,0;MQSB=0.786628;MQ0F=0	PL:DP:DV	0,33,250:11:0	0,12,131:4:0	0,27,237:9:0
+17	1337	.	A	<X>	0	.	DP=26;I16=13,13,0,0,941,34611,0,0,1498,88082,0,0,411,8967,0,0;QS=3,0;MQSB=0.800737;MQ0F=0	PL:DP:DV	0,33,249:11:0	0,15,152:5:0	0,30,247:10:0
+17	1338	.	A	<X>	0	.	DP=26;I16=12,14,0,0,982,37358,0,0,1498,88082,0,0,416,9048,0,0;QS=3,0;MQSB=0.771623;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,153:5:0	0,30,255:10:0
+17	1339	.	T	<X>	0	.	DP=27;I16=12,15,0,0,989,36855,0,0,1558,91682,0,0,422,9160,0,0;QS=3,0;MQSB=0.765017;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,151:5:0	0,33,255:11:0
+17	1340	.	A	<X>	0	.	DP=27;I16=11,15,0,0,937,34141,0,0,1498,88082,0,0,425,9289,0,0;QS=3,0;MQSB=0.738577;MQ0F=0	PL:DP:DV	0,30,250:10:0	0,15,149:5:0	0,33,254:11:0
+17	1341	.	A	<X>	0	.	DP=27;I16=12,14,0,0,929,33961,0,0,1498,88082,0,0,410,8810,0,0;QS=3,0;MQSB=0.771623;MQ0F=0	PL:DP:DV	0,30,245:10:0	0,15,141:5:0	0,33,255:11:0
+17	1342	.	A	<X>	0	.	DP=27;I16=12,15,0,0,951,34575,0,0,1558,91682,0,0,439,9499,0,0;QS=3,0;MQSB=0.765017;MQ0F=0	PL:DP:DV	0,33,254:11:0	0,15,159:5:0	0,33,249:11:0
+17	1343	.	C	<X>	0	.	DP=25;I16=10,15,0,0,902,33364,0,0,1469,87241,0,0,445,9593,0,0;QS=3,0;MQSB=0.9171;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,15,140:5:0	0,30,233:10:0
+17	1344	.	C	<X>	0	.	DP=26;I16=10,16,0,0,985,37915,0,0,1529,90841,0,0,451,9715,0,0;QS=3,0;MQSB=0.914947;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,18,163:6:0	0,30,238:10:0
+17	1345	.	T	<X>	0	.	DP=26;I16=10,16,0,0,1004,39262,0,0,1529,90841,0,0,458,9866,0,0;QS=3,0;MQSB=0.914947;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,18,182:6:0	0,30,242:10:0
+17	1346	.	G	<X>	0	.	DP=26;I16=10,16,0,0,1003,38983,0,0,1529,90841,0,0,465,10047,0,0;QS=3,0;MQSB=0.914947;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,18,172:6:0	0,30,239:10:0
+17	1347	.	A	<X>	0	.	DP=26;I16=10,16,0,0,995,38409,0,0,1529,90841,0,0,470,10156,0,0;QS=3,0;MQSB=0.914947;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,18,177:6:0	0,30,243:10:0
+17	1348	.	T	<X>	0	.	DP=26;I16=10,16,0,0,988,38126,0,0,1529,90841,0,0,474,10242,0,0;QS=3,0;MQSB=0.914947;MQ0F=0	PL:DP:DV	0,30,252:10:0	0,18,185:6:0	0,30,251:10:0
+17	1349	.	T	<X>	0	.	DP=26;I16=9,15,0,0,905,34409,0,0,1409,83641,0,0,454,9730,0,0;QS=3,0;MQSB=0.904837;MQ0F=0	PL:DP:DV	0,24,225:8:0	0,18,176:6:0	0,30,248:10:0
+17	1350	.	T	<X>	0	.	DP=26;I16=10,16,0,0,975,36909,0,0,1498,88082,0,0,485,10495,0,0;QS=3,0;MQSB=0.700784;MQ0F=0	PL:DP:DV	0,27,242:9:0	0,21,195:7:0	0,30,249:10:0
+17	1351	.	T	<X>	0	.	DP=26;I16=10,16,0,0,956,35602,0,0,1498,88082,0,0,491,10663,0,0;QS=3,0;MQSB=0.700784;MQ0F=0	PL:DP:DV	0,27,238:9:0	0,21,193:7:0	0,30,240:10:0
+17	1352	.	A	<X>	0	.	DP=26;I16=10,16,0,0,901,31965,0,0,1498,88082,0,0,496,10810,0,0;QS=3,0;MQSB=0.700784;MQ0F=0	PL:DP:DV	0,27,250:9:0	0,21,180:7:0	0,30,211:10:0
+17	1353	.	A	<X>	0	.	DP=26;I16=10,16,0,0,927,33583,0,0,1498,88082,0,0,499,10885,0,0;QS=3,0;MQSB=0.700784;MQ0F=0	PL:DP:DV	0,27,240:9:0	0,21,187:7:0	0,30,224:10:0
+17	1354	.	A	<X>	0	.	DP=26;I16=10,16,0,0,927,33621,0,0,1498,88082,0,0,502,10986,0,0;QS=3,0;MQSB=0.700784;MQ0F=0	PL:DP:DV	0,27,237:9:0	0,21,190:7:0	0,30,223:10:0
+17	1355	.	A	<X>	0	.	DP=26;I16=10,16,0,0,924,33736,0,0,1498,88082,0,0,505,11113,0,0;QS=3,0;MQSB=0.700784;MQ0F=0	PL:DP:DV	0,27,239:9:0	0,21,186:7:0	0,30,227:10:0
+17	1356	.	A	<X>	0	.	DP=25;I16=10,15,0,0,916,34050,0,0,1438,84482,0,0,509,11265,0,0;QS=3,0;MQSB=0.707404;MQ0F=0	PL:DP:DV	0,27,249:9:0	0,21,178:7:0	0,27,226:9:0
+17	1357	.	A	<X>	0	.	DP=25;I16=9,15,0,0,949,38007,0,0,1378,80882,0,0,488,10816,0,0;QS=3,0;MQSB=0.67032;MQ0F=0	PL:DP:DV	0,27,255:9:0	0,21,193:7:0	0,24,217:8:0
+17	1358	.	G	<X>	0	.	DP=25;I16=9,15,0,0,873,32435,0,0,1378,80882,0,0,491,10967,0,0;QS=3,0;MQSB=0.67032;MQ0F=0	PL:DP:DV	0,27,255:9:0	0,21,172:7:0	0,24,188:8:0
+17	1359	.	T	<X>	0	.	DP=25;I16=9,15,0,0,857,31139,0,0,1378,80882,0,0,494,11144,0,0;QS=3,0;MQSB=0.67032;MQ0F=0	PL:DP:DV	0,27,232:9:0	0,21,184:7:0	0,24,196:8:0
+17	1360	.	T	<X>	0	.	DP=25;I16=9,15,0,0,879,32419,0,0,1378,80882,0,0,497,11347,0,0;QS=3,0;MQSB=0.67032;MQ0F=0	PL:DP:DV	0,27,248:9:0	0,21,184:7:0	0,24,192:8:0
+17	1361	.	T	<X>	0	.	DP=27;I16=9,17,0,0,936,34238,0,0,1498,88082,0,0,500,11576,0,0;QS=3,0;MQSB=0.657209;MQ0F=0	PL:DP:DV	0,27,234:9:0	0,24,201:8:0	0,27,206:9:0
+17	1362	.	G	<X>	0	.	DP=26;I16=9,17,0,0,973,36785,0,0,1498,88082,0,0,502,11680,0,0;QS=3,0;MQSB=0.657209;MQ0F=0	PL:DP:DV	0,27,255:9:0	0,24,202:8:0	0,27,207:9:0
+17	1363	.	G	<X>	0	.	DP=25;I16=8,17,0,0,936,35390,0,0,1438,84482,0,0,504,11756,0,0;QS=3,0;MQSB=0.612391;MQ0F=0	PL:DP:DV	0,27,255:9:0	0,21,181:7:0	0,27,202:9:0
+17	1364	.	G	<X>	0	.	DP=25;I16=8,17,0,0,902,32840,0,0,1438,84482,0,0,504,11752,0,0;QS=3,0;MQSB=0.612391;MQ0F=0	PL:DP:DV	0,27,233:9:0	0,21,184:7:0	0,27,200:9:0
+17	1365	.	G	<X>	0	.	DP=26;I16=9,17,0,0,946,35224,0,0,1498,88082,0,0,503,11717,0,0;QS=3,0;MQSB=0.657209;MQ0F=0	PL:DP:DV	0,27,255:9:0	0,24,190:8:0	0,27,202:9:0
+17	1366	.	G	<X>	0	.	DP=25;I16=8,15,0,0,840,31058,0,0,1318,77282,0,0,454,10450,0,0;QS=3,0;MQSB=0.625784;MQ0F=0	PL:DP:DV	0,21,215:7:0	0,21,181:7:0	0,27,199:9:0
+17	1367	.	G	C,<X>	0	.	DP=25;I16=7,16,0,1,836,30888,27,729,1349,80041,60,3600,472,11152,15,225;QS=2.91641,0.0835913,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.864405;BQB=1;MQ0F=0	PL:DP:DV	0,24,236,24,236,236:8:0	0,21,179,21,179,179:7:0	0,0,171,24,174,189:9:1
+17	1368	.	A	<X>	0	.	DP=26;I16=8,17,0,0,869,30839,0,0,1438,84482,0,0,481,11095,0,0;QS=3,0;MQSB=0.612391;MQ0F=0	PL:DP:DV	0,27,240:9:0	0,21,180:7:0	0,27,197:9:0
+17	1369	.	T	<X>	0	.	DP=26;I16=8,18,0,0,902,32160,0,0,1498,88082,0,0,508,11758,0,0;QS=3,0;MQSB=0.606531;MQ0F=0	PL:DP:DV	0,27,242:9:0	0,24,197:8:0	0,27,194:9:0
+17	1370	.	T	<X>	0	.	DP=27;I16=8,17,0,0,926,34736,0,0,1438,84482,0,0,458,10466,0,0;QS=3,0;MQSB=0.612391;MQ0F=0	PL:DP:DV	0,27,238:9:0	0,21,195:7:0	0,27,215:9:0
+17	1371	.	C	<X>	0	.	DP=27;I16=8,19,0,0,929,33255,0,0,1558,91682,0,0,509,11695,0,0;QS=3,0;MQSB=0.601139;MQ0F=0	PL:DP:DV	0,27,241:9:0	0,24,196:8:0	0,30,196:10:0
+17	1372	.	C	<X>	0	.	DP=27;I16=8,19,0,0,954,34882,0,0,1558,91682,0,0,510,11696,0,0;QS=3,0;MQSB=0.601139;MQ0F=0	PL:DP:DV	0,27,251:9:0	0,24,198:8:0	0,30,200:10:0
+17	1373	.	C	<X>	0	.	DP=26;I16=8,17,0,0,892,32692,0,0,1438,84482,0,0,486,11044,0,0;QS=3,0;MQSB=0.612391;MQ0F=0	PL:DP:DV	0,24,243:8:0	0,21,186:7:0	0,30,195:10:0
+17	1374	.	C	<X>	0	.	DP=26;I16=8,17,0,0,953,36553,0,0,1438,84482,0,0,487,11039,0,0;QS=3,0;MQSB=0.612391;MQ0F=0	PL:DP:DV	0,24,249:8:0	0,21,193:7:0	0,30,211:10:0
+17	1375	.	T	<X>	0	.	DP=27;I16=9,18,0,0,1011,38377,0,0,1558,91682,0,0,512,11630,0,0;QS=3,0;MQSB=0.651439;MQ0F=0	PL:DP:DV	0,27,243:9:0	0,24,215:8:0	0,30,215:10:0
+17	1376	.	A	<X>	0	.	DP=27;I16=9,17,0,0,912,32444,0,0,1498,88082,0,0,488,10992,0,0;QS=3,0;MQSB=0.657209;MQ0F=0	PL:DP:DV	0,27,234:9:0	0,21,198:7:0	0,30,195:10:0
+17	1377	.	A	<X>	0	.	DP=26;I16=9,17,0,0,994,38518,0,0,1498,88082,0,0,515,11625,0,0;QS=3,0;MQSB=0.657209;MQ0F=0	PL:DP:DV	0,24,228:8:0	0,24,221:8:0	0,30,228:10:0
+17	1378	.	G	<X>	0	.	DP=26;I16=9,17,0,0,910,33180,0,0,1498,88082,0,0,517,11653,0,0;QS=3,0;MQSB=0.657209;MQ0F=0	PL:DP:DV	0,24,234:8:0	0,24,199:8:0	0,30,197:10:0
+17	1379	.	C	<X>	0	.	DP=26;I16=9,17,0,0,891,31779,0,0,1498,88082,0,0,519,11701,0,0;QS=3,0;MQSB=0.657209;MQ0F=0	PL:DP:DV	0,24,228:8:0	0,24,198:8:0	0,30,193:10:0
+17	1380	.	C	<X>	0	.	DP=26;I16=9,17,0,0,925,33925,0,0,1498,88082,0,0,520,11720,0,0;QS=3,0;MQSB=0.657209;MQ0F=0	PL:DP:DV	0,24,226:8:0	0,24,202:8:0	0,30,209:10:0
+17	1381	.	C	<X>	0	.	DP=28;I16=10,18,0,0,878,28560,0,0,1618,95282,0,0,521,11761,0,0;QS=3,0;MQSB=0.689069;MQ0F=0	PL:DP:DV	0,24,211:8:0	0,24,177:8:0	0,36,208:12:0
+17	1382	.	G	<X>	0	.	DP=28;I16=8,18,0,0,905,32553,0,0,1529,90841,0,0,482,10912,0,0;QS=3,0;MQSB=0.882497;MQ0F=0	PL:DP:DV	0,24,213:8:0	0,18,152:6:0	0,36,243:12:0
+17	1383	.	C	<X>	0	.	DP=27;I16=10,16,0,0,897,32373,0,0,1498,88082,0,0,502,11242,0,0;QS=3,0;MQSB=0.700784;MQ0F=0	PL:DP:DV	0,24,225:8:0	0,21,163:7:0	0,33,241:11:0
+17	1384	.	C	<X>	0	.	DP=28;I16=11,17,0,0,980,35558,0,0,1618,95282,0,0,529,11885,0,0;QS=3,0;MQSB=0.726331;MQ0F=0	PL:DP:DV	0,27,248:9:0	0,24,184:8:0	0,33,239:11:0
+17	1385	.	A	<X>	0	.	DP=30;I16=11,18,0,0,949,33215,0,0,1678,98882,0,0,508,11356,0,0;QS=3,0;MQSB=0.720887;MQ0F=0	PL:DP:DV	0,30,232:10:0	0,27,185:9:0	0,30,234:10:0
+17	1386	.	C	<X>	0	.	DP=30;I16=11,19,0,0,1088,39938,0,0,1738,102482,0,0,537,12011,0,0;QS=3,0;MQSB=0.715831;MQ0F=0	PL:DP:DV	0,30,248:10:0	0,27,218:9:0	0,33,255:11:0
+17	1387	.	C	<X>	0	.	DP=31;I16=12,19,0,0,1101,40297,0,0,1798,106082,0,0,540,12022,0,0;QS=3,0;MQSB=0.743137;MQ0F=0	PL:DP:DV	0,33,250:11:0	0,27,219:9:0	0,33,252:11:0
+17	1388	.	C	<X>	0	.	DP=31;I16=11,19,0,0,999,34081,0,0,1769,105241,0,0,519,11439,0,0;QS=3,0;MQSB=0.91982;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,24,185:8:0	0,33,211:11:0
+17	1389	.	G	<X>	0	.	DP=31;I16=11,19,0,0,1065,39119,0,0,1738,102482,0,0,535,11941,0,0;QS=3,0;MQSB=0.715831;MQ0F=0	PL:DP:DV	0,27,234:9:0	0,30,234:10:0	0,33,255:11:0
+17	1390	.	G	<X>	0	.	DP=31;I16=12,19,0,0,1152,43744,0,0,1798,106082,0,0,555,12241,0,0;QS=3,0;MQSB=0.743137;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,30,245:10:0	0,33,255:11:0
+17	1391	.	A	<X>	0	.	DP=31;I16=12,19,0,0,1241,50255,0,0,1798,106082,0,0,560,12326,0,0;QS=3,0;MQSB=0.743137;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,30,255:10:0	0,33,255:11:0
+17	1392	.	G	<X>	0	.	DP=31;I16=12,19,0,0,1160,44364,0,0,1798,106082,0,0,564,12392,0,0;QS=3,0;MQSB=0.743137;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,30,250:10:0	0,33,255:11:0
+17	1393	.	A	<X>	0	.	DP=31;I16=12,19,0,0,1123,41811,0,0,1798,106082,0,0,568,12490,0,0;QS=3,0;MQSB=0.743137;MQ0F=0	PL:DP:DV	0,30,228:10:0	0,30,255:10:0	0,33,255:11:0
+17	1394	.	C	<X>	0	.	DP=31;I16=12,19,0,0,1139,42555,0,0,1798,106082,0,0,571,12569,0,0;QS=3,0;MQSB=0.743137;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,30,244:10:0	0,33,255:11:0
+17	1395	.	A	<X>	0	.	DP=31;I16=12,19,0,0,1206,48048,0,0,1798,106082,0,0,575,12677,0,0;QS=3,0;MQSB=0.743137;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,27,240:9:0	0,33,255:11:0
+17	1396	.	G	<X>	0	.	DP=31;I16=12,19,0,0,1196,46882,0,0,1798,106082,0,0,579,12763,0,0;QS=3,0;MQSB=0.743137;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,27,249:9:0	0,33,255:11:0
+17	1397	.	C	<X>	0	.	DP=31;I16=12,18,0,0,993,33339,0,0,1738,102482,0,0,579,12775,0,0;QS=3,0;MQSB=0.748022;MQ0F=0	PL:DP:DV	0,30,231:10:0	0,27,205:9:0	0,33,217:11:0
+17	1398	.	G	<X>	0	.	DP=30;I16=12,18,0,0,1055,38309,0,0,1738,102482,0,0,584,12826,0,0;QS=3,0;MQSB=0.748022;MQ0F=0	PL:DP:DV	0,33,250:11:0	0,27,229:9:0	0,30,244:10:0
+17	1399	.	G	<X>	0	.	DP=30;I16=12,18,0,0,1132,43666,0,0,1738,102482,0,0,586,12854,0,0;QS=3,0;MQSB=0.748022;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,27,239:9:0	0,30,255:10:0
+17	1400	.	A	<X>	0	.	DP=30;I16=11,18,0,0,1101,42271,0,0,1678,98882,0,0,563,12289,0,0;QS=3,0;MQSB=0.720887;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,27,239:9:0	0,30,246:10:0
+17	1401	.	T	<X>	0	.	DP=30;I16=12,18,0,0,1130,44170,0,0,1738,102482,0,0,589,12955,0,0;QS=3,0;MQSB=0.748022;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,27,251:9:0	0,30,255:10:0
+17	1402	.	T	<X>	0	.	DP=31;I16=13,18,0,0,1152,44058,0,0,1798,106082,0,0,589,12977,0,0;QS=3,0;MQSB=0.771348;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,27,244:9:0	0,30,255:10:0
+17	1403	.	T	<X>	0	.	DP=31;I16=13,18,0,0,1178,45296,0,0,1798,106082,0,0,590,13032,0,0;QS=3,0;MQSB=0.771348;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,27,249:9:0	0,30,255:10:0
+17	1404	.	C	<X>	0	.	DP=31;I16=13,18,0,0,1102,40838,0,0,1798,106082,0,0,591,13121,0,0;QS=3,0;MQSB=0.771348;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,27,236:9:0	0,30,244:10:0
+17	1405	.	C	<X>	0	.	DP=30;I16=12,18,0,0,1154,45216,0,0,1738,102482,0,0,593,13243,0,0;QS=3,0;MQSB=0.748022;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,27,241:9:0	0,27,229:9:0
+17	1406	.	T	<X>	0	.	DP=30;I16=12,18,0,0,1153,44919,0,0,1738,102482,0,0,595,13397,0,0;QS=3,0;MQSB=0.748022;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,27,248:9:0	0,27,223:9:0
+17	1407	.	T	<X>	0	.	DP=30;I16=11,18,0,0,1074,40182,0,0,1678,98882,0,0,570,12856,0,0;QS=3,0;MQSB=0.720887;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,27,231:9:0	0,27,215:9:0
+17	1408	.	A	<X>	0	.	DP=30;I16=12,18,0,0,1131,43363,0,0,1738,102482,0,0,596,13592,0,0;QS=3,0;MQSB=0.748022;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,30,244:10:0	0,27,234:9:0
+17	1409	.	G	<X>	0	.	DP=29;I16=12,17,0,0,1082,40752,0,0,1678,98882,0,0,599,13729,0,0;QS=3,0;MQSB=0.753269;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,27,237:9:0	0,27,204:9:0
+17	1410	.	T	<X>	0	.	DP=29;I16=12,17,0,0,1084,41030,0,0,1678,98882,0,0,601,13841,0,0;QS=3,0;MQSB=0.753269;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,27,239:9:0	0,27,218:9:0
+17	1411	.	T	<X>	0	.	DP=29;I16=12,17,0,0,958,32550,0,0,1678,98882,0,0,600,13826,0,0;QS=3,0;MQSB=0.753269;MQ0F=0	PL:DP:DV	0,33,250:11:0	0,27,206:9:0	0,27,194:9:0
+17	1412	.	A	T,<X>	0	.	DP=29;I16=11,17,1,0,924,31586,25,625,1649,98041,29,841,573,13159,24,576;QS=2.90842,0.0915751,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.753269;BQB=1;MQ0F=0	PL:DP:DV	0,33,245,33,245,245:11:0	0,2,171,24,174,187:9:1	0,27,192,27,192,192:9:0
+17	1413	.	C	<X>	0	.	DP=29;I16=12,17,0,0,1067,39941,0,0,1678,98882,0,0,591,13521,0,0;QS=3,0;MQSB=0.753269;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,27,230:9:0	0,27,209:9:0
+17	1414	.	T	<X>	0	.	DP=29;I16=12,17,0,0,1123,44271,0,0,1678,98882,0,0,585,13335,0,0;QS=3,0;MQSB=0.753269;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,27,236:9:0	0,27,221:9:0
+17	1415	.	T	<X>	0	.	DP=29;I16=12,17,0,0,1000,35254,0,0,1678,98882,0,0,577,13077,0,0;QS=3,0;MQSB=0.753269;MQ0F=0	PL:DP:DV	0,33,246:11:0	0,27,216:9:0	0,27,208:9:0
+17	1416	.	A	<X>	0	.	DP=30;I16=13,17,0,0,1026,36124,0,0,1738,102482,0,0,569,12847,0,0;QS=3,0;MQSB=0.776389;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,27,208:9:0	0,27,199:9:0
+17	1417	.	C	<X>	0	.	DP=29;I16=13,16,0,0,1111,42941,0,0,1678,98882,0,0,563,12645,0,0;QS=3,0;MQSB=0.781802;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,27,235:9:0	0,24,211:8:0
+17	1418	.	T	<X>	0	.	DP=29;I16=13,16,0,0,1111,43021,0,0,1678,98882,0,0,557,12471,0,0;QS=3,0;MQSB=0.781802;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,27,231:9:0	0,24,207:8:0
+17	1419	.	A	<X>	0	.	DP=29;I16=13,16,0,0,1039,38191,0,0,1678,98882,0,0,551,12325,0,0;QS=3,0;MQSB=0.781802;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,27,222:9:0	0,24,199:8:0
+17	1420	.	T	<X>	0	.	DP=29;I16=13,16,0,0,1039,37885,0,0,1678,98882,0,0,544,12158,0,0;QS=3,0;MQSB=0.781802;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,27,234:9:0	0,24,185:8:0
+17	1421	.	G	<X>	0	.	DP=31;I16=13,18,0,0,1129,41649,0,0,1798,106082,0,0,536,11970,0,0;QS=3,0;MQSB=0.771348;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,30,247:10:0	0,24,191:8:0
+17	1422	.	C	<X>	0	.	DP=29;I16=13,16,0,0,1075,40645,0,0,1678,98882,0,0,532,11810,0,0;QS=3,0;MQSB=0.781802;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,30,239:10:0	0,18,180:6:0
+17	1423	.	T	<X>	0	.	DP=31;I16=14,17,0,0,1179,45767,0,0,1798,106082,0,0,528,11678,0,0;QS=3,0;MQSB=0.79638;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,36,255:12:0	0,18,183:6:0
+17	1424	.	C	<X>	0	.	DP=30;I16=13,17,0,0,1086,40448,0,0,1738,102482,0,0,527,11575,0,0;QS=3,0;MQSB=0.776389;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,36,255:12:0	0,18,174:6:0
+17	1425	.	C	<X>	0	.	DP=30;I16=13,17,0,0,1124,42974,0,0,1738,102482,0,0,525,11453,0,0;QS=3,0;MQSB=0.776389;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,36,255:12:0	0,18,180:6:0
+17	1426	.	T	<X>	0	.	DP=32;I16=15,17,0,0,1218,47130,0,0,1858,109682,0,0,523,11363,0,0;QS=3,0;MQSB=0.813784;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,36,255:12:0	0,18,188:6:0
+17	1427	.	T	<X>	0	.	DP=32;I16=14,18,0,0,1126,40772,0,0,1827,106923,0,0,524,11306,0,0;QS=3,0;MQSB=0.916401;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,36,255:12:0	0,18,176:6:0
+17	1428	.	G	<X>	0	.	DP=33;I16=15,18,0,0,1188,43596,0,0,1887,110523,0,0,525,11233,0,0;QS=3,0;MQSB=0.930476;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,36,255:12:0	0,18,166:6:0
+17	1429	.	G	<X>	0	.	DP=33;I16=14,18,0,0,1070,37720,0,0,1858,109682,0,0,507,10795,0,0;QS=3,0;MQSB=0.997118;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,33,243:11:0	0,18,148:6:0
+17	1430	.	C	<X>	0	.	DP=33;I16=15,18,0,0,1145,40795,0,0,1887,110523,0,0,529,11193,0,0;QS=3,0;MQSB=0.930476;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,36,247:12:0	0,18,157:6:0
+17	1431	.	C	<X>	0	.	DP=33;I16=15,18,0,0,1160,41686,0,0,1887,110523,0,0,531,11227,0,0;QS=3,0;MQSB=0.930476;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,36,253:12:0	0,18,167:6:0
+17	1432	.	A	<X>	0	.	DP=33;I16=15,18,0,0,1118,39032,0,0,1887,110523,0,0,533,11297,0,0;QS=3,0;MQSB=0.930476;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,36,255:12:0	0,18,169:6:0
+17	1433	.	T	<X>	0	.	DP=34;I16=15,19,0,0,1238,45602,0,0,1947,114123,0,0,535,11403,0,0;QS=3,0;MQSB=0.923533;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,36,255:12:0	0,18,174:6:0
+17	1434	.	T	<X>	0	.	DP=35;I16=15,20,0,0,1269,46757,0,0,2007,117723,0,0,537,11495,0,0;QS=3,0;MQSB=0.916855;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,36,255:12:0	0,18,179:6:0
+17	1435	.	T	<X>	0	.	DP=35;I16=14,20,0,0,1256,46868,0,0,1947,114123,0,0,515,10999,0,0;QS=3,0;MQSB=0.901704;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,36,255:12:0	0,18,180:6:0
+17	1436	.	C	<X>	0	.	DP=34;I16=14,20,0,0,1250,46978,0,0,1947,114123,0,0,544,11790,0,0;QS=3,0;MQSB=0.901704;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,36,255:12:0	0,18,165:6:0
+17	1437	.	T	<X>	0	.	DP=32;I16=13,19,0,0,1222,47206,0,0,1858,109682,0,0,548,11892,0,0;QS=3,0;MQSB=0.993397;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,33,255:11:0	0,15,161:5:0
+17	1438	.	C	<X>	0	.	DP=30;I16=13,17,0,0,1132,43284,0,0,1738,102482,0,0,554,12028,0,0;QS=3,0;MQSB=0.996503;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,30,251:10:0	0,15,159:5:0
+17	1439	.	T	<X>	0	.	DP=30;I16=13,17,0,0,1110,41602,0,0,1738,102482,0,0,560,12196,0,0;QS=3,0;MQSB=0.996503;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,30,255:10:0	0,15,156:5:0
+17	1440	.	A	<X>	0	.	DP=30;I16=12,16,0,0,1062,41028,0,0,1618,95282,0,0,550,12106,0,0;QS=3,0;MQSB=0.995699;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,27,255:9:0	0,12,144:4:0
+17	1441	.	G	<X>	0	.	DP=30;I16=13,17,0,0,1138,44104,0,0,1738,102482,0,0,574,12576,0,0;QS=3,0;MQSB=0.996503;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,30,244:10:0	0,12,137:4:0
+17	1442	.	G	<X>	0	.	DP=30;I16=13,17,0,0,1064,38534,0,0,1738,102482,0,0,580,12740,0,0;QS=3,0;MQSB=0.996503;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,30,242:10:0	0,12,128:4:0
+17	1443	.	T	<X>	0	.	DP=30;I16=12,17,0,0,1013,36225,0,0,1678,98882,0,0,568,12598,0,0;QS=3,0;MQSB=0.993891;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,30,230:10:0	0,12,133:4:0
+17	1444	.	A	<X>	0	.	DP=30;I16=12,17,0,0,968,33936,0,0,1678,98882,0,0,569,12627,0,0;QS=3,0;MQSB=0.993891;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,27,205:9:0	0,12,132:4:0
+17	1445	.	T	<X>	0	.	DP=30;I16=14,15,0,0,1053,39129,0,0,1678,98882,0,0,585,13161,0,0;QS=3,0;MQSB=0.999762;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,27,237:9:0	0,15,169:5:0
+17	1446	.	T	<X>	0	.	DP=30;I16=13,16,0,0,1051,38675,0,0,1678,98882,0,0,579,12951,0,0;QS=3,0;MQSB=0.997839;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,24,229:8:0	0,15,164:5:0
+17	1447	.	G	<X>	0	.	DP=30;I16=14,16,0,0,1110,42692,0,0,1738,102482,0,0,606,13612,0,0;QS=3,0;MQSB=0.999136;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,27,229:9:0	0,15,157:5:0
+17	1448	.	G	<X>	0	.	DP=30;I16=13,16,0,0,1037,37759,0,0,1678,98882,0,0,585,13151,0,0;QS=3,0;MQSB=0.997839;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,24,217:8:0	0,15,150:5:0
+17	1449	.	T	<X>	0	.	DP=30;I16=14,16,0,0,1051,37869,0,0,1738,102482,0,0,612,13870,0,0;QS=3,0;MQSB=0.999136;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,27,230:9:0	0,15,152:5:0
+17	1450	.	A	<X>	0	.	DP=29;I16=13,15,0,0,1039,38785,0,0,1649,98041,0,0,604,13842,0,0;QS=3,0;MQSB=0.956162;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,24,224:8:0	0,15,165:5:0
+17	1451	.	T	<X>	0	.	DP=29;I16=13,16,0,0,1046,38586,0,0,1709,101641,0,0,616,14042,0,0;QS=3,0;MQSB=0.960189;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,24,228:8:0	0,15,158:5:0
+17	1452	.	A	<X>	0	.	DP=31;I16=14,16,0,0,1066,38696,0,0,1769,105241,0,0,604,13924,0,0;QS=3,0;MQSB=0.958545;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,24,218:8:0	0,15,147:5:0
+17	1453	.	T	<X>	0	.	DP=31;I16=13,17,0,0,1107,42059,0,0,1769,105241,0,0,592,13444,0,0;QS=3,0;MQSB=0.963674;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,21,199:7:0	0,15,165:5:0
+17	1454	.	T	<X>	0	.	DP=31;I16=14,17,0,0,1139,42711,0,0,1829,108841,0,0,617,14045,0,0;QS=3,0;MQSB=0.962133;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,24,234:8:0	0,15,166:5:0
+17	1455	.	G	<X>	0	.	DP=31;I16=13,17,0,0,1107,41765,0,0,1769,105241,0,0,592,13420,0,0;QS=3,0;MQSB=0.963674;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,21,197:7:0	0,15,148:5:0
+17	1456	.	T	<X>	0	.	DP=31;I16=14,17,0,0,1139,42717,0,0,1829,108841,0,0,617,14069,0,0;QS=3,0;MQSB=0.962133;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,24,215:8:0	0,15,170:5:0
+17	1457	.	G	<X>	0	.	DP=31;I16=14,17,0,0,1129,42071,0,0,1829,108841,0,0,615,14019,0,0;QS=3,0;MQSB=0.962133;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,24,212:8:0	0,15,164:5:0
+17	1458	.	T	<X>	0	.	DP=31;I16=14,17,0,0,1101,40243,0,0,1829,108841,0,0,613,13997,0,0;QS=3,0;MQSB=0.962133;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,24,220:8:0	0,15,165:5:0
+17	1459	.	C	A,<X>	0	.	DP=31;I16=14,16,0,1,1164,45842,24,576,1769,105241,60,3600,608,13948,2,4;QS=2.87234,0.12766,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.962133;BQB=1;MQ0F=0	PL:DP:DV	0,54,255,54,255,255:18:0	0,24,224,24,224,224:8:0	9,0,135,21,138,152:5:1
+17	1460	.	T	<X>	0	.	DP=32;I16=15,17,0,0,1243,48813,0,0,1889,112441,0,0,605,13833,0,0;QS=3,0;MQSB=0.960687;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,24,240:8:0	0,15,170:5:0
+17	1461	.	G	<X>	0	.	DP=32;I16=15,17,0,0,1171,44033,0,0,1889,112441,0,0,600,13692,0,0;QS=3,0;MQSB=0.960687;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,24,224:8:0	0,15,157:5:0
+17	1462	.	C	<X>	0	.	DP=30;I16=14,15,0,0,1102,42216,0,0,1709,101641,0,0,579,13241,0,0;QS=3,0;MQSB=0.954405;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,21,202:7:0	0,9,112:3:0
+17	1463	.	T	<X>	0	.	DP=30;I16=15,15,0,0,1128,43348,0,0,1769,105241,0,0,592,13396,0,0;QS=3,0;MQSB=0.952765;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,21,209:7:0	0,12,139:4:0
+17	1464	.	G	<X>	0	.	DP=31;I16=14,16,0,0,1095,40557,0,0,1769,105241,0,0,563,12665,0,0;QS=3,0;MQSB=0.958545;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,18,186:6:0	0,15,144:5:0
+17	1465	.	T	<X>	0	.	DP=31;I16=15,16,0,0,1143,42557,0,0,1829,108841,0,0,584,13164,0,0;QS=3,0;MQSB=0.957006;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,21,204:7:0	0,15,166:5:0
+17	1466	.	G	<X>	0	.	DP=31;I16=15,16,0,0,1122,42294,0,0,1829,108841,0,0,580,13018,0,0;QS=3,0;MQSB=0.957006;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,21,206:7:0	0,15,163:5:0
+17	1467	.	A	<X>	0	.	DP=31;I16=14,16,0,0,1031,36341,0,0,1769,105241,0,0,569,12803,0,0;QS=3,0;MQSB=0.958545;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,21,195:7:0	0,15,155:5:0
+17	1468	.	A	<X>	0	.	DP=30;I16=15,15,0,0,991,34477,0,0,1769,105241,0,0,573,12717,0,0;QS=3,0;MQSB=0.952765;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,21,177:7:0	0,15,158:5:0
+17	1469	.	C	T,<X>	0	.	DP=31;I16=13,15,1,0,1013,37887,38,1444,1649,98041,60,3600,536,12106,9,81;QS=2.94025,0.0597484,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.954405;BQB=1;MQ0F=0	PL:DP:DV	0,16,255,51,255,255:18:1	0,18,178,18,178,178:6:0	0,15,160,15,160,160:5:0
+17	1470	.	T	<X>	0	.	DP=31;I16=16,15,0,0,1110,41070,0,0,1829,108841,0,0,567,12489,0,0;QS=3,0;MQSB=0.951229;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,21,210:7:0	0,15,165:5:0
+17	1471	.	G	<X>	0	.	DP=30;I16=16,14,0,0,1051,38425,0,0,1769,105241,0,0,564,12348,0,0;QS=3,0;MQSB=0.946202;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,21,192:7:0	0,12,128:4:0
+17	1472	.	T	<X>	0	.	DP=30;I16=16,14,0,0,1049,38097,0,0,1769,105241,0,0,561,12237,0,0;QS=3,0;MQSB=0.946202;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,21,200:7:0	0,12,134:4:0
+17	1473	.	C	<X>	0	.	DP=30;I16=16,14,0,0,1058,38526,0,0,1769,105241,0,0,558,12156,0,0;QS=3,0;MQSB=0.946202;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,21,175:7:0	0,12,140:4:0
+17	1474	.	C	<X>	0	.	DP=30;I16=16,14,0,0,1120,42756,0,0,1769,105241,0,0,555,12105,0,0;QS=3,0;MQSB=0.946202;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,21,202:7:0	0,12,141:4:0
+17	1475	.	T	<X>	0	.	DP=29;I16=14,14,0,0,1047,40395,0,0,1649,98041,0,0,537,11827,0,0;QS=3,0;MQSB=0.949591;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,21,208:7:0	0,12,155:4:0
+17	1476	.	T	G,<X>	0	.	DP=31;I16=15,15,1,0,1056,37884,14,196,1769,105241,60,3600,566,12614,10,100;QS=2.944,0.056,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.951229;BQB=1;MQ0F=0	PL:DP:DV	0,57,255,57,255,255:19:0	0,9,177,21,180,183:8:1	0,12,140,12,140,140:4:0
+17	1477	.	G	<X>	0	.	DP=31;I16=16,15,0,0,1150,43390,0,0,1829,108841,0,0,574,12700,0,0;QS=3,0;MQSB=0.951229;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,24,217:8:0	0,12,138:4:0
+17	1478	.	G	<X>	0	.	DP=31;I16=14,15,0,0,1008,36638,0,0,1709,101641,0,0,542,11982,0,0;QS=3,0;MQSB=0.954405;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,24,208:8:0	0,9,109:3:0
+17	1479	.	C	<X>	0	.	DP=30;I16=15,15,0,0,1061,38671,0,0,1769,105241,0,0,564,12556,0,0;QS=3,0;MQSB=0.952765;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,24,211:8:0	0,9,106:3:0
+17	1480	.	C	<X>	0	.	DP=30;I16=15,15,0,0,1083,40355,0,0,1769,105241,0,0,561,12531,0,0;QS=3,0;MQSB=0.952765;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,24,220:8:0	0,9,103:3:0
+17	1481	.	T	<X>	0	.	DP=30;I16=15,15,0,0,1102,41308,0,0,1769,105241,0,0,558,12532,0,0;QS=3,0;MQSB=0.952765;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,24,235:8:0	0,9,105:3:0
+17	1482	.	G	<X>	0	.	DP=29;I16=15,14,0,0,1044,38550,0,0,1709,101641,0,0,556,12558,0,0;QS=3,0;MQSB=0.947838;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,24,210:8:0	0,6,75:2:0
+17	1483	.	T	<X>	0	.	DP=31;I16=14,16,0,0,1042,37190,0,0,1769,105241,0,0,521,11919,0,0;QS=3,0;MQSB=0.958545;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,21,215:7:0	0,9,100:3:0
+17	1484	.	T	<X>	0	.	DP=31;I16=15,16,0,0,1067,37837,0,0,1829,108841,0,0,547,12587,0,0;QS=3,0;MQSB=0.957006;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,24,216:8:0	0,9,106:3:0
+17	1485	.	T	<X>	0	.	DP=30;I16=15,15,0,0,1027,35863,0,0,1769,105241,0,0,549,12659,0,0;QS=3,0;MQSB=0.952765;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,24,209:8:0	0,9,93:3:0
+17	1486	.	G	<X>	0	.	DP=29;I16=15,14,0,0,1089,41679,0,0,1709,101641,0,0,551,12707,0,0;QS=3,0;MQSB=0.947838;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,21,198:7:0	0,9,108:3:0
+17	1487	.	G	<X>	0	.	DP=28;I16=14,14,0,0,973,34723,0,0,1649,98041,0,0,554,12778,0,0;QS=3,0;MQSB=0.949591;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,21,196:7:0	0,9,97:3:0
+17	1488	.	T	<X>	0	.	DP=28;I16=13,14,0,0,928,32432,0,0,1589,94441,0,0,532,12246,0,0;QS=3,0;MQSB=0.951472;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,18,176:6:0	0,9,102:3:0
+17	1489	.	G	<X>	0	.	DP=27;I16=13,14,0,0,958,35292,0,0,1589,94441,0,0,535,12361,0,0;QS=3,0;MQSB=0.951472;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,18,174:6:0	0,9,93:3:0
+17	1490	.	A	<X>	0	.	DP=27;I16=13,14,0,0,928,33108,0,0,1589,94441,0,0,538,12446,0,0;QS=3,0;MQSB=0.951472;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,15,160:5:0	0,9,94:3:0
+17	1491	.	C	<X>	0	.	DP=27;I16=12,13,0,0,798,26812,0,0,1469,87241,0,0,499,11587,0,0;QS=3,0;MQSB=0.948139;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,12,108:4:0	0,9,79:3:0
+17	1492	.	G	<X>	0	.	DP=27;I16=13,14,0,0,893,30927,0,0,1589,94441,0,0,543,12527,0,0;QS=3,0;MQSB=0.951472;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,15,136:5:0	0,9,100:3:0
+17	1493	.	G	<X>	0	.	DP=27;I16=13,13,0,0,907,32761,0,0,1529,90841,0,0,520,11948,0,0;QS=3,0;MQSB=0.945959;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,15,155:5:0	0,9,106:3:0
+17	1494	.	G	<X>	0	.	DP=27;I16=13,14,0,0,939,33599,0,0,1589,94441,0,0,547,12639,0,0;QS=3,0;MQSB=0.951472;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,15,156:5:0	0,9,107:3:0
+17	1495	.	T	<X>	0	.	DP=26;I16=12,13,0,0,814,27700,0,0,1469,87241,0,0,524,12048,0,0;QS=3,0;MQSB=0.948139;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,15,143:5:0	0,9,105:3:0
+17	1496	.	G	<X>	0	.	DP=26;I16=13,13,0,0,969,36751,0,0,1529,90841,0,0,550,12674,0,0;QS=3,0;MQSB=0.945959;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,15,157:5:0	0,9,107:3:0
+17	1497	.	A	<X>	0	.	DP=27;I16=12,14,0,0,904,32740,0,0,1529,90841,0,0,525,12019,0,0;QS=3,0;MQSB=0.953497;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,15,166:5:0	0,9,113:3:0
+17	1498	.	G	<X>	0	.	DP=27;I16=13,14,0,0,1002,37852,0,0,1589,94441,0,0,551,12635,0,0;QS=3,0;MQSB=0.951472;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,15,153:5:0	0,9,112:3:0
+17	1499	.	G	<X>	0	.	DP=28;I16=14,14,0,0,973,34891,0,0,1649,98041,0,0,551,12599,0,0;QS=3,0;MQSB=0.949591;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,15,146:5:0	0,9,108:3:0
+17	1500	.	A	<X>	0	.	DP=28;I16=14,14,0,0,1023,38115,0,0,1649,98041,0,0,552,12588,0,0;QS=3,0;MQSB=0.949591;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,15,165:5:0	0,9,115:3:0
+17	1501	.	G	<X>	0	.	DP=28;I16=14,14,0,0,1051,40105,0,0,1649,98041,0,0,551,12505,0,0;QS=3,0;MQSB=0.949591;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,15,163:5:0	0,9,100:3:0
+17	1502	.	C	<X>	0	.	DP=27;I16=13,14,0,0,963,35241,0,0,1589,94441,0,0,549,12351,0,0;QS=3,0;MQSB=0.951472;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,15,140:5:0	0,9,105:3:0
+17	1503	.	A	<X>	0	.	DP=28;I16=14,14,0,0,1026,38252,0,0,1649,98041,0,0,546,12176,0,0;QS=3,0;MQSB=0.949591;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,15,171:5:0	0,9,109:3:0
+17	1504	.	G	<X>	0	.	DP=28;I16=13,14,0,0,1052,41226,0,0,1589,94441,0,0,523,11591,0,0;QS=3,0;MQSB=0.951472;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,15,163:5:0	0,9,111:3:0
+17	1505	.	G	<X>	0	.	DP=28;I16=14,13,0,0,959,35545,0,0,1589,94441,0,0,517,11295,0,0;QS=3,0;MQSB=0.94394;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,15,155:5:0	0,9,114:3:0
+17	1506	.	G	<X>	0	.	DP=28;I16=14,14,0,0,1013,37355,0,0,1649,98041,0,0,540,11840,0,0;QS=3,0;MQSB=0.949591;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,15,139:5:0	0,9,112:3:0
+17	1507	.	A	<X>	0	.	DP=28;I16=14,14,0,0,987,35217,0,0,1649,98041,0,0,538,11792,0,0;QS=3,0;MQSB=0.949591;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,15,162:5:0	0,9,114:3:0
+17	1508	.	C	<X>	0	.	DP=28;I16=14,14,0,0,1033,38663,0,0,1649,98041,0,0,535,11727,0,0;QS=3,0;MQSB=0.949591;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,15,137:5:0	0,9,112:3:0
+17	1509	.	A	<X>	0	.	DP=28;I16=15,13,0,0,1028,38610,0,0,1649,98041,0,0,529,11493,0,0;QS=3,0;MQSB=0.942064;MQ0F=0	PL:DP:DV	0,63,255:21:0	0,12,128:4:0	0,9,122:3:0
+17	1510	.	G	<X>	0	.	DP=28;I16=15,13,0,0,1064,40824,0,0,1649,98041,0,0,524,11288,0,0;QS=3,0;MQSB=0.942064;MQ0F=0	PL:DP:DV	0,63,255:21:0	0,12,132:4:0	0,9,111:3:0
+17	1511	.	A	<X>	0	.	DP=28;I16=15,13,0,0,976,34794,0,0,1649,98041,0,0,519,11113,0,0;QS=3,0;MQSB=0.942064;MQ0F=0	PL:DP:DV	0,63,255:21:0	0,12,136:4:0	0,9,110:3:0
+17	1512	.	A	<X>	0	.	DP=28;I16=15,12,0,0,998,37460,0,0,1589,94441,0,0,489,10343,0,0;QS=3,0;MQSB=0.935229;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,12,142:4:0	0,9,110:3:0
+17	1513	.	G	<X>	0	.	DP=28;I16=14,13,0,0,1014,38940,0,0,1589,94441,0,0,497,10709,0,0;QS=3,0;MQSB=0.94394;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,12,134:4:0	0,9,108:3:0
+17	1514	.	G	<X>	0	.	DP=28;I16=15,13,0,0,1054,39954,0,0,1649,98041,0,0,504,10768,0,0;QS=3,0;MQSB=0.942064;MQ0F=0	PL:DP:DV	0,63,255:21:0	0,12,134:4:0	0,9,108:3:0
+17	1515	.	G	<X>	0	.	DP=28;I16=14,13,0,0,948,34152,0,0,1589,94441,0,0,488,10564,0,0;QS=3,0;MQSB=0.94394;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,12,133:4:0	0,9,101:3:0
+17	1516	.	T	<X>	0	.	DP=27;I16=12,13,0,0,811,27385,0,0,1469,87241,0,0,472,10338,0,0;QS=3,0;MQSB=0.948139;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,12,117:4:0	0,9,106:3:0
+17	1517	.	C	<X>	0	.	DP=27;I16=13,13,0,0,943,35153,0,0,1529,90841,0,0,478,10380,0,0;QS=3,0;MQSB=0.945959;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,12,134:4:0	0,9,97:3:0
+17	1518	.	C	<X>	0	.	DP=28;I16=13,12,0,0,908,33852,0,0,1469,87241,0,0,427,9261,0,0;QS=3,0;MQSB=0.939413;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,12,132:4:0	0,9,96:3:0
+17	1519	.	T	<X>	0	.	DP=28;I16=15,13,0,0,988,35808,0,0,1649,98041,0,0,475,10337,0,0;QS=3,0;MQSB=0.942064;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,15,154:5:0	0,9,110:3:0
+17	1520	.	G	<X>	0	.	DP=29;I16=16,13,0,0,1005,36307,0,0,1709,101641,0,0,470,10328,0,0;QS=3,0;MQSB=0.940317;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,18,150:6:0	0,9,104:3:0
+17	1521	.	C	<X>	0	.	DP=28;I16=16,12,0,0,900,30324,0,0,1649,98041,0,0,466,10300,0,0;QS=3,0;MQSB=0.933359;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,18,164:6:0	0,9,88:3:0
+17	1522	.	G	<X>	0	.	DP=27;I16=15,10,0,0,784,25144,0,0,1469,87241,0,0,442,9956,0,0;QS=3,0;MQSB=0.9171;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,15,110:5:0	0,9,91:3:0
+17	1523	.	T	<X>	0	.	DP=27;I16=16,11,0,0,921,32001,0,0,1589,94441,0,0,457,10189,0,0;QS=3,0;MQSB=0.925036;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,15,136:5:0	0,9,108:3:0
+17	1524	.	G	<X>	0	.	DP=27;I16=16,10,0,0,932,34140,0,0,1529,90841,0,0,453,10153,0,0;QS=3,0;MQSB=0.914947;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,12,108:4:0	0,9,103:3:0
+17	1525	.	C	<X>	0	.	DP=27;I16=16,11,0,0,972,35704,0,0,1589,94441,0,0,473,10719,0,0;QS=3,0;MQSB=0.925036;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,12,113:4:0	0,9,112:3:0
+17	1526	.	C	<X>	0	.	DP=25;I16=14,11,0,0,883,31843,0,0,1469,87241,0,0,470,10684,0,0;QS=3,0;MQSB=0.929204;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,12,109:4:0	0,9,106:3:0
+17	1527	.	C	<X>	0	.	DP=24;I16=14,10,0,0,867,31999,0,0,1440,86400,0,0,466,10572,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,12,107:4:0	0,9,112:3:0
+17	1528	.	T	<X>	0	.	DP=23;I16=13,10,0,0,869,33133,0,0,1380,82800,0,0,463,10483,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,12,114:4:0	0,9,113:3:0
+17	1529	.	G	<X>	0	.	DP=23;I16=13,10,0,0,812,29432,0,0,1380,82800,0,0,459,10365,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,12,108:4:0	0,9,104:3:0
+17	1530	.	C	<X>	0	.	DP=24;I16=13,10,0,0,819,30073,0,0,1380,82800,0,0,446,10186,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,137:5:0	0,9,106:3:0
+17	1531	.	C	<X>	0	.	DP=24;I16=13,11,0,0,877,32969,0,0,1440,86400,0,0,452,10190,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,15,144:5:0	0,9,105:3:0
+17	1532	.	T	<X>	0	.	DP=24;I16=13,11,0,0,887,33721,0,0,1440,86400,0,0,449,10135,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,15,165:5:0	0,9,120:3:0
+17	1533	.	T	<X>	0	.	DP=23;I16=13,10,0,0,793,27987,0,0,1380,82800,0,0,447,10101,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,146:5:0	0,9,107:3:0
+17	1534	.	C	<X>	0	.	DP=23;I16=14,9,0,0,847,31627,0,0,1380,82800,0,0,446,10086,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,153:5:0	0,9,109:3:0
+17	1535	.	A	<X>	0	.	DP=23;I16=14,9,0,0,770,26604,0,0,1380,82800,0,0,444,9990,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,144:5:0	0,9,99:3:0
+17	1536	.	C	<X>	0	.	DP=24;I16=15,9,0,0,826,28984,0,0,1440,86400,0,0,442,9914,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,15,138:5:0	0,9,110:3:0
+17	1537	.	A	<X>	0	.	DP=24;I16=14,9,0,0,844,31384,0,0,1380,82800,0,0,416,9234,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,149:5:0	0,9,115:3:0
+17	1538	.	A	<X>	0	.	DP=24;I16=15,9,0,0,909,34727,0,0,1440,86400,0,0,440,9826,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,15,154:5:0	0,9,112:3:0
+17	1539	.	G	<X>	0	.	DP=24;I16=15,9,0,0,913,35327,0,0,1440,86400,0,0,439,9815,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,15,149:5:0	0,9,117:3:0
+17	1540	.	C	<X>	0	.	DP=23;I16=15,8,0,0,828,30260,0,0,1380,82800,0,0,438,9776,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,146:5:0	0,9,102:3:0
+17	1541	.	C	<X>	0	.	DP=23;I16=15,8,0,0,823,30615,0,0,1380,82800,0,0,437,9759,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,142:5:0	0,9,108:3:0
+17	1542	.	C	<X>	0	.	DP=25;I16=16,8,0,0,893,33843,0,0,1440,86400,0,0,435,9715,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,147:5:0	0,12,131:4:0
+17	1543	.	C	<X>	0	.	DP=25;I16=16,8,0,0,880,33206,0,0,1440,86400,0,0,434,9696,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,141:5:0	0,12,136:4:0
+17	1544	.	T	<X>	0	.	DP=25;I16=16,8,0,0,899,34405,0,0,1440,86400,0,0,431,9603,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,150:5:0	0,12,148:4:0
+17	1545	.	G	<X>	0	.	DP=25;I16=16,8,0,0,874,32636,0,0,1440,86400,0,0,428,9536,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,146:5:0	0,12,129:4:0
+17	1546	.	G	<X>	0	.	DP=24;I16=15,8,0,0,796,28796,0,0,1380,82800,0,0,425,9443,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,130:5:0	0,9,110:3:0
+17	1547	.	A	<X>	0	.	DP=23;I16=15,8,0,0,837,30945,0,0,1380,82800,0,0,448,9996,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,18,176:6:0	0,9,112:3:0
+17	1548	.	A	<X>	0	.	DP=23;I16=14,8,0,0,812,30830,0,0,1320,79200,0,0,421,9319,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,173:5:0	0,9,115:3:0
+17	1549	.	G	<X>	0	.	DP=23;I16=15,8,0,0,870,33642,0,0,1380,82800,0,0,444,9912,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,18,174:6:0	0,9,114:3:0
+17	1550	.	G	<X>	0	.	DP=23;I16=15,8,0,0,790,28502,0,0,1380,82800,0,0,442,9900,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,18,154:6:0	0,9,109:3:0
+17	1551	.	A	<X>	0	.	DP=23;I16=15,8,0,0,802,28596,0,0,1380,82800,0,0,440,9908,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,18,173:6:0	0,9,107:3:0
+17	1552	.	A	<X>	0	.	DP=21;I16=14,7,0,0,792,30156,0,0,1260,75600,0,0,438,9836,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,196:6:0	0,9,110:3:0
+17	1553	.	A	<X>	0	.	DP=21;I16=13,7,0,0,738,28112,0,0,1200,72000,0,0,411,9159,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,251:11:0	0,18,192:6:0	0,9,115:3:0
+17	1554	.	G	<X>	0	.	DP=21;I16=14,7,0,0,763,28221,0,0,1260,75600,0,0,434,9752,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,171:6:0	0,9,101:3:0
+17	1555	.	T	<X>	0	.	DP=21;I16=14,7,0,0,726,26234,0,0,1260,75600,0,0,432,9740,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,252:12:0	0,18,169:6:0	0,9,108:3:0
+17	1556	.	T	<X>	0	.	DP=21;I16=14,7,0,0,745,26971,0,0,1260,75600,0,0,429,9697,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,253:12:0	0,18,177:6:0	0,9,110:3:0
+17	1557	.	G	<X>	0	.	DP=22;I16=15,7,0,0,801,29689,0,0,1320,79200,0,0,426,9672,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,18,166:6:0	0,9,101:3:0
+17	1558	.	T	<X>	0	.	DP=22;I16=15,6,0,0,720,25620,0,0,1260,75600,0,0,404,9244,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,131:5:0	0,9,112:3:0
+17	1559	.	T	<X>	0	.	DP=22;I16=15,7,0,0,712,24690,0,0,1320,79200,0,0,417,9439,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,248:13:0	0,18,158:6:0	0,9,103:3:0
+17	1560	.	T	<X>	0	.	DP=21;I16=14,7,0,0,736,26560,0,0,1260,75600,0,0,412,9284,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,251:12:0	0,18,170:6:0	0,9,112:3:0
+17	1561	.	T	<X>	0	.	DP=21;I16=14,7,0,0,706,24776,0,0,1260,75600,0,0,406,9102,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,241:12:0	0,18,174:6:0	0,9,106:3:0
+17	1562	.	G	<X>	0	.	DP=21;I16=14,7,0,0,765,28655,0,0,1260,75600,0,0,399,8893,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,181:6:0	0,9,108:3:0
+17	1563	.	G	<X>	0	.	DP=22;I16=13,7,0,0,713,26255,0,0,1200,72000,0,0,360,8176,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,147:5:0	0,9,108:3:0
+17	1564	.	G	<X>	0	.	DP=22;I16=13,8,0,0,721,25457,0,0,1260,75600,0,0,368,8218,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,173:6:0	0,9,95:3:0
+17	1565	.	A	<X>	0	.	DP=21;I16=14,7,0,0,724,25888,0,0,1260,75600,0,0,380,8352,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,18,162:6:0	0,6,71:2:0
+17	1566	.	T	<X>	0	.	DP=21;I16=13,7,0,0,698,25286,0,0,1200,72000,0,0,364,8086,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,143:5:0	0,6,78:2:0
+17	1567	.	C	<X>	0	.	DP=20;I16=12,6,0,0,652,24422,0,0,1080,64800,0,0,351,7881,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,9,104:3:0	0,6,72:2:0
+17	1568	.	T	<X>	0	.	DP=20;I16=13,7,0,0,711,26125,0,0,1200,72000,0,0,363,7871,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,157:5:0	0,6,74:2:0
+17	1569	.	C	<X>	0	.	DP=19;I16=12,6,0,0,676,25850,0,0,1080,64800,0,0,351,7669,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,128:4:0	0,6,76:2:0
+17	1570	.	T	<X>	0	.	DP=19;I16=12,7,0,0,700,26750,0,0,1140,68400,0,0,353,7583,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,149:5:0	0,6,71:2:0
+17	1571	.	G	<X>	0	.	DP=19;I16=12,6,0,0,639,23361,0,0,1080,64800,0,0,343,7441,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,125:4:0	0,6,70:2:0
+17	1572	.	C	<X>	0	.	DP=19;I16=11,6,0,0,640,24568,0,0,1020,61200,0,0,328,7202,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,125:4:0	0,6,70:2:0
+17	1573	.	A	<X>	0	.	DP=19;I16=11,4,0,0,565,21475,0,0,900,54000,0,0,304,6900,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,12,132:4:0	0,3,40:1:0
+17	1574	.	C	<X>	0	.	DP=19;I16=12,5,0,0,636,24076,0,0,1020,61200,0,0,318,6948,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,128:4:0	0,3,38:1:0
+17	1575	.	C	<X>	0	.	DP=19;I16=11,6,0,0,610,22742,0,0,1020,61200,0,0,296,6272,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,125:4:0	0,6,71:2:0
+17	1576	.	C	<X>	0	.	DP=19;I16=12,6,0,0,675,25821,0,0,1080,64800,0,0,315,6785,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,133:4:0	0,6,78:2:0
+17	1577	.	T	<X>	0	.	DP=17;I16=11,6,0,0,650,25330,0,0,1020,61200,0,0,310,6692,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,9,118:3:0	0,6,77:2:0
+17	1578	.	C	<X>	0	.	DP=17;I16=10,6,0,0,622,24364,0,0,960,57600,0,0,279,5943,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,6,84:2:0	0,6,77:2:0
+17	1579	.	A	<X>	0	.	DP=17;I16=11,6,0,0,596,22326,0,0,1020,61200,0,0,298,6464,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,9,116:3:0	0,6,80:2:0
+17	1580	.	G	<X>	0	.	DP=17;I16=11,6,0,0,651,25195,0,0,1020,61200,0,0,292,6380,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,9,109:3:0	0,6,77:2:0
+17	1581	.	C	<X>	0	.	DP=17;I16=11,6,0,0,586,21418,0,0,1020,61200,0,0,286,6316,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,9,103:3:0	0,6,71:2:0
+17	1582	.	C	<X>	0	.	DP=18;I16=11,7,0,0,639,23491,0,0,1080,64800,0,0,280,6272,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,9,109:3:0	0,6,75:2:0
+17	1583	.	T	<X>	0	.	DP=16;I16=10,6,0,0,591,22349,0,0,960,57600,0,0,276,6196,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,9,112:3:0	0,6,74:2:0
+17	1584	.	G	<X>	0	.	DP=15;I16=10,5,0,0,563,21283,0,0,900,54000,0,0,272,6086,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,9,105:3:0	0,3,39:1:0
+17	1585	.	G	<X>	0	.	DP=16;I16=10,5,0,0,494,17160,0,0,900,54000,0,0,251,5703,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,244:11:0	0,9,103:3:0	0,3,30:1:0
+17	1586	.	A	<X>	0	.	DP=15;I16=10,3,0,0,470,17200,0,0,780,46800,0,0,237,5273,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,223:10:0	0,6,79:2:0	0,3,42:1:0
+17	1587	.	C	<X>	0	.	DP=15;I16=11,4,0,0,508,17900,0,0,900,54000,0,0,264,5852,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,247:11:0	0,9,94:3:0	0,3,31:1:0
+17	1588	.	A	<X>	0	.	DP=15;I16=11,4,0,0,511,17939,0,0,900,54000,0,0,262,5806,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,232:11:0	0,9,105:3:0	0,3,41:1:0
+17	1589	.	A	<X>	0	.	DP=15;I16=11,4,0,0,536,19584,0,0,900,54000,0,0,259,5725,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,249:11:0	0,9,106:3:0	0,3,42:1:0
+17	1590	.	C	<X>	0	.	DP=15;I16=10,5,0,0,514,18228,0,0,900,54000,0,0,257,5657,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,231:10:0	0,9,104:3:0	0,6,71:2:0
+17	1591	.	T	<X>	0	.	DP=15;I16=10,5,0,0,515,18559,0,0,900,54000,0,0,256,5602,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,241:10:0	0,9,85:3:0	0,6,73:2:0
+17	1592	.	T	<X>	0	.	DP=15;I16=10,5,0,0,503,17345,0,0,900,54000,0,0,255,5561,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,225:10:0	0,9,107:3:0	0,6,62:2:0
+17	1593	.	G	<X>	0	.	DP=15;I16=10,5,0,0,540,19930,0,0,900,54000,0,0,254,5534,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,250:10:0	0,9,106:3:0	0,6,60:2:0
+17	1594	.	T	<X>	0	.	DP=15;I16=10,5,0,0,535,19445,0,0,900,54000,0,0,252,5472,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,234:10:0	0,9,106:3:0	0,6,80:2:0
+17	1595	.	G	<X>	0	.	DP=15;I16=10,4,0,0,494,17940,0,0,840,50400,0,0,225,4801,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,213:9:0	0,9,105:3:0	0,6,69:2:0
+17	1596	.	C	<X>	0	.	DP=15;I16=10,4,0,0,479,17011,0,0,840,50400,0,0,233,5151,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,200:9:0	0,9,111:3:0	0,6,74:2:0
+17	1597	.	C	<X>	0	.	DP=15;I16=10,5,0,0,489,16941,0,0,900,54000,0,0,245,5285,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,195:9:0	0,12,127:4:0	0,6,73:2:0
+17	1598	.	C	<X>	0	.	DP=15;I16=10,5,0,0,514,18282,0,0,900,54000,0,0,244,5240,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,207:9:0	0,12,133:4:0	0,6,68:2:0
+17	1599	.	A	<X>	0	.	DP=14;I16=8,5,0,0,436,15330,0,0,780,46800,0,0,225,4851,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,182:8:0	0,9,103:3:0	0,6,76:2:0
+17	1600	.	T	<X>	0	.	DP=13;I16=8,5,0,0,456,16430,0,0,780,46800,0,0,226,4876,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,193:8:0	0,9,105:3:0	0,6,79:2:0
+17	1601	.	C	<X>	0	.	DP=13;I16=8,4,0,0,431,15861,0,0,720,43200,0,0,208,4554,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,171:7:0	0,9,108:3:0	0,6,78:2:0
+17	1602	.	T	<X>	0	.	DP=13;I16=7,5,0,0,439,16867,0,0,720,43200,0,0,228,4968,0,0;QS=3,0;MQSB=0.95494;MQ0F=0	PL:DP:DV	0,21,179:7:0	0,9,115:3:0	0,6,85:2:0
+17	1603	.	G	<X>	0	.	DP=12;I16=7,5,0,0,455,17407,0,0,720,43200,0,0,230,5034,0,0;QS=3,0;MQSB=0.95494;MQ0F=0	PL:DP:DV	0,21,202:7:0	0,9,111:3:0	0,6,75:2:0
+17	1604	.	G	<X>	0	.	DP=12;I16=7,5,0,0,362,11620,0,0,720,43200,0,0,232,5112,0,0;QS=3,0;MQSB=0.95494;MQ0F=0	PL:DP:DV	0,21,163:7:0	0,9,84:3:0	0,6,66:2:0
+17	1605	.	T	<X>	0	.	DP=12;I16=7,5,0,0,410,14230,0,0,720,43200,0,0,234,5202,0,0;QS=3,0;MQSB=0.95494;MQ0F=0	PL:DP:DV	0,21,190:7:0	0,9,97:3:0	0,6,61:2:0
+17	1606	.	G	<X>	0	.	DP=12;I16=7,4,0,0,370,12738,0,0,660,39600,0,0,211,4679,0,0;QS=3,0;MQSB=0.964642;MQ0F=0	PL:DP:DV	0,18,165:6:0	0,9,91:3:0	0,6,56:2:0
+17	1607	.	A	<X>	0	.	DP=12;I16=7,4,0,0,337,11369,0,0,660,39600,0,0,226,5222,0,0;QS=3,0;MQSB=0.964642;MQ0F=0	PL:DP:DV	0,21,161:7:0	0,6,70:2:0	0,6,55:2:0
+17	1608	.	C	<X>	0	.	DP=12;I16=7,4,0,0,366,12898,0,0,660,39600,0,0,211,4727,0,0;QS=3,0;MQSB=0.964642;MQ0F=0	PL:DP:DV	0,18,141:6:0	0,9,111:3:0	0,6,62:2:0
+17	1609	.	C	<X>	0	.	DP=11;I16=6,5,0,0,365,12889,0,0,660,39600,0,0,237,5393,0,0;QS=3,0;MQSB=0.950952;MQ0F=0	PL:DP:DV	0,18,149:6:0	0,9,110:3:0	0,6,71:2:0
+17	1610	.	C	<X>	0	.	DP=11;I16=5,5,0,0,313,10713,0,0,600,36000,0,0,213,4819,0,0;QS=3,0;MQSB=0.952347;MQ0F=0	PL:DP:DV	0,15,127:5:0	0,9,106:3:0	0,6,57:2:0
+17	1611	.	C	<X>	0	.	DP=11;I16=6,5,0,0,398,14904,0,0,660,39600,0,0,238,5454,0,0;QS=3,0;MQSB=0.950952;MQ0F=0	PL:DP:DV	0,18,180:6:0	0,9,110:3:0	0,6,67:2:0
+17	1612	.	T	<X>	0	.	DP=11;I16=6,5,0,0,409,15421,0,0,660,39600,0,0,238,5472,0,0;QS=3,0;MQSB=0.950952;MQ0F=0	PL:DP:DV	0,18,174:6:0	0,9,107:3:0	0,6,83:2:0
+17	1613	.	C	<X>	0	.	DP=11;I16=6,5,0,0,372,12904,0,0,660,39600,0,0,238,5498,0,0;QS=3,0;MQSB=0.950952;MQ0F=0	PL:DP:DV	0,18,169:6:0	0,9,99:3:0	0,6,63:2:0
+17	1614	.	A	<X>	0	.	DP=11;I16=6,5,0,0,353,12139,0,0,660,39600,0,0,238,5532,0,0;QS=3,0;MQSB=0.950952;MQ0F=0	PL:DP:DV	0,18,147:6:0	0,9,98:3:0	0,6,69:2:0
+17	1615	.	C	<X>	0	.	DP=11;I16=6,5,0,0,366,13080,0,0,660,39600,0,0,238,5574,0,0;QS=3,0;MQSB=0.950952;MQ0F=0	PL:DP:DV	0,18,171:6:0	0,9,105:3:0	0,6,51:2:0
+17	1616	.	T	<X>	0	.	DP=11;I16=6,3,0,0,348,13606,0,0,540,32400,0,0,187,4323,0,0;QS=3,0;MQSB=0.924584;MQ0F=0	PL:DP:DV	0,15,159:5:0	0,9,105:3:0	0,3,42:1:0
+17	1617	.	C	<X>	0	.	DP=12;I16=6,3,0,0,330,12316,0,0,540,32400,0,0,185,4279,0,0;QS=3,0;MQSB=0.924584;MQ0F=0	PL:DP:DV	0,15,146:5:0	0,9,105:3:0	0,3,42:1:0
+17	1618	.	A	<X>	0	.	DP=12;I16=5,6,0,0,385,14199,0,0,629,36841,0,0,244,5636,0,0;QS=3,0;MQSB=0.891517;MQ0F=0	PL:DP:DV	0,18,151:6:0	0,9,93:3:0	0,6,81:2:0
+17	1619	.	G	<X>	0	.	DP=11;I16=5,6,0,0,377,13119,0,0,629,36841,0,0,242,5544,0,0;QS=3,0;MQSB=0.891517;MQ0F=0	PL:DP:DV	0,18,166:6:0	0,9,84:3:0	0,6,67:2:0
+17	1620	.	C	<X>	0	.	DP=11;I16=5,5,0,0,323,10965,0,0,569,33241,0,0,215,4839,0,0;QS=3,0;MQSB=0.857112;MQ0F=0	PL:DP:DV	0,15,142:5:0	0,9,78:3:0	0,6,56:2:0
+17	1621	.	C	<X>	0	.	DP=12;I16=5,7,0,0,363,11779,0,0,689,40441,0,0,263,6021,0,0;QS=3,0;MQSB=0.896474;MQ0F=0	PL:DP:DV	0,21,174:7:0	0,9,80:3:0	0,6,56:2:0
+17	1622	.	A	<X>	0	.	DP=12;I16=5,7,0,0,365,12105,0,0,689,40441,0,0,261,5965,0,0;QS=3,0;MQSB=0.896474;MQ0F=0	PL:DP:DV	0,21,176:7:0	0,9,81:3:0	0,6,52:2:0
+17	1623	.	C	<X>	0	.	DP=12;I16=5,5,0,0,325,10979,0,0,569,33241,0,0,208,4620,0,0;QS=3,0;MQSB=0.857112;MQ0F=0	PL:DP:DV	0,18,155:6:0	0,9,84:3:0	0,3,37:1:0
+17	1624	.	C	<X>	0	.	DP=12;I16=4,6,0,0,336,11718,0,0,569,33241,0,0,211,4799,0,0;QS=3,0;MQSB=0.895781;MQ0F=0	PL:DP:DV	0,18,162:6:0	0,9,88:3:0	0,3,39:1:0
+17	1625	.	A	<X>	0	.	DP=12;I16=4,7,0,0,375,13503,0,0,629,36841,0,0,234,5386,0,0;QS=3,0;MQSB=0.924449;MQ0F=0	PL:DP:DV	0,18,158:6:0	0,9,93:3:0	0,6,80:2:0
+17	1626	.	G	<X>	0	.	DP=12;I16=5,7,0,0,358,11490,0,0,689,40441,0,0,249,5645,0,0;QS=3,0;MQSB=0.896474;MQ0F=0	PL:DP:DV	0,21,158:7:0	0,9,83:3:0	0,6,63:2:0
+17	1627	.	A	<X>	0	.	DP=12;I16=5,7,0,0,363,11609,0,0,689,40441,0,0,246,5590,0,0;QS=3,0;MQSB=0.896474;MQ0F=0	PL:DP:DV	0,21,165:7:0	0,9,75:3:0	0,6,72:2:0
+17	1628	.	C	<X>	0	.	DP=12;I16=5,7,0,0,357,11583,0,0,689,40441,0,0,243,5545,0,0;QS=3,0;MQSB=0.896474;MQ0F=0	PL:DP:DV	0,21,165:7:0	0,9,80:3:0	0,6,57:2:0
+17	1629	.	T	<X>	0	.	DP=13;I16=6,7,0,0,451,16079,0,0,749,44041,0,0,240,5510,0,0;QS=3,0;MQSB=0.899815;MQ0F=0	PL:DP:DV	0,21,187:7:0	0,12,120:4:0	0,6,79:2:0
+17	1630	.	T	<X>	0	.	DP=13;I16=6,7,0,0,403,13323,0,0,749,44041,0,0,237,5435,0,0;QS=3,0;MQSB=0.899815;MQ0F=0	PL:DP:DV	0,21,169:7:0	0,12,111:4:0	0,6,73:2:0
+17	1631	.	C	<X>	0	.	DP=12;I16=6,5,0,0,354,12046,0,0,660,39600,0,0,210,4744,0,0;QS=3,0;MQSB=0.950952;MQ0F=0	PL:DP:DV	0,21,184:7:0	0,6,67:2:0	0,6,61:2:0
+17	1632	.	C	<X>	0	.	DP=13;I16=6,7,0,0,387,12175,0,0,749,44041,0,0,232,5262,0,0;QS=3,0;MQSB=0.899815;MQ0F=0	PL:DP:DV	0,24,188:8:0	0,9,82:3:0	0,6,61:2:0
+17	1633	.	A	<X>	0	.	DP=13;I16=6,7,0,0,404,13272,0,0,749,44041,0,0,230,5166,0,0;QS=3,0;MQSB=0.899815;MQ0F=0	PL:DP:DV	0,24,183:8:0	0,9,86:3:0	0,6,73:2:0
+17	1634	.	C	<X>	0	.	DP=13;I16=6,6,0,0,328,9716,0,0,689,40441,0,0,203,4457,0,0;QS=3,0;MQSB=0.864013;MQ0F=0	PL:DP:DV	0,21,151:7:0	0,9,80:3:0	0,6,59:2:0
+17	1635	.	G	<X>	0	.	DP=14;I16=6,8,0,0,419,12831,0,0,809,47641,0,0,226,5010,0,0;QS=3,0;MQSB=0.927743;MQ0F=0	PL:DP:DV	0,24,180:8:0	0,12,108:4:0	0,6,59:2:0
+17	1636	.	A	<X>	0	.	DP=14;I16=6,8,0,0,418,13400,0,0,809,47641,0,0,225,4951,0,0;QS=3,0;MQSB=0.927743;MQ0F=0	PL:DP:DV	0,24,179:8:0	0,12,110:4:0	0,6,66:2:0
+17	1637	.	C	<X>	0	.	DP=14;I16=6,8,0,0,422,13498,0,0,809,47641,0,0,224,4906,0,0;QS=3,0;MQSB=0.927743;MQ0F=0	PL:DP:DV	0,24,185:8:0	0,12,110:4:0	0,6,60:2:0
+17	1638	.	A	<X>	0	.	DP=17;I16=9,7,0,0,513,17167,0,0,929,54841,0,0,216,4790,0,0;QS=3,0;MQSB=0.892753;MQ0F=0	PL:DP:DV	0,24,191:8:0	0,18,149:6:0	0,6,78:2:0
+17	1639	.	G	<X>	0	.	DP=17;I16=9,8,0,0,552,18844,0,0,989,58441,0,0,223,4765,0,0;QS=3,0;MQSB=0.91051;MQ0F=0	PL:DP:DV	0,27,228:9:0	0,18,150:6:0	0,6,68:2:0
+17	1640	.	G	<X>	0	.	DP=17;I16=8,6,0,0,414,13296,0,0,809,47641,0,0,171,3467,0,0;QS=3,0;MQSB=0.875173;MQ0F=0	PL:DP:DV	0,18,150:6:0	0,18,151:6:0	0,6,51:2:0
+17	1641	.	C	<X>	0	.	DP=18;I16=9,8,0,0,511,16289,0,0,989,58441,0,0,225,4709,0,0;QS=3,0;MQSB=0.91051;MQ0F=0	PL:DP:DV	0,27,188:9:0	0,18,167:6:0	0,6,65:2:0
+17	1642	.	T	<X>	0	.	DP=17;I16=8,7,0,0,519,18513,0,0,869,51241,0,0,217,4613,0,0;QS=3,0;MQSB=0.898397;MQ0F=0	PL:DP:DV	0,18,170:6:0	0,18,168:6:0	0,9,102:3:0
+17	1643	.	C	<X>	0	.	DP=16;I16=7,9,0,0,508,16910,0,0,929,54841,0,0,255,5361,0,0;QS=3,0;MQSB=0.933674;MQ0F=0	PL:DP:DV	0,24,193:8:0	0,18,169:6:0	0,6,56:2:0
+17	1644	.	C	<X>	0	.	DP=15;I16=6,9,0,0,514,18056,0,0,869,51241,0,0,259,5401,0,0;QS=3,0;MQSB=0.939413;MQ0F=0	PL:DP:DV	0,21,209:7:0	0,18,165:6:0	0,6,54:2:0
+17	1645	.	A	<X>	0	.	DP=15;I16=6,9,0,0,520,18852,0,0,869,51241,0,0,263,5457,0,0;QS=3,0;MQSB=0.939413;MQ0F=0	PL:DP:DV	0,21,213:7:0	0,18,173:6:0	0,6,49:2:0
+17	1646	.	G	<X>	0	.	DP=15;I16=6,7,0,0,440,15526,0,0,780,46800,0,0,217,4279,0,0;QS=3,0;MQSB=0.961166;MQ0F=0	PL:DP:DV	0,18,185:6:0	0,15,148:5:0	0,6,48:2:0
+17	1647	.	C	<X>	0	.	DP=15;I16=6,9,0,0,433,13883,0,0,869,51241,0,0,271,5617,0,0;QS=3,0;MQSB=0.939413;MQ0F=0	PL:DP:DV	0,21,190:7:0	0,18,139:6:0	0,6,35:2:0
+17	1648	.	C	<X>	0	.	DP=15;I16=6,9,0,0,495,16965,0,0,869,51241,0,0,275,5721,0,0;QS=3,0;MQSB=0.939413;MQ0F=0	PL:DP:DV	0,21,203:7:0	0,18,159:6:0	0,6,44:2:0
+17	1649	.	T	<X>	0	.	DP=15;I16=6,9,0,0,516,18122,0,0,869,51241,0,0,279,5841,0,0;QS=3,0;MQSB=0.939413;MQ0F=0	PL:DP:DV	0,21,187:7:0	0,18,182:6:0	0,6,56:2:0
+17	1650	.	C	<X>	0	.	DP=15;I16=6,7,0,0,405,13551,0,0,749,44041,0,0,240,5028,0,0;QS=3,0;MQSB=0.899815;MQ0F=0	PL:DP:DV	0,18,161:6:0	0,18,169:6:0	0,3,13:1:0
+17	1651	.	G	<X>	0	.	DP=17;I16=5,9,0,0,424,13328,0,0,778,44882,0,0,249,5335,0,0;QS=3,0;MQSB=0.965069;MQ0F=0	PL:DP:DV	0,18,150:6:0	0,15,128:5:0	0,9,86:3:0
+17	1652	.	G	<X>	0	.	DP=18;I16=7,9,0,0,532,18602,0,0,898,52082,0,0,267,5673,0,0;QS=3,0;MQSB=0.994413;MQ0F=0	PL:DP:DV	0,24,212:8:0	0,18,168:6:0	0,6,54:2:0
+17	1653	.	C	<X>	0	.	DP=18;I16=8,10,0,0,581,19565,0,0,1018,59282,0,0,300,6490,0,0;QS=3,0;MQSB=0.99606;MQ0F=0	PL:DP:DV	0,24,208:8:0	0,21,175:7:0	0,9,82:3:0
+17	1654	.	A	T,<X>	0	.	DP=18;I16=8,9,0,1,516,16718,15,225,958,55682,60,3600,285,6219,22,484;QS=2.93213,0.0678733,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.99606;BQB=1;MQ0F=0	PL:DP:DV	0,9,155,21,158,162:8:1	0,21,179,21,179,179:7:0	0,9,78,9,78,78:3:0
+17	1655	.	C	<X>	0	.	DP=18;I16=8,10,0,0,565,19017,0,0,1018,59282,0,0,313,6887,0,0;QS=3,0;MQSB=0.99606;MQ0F=0	PL:DP:DV	0,24,198:8:0	0,21,180:7:0	0,9,79:3:0
+17	1656	.	C	<X>	0	.	DP=19;I16=9,9,0,0,557,18013,0,0,1018,59282,0,0,295,6515,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,202:8:0	0,21,165:7:0	0,9,80:3:0
+17	1657	.	T	A,<X>	0	.	DP=18;I16=8,9,0,1,580,20362,15,225,989,58441,29,841,301,6641,25,625;QS=2.93243,0.0675676,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.99606;BQB=1;MQ0F=0	PL:DP:DV	0,24,206,24,206,206:8:0	0,6,158,18,161,165:7:1	0,9,85,9,85,85:3:0
+17	1658	.	T	<X>	0	.	DP=19;I16=8,10,0,0,573,19127,0,0,1018,59282,0,0,332,7412,0,0;QS=3,0;MQSB=0.99606;MQ0F=0	PL:DP:DV	0,24,187:8:0	0,21,189:7:0	0,9,91:3:0
+17	1659	.	C	<X>	0	.	DP=20;I16=8,10,0,0,609,21517,0,0,1049,62041,0,0,338,7578,0,0;QS=3,0;MQSB=0.906029;MQ0F=0	PL:DP:DV	0,24,219:8:0	0,21,189:7:0	0,9,80:3:0
+17	1660	.	A	<X>	0	.	DP=21;I16=8,11,0,0,641,23219,0,0,1078,62882,0,0,385,8901,0,0;QS=3,0;MQSB=0.992359;MQ0F=0	PL:DP:DV	0,21,172:7:0	0,24,219:8:0	0,12,127:4:0
+17	1661	.	G	<X>	0	.	DP=21;I16=7,13,0,0,639,21739,0,0,1107,63723,0,0,412,9598,0,0;QS=3,0;MQSB=0.999215;MQ0F=0	PL:DP:DV	0,24,209:8:0	0,24,193:8:0	0,12,98:4:0
+17	1662	.	C	<X>	0	.	DP=21;I16=8,12,0,0,641,21423,0,0,1107,63723,0,0,407,9465,0,0;QS=3,0;MQSB=0.988166;MQ0F=0	PL:DP:DV	0,21,192:7:0	0,27,211:9:0	0,12,100:4:0
+17	1663	.	C	<X>	0	.	DP=20;I16=7,11,0,0,577,19507,0,0,1018,59282,0,0,394,9204,0,0;QS=3,0;MQSB=0.983729;MQ0F=0	PL:DP:DV	0,21,178:7:0	0,21,192:7:0	0,12,101:4:0
+17	1664	.	A	C,<X>	0	.	DP=20;I16=6,10,0,1,530,17982,13,169,898,52082,29,841,358,8422,25,625;QS=2.93953,0.0604651,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.998738;BQB=1;MQ0F=0	PL:DP:DV	0,18,167,18,167,167:6:0	0,7,154,18,157,159:7:1	0,12,109,12,109,109:4:0
+17	1665	.	T	C,<X>	0	.	DP=20;I16=7,11,1,1,592,20170,58,1924,1018,59282,89,4441,396,9188,39,821;QS=2.5913,0.408696,0;VDB=0.1;SGB=0.346553;RPB=0.222222;MQB=0.611111;MQSB=0.988166;BQB=0.944444;MQ0F=0	PL:DP:DV	0,21,185,21,185,185:7:0	0,27,222,27,222,222:9:0	35,0,51,41,57,90:4:2
+17	1666	.	G	<X>	0	.	DP=20;I16=8,12,0,0,614,19760,0,0,1107,63723,0,0,435,9947,0,0;QS=3,0;MQSB=0.988166;MQ0F=0	PL:DP:DV	0,21,173:7:0	0,27,206:9:0	0,12,111:4:0
+17	1667	.	G	<X>	0	.	DP=20;I16=8,11,0,0,617,21033,0,0,1078,62882,0,0,410,9276,0,0;QS=3,0;MQSB=0.992359;MQ0F=0	PL:DP:DV	0,21,183:7:0	0,24,195:8:0	0,12,115:4:0
+17	1668	.	A	<X>	0	.	DP=20;I16=7,10,0,0,570,19908,0,0,958,55682,0,0,369,8365,0,0;QS=3,0;MQSB=0.989343;MQ0F=0	PL:DP:DV	0,18,158:6:0	0,21,186:7:0	0,12,124:4:0
+17	1669	.	C	<X>	0	.	DP=20;I16=8,12,0,0,640,21336,0,0,1107,63723,0,0,435,9857,0,0;QS=3,0;MQSB=0.988166;MQ0F=0	PL:DP:DV	0,21,172:7:0	0,27,216:9:0	0,12,115:4:0
+17	1670	.	A	<X>	0	.	DP=23;I16=9,13,0,0,765,27363,0,0,1258,73682,0,0,410,9234,0,0;QS=3,0;MQSB=0.991121;MQ0F=0	PL:DP:DV	0,27,215:9:0	0,27,233:9:0	0,12,129:4:0
+17	1671	.	G	<X>	0	.	DP=23;I16=9,13,0,0,703,23631,0,0,1258,73682,0,0,412,9206,0,0;QS=3,0;MQSB=0.991121;MQ0F=0	PL:DP:DV	0,27,214:9:0	0,27,210:9:0	0,12,106:4:0
+17	1672	.	T	<X>	0	.	DP=23;I16=9,13,0,0,724,24700,0,0,1258,73682,0,0,414,9202,0,0;QS=3,0;MQSB=0.991121;MQ0F=0	PL:DP:DV	0,27,203:9:0	0,27,232:9:0	0,12,111:4:0
+17	1673	.	T	<X>	0	.	DP=25;I16=8,13,0,0,719,25183,0,0,1198,70082,0,0,372,8248,0,0;QS=3,0;MQSB=0.983744;MQ0F=0	PL:DP:DV	0,27,221:9:0	0,24,212:8:0	0,12,112:4:0
+17	1674	.	C	<X>	0	.	DP=25;I16=8,14,0,0,755,26561,0,0,1289,76441,0,0,389,8417,0,0;QS=3,0;MQSB=0.892142;MQ0F=0	PL:DP:DV	0,33,244:11:0	0,21,206:7:0	0,12,96:4:0
+17	1675	.	C	<X>	0	.	DP=25;I16=9,15,0,0,705,22355,0,0,1347,78123,0,0,447,9897,0,0;QS=3,0;MQSB=0.996008;MQ0F=0	PL:DP:DV	0,33,222:11:0	0,30,212:10:0	0,9,65:3:0
+17	1676	.	G	<X>	0	.	DP=25;I16=6,15,0,0,660,21708,0,0,1167,67323,0,0,383,8265,0,0;QS=3,0;MQSB=0.993205;MQ0F=0	PL:DP:DV	0,33,222:11:0	0,21,170:7:0	0,9,96:3:0
+17	1677	.	C	<X>	0	.	DP=25;I16=9,13,0,0,681,22869,0,0,1289,76441,0,0,394,8510,0,0;QS=3,0;MQSB=0.910098;MQ0F=0	PL:DP:DV	0,33,225:11:0	0,24,198:8:0	0,9,74:3:0
+17	1678	.	C	<X>	0	.	DP=25;I16=9,15,0,0,775,26785,0,0,1347,78123,0,0,438,9496,0,0;QS=3,0;MQSB=0.996008;MQ0F=0	PL:DP:DV	0,33,235:11:0	0,30,231:10:0	0,9,83:3:0
+17	1679	.	A	<X>	0	.	DP=25;I16=8,15,0,0,762,27552,0,0,1287,74523,0,0,412,8858,0,0;QS=3,0;MQSB=0.999479;MQ0F=0	PL:DP:DV	0,33,235:11:0	0,27,219:9:0	0,9,106:3:0
+17	1680	.	G	<X>	0	.	DP=26;I16=9,17,0,0,843,29213,0,0,1467,85323,0,0,459,10021,0,0;QS=3,0;MQSB=0.999637;MQ0F=0	PL:DP:DV	0,33,253:11:0	0,33,232:11:0	0,12,108:4:0
+17	1681	.	C	<X>	0	.	DP=26;I16=8,15,0,0,681,21293,0,0,1318,77282,0,0,407,8999,0,0;QS=3,0;MQSB=0.974802;MQ0F=0	PL:DP:DV	0,33,223:11:0	0,27,191:9:0	0,9,69:3:0
+17	1682	.	G	<X>	0	.	DP=25;I16=9,16,0,0,728,22560,0,0,1407,81723,0,0,455,9877,0,0;QS=3,0;MQSB=0.998399;MQ0F=0	PL:DP:DV	0,30,222:10:0	0,33,208:11:0	0,12,98:4:0
+17	1683	.	T	<X>	0	.	DP=25;I16=8,15,0,0,807,29159,0,0,1287,74523,0,0,403,8567,0,0;QS=3,0;MQSB=0.999479;MQ0F=0	PL:DP:DV	0,30,250:10:0	0,30,235:10:0	0,9,91:3:0
+17	1684	.	T	<X>	0	.	DP=25;I16=8,15,0,0,802,28774,0,0,1318,77282,0,0,438,9612,0,0;QS=3,0;MQSB=0.974802;MQ0F=0	PL:DP:DV	0,27,227:9:0	0,30,237:10:0	0,12,107:4:0
+17	1685	.	G	<X>	0	.	DP=24;I16=8,14,0,0,759,27319,0,0,1258,73682,0,0,413,8999,0,0;QS=3,0;MQSB=0.979255;MQ0F=0	PL:DP:DV	0,24,216:8:0	0,30,242:10:0	0,12,110:4:0
+17	1686	.	C	<X>	0	.	DP=24;I16=8,15,0,0,793,28073,0,0,1318,77282,0,0,438,9656,0,0;QS=3,0;MQSB=0.974802;MQ0F=0	PL:DP:DV	0,27,225:9:0	0,30,241:10:0	0,12,103:4:0
+17	1687	.	C	<X>	0	.	DP=24;I16=7,14,0,0,741,26765,0,0,1198,70082,0,0,388,8458,0,0;QS=3,0;MQSB=0.966484;MQ0F=0	PL:DP:DV	0,24,221:8:0	0,27,229:9:0	0,12,106:4:0
+17	1688	.	C	<X>	0	.	DP=24;I16=8,15,0,0,794,28736,0,0,1318,77282,0,0,431,9605,0,0;QS=3,0;MQSB=0.974802;MQ0F=0	PL:DP:DV	0,27,239:9:0	0,30,221:10:0	0,12,120:4:0
+17	1689	.	T	A,<X>	0	.	DP=24;I16=8,15,0,1,805,29443,33,1089,1287,74523,60,3600,421,9311,25,625;QS=2.74419,0.255814,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=1;BQB=1;MQ0F=0	PL:DP:DV	0,27,224,27,224,224:9:0	0,33,255,33,255,255:11:0	21,0,79,30,82,106:4:1
+17	1690	.	C	<X>	0	.	DP=24;I16=8,16,0,0,864,32420,0,0,1347,78123,0,0,445,10033,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,242:9:0	0,33,255:11:0	0,12,95:4:0
+17	1691	.	T	<X>	0	.	DP=22;I16=7,14,0,0,734,27150,0,0,1167,67323,0,0,421,9525,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,225:9:0	0,30,242:10:0	0,6,57:2:0
+17	1692	.	G	<X>	0	.	DP=22;I16=7,13,0,0,678,24110,0,0,1107,63723,0,0,400,9176,0,0;QS=3,0;MQSB=0.999215;MQ0F=0	PL:DP:DV	0,24,218:8:0	0,30,218:10:0	0,6,61:2:0
+17	1693	.	T	<X>	0	.	DP=24;I16=10,13,0,0,795,28363,0,0,1318,77282,0,0,444,10422,0,0;QS=3,0;MQSB=0.995682;MQ0F=0	PL:DP:DV	0,27,227:9:0	0,30,235:10:0	0,12,104:4:0
+17	1694	.	T	<X>	0	.	DP=24;I16=10,13,0,0,771,26775,0,0,1318,77282,0,0,448,10602,0,0;QS=3,0;MQSB=0.995682;MQ0F=0	PL:DP:DV	0,27,221:9:0	0,30,232:10:0	0,12,114:4:0
+17	1695	.	C	<X>	0	.	DP=24;I16=10,14,0,0,811,28517,0,0,1347,78123,0,0,454,10806,0,0;QS=3,0;MQSB=0.98469;MQ0F=0	PL:DP:DV	0,27,227:9:0	0,33,239:11:0	0,12,121:4:0
+17	1696	.	T	<X>	0	.	DP=23;I16=10,13,0,0,825,30819,0,0,1287,74523,0,0,455,10869,0,0;QS=3,0;MQSB=0.976718;MQ0F=0	PL:DP:DV	0,24,219:8:0	0,33,255:11:0	0,12,108:4:0
+17	1697	.	G	<X>	0	.	DP=23;I16=10,13,0,0,767,26757,0,0,1287,74523,0,0,455,10897,0,0;QS=3,0;MQSB=0.976718;MQ0F=0	PL:DP:DV	0,24,208:8:0	0,33,246:11:0	0,12,112:4:0
+17	1698	.	C	A,<X>	0	.	DP=21;I16=10,10,0,1,726,27088,27,729,1169,69241,29,841,451,10903,6,36;QS=2.91148,0.0885246,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.99938;BQB=1;MQ0F=0	PL:DP:DV	0,24,229,24,229,229:8:0	0,0,190,24,193,207:9:1	0,12,111,12,111,111:4:0
+17	1699	.	T	<X>	0	.	DP=21;I16=9,10,0,0,698,25826,0,0,1078,62882,0,0,408,9692,0,0;QS=3,0;MQSB=0.999167;MQ0F=0	PL:DP:DV	0,21,203:7:0	0,24,219:8:0	0,12,115:4:0
+17	1700	.	G	<X>	0	.	DP=20;I16=9,10,0,0,696,25850,0,0,1078,62882,0,0,409,9705,0,0;QS=3,0;MQSB=0.999167;MQ0F=0	PL:DP:DV	0,21,216:7:0	0,24,215:8:0	0,12,110:4:0
+17	1701	.	T	<X>	0	.	DP=20;I16=9,11,0,0,711,25539,0,0,1138,66482,0,0,435,10353,0,0;QS=3,0;MQSB=0.997118;MQ0F=0	PL:DP:DV	0,24,207:8:0	0,24,210:8:0	0,12,125:4:0
+17	1702	.	T	<X>	0	.	DP=20;I16=8,11,0,0,671,24367,0,0,1078,62882,0,0,410,9712,0,0;QS=3,0;MQSB=0.992359;MQ0F=0	PL:DP:DV	0,24,214:8:0	0,21,193:7:0	0,12,115:4:0
+17	1703	.	T	<X>	0	.	DP=20;I16=9,10,0,0,648,22696,0,0,1078,62882,0,0,410,9708,0,0;QS=3,0;MQSB=0.999167;MQ0F=0	PL:DP:DV	0,21,197:7:0	0,24,195:8:0	0,12,114:4:0
+17	1704	.	T	<X>	0	.	DP=20;I16=10,10,0,0,711,25771,0,0,1169,69241,0,0,435,10341,0,0;QS=3,0;MQSB=0.931063;MQ0F=0	PL:DP:DV	0,24,208:8:0	0,21,208:7:0	0,15,128:5:0
+17	1705	.	C	<X>	0	.	DP=20;I16=10,10,0,0,744,28388,0,0,1169,69241,0,0,436,10312,0,0;QS=3,0;MQSB=0.931063;MQ0F=0	PL:DP:DV	0,24,232:8:0	0,21,213:7:0	0,15,120:5:0
+17	1706	.	T	<X>	0	.	DP=20;I16=10,10,0,0,775,30329,0,0,1169,69241,0,0,436,10246,0,0;QS=3,0;MQSB=0.931063;MQ0F=0	PL:DP:DV	0,24,221:8:0	0,21,219:7:0	0,15,145:5:0
+17	1707	.	C	<X>	0	.	DP=21;I16=9,11,0,0,724,26998,0,0,1169,69241,0,0,410,9518,0,0;QS=3,0;MQSB=0.916401;MQ0F=0	PL:DP:DV	0,27,235:9:0	0,18,180:6:0	0,15,134:5:0
+17	1708	.	T	<X>	0	.	DP=21;I16=9,12,0,0,740,27282,0,0,1229,72841,0,0,410,9430,0,0;QS=3,0;MQSB=0.913101;MQ0F=0	PL:DP:DV	0,30,229:10:0	0,18,187:6:0	0,15,132:5:0
+17	1709	.	A	<X>	0	.	DP=21;I16=9,11,0,0,675,23509,0,0,1169,69241,0,0,386,8734,0,0;QS=3,0;MQSB=0.916401;MQ0F=0	PL:DP:DV	0,27,210:9:0	0,18,166:6:0	0,15,131:5:0
+17	1710	.	C	<X>	0	.	DP=22;I16=9,13,0,0,755,26817,0,0,1289,76441,0,0,412,9306,0,0;QS=3,0;MQSB=0.910098;MQ0F=0	PL:DP:DV	0,33,236:11:0	0,18,181:6:0	0,15,128:5:0
+17	1711	.	C	<X>	0	.	DP=22;I16=9,13,0,0,786,28790,0,0,1289,76441,0,0,413,9223,0,0;QS=3,0;MQSB=0.910098;MQ0F=0	PL:DP:DV	0,33,250:11:0	0,18,169:6:0	0,15,138:5:0
+17	1712	.	A	<X>	0	.	DP=22;I16=9,13,0,0,824,31342,0,0,1289,76441,0,0,414,9162,0,0;QS=3,0;MQSB=0.910098;MQ0F=0	PL:DP:DV	0,33,252:11:0	0,18,198:6:0	0,15,136:5:0
+17	1713	.	G	<X>	0	.	DP=23;I16=8,14,0,0,823,31285,0,0,1289,76441,0,0,405,8993,0,0;QS=3,0;MQSB=0.892142;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,189:6:0	0,12,118:4:0
+17	1714	.	A	<X>	0	.	DP=23;I16=9,13,0,0,763,27439,0,0,1289,76441,0,0,402,8818,0,0;QS=3,0;MQSB=0.910098;MQ0F=0	PL:DP:DV	0,36,234:12:0	0,18,190:6:0	0,12,101:4:0
+17	1715	.	A	<X>	0	.	DP=23;I16=9,14,0,0,900,35416,0,0,1349,80041,0,0,414,8878,0,0;QS=3,0;MQSB=0.907354;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,206:6:0	0,15,145:5:0
+17	1716	.	G	<X>	0	.	DP=23;I16=9,14,0,0,844,31500,0,0,1349,80041,0,0,414,8822,0,0;QS=3,0;MQSB=0.907354;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,188:6:0	0,15,129:5:0
+17	1717	.	T	<X>	0	.	DP=24;I16=9,15,0,0,854,30878,0,0,1409,83641,0,0,414,8794,0,0;QS=3,0;MQSB=0.904837;MQ0F=0	PL:DP:DV	0,39,253:13:0	0,18,185:6:0	0,15,122:5:0
+17	1718	.	G	<X>	0	.	DP=24;I16=9,14,0,0,806,29332,0,0,1349,80041,0,0,390,8170,0,0;QS=3,0;MQSB=0.907354;MQ0F=0	PL:DP:DV	0,36,249:12:0	0,18,188:6:0	0,15,124:5:0
+17	1719	.	C	<X>	0	.	DP=26;I16=11,14,0,0,857,30717,0,0,1469,87241,0,0,407,8675,0,0;QS=3,0;MQSB=0.929204;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,18,173:6:0	0,12,98:4:0
+17	1720	.	C	<X>	0	.	DP=26;I16=11,14,0,0,898,33274,0,0,1469,87241,0,0,409,8645,0,0;QS=3,0;MQSB=0.929204;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,18,166:6:0	0,12,99:4:0
+17	1721	.	C	<X>	0	.	DP=26;I16=10,14,0,0,846,30642,0,0,1409,83641,0,0,388,8258,0,0;QS=3,0;MQSB=0.919431;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,18,187:6:0	0,12,119:4:0
+17	1722	.	T	<X>	0	.	DP=25;I16=11,13,0,0,876,33054,0,0,1409,83641,0,0,406,8540,0,0;QS=3,0;MQSB=0.931547;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,174:5:0	0,15,123:5:0
+17	1723	.	T	<X>	0	.	DP=25;I16=11,14,0,0,835,28861,0,0,1469,87241,0,0,420,8728,0,0;QS=3,0;MQSB=0.929204;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,167:5:0	0,15,130:5:0
+17	1724	.	C	<X>	0	.	DP=25;I16=11,14,0,0,903,33735,0,0,1469,87241,0,0,422,8800,0,0;QS=3,0;MQSB=0.929204;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,164:5:0	0,15,139:5:0
+17	1725	.	C	G,<X>	0	.	DP=25;I16=11,13,0,1,835,29699,25,625,1409,83641,60,3600,406,8576,18,324;QS=2.95164,0.0483559,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.929204;BQB=1;MQ0F=0	PL:DP:DV	0,20,255,42,255,255:15:1	0,15,153,15,153,153:5:0	0,15,132,15,132,132:5:0
+17	1726	.	C	<X>	0	.	DP=25;I16=11,14,0,0,932,35588,0,0,1469,87241,0,0,426,9028,0,0;QS=3,0;MQSB=0.929204;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,165:5:0	0,15,122:5:0
+17	1727	.	T	<X>	0	.	DP=25;I16=10,14,0,0,862,32080,0,0,1409,83641,0,0,404,8556,0,0;QS=3,0;MQSB=0.919431;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,167:5:0	0,12,120:4:0
+17	1728	.	C	<X>	0	.	DP=25;I16=11,14,0,0,915,33845,0,0,1469,87241,0,0,429,9173,0,0;QS=3,0;MQSB=0.929204;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,156:5:0	0,15,144:5:0
+17	1729	.	C	<X>	0	.	DP=25;I16=10,14,0,0,919,35797,0,0,1409,83641,0,0,406,8668,0,0;QS=3,0;MQSB=0.919431;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,142:5:0	0,12,128:4:0
+17	1730	.	T	<X>	0	.	DP=24;I16=10,14,0,0,849,30711,0,0,1409,83641,0,0,433,9393,0,0;QS=3,0;MQSB=0.919431;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,12,138:4:0	0,15,148:5:0
+17	1731	.	C	<X>	0	.	DP=24;I16=10,14,0,0,907,34875,0,0,1409,83641,0,0,434,9472,0,0;QS=3,0;MQSB=0.919431;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,12,123:4:0	0,15,140:5:0
+17	1732	.	A	<X>	0	.	DP=24;I16=11,13,0,0,816,28582,0,0,1409,83641,0,0,436,9580,0,0;QS=3,0;MQSB=0.931547;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,12,123:4:0	0,15,143:5:0
+17	1733	.	C	<X>	0	.	DP=25;I16=12,13,0,0,869,31451,0,0,1469,87241,0,0,438,9666,0,0;QS=3,0;MQSB=0.939413;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,12,116:4:0	0,15,136:5:0
+17	1734	.	C	<X>	0	.	DP=25;I16=12,13,0,0,926,35482,0,0,1469,87241,0,0,440,9730,0,0;QS=3,0;MQSB=0.939413;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,12,122:4:0	0,15,141:5:0
+17	1735	.	T	<X>	0	.	DP=26;I16=13,13,0,0,935,35169,0,0,1529,90841,0,0,442,9822,0,0;QS=3,0;MQSB=0.945959;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,12,112:4:0	0,15,148:5:0
+17	1736	.	G	<X>	0	.	DP=25;I16=11,11,0,0,829,31469,0,0,1289,76441,0,0,380,8416,0,0;QS=3,0;MQSB=0.936864;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,72:2:0	0,12,118:4:0
+17	1737	.	A	<X>	0	.	DP=25;I16=12,12,0,0,842,30606,0,0,1409,83641,0,0,422,9312,0,0;QS=3,0;MQSB=0.941765;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,6,76:2:0	0,15,131:5:0
+17	1738	.	C	<X>	0	.	DP=24;I16=12,12,0,0,835,30251,0,0,1409,83641,0,0,450,10010,0,0;QS=3,0;MQSB=0.941765;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,78:3:0	0,15,130:5:0
+17	1739	.	C	<X>	0	.	DP=23;I16=10,12,0,0,831,32123,0,0,1289,76441,0,0,428,9432,0,0;QS=3,0;MQSB=0.924723;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,55:2:0	0,12,135:4:0
+17	1740	.	A	<X>	0	.	DP=23;I16=11,12,0,0,774,27126,0,0,1349,80041,0,0,456,10126,0,0;QS=3,0;MQSB=0.934091;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,56:2:0	0,15,139:5:0
+17	1741	.	C	<X>	0	.	DP=23;I16=11,12,0,0,850,32314,0,0,1349,80041,0,0,459,10217,0,0;QS=3,0;MQSB=0.934091;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,70:2:0	0,15,136:5:0
+17	1742	.	T	<X>	0	.	DP=23;I16=11,12,0,0,866,33204,0,0,1349,80041,0,0,462,10330,0,0;QS=3,0;MQSB=0.934091;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,72:2:0	0,15,144:5:0
+17	1743	.	C	<X>	0	.	DP=23;I16=11,12,0,0,894,35176,0,0,1349,80041,0,0,464,10414,0,0;QS=3,0;MQSB=0.934091;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,74:2:0	0,15,138:5:0
+17	1744	.	T	<X>	0	.	DP=23;I16=11,11,0,0,857,33579,0,0,1289,76441,0,0,459,10469,0,0;QS=3,0;MQSB=0.936864;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,6,80:2:0	0,15,156:5:0
+17	1745	.	G	<X>	0	.	DP=23;I16=11,12,0,0,882,34572,0,0,1349,80041,0,0,464,10442,0,0;QS=3,0;MQSB=0.934091;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,78:2:0	0,15,142:5:0
+17	1746	.	G	<X>	0	.	DP=24;I16=12,11,0,0,836,31102,0,0,1349,80041,0,0,456,10312,0,0;QS=3,0;MQSB=0.944319;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,6,69:2:0	0,18,151:6:0
+17	1747	.	G	<X>	0	.	DP=24;I16=12,11,0,0,839,31729,0,0,1349,80041,0,0,455,10239,0,0;QS=3,0;MQSB=0.944319;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,6,75:2:0	0,18,154:6:0
+17	1748	.	G	<X>	0	.	DP=24;I16=11,12,0,0,843,31857,0,0,1349,80041,0,0,434,9664,0,0;QS=3,0;MQSB=0.934091;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,3,42:1:0	0,18,154:6:0
+17	1749	.	A	<X>	0	.	DP=25;I16=13,11,0,0,864,31748,0,0,1409,83641,0,0,451,10063,0,0;QS=3,0;MQSB=0.950498;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,6,72:2:0	0,21,172:7:0
+17	1750	.	A	<X>	0	.	DP=25;I16=13,12,0,0,905,33667,0,0,1469,87241,0,0,451,10013,0,0;QS=3,0;MQSB=0.948139;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,56:2:0	0,21,187:7:0
+17	1751	.	A	<X>	0	.	DP=25;I16=13,12,0,0,908,33658,0,0,1469,87241,0,0,449,9987,0,0;QS=3,0;MQSB=0.948139;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,67:2:0	0,21,183:7:0
+17	1752	.	T	<X>	0	.	DP=23;I16=12,11,0,0,838,31088,0,0,1380,82800,0,0,449,9987,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,6,71:2:0	0,18,170:6:0
+17	1753	.	C	<X>	0	.	DP=23;I16=12,11,0,0,869,33595,0,0,1380,82800,0,0,448,9960,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,6,77:2:0	0,18,163:6:0
+17	1754	.	C	<X>	0	.	DP=23;I16=11,11,0,0,830,31628,0,0,1320,79200,0,0,431,9699,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,3,42:1:0	0,18,163:6:0
+17	1755	.	C	<X>	0	.	DP=23;I16=12,11,0,0,856,33082,0,0,1380,82800,0,0,446,9972,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,6,61:2:0	0,18,165:6:0
+17	1756	.	T	<X>	0	.	DP=22;I16=11,11,0,0,858,33720,0,0,1320,79200,0,0,445,9961,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,6,77:2:0	0,18,179:6:0
+17	1757	.	C	<X>	0	.	DP=22;I16=11,11,0,0,869,34651,0,0,1320,79200,0,0,444,9972,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,6,78:2:0	0,18,176:6:0
+17	1758	.	A	<X>	0	.	DP=22;I16=11,11,0,0,865,34205,0,0,1320,79200,0,0,442,9954,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,6,81:2:0	0,18,177:6:0
+17	1759	.	G	<X>	0	.	DP=22;I16=11,11,0,0,833,31965,0,0,1320,79200,0,0,439,9905,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,6,77:2:0	0,18,159:6:0
+17	1760	.	C	<X>	0	.	DP=22;I16=11,11,0,0,849,33441,0,0,1320,79200,0,0,436,9874,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,6,79:2:0	0,18,159:6:0
+17	1761	.	A	<X>	0	.	DP=22;I16=11,11,0,0,730,25766,0,0,1320,79200,0,0,432,9810,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,6,75:2:0	0,18,153:6:0
+17	1762	.	C	<X>	0	.	DP=21;I16=11,10,0,0,767,28667,0,0,1260,75600,0,0,429,9761,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,6,76:2:0	0,18,160:6:0
+17	1763	.	C	<X>	0	.	DP=21;I16=11,10,0,0,789,30115,0,0,1260,75600,0,0,426,9726,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,6,72:2:0	0,18,162:6:0
+17	1764	.	C	<X>	0	.	DP=21;I16=11,10,0,0,821,32443,0,0,1260,75600,0,0,423,9705,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,6,72:2:0	0,18,167:6:0
+17	1765	.	T	<X>	0	.	DP=21;I16=11,10,0,0,814,31746,0,0,1260,75600,0,0,420,9698,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,6,83:2:0	0,18,179:6:0
+17	1766	.	C	<X>	0	.	DP=21;I16=11,10,0,0,796,30564,0,0,1260,75600,0,0,417,9705,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,6,71:2:0	0,18,162:6:0
+17	1767	.	C	<X>	0	.	DP=21;I16=11,10,0,0,779,29559,0,0,1260,75600,0,0,414,9726,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,6,73:2:0	0,18,163:6:0
+17	1768	.	C	<X>	0	.	DP=21;I16=11,10,0,0,798,30670,0,0,1260,75600,0,0,411,9761,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,6,68:2:0	0,18,160:6:0
+17	1769	.	T	<X>	0	.	DP=21;I16=11,10,0,0,819,32179,0,0,1260,75600,0,0,406,9712,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,6,77:2:0	0,18,184:6:0
+17	1770	.	G	<X>	0	.	DP=19;I16=11,8,0,0,699,26453,0,0,1140,68400,0,0,403,9679,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,6,68:2:0	0,18,158:6:0
+17	1771	.	A	<X>	0	.	DP=18;I16=10,8,0,0,707,27853,0,0,1080,64800,0,0,401,9659,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,3,42:1:0	0,18,177:6:0
+17	1772	.	G	<X>	0	.	DP=18;I16=10,8,0,0,669,25513,0,0,1080,64800,0,0,398,9600,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,3,38:1:0	0,18,159:6:0
+17	1773	.	C	<X>	0	.	DP=17;I16=10,7,0,0,675,26897,0,0,1020,61200,0,0,396,9550,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,3,39:1:0	0,18,172:6:0
+17	1774	.	A	<X>	0	.	DP=17;I16=10,7,0,0,653,25153,0,0,1020,61200,0,0,394,9508,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,3,39:1:0	0,18,172:6:0
+17	1775	.	T	<X>	0	.	DP=17;I16=10,7,0,0,605,22253,0,0,1020,61200,0,0,391,9423,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,3,38:1:0	0,18,156:6:0
+17	1776	.	A	<X>	0	.	DP=17;I16=10,7,0,0,610,22124,0,0,1020,61200,0,0,388,9344,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,254:10:0	0,3,35:1:0	0,18,166:6:0
+17	1777	.	C	<X>	0	.	DP=18;I16=11,7,0,0,661,24975,0,0,1080,64800,0,0,385,9271,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,3,35:1:0	0,18,158:6:0
+17	1778	.	C	<X>	0	.	DP=18;I16=11,7,0,0,680,25970,0,0,1080,64800,0,0,383,9205,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,3,31:1:0	0,18,172:6:0
+17	1779	.	C	<X>	0	.	DP=18;I16=11,7,0,0,703,27663,0,0,1080,64800,0,0,381,9147,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,3,34:1:0	0,18,174:6:0
+17	1780	.	T	<X>	0	.	DP=18;I16=11,7,0,0,672,26000,0,0,1080,64800,0,0,378,9048,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,3,33:1:0	0,18,177:6:0
+17	1781	.	A	<X>	0	.	DP=19;I16=10,6,0,0,579,21377,0,0,960,57600,0,0,328,7804,0,0;QS=2,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,0,0:0:0	0,15,160:5:0
+17	1782	.	C	<X>	0	.	DP=20;I16=11,9,0,0,715,26603,0,0,1200,72000,0,0,382,8892,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,6,47:2:0	0,18,156:6:0
+17	1783	.	T	<X>	0	.	DP=20;I16=11,9,0,0,755,29057,0,0,1200,72000,0,0,381,8743,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,6,68:2:0	0,18,184:6:0
+17	1784	.	C	<X>	0	.	DP=20;I16=10,9,0,0,723,28017,0,0,1140,68400,0,0,360,8212,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,6,62:2:0	0,15,151:5:0
+17	1785	.	T	<X>	0	.	DP=20;I16=10,10,0,0,766,29878,0,0,1200,72000,0,0,359,8089,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,6,66:2:0	0,15,168:5:0
+17	1786	.	G	<X>	0	.	DP=22;I16=11,11,0,0,841,32323,0,0,1320,79200,0,0,359,7985,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,6,68:2:0	0,15,158:5:0
+17	1787	.	G	<X>	0	.	DP=22;I16=11,11,0,0,806,30294,0,0,1320,79200,0,0,361,7903,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,6,68:2:0	0,15,148:5:0
+17	1788	.	C	<X>	0	.	DP=22;I16=11,11,0,0,858,33674,0,0,1320,79200,0,0,362,7796,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,6,67:2:0	0,15,158:5:0
+17	1789	.	A	<X>	0	.	DP=23;I16=11,12,0,0,797,28705,0,0,1380,82800,0,0,363,7715,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,69:2:0	0,15,157:5:0
+17	1790	.	C	<X>	0	.	DP=23;I16=11,12,0,0,852,31816,0,0,1380,82800,0,0,365,7661,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,63:2:0	0,15,153:5:0
+17	1791	.	A	<X>	0	.	DP=23;I16=11,12,0,0,830,30484,0,0,1380,82800,0,0,367,7635,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,61:2:0	0,15,155:5:0
+17	1792	.	A	<X>	0	.	DP=23;I16=11,12,0,0,862,32760,0,0,1380,82800,0,0,368,7588,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,67:2:0	0,15,161:5:0
+17	1793	.	G	<X>	0	.	DP=23;I16=11,12,0,0,813,29603,0,0,1380,82800,0,0,369,7571,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,61:2:0	0,15,126:5:0
+17	1794	.	C	<X>	0	.	DP=21;I16=9,12,0,0,736,26472,0,0,1260,75600,0,0,370,7484,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,48:2:0	0,9,96:3:0
+17	1795	.	C	<X>	0	.	DP=21;I16=9,12,0,0,763,28807,0,0,1260,75600,0,0,371,7427,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,45:2:0	0,9,100:3:0
+17	1796	.	C	<X>	0	.	DP=21;I16=9,12,0,0,782,29718,0,0,1260,75600,0,0,372,7400,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,52:2:0	0,9,102:3:0
+17	1797	.	A	<X>	0	.	DP=21;I16=9,12,0,0,704,25190,0,0,1260,75600,0,0,373,7403,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,59:2:0	0,9,92:3:0
+17	1798	.	C	<X>	0	.	DP=21;I16=9,12,0,0,759,28119,0,0,1260,75600,0,0,374,7436,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,49:2:0	0,9,99:3:0
+17	1799	.	C	<X>	0	.	DP=22;I16=9,13,0,0,796,29520,0,0,1320,79200,0,0,375,7499,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,56:2:0	0,12,131:4:0
+17	1800	.	C	<X>	0	.	DP=22;I16=9,13,0,0,866,34352,0,0,1320,79200,0,0,376,7542,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,63:2:0	0,12,138:4:0
+17	1801	.	T	<X>	0	.	DP=22;I16=9,13,0,0,838,32282,0,0,1320,79200,0,0,377,7615,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,63:2:0	0,12,150:4:0
+17	1802	.	G	<X>	0	.	DP=22;I16=9,13,0,0,844,32894,0,0,1320,79200,0,0,378,7718,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,60:2:0	0,12,137:4:0
+17	1803	.	C	<X>	0	.	DP=22;I16=9,13,0,0,837,32691,0,0,1320,79200,0,0,377,7751,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,60:2:0	0,12,143:4:0
+17	1804	.	A	<X>	0	.	DP=23;I16=9,14,0,0,793,28517,0,0,1380,82800,0,0,376,7814,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,6,54:2:0	0,12,144:4:0
+17	1805	.	A	<X>	0	.	DP=23;I16=9,14,0,0,810,29148,0,0,1380,82800,0,0,376,7908,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,6,67:2:0	0,12,138:4:0
+17	1806	.	A	<X>	0	.	DP=23;I16=9,14,0,0,816,29932,0,0,1380,82800,0,0,376,8034,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,6,61:2:0	0,12,139:4:0
+17	1807	.	G	<X>	0	.	DP=22;I16=9,13,0,0,837,32299,0,0,1320,79200,0,0,375,8091,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,67:2:0	0,12,142:4:0
+17	1808	.	C	<X>	0	.	DP=21;I16=9,11,0,0,705,25519,0,0,1200,72000,0,0,354,7716,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,6,53:2:0	0,12,140:4:0
+17	1809	.	C	<X>	0	.	DP=22;I16=10,12,0,0,789,29123,0,0,1320,79200,0,0,371,8091,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,55:2:0	0,12,143:4:0
+17	1810	.	C	<X>	0	.	DP=21;I16=10,11,0,0,754,27902,0,0,1260,75600,0,0,370,8084,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,6,51:2:0	0,12,145:4:0
+17	1811	.	C	<X>	0	.	DP=22;I16=11,11,0,0,837,32353,0,0,1320,79200,0,0,368,8056,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,61:2:0	0,12,146:4:0
+17	1812	.	T	<X>	0	.	DP=22;I16=11,11,0,0,830,31782,0,0,1320,79200,0,0,365,7955,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,60:2:0	0,12,151:4:0
+17	1813	.	G	<X>	0	.	DP=21;I16=11,10,0,0,789,29971,0,0,1260,75600,0,0,363,7879,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,6,63:2:0	0,12,135:4:0
+17	1814	.	A	<X>	0	.	DP=21;I16=11,10,0,0,780,29356,0,0,1260,75600,0,0,361,7827,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,6,63:2:0	0,12,148:4:0
+17	1815	.	G	<X>	0	.	DP=21;I16=11,10,0,0,742,27064,0,0,1260,75600,0,0,358,7748,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,6,56:2:0	0,12,135:4:0
+17	1816	.	G	<X>	0	.	DP=21;I16=11,10,0,0,702,24670,0,0,1260,75600,0,0,355,7691,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,6,49:2:0	0,12,124:4:0
+17	1817	.	C	<X>	0	.	DP=20;I16=11,9,0,0,701,25263,0,0,1200,72000,0,0,353,7655,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,6,58:2:0	0,12,134:4:0
+17	1818	.	C	<X>	0	.	DP=20;I16=11,8,0,0,665,23987,0,0,1140,68400,0,0,326,7014,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,6,53:2:0	0,12,132:4:0
+17	1819	.	C	<X>	0	.	DP=18;I16=9,9,0,0,580,20092,0,0,1080,64800,0,0,351,7641,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,6,38:2:0	0,12,124:4:0
+17	1820	.	G	<X>	0	.	DP=18;I16=9,9,0,0,589,19883,0,0,1080,64800,0,0,351,7659,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,6,58:2:0	0,12,117:4:0
+17	1821	.	C	<X>	0	.	DP=18;I16=9,9,0,0,619,22131,0,0,1080,64800,0,0,351,7693,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,6,60:2:0	0,12,131:4:0
+17	1822	.	C	<X>	0	.	DP=18;I16=9,9,0,0,655,24177,0,0,1080,64800,0,0,350,7694,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,6,58:2:0	0,12,131:4:0
+17	1823	.	C	<X>	0	.	DP=19;I16=10,9,0,0,703,26765,0,0,1140,68400,0,0,349,7713,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,6,62:2:0	0,12,138:4:0
+17	1824	.	T	<X>	0	.	DP=19;I16=10,9,0,0,714,27628,0,0,1140,68400,0,0,349,7751,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,6,69:2:0	0,12,149:4:0
+17	1825	.	G	<X>	0	.	DP=19;I16=10,9,0,0,682,24804,0,0,1140,68400,0,0,347,7709,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,6,61:2:0	0,12,129:4:0
+17	1826	.	T	<X>	0	.	DP=19;I16=10,9,0,0,643,22525,0,0,1140,68400,0,0,345,7687,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,6,62:2:0	0,12,141:4:0
+17	1827	.	G	<X>	0	.	DP=19;I16=10,9,0,0,722,27844,0,0,1140,68400,0,0,343,7685,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,6,66:2:0	0,12,134:4:0
+17	1828	.	G	<X>	0	.	DP=18;I16=10,8,0,0,619,21719,0,0,1080,64800,0,0,342,7702,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,6,61:2:0	0,9,100:3:0
+17	1829	.	C	<X>	0	.	DP=19;I16=9,9,0,0,576,19228,0,0,1080,64800,0,0,323,7413,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,9,59:3:0	0,9,103:3:0
+17	1830	.	G	<X>	0	.	DP=19;I16=9,9,0,0,582,19586,0,0,1080,64800,0,0,321,7379,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,9,82:3:0	0,9,80:3:0
+17	1831	.	T	<X>	0	.	DP=20;I16=10,8,0,0,605,21015,0,0,1080,64800,0,0,294,6736,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,106:4:0	0,9,101:3:0
+17	1832	.	C	<X>	0	.	DP=19;I16=9,9,0,0,675,25747,0,0,1080,64800,0,0,319,7359,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,110:4:0	0,9,105:3:0
+17	1833	.	T	<X>	0	.	DP=18;I16=8,8,0,0,565,20733,0,0,960,57600,0,0,295,6747,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,248:10:0	0,9,105:3:0	0,9,106:3:0
+17	1834	.	C	<X>	0	.	DP=19;I16=9,9,0,0,654,24424,0,0,1037,61489,0,0,321,7399,0,0;QS=3,0;MQSB=0.924089;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,104:4:0	0,9,107:3:0
+17	1835	.	T	<X>	0	.	DP=18;I16=9,9,0,0,641,23505,0,0,1037,61489,0,0,347,7965,0,0;QS=3,0;MQSB=0.924089;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,123:4:0	0,9,115:3:0
+17	1836	.	C	<X>	0	.	DP=18;I16=9,9,0,0,657,24427,0,0,1037,61489,0,0,350,8016,0,0;QS=3,0;MQSB=0.924089;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,127:4:0	0,9,108:3:0
+17	1837	.	C	<X>	0	.	DP=18;I16=9,9,0,0,586,20044,0,0,1037,61489,0,0,352,8030,0,0;QS=3,0;MQSB=0.924089;MQ0F=0	PL:DP:DV	0,33,233:11:0	0,12,114:4:0	0,9,108:3:0
+17	1838	.	C	<X>	0	.	DP=18;I16=9,9,0,0,655,24607,0,0,1037,61489,0,0,354,8056,0,0;QS=3,0;MQSB=0.924089;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,120:4:0	0,9,107:3:0
+17	1839	.	T	<X>	0	.	DP=18;I16=9,7,0,0,557,20543,0,0,917,54289,0,0,321,7369,0,0;QS=3,0;MQSB=0.933674;MQ0F=0	PL:DP:DV	0,30,231:10:0	0,9,103:3:0	0,9,119:3:0
+17	1840	.	C	<X>	0	.	DP=18;I16=9,9,0,0,637,23295,0,0,1037,61489,0,0,358,8144,0,0;QS=3,0;MQSB=0.924089;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,116:4:0	0,9,109:3:0
+17	1841	.	C	<X>	0	.	DP=18;I16=9,9,0,0,622,22458,0,0,1037,61489,0,0,360,8206,0,0;QS=3,0;MQSB=0.924089;MQ0F=0	PL:DP:DV	0,33,252:11:0	0,12,121:4:0	0,9,108:3:0
+17	1842	.	C	<X>	0	.	DP=18;I16=9,9,0,0,672,26064,0,0,1037,61489,0,0,362,8280,0,0;QS=3,0;MQSB=0.924089;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,124:4:0	0,9,108:3:0
+17	1843	.	T	<X>	0	.	DP=18;I16=9,9,0,0,630,22746,0,0,1037,61489,0,0,364,8366,0,0;QS=3,0;MQSB=0.924089;MQ0F=0	PL:DP:DV	0,33,243:11:0	0,12,131:4:0	0,9,107:3:0
+17	1844	.	T	<X>	0	.	DP=18;I16=9,9,0,0,618,21618,0,0,1037,61489,0,0,366,8464,0,0;QS=3,0;MQSB=0.924089;MQ0F=0	PL:DP:DV	0,33,240:11:0	0,12,137:4:0	0,9,98:3:0
+17	1845	.	G	<X>	0	.	DP=18;I16=9,9,0,0,644,23976,0,0,1037,61489,0,0,368,8574,0,0;QS=3,0;MQSB=0.924089;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,138:4:0	0,9,82:3:0
+17	1846	.	C	<X>	0	.	DP=18;I16=9,9,0,0,687,26809,0,0,1037,61489,0,0,370,8696,0,0;QS=3,0;MQSB=0.924089;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,129:4:0	0,9,100:3:0
+17	1847	.	T	<X>	0	.	DP=18;I16=9,9,0,0,675,25529,0,0,1037,61489,0,0,373,8829,0,0;QS=3,0;MQSB=0.924089;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,132:4:0	0,6,76:2:0
+17	1848	.	G	<X>	0	.	DP=18;I16=9,9,0,0,597,20845,0,0,1037,61489,0,0,377,8973,0,0;QS=3,0;MQSB=0.924089;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,118:4:0	0,6,64:2:0
+17	1849	.	T	<X>	0	.	DP=20;I16=9,10,0,0,614,20770,0,0,1097,65089,0,0,380,9078,0,0;QS=3,0;MQSB=0.920044;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,119:4:0	0,6,71:2:0
+17	1850	.	C	<X>	0	.	DP=19;I16=8,11,0,0,684,25154,0,0,1097,65089,0,0,409,9769,0,0;QS=3,0;MQSB=0.902014;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,120:4:0	0,3,37:1:0
+17	1851	.	A	<X>	0	.	DP=20;I16=9,11,0,0,738,27838,0,0,1157,68689,0,0,413,9847,0,0;QS=3,0;MQSB=0.916401;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,12,143:4:0	0,3,41:1:0
+17	1852	.	G	<X>	0	.	DP=19;I16=8,11,0,0,639,22239,0,0,1097,65089,0,0,392,9264,0,0;QS=3,0;MQSB=0.902014;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,117:4:0	0,3,36:1:0
+17	1853	.	G	<X>	0	.	DP=20;I16=9,11,0,0,627,20873,0,0,1157,68689,0,0,396,9322,0,0;QS=3,0;MQSB=0.916401;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,127:5:0	0,3,38:1:0
+17	1854	.	A	<X>	0	.	DP=22;I16=10,11,0,0,674,22428,0,0,1217,72289,0,0,401,9397,0,0;QS=3,0;MQSB=0.927743;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,145:5:0	0,3,38:1:0
+17	1855	.	C	<X>	0	.	DP=22;I16=10,12,0,0,771,27949,0,0,1277,75889,0,0,407,9441,0,0;QS=3,0;MQSB=0.924723;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,15,132:5:0	0,3,37:1:0
+17	1856	.	A	<X>	0	.	DP=22;I16=10,12,0,0,806,30230,0,0,1277,75889,0,0,412,9456,0,0;QS=3,0;MQSB=0.924723;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,15,146:5:0	0,3,41:1:0
+17	1857	.	G	<X>	0	.	DP=22;I16=10,12,0,0,699,23919,0,0,1277,75889,0,0,416,9442,0,0;QS=3,0;MQSB=0.924723;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,15,134:5:0	0,3,35:1:0
+17	1858	.	T	<X>	0	.	DP=23;I16=10,13,0,0,773,26797,0,0,1337,79489,0,0,419,9399,0,0;QS=3,0;MQSB=0.921963;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,15,148:5:0	0,3,37:1:0
+17	1859	.	G	<X>	0	.	DP=23;I16=10,13,0,0,798,28594,0,0,1337,79489,0,0,423,9379,0,0;QS=3,0;MQSB=0.921963;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,15,146:5:0	0,3,36:1:0
+17	1860	.	G	<X>	0	.	DP=23;I16=10,13,0,0,726,23842,0,0,1337,79489,0,0,425,9283,0,0;QS=3,0;MQSB=0.921963;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,15,126:5:0	0,3,33:1:0
+17	1861	.	T	<X>	0	.	DP=23;I16=10,13,0,0,741,24793,0,0,1337,79489,0,0,425,9113,0,0;QS=3,0;MQSB=0.921963;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,15,143:5:0	0,3,39:1:0
+17	1862	.	C	<X>	0	.	DP=23;I16=10,12,0,0,738,25732,0,0,1277,75889,0,0,403,8487,0,0;QS=3,0;MQSB=0.924723;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,15,135:5:0	0,3,34:1:0
+17	1863	.	C	<X>	0	.	DP=24;I16=10,13,0,0,804,29186,0,0,1337,79489,0,0,400,8232,0,0;QS=3,0;MQSB=0.921963;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,15,133:5:0	0,3,36:1:0
+17	1864	.	T	<X>	0	.	DP=24;I16=11,11,0,0,766,27572,0,0,1277,75889,0,0,392,8174,0,0;QS=3,0;MQSB=0.936864;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,12,125:4:0	0,3,37:1:0
+17	1865	.	G	<X>	0	.	DP=24;I16=11,13,0,0,860,31394,0,0,1397,83089,0,0,425,8621,0,0;QS=3,0;MQSB=0.931547;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,15,154:5:0	0,3,38:1:0
+17	1866	.	G	<X>	0	.	DP=24;I16=11,13,0,0,795,27503,0,0,1397,83089,0,0,425,8551,0,0;QS=3,0;MQSB=0.931547;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,15,152:5:0	0,3,36:1:0
+17	1867	.	C	<X>	0	.	DP=24;I16=9,13,0,0,726,24886,0,0,1320,79200,0,0,375,7263,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,15,122:5:0	0,3,38:1:0
+17	1868	.	C	<X>	0	.	DP=24;I16=11,12,0,0,857,32293,0,0,1337,79489,0,0,411,8311,0,0;QS=3,0;MQSB=0.934091;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,12,118:4:0	0,3,41:1:0
+17	1869	.	A	T,<X>	0	.	DP=24;I16=6,9,5,4,531,19001,268,8660,857,50689,540,32400,273,5667,152,2866;QS=1.4724,1.5276,0;VDB=0.928022;SGB=-11.9537;RPB=0.984127;MQB=0.96464;MQSB=0.931547;BQB=0.359155;MQ0F=0	PL:DP:DV	115,0,224,148,245,255:18:7	16,0,104,28,107,128:5:1	42,3,0,42,3,42:1:1
+17	1870	.	C	<X>	0	.	DP=25;I16=11,13,0,0,804,27826,0,0,1397,83089,0,0,425,8591,0,0;QS=3,0;MQSB=0.931547;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,15,127:5:0	0,3,36:1:0
+17	1871	.	C	<X>	0	.	DP=25;I16=11,14,0,0,761,24187,0,0,1457,86689,0,0,428,8690,0,0;QS=3,0;MQSB=0.929204;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,18,128:6:0	0,3,29:1:0
+17	1872	.	G	<X>	0	.	DP=25;I16=10,14,0,0,763,25437,0,0,1397,83089,0,0,425,8803,0,0;QS=3,0;MQSB=0.919431;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,18,132:6:0	0,3,43:1:0
+17	1873	.	G	<X>	0	.	DP=26;I16=11,15,0,0,790,25548,0,0,1517,90289,0,0,429,8931,0,0;QS=3,0;MQSB=0.927041;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,21,151:7:0	0,3,43:1:0
+17	1874	.	G	<X>	0	.	DP=27;I16=11,16,0,0,861,29013,0,0,1577,93889,0,0,430,9076,0,0;QS=3,0;MQSB=0.925036;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,24,172:8:0	0,3,43:1:0
+17	1875	.	G	<X>	0	.	DP=26;I16=11,15,0,0,800,26216,0,0,1517,90289,0,0,431,9155,0,0;QS=3,0;MQSB=0.927041;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,21,168:7:0	0,3,42:1:0
+17	1876	.	C	<X>	0	.	DP=26;I16=10,15,0,0,894,32714,0,0,1457,86689,0,0,432,9268,0,0;QS=3,0;MQSB=0.9171;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,21,171:7:0	0,3,41:1:0
+17	1877	.	T	<X>	0	.	DP=25;I16=9,15,0,0,848,30804,0,0,1397,83089,0,0,409,8787,0,0;QS=3,0;MQSB=0.904837;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,18,163:6:0	0,3,42:1:0
+17	1878	.	C	<X>	0	.	DP=25;I16=10,15,0,0,906,33478,0,0,1457,86689,0,0,434,9488,0,0;QS=3,0;MQSB=0.9171;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,21,166:7:0	0,3,40:1:0
+17	1879	.	A	<X>	0	.	DP=26;I16=10,16,0,0,911,32761,0,0,1517,90289,0,0,433,9543,0,0;QS=3,0;MQSB=0.914947;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,24,191:8:0	0,3,40:1:0
+17	1880	.	C	<X>	0	.	DP=26;I16=10,16,0,0,790,24876,0,0,1517,90289,0,0,431,9527,0,0;QS=3,0;MQSB=0.914947;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,24,152:8:0	0,3,31:1:0
+17	1881	.	G	<X>	0	.	DP=27;I16=10,15,0,0,782,25352,0,0,1500,90000,0,0,380,8288,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,21,144:7:0	0,3,42:1:0
+17	1882	.	G	<X>	0	.	DP=28;I16=12,15,0,0,937,33215,0,0,1577,93889,0,0,406,8952,0,0;QS=3,0;MQSB=0.935229;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,21,164:7:0	0,3,42:1:0
+17	1883	.	A	<X>	0	.	DP=29;I16=14,15,0,0,998,35394,0,0,1697,101089,0,0,434,9646,0,0;QS=3,0;MQSB=0.947838;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,24,180:8:0	0,3,43:1:0
+17	1884	.	G	<X>	0	.	DP=29;I16=14,15,0,0,1036,37926,0,0,1697,101089,0,0,437,9647,0,0;QS=3,0;MQSB=0.947838;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,24,202:8:0	0,3,42:1:0
+17	1885	.	C	<X>	0	.	DP=28;I16=14,13,0,0,925,32305,0,0,1577,93889,0,0,430,9560,0,0;QS=3,0;MQSB=0.951472;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,21,182:7:0	0,3,42:1:0
+17	1886	.	C	<X>	0	.	DP=26;I16=13,13,0,0,826,27194,0,0,1517,90289,0,0,447,9745,0,0;QS=3,0;MQSB=0.945959;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,24,166:8:0	0,3,32:1:0
+17	1887	.	G	<X>	0	.	DP=26;I16=12,13,0,0,798,26554,0,0,1500,90000,0,0,428,9212,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,24,185:8:0	0,3,40:1:0
+17	1888	.	C	<X>	0	.	DP=26;I16=13,13,0,0,901,32343,0,0,1517,90289,0,0,459,9957,0,0;QS=3,0;MQSB=0.945959;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,24,178:8:0	0,3,39:1:0
+17	1889	.	C	<X>	0	.	DP=25;I16=13,11,0,0,825,29127,0,0,1397,83089,0,0,444,9612,0,0;QS=3,0;MQSB=0.950498;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,21,187:7:0	0,3,37:1:0
+17	1890	.	C	<X>	0	.	DP=25;I16=13,12,0,0,913,34029,0,0,1457,86689,0,0,471,10173,0,0;QS=3,0;MQSB=0.948139;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,24,198:8:0	0,3,40:1:0
+17	1891	.	T	<X>	0	.	DP=25;I16=13,12,0,0,912,34028,0,0,1457,86689,0,0,477,10317,0,0;QS=3,0;MQSB=0.948139;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,24,212:8:0	0,3,39:1:0
+17	1892	.	G	<X>	0	.	DP=25;I16=12,12,0,0,885,33149,0,0,1397,83089,0,0,458,9860,0,0;QS=3,0;MQSB=0.941765;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,21,166:7:0	0,3,37:1:0
+17	1893	.	T	<X>	0	.	DP=26;I16=14,12,0,0,920,33494,0,0,1517,90289,0,0,489,10677,0,0;QS=3,0;MQSB=0.953497;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,24,205:8:0	0,6,72:2:0
+17	1894	.	G	<X>	0	.	DP=26;I16=14,12,0,0,934,35048,0,0,1517,90289,0,0,495,10843,0,0;QS=3,0;MQSB=0.953497;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,24,188:8:0	0,6,75:2:0
+17	1895	.	C	<X>	0	.	DP=26;I16=13,12,0,0,882,31980,0,0,1500,90000,0,0,476,10408,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,24,180:8:0	0,6,73:2:0
+17	1896	.	C	<X>	0	.	DP=26;I16=14,11,0,0,827,28179,0,0,1457,86689,0,0,482,10622,0,0;QS=3,0;MQSB=0.955682;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,21,154:7:0	0,6,72:2:0
+17	1897	.	G	<X>	0	.	DP=26;I16=13,11,0,0,763,25169,0,0,1397,83089,0,0,486,10856,0,0;QS=3,0;MQSB=0.950498;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,21,164:7:0	0,3,27:1:0
+17	1898	.	T	<X>	0	.	DP=27;I16=14,11,0,0,846,29526,0,0,1500,90000,0,0,492,11072,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,24,187:8:0	0,6,62:2:0
+17	1899	.	G	<X>	0	.	DP=27;I16=14,11,0,0,875,32007,0,0,1500,90000,0,0,497,11213,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,24,188:8:0	0,6,61:2:0
+17	1900	.	T	<X>	0	.	DP=26;I16=14,11,0,0,850,29882,0,0,1500,90000,0,0,501,11329,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,24,185:8:0	0,6,69:2:0
+17	1901	.	A	<X>	0	.	DP=27;I16=15,10,0,0,842,29298,0,0,1457,86689,0,0,505,11469,0,0;QS=3,0;MQSB=0.962269;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,21,190:7:0	0,6,68:2:0
+17	1902	.	C	<X>	0	.	DP=27;I16=15,12,0,0,912,31970,0,0,1577,93889,0,0,537,12267,0,0;QS=3,0;MQSB=0.958048;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,24,184:8:0	0,6,60:2:0
+17	1903	.	C	<X>	0	.	DP=27;I16=15,12,0,0,959,34645,0,0,1577,93889,0,0,542,12462,0,0;QS=3,0;MQSB=0.958048;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,24,201:8:0	0,6,63:2:0
+17	1904	.	T	<X>	0	.	DP=27;I16=16,11,0,0,1017,38757,0,0,1577,93889,0,0,548,12682,0,0;QS=3,0;MQSB=0.96384;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,24,221:8:0	0,6,77:2:0
+17	1905	.	C	<X>	0	.	DP=27;I16=16,11,0,0,985,36561,0,0,1577,93889,0,0,553,12827,0,0;QS=3,0;MQSB=0.96384;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,24,211:8:0	0,6,69:2:0
+17	1906	.	T	<X>	0	.	DP=27;I16=16,11,0,0,1018,39242,0,0,1577,93889,0,0,558,12998,0,0;QS=3,0;MQSB=0.96384;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,24,207:8:0	0,6,75:2:0
+17	1907	.	G	<X>	0	.	DP=27;I16=15,11,0,0,935,34679,0,0,1517,90289,0,0,535,12419,0,0;QS=3,0;MQSB=0.960078;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,21,187:7:0	0,6,68:2:0
+17	1908	.	A	<X>	0	.	DP=28;I16=16,12,0,0,1023,38221,0,0,1637,97489,0,0,561,13063,0,0;QS=3,0;MQSB=0.96195;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,24,215:8:0	0,6,67:2:0
+17	1909	.	G	<X>	0	.	DP=27;I16=15,12,0,0,1002,38398,0,0,1577,93889,0,0,561,12953,0,0;QS=3,0;MQSB=0.958048;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,24,206:8:0	0,6,73:2:0
+17	1910	.	C	<X>	0	.	DP=27;I16=14,10,0,0,855,31251,0,0,1440,86400,0,0,502,11588,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,21,179:7:0	0,6,71:2:0
+17	1911	.	C	<X>	0	.	DP=27;I16=15,12,0,0,967,35429,0,0,1577,93889,0,0,561,12793,0,0;QS=3,0;MQSB=0.958048;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,24,206:8:0	0,6,71:2:0
+17	1912	.	C	<X>	0	.	DP=27;I16=15,12,0,0,1024,39272,0,0,1577,93889,0,0,561,12743,0,0;QS=3,0;MQSB=0.958048;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,24,217:8:0	0,6,73:2:0
+17	1913	.	T	<X>	0	.	DP=27;I16=15,12,0,0,1028,39768,0,0,1577,93889,0,0,561,12713,0,0;QS=3,0;MQSB=0.958048;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,24,228:8:0	0,6,77:2:0
+17	1914	.	C	<X>	0	.	DP=27;I16=15,12,0,0,1010,38762,0,0,1577,93889,0,0,561,12703,0,0;QS=3,0;MQSB=0.958048;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,24,221:8:0	0,6,75:2:0
+17	1915	.	T	C,<X>	0	.	DP=27;I16=14,12,1,0,974,37184,16,256,1560,93600,17,289,543,12389,18,324;QS=2.97351,0.0264901,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.958048;BQB=1;MQ0F=0	PL:DP:DV	0,34,255,48,255,255:17:1	0,24,231,24,231,231:8:0	0,6,60,6,60,60:2:0
+17	1916	.	G	T,<X>	0	.	DP=27;I16=14,12,1,0,991,38291,15,225,1560,93600,17,289,544,12454,17,289;QS=2.97581,0.0241935,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.958048;BQB=1;MQ0F=0	PL:DP:DV	0,35,255,48,255,255:17:1	0,24,226,24,226,226:8:0	0,6,69,6,69,69:2:0
+17	1917	.	C	<X>	0	.	DP=27;I16=15,12,0,0,1030,39740,0,0,1577,93889,0,0,561,12793,0,0;QS=3,0;MQSB=0.958048;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,24,214:8:0	0,6,73:2:0
+17	1918	.	A	<X>	0	.	DP=27;I16=15,11,0,0,963,36201,0,0,1517,90289,0,0,542,12502,0,0;QS=3,0;MQSB=0.960078;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,24,217:8:0	0,6,72:2:0
+17	1919	.	C	<X>	0	.	DP=27;I16=15,12,0,0,987,36651,0,0,1577,93889,0,0,560,12902,0,0;QS=3,0;MQSB=0.958048;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,24,214:8:0	0,6,72:2:0
+17	1920	.	A	T,<X>	0	.	DP=29;I16=15,12,0,1,1007,38337,14,196,1546,91130,60,3600,538,12518,21,441;QS=2.97647,0.0235294,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.999735;BQB=1;MQ0F=0	PL:DP:DV	0,36,255,48,255,255:17:1	0,24,225,24,225,225:8:0	0,9,101,9,101,101:3:0
+17	1921	.	G	<X>	0	.	DP=30;I16=15,14,0,0,1059,39815,0,0,1666,98330,0,0,542,12474,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,21,182:7:0	0,12,132:4:0
+17	1922	.	T	<X>	0	.	DP=29;I16=14,14,0,0,1013,37513,0,0,1649,98041,0,0,532,12418,0,0;QS=3,0;MQSB=0.949591;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,21,197:7:0	0,12,134:4:0
+17	1923	.	G	<X>	0	.	DP=28;I16=14,14,0,0,1034,38974,0,0,1606,94730,0,0,545,12629,0,0;QS=3,0;MQSB=0.999736;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,21,188:7:0	0,12,126:4:0
+17	1924	.	C	<X>	0	.	DP=27;I16=13,13,0,0,965,36587,0,0,1486,87530,0,0,521,12017,0,0;QS=3,0;MQSB=0.999671;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,21,183:7:0	0,12,116:4:0
+17	1925	.	C	<X>	0	.	DP=27;I16=14,13,0,0,987,37021,0,0,1546,91130,0,0,546,12626,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,21,187:7:0	0,12,124:4:0
+17	1926	.	T	<X>	0	.	DP=27;I16=14,13,0,0,1031,40057,0,0,1546,91130,0,0,545,12581,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,21,197:7:0	0,12,141:4:0
+17	1927	.	T	<X>	0	.	DP=27;I16=13,13,0,0,959,35773,0,0,1529,90841,0,0,538,12522,0,0;QS=3,0;MQSB=0.945959;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,21,191:7:0	0,12,133:4:0
+17	1928	.	C	<X>	0	.	DP=27;I16=13,13,0,0,986,38264,0,0,1529,90841,0,0,538,12532,0,0;QS=3,0;MQSB=0.945959;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,21,189:7:0	0,12,125:4:0
+17	1929	.	T	<X>	0	.	DP=27;I16=13,13,0,0,990,38630,0,0,1529,90841,0,0,538,12562,0,0;QS=3,0;MQSB=0.945959;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,21,189:7:0	0,12,139:4:0
+17	1930	.	G	<X>	0	.	DP=26;I16=13,11,0,0,905,34865,0,0,1409,83641,0,0,521,12271,0,0;QS=3,0;MQSB=0.931547;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,18,179:6:0	0,9,99:3:0
+17	1931	.	C	<X>	0	.	DP=27;I16=15,12,0,0,967,36293,0,0,1546,91130,0,0,540,12578,0,0;QS=3,0;MQSB=0.99881;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,18,165:6:0	0,12,121:4:0
+17	1932	.	T	<X>	0	.	DP=27;I16=14,13,0,0,998,38154,0,0,1546,91130,0,0,541,12605,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,15,143:5:0	0,15,146:5:0
+17	1933	.	T	<X>	0	.	DP=27;I16=14,13,0,0,962,35344,0,0,1546,91130,0,0,542,12602,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,15,142:5:0	0,15,158:5:0
+17	1934	.	G	<X>	0	.	DP=27;I16=13,13,0,0,987,38219,0,0,1529,90841,0,0,543,12569,0,0;QS=3,0;MQSB=0.945959;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,15,134:5:0	0,15,143:5:0
+17	1935	.	C	<X>	0	.	DP=27;I16=14,12,0,0,963,36627,0,0,1529,90841,0,0,520,11930,0,0;QS=3,0;MQSB=0.937241;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,18,162:6:0	0,15,154:5:0
+17	1936	.	C	<X>	0	.	DP=27;I16=14,13,0,0,1018,39406,0,0,1589,94441,0,0,547,12561,0,0;QS=3,0;MQSB=0.94394;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,18,177:6:0	0,15,159:5:0
+17	1937	.	T	<X>	0	.	DP=27;I16=14,13,0,0,1036,40636,0,0,1589,94441,0,0,547,12489,0,0;QS=3,0;MQSB=0.94394;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,18,182:6:0	0,15,170:5:0
+17	1938	.	G	<X>	0	.	DP=27;I16=14,13,0,0,1001,38377,0,0,1589,94441,0,0,546,12392,0,0;QS=3,0;MQSB=0.94394;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,18,166:6:0	0,15,155:5:0
+17	1939	.	T	<X>	0	.	DP=27;I16=14,12,0,0,964,36430,0,0,1560,93600,0,0,525,11909,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,18,167:6:0	0,12,144:4:0
+17	1940	.	G	<X>	0	.	DP=27;I16=14,13,0,0,1003,37937,0,0,1589,94441,0,0,542,12172,0,0;QS=3,0;MQSB=0.94394;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,18,159:6:0	0,15,155:5:0
+17	1941	.	G	<X>	0	.	DP=27;I16=14,13,0,0,1004,38072,0,0,1589,94441,0,0,540,12098,0,0;QS=3,0;MQSB=0.94394;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,18,176:6:0	0,15,156:5:0
+17	1942	.	C	<X>	0	.	DP=27;I16=14,12,0,0,996,38790,0,0,1560,93600,0,0,516,11564,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,18,174:6:0	0,12,140:4:0
+17	1943	.	T	<X>	0	.	DP=27;I16=14,13,0,0,1044,40952,0,0,1589,94441,0,0,536,12022,0,0;QS=3,0;MQSB=0.94394;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,18,184:6:0	0,15,167:5:0
+17	1944	.	T	<X>	0	.	DP=27;I16=14,13,0,0,987,37237,0,0,1589,94441,0,0,533,11971,0,0;QS=3,0;MQSB=0.94394;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,18,175:6:0	0,15,170:5:0
+17	1945	.	T	<X>	0	.	DP=27;I16=14,13,0,0,993,37067,0,0,1589,94441,0,0,530,11946,0,0;QS=3,0;MQSB=0.94394;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,18,174:6:0	0,15,171:5:0
+17	1946	.	G	<X>	0	.	DP=27;I16=14,13,0,0,1013,38617,0,0,1589,94441,0,0,526,11896,0,0;QS=3,0;MQSB=0.94394;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,18,162:6:0	0,15,162:5:0
+17	1947	.	A	<X>	0	.	DP=26;I16=13,13,0,0,950,35522,0,0,1529,90841,0,0,522,11818,0,0;QS=3,0;MQSB=0.945959;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,18,167:6:0	0,15,160:5:0
+17	1948	.	G	C,<X>	0	.	DP=27;I16=14,12,0,1,966,36912,16,256,1560,93600,29,841,493,11135,25,625;QS=2.90361,0.0963855,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.94394;BQB=1;MQ0F=0	PL:DP:DV	0,45,255,45,255,255:15:0	0,21,190,21,190,190:7:0	1,0,123,13,126,132:5:1
+17	1949	.	A	<X>	0	.	DP=26;I16=14,11,0,0,871,31325,0,0,1469,87241,0,0,490,11048,0,0;QS=3,0;MQSB=0.929204;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,21,174:7:0	0,15,155:5:0
+17	1950	.	A	<X>	0	.	DP=27;I16=14,13,0,0,1007,38049,0,0,1589,94441,0,0,511,11559,0,0;QS=3,0;MQSB=0.94394;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,21,205:7:0	0,18,176:6:0
+17	1951	.	G	<X>	0	.	DP=27;I16=14,13,0,0,960,35536,0,0,1589,94441,0,0,509,11469,0,0;QS=3,0;MQSB=0.94394;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,21,180:7:0	0,18,181:6:0
+17	1952	.	A	<X>	0	.	DP=27;I16=14,12,0,0,924,33366,0,0,1529,90841,0,0,483,10779,0,0;QS=3,0;MQSB=0.937241;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,21,184:7:0	0,18,182:6:0
+17	1953	.	A	<X>	0	.	DP=28;I16=15,12,0,0,925,32719,0,0,1589,94441,0,0,482,10740,0,0;QS=3,0;MQSB=0.935229;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,21,189:7:0	0,18,168:6:0
+17	1954	.	A	C,<X>	0	.	DP=29;I16=14,13,0,1,929,33219,18,324,1620,97200,29,841,475,10679,25,625;QS=2.90217,0.0978261,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.949591;BQB=1;MQ0F=0	PL:DP:DV	0,45,255,45,255,255:15:0	0,21,198,21,198,198:7:0	0,0,130,15,133,141:6:1
+17	1955	.	C	<X>	0	.	DP=29;I16=14,12,0,0,961,36067,0,0,1560,93600,0,0,451,10035,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,21,206:7:0	0,15,165:5:0
+17	1956	.	C	<X>	0	.	DP=29;I16=14,13,0,0,964,35402,0,0,1620,97200,0,0,475,10573,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,21,196:7:0	0,15,164:5:0
+17	1957	.	C	<X>	0	.	DP=29;I16=14,13,0,0,980,36212,0,0,1620,97200,0,0,472,10420,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,21,183:7:0	0,15,167:5:0
+17	1958	.	C	<X>	0	.	DP=29;I16=15,13,0,0,1003,37293,0,0,1649,98041,0,0,493,10825,0,0;QS=3,0;MQSB=0.942064;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,21,191:7:0	0,18,190:6:0
+17	1959	.	T	<X>	0	.	DP=29;I16=16,13,0,0,1112,43258,0,0,1709,101641,0,0,491,10593,0,0;QS=3,0;MQSB=0.940317;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,21,213:7:0	0,18,193:6:0
+17	1960	.	T	<X>	0	.	DP=30;I16=17,13,0,0,1053,37939,0,0,1769,105241,0,0,485,10339,0,0;QS=3,0;MQSB=0.938685;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,21,196:7:0	0,18,186:6:0
+17	1961	.	C	<X>	0	.	DP=30;I16=17,13,0,0,1101,41737,0,0,1769,105241,0,0,480,10122,0,0;QS=3,0;MQSB=0.938685;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,21,195:7:0	0,18,183:6:0
+17	1962	.	T	<X>	0	.	DP=29;I16=17,12,0,0,1134,44582,0,0,1709,101641,0,0,477,9941,0,0;QS=3,0;MQSB=0.931617;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,21,208:7:0	0,18,198:6:0
+17	1963	.	G	<X>	0	.	DP=28;I16=16,12,0,0,1066,41050,0,0,1649,98041,0,0,476,9794,0,0;QS=3,0;MQSB=0.933359;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,21,192:7:0	0,18,188:6:0
+17	1964	.	G	<X>	0	.	DP=28;I16=16,12,0,0,970,34764,0,0,1649,98041,0,0,475,9681,0,0;QS=3,0;MQSB=0.933359;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,21,178:7:0	0,18,169:6:0
+17	1965	.	T	<X>	0	.	DP=29;I16=16,12,0,0,964,34772,0,0,1649,98041,0,0,449,8977,0,0;QS=3,0;MQSB=0.933359;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,21,196:7:0	0,18,171:6:0
+17	1966	.	T	<X>	0	.	DP=29;I16=16,13,0,0,1029,37027,0,0,1709,101641,0,0,474,9558,0,0;QS=3,0;MQSB=0.940317;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,21,191:7:0	0,18,181:6:0
+17	1967	.	A	<X>	0	.	DP=29;I16=16,13,0,0,1030,37234,0,0,1709,101641,0,0,474,9550,0,0;QS=3,0;MQSB=0.940317;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,21,187:7:0	0,18,182:6:0
+17	1968	.	T	<X>	0	.	DP=29;I16=16,13,0,0,1075,40173,0,0,1709,101641,0,0,474,9578,0,0;QS=3,0;MQSB=0.940317;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,21,195:7:0	0,18,190:6:0
+17	1969	.	A	<X>	0	.	DP=28;I16=16,12,0,0,992,35828,0,0,1649,98041,0,0,474,9592,0,0;QS=3,0;MQSB=0.933359;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,18,175:6:0	0,18,186:6:0
+17	1970	.	C	<X>	0	.	DP=28;I16=16,12,0,0,1015,37503,0,0,1649,98041,0,0,474,9642,0,0;QS=3,0;MQSB=0.933359;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,18,170:6:0	0,18,180:6:0
+17	1971	.	A	<X>	0	.	DP=29;I16=16,13,0,0,1073,40273,0,0,1709,101641,0,0,474,9728,0,0;QS=3,0;MQSB=0.940317;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,18,178:6:0	0,21,206:7:0
+17	1972	.	T	<X>	0	.	DP=30;I16=16,14,0,0,1068,38978,0,0,1769,105241,0,0,475,9851,0,0;QS=3,0;MQSB=0.946202;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,18,176:6:0	0,21,203:7:0
+17	1973	.	A	<X>	0	.	DP=30;I16=16,13,0,0,1046,38070,0,0,1740,104400,0,0,452,9388,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,18,172:6:0	0,18,196:6:0
+17	1974	.	A	<X>	0	.	DP=29;I16=16,13,0,0,1086,41474,0,0,1709,101641,0,0,477,10065,0,0;QS=3,0;MQSB=0.940317;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,15,157:5:0	0,21,214:7:0
+17	1975	.	G	<X>	0	.	DP=28;I16=16,12,0,0,1067,41171,0,0,1649,98041,0,0,478,10156,0,0;QS=3,0;MQSB=0.933359;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,12,133:4:0	0,21,195:7:0
+17	1976	.	A	<X>	0	.	DP=28;I16=16,12,0,0,981,34839,0,0,1649,98041,0,0,478,10234,0,0;QS=3,0;MQSB=0.933359;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,12,125:4:0	0,21,199:7:0
+17	1977	.	C	<X>	0	.	DP=28;I16=16,12,0,0,1009,37471,0,0,1649,98041,0,0,477,10297,0,0;QS=3,0;MQSB=0.933359;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,12,132:4:0	0,21,194:7:0
+17	1978	.	A	<X>	0	.	DP=28;I16=16,12,0,0,1082,42132,0,0,1649,98041,0,0,476,10394,0,0;QS=3,0;MQSB=0.933359;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,12,144:4:0	0,21,220:7:0
+17	1979	.	G	<X>	0	.	DP=28;I16=16,11,0,0,1019,38927,0,0,1589,94441,0,0,454,10064,0,0;QS=3,0;MQSB=0.925036;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,12,122:4:0	0,21,208:7:0
+17	1980	.	C	<X>	0	.	DP=27;I16=16,10,0,0,932,34456,0,0,1529,90841,0,0,452,10114,0,0;QS=3,0;MQSB=0.914947;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,107:3:0	0,21,197:7:0
+17	1981	.	C	<X>	0	.	DP=28;I16=16,12,0,0,998,36510,0,0,1649,98041,0,0,469,10479,0,0;QS=3,0;MQSB=0.933359;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,9,101:3:0	0,24,219:8:0
+17	1982	.	A	<X>	0	.	DP=29;I16=16,12,0,0,1035,38815,0,0,1649,98041,0,0,472,10548,0,0;QS=3,0;MQSB=0.933359;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,110:3:0	0,27,254:9:0
+17	1983	.	G	<X>	0	.	DP=28;I16=16,12,0,0,1048,40322,0,0,1649,98041,0,0,477,10599,0,0;QS=3,0;MQSB=0.933359;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,96:3:0	0,27,249:9:0
+17	1984	.	A	<X>	0	.	DP=27;I16=16,11,0,0,1024,39232,0,0,1589,94441,0,0,482,10632,0,0;QS=3,0;MQSB=0.925036;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,70:2:0	0,27,255:9:0
+17	1985	.	G	<X>	0	.	DP=27;I16=16,11,0,0,1009,38449,0,0,1589,94441,0,0,487,10695,0,0;QS=3,0;MQSB=0.925036;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,66:2:0	0,27,231:9:0
+17	1986	.	A	<X>	0	.	DP=27;I16=16,10,0,0,926,33696,0,0,1560,93600,0,0,466,10112,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,76:2:0	0,24,223:8:0
+17	1987	.	A	<X>	0	.	DP=28;I16=17,11,0,0,1034,39088,0,0,1649,98041,0,0,495,10807,0,0;QS=3,0;MQSB=0.923174;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,6,78:2:0	0,27,247:9:0
+17	1988	.	G	<X>	0	.	DP=28;I16=17,11,0,0,1050,39980,0,0,1649,98041,0,0,499,10855,0,0;QS=3,0;MQSB=0.923174;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,6,63:2:0	0,27,239:9:0
+17	1989	.	G	<X>	0	.	DP=28;I16=17,10,0,0,994,37610,0,0,1589,94441,0,0,493,10801,0,0;QS=3,0;MQSB=0.912952;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,73:2:0	0,27,237:9:0
+17	1990	.	G	T,<X>	0	.	DP=28;I16=17,9,0,1,965,36359,33,1089,1560,93600,29,841,472,10250,25,625;QS=2.90675,0.0932476,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.912952;BQB=1;MQ0F=0	PL:DP:DV	0,48,255,48,255,255:16:0	0,6,71,6,71,71:2:0	2,0,195,26,198,215:9:1
+17	1991	.	A	<X>	0	.	DP=28;I16=17,11,0,0,1017,38203,0,0,1649,98041,0,0,507,10975,0,0;QS=3,0;MQSB=0.923174;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,6,60:2:0	0,27,250:9:0
+17	1992	.	G	<X>	0	.	DP=28;I16=17,11,0,0,1028,38852,0,0,1649,98041,0,0,509,11039,0,0;QS=3,0;MQSB=0.923174;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,6,62:2:0	0,27,231:9:0
+17	1993	.	T	<X>	0	.	DP=28;I16=17,11,0,0,1015,37325,0,0,1649,98041,0,0,511,11131,0,0;QS=3,0;MQSB=0.923174;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,6,59:2:0	0,27,243:9:0
+17	1994	.	T	<X>	0	.	DP=27;I16=16,11,0,0,942,33698,0,0,1589,94441,0,0,514,11250,0,0;QS=3,0;MQSB=0.925036;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,6,54:2:0	0,24,216:8:0
+17	1995	.	G	<X>	0	.	DP=28;I16=16,11,0,0,960,35432,0,0,1620,97200,0,0,492,10770,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,6,66:2:0	0,21,188:7:0
+17	1996	.	C	<X>	0	.	DP=29;I16=17,12,0,0,1022,37426,0,0,1709,101641,0,0,519,11469,0,0;QS=3,0;MQSB=0.931617;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,6,64:2:0	0,24,192:8:0
+17	1997	.	C	<X>	0	.	DP=29;I16=17,11,0,0,934,32858,0,0,1649,98041,0,0,520,11524,0,0;QS=3,0;MQSB=0.923174;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,6,70:2:0	0,24,193:8:0
+17	1998	.	C	<X>	0	.	DP=29;I16=17,12,0,0,1027,37843,0,0,1709,101641,0,0,522,11562,0,0;QS=3,0;MQSB=0.931617;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,6,69:2:0	0,24,222:8:0
+17	1999	.	A	<X>	0	.	DP=28;I16=17,11,0,0,1073,41493,0,0,1649,98041,0,0,525,11627,0,0;QS=3,0;MQSB=0.923174;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,6,72:2:0	0,21,206:7:0
+17	2000	.	G	<X>	0	.	DP=28;I16=16,11,0,0,1036,40576,0,0,1589,94441,0,0,511,11395,0,0;QS=3,0;MQSB=0.925036;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,6,72:2:0	0,18,168:6:0
+17	2001	.	G	<X>	0	.	DP=28;I16=15,11,0,0,955,35661,0,0,1529,90841,0,0,489,10853,0,0;QS=3,0;MQSB=0.927041;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,6,62:2:0	0,18,172:6:0
+17	2002	.	G	<X>	0	.	DP=28;I16=17,10,0,0,907,32227,0,0,1620,97200,0,0,519,11663,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,6,53:2:0	0,18,163:6:0
+17	2003	.	T	<X>	0	.	DP=28;I16=17,11,0,0,920,31866,0,0,1649,98041,0,0,541,12163,0,0;QS=3,0;MQSB=0.923174;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,6,49:2:0	0,21,190:7:0
+17	2004	.	G	<X>	0	.	DP=27;I16=16,10,0,0,970,36928,0,0,1560,93600,0,0,530,12110,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,6,57:2:0	0,18,178:6:0
+17	2005	.	G	<X>	0	.	DP=27;I16=16,10,0,0,868,30936,0,0,1560,93600,0,0,536,12370,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,6,59:2:0	0,18,153:6:0
+17	2006	.	C	<X>	0	.	DP=27;I16=16,10,0,0,968,37046,0,0,1560,93600,0,0,541,12605,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,6,73:2:0	0,18,166:6:0
+17	2007	.	A	<X>	0	.	DP=27;I16=16,11,0,0,1000,37396,0,0,1589,94441,0,0,556,12882,0,0;QS=3,0;MQSB=0.925036;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,6,76:2:0	0,21,193:7:0
+17	2008	.	C	<X>	0	.	DP=26;I16=16,10,0,0,964,36892,0,0,1529,90841,0,0,555,12833,0,0;QS=3,0;MQSB=0.914947;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,6,73:2:0	0,21,183:7:0
+17	2009	.	A	<X>	0	.	DP=26;I16=16,10,0,0,997,38955,0,0,1529,90841,0,0,554,12802,0,0;QS=3,0;MQSB=0.914947;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,6,74:2:0	0,21,210:7:0
+17	2010	.	G	<X>	0	.	DP=26;I16=16,9,0,0,936,36208,0,0,1500,90000,0,0,542,12640,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,6,73:2:0	0,18,169:6:0
+17	2011	.	C	<X>	0	.	DP=26;I16=16,9,0,0,966,37960,0,0,1500,90000,0,0,541,12617,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,6,74:2:0	0,18,175:6:0
+17	2012	.	A	<X>	0	.	DP=27;I16=16,11,0,0,956,35018,0,0,1589,94441,0,0,548,12676,0,0;QS=3,0;MQSB=0.925036;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,6,74:2:0	0,21,189:7:0
+17	2013	.	C	<X>	0	.	DP=27;I16=15,10,0,0,876,31370,0,0,1500,90000,0,0,514,11950,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,6,69:2:0	0,18,160:6:0
+17	2014	.	G	<X>	0	.	DP=27;I16=17,10,0,0,903,31239,0,0,1589,94441,0,0,545,12591,0,0;QS=3,0;MQSB=0.912952;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,9,80:3:0	0,18,160:6:0
+17	2015	.	T	<X>	0	.	DP=27;I16=17,10,0,0,999,37507,0,0,1589,94441,0,0,545,12577,0,0;QS=3,0;MQSB=0.912952;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,9,95:3:0	0,18,178:6:0
+17	2016	.	T	<X>	0	.	DP=27;I16=17,10,0,0,971,35649,0,0,1589,94441,0,0,545,12583,0,0;QS=3,0;MQSB=0.912952;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,9,93:3:0	0,18,178:6:0
+17	2017	.	G	<X>	0	.	DP=28;I16=17,11,0,0,1013,37849,0,0,1649,98041,0,0,545,12609,0,0;QS=3,0;MQSB=0.923174;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,9,91:3:0	0,18,172:6:0
+17	2018	.	C	<X>	0	.	DP=28;I16=17,11,0,0,1060,41414,0,0,1649,98041,0,0,546,12656,0,0;QS=3,0;MQSB=0.923174;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,9,97:3:0	0,18,169:6:0
+17	2019	.	T	<X>	0	.	DP=28;I16=17,11,0,0,1083,42253,0,0,1649,98041,0,0,547,12725,0,0;QS=3,0;MQSB=0.923174;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,9,106:3:0	0,18,187:6:0
+17	2020	.	G	<X>	0	.	DP=29;I16=18,11,0,0,1095,42063,0,0,1678,98882,0,0,548,12816,0,0;QS=3,0;MQSB=0.987702;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,9,85:3:0	0,18,175:6:0
+17	2021	.	C	<X>	0	.	DP=29;I16=18,11,0,0,1081,41535,0,0,1709,101641,0,0,551,12877,0,0;QS=3,0;MQSB=0.969907;MQ0F=0	PL:DP:DV	0,63,255:21:0	0,9,97:3:0	0,15,167:5:0
+17	2022	.	C	<X>	0	.	DP=30;I16=19,11,0,0,1115,42003,0,0,1769,105241,0,0,555,12907,0,0;QS=3,0;MQSB=0.972375;MQ0F=0	PL:DP:DV	0,63,255:21:0	0,9,92:3:0	0,18,177:6:0
+17	2023	.	A	<X>	0	.	DP=30;I16=19,10,0,0,1063,39991,0,0,1709,101641,0,0,549,12837,0,0;QS=3,0;MQSB=0.974027;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,9,96:3:0	0,18,186:6:0
+17	2024	.	G	<X>	0	.	DP=32;I16=20,12,0,0,1168,43872,0,0,1889,112441,0,0,564,12982,0,0;QS=3,0;MQSB=0.973096;MQ0F=0	PL:DP:DV	0,63,255:21:0	0,9,92:3:0	0,24,203:8:0
+17	2025	.	T	<X>	0	.	DP=32;I16=20,12,0,0,1150,42122,0,0,1889,112441,0,0,569,12981,0,0;QS=3,0;MQSB=0.973096;MQ0F=0	PL:DP:DV	0,63,255:21:0	0,9,87:3:0	0,24,226:8:0
+17	2026	.	T	<X>	0	.	DP=32;I16=20,12,0,0,1130,40724,0,0,1889,112441,0,0,572,12908,0,0;QS=3,0;MQSB=0.973096;MQ0F=0	PL:DP:DV	0,63,255:21:0	0,9,94:3:0	0,24,208:8:0
+17	2027	.	A	<X>	0	.	DP=32;I16=19,12,0,0,1121,40871,0,0,1829,108841,0,0,550,12240,0,0;QS=3,0;MQSB=0.970829;MQ0F=0	PL:DP:DV	0,63,255:21:0	0,9,84:3:0	0,21,207:7:0
+17	2028	.	C	<X>	0	.	DP=32;I16=20,12,0,0,1242,48548,0,0,1889,112441,0,0,577,12803,0,0;QS=3,0;MQSB=0.973096;MQ0F=0	PL:DP:DV	0,63,255:21:0	0,9,94:3:0	0,24,228:8:0
+17	2029	.	T	<X>	0	.	DP=32;I16=20,12,0,0,1229,47605,0,0,1889,112441,0,0,578,12724,0,0;QS=3,0;MQSB=0.973096;MQ0F=0	PL:DP:DV	0,63,255:21:0	0,9,102:3:0	0,24,236:8:0
+17	2030	.	G	<X>	0	.	DP=32;I16=20,12,0,0,1222,47140,0,0,1889,112441,0,0,579,12679,0,0;QS=3,0;MQSB=0.973096;MQ0F=0	PL:DP:DV	0,63,255:21:0	0,9,93:3:0	0,24,216:8:0
+17	2031	.	C	<X>	0	.	DP=31;I16=19,12,0,0,1150,43656,0,0,1829,108841,0,0,581,12667,0,0;QS=3,0;MQSB=0.970829;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,9,96:3:0	0,24,204:8:0
+17	2032	.	C	<X>	0	.	DP=31;I16=19,12,0,0,1157,44035,0,0,1829,108841,0,0,583,12687,0,0;QS=3,0;MQSB=0.970829;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,9,90:3:0	0,24,210:8:0
+17	2033	.	A	<X>	0	.	DP=30;I16=19,11,0,0,1091,40223,0,0,1769,105241,0,0,585,12689,0,0;QS=3,0;MQSB=0.972375;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,9,93:3:0	0,21,203:7:0
+17	2034	.	T	<X>	0	.	DP=30;I16=19,11,0,0,1104,41498,0,0,1769,105241,0,0,587,12723,0,0;QS=3,0;MQSB=0.972375;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,9,91:3:0	0,21,208:7:0
+17	2035	.	T	<X>	0	.	DP=29;I16=18,11,0,0,1084,41024,0,0,1709,101641,0,0,589,12739,0,0;QS=3,0;MQSB=0.969907;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,6,69:2:0	0,21,211:7:0
+17	2036	.	T	<X>	0	.	DP=29;I16=18,11,0,0,1080,40612,0,0,1709,101641,0,0,591,12787,0,0;QS=3,0;MQSB=0.969907;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,6,67:2:0	0,21,216:7:0
+17	2037	.	T	<X>	0	.	DP=29;I16=18,11,0,0,1082,40956,0,0,1709,101641,0,0,592,12818,0,0;QS=3,0;MQSB=0.969907;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,6,69:2:0	0,21,217:7:0
+17	2038	.	C	<X>	0	.	DP=29;I16=18,11,0,0,1117,43573,0,0,1709,101641,0,0,592,12832,0,0;QS=3,0;MQSB=0.969907;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,6,69:2:0	0,21,211:7:0
+17	2039	.	A	<X>	0	.	DP=29;I16=18,11,0,0,1067,39581,0,0,1709,101641,0,0,592,12878,0,0;QS=3,0;MQSB=0.969907;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,6,72:2:0	0,21,212:7:0
+17	2040	.	C	<X>	0	.	DP=29;I16=18,11,0,0,1077,40469,0,0,1709,101641,0,0,590,12856,0,0;QS=3,0;MQSB=0.969907;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,6,69:2:0	0,21,196:7:0
+17	2041	.	G	A,<X>	0	.	DP=31;I16=6,5,12,7,389,14023,721,28149,660,39600,1109,65641,235,5607,353,7259;QS=0.917304,2.0827,0;VDB=0.816435;SGB=-4.18892;RPB=0.88473;MQB=0.972375;MQSB=0.968257;BQB=0.311275;MQ0F=0	PL:DP:DV	229,0,212,255,245,255:21:11	32,0,24,35,27,59:2:1	223,21,0,223,21,223:7:7
+17	2042	.	G	<X>	0	.	DP=32;I16=18,14,0,0,1189,45617,0,0,1889,112441,0,0,588,12910,0,0;QS=3,0;MQSB=0.965264;MQ0F=0	PL:DP:DV	0,66,255:22:0	0,9,86:3:0	0,21,206:7:0
+17	2043	.	G	<X>	0	.	DP=32;I16=17,14,0,0,1115,41585,0,0,1829,108841,0,0,581,12891,0,0;QS=3,0;MQSB=0.962133;MQ0F=0	PL:DP:DV	0,63,255:21:0	0,9,90:3:0	0,21,197:7:0
+17	2044	.	C	<X>	0	.	DP=32;I16=18,14,0,0,1213,47029,0,0,1889,112441,0,0,588,13006,0,0;QS=3,0;MQSB=0.965264;MQ0F=0	PL:DP:DV	0,66,255:22:0	0,9,85:3:0	0,21,207:7:0
+17	2045	.	A	<X>	0	.	DP=32;I16=18,14,0,0,1181,44527,0,0,1889,112441,0,0,588,13108,0,0;QS=3,0;MQSB=0.965264;MQ0F=0	PL:DP:DV	0,66,255:22:0	0,9,83:3:0	0,21,213:7:0
+17	2046	.	T	<X>	0	.	DP=32;I16=18,14,0,0,1197,45135,0,0,1889,112441,0,0,587,13195,0,0;QS=3,0;MQSB=0.965264;MQ0F=0	PL:DP:DV	0,66,255:22:0	0,9,103:3:0	0,21,216:7:0
+17	2047	.	G	<X>	0	.	DP=34;I16=17,16,0,0,1248,47798,0,0,1949,116041,0,0,557,12491,0,0;QS=3,0;MQSB=0.959328;MQ0F=0	PL:DP:DV	0,72,255:24:0	0,9,88:3:0	0,18,195:6:0
+17	2048	.	A	<X>	0	.	DP=34;I16=18,16,0,0,1230,45184,0,0,2009,119641,0,0,578,13022,0,0;QS=3,0;MQSB=0.962621;MQ0F=0	PL:DP:DV	0,72,255:24:0	0,9,87:3:0	0,21,206:7:0
+17	2049	.	A	<X>	0	.	DP=33;I16=17,16,0,0,1207,44567,0,0,1949,116041,0,0,575,12963,0,0;QS=3,0;MQSB=0.959328;MQ0F=0	PL:DP:DV	0,72,255:24:0	0,6,74:2:0	0,21,208:7:0
+17	2050	.	A	<X>	0	.	DP=33;I16=16,16,0,0,1169,43313,0,0,1889,112441,0,0,545,12211,0,0;QS=3,0;MQSB=0.955563;MQ0F=0	PL:DP:DV	0,72,255:24:0	0,6,77:2:0	0,18,188:6:0
+17	2051	.	T	<X>	0	.	DP=31;I16=16,15,0,0,1134,42164,0,0,1829,108841,0,0,567,12737,0,0;QS=3,0;MQSB=0.957006;MQ0F=0	PL:DP:DV	0,69,255:23:0	0,6,69:2:0	0,18,170:6:0
+17	2052	.	G	<X>	0	.	DP=31;I16=16,15,0,0,1180,45546,0,0,1829,108841,0,0,564,12664,0,0;QS=3,0;MQSB=0.957006;MQ0F=0	PL:DP:DV	0,69,255:23:0	0,6,74:2:0	0,18,175:6:0
+17	2053	.	G	T,<X>	0	.	DP=31;I16=15,15,0,1,1126,42672,23,529,1769,105241,60,3600,537,11991,25,625;QS=2.97307,0.0269321,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.951229;BQB=1;MQ0F=0	PL:DP:DV	0,46,255,66,255,255:23:1	0,6,71,6,71,71:2:0	0,18,180,18,180,180:6:0
+17	2054	.	A	<X>	0	.	DP=30;I16=15,15,0,0,1123,43027,0,0,1769,105241,0,0,562,12592,0,0;QS=3,0;MQSB=0.952765;MQ0F=0	PL:DP:DV	0,66,255:22:0	0,6,78:2:0	0,18,171:6:0
+17	2055	.	G	<X>	0	.	DP=30;I16=15,15,0,0,1156,45206,0,0,1769,105241,0,0,562,12592,0,0;QS=3,0;MQSB=0.952765;MQ0F=0	PL:DP:DV	0,66,255:22:0	0,6,66:2:0	0,18,168:6:0
+17	2056	.	A	<X>	0	.	DP=30;I16=15,15,0,0,1124,42416,0,0,1769,105241,0,0,560,12518,0,0;QS=3,0;MQSB=0.952765;MQ0F=0	PL:DP:DV	0,66,255:22:0	0,6,71:2:0	0,18,179:6:0
+17	2057	.	T	<X>	0	.	DP=30;I16=15,15,0,0,1094,40082,0,0,1769,105241,0,0,556,12374,0,0;QS=3,0;MQSB=0.952765;MQ0F=0	PL:DP:DV	0,66,255:22:0	0,6,72:2:0	0,18,178:6:0
+17	2058	.	A	<X>	0	.	DP=29;I16=14,15,0,0,1035,37517,0,0,1709,101641,0,0,552,12212,0,0;QS=3,0;MQSB=0.947838;MQ0F=0	PL:DP:DV	0,63,255:21:0	0,6,57:2:0	0,18,179:6:0
+17	2059	.	A	<X>	0	.	DP=29;I16=14,15,0,0,1063,39615,0,0,1709,101641,0,0,548,12082,0,0;QS=3,0;MQSB=0.947838;MQ0F=0	PL:DP:DV	0,63,255:21:0	0,6,66:2:0	0,18,188:6:0
+17	2060	.	C	<X>	0	.	DP=28;I16=12,15,0,0,1015,39057,0,0,1589,94441,0,0,523,11499,0,0;QS=3,0;MQSB=0.935229;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,6,62:2:0	0,15,143:5:0
+17	2061	.	A	<X>	0	.	DP=27;I16=12,14,0,0,950,35084,0,0,1529,90841,0,0,501,11073,0,0;QS=3,0;MQSB=0.937241;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,3,41:1:0	0,15,163:5:0
+17	2062	.	A	<X>	0	.	DP=26;I16=11,15,0,0,973,37349,0,0,1529,90841,0,0,519,11425,0,0;QS=3,0;MQSB=0.927041;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,6,57:2:0	0,15,164:5:0
+17	2063	.	C	<X>	0	.	DP=26;I16=11,15,0,0,1017,40149,0,0,1529,90841,0,0,517,11405,0,0;QS=3,0;MQSB=0.927041;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,6,74:2:0	0,15,158:5:0
+17	2064	.	A	<X>	0	.	DP=26;I16=11,15,0,0,1002,38980,0,0,1529,90841,0,0,515,11413,0,0;QS=3,0;MQSB=0.927041;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,6,75:2:0	0,15,164:5:0
+17	2065	.	G	<X>	0	.	DP=26;I16=12,14,0,0,1030,41232,0,0,1529,90841,0,0,514,11448,0,0;QS=3,0;MQSB=0.937241;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,6,78:2:0	0,18,167:6:0
+17	2066	.	G	<X>	0	.	DP=26;I16=12,14,0,0,973,37055,0,0,1529,90841,0,0,514,11510,0,0;QS=3,0;MQSB=0.937241;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,6,75:2:0	0,18,152:6:0
+17	2067	.	A	<X>	0	.	DP=26;I16=12,14,0,0,1005,39095,0,0,1529,90841,0,0,512,11498,0,0;QS=3,0;MQSB=0.937241;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,6,69:2:0	0,18,187:6:0
+17	2068	.	G	<X>	0	.	DP=26;I16=12,14,0,0,993,39005,0,0,1529,90841,0,0,509,11459,0,0;QS=3,0;MQSB=0.937241;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,6,53:2:0	0,18,167:6:0
+17	2069	.	C	<X>	0	.	DP=26;I16=12,14,0,0,873,29879,0,0,1529,90841,0,0,506,11442,0,0;QS=3,0;MQSB=0.937241;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,6,59:2:0	0,18,156:6:0
+17	2070	.	G	<X>	0	.	DP=27;I16=13,14,0,0,932,33090,0,0,1589,94441,0,0,502,11398,0,0;QS=3,0;MQSB=0.94394;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,6,62:2:0	0,18,145:6:0
+17	2071	.	A	<X>	0	.	DP=27;I16=13,14,0,0,946,33884,0,0,1589,94441,0,0,498,11330,0,0;QS=3,0;MQSB=0.94394;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,6,53:2:0	0,18,177:6:0
+17	2072	.	C	<X>	0	.	DP=25;I16=13,12,0,0,897,32897,0,0,1469,87241,0,0,496,11288,0,0;QS=3,0;MQSB=0.948139;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,6,59:2:0	0,15,128:5:0
+17	2073	.	C	<X>	0	.	DP=26;I16=14,12,0,0,874,30184,0,0,1529,90841,0,0,492,11168,0,0;QS=3,0;MQSB=0.953497;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,6,53:2:0	0,15,133:5:0
+17	2074	.	G	<X>	0	.	DP=26;I16=13,12,0,0,835,29219,0,0,1469,87241,0,0,463,10395,0,0;QS=3,0;MQSB=0.948139;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,6,67:2:0	0,12,83:4:0
+17	2075	.	C	<X>	0	.	DP=27;I16=15,12,0,0,989,37027,0,0,1589,94441,0,0,484,10896,0,0;QS=3,0;MQSB=0.958048;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,6,69:2:0	0,15,115:5:0
+17	2076	.	A	<X>	0	.	DP=27;I16=14,12,0,0,929,33551,0,0,1529,90841,0,0,470,10676,0,0;QS=3,0;MQSB=0.953497;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,6,76:2:0	0,12,114:4:0
+17	2077	.	C	<X>	0	.	DP=27;I16=15,12,0,0,990,37252,0,0,1589,94441,0,0,478,10724,0,0;QS=3,0;MQSB=0.958048;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,6,65:2:0	0,15,125:5:0
+17	2078	.	A	<X>	0	.	DP=27;I16=15,12,0,0,1023,39089,0,0,1589,94441,0,0,475,10677,0,0;QS=3,0;MQSB=0.958048;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,6,72:2:0	0,15,148:5:0
+17	2079	.	G	<X>	0	.	DP=28;I16=15,13,0,0,1042,39694,0,0,1649,98041,0,0,471,10605,0,0;QS=3,0;MQSB=0.956162;MQ0F=0	PL:DP:DV	0,63,255:21:0	0,6,72:2:0	0,15,133:5:0
+17	2080	.	G	<X>	0	.	DP=28;I16=14,13,0,0,968,35328,0,0,1589,94441,0,0,453,10333,0,0;QS=3,0;MQSB=0.951472;MQ0F=0	PL:DP:DV	0,63,255:21:0	0,6,67:2:0	0,12,108:4:0
+17	2081	.	C	<X>	0	.	DP=26;I16=14,12,0,0,937,35303,0,0,1529,90841,0,0,467,10535,0,0;QS=3,0;MQSB=0.953497;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,6,63:2:0	0,15,110:5:0
+17	2082	.	T	<X>	0	.	DP=24;I16=12,12,0,0,901,34287,0,0,1409,83641,0,0,468,10532,0,0;QS=3,0;MQSB=0.941765;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,6,71:2:0	0,12,112:4:0
+17	2083	.	G	<X>	0	.	DP=24;I16=12,12,0,0,887,33597,0,0,1409,83641,0,0,469,10547,0,0;QS=3,0;MQSB=0.941765;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,6,68:2:0	0,12,113:4:0
+17	2084	.	C	<X>	0	.	DP=25;I16=13,12,0,0,938,35868,0,0,1469,87241,0,0,470,10580,0,0;QS=3,0;MQSB=0.948139;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,6,61:2:0	0,12,115:4:0
+17	2085	.	T	<X>	0	.	DP=25;I16=13,12,0,0,932,35282,0,0,1469,87241,0,0,472,10632,0,0;QS=3,0;MQSB=0.948139;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,6,64:2:0	0,12,130:4:0
+17	2086	.	G	<X>	0	.	DP=25;I16=13,12,0,0,932,35400,0,0,1469,87241,0,0,474,10704,0,0;QS=3,0;MQSB=0.948139;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,6,61:2:0	0,12,129:4:0
+17	2087	.	A	<X>	0	.	DP=24;I16=12,12,0,0,903,34391,0,0,1409,83641,0,0,476,10746,0,0;QS=3,0;MQSB=0.941765;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,6,66:2:0	0,12,126:4:0
+17	2088	.	G	<X>	0	.	DP=24;I16=12,12,0,0,880,33116,0,0,1409,83641,0,0,478,10808,0,0;QS=3,0;MQSB=0.941765;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,6,70:2:0	0,12,121:4:0
+17	2089	.	C	<X>	0	.	DP=25;I16=13,12,0,0,817,27419,0,0,1469,87241,0,0,480,10890,0,0;QS=3,0;MQSB=0.948139;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,6,64:2:0	0,15,138:5:0
+17	2090	.	G	<X>	0	.	DP=25;I16=12,12,0,0,802,27940,0,0,1409,83641,0,0,457,10319,0,0;QS=3,0;MQSB=0.941765;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,6,63:2:0	0,12,99:4:0
+17	2091	.	C	<X>	0	.	DP=25;I16=12,12,0,0,800,27346,0,0,1440,86400,0,0,458,10346,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,6,61:2:0	0,15,125:5:0
+17	2092	.	G	<X>	0	.	DP=26;I16=13,12,0,0,838,29188,0,0,1469,87241,0,0,461,10487,0,0;QS=3,0;MQSB=0.948139;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,6,64:2:0	0,18,133:6:0
+17	2093	.	T	G,<X>	0	.	DP=26;I16=13,12,1,0,905,33415,17,289,1500,90000,29,841,459,10371,25,625;QS=2.97424,0.0257576,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.953497;BQB=1;MQ0F=0	PL:DP:DV	0,36,255,51,255,255:18:1	0,6,67,6,67,67:2:0	0,18,153,18,153,153:6:0
+17	2094	.	C	<X>	0	.	DP=26;I16=14,12,0,0,949,35501,0,0,1529,90841,0,0,485,11047,0,0;QS=3,0;MQSB=0.953497;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,6,69:2:0	0,18,142:6:0
+17	2095	.	A	<X>	0	.	DP=25;I16=14,11,0,0,879,31219,0,0,1469,87241,0,0,487,11123,0,0;QS=3,0;MQSB=0.955682;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,6,72:2:0	0,18,154:6:0
+17	2096	.	C	<X>	0	.	DP=24;I16=13,11,0,0,878,32734,0,0,1409,83641,0,0,487,11073,0,0;QS=3,0;MQSB=0.950498;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,65:2:0	0,18,161:6:0
+17	2097	.	A	<X>	0	.	DP=24;I16=13,11,0,0,849,30671,0,0,1409,83641,0,0,487,11047,0,0;QS=3,0;MQSB=0.950498;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,56:2:0	0,18,172:6:0
+17	2098	.	C	<X>	0	.	DP=24;I16=13,11,0,0,781,26113,0,0,1409,83641,0,0,486,10996,0,0;QS=3,0;MQSB=0.950498;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,58:2:0	0,18,139:6:0
+17	2099	.	G	<X>	0	.	DP=23;I16=12,10,0,0,719,25109,0,0,1289,76441,0,0,460,10294,0,0;QS=3,0;MQSB=0.947103;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,3,24:1:0	0,18,129:6:0
+17	2100	.	C	<X>	0	.	DP=25;I16=13,11,0,0,873,32759,0,0,1409,83641,0,0,457,10141,0,0;QS=3,0;MQSB=0.950498;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,9,87:3:0	0,18,160:6:0
+17	2101	.	A	<X>	0	.	DP=25;I16=12,12,0,0,907,34671,0,0,1440,86400,0,0,455,9965,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,135:4:0	0,18,161:6:0
+17	2102	.	G	<X>	0	.	DP=25;I16=13,12,0,0,930,35596,0,0,1469,87241,0,0,478,10442,0,0;QS=3,0;MQSB=0.948139;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,12,118:4:0	0,18,151:6:0
+17	2103	.	C	<X>	0	.	DP=25;I16=11,12,0,0,842,31630,0,0,1380,82800,0,0,432,9336,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,106:4:0	0,15,146:5:0
+17	2104	.	C	<X>	0	.	DP=24;I16=12,12,0,0,869,32463,0,0,1409,83641,0,0,454,9810,0,0;QS=3,0;MQSB=0.941765;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,12,126:4:0	0,15,147:5:0
+17	2105	.	A	<X>	0	.	DP=25;I16=11,12,0,0,836,30696,0,0,1380,82800,0,0,429,9201,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,138:4:0	0,15,130:5:0
+17	2106	.	T	<X>	0	.	DP=25;I16=12,13,0,0,897,33087,0,0,1469,87241,0,0,473,10211,0,0;QS=3,0;MQSB=0.939413;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,12,129:4:0	0,15,146:5:0
+17	2107	.	C	<X>	0	.	DP=25;I16=11,12,0,0,783,27185,0,0,1380,82800,0,0,425,9113,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,9,100:3:0	0,15,133:5:0
+17	2108	.	G	<X>	0	.	DP=25;I16=11,13,0,0,829,29703,0,0,1440,86400,0,0,448,9730,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,12,122:4:0	0,15,111:5:0
+17	2109	.	C	<X>	0	.	DP=25;I16=11,13,0,0,781,26717,0,0,1440,86400,0,0,446,9746,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,12,109:4:0	0,15,125:5:0
+17	2110	.	G	<X>	0	.	DP=25;I16=12,12,0,0,804,28134,0,0,1440,86400,0,0,418,9110,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,92:3:0	0,15,117:5:0
+17	2111	.	C	<X>	0	.	DP=25;I16=12,13,0,0,925,35081,0,0,1500,90000,0,0,441,9747,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,12,134:4:0	0,15,140:5:0
+17	2112	.	A	<X>	0	.	DP=24;I16=12,12,0,0,885,33445,0,0,1440,86400,0,0,440,9782,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,12,129:4:0	0,15,140:5:0
+17	2113	.	G	<X>	0	.	DP=24;I16=12,12,0,0,871,32641,0,0,1440,86400,0,0,439,9839,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,12,128:4:0	0,15,134:5:0
+17	2114	.	C	<X>	0	.	DP=24;I16=12,11,0,0,844,32052,0,0,1380,82800,0,0,413,9293,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,9,103:3:0	0,15,126:5:0
+17	2115	.	T	<X>	0	.	DP=23;I16=11,11,0,0,821,30869,0,0,1320,79200,0,0,412,9342,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,6,78:2:0	0,15,143:5:0
+17	2116	.	C	<X>	0	.	DP=23;I16=11,12,0,0,890,34892,0,0,1380,82800,0,0,435,9985,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,9,102:3:0	0,15,152:5:0
+17	2117	.	A	<X>	0	.	DP=23;I16=11,11,0,0,833,32121,0,0,1320,79200,0,0,432,9924,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,9,118:3:0	0,15,156:5:0
+17	2118	.	G	<X>	0	.	DP=23;I16=12,11,0,0,842,31502,0,0,1380,82800,0,0,429,9835,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,125:4:0	0,15,147:5:0
+17	2119	.	G	<X>	0	.	DP=23;I16=12,11,0,0,823,30553,0,0,1380,82800,0,0,426,9768,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,135:4:0	0,15,137:5:0
+17	2120	.	G	<X>	0	.	DP=24;I16=13,11,0,0,864,32028,0,0,1440,86400,0,0,423,9723,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,12,137:4:0	0,15,140:5:0
+17	2121	.	A	<X>	0	.	DP=22;I16=11,10,0,0,734,26712,0,0,1260,75600,0,0,398,9074,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,135:4:0	0,12,122:4:0
+17	2122	.	T	<X>	0	.	DP=22;I16=11,10,0,0,752,27278,0,0,1260,75600,0,0,396,8972,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,136:4:0	0,12,123:4:0
+17	2123	.	A	<X>	0	.	DP=22;I16=12,10,0,0,758,27024,0,0,1320,79200,0,0,419,9519,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,120:4:0	0,15,137:5:0
+17	2124	.	T	<X>	0	.	DP=22;I16=12,10,0,0,789,28741,0,0,1320,79200,0,0,417,9465,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,128:4:0	0,15,136:5:0
+17	2125	.	T	<X>	0	.	DP=20;I16=11,8,0,0,696,25704,0,0,1140,68400,0,0,401,9177,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,9,106:3:0	0,9,93:3:0
+17	2126	.	A	<X>	0	.	DP=20;I16=11,9,0,0,717,25979,0,0,1200,72000,0,0,415,9319,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,133:4:0	0,9,95:3:0
+17	2127	.	C	<X>	0	.	DP=21;I16=11,10,0,0,706,24426,0,0,1260,75600,0,0,413,9221,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,107:4:0	0,9,95:3:0
+17	2128	.	G	<X>	0	.	DP=21;I16=11,10,0,0,677,22633,0,0,1260,75600,0,0,411,9091,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,116:4:0	0,9,72:3:0
+17	2129	.	T	<X>	0	.	DP=21;I16=11,10,0,0,782,29386,0,0,1260,75600,0,0,409,8981,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,140:4:0	0,9,83:3:0
+17	2130	.	G	<X>	0	.	DP=21;I16=11,10,0,0,766,28562,0,0,1260,75600,0,0,407,8891,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,135:4:0	0,9,87:3:0
+17	2131	.	T	<X>	0	.	DP=21;I16=11,10,0,0,732,26216,0,0,1260,75600,0,0,405,8821,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,136:4:0	0,9,79:3:0
+17	2132	.	A	<X>	0	.	DP=21;I16=11,10,0,0,743,26733,0,0,1260,75600,0,0,403,8771,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,135:4:0	0,9,88:3:0
+17	2133	.	A	<X>	0	.	DP=21;I16=11,10,0,0,787,29651,0,0,1260,75600,0,0,401,8741,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,141:4:0	0,9,96:3:0
+17	2134	.	C	<X>	0	.	DP=21;I16=11,10,0,0,804,31100,0,0,1260,75600,0,0,399,8731,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,138:4:0	0,9,86:3:0
+17	2135	.	T	<X>	0	.	DP=22;I16=11,11,0,0,831,32197,0,0,1320,79200,0,0,397,8741,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,153:4:0	0,12,119:4:0
+17	2136	.	C	<X>	0	.	DP=22;I16=11,11,0,0,760,26892,0,0,1320,79200,0,0,395,8721,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,124:4:0	0,12,127:4:0
+17	2137	.	G	<X>	0	.	DP=22;I16=11,11,0,0,745,26047,0,0,1320,79200,0,0,393,8721,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,121:4:0	0,12,102:4:0
+17	2138	.	A	<X>	0	.	DP=22;I16=11,11,0,0,816,30934,0,0,1320,79200,0,0,391,8741,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,128:4:0	0,12,139:4:0
+17	2139	.	C	<X>	0	.	DP=22;I16=11,11,0,0,839,32237,0,0,1320,79200,0,0,389,8781,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,138:4:0	0,12,125:4:0
+17	2140	.	A	<X>	0	.	DP=22;I16=11,11,0,0,826,31300,0,0,1320,79200,0,0,387,8841,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,140:4:0	0,12,138:4:0
+17	2141	.	T	<X>	0	.	DP=21;I16=11,10,0,0,792,30156,0,0,1260,75600,0,0,385,8871,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,137:4:0	0,12,137:4:0
+17	2142	.	G	<X>	0	.	DP=19;I16=11,8,0,0,724,27784,0,0,1140,68400,0,0,385,8919,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,9,113:3:0	0,12,129:4:0
+17	2143	.	T	<X>	0	.	DP=19;I16=11,8,0,0,650,23454,0,0,1140,68400,0,0,384,8932,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,9,113:3:0	0,12,120:4:0
+17	2144	.	C	<X>	0	.	DP=19;I16=11,8,0,0,739,29003,0,0,1140,68400,0,0,383,8959,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,9,108:3:0	0,12,125:4:0
+17	2145	.	A	<X>	0	.	DP=20;I16=12,8,0,0,760,29304,0,0,1200,72000,0,0,381,8951,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,133:4:0	0,12,139:4:0
+17	2146	.	G	<X>	0	.	DP=20;I16=12,8,0,0,745,28105,0,0,1200,72000,0,0,379,8909,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,139:4:0	0,12,127:4:0
+17	2147	.	C	<X>	0	.	DP=20;I16=13,6,0,0,674,24296,0,0,1140,68400,0,0,379,8881,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,127:4:0	0,12,130:4:0
+17	2148	.	G	<X>	0	.	DP=20;I16=12,7,0,0,630,21274,0,0,1140,68400,0,0,365,8537,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,250:11:0	0,12,112:4:0	0,12,120:4:0
+17	2149	.	A	<X>	0	.	DP=20;I16=12,7,0,0,702,26212,0,0,1140,68400,0,0,367,8529,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,138:4:0	0,12,127:4:0
+17	2150	.	T	<X>	0	.	DP=20;I16=13,7,0,0,675,23943,0,0,1200,72000,0,0,383,8713,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,247:11:0	0,12,138:4:0	0,15,139:5:0
+17	2151	.	T	<X>	0	.	DP=20;I16=13,7,0,0,690,24274,0,0,1200,72000,0,0,383,8661,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,251:11:0	0,12,133:4:0	0,15,142:5:0
+17	2152	.	G	<X>	0	.	DP=20;I16=13,7,0,0,693,24713,0,0,1200,72000,0,0,383,8629,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,131:4:0	0,15,146:5:0
+17	2153	.	T	<X>	0	.	DP=19;I16=13,6,0,0,671,24571,0,0,1140,68400,0,0,383,8565,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,230:10:0	0,12,134:4:0	0,15,162:5:0
+17	2154	.	C	<X>	0	.	DP=19;I16=13,6,0,0,703,26955,0,0,1140,68400,0,0,382,8468,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,251:10:0	0,12,131:4:0	0,15,159:5:0
+17	2155	.	A	<X>	0	.	DP=19;I16=13,6,0,0,693,25727,0,0,1140,68400,0,0,381,8389,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,245:10:0	0,12,135:4:0	0,15,156:5:0
+17	2156	.	C	<X>	0	.	DP=19;I16=13,6,0,0,702,26214,0,0,1140,68400,0,0,380,8328,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,12,125:4:0	0,15,154:5:0
+17	2157	.	A	<X>	0	.	DP=19;I16=13,6,0,0,722,28058,0,0,1140,68400,0,0,379,8285,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,250:10:0	0,12,141:4:0	0,15,173:5:0
+17	2158	.	G	<X>	0	.	DP=19;I16=13,6,0,0,713,27567,0,0,1140,68400,0,0,378,8260,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,12,136:4:0	0,15,144:5:0
+17	2159	.	G	<X>	0	.	DP=19;I16=12,6,0,0,662,24744,0,0,1080,64800,0,0,366,8104,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,247:9:0	0,12,126:4:0	0,15,153:5:0
+17	2160	.	C	<X>	0	.	DP=19;I16=12,6,0,0,651,24005,0,0,1080,64800,0,0,364,8038,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,244:9:0	0,12,119:4:0	0,15,154:5:0
+17	2161	.	A	<X>	0	.	DP=19;I16=13,6,0,0,695,25883,0,0,1140,68400,0,0,369,8005,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,248:10:0	0,12,121:4:0	0,15,164:5:0
+17	2162	.	C	<X>	0	.	DP=20;I16=13,7,0,0,742,27834,0,0,1200,72000,0,0,365,7911,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,127:4:0	0,15,155:5:0
+17	2163	.	T	<X>	0	.	DP=20;I16=13,7,0,0,763,29517,0,0,1200,72000,0,0,362,7838,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,131:4:0	0,15,175:5:0
+17	2164	.	G	<X>	0	.	DP=20;I16=13,7,0,0,715,26301,0,0,1200,72000,0,0,359,7787,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,116:4:0	0,15,156:5:0
+17	2165	.	C	<X>	0	.	DP=20;I16=13,7,0,0,753,28781,0,0,1200,72000,0,0,355,7709,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,136:4:0	0,15,151:5:0
+17	2166	.	T	<X>	0	.	DP=19;I16=12,7,0,0,711,27211,0,0,1140,68400,0,0,352,7654,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,142:4:0	0,12,140:4:0
+17	2167	.	A	<X>	0	.	DP=19;I16=12,6,0,0,650,23760,0,0,1080,64800,0,0,327,7137,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,254:11:0	0,12,133:4:0	0,9,111:3:0
+17	2168	.	C	<X>	0	.	DP=19;I16=12,7,0,0,685,25039,0,0,1140,68400,0,0,345,7561,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,130:4:0	0,12,124:4:0
+17	2169	.	T	<X>	0	.	DP=19;I16=12,7,0,0,702,26940,0,0,1140,68400,0,0,341,7525,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,140:4:0	0,12,142:4:0
+17	2170	.	C	<X>	0	.	DP=18;I16=11,7,0,0,665,24861,0,0,1080,64800,0,0,338,7512,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,12,132:4:0	0,12,135:4:0
+17	2171	.	C	<X>	0	.	DP=20;I16=11,9,0,0,750,28368,0,0,1200,72000,0,0,333,7419,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,136:4:0	0,12,138:4:0
+17	2172	.	T	<X>	0	.	DP=20;I16=11,9,0,0,732,27540,0,0,1200,72000,0,0,330,7346,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,149:4:0	0,12,147:4:0
+17	2173	.	G	<X>	0	.	DP=19;I16=10,9,0,0,704,26534,0,0,1140,68400,0,0,327,7243,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,142:4:0	0,12,133:4:0
+17	2174	.	G	<X>	0	.	DP=19;I16=10,9,0,0,674,24372,0,0,1140,68400,0,0,324,7158,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,126:4:0	0,12,129:4:0
+17	2175	.	G	<X>	0	.	DP=18;I16=9,9,0,0,639,23059,0,0,1080,64800,0,0,322,7090,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,12,123:4:0	0,12,126:4:0
+17	2176	.	G	<X>	0	.	DP=18;I16=9,9,0,0,621,21815,0,0,1080,64800,0,0,318,6940,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,247:10:0	0,12,121:4:0	0,12,123:4:0
+17	2177	.	T	<X>	0	.	DP=18;I16=9,9,0,0,547,18051,0,0,1080,64800,0,0,314,6810,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,239:10:0	0,12,83:4:0	0,12,108:4:0
+17	2178	.	T	<X>	0	.	DP=18;I16=9,9,0,0,579,19659,0,0,1080,64800,0,0,310,6700,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,234:10:0	0,12,110:4:0	0,12,118:4:0
+17	2179	.	T	<X>	0	.	DP=18;I16=9,9,0,0,591,20403,0,0,1080,64800,0,0,307,6609,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,239:10:0	0,12,97:4:0	0,12,135:4:0
+17	2180	.	T	<X>	0	.	DP=18;I16=9,9,0,0,616,21524,0,0,1080,64800,0,0,305,6537,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,236:10:0	0,12,122:4:0	0,12,133:4:0
+17	2181	.	C	<X>	0	.	DP=18;I16=9,8,0,0,611,22485,0,0,1020,61200,0,0,293,6385,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,224:9:0	0,12,129:4:0	0,12,150:4:0
+17	2182	.	C	<X>	0	.	DP=18;I16=9,9,0,0,665,24877,0,0,1080,64800,0,0,301,6453,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,12,125:4:0	0,12,145:4:0
+17	2183	.	A	<X>	0	.	DP=18;I16=9,9,0,0,646,23624,0,0,1080,64800,0,0,299,6441,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,247:10:0	0,12,123:4:0	0,12,144:4:0
+17	2184	.	T	<X>	0	.	DP=17;I16=8,9,0,0,610,22250,0,0,1020,61200,0,0,298,6448,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,224:9:0	0,12,134:4:0	0,12,136:4:0
+17	2185	.	C	<X>	0	.	DP=16;I16=8,8,0,0,569,20761,0,0,960,57600,0,0,297,6423,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,211:8:0	0,12,128:4:0	0,12,137:4:0
+17	2186	.	A	<X>	0	.	DP=16;I16=8,8,0,0,576,21314,0,0,960,57600,0,0,296,6416,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,204:8:0	0,12,134:4:0	0,12,145:4:0
+17	2187	.	A	<X>	0	.	DP=16;I16=8,8,0,0,562,20396,0,0,960,57600,0,0,295,6427,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,201:8:0	0,12,136:4:0	0,12,135:4:0
+17	2188	.	A	<X>	0	.	DP=17;I16=9,8,0,0,569,19925,0,0,1020,61200,0,0,293,6405,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,214:9:0	0,12,133:4:0	0,12,123:4:0
+17	2189	.	C	<X>	0	.	DP=19;I16=9,10,0,0,645,22647,0,0,1097,65089,0,0,292,6400,0,0;QS=3,0;MQSB=0.934728;MQ0F=0	PL:DP:DV	0,30,230:10:0	0,12,133:4:0	0,15,142:5:0
+17	2190	.	C	<X>	0	.	DP=19;I16=9,10,0,0,604,20072,0,0,1097,65089,0,0,294,6414,0,0;QS=3,0;MQSB=0.934728;MQ0F=0	PL:DP:DV	0,33,238:11:0	0,12,119:4:0	0,12,107:4:0
+17	2191	.	C	<X>	0	.	DP=19;I16=9,10,0,0,647,23007,0,0,1097,65089,0,0,297,6449,0,0;QS=3,0;MQSB=0.934728;MQ0F=0	PL:DP:DV	0,33,251:11:0	0,12,129:4:0	0,12,119:4:0
+17	2192	.	T	<X>	0	.	DP=19;I16=9,10,0,0,659,23723,0,0,1097,65089,0,0,300,6506,0,0;QS=3,0;MQSB=0.934728;MQ0F=0	PL:DP:DV	0,33,253:11:0	0,12,136:4:0	0,12,120:4:0
+17	2193	.	C	<X>	0	.	DP=18;I16=8,10,0,0,642,23934,0,0,1037,61489,0,0,303,6535,0,0;QS=3,0;MQSB=0.938795;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,128:4:0	0,9,87:3:0
+17	2194	.	A	<X>	0	.	DP=18;I16=8,9,0,0,617,22683,0,0,1020,61200,0,0,301,6561,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,247:10:0	0,12,134:4:0	0,9,98:3:0
+17	2195	.	A	<X>	0	.	DP=18;I16=8,10,0,0,635,23271,0,0,1037,61489,0,0,309,6659,0,0;QS=3,0;MQSB=0.938795;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,128:4:0	0,9,101:3:0
+17	2196	.	G	<X>	0	.	DP=19;I16=8,11,0,0,703,26383,0,0,1097,65089,0,0,312,6754,0,0;QS=3,0;MQSB=0.946915;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,117:4:0	0,12,120:4:0
+17	2197	.	A	<X>	0	.	DP=19;I16=8,11,0,0,735,28599,0,0,1097,65089,0,0,314,6770,0,0;QS=3,0;MQSB=0.946915;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,141:4:0	0,12,125:4:0
+17	2198	.	G	<X>	0	.	DP=19;I16=8,10,0,0,650,24206,0,0,1080,64800,0,0,307,6725,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,12,129:4:0	0,12,107:4:0
+17	2199	.	C	<X>	0	.	DP=19;I16=8,11,0,0,701,26735,0,0,1097,65089,0,0,318,6862,0,0;QS=3,0;MQSB=0.946915;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,128:4:0	0,12,116:4:0
+17	2200	.	T	<X>	0	.	DP=19;I16=8,11,0,0,710,26768,0,0,1097,65089,0,0,320,6938,0,0;QS=3,0;MQSB=0.946915;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,129:4:0	0,12,114:4:0
+17	2201	.	G	<X>	0	.	DP=17;I16=7,10,0,0,628,23764,0,0,977,57889,0,0,324,7032,0,0;QS=3,0;MQSB=0.943335;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,6,66:2:0	0,12,119:4:0
+17	2202	.	G	<X>	0	.	DP=17;I16=7,10,0,0,557,19249,0,0,977,57889,0,0,327,7093,0,0;QS=3,0;MQSB=0.943335;MQ0F=0	PL:DP:DV	0,33,245:11:0	0,6,57:2:0	0,12,115:4:0
+17	2203	.	G	<X>	0	.	DP=17;I16=7,10,0,0,588,21184,0,0,977,57889,0,0,329,7123,0,0;QS=3,0;MQSB=0.943335;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,6,47:2:0	0,12,116:4:0
+17	2204	.	C	<X>	0	.	DP=17;I16=7,10,0,0,538,18568,0,0,977,57889,0,0,331,7173,0,0;QS=3,0;MQSB=0.943335;MQ0F=0	PL:DP:DV	0,33,246:11:0	0,6,61:2:0	0,12,99:4:0
+17	2205	.	C	<X>	0	.	DP=18;I16=7,11,0,0,628,22918,0,0,1037,61489,0,0,332,7192,0,0;QS=3,0;MQSB=0.951002;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,6,68:2:0	0,12,109:4:0
+17	2206	.	T	<X>	0	.	DP=19;I16=7,12,0,0,677,25237,0,0,1097,65089,0,0,334,7230,0,0;QS=3,0;MQSB=0.957193;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,6,77:2:0	0,12,115:4:0
+17	2207	.	G	<X>	0	.	DP=19;I16=7,11,0,0,663,24717,0,0,1080,64800,0,0,319,6965,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,6,67:2:0	0,12,110:4:0
+17	2208	.	G	<X>	0	.	DP=21;I16=7,14,0,0,726,26038,0,0,1217,72289,0,0,340,7370,0,0;QS=3,0;MQSB=0.966484;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,110:4:0	0,12,122:4:0
+17	2209	.	G	<X>	0	.	DP=22;I16=8,13,0,0,715,25133,0,0,1237,73369,0,0,325,7075,0,0;QS=3,0;MQSB=0.895122;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,128:5:0	0,12,117:4:0
+17	2210	.	G	C,<X>	0	.	DP=21;I16=7,13,0,1,648,22186,25,625,1177,69769,17,289,331,7165,21,441;QS=2.95442,0.0455764,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.975265;BQB=1;MQ0F=0	PL:DP:DV	0,19,234,33,237,241:12:1	0,15,127,15,127,127:5:0	0,12,113,12,113,113:4:0
+17	2211	.	T	<X>	0	.	DP=21;I16=7,13,0,0,724,27000,0,0,1177,69769,0,0,336,7230,0,0;QS=3,0;MQSB=0.875769;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,141:5:0	0,12,124:4:0
+17	2212	.	C	<X>	0	.	DP=22;I16=8,14,0,0,791,29201,0,0,1254,73658,0,0,364,7850,0,0;QS=3,0;MQSB=0.985548;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,148:5:0	0,12,111:4:0
+17	2213	.	A	<X>	0	.	DP=22;I16=8,14,0,0,767,27327,0,0,1254,73658,0,0,371,8015,0,0;QS=3,0;MQSB=0.985548;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,153:5:0	0,12,112:4:0
+17	2214	.	A	<X>	0	.	DP=22;I16=8,14,0,0,756,26836,0,0,1254,73658,0,0,377,8159,0,0;QS=3,0;MQSB=0.985548;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,153:5:0	0,12,117:4:0
+17	2215	.	C	<X>	0	.	DP=22;I16=8,14,0,0,815,31121,0,0,1254,73658,0,0,381,8229,0,0;QS=3,0;MQSB=0.985548;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,162:5:0	0,12,124:4:0
+17	2216	.	T	<X>	0	.	DP=22;I16=8,14,0,0,815,31233,0,0,1254,73658,0,0,384,8272,0,0;QS=3,0;MQSB=0.985548;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,166:5:0	0,12,124:4:0
+17	2217	.	T	<X>	0	.	DP=22;I16=8,13,0,0,741,26855,0,0,1237,73369,0,0,362,7712,0,0;QS=3,0;MQSB=0.895122;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,155:5:0	0,12,118:4:0
+17	2218	.	C	<X>	0	.	DP=21;I16=7,14,0,0,753,27973,0,0,1194,70058,0,0,391,8423,0,0;QS=3,0;MQSB=0.975265;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,138:4:0	0,12,119:4:0
+17	2219	.	C	<X>	0	.	DP=21;I16=7,13,0,0,757,29125,0,0,1177,69769,0,0,370,7904,0,0;QS=3,0;MQSB=0.875769;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,141:4:0	0,12,122:4:0
+17	2220	.	G	A,<X>	0	.	DP=21;I16=6,2,1,11,256,8364,474,19128,457,26569,720,43200,141,2959,233,5071;QS=0.886504,2.1135,0;VDB=0.532753;SGB=-3.51597;RPB=0.964198;MQB=0.898397;MQSB=0.875769;BQB=0.0354359;MQ0F=0	PL:DP:DV	139,0,130,157,148,255:12:6	69,0,46,75,52,119:4:2	131,12,0,131,12,131:4:4
+17	2221	.	G	<X>	0	.	DP=21;I16=7,13,0,0,738,27922,0,0,1177,69769,0,0,376,8078,0,0;QS=3,0;MQSB=0.875769;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,132:4:0	0,12,120:4:0
+17	2222	.	C	<X>	0	.	DP=21;I16=7,14,0,0,746,28098,0,0,1194,70058,0,0,401,8675,0,0;QS=3,0;MQSB=0.975265;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,135:4:0	0,12,107:4:0
+17	2223	.	C	<X>	0	.	DP=21;I16=7,14,0,0,796,30632,0,0,1194,70058,0,0,401,8671,0,0;QS=3,0;MQSB=0.975265;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,135:4:0	0,12,122:4:0
+17	2224	.	T	<X>	0	.	DP=21;I16=7,14,0,0,811,31599,0,0,1194,70058,0,0,401,8691,0,0;QS=3,0;MQSB=0.975265;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,144:4:0	0,12,123:4:0
+17	2225	.	G	<X>	0	.	DP=21;I16=7,14,0,0,778,29396,0,0,1194,70058,0,0,401,8735,0,0;QS=3,0;MQSB=0.975265;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,133:4:0	0,12,121:4:0
+17	2226	.	G	<X>	0	.	DP=21;I16=7,14,0,0,727,26485,0,0,1194,70058,0,0,401,8803,0,0;QS=3,0;MQSB=0.975265;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,128:4:0	0,12,113:4:0
+17	2227	.	G	<X>	0	.	DP=20;I16=7,12,0,0,663,23985,0,0,1117,66169,0,0,377,8269,0,0;QS=3,0;MQSB=0.879351;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,123:4:0	0,12,114:4:0
+17	2228	.	G	C,<X>	0	.	DP=19;I16=5,12,0,1,643,24791,16,256,1020,61200,17,289,360,8020,25,625;QS=2.9603,0.0397022,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.970092;BQB=1;MQ0F=0	PL:DP:DV	0,17,255,30,255,255:11:1	0,9,95,9,95,95:3:0	0,12,121,12,121,121:4:0
+17	2229	.	A	<X>	0	.	DP=20;I16=6,14,0,0,757,28857,0,0,1134,66458,0,0,406,9138,0,0;QS=3,0;MQSB=0.959189;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,138:4:0	0,12,122:4:0
+17	2230	.	A	<X>	0	.	DP=20;I16=6,14,0,0,729,26985,0,0,1134,66458,0,0,409,9291,0,0;QS=3,0;MQSB=0.959189;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,141:4:0	0,12,119:4:0
+17	2231	.	A	<X>	0	.	DP=20;I16=6,13,0,0,712,26990,0,0,1117,66169,0,0,386,8790,0,0;QS=3,0;MQSB=0.850016;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,144:4:0	0,12,124:4:0
+17	2232	.	C	<X>	0	.	DP=20;I16=6,14,0,0,751,28657,0,0,1134,66458,0,0,412,9508,0,0;QS=3,0;MQSB=0.959189;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,130:4:0	0,12,107:4:0
+17	2233	.	T	<X>	0	.	DP=20;I16=6,14,0,0,774,30432,0,0,1134,66458,0,0,413,9619,0,0;QS=3,0;MQSB=0.959189;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,150:4:0	0,12,117:4:0
+17	2234	.	G	<X>	0	.	DP=20;I16=6,14,0,0,719,26621,0,0,1134,66458,0,0,412,9646,0,0;QS=3,0;MQSB=0.959189;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,145:4:0	0,12,107:4:0
+17	2235	.	G	<X>	0	.	DP=20;I16=6,14,0,0,728,27036,0,0,1134,66458,0,0,410,9636,0,0;QS=3,0;MQSB=0.959189;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,139:4:0	0,12,104:4:0
+17	2236	.	G	<X>	0	.	DP=19;I16=6,13,0,0,705,26985,0,0,1074,62858,0,0,409,9637,0,0;QS=3,0;MQSB=0.965977;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,142:4:0	0,9,84:3:0
+17	2237	.	G	<X>	0	.	DP=19;I16=6,12,0,0,684,26576,0,0,1057,62569,0,0,383,9023,0,0;QS=3,0;MQSB=0.85394;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,141:4:0	0,9,86:3:0
+17	2238	.	C	<X>	0	.	DP=19;I16=5,13,0,0,648,24496,0,0,1037,61489,0,0,381,8993,0,0;QS=3,0;MQSB=0.970092;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,9,108:3:0	0,9,78:3:0
+17	2239	.	A	<X>	0	.	DP=19;I16=6,11,0,0,634,24178,0,0,997,58969,0,0,373,8935,0,0;QS=3,0;MQSB=0.85832;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,133:4:0	0,6,77:2:0
+17	2240	.	A	<X>	0	.	DP=19;I16=6,13,0,0,731,28595,0,0,1074,62858,0,0,402,9582,0,0;QS=3,0;MQSB=0.965977;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,135:4:0	0,9,101:3:0
+17	2241	.	G	<X>	0	.	DP=19;I16=6,12,0,0,683,26433,0,0,1057,62569,0,0,375,8951,0,0;QS=3,0;MQSB=0.85394;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,126:4:0	0,9,88:3:0
+17	2242	.	T	<X>	0	.	DP=20;I16=5,13,0,0,635,22949,0,0,1057,62569,0,0,370,8944,0,0;QS=3,0;MQSB=0.814433;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,9,91:3:0	0,9,95:3:0
+17	2243	.	A	<X>	0	.	DP=19;I16=5,14,0,0,704,26274,0,0,1074,62858,0,0,395,9585,0,0;QS=3,0;MQSB=0.933727;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,9,107:3:0	0,9,99:3:0
+17	2244	.	T	<X>	0	.	DP=19;I16=5,14,0,0,681,25263,0,0,1074,62858,0,0,395,9609,0,0;QS=3,0;MQSB=0.933727;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,9,89:3:0	0,9,98:3:0
+17	2245	.	C	<X>	0	.	DP=19;I16=5,14,0,0,722,27846,0,0,1074,62858,0,0,394,9592,0,0;QS=3,0;MQSB=0.933727;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,9,98:3:0	0,9,88:3:0
+17	2246	.	A	<X>	0	.	DP=18;I16=5,12,0,0,597,21693,0,0,997,58969,0,0,367,8861,0,0;QS=3,0;MQSB=0.818731;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,9,95:3:0	0,6,72:2:0
+17	2247	.	C	<X>	0	.	DP=17;I16=4,13,0,0,639,24373,0,0,954,55658,0,0,391,9391,0,0;QS=3,0;MQSB=0.90252;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,9,105:3:0	0,6,71:2:0
+17	2248	.	C	<X>	0	.	DP=17;I16=4,13,0,0,669,26863,0,0,954,55658,0,0,390,9306,0,0;QS=3,0;MQSB=0.90252;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,9,90:3:0	0,6,75:2:0
+17	2249	.	A	<X>	0	.	DP=17;I16=4,13,0,0,677,27371,0,0,954,55658,0,0,389,9231,0,0;QS=3,0;MQSB=0.90252;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,9,116:3:0	0,6,80:2:0
+17	2250	.	G	<X>	0	.	DP=17;I16=4,13,0,0,654,25800,0,0,954,55658,0,0,388,9166,0,0;QS=3,0;MQSB=0.90252;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,9,100:3:0	0,6,78:2:0
+17	2251	.	A	<X>	0	.	DP=17;I16=4,13,0,0,673,27327,0,0,954,55658,0,0,387,9111,0,0;QS=3,0;MQSB=0.90252;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,9,112:3:0	0,6,80:2:0
+17	2252	.	G	<X>	0	.	DP=17;I16=4,12,0,0,647,26249,0,0,937,55369,0,0,361,8441,0,0;QS=3,0;MQSB=0.767432;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,9,113:3:0	0,6,73:2:0
+17	2253	.	A	<X>	0	.	DP=17;I16=4,13,0,0,641,24643,0,0,954,55658,0,0,385,9031,0,0;QS=3,0;MQSB=0.90252;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,9,111:3:0	0,6,73:2:0
+17	2254	.	T	<X>	0	.	DP=17;I16=4,12,0,0,615,23821,0,0,937,55369,0,0,358,8332,0,0;QS=3,0;MQSB=0.767432;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,9,112:3:0	0,6,73:2:0
+17	2255	.	G	<X>	0	.	DP=17;I16=4,13,0,0,677,27243,0,0,954,55658,0,0,380,8844,0,0;QS=3,0;MQSB=0.90252;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,9,115:3:0	0,6,71:2:0
+17	2256	.	A	<X>	0	.	DP=17;I16=4,13,0,0,656,26088,0,0,954,55658,0,0,377,8741,0,0;QS=3,0;MQSB=0.90252;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,9,110:3:0	0,6,78:2:0
+17	2257	.	G	<X>	0	.	DP=17;I16=4,12,0,0,627,24863,0,0,937,55369,0,0,349,8023,0,0;QS=3,0;MQSB=0.767432;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,9,115:3:0	0,6,74:2:0
+17	2258	.	C	<X>	0	.	DP=17;I16=4,13,0,0,667,26403,0,0,954,55658,0,0,371,8565,0,0;QS=3,0;MQSB=0.90252;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,9,109:3:0	0,6,70:2:0
+17	2259	.	T	<X>	0	.	DP=17;I16=4,13,0,0,646,25334,0,0,954,55658,0,0,368,8492,0,0;QS=3,0;MQSB=0.90252;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,9,116:3:0	0,6,79:2:0
+17	2260	.	T	<X>	0	.	DP=17;I16=4,13,0,0,638,24178,0,0,954,55658,0,0,365,8429,0,0;QS=3,0;MQSB=0.90252;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,9,115:3:0	0,6,72:2:0
+17	2261	.	T	<X>	0	.	DP=17;I16=4,13,0,0,633,23799,0,0,954,55658,0,0,362,8376,0,0;QS=3,0;MQSB=0.90252;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,9,105:3:0	0,6,73:2:0
+17	2262	.	A	<X>	0	.	DP=17;I16=4,13,0,0,628,23438,0,0,954,55658,0,0,359,8333,0,0;QS=3,0;MQSB=0.90252;MQ0F=0	PL:DP:DV	0,36,253:12:0	0,9,112:3:0	0,6,74:2:0
+17	2263	.	T	<X>	0	.	DP=17;I16=4,13,0,0,631,23673,0,0,954,55658,0,0,355,8251,0,0;QS=3,0;MQSB=0.90252;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,9,112:3:0	0,6,74:2:0
+17	2264	.	A	<X>	0	.	DP=17;I16=4,12,0,0,623,24371,0,0,937,55369,0,0,326,7556,0,0;QS=3,0;MQSB=0.767432;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,9,114:3:0	0,6,75:2:0
+17	2265	.	A	<X>	0	.	DP=18;I16=4,13,0,0,642,24718,0,0,997,58969,0,0,320,7400,0,0;QS=3,0;MQSB=0.762744;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,9,113:3:0	0,6,75:2:0
+17	2266	.	A	<X>	0	.	DP=19;I16=5,14,0,0,656,23962,0,0,1074,62858,0,0,337,7745,0,0;QS=3,0;MQSB=0.933727;MQ0F=0	PL:DP:DV	0,39,252:13:0	0,12,128:4:0	0,6,75:2:0
+17	2267	.	A	<X>	0	.	DP=20;I16=6,14,0,0,712,26052,0,0,1134,66458,0,0,332,7582,0,0;QS=3,0;MQSB=0.959189;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,134:4:0	0,9,102:3:0
+17	2268	.	A	<X>	0	.	DP=20;I16=6,14,0,0,741,27841,0,0,1134,66458,0,0,327,7391,0,0;QS=3,0;MQSB=0.959189;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,135:4:0	0,9,100:3:0
+17	2269	.	T	<X>	0	.	DP=20;I16=6,13,0,0,681,24751,0,0,1074,62858,0,0,318,7206,0,0;QS=3,0;MQSB=0.965977;MQ0F=0	PL:DP:DV	0,36,246:12:0	0,12,137:4:0	0,9,111:3:0
+17	2270	.	A	<X>	0	.	DP=19;I16=6,12,0,0,652,24154,0,0,1057,62569,0,0,300,6750,0,0;QS=3,0;MQSB=0.85394;MQ0F=0	PL:DP:DV	0,33,244:11:0	0,12,134:4:0	0,9,112:3:0
+17	2271	.	A	<X>	0	.	DP=17;I16=6,11,0,0,654,25406,0,0,954,55658,0,0,316,6944,0,0;QS=3,0;MQSB=0.980001;MQ0F=0	PL:DP:DV	0,30,243:10:0	0,12,142:4:0	0,9,111:3:0
+17	2272	.	T	<X>	0	.	DP=17;I16=6,10,0,0,604,22908,0,0,937,55369,0,0,297,6525,0,0;QS=3,0;MQSB=0.863243;MQ0F=0	PL:DP:DV	0,27,238:9:0	0,12,137:4:0	0,9,111:3:0
+17	2273	.	G	<X>	0	.	DP=17;I16=6,10,0,0,581,22129,0,0,937,55369,0,0,295,6411,0,0;QS=3,0;MQSB=0.863243;MQ0F=0	PL:DP:DV	0,27,240:9:0	0,12,123:4:0	0,9,115:3:0
+17	2274	.	G	<X>	0	.	DP=18;I16=6,11,0,0,621,23109,0,0,997,58969,0,0,293,6313,0,0;QS=3,0;MQSB=0.85832;MQ0F=0	PL:DP:DV	0,30,248:10:0	0,12,132:4:0	0,9,110:3:0
+17	2275	.	T	<X>	0	.	DP=18;I16=6,11,0,0,624,23152,0,0,997,58969,0,0,292,6232,0,0;QS=3,0;MQSB=0.85832;MQ0F=0	PL:DP:DV	0,30,249:10:0	0,12,126:4:0	0,9,113:3:0
+17	2276	.	G	<X>	0	.	DP=20;I16=7,12,0,0,710,26848,0,0,1074,62858,0,0,303,6313,0,0;QS=3,0;MQSB=0.985816;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,129:4:0	0,9,110:3:0
+17	2277	.	C	<X>	0	.	DP=21;I16=8,13,0,0,797,30699,0,0,1194,70058,0,0,303,6247,0,0;QS=3,0;MQSB=0.989565;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,151:5:0	0,12,143:4:0
+17	2278	.	T	<X>	0	.	DP=21;I16=7,13,0,0,736,27790,0,0,1157,68689,0,0,279,5581,0,0;QS=3,0;MQSB=0.962269;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,133:4:0	0,12,148:4:0
+17	2279	.	A	<X>	0	.	DP=20;I16=8,12,0,0,723,27047,0,0,1134,66458,0,0,306,6190,0,0;QS=3,0;MQSB=0.993326;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,155:5:0	0,12,144:4:0
+17	2280	.	G	<X>	0	.	DP=21;I16=8,12,0,0,766,29776,0,0,1177,69769,0,0,299,6085,0,0;QS=3,0;MQSB=0.898397;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,166:5:0	0,12,144:4:0
+17	2281	.	C	<X>	0	.	DP=22;I16=8,13,0,0,784,29748,0,0,1237,73369,0,0,301,6037,0,0;QS=3,0;MQSB=0.895122;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,165:5:0	0,12,140:4:0
+17	2282	.	T	<X>	0	.	DP=22;I16=8,14,0,0,789,29699,0,0,1254,73658,0,0,310,6054,0,0;QS=3,0;MQSB=0.985548;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,162:5:0	0,12,150:4:0
+17	2283	.	G	<X>	0	.	DP=22;I16=8,14,0,0,798,29774,0,0,1254,73658,0,0,312,6054,0,0;QS=3,0;MQSB=0.985548;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,158:5:0	0,12,142:4:0
+17	2284	.	G	<X>	0	.	DP=22;I16=7,14,0,0,760,28408,0,0,1194,70058,0,0,294,5664,0,0;QS=3,0;MQSB=0.975265;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,130:4:0	0,12,141:4:0
+17	2285	.	G	<X>	0	.	DP=23;I16=9,14,0,0,844,31592,0,0,1314,77258,0,0,311,5909,0,0;QS=3,0;MQSB=0.992095;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,152:5:0	0,12,144:4:0
+17	2286	.	C	<X>	0	.	DP=23;I16=9,14,0,0,854,32244,0,0,1314,77258,0,0,311,5869,0,0;QS=3,0;MQSB=0.992095;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,155:5:0	0,12,130:4:0
+17	2287	.	A	<X>	0	.	DP=23;I16=9,14,0,0,818,30288,0,0,1314,77258,0,0,311,5869,0,0;QS=3,0;MQSB=0.992095;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,166:5:0	0,12,143:4:0
+17	2288	.	T	<X>	0	.	DP=22;I16=8,14,0,0,794,29190,0,0,1254,73658,0,0,312,5908,0,0;QS=3,0;MQSB=0.985548;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,158:5:0	0,12,142:4:0
+17	2289	.	G	<X>	0	.	DP=21;I16=8,13,0,0,723,25835,0,0,1237,73369,0,0,314,5984,0,0;QS=3,0;MQSB=0.895122;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,154:5:0	0,12,126:4:0
+17	2290	.	G	<X>	0	.	DP=20;I16=7,13,0,0,748,28318,0,0,1177,69769,0,0,318,6094,0,0;QS=3,0;MQSB=0.875769;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,149:5:0	0,9,114:3:0
+17	2291	.	T	<X>	0	.	DP=20;I16=7,13,0,0,731,27165,0,0,1177,69769,0,0,322,6186,0,0;QS=3,0;MQSB=0.875769;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,151:5:0	0,9,112:3:0
+17	2292	.	G	<X>	0	.	DP=20;I16=7,13,0,0,749,28747,0,0,1177,69769,0,0,325,6259,0,0;QS=3,0;MQSB=0.875769;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,156:5:0	0,9,109:3:0
+17	2293	.	G	<X>	0	.	DP=20;I16=7,13,0,0,739,27903,0,0,1177,69769,0,0,327,6311,0,0;QS=3,0;MQSB=0.875769;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,156:5:0	0,9,112:3:0
+17	2294	.	C	<X>	0	.	DP=21;I16=7,14,0,0,775,29453,0,0,1237,73369,0,0,329,6391,0,0;QS=3,0;MQSB=0.872525;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,169:5:0	0,9,114:3:0
+17	2295	.	T	<X>	0	.	DP=21;I16=7,14,0,0,773,29209,0,0,1237,73369,0,0,331,6451,0,0;QS=3,0;MQSB=0.872525;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,164:5:0	0,9,115:3:0
+17	2296	.	T	<X>	0	.	DP=21;I16=7,14,0,0,756,27780,0,0,1237,73369,0,0,333,6543,0,0;QS=3,0;MQSB=0.872525;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,160:5:0	0,9,106:3:0
+17	2297	.	G	<X>	0	.	DP=20;I16=7,13,0,0,736,27692,0,0,1177,69769,0,0,336,6666,0,0;QS=3,0;MQSB=0.875769;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,165:5:0	0,6,74:2:0
+17	2298	.	C	<X>	0	.	DP=21;I16=7,14,0,0,778,29300,0,0,1237,73369,0,0,339,6819,0,0;QS=3,0;MQSB=0.872525;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,139:5:0	0,9,106:3:0
+17	2299	.	A	<X>	0	.	DP=21;I16=7,14,0,0,714,25282,0,0,1237,73369,0,0,343,7003,0,0;QS=3,0;MQSB=0.872525;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,128:5:0	0,9,110:3:0
+17	2300	.	C	<X>	0	.	DP=21;I16=7,13,0,0,687,24749,0,0,1177,69769,0,0,326,6768,0,0;QS=3,0;MQSB=0.875769;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,148:5:0	0,9,109:3:0
+17	2301	.	C	<X>	0	.	DP=23;I16=7,15,0,0,802,30292,0,0,1266,74210,0,0,349,7363,0,0;QS=3,0;MQSB=0.970024;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,147:5:0	0,9,116:3:0
+17	2302	.	T	<X>	0	.	DP=23;I16=7,16,0,0,860,32956,0,0,1326,77810,0,0,354,7496,0,0;QS=3,0;MQSB=0.964916;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,166:5:0	0,12,150:4:0
+17	2303	.	G	<X>	0	.	DP=23;I16=7,16,0,0,817,29823,0,0,1326,77810,0,0,356,7604,0,0;QS=3,0;MQSB=0.964916;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,151:5:0	0,12,139:4:0
+17	2304	.	T	<X>	0	.	DP=23;I16=7,16,0,0,802,28628,0,0,1326,77810,0,0,357,7691,0,0;QS=3,0;MQSB=0.964916;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,148:5:0	0,12,140:4:0
+17	2305	.	A	<X>	0	.	DP=22;I16=7,14,0,0,725,25585,0,0,1237,73369,0,0,355,7791,0,0;QS=3,0;MQSB=0.872525;MQ0F=0	PL:DP:DV	0,36,248:12:0	0,15,155:5:0	0,12,129:4:0
+17	2306	.	A	<X>	0	.	DP=21;I16=7,14,0,0,727,26841,0,0,1206,70610,0,0,361,7899,0,0;QS=3,0;MQSB=0.975265;MQ0F=0	PL:DP:DV	0,36,246:12:0	0,15,168:5:0	0,12,130:4:0
+17	2307	.	T	<X>	0	.	DP=21;I16=7,14,0,0,751,27427,0,0,1206,70610,0,0,362,7964,0,0;QS=3,0;MQSB=0.975265;MQ0F=0	PL:DP:DV	0,36,251:12:0	0,15,165:5:0	0,12,141:4:0
+17	2308	.	C	<X>	0	.	DP=21;I16=7,14,0,0,735,26675,0,0,1206,70610,0,0,363,8051,0,0;QS=3,0;MQSB=0.975265;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,144:5:0	0,12,146:4:0
+17	2309	.	C	A,<X>	0	.	DP=19;I16=7,11,0,1,604,21364,16,256,1057,62569,29,841,358,8094,8,64;QS=2.95676,0.0432432,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.985816;BQB=1;MQ0F=0	PL:DP:DV	0,20,224,33,227,230:12:1	0,9,94,9,94,94:3:0	0,12,138,12,138,138:4:0
+17	2310	.	C	<X>	0	.	DP=18;I16=6,12,0,0,668,25392,0,0,1049,62041,0,0,370,8282,0,0;QS=3,0;MQSB=0.961295;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,6,80:2:0	0,12,139:4:0
+17	2311	.	A	<X>	0	.	DP=19;I16=7,12,0,0,707,26855,0,0,1109,65641,0,0,373,8371,0,0;QS=3,0;MQSB=0.957193;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,6,78:2:0	0,12,137:4:0
+17	2312	.	G	<X>	0	.	DP=20;I16=7,12,0,0,736,29118,0,0,1109,65641,0,0,364,8306,0,0;QS=3,0;MQSB=0.957193;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,6,82:2:0	0,9,122:3:0
+17	2313	.	C	<X>	0	.	DP=20;I16=7,13,0,0,723,27231,0,0,1169,69241,0,0,382,8596,0,0;QS=3,0;MQSB=0.962269;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,6,76:2:0	0,12,130:4:0
+17	2314	.	A	<X>	0	.	DP=21;I16=7,12,0,0,630,22184,0,0,1109,65641,0,0,372,8510,0,0;QS=3,0;MQSB=0.957193;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,6,78:2:0	0,9,115:3:0
+17	2315	.	C	<X>	0	.	DP=23;I16=7,14,0,0,739,26861,0,0,1229,72841,0,0,392,8892,0,0;QS=3,0;MQSB=0.966484;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,6,71:2:0	0,12,135:4:0
+17	2316	.	T	<X>	0	.	DP=23;I16=8,15,0,0,826,30690,0,0,1349,80041,0,0,408,9102,0,0;QS=3,0;MQSB=0.967216;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,9,105:3:0	0,15,170:5:0
+17	2317	.	T	<X>	0	.	DP=24;I16=7,16,0,0,766,27014,0,0,1349,80041,0,0,411,9211,0,0;QS=3,0;MQSB=0.973027;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,78:2:0	0,15,170:5:0
+17	2318	.	T	<X>	0	.	DP=24;I16=8,14,0,0,757,27433,0,0,1320,79200,0,0,379,8449,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,9,91:3:0	0,15,165:5:0
+17	2319	.	G	<X>	0	.	DP=24;I16=6,16,0,0,827,31577,0,0,1289,76441,0,0,398,8882,0,0;QS=3,0;MQSB=0.97584;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,3,43:1:0	0,15,167:5:0
+17	2320	.	G	<X>	0	.	DP=23;I16=7,16,0,0,803,29077,0,0,1349,80041,0,0,435,9675,0,0;QS=3,0;MQSB=0.973027;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,9,87:3:0	0,15,157:5:0
+17	2321	.	G	<X>	0	.	DP=23;I16=7,16,0,0,804,29368,0,0,1349,80041,0,0,442,9840,0,0;QS=3,0;MQSB=0.973027;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,9,79:3:0	0,15,169:5:0
+17	2322	.	A	<X>	0	.	DP=24;I16=7,17,0,0,860,32116,0,0,1409,83641,0,0,449,10027,0,0;QS=3,0;MQSB=0.975597;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,95:3:0	0,15,178:5:0
+17	2323	.	G	<X>	0	.	DP=24;I16=7,17,0,0,863,31887,0,0,1409,83641,0,0,457,10237,0,0;QS=3,0;MQSB=0.975597;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,88:3:0	0,15,153:5:0
+17	2324	.	G	<X>	0	.	DP=24;I16=7,16,0,0,786,27932,0,0,1349,80041,0,0,462,10416,0,0;QS=3,0;MQSB=0.973027;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,9,88:3:0	0,15,161:5:0
+17	2325	.	C	<X>	0	.	DP=24;I16=7,15,0,0,730,25576,0,0,1289,76441,0,0,427,9625,0,0;QS=3,0;MQSB=0.970024;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,9,102:3:0	0,12,130:4:0
+17	2326	.	C	<X>	0	.	DP=24;I16=7,15,0,0,709,23523,0,0,1320,79200,0,0,426,9498,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,241:15:0	0,9,95:3:0	0,12,133:4:0
+17	2327	.	G	<X>	0	.	DP=24;I16=7,17,0,0,817,29275,0,0,1409,83641,0,0,481,10891,0,0;QS=3,0;MQSB=0.975597;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,81:3:0	0,15,158:5:0
+17	2328	.	A	<X>	0	.	DP=24;I16=6,17,0,0,814,29804,0,0,1349,80041,0,0,461,10427,0,0;QS=3,0;MQSB=0.978183;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,9,82:3:0	0,15,172:5:0
+17	2329	.	G	<X>	0	.	DP=23;I16=6,16,0,0,755,27641,0,0,1289,76441,0,0,477,11005,0,0;QS=3,0;MQSB=0.97584;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,6,63:2:0	0,15,160:5:0
+17	2330	.	C	<X>	0	.	DP=24;I16=7,17,0,0,875,33131,0,0,1409,83641,0,0,498,11424,0,0;QS=3,0;MQSB=0.975597;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,9,87:3:0	0,18,181:6:0
+17	2331	.	T	<X>	0	.	DP=24;I16=7,17,0,0,862,31882,0,0,1409,83641,0,0,505,11635,0,0;QS=3,0;MQSB=0.975597;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,9,106:3:0	0,18,200:6:0
+17	2332	.	A	<X>	0	.	DP=25;I16=8,17,0,0,926,35412,0,0,1469,87241,0,0,512,11864,0,0;QS=3,0;MQSB=0.973216;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,97:3:0	0,18,204:6:0
+17	2333	.	G	<X>	0	.	DP=26;I16=8,17,0,0,923,35129,0,0,1469,87241,0,0,494,11436,0,0;QS=3,0;MQSB=0.973216;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,97:3:0	0,18,189:6:0
+17	2334	.	G	<X>	0	.	DP=26;I16=8,18,0,0,928,34574,0,0,1529,90841,0,0,527,12277,0,0;QS=3,0;MQSB=0.975611;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,93:3:0	0,21,202:7:0
+17	2335	.	A	<X>	0	.	DP=26;I16=8,18,0,0,967,36793,0,0,1529,90841,0,0,535,12513,0,0;QS=3,0;MQSB=0.975611;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,105:3:0	0,21,214:7:0
+17	2336	.	G	<X>	0	.	DP=26;I16=8,18,0,0,962,36346,0,0,1529,90841,0,0,543,12769,0,0;QS=3,0;MQSB=0.975611;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,92:3:0	0,21,204:7:0
+17	2337	.	G	<X>	0	.	DP=26;I16=7,18,0,0,895,32981,0,0,1469,87241,0,0,527,12465,0,0;QS=3,0;MQSB=0.977814;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,74:2:0	0,21,204:7:0
+17	2338	.	A	<X>	0	.	DP=26;I16=8,18,0,0,892,31758,0,0,1529,90841,0,0,556,13186,0,0;QS=3,0;MQSB=0.975611;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,87:3:0	0,21,194:7:0
+17	2339	.	T	<X>	0	.	DP=26;I16=7,18,0,0,827,28921,0,0,1469,87241,0,0,537,12769,0,0;QS=3,0;MQSB=0.977814;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,55:2:0	0,21,200:7:0
+17	2340	.	C	<X>	0	.	DP=25;I16=7,18,0,0,792,25816,0,0,1469,87241,0,0,541,12893,0,0;QS=3,0;MQSB=0.977814;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,57:2:0	0,21,173:7:0
+17	2341	.	G	<X>	0	.	DP=25;I16=6,17,0,0,771,26477,0,0,1349,80041,0,0,494,11732,0,0;QS=3,0;MQSB=0.978183;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,3,41:1:0	0,21,186:7:0
+17	2342	.	T	<X>	0	.	DP=24;I16=6,17,0,0,863,32711,0,0,1349,80041,0,0,523,12459,0,0;QS=3,0;MQSB=0.978183;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,3,43:1:0	0,21,214:7:0
+17	2343	.	T	<X>	0	.	DP=24;I16=6,16,0,0,770,28230,0,0,1289,76441,0,0,504,12032,0,0;QS=3,0;MQSB=0.97584;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,3,44:1:0	0,21,213:7:0
+17	2344	.	T	<X>	0	.	DP=24;I16=7,17,0,0,843,30483,0,0,1409,83641,0,0,552,13124,0,0;QS=3,0;MQSB=0.975597;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,6,56:2:0	0,21,202:7:0
+17	2345	.	G	<X>	0	.	DP=24;I16=7,17,0,0,897,34121,0,0,1409,83641,0,0,554,13162,0,0;QS=3,0;MQSB=0.975597;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,6,77:2:0	0,21,206:7:0
+17	2346	.	A	<X>	0	.	DP=24;I16=7,17,0,0,908,34818,0,0,1409,83641,0,0,556,13212,0,0;QS=3,0;MQSB=0.975597;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,6,68:2:0	0,21,220:7:0
+17	2347	.	G	<X>	0	.	DP=24;I16=6,17,0,0,824,30406,0,0,1349,80041,0,0,533,12649,0,0;QS=3,0;MQSB=0.978183;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,3,39:1:0	0,21,190:7:0
+17	2348	.	T	<X>	0	.	DP=24;I16=7,16,0,0,745,25653,0,0,1349,80041,0,0,544,13072,0,0;QS=3,0;MQSB=0.973027;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,6,64:2:0	0,18,183:6:0
+17	2349	.	C	<X>	0	.	DP=24;I16=6,17,0,0,804,29224,0,0,1349,80041,0,0,534,12656,0,0;QS=3,0;MQSB=0.978183;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,3,36:1:0	0,21,200:7:0
+17	2350	.	C	<X>	0	.	DP=25;I16=7,17,0,0,869,31905,0,0,1409,83641,0,0,534,12652,0,0;QS=3,0;MQSB=0.975597;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,6,63:2:0	0,21,198:7:0
+17	2351	.	A	<X>	0	.	DP=25;I16=8,17,0,0,945,36169,0,0,1469,87241,0,0,559,13237,0,0;QS=3,0;MQSB=0.973216;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,74:2:0	0,21,222:7:0
+17	2352	.	G	<X>	0	.	DP=25;I16=7,17,0,0,893,34005,0,0,1409,83641,0,0,533,12539,0,0;QS=3,0;MQSB=0.975597;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,3,41:1:0	0,21,207:7:0
+17	2353	.	C	<X>	0	.	DP=24;I16=7,17,0,0,866,31864,0,0,1409,83641,0,0,531,12435,0,0;QS=3,0;MQSB=0.975597;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,3,41:1:0	0,21,205:7:0
+17	2354	.	A	<X>	0	.	DP=24;I16=7,17,0,0,880,33206,0,0,1409,83641,0,0,529,12351,0,0;QS=3,0;MQSB=0.975597;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,3,43:1:0	0,21,214:7:0
+17	2355	.	G	<X>	0	.	DP=24;I16=7,17,0,0,871,32261,0,0,1409,83641,0,0,526,12238,0,0;QS=3,0;MQSB=0.975597;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,3,39:1:0	0,21,195:7:0
+17	2356	.	T	<X>	0	.	DP=24;I16=7,17,0,0,887,33305,0,0,1409,83641,0,0,521,12047,0,0;QS=3,0;MQSB=0.975597;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,3,43:1:0	0,21,219:7:0
+17	2357	.	T	<X>	0	.	DP=24;I16=7,17,0,0,899,34225,0,0,1409,83641,0,0,516,11878,0,0;QS=3,0;MQSB=0.975597;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,3,43:1:0	0,21,220:7:0
+17	2358	.	T	<X>	0	.	DP=24;I16=7,17,0,0,913,34891,0,0,1409,83641,0,0,510,11680,0,0;QS=3,0;MQSB=0.975597;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,3,40:1:0	0,21,218:7:0
+17	2359	.	G	<X>	0	.	DP=25;I16=7,17,0,0,898,34048,0,0,1409,83641,0,0,503,11451,0,0;QS=3,0;MQSB=0.975597;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,3,39:1:0	0,21,209:7:0
+17	2360	.	A	<X>	0	.	DP=25;I16=7,18,0,0,959,37113,0,0,1469,87241,0,0,514,11552,0,0;QS=3,0;MQSB=0.977814;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,72:2:0	0,21,222:7:0
+17	2361	.	G	<X>	0	.	DP=25;I16=7,17,0,0,850,30946,0,0,1409,83641,0,0,482,10726,0,0;QS=3,0;MQSB=0.975597;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,67:2:0	0,18,168:6:0
+17	2362	.	A	<X>	0	.	DP=25;I16=7,17,0,0,762,25482,0,0,1409,83641,0,0,475,10547,0,0;QS=3,0;MQSB=0.975597;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,51:2:0	0,18,159:6:0
+17	2363	.	C	<X>	0	.	DP=25;I16=7,18,0,0,875,31837,0,0,1469,87241,0,0,493,11015,0,0;QS=3,0;MQSB=0.977814;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,65:2:0	0,21,187:7:0
+17	2364	.	C	<X>	0	.	DP=25;I16=7,18,0,0,927,34965,0,0,1469,87241,0,0,486,10880,0,0;QS=3,0;MQSB=0.977814;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,64:2:0	0,21,201:7:0
+17	2365	.	A	<X>	0	.	DP=24;I16=7,17,0,0,908,34754,0,0,1409,83641,0,0,479,10717,0,0;QS=3,0;MQSB=0.975597;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,6,65:2:0	0,21,221:7:0
+17	2366	.	G	<X>	0	.	DP=25;I16=7,17,0,0,912,35074,0,0,1440,86400,0,0,447,9951,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,6,58:2:0	0,21,206:7:0
+17	2367	.	C	<X>	0	.	DP=25;I16=7,17,0,0,872,32088,0,0,1409,83641,0,0,440,9782,0,0;QS=3,0;MQSB=0.975597;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,3,36:1:0	0,21,197:7:0
+17	2368	.	C	<X>	0	.	DP=24;I16=6,17,0,0,871,33801,0,0,1349,80041,0,0,434,9634,0,0;QS=3,0;MQSB=0.978183;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,3,39:1:0	0,18,180:6:0
+17	2369	.	T	<X>	0	.	DP=24;I16=6,18,0,0,877,33009,0,0,1409,83641,0,0,452,10082,0,0;QS=3,0;MQSB=0.980199;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,49:2:0	0,18,179:6:0
+17	2370	.	G	<X>	0	.	DP=24;I16=6,18,0,0,899,34289,0,0,1409,83641,0,0,445,9927,0,0;QS=3,0;MQSB=0.980199;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,56:2:0	0,18,179:6:0
+17	2371	.	G	<X>	0	.	DP=24;I16=6,18,0,0,880,33088,0,0,1409,83641,0,0,438,9794,0,0;QS=3,0;MQSB=0.980199;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,51:2:0	0,18,177:6:0
+17	2372	.	C	<X>	0	.	DP=24;I16=6,18,0,0,827,29615,0,0,1409,83641,0,0,431,9683,0,0;QS=3,0;MQSB=0.980199;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,47:2:0	0,18,163:6:0
+17	2373	.	C	<X>	0	.	DP=24;I16=6,18,0,0,886,33212,0,0,1409,83641,0,0,424,9594,0,0;QS=3,0;MQSB=0.980199;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,58:2:0	0,18,166:6:0
+17	2374	.	A	<X>	0	.	DP=23;I16=6,17,0,0,844,31230,0,0,1349,80041,0,0,417,9477,0,0;QS=3,0;MQSB=0.978183;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,6,66:2:0	0,18,177:6:0
+17	2375	.	A	<X>	0	.	DP=23;I16=5,17,0,0,788,28340,0,0,1289,76441,0,0,409,9333,0,0;QS=3,0;MQSB=0.981001;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,6,64:2:0	0,18,171:6:0
+17	2376	.	T	<X>	0	.	DP=22;I16=5,17,0,0,778,27804,0,0,1289,76441,0,0,401,9161,0,0;QS=3,0;MQSB=0.981001;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,6,62:2:0	0,18,162:6:0
+17	2377	.	A	<X>	0	.	DP=21;I16=4,17,0,0,704,24488,0,0,1229,72841,0,0,394,9008,0,0;QS=3,0;MQSB=0.984085;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,6,49:2:0	0,15,135:5:0
+17	2378	.	C	<X>	0	.	DP=20;I16=4,16,0,0,626,20138,0,0,1169,69241,0,0,388,8872,0,0;QS=3,0;MQSB=0.982301;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,3,15:1:0	0,15,108:5:0
+17	2379	.	G	<X>	0	.	DP=20;I16=4,16,0,0,714,25924,0,0,1169,69241,0,0,382,8752,0,0;QS=3,0;MQSB=0.982301;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,3,34:1:0	0,15,140:5:0
+17	2380	.	G	<X>	0	.	DP=19;I16=4,14,0,0,672,25672,0,0,1049,62041,0,0,352,8022,0,0;QS=3,0;MQSB=0.977696;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,3,18:1:0	0,15,134:5:0
+17	2381	.	C	<X>	0	.	DP=18;I16=4,14,0,0,676,25626,0,0,1049,62041,0,0,373,8555,0,0;QS=3,0;MQSB=0.977696;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,3,28:1:0	0,15,133:5:0
+17	2382	.	A	<X>	0	.	DP=19;I16=5,14,0,0,669,23995,0,0,1109,65641,0,0,369,8475,0,0;QS=3,0;MQSB=0.97357;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,3,28:1:0	0,15,131:5:0
+17	2383	.	A	<X>	0	.	DP=19;I16=5,14,0,0,686,25162,0,0,1109,65641,0,0,365,8359,0,0;QS=3,0;MQSB=0.97357;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,3,26:1:0	0,15,140:5:0
+17	2384	.	A	<X>	0	.	DP=19;I16=5,14,0,0,649,22943,0,0,1109,65641,0,0,360,8210,0,0;QS=3,0;MQSB=0.97357;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,3,13:1:0	0,15,132:5:0
+17	2385	.	A	<X>	0	.	DP=18;I16=4,14,0,0,643,23235,0,0,1049,62041,0,0,356,8078,0,0;QS=3,0;MQSB=0.977696;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,3,38:1:0	0,15,134:5:0
+17	2386	.	C	<X>	0	.	DP=18;I16=4,14,0,0,652,24008,0,0,1049,62041,0,0,351,7913,0,0;QS=3,0;MQSB=0.977696;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,3,25:1:0	0,15,130:5:0
+17	2387	.	C	<X>	0	.	DP=18;I16=4,14,0,0,667,25007,0,0,1049,62041,0,0,345,7717,0,0;QS=3,0;MQSB=0.977696;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,3,25:1:0	0,15,128:5:0
+17	2388	.	C	<X>	0	.	DP=18;I16=4,14,0,0,691,26659,0,0,1049,62041,0,0,339,7541,0,0;QS=3,0;MQSB=0.977696;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,3,39:1:0	0,15,134:5:0
+17	2389	.	A	<X>	0	.	DP=19;I16=5,14,0,0,682,24912,0,0,1109,65641,0,0,333,7385,0,0;QS=3,0;MQSB=0.97357;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,3,35:1:0	0,15,140:5:0
+17	2390	.	G	<X>	0	.	DP=18;I16=5,13,0,0,642,23418,0,0,1049,62041,0,0,328,7200,0,0;QS=3,0;MQSB=0.970092;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,3,27:1:0	0,15,126:5:0
+17	2391	.	T	<X>	0	.	DP=18;I16=5,12,0,0,624,23122,0,0,989,58441,0,0,298,6412,0,0;QS=2,0;MQSB=0.965874;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,0,0:0:0	0,15,140:5:0
+17	2392	.	C	<X>	0	.	DP=18;I16=5,12,0,0,660,25910,0,0,989,58441,0,0,291,6171,0,0;QS=2,0;MQSB=0.965874;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,0,0:0:0	0,15,131:5:0
+17	2393	.	T	<X>	0	.	DP=18;I16=5,13,0,0,669,25099,0,0,1049,62041,0,0,309,6577,0,0;QS=3,0;MQSB=0.970092;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,3,38:1:0	0,15,134:5:0
+17	2394	.	C	<X>	0	.	DP=17;I16=5,12,0,0,653,25323,0,0,989,58441,0,0,303,6379,0,0;QS=3,0;MQSB=0.965874;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,3,29:1:0	0,15,133:5:0
+17	2395	.	T	<X>	0	.	DP=17;I16=5,12,0,0,613,22621,0,0,989,58441,0,0,297,6201,0,0;QS=3,0;MQSB=0.965874;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,3,19:1:0	0,15,128:5:0
+17	2396	.	A	<X>	0	.	DP=17;I16=5,11,0,0,584,21426,0,0,929,54841,0,0,266,5418,0,0;QS=2,0;MQSB=0.960687;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,0,0:0:0	0,15,130:5:0
+17	2397	.	C	<X>	0	.	DP=18;I16=5,13,0,0,650,24046,0,0,1049,62041,0,0,284,5856,0,0;QS=3,0;MQSB=0.970092;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,3,18:1:0	0,15,129:5:0
+17	2398	.	A	<X>	0	.	DP=18;I16=5,13,0,0,617,21907,0,0,1049,62041,0,0,278,5692,0,0;QS=3,0;MQSB=0.970092;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,3,19:1:0	0,15,128:5:0
+17	2399	.	A	<X>	0	.	DP=17;I16=5,11,0,0,592,22176,0,0,929,54841,0,0,248,4926,0,0;QS=2,0;MQSB=0.960687;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,0,0:0:0	0,12,115:4:0
+17	2400	.	A	<X>	0	.	DP=16;I16=5,11,0,0,576,21010,0,0,929,54841,0,0,269,5431,0,0;QS=3,0;MQSB=0.960687;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,3,26:1:0	0,9,99:3:0
+17	2401	.	A	<X>	0	.	DP=17;I16=6,11,0,0,594,21126,0,0,989,58441,0,0,265,5331,0,0;QS=3,0;MQSB=0.955563;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,3,23:1:0	0,9,98:3:0
+17	2402	.	A	<X>	0	.	DP=17;I16=6,11,0,0,606,21986,0,0,989,58441,0,0,262,5252,0,0;QS=3,0;MQSB=0.955563;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,3,27:1:0	0,9,99:3:0
+17	2403	.	A	<X>	0	.	DP=17;I16=6,11,0,0,608,22130,0,0,989,58441,0,0,259,5195,0,0;QS=3,0;MQSB=0.955563;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,3,21:1:0	0,9,97:3:0
+17	2404	.	T	<X>	0	.	DP=17;I16=6,11,0,0,567,19449,0,0,989,58441,0,0,256,5160,0,0;QS=3,0;MQSB=0.955563;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,3,14:1:0	0,9,87:3:0
+17	2405	.	A	<X>	0	.	DP=18;I16=7,11,0,0,618,21666,0,0,1049,62041,0,0,253,5147,0,0;QS=3,0;MQSB=0.951002;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,3,17:1:0	0,9,88:3:0
+17	2406	.	C	<X>	0	.	DP=18;I16=7,11,0,0,676,25664,0,0,1049,62041,0,0,250,5108,0,0;QS=3,0;MQSB=0.951002;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,3,27:1:0	0,9,90:3:0
+17	2407	.	A	<X>	0	.	DP=19;I16=8,11,0,0,673,24197,0,0,1109,65641,0,0,246,5046,0,0;QS=3,0;MQSB=0.946915;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,3,34:1:0	0,9,89:3:0
+17	2408	.	A	<X>	0	.	DP=18;I16=8,10,0,0,619,21951,0,0,1049,62041,0,0,243,4961,0,0;QS=3,0;MQSB=0.938795;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,3,22:1:0	0,6,73:2:0
+17	2409	.	A	<X>	0	.	DP=17;I16=8,9,0,0,615,22687,0,0,1020,61200,0,0,240,4852,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,3,39:1:0	0,6,74:2:0
+17	2410	.	A	<X>	0	.	DP=17;I16=8,9,0,0,604,21938,0,0,1020,61200,0,0,237,4769,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,3,39:1:0	0,6,73:2:0
+17	2411	.	A	<X>	0	.	DP=16;I16=7,9,0,0,567,20551,0,0,960,57600,0,0,235,4711,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,3,25:1:0	0,6,70:2:0
+17	2412	.	A	<X>	0	.	DP=15;I16=7,8,0,0,527,18903,0,0,900,54000,0,0,234,4676,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,3,21:1:0	0,6,70:2:0
+17	2413	.	C	<X>	0	.	DP=15;I16=7,8,0,0,559,21161,0,0,900,54000,0,0,233,4663,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,3,22:1:0	0,6,72:2:0
+17	2414	.	A	<X>	0	.	DP=16;I16=8,8,0,0,570,20822,0,0,929,54841,0,0,232,4672,0,0;QS=3,0;MQSB=0.915545;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,3,25:1:0	0,6,73:2:0
+17	2415	.	A	<X>	0	.	DP=16;I16=9,7,0,0,574,20768,0,0,929,54841,0,0,232,4652,0,0;QS=3,0;MQSB=0.933674;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,3,30:1:0	0,6,64:2:0
+17	2416	.	C	<X>	0	.	DP=17;I16=8,8,0,0,576,21424,0,0,960,57600,0,0,231,4649,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,6,42:2:0	0,6,68:2:0
+17	2417	.	T	<X>	0	.	DP=17;I16=10,7,0,0,612,22740,0,0,958,55682,0,0,235,4627,0,0;QS=3,0;MQSB=0.79189;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,6,57:2:0	0,9,92:3:0
+17	2418	.	A	<X>	0	.	DP=17;I16=10,7,0,0,624,23210,0,0,958,55682,0,0,238,4626,0,0;QS=3,0;MQSB=0.79189;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,6,62:2:0	0,9,105:3:0
+17	2419	.	G	<X>	0	.	DP=19;I16=11,7,0,0,651,24113,0,0,1018,59282,0,0,241,4651,0,0;QS=3,0;MQSB=0.817948;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,6,51:2:0	0,12,126:4:0
+17	2420	.	C	<X>	0	.	DP=19;I16=11,8,0,0,663,23999,0,0,1078,62882,0,0,246,4704,0,0;QS=3,0;MQSB=0.803979;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,6,44:2:0	0,12,127:4:0
+17	2421	.	C	<X>	0	.	DP=19;I16=10,8,0,0,657,24779,0,0,1049,62041,0,0,244,4738,0,0;QS=3,0;MQSB=0.938795;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,6,45:2:0	0,12,126:4:0
+17	2422	.	A	<X>	0	.	DP=18;I16=11,6,0,0,647,24747,0,0,958,55682,0,0,238,4538,0,0;QS=3,0;MQSB=0.833753;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,3,33:1:0	0,12,137:4:0
+17	2423	.	G	<X>	0	.	DP=18;I16=11,6,0,0,634,24250,0,0,958,55682,0,0,258,4972,0,0;QS=3,0;MQSB=0.833753;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,6,54:2:0	0,12,126:4:0
+17	2424	.	G	<X>	0	.	DP=18;I16=10,6,0,0,595,22361,0,0,929,54841,0,0,240,4714,0,0;QS=3,0;MQSB=0.948436;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,3,36:1:0	0,12,126:4:0
+17	2425	.	C	<X>	0	.	DP=18;I16=10,7,0,0,596,21716,0,0,989,58441,0,0,260,5074,0,0;QS=3,0;MQSB=0.943335;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,6,45:2:0	0,12,114:4:0
+17	2426	.	G	<X>	0	.	DP=18;I16=10,7,0,0,550,18088,0,0,989,58441,0,0,263,5171,0,0;QS=3,0;MQSB=0.943335;MQ0F=0	PL:DP:DV	0,33,232:11:0	0,6,59:2:0	0,12,113:4:0
+17	2427	.	T	<X>	0	.	DP=18;I16=11,6,0,0,618,22654,0,0,958,55682,0,0,275,5403,0,0;QS=3,0;MQSB=0.833753;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,6,62:2:0	0,9,99:3:0
+17	2428	.	G	<X>	0	.	DP=18;I16=11,7,0,0,649,24633,0,0,1018,59282,0,0,281,5535,0,0;QS=3,0;MQSB=0.817948;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,6,48:2:0	0,12,128:4:0
+17	2429	.	G	<X>	0	.	DP=18;I16=10,7,0,0,553,19057,0,0,989,58441,0,0,269,5459,0,0;QS=3,0;MQSB=0.943335;MQ0F=0	PL:DP:DV	0,33,241:11:0	0,6,55:2:0	0,12,117:4:0
+17	2430	.	T	A,<X>	0	.	DP=18;I16=10,7,1,0,552,18556,21,441,989,58441,29,841,271,5603,16,256;QS=2.94278,0.0572207,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.817948;BQB=1;MQ0F=0	PL:DP:DV	0,15,212,33,215,222:12:1	0,6,60,6,60,60:2:0	0,12,125,12,125,125:4:0
+17	2431	.	G	<X>	0	.	DP=18;I16=11,5,0,0,580,21766,0,0,898,52082,0,0,268,5764,0,0;QS=3,0;MQSB=0.851779;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,3,37:1:0	0,9,98:3:0
+17	2432	.	G	<X>	0	.	DP=17;I16=10,7,0,0,593,21479,0,0,958,55682,0,0,295,6179,0,0;QS=3,0;MQSB=0.79189;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,6,53:2:0	0,9,97:3:0
+17	2433	.	T	<X>	0	.	DP=17;I16=10,7,0,0,577,20425,0,0,958,55682,0,0,299,6321,0,0;QS=3,0;MQSB=0.79189;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,6,57:2:0	0,9,94:3:0
+17	2434	.	G	<X>	0	.	DP=17;I16=10,6,0,0,546,19340,0,0,929,54841,0,0,284,6082,0,0;QS=3,0;MQSB=0.948436;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,6,46:2:0	0,6,62:2:0
+17	2435	.	C	<X>	0	.	DP=18;I16=12,5,0,0,597,21843,0,0,958,55682,0,0,304,6626,0,0;QS=3,0;MQSB=0.870325;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,6,58:2:0	0,6,60:2:0
+17	2436	.	A	<X>	0	.	DP=18;I16=11,6,0,0,545,18599,0,0,989,58441,0,0,295,6379,0,0;QS=3,0;MQSB=0.955563;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,9,64:3:0	0,6,61:2:0
+17	2437	.	C	<X>	0	.	DP=18;I16=11,5,0,0,573,21195,0,0,929,54841,0,0,297,6541,0,0;QS=3,0;MQSB=0.960687;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,6,63:2:0	0,6,63:2:0
+17	2438	.	A	<X>	0	.	DP=19;I16=12,6,0,0,583,20111,0,0,1018,59282,0,0,328,7322,0,0;QS=3,0;MQSB=0.85394;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,6,65:2:0	0,6,65:2:0
+17	2439	.	C	<X>	0	.	DP=19;I16=11,7,0,0,635,22997,0,0,1049,62041,0,0,314,6974,0,0;QS=3,0;MQSB=0.951002;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,9,91:3:0	0,6,57:2:0
+17	2440	.	C	<X>	0	.	DP=21;I16=13,7,0,0,701,26195,0,0,1138,66482,0,0,346,7840,0,0;QS=3,0;MQSB=0.857404;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,114:4:0	0,6,66:2:0
+17	2441	.	T	<X>	0	.	DP=21;I16=13,8,0,0,788,29910,0,0,1198,70082,0,0,360,8068,0,0;QS=3,0;MQSB=0.845496;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,164:5:0	0,6,67:2:0
+17	2442	.	G	<X>	0	.	DP=20;I16=12,7,0,0,695,25957,0,0,1109,65641,0,0,342,7596,0,0;QS=3,0;MQSB=0.957193;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,128:4:0	0,6,66:2:0
+17	2443	.	T	<X>	0	.	DP=20;I16=13,7,0,0,697,24685,0,0,1138,66482,0,0,373,8345,0,0;QS=3,0;MQSB=0.857404;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,130:4:0	0,6,64:2:0
+17	2444	.	A	<X>	0	.	DP=21;I16=13,8,0,0,755,27981,0,0,1198,70082,0,0,379,8489,0,0;QS=3,0;MQSB=0.845496;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,12,140:4:0	0,6,64:2:0
+17	2445	.	G	<X>	0	.	DP=21;I16=12,8,0,0,731,27427,0,0,1169,69241,0,0,359,7927,0,0;QS=3,0;MQSB=0.953497;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,130:4:0	0,6,65:2:0
+17	2446	.	T	<X>	0	.	DP=21;I16=13,8,0,0,723,25707,0,0,1198,70082,0,0,389,8633,0,0;QS=3,0;MQSB=0.845496;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,12,128:4:0	0,6,65:2:0
+17	2447	.	C	<X>	0	.	DP=22;I16=14,8,0,0,770,27950,0,0,1258,73682,0,0,394,8732,0,0;QS=3,0;MQSB=0.86151;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,12,127:4:0	0,6,64:2:0
+17	2448	.	C	<X>	0	.	DP=23;I16=14,7,0,0,727,26165,0,0,1167,67323,0,0,388,8674,0,0;QS=3,0;MQSB=0.735784;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,129:5:0	0,6,66:2:0
+17	2449	.	C	<X>	0	.	DP=23;I16=13,8,0,0,727,26415,0,0,1198,70082,0,0,363,7787,0,0;QS=3,0;MQSB=0.845496;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,128:5:0	0,6,62:2:0
+17	2450	.	A	<X>	0	.	DP=22;I16=12,8,0,0,673,24267,0,0,1138,66482,0,0,371,7959,0,0;QS=3,0;MQSB=0.826565;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,143:5:0	0,6,65:2:0
+17	2451	.	G	<X>	0	.	DP=22;I16=14,8,0,0,821,31595,0,0,1227,70923,0,0,429,9401,0,0;QS=3,0;MQSB=0.715049;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,151:5:0	0,6,67:2:0
+17	2452	.	C	<X>	0	.	DP=22;I16=14,8,0,0,743,26557,0,0,1227,70923,0,0,437,9613,0,0;QS=3,0;MQSB=0.715049;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,137:5:0	0,6,66:2:0
+17	2453	.	T	<X>	0	.	DP=22;I16=14,8,0,0,775,28215,0,0,1227,70923,0,0,445,9845,0,0;QS=3,0;MQSB=0.715049;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,143:5:0	0,6,68:2:0
+17	2454	.	A	<X>	0	.	DP=22;I16=14,8,0,0,721,24545,0,0,1227,70923,0,0,453,10097,0,0;QS=3,0;MQSB=0.715049;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,145:5:0	0,6,64:2:0
+17	2455	.	C	<X>	0	.	DP=22;I16=14,8,0,0,776,28212,0,0,1227,70923,0,0,461,10369,0,0;QS=3,0;MQSB=0.715049;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,138:5:0	0,6,65:2:0
+17	2456	.	T	<X>	0	.	DP=24;I16=14,9,0,0,834,30902,0,0,1318,77282,0,0,444,10036,0,0;QS=3,0;MQSB=0.851535;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,18,168:6:0	0,6,60:2:0
+17	2457	.	C	<X>	0	.	DP=24;I16=15,9,0,0,816,29244,0,0,1347,78123,0,0,478,10924,0,0;QS=3,0;MQSB=0.72325;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,18,159:6:0	0,6,65:2:0
+17	2458	.	A	<X>	0	.	DP=24;I16=15,9,0,0,869,32555,0,0,1347,78123,0,0,487,11209,0,0;QS=3,0;MQSB=0.72325;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,18,166:6:0	0,6,65:2:0
+17	2459	.	G	T,<X>	0	.	DP=24;I16=13,9,1,0,822,31186,13,169,1289,76441,29,841,453,10551,17,289;QS=2.92973,0.0702703,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.851535;BQB=1;MQ0F=0	PL:DP:DV	0,45,255,45,255,255:15:0	0,5,138,15,141,144:6:1	0,6,64,6,64,64:2:0
+17	2460	.	G	<X>	0	.	DP=24;I16=14,9,0,0,834,31432,0,0,1318,77282,0,0,477,11065,0,0;QS=3,0;MQSB=0.851535;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,18,160:6:0	0,6,65:2:0
+17	2461	.	A	G,<X>	0	.	DP=24;I16=14,9,1,0,839,31487,13,169,1318,77282,29,841,489,11521,19,361;QS=2.93401,0.0659898,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.72325;BQB=1;MQ0F=0	PL:DP:DV	0,48,255,48,255,255:16:0	0,5,148,15,151,154:6:1	0,6,67,6,67,67:2:0
+17	2462	.	G	<X>	0	.	DP=25;I16=15,10,0,0,893,33155,0,0,1407,81723,0,0,514,12090,0,0;QS=3,0;MQSB=0.707404;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,18,165:6:0	0,6,66:2:0
+17	2463	.	G	T,<X>	0	.	DP=25;I16=12,10,1,0,777,28525,14,196,1289,76441,29,841,452,10720,25,625;QS=2.975,0.025,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.825053;BQB=1;MQ0F=0	PL:DP:DV	0,36,255,48,255,255:17:1	0,12,133,12,133,133:4:0	0,6,68,6,68,68:2:0
+17	2464	.	C	<X>	0	.	DP=25;I16=15,10,0,0,904,34194,0,0,1407,81723,0,0,526,12458,0,0;QS=3,0;MQSB=0.707404;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,18,149:6:0	0,6,67:2:0
+17	2465	.	T	<X>	0	.	DP=25;I16=14,10,0,0,857,32235,0,0,1347,78123,0,0,506,11994,0,0;QS=3,0;MQSB=0.679965;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,18,163:6:0	0,6,69:2:0
+17	2466	.	G	<X>	0	.	DP=24;I16=14,9,0,0,852,32336,0,0,1318,77282,0,0,509,12025,0,0;QS=3,0;MQSB=0.851535;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,18,157:6:0	0,6,63:2:0
+17	2467	.	A	<X>	0	.	DP=24;I16=14,9,0,0,829,30725,0,0,1318,77282,0,0,513,12121,0,0;QS=3,0;MQSB=0.851535;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,18,168:6:0	0,6,67:2:0
+17	2468	.	G	<X>	0	.	DP=24;I16=15,9,0,0,890,34034,0,0,1347,78123,0,0,541,12807,0,0;QS=3,0;MQSB=0.72325;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,18,169:6:0	0,6,64:2:0
+17	2469	.	G	<X>	0	.	DP=24;I16=15,9,0,0,865,32303,0,0,1347,78123,0,0,544,12882,0,0;QS=3,0;MQSB=0.72325;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,18,174:6:0	0,6,58:2:0
+17	2470	.	G	<X>	0	.	DP=24;I16=14,9,0,0,829,30785,0,0,1318,77282,0,0,521,12295,0,0;QS=3,0;MQSB=0.851535;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,18,178:6:0	0,6,58:2:0
+17	2471	.	G	<X>	0	.	DP=24;I16=14,9,0,0,833,31429,0,0,1318,77282,0,0,523,12345,0,0;QS=3,0;MQSB=0.851535;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,15,170:5:0	0,6,64:2:0
+17	2472	.	G	<X>	0	.	DP=24;I16=13,9,0,0,774,28428,0,0,1289,76441,0,0,499,11733,0,0;QS=3,0;MQSB=0.955854;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,154:5:0	0,6,56:2:0
+17	2473	.	A	<X>	0	.	DP=24;I16=13,9,0,0,775,28137,0,0,1258,73682,0,0,508,12078,0,0;QS=3,0;MQSB=0.834768;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,160:5:0	0,6,63:2:0
+17	2474	.	A	<X>	0	.	DP=25;I16=15,9,0,0,851,31665,0,0,1378,80882,0,0,524,12322,0,0;QS=3,0;MQSB=0.865888;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,15,160:5:0	0,9,80:3:0
+17	2475	.	G	<X>	0	.	DP=25;I16=15,9,0,0,913,35239,0,0,1378,80882,0,0,525,12323,0,0;QS=3,0;MQSB=0.865888;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,15,167:5:0	0,9,84:3:0
+17	2476	.	G	<X>	0	.	DP=25;I16=13,9,0,0,776,28584,0,0,1289,76441,0,0,488,11544,0,0;QS=3,0;MQSB=0.955854;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,138:5:0	0,9,82:3:0
+17	2477	.	A	<X>	0	.	DP=25;I16=14,9,0,0,867,34329,0,0,1318,77282,0,0,515,12223,0,0;QS=3,0;MQSB=0.851535;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,178:5:0	0,9,91:3:0
+17	2478	.	C	<X>	0	.	DP=25;I16=14,9,0,0,897,36911,0,0,1318,77282,0,0,517,12289,0,0;QS=3,0;MQSB=0.851535;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,175:5:0	0,9,87:3:0
+17	2479	.	T	<X>	0	.	DP=25;I16=15,9,0,0,921,37957,0,0,1378,80882,0,0,529,12467,0,0;QS=3,0;MQSB=0.865888;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,15,176:5:0	0,9,97:3:0
+17	2480	.	G	<X>	0	.	DP=25;I16=14,9,0,0,877,35485,0,0,1349,80041,0,0,504,11864,0,0;QS=3,0;MQSB=0.960618;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,176:5:0	0,9,88:3:0
+17	2481	.	C	<X>	0	.	DP=25;I16=13,9,0,0,848,34542,0,0,1289,76441,0,0,496,11838,0,0;QS=3,0;MQSB=0.955854;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,183:5:0	0,9,88:3:0
+17	2482	.	T	<X>	0	.	DP=25;I16=15,9,0,0,905,37331,0,0,1378,80882,0,0,526,12430,0,0;QS=3,0;MQSB=0.865888;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,15,178:5:0	0,9,96:3:0
+17	2483	.	T	<X>	0	.	DP=25;I16=14,9,0,0,879,36187,0,0,1318,77282,0,0,517,12311,0,0;QS=3,0;MQSB=0.851535;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,180:5:0	0,9,89:3:0
+17	2484	.	G	<X>	0	.	DP=25;I16=14,9,0,0,884,35142,0,0,1349,80041,0,0,494,11604,0,0;QS=3,0;MQSB=0.960618;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,174:5:0	0,9,84:3:0
+17	2485	.	A	T,<X>	0	.	DP=25;I16=14,9,1,0,891,36757,17,289,1349,80041,29,841,490,11502,25,625;QS=2.96926,0.0307414,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.865888;BQB=1;MQ0F=0	PL:DP:DV	0,31,255,45,255,255:16:1	0,15,193,15,193,193:5:0	0,9,93,9,93,93:3:0
+17	2486	.	G	<X>	0	.	DP=25;I16=15,9,0,0,898,36230,0,0,1378,80882,0,0,511,12041,0,0;QS=3,0;MQSB=0.865888;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,15,153:5:0	0,9,90:3:0
+17	2487	.	C	<X>	0	.	DP=25;I16=14,9,0,0,793,30695,0,0,1349,80041,0,0,482,11346,0,0;QS=3,0;MQSB=0.960618;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,175:5:0	0,9,91:3:0
+17	2488	.	C	<X>	0	.	DP=25;I16=13,9,0,0,841,34597,0,0,1289,76441,0,0,457,10841,0,0;QS=3,0;MQSB=0.955854;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,174:5:0	0,9,93:3:0
+17	2489	.	C	<X>	0	.	DP=23;I16=11,9,0,0,801,34227,0,0,1169,69241,0,0,454,10788,0,0;QS=3,0;MQSB=0.943233;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,187:5:0	0,9,93:3:0
+17	2490	.	A	<X>	0	.	DP=23;I16=11,10,0,0,818,34642,0,0,1229,72841,0,0,451,10695,0,0;QS=3,0;MQSB=0.939898;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,175:5:0	0,12,128:4:0
+17	2491	.	G	<X>	0	.	DP=23;I16=12,10,0,0,845,35143,0,0,1258,73682,0,0,471,11097,0,0;QS=3,0;MQSB=0.804615;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,178:5:0	0,12,121:4:0
+17	2492	.	G	A,<X>	0	.	DP=23;I16=11,10,1,0,845,36207,16,256,1229,72841,29,841,446,10494,21,441;QS=2.96708,0.0329218,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.804615;BQB=1;MQ0F=0	PL:DP:DV	0,22,255,36,255,255:13:1	0,15,187,15,187,187:5:0	0,12,124,12,124,124:4:0
+17	2493	.	A	G,<X>	0	.	DP=23;I16=11,10,1,0,855,37007,13,169,1229,72841,29,841,442,10340,20,400;QS=2.97269,0.0273109,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.804615;BQB=1;MQ0F=0	PL:DP:DV	0,25,255,36,255,255:13:1	0,15,191,15,191,191:5:0	0,12,127,12,127,127:4:0
+17	2494	.	G	<X>	0	.	DP=23;I16=11,10,0,0,802,32720,0,0,1229,72841,0,0,437,10153,0,0;QS=3,0;MQSB=0.939898;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,179:5:0	0,12,118:4:0
+17	2495	.	T	<X>	0	.	DP=23;I16=10,10,0,0,737,29861,0,0,1138,66482,0,0,413,9513,0,0;QS=3,0;MQSB=0.751477;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,172:5:0	0,12,113:4:0
+17	2496	.	T	<X>	0	.	DP=23;I16=12,10,0,0,815,32793,0,0,1258,73682,0,0,442,10026,0,0;QS=3,0;MQSB=0.804615;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,183:5:0	0,12,123:4:0
+17	2497	.	T	<X>	0	.	DP=22;I16=12,9,0,0,807,33723,0,0,1198,70082,0,0,436,9814,0,0;QS=3,0;MQSB=0.815018;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,177:5:0	0,12,131:4:0
+17	2498	.	G	<X>	0	.	DP=22;I16=12,9,0,0,808,33264,0,0,1198,70082,0,0,430,9622,0,0;QS=3,0;MQSB=0.815018;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,173:5:0	0,12,127:4:0
+17	2499	.	A	<X>	0	.	DP=22;I16=12,9,0,0,847,36803,0,0,1198,70082,0,0,424,9450,0,0;QS=3,0;MQSB=0.815018;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,185:5:0	0,12,133:4:0
+17	2500	.	G	<X>	0	.	DP=22;I16=11,9,0,0,772,32546,0,0,1169,69241,0,0,404,9078,0,0;QS=3,0;MQSB=0.943233;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,168:5:0	0,12,129:4:0
+17	2501	.	G	<X>	0	.	DP=22;I16=11,8,0,0,768,33120,0,0,1109,65641,0,0,373,8293,0,0;QS=3,0;MQSB=0.946915;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,146:4:0	0,12,118:4:0
+17	2502	.	C	<X>	0	.	DP=22;I16=12,8,0,0,798,33902,0,0,1138,66482,0,0,378,8270,0,0;QS=3,0;MQSB=0.826565;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,155:4:0	0,12,125:4:0
+17	2503	.	T	<X>	0	.	DP=22;I16=12,9,0,0,851,36841,0,0,1198,70082,0,0,396,8746,0,0;QS=3,0;MQSB=0.815018;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,180:5:0	0,12,139:4:0
+17	2504	.	G	<X>	0	.	DP=22;I16=12,9,0,0,787,31955,0,0,1198,70082,0,0,389,8615,0,0;QS=3,0;MQSB=0.815018;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,171:5:0	0,12,129:4:0
+17	2505	.	C	<X>	0	.	DP=21;I16=11,9,0,0,792,33440,0,0,1138,66482,0,0,383,8501,0,0;QS=3,0;MQSB=0.791547;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,169:5:0	0,12,132:4:0
+17	2506	.	T	<X>	0	.	DP=22;I16=11,10,0,0,798,32868,0,0,1198,70082,0,0,376,8354,0,0;QS=3,0;MQSB=0.780412;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,175:5:0	0,15,169:5:0
+17	2507	.	G	<X>	0	.	DP=21;I16=9,10,0,0,716,30074,0,0,1109,65641,0,0,365,8189,0,0;QS=3,0;MQSB=0.920044;MQ0F=0	PL:DP:DV	0,27,241:9:0	0,15,163:5:0	0,15,153:5:0
+17	2508	.	T	<X>	0	.	DP=21;I16=9,10,0,0,724,30396,0,0,1109,65641,0,0,361,8089,0,0;QS=3,0;MQSB=0.920044;MQ0F=0	PL:DP:DV	0,27,241:9:0	0,15,158:5:0	0,15,162:5:0
+17	2509	.	G	T,<X>	0	.	DP=21;I16=8,10,1,0,710,30408,35,1225,1049,62041,60,3600,330,7282,25,625;QS=2.80663,0.19337,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.920044;BQB=1;MQ0F=0	PL:DP:DV	0,27,253,27,253,253:9:0	20,0,122,32,125,150:5:1	0,15,163,15,163,163:5:0
+17	2510	.	A	<X>	0	.	DP=21;I16=10,10,0,0,778,33128,0,0,1138,66482,0,0,352,7754,0,0;QS=3,0;MQSB=0.751477;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,15,174:5:0	0,15,161:5:0
+17	2511	.	G	<X>	0	.	DP=21;I16=10,10,0,0,771,32165,0,0,1138,66482,0,0,344,7558,0,0;QS=3,0;MQSB=0.751477;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,15,161:5:0	0,15,159:5:0
+17	2512	.	C	<X>	0	.	DP=21;I16=10,10,0,0,790,33406,0,0,1138,66482,0,0,336,7386,0,0;QS=3,0;MQSB=0.751477;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,15,175:5:0	0,15,160:5:0
+17	2513	.	T	<X>	0	.	DP=21;I16=10,10,0,0,755,31503,0,0,1138,66482,0,0,327,7189,0,0;QS=3,0;MQSB=0.751477;MQ0F=0	PL:DP:DV	0,30,246:10:0	0,15,180:5:0	0,15,156:5:0
+17	2514	.	G	<X>	0	.	DP=20;I16=9,10,0,0,702,28002,0,0,1109,65641,0,0,319,7017,0,0;QS=3,0;MQSB=0.920044;MQ0F=0	PL:DP:DV	0,27,228:9:0	0,15,171:5:0	0,15,155:5:0
+17	2515	.	T	<X>	0	.	DP=19;I16=8,10,0,0,642,25888,0,0,1049,62041,0,0,312,6868,0,0;QS=3,0;MQSB=0.906029;MQ0F=0	PL:DP:DV	0,24,182:8:0	0,15,172:5:0	0,15,141:5:0
+17	2516	.	G	<X>	0	.	DP=19;I16=8,10,0,0,685,28155,0,0,1049,62041,0,0,303,6641,0,0;QS=3,0;MQSB=0.906029;MQ0F=0	PL:DP:DV	0,24,211:8:0	0,15,175:5:0	0,15,147:5:0
+17	2517	.	A	<X>	0	.	DP=18;I16=8,9,0,0,660,27600,0,0,989,58441,0,0,295,6435,0,0;QS=3,0;MQSB=0.91051;MQ0F=0	PL:DP:DV	0,24,215:8:0	0,12,139:4:0	0,15,161:5:0
+17	2518	.	T	<X>	0	.	DP=17;I16=6,9,0,0,611,26911,0,0,900,54000,0,0,273,6023,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,188:7:0	0,12,144:4:0	0,12,146:4:0
+17	2519	.	C	<X>	0	.	DP=16;I16=7,8,0,0,531,20111,0,0,900,54000,0,0,282,6078,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,175:7:0	0,12,141:4:0	0,12,125:4:0
+17	2520	.	G	<X>	0	.	DP=15;I16=6,8,0,0,501,19731,0,0,840,50400,0,0,277,5923,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,187:7:0	0,12,129:4:0	0,9,101:3:0
+17	2521	.	C	<X>	0	.	DP=15;I16=6,8,0,0,583,25777,0,0,840,50400,0,0,272,5782,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,214:7:0	0,12,149:4:0	0,9,111:3:0
+17	2522	.	A	<X>	0	.	DP=16;I16=6,8,0,0,516,20930,0,0,840,50400,0,0,266,5606,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,173:7:0	0,12,139:4:0	0,9,114:3:0
+17	2523	.	T	<X>	0	.	DP=16;I16=6,9,0,0,588,25538,0,0,900,54000,0,0,270,5546,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,207:7:0	0,15,157:5:0	0,9,117:3:0
+17	2524	.	C	<X>	0	.	DP=16;I16=5,9,0,0,548,23502,0,0,840,50400,0,0,256,5342,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,18,182:6:0	0,15,156:5:0	0,9,112:3:0
+17	2525	.	A	C,<X>	0	.	DP=17;I16=6,9,0,1,550,23138,28,784,900,54000,60,3600,248,5174,12,144;QS=2.86,0.14,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=1;BQB=1;MQ0F=0	PL:DP:DV	0,24,168,24,168,168:8:0	13,0,138,25,141,159:5:1	0,9,117,9,117,117:3:0
+17	2526	.	C	<X>	0	.	DP=18;I16=6,11,0,0,677,28649,0,0,1020,61200,0,0,256,5232,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,229:9:0	0,15,183:5:0	0,9,113:3:0
+17	2527	.	T	<X>	0	.	DP=18;I16=6,11,0,0,674,29286,0,0,1020,61200,0,0,252,5118,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,217:9:0	0,15,183:5:0	0,9,119:3:0
+17	2528	.	G	<X>	0	.	DP=18;I16=6,11,0,0,701,30729,0,0,1020,61200,0,0,248,5028,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,234:9:0	0,15,184:5:0	0,9,119:3:0
+17	2529	.	C	<X>	0	.	DP=18;I16=6,11,0,0,676,28974,0,0,1020,61200,0,0,244,4962,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,228:9:0	0,15,175:5:0	0,9,117:3:0
+17	2530	.	A	<X>	0	.	DP=18;I16=6,10,0,0,624,26620,0,0,960,57600,0,0,223,4631,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,209:9:0	0,12,153:4:0	0,9,116:3:0
+17	2531	.	T	<X>	0	.	DP=17;I16=6,10,0,0,641,27911,0,0,960,57600,0,0,236,4852,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,210:8:0	0,15,175:5:0	0,9,122:3:0
+17	2532	.	T	<X>	0	.	DP=17;I16=6,10,0,0,634,27460,0,0,960,57600,0,0,230,4708,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,212:8:0	0,15,173:5:0	0,9,117:3:0
+17	2533	.	C	<X>	0	.	DP=18;I16=6,11,0,0,614,24196,0,0,1020,61200,0,0,224,4588,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,212:9:0	0,15,159:5:0	0,9,104:3:0
+17	2534	.	C	<X>	0	.	DP=16;I16=5,10,0,0,595,25141,0,0,900,54000,0,0,221,4491,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,202:8:0	0,12,144:4:0	0,9,110:3:0
+17	2535	.	A	<X>	0	.	DP=16;I16=5,10,0,0,617,27711,0,0,900,54000,0,0,218,4416,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,204:8:0	0,12,136:4:0	0,9,123:3:0
+17	2536	.	G	<X>	0	.	DP=15;I16=4,10,0,0,543,23023,0,0,840,50400,0,0,216,4362,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,195:8:0	0,9,102:3:0	0,9,117:3:0
+17	2537	.	C	<X>	0	.	DP=15;I16=4,10,0,0,555,24075,0,0,840,50400,0,0,213,4279,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,195:8:0	0,9,113:3:0	0,9,115:3:0
+17	2538	.	C	<X>	0	.	DP=15;I16=5,9,0,0,510,21070,0,0,840,50400,0,0,211,4217,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,157:7:0	0,9,129:3:0	0,12,126:4:0
+17	2539	.	C	<X>	0	.	DP=15;I16=5,9,0,0,464,16896,0,0,840,50400,0,0,209,4125,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,146:7:0	0,9,122:3:0	0,12,111:4:0
+17	2540	.	G	<X>	0	.	DP=16;I16=6,9,0,0,548,21860,0,0,900,54000,0,0,207,4053,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,189:7:0	0,12,139:4:0	0,12,110:4:0
+17	2541	.	G	<X>	0	.	DP=15;I16=5,9,0,0,535,22527,0,0,840,50400,0,0,207,4001,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,170:7:0	0,9,117:3:0	0,12,140:4:0
+17	2542	.	T	<X>	0	.	DP=15;I16=4,9,0,0,527,23207,0,0,780,46800,0,0,203,3953,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,183:7:0	0,9,125:3:0	0,9,109:3:0
+17	2543	.	G	<X>	0	.	DP=15;I16=5,9,0,0,540,23004,0,0,840,50400,0,0,207,3957,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,196:7:0	0,9,117:3:0	0,12,117:4:0
+17	2544	.	A	<X>	0	.	DP=16;I16=6,9,0,0,569,24139,0,0,900,54000,0,0,207,3965,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,202:8:0	0,9,119:3:0	0,12,132:4:0
+17	2545	.	C	<X>	0	.	DP=16;I16=6,9,0,0,583,24657,0,0,900,54000,0,0,208,3994,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,217:8:0	0,9,118:3:0	0,12,130:4:0
+17	2546	.	A	<X>	0	.	DP=16;I16=6,9,0,0,608,27290,0,0,900,54000,0,0,209,4045,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,206:8:0	0,9,133:3:0	0,12,144:4:0
+17	2547	.	G	<X>	0	.	DP=16;I16=6,9,0,0,597,26215,0,0,900,54000,0,0,211,4117,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,191:7:0	0,9,131:3:0	0,15,150:5:0
+17	2548	.	A	<X>	0	.	DP=16;I16=6,9,0,0,632,28806,0,0,900,54000,0,0,214,4210,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,196:7:0	0,9,131:3:0	0,15,171:5:0
+17	2549	.	G	<X>	0	.	DP=16;I16=6,9,0,0,594,25254,0,0,900,54000,0,0,217,4325,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,180:7:0	0,9,132:3:0	0,15,160:5:0
+17	2550	.	T	<X>	0	.	DP=16;I16=6,9,0,0,572,24134,0,0,900,54000,0,0,219,4413,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,182:7:0	0,9,122:3:0	0,15,148:5:0
+17	2551	.	G	<X>	0	.	DP=16;I16=6,9,0,0,578,24606,0,0,900,54000,0,0,220,4474,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,181:7:0	0,9,131:3:0	0,15,151:5:0
+17	2552	.	A	<X>	0	.	DP=15;I16=6,8,0,0,585,26419,0,0,840,50400,0,0,221,4505,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,18,178:6:0	0,9,129:3:0	0,15,168:5:0
+17	2553	.	G	<X>	0	.	DP=15;I16=6,8,0,0,528,21944,0,0,840,50400,0,0,222,4554,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,18,170:6:0	0,9,117:3:0	0,15,142:5:0
+17	2554	.	T	<X>	0	.	DP=15;I16=6,8,0,0,543,23015,0,0,840,50400,0,0,223,4621,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,18,156:6:0	0,9,129:3:0	0,15,160:5:0
+17	2555	.	C	<X>	0	.	DP=15;I16=6,8,0,0,566,24416,0,0,840,50400,0,0,224,4706,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,18,173:6:0	0,9,131:3:0	0,15,159:5:0
+17	2556	.	A	<X>	0	.	DP=14;I16=6,7,0,0,487,20095,0,0,780,46800,0,0,226,4808,0,0;QS=3,0;MQSB=0.961166;MQ0F=0	PL:DP:DV	0,15,141:5:0	0,9,125:3:0	0,15,146:5:0
+17	2557	.	C	<X>	0	.	DP=13;I16=5,8,0,0,471,17481,0,0,780,46800,0,0,249,5325,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,15,161:5:0	0,9,96:3:0	0,15,151:5:0
+17	2558	.	T	<X>	0	.	DP=14;I16=5,9,0,0,535,20597,0,0,840,50400,0,0,251,5417,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,18,173:6:0	0,9,99:3:0	0,15,174:5:0
+17	2559	.	G	<X>	0	.	DP=14;I16=5,9,0,0,509,18693,0,0,840,50400,0,0,253,5475,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,18,172:6:0	0,9,98:3:0	0,15,156:5:0
+17	2560	.	T	<X>	0	.	DP=14;I16=5,9,0,0,489,17587,0,0,840,50400,0,0,255,5549,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,18,160:6:0	0,9,106:3:0	0,15,144:5:0
+17	2561	.	C	<X>	0	.	DP=14;I16=5,9,0,0,489,17477,0,0,840,50400,0,0,257,5639,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,18,164:6:0	0,9,96:3:0	0,15,153:5:0
+17	2562	.	T	<X>	0	.	DP=13;I16=5,8,0,0,460,17016,0,0,780,46800,0,0,260,5744,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,15,139:5:0	0,9,99:3:0	0,15,167:5:0
+17	2563	.	C	<X>	0	.	DP=14;I16=5,8,0,0,433,15133,0,0,780,46800,0,0,263,5863,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,15,149:5:0	0,9,83:3:0	0,15,142:5:0
+17	2564	.	A	G,<X>	0	.	DP=15;I16=1,4,4,5,174,6124,316,11352,300,18000,540,32400,61,1311,184,4034;QS=0.988263,2.01174,0;VDB=0.690812;SGB=-3.20711;RPB=0.197899;MQB=1;MQSB=1;BQB=0.965069;MQ0F=0	PL:DP:DV	88,0,78,98,87,171:6:3	57,0,56,63,62,117:4:2	124,12,0,124,12,124:4:4
+17	2565	.	A	<X>	0	.	DP=15;I16=6,9,0,0,562,21216,0,0,900,54000,0,0,274,6076,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,18,178:6:0	0,12,134:4:0	0,15,166:5:0
+17	2566	.	A	<X>	0	.	DP=15;I16=6,9,0,0,545,20019,0,0,900,54000,0,0,276,6098,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,18,181:6:0	0,12,120:4:0	0,15,162:5:0
+17	2567	.	A	<X>	0	.	DP=16;I16=7,9,0,0,580,21342,0,0,960,57600,0,0,278,6136,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,18,177:6:0	0,15,151:5:0	0,15,166:5:0
+17	2568	.	A	<X>	0	.	DP=16;I16=7,8,0,0,555,20795,0,0,900,54000,0,0,256,5566,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,18,180:6:0	0,12,132:4:0	0,15,167:5:0
+17	2569	.	A	<X>	0	.	DP=17;I16=7,10,0,0,661,25943,0,0,1020,61200,0,0,284,6264,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,213:7:0	0,15,163:5:0	0,15,172:5:0
+17	2570	.	G	<X>	0	.	DP=18;I16=8,10,0,0,664,24968,0,0,1080,64800,0,0,287,6305,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,213:7:0	0,15,152:5:0	0,18,176:6:0
+17	2571	.	A	<X>	0	.	DP=18;I16=8,10,0,0,618,21870,0,0,1080,64800,0,0,291,6365,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,195:7:0	0,15,155:5:0	0,18,155:6:0
+17	2572	.	A	<X>	0	.	DP=18;I16=8,10,0,0,631,22829,0,0,1080,64800,0,0,295,6445,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,194:7:0	0,15,150:5:0	0,18,173:6:0
+17	2573	.	A	<X>	0	.	DP=18;I16=8,10,0,0,690,26830,0,0,1080,64800,0,0,298,6494,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,210:7:0	0,15,170:5:0	0,18,183:6:0
+17	2574	.	G	<X>	0	.	DP=18;I16=8,10,0,0,664,24884,0,0,1080,64800,0,0,301,6561,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,211:7:0	0,15,152:5:0	0,18,176:6:0
+17	2575	.	G	<X>	0	.	DP=18;I16=8,10,0,0,642,23904,0,0,1080,64800,0,0,305,6645,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,242:8:0	0,15,145:5:0	0,15,140:5:0
+17	2576	.	A	<X>	0	.	DP=18;I16=7,10,0,0,595,21311,0,0,1020,61200,0,0,285,6121,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,210:8:0	0,15,153:5:0	0,12,131:4:0
+17	2577	.	A	<X>	0	.	DP=19;I16=8,10,0,0,682,26398,0,0,1080,64800,0,0,290,6240,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,244:8:0	0,15,161:5:0	0,15,155:5:0
+17	2578	.	G	<X>	0	.	DP=18;I16=9,9,0,0,643,24115,0,0,1080,64800,0,0,322,7002,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,249:8:0	0,12,114:4:0	0,18,161:6:0
+17	2579	.	A	<X>	0	.	DP=18;I16=9,8,0,0,634,23870,0,0,1020,61200,0,0,304,6532,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,229:8:0	0,9,110:3:0	0,18,176:6:0
+17	2580	.	A	<X>	0	.	DP=18;I16=9,9,0,0,629,22593,0,0,1080,64800,0,0,336,7330,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,223:8:0	0,12,117:4:0	0,18,169:6:0
+17	2581	.	A	<X>	0	.	DP=19;I16=10,9,0,0,691,25669,0,0,1140,68400,0,0,343,7521,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,255:9:0	0,12,133:4:0	0,18,166:6:0
+17	2582	.	T	<X>	0	.	DP=19;I16=10,9,0,0,674,24218,0,0,1140,68400,0,0,350,7682,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,235:9:0	0,12,138:4:0	0,18,168:6:0
+17	2583	.	A	<X>	0	.	DP=19;I16=10,9,0,0,693,25465,0,0,1140,68400,0,0,357,7865,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,247:9:0	0,12,126:4:0	0,18,178:6:0
+17	2584	.	A	<X>	0	.	DP=19;I16=10,9,0,0,702,26340,0,0,1140,68400,0,0,363,8019,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,243:9:0	0,12,134:4:0	0,18,187:6:0
+17	2585	.	A	<X>	0	.	DP=19;I16=9,9,0,0,690,26700,0,0,1080,64800,0,0,350,7818,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,250:9:0	0,9,114:3:0	0,18,190:6:0
+17	2586	.	G	<X>	0	.	DP=19;I16=10,9,0,0,714,27314,0,0,1140,68400,0,0,373,8283,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,255:9:0	0,12,127:4:0	0,18,176:6:0
+17	2587	.	A	<X>	0	.	DP=20;I16=9,9,0,0,665,24781,0,0,1049,62041,0,0,343,7717,0,0;QS=3,0;MQSB=0.924089;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,12,137:4:0	0,12,136:4:0
+17	2588	.	A	<X>	0	.	DP=21;I16=12,9,0,0,737,26531,0,0,1229,72841,0,0,384,8620,0,0;QS=3,0;MQSB=0.950149;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,138:4:0	0,18,162:6:0
+17	2589	.	A	<X>	0	.	DP=22;I16=13,9,0,0,780,28412,0,0,1289,76441,0,0,390,8770,0,0;QS=3,0;MQSB=0.955854;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,142:4:0	0,18,170:6:0
+17	2590	.	A	<X>	0	.	DP=22;I16=13,9,0,0,774,28352,0,0,1289,76441,0,0,396,8894,0,0;QS=3,0;MQSB=0.955854;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,135:4:0	0,18,160:6:0
+17	2591	.	C	<X>	0	.	DP=21;I16=13,8,0,0,765,28617,0,0,1229,72841,0,0,403,9041,0,0;QS=3,0;MQSB=0.95891;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,136:4:0	0,15,136:5:0
+17	2592	.	A	<X>	0	.	DP=21;I16=13,8,0,0,763,28325,0,0,1229,72841,0,0,410,9210,0,0;QS=3,0;MQSB=0.95891;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,140:4:0	0,15,139:5:0
+17	2593	.	A	<X>	0	.	DP=21;I16=13,8,0,0,754,27888,0,0,1229,72841,0,0,416,9350,0,0;QS=3,0;MQSB=0.95891;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,141:4:0	0,15,147:5:0
+17	2594	.	A	<X>	0	.	DP=21;I16=13,8,0,0,775,29179,0,0,1229,72841,0,0,422,9510,0,0;QS=3,0;MQSB=0.95891;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,130:4:0	0,15,153:5:0
+17	2595	.	T	<X>	0	.	DP=22;I16=14,8,0,0,766,27472,0,0,1289,76441,0,0,427,9639,0,0;QS=3,0;MQSB=0.963419;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,119:4:0	0,15,143:5:0
+17	2596	.	A	<X>	0	.	DP=22;I16=13,8,0,0,751,27409,0,0,1229,72841,0,0,407,9111,0,0;QS=3,0;MQSB=0.95891;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,123:4:0	0,12,129:4:0
+17	2597	.	A	<X>	0	.	DP=22;I16=14,8,0,0,811,30147,0,0,1289,76441,0,0,437,9851,0,0;QS=3,0;MQSB=0.963419;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,145:4:0	0,15,145:5:0
+17	2598	.	A	<X>	0	.	DP=22;I16=14,8,0,0,817,30915,0,0,1289,76441,0,0,442,9984,0,0;QS=3,0;MQSB=0.963419;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,136:4:0	0,15,159:5:0
+17	2599	.	A	<X>	0	.	DP=22;I16=14,8,0,0,800,29912,0,0,1289,76441,0,0,447,10135,0,0;QS=3,0;MQSB=0.963419;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,126:4:0	0,15,150:5:0
+17	2600	.	A	<X>	0	.	DP=22;I16=14,8,0,0,784,29138,0,0,1289,76441,0,0,451,10255,0,0;QS=3,0;MQSB=0.963419;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,113:4:0	0,15,150:5:0
+17	2601	.	T	<X>	0	.	DP=22;I16=14,8,0,0,770,27820,0,0,1289,76441,0,0,454,10344,0,0;QS=3,0;MQSB=0.963419;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,118:4:0	0,15,142:5:0
+17	2602	.	A	<X>	0	.	DP=23;I16=15,8,0,0,825,29971,0,0,1349,80041,0,0,457,10451,0,0;QS=3,0;MQSB=0.967216;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,143:4:0	0,18,154:6:0
+17	2603	.	A	<X>	0	.	DP=23;I16=15,8,0,0,862,32840,0,0,1349,80041,0,0,460,10526,0,0;QS=3,0;MQSB=0.967216;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,138:4:0	0,18,172:6:0
+17	2604	.	T	<X>	0	.	DP=23;I16=15,8,0,0,822,29902,0,0,1349,80041,0,0,463,10619,0,0;QS=3,0;MQSB=0.967216;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,129:4:0	0,18,154:6:0
+17	2605	.	A	<X>	0	.	DP=23;I16=14,8,0,0,845,32617,0,0,1289,76441,0,0,441,10105,0,0;QS=3,0;MQSB=0.963419;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,143:4:0	0,15,157:5:0
+17	2606	.	G	<X>	0	.	DP=23;I16=14,8,0,0,812,30796,0,0,1289,76441,0,0,444,10234,0,0;QS=3,0;MQSB=0.963419;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,129:4:0	0,15,142:5:0
+17	2607	.	T	<X>	0	.	DP=22;I16=15,7,0,0,782,28440,0,0,1289,76441,0,0,472,10954,0,0;QS=3,0;MQSB=0.970024;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,119:4:0	0,15,132:5:0
+17	2608	.	G	<X>	0	.	DP=22;I16=15,7,0,0,851,33169,0,0,1289,76441,0,0,474,11014,0,0;QS=3,0;MQSB=0.970024;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,132:4:0	0,15,127:5:0
+17	2609	.	C	<X>	0	.	DP=22;I16=15,7,0,0,796,29454,0,0,1289,76441,0,0,475,11041,0,0;QS=3,0;MQSB=0.970024;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,137:4:0	0,15,124:5:0
+17	2610	.	A	<X>	0	.	DP=22;I16=15,7,0,0,830,31684,0,0,1289,76441,0,0,476,11086,0,0;QS=3,0;MQSB=0.970024;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,146:4:0	0,15,121:5:0
+17	2611	.	G	<X>	0	.	DP=22;I16=15,7,0,0,824,32048,0,0,1289,76441,0,0,477,11149,0,0;QS=3,0;MQSB=0.970024;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,129:4:0	0,15,122:5:0
+17	2612	.	A	<X>	0	.	DP=22;I16=14,7,0,0,771,29035,0,0,1229,72841,0,0,453,10605,0,0;QS=3,0;MQSB=0.966484;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,130:4:0	0,12,117:4:0
+17	2613	.	C	<X>	0	.	DP=22;I16=15,7,0,0,832,31926,0,0,1289,76441,0,0,478,11278,0,0;QS=3,0;MQSB=0.970024;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,138:4:0	0,15,120:5:0
+17	2614	.	A	<X>	0	.	DP=21;I16=15,6,0,0,791,30065,0,0,1229,72841,0,0,477,11241,0,0;QS=3,0;MQSB=0.973096;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,9,110:3:0	0,15,140:5:0
+17	2615	.	A	<X>	0	.	DP=21;I16=15,6,0,0,777,29101,0,0,1229,72841,0,0,475,11167,0,0;QS=3,0;MQSB=0.973096;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,9,99:3:0	0,15,142:5:0
+17	2616	.	A	<X>	0	.	DP=21;I16=15,6,0,0,734,26922,0,0,1229,72841,0,0,472,11056,0,0;QS=3,0;MQSB=0.973096;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,9,90:3:0	0,15,144:5:0
+17	2617	.	A	<X>	0	.	DP=21;I16=15,6,0,0,810,31654,0,0,1229,72841,0,0,469,10959,0,0;QS=3,0;MQSB=0.973096;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,9,95:3:0	0,15,140:5:0
+17	2618	.	G	<X>	0	.	DP=23;I16=16,6,0,0,863,34219,0,0,1289,76441,0,0,441,10251,0,0;QS=3,0;MQSB=0.97584;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,6,74:2:0	0,15,132:5:0
+17	2619	.	G	<X>	0	.	DP=23;I16=16,6,0,0,807,30109,0,0,1289,76441,0,0,439,10135,0,0;QS=3,0;MQSB=0.97584;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,6,66:2:0	0,15,127:5:0
+17	2620	.	C	<X>	0	.	DP=23;I16=16,7,0,0,780,28242,0,0,1349,80041,0,0,462,10664,0,0;QS=3,0;MQSB=0.973027;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,9,87:3:0	0,15,115:5:0
+17	2621	.	C	<X>	0	.	DP=23;I16=16,7,0,0,860,32944,0,0,1349,80041,0,0,459,10537,0,0;QS=3,0;MQSB=0.973027;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,9,112:3:0	0,15,124:5:0
+17	2622	.	T	<X>	0	.	DP=24;I16=17,7,0,0,908,35474,0,0,1409,83641,0,0,456,10428,0,0;QS=3,0;MQSB=0.975597;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,115:3:0	0,15,134:5:0
+17	2623	.	T	<X>	0	.	DP=24;I16=17,7,0,0,850,30978,0,0,1409,83641,0,0,453,10289,0,0;QS=3,0;MQSB=0.975597;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,114:3:0	0,15,129:5:0
+17	2624	.	G	<X>	0	.	DP=24;I16=17,7,0,0,882,33332,0,0,1409,83641,0,0,450,10172,0,0;QS=3,0;MQSB=0.975597;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,101:3:0	0,15,133:5:0
+17	2625	.	A	<X>	0	.	DP=23;I16=17,6,0,0,855,32593,0,0,1349,80041,0,0,448,10076,0,0;QS=3,0;MQSB=0.978183;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,9,114:3:0	0,15,135:5:0
+17	2626	.	C	<X>	0	.	DP=23;I16=17,6,0,0,847,31625,0,0,1349,80041,0,0,446,10000,0,0;QS=3,0;MQSB=0.978183;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,9,100:3:0	0,15,122:5:0
+17	2627	.	C	<X>	0	.	DP=23;I16=17,6,0,0,863,32865,0,0,1349,80041,0,0,444,9944,0,0;QS=3,0;MQSB=0.978183;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,9,104:3:0	0,15,129:5:0
+17	2628	.	C	<X>	0	.	DP=24;I16=17,6,0,0,793,28559,0,0,1349,80041,0,0,431,9757,0,0;QS=3,0;MQSB=0.978183;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,9,95:3:0	0,15,127:5:0
+17	2629	.	A	<X>	0	.	DP=24;I16=18,6,0,0,893,33537,0,0,1409,83641,0,0,439,9789,0,0;QS=3,0;MQSB=0.980199;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,9,101:3:0	0,18,148:6:0
+17	2630	.	T	<X>	0	.	DP=24;I16=17,6,0,0,836,31094,0,0,1380,82800,0,0,412,9116,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,9,112:3:0	0,18,140:6:0
+17	2631	.	C	<X>	0	.	DP=24;I16=18,6,0,0,900,34378,0,0,1409,83641,0,0,435,9713,0,0;QS=3,0;MQSB=0.980199;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,9,104:3:0	0,18,142:6:0
+17	2632	.	T	<X>	0	.	DP=24;I16=18,6,0,0,937,37097,0,0,1409,83641,0,0,433,9705,0,0;QS=3,0;MQSB=0.980199;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,9,113:3:0	0,18,164:6:0
+17	2633	.	A	<X>	0	.	DP=23;I16=18,5,0,0,801,28913,0,0,1349,80041,0,0,431,9667,0,0;QS=3,0;MQSB=0.982789;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,9,95:3:0	0,18,148:6:0
+17	2634	.	G	<X>	0	.	DP=23;I16=19,3,0,0,861,34125,0,0,1289,76441,0,0,405,9023,0,0;QS=3,0;MQSB=0.989755;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,6,74:2:0	0,18,149:6:0
+17	2635	.	C	<X>	0	.	DP=23;I16=19,4,0,0,848,32154,0,0,1349,80041,0,0,429,9599,0,0;QS=3,0;MQSB=0.986928;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,9,107:3:0	0,18,148:6:0
+17	2636	.	T	<X>	0	.	DP=24;I16=19,4,0,0,871,33973,0,0,1349,80041,0,0,428,9572,0,0;QS=3,0;MQSB=0.986928;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,9,98:3:0	0,18,160:6:0
+17	2637	.	T	<X>	0	.	DP=24;I16=19,5,0,0,871,32073,0,0,1409,83641,0,0,428,9568,0,0;QS=3,0;MQSB=0.984335;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,9,111:3:0	0,18,144:6:0
+17	2638	.	T	<X>	0	.	DP=24;I16=19,5,0,0,821,28851,0,0,1409,83641,0,0,428,9588,0,0;QS=3,0;MQSB=0.984335;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,9,103:3:0	0,18,135:6:0
+17	2639	.	G	<X>	0	.	DP=24;I16=18,6,0,0,842,30840,0,0,1409,83641,0,0,428,9582,0,0;QS=3,0;MQSB=0.980199;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,106:3:0	0,15,125:5:0
+17	2640	.	G	<X>	0	.	DP=24;I16=17,6,0,0,749,25957,0,0,1380,82800,0,0,404,8976,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,9,84:3:0	0,15,117:5:0
+17	2641	.	C	<X>	0	.	DP=23;I16=17,6,0,0,834,31792,0,0,1349,80041,0,0,431,9645,0,0;QS=3,0;MQSB=0.978183;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,61:2:0	0,15,129:5:0
+17	2642	.	C	<X>	0	.	DP=23;I16=17,6,0,0,809,30033,0,0,1349,80041,0,0,433,9713,0,0;QS=3,0;MQSB=0.978183;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,58:2:0	0,15,131:5:0
+17	2643	.	C	<X>	0	.	DP=23;I16=17,6,0,0,856,33004,0,0,1349,80041,0,0,434,9756,0,0;QS=3,0;MQSB=0.978183;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,57:2:0	0,15,133:5:0
+17	2644	.	T	<X>	0	.	DP=22;I16=16,5,0,0,805,31419,0,0,1229,72841,0,0,428,9648,0,0;QS=3,0;MQSB=0.978919;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,6,73:2:0	0,15,143:5:0
+17	2645	.	C	<X>	0	.	DP=22;I16=15,6,0,0,823,32499,0,0,1229,72841,0,0,415,9323,0,0;QS=3,0;MQSB=0.973096;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,6,78:2:0	0,12,122:4:0
+17	2646	.	A	<X>	0	.	DP=22;I16=16,6,0,0,826,31566,0,0,1289,76441,0,0,430,9524,0,0;QS=3,0;MQSB=0.97584;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,6,79:2:0	0,15,129:5:0
+17	2647	.	G	<X>	0	.	DP=22;I16=16,6,0,0,803,30643,0,0,1289,76441,0,0,428,9460,0,0;QS=3,0;MQSB=0.97584;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,6,77:2:0	0,15,129:5:0
+17	2648	.	C	<X>	0	.	DP=21;I16=15,6,0,0,811,31709,0,0,1229,72841,0,0,426,9368,0,0;QS=3,0;MQSB=0.973096;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,6,80:2:0	0,12,118:4:0
+17	2649	.	A	<X>	0	.	DP=23;I16=16,6,0,0,789,29215,0,0,1258,73682,0,0,414,9196,0,0;QS=3,0;MQSB=0.934321;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,9,93:3:0	0,12,105:4:0
+17	2650	.	T	<X>	0	.	DP=23;I16=16,7,0,0,856,32340,0,0,1318,77282,0,0,423,9197,0,0;QS=3,0;MQSB=0.955805;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,103:3:0	0,12,118:4:0
+17	2651	.	C	<X>	0	.	DP=23;I16=16,7,0,0,871,33599,0,0,1318,77282,0,0,422,9124,0,0;QS=3,0;MQSB=0.955805;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,95:3:0	0,12,121:4:0
+17	2652	.	A	<X>	0	.	DP=23;I16=16,7,0,0,820,30324,0,0,1318,77282,0,0,421,9077,0,0;QS=3,0;MQSB=0.955805;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,87:3:0	0,12,126:4:0
+17	2653	.	A	<X>	0	.	DP=23;I16=15,6,0,0,759,28489,0,0,1198,70082,0,0,389,8395,0,0;QS=3,0;MQSB=0.940481;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,73:2:0	0,9,109:3:0
+17	2654	.	C	<X>	0	.	DP=23;I16=16,7,0,0,836,31006,0,0,1318,77282,0,0,393,8385,0,0;QS=3,0;MQSB=0.955805;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,9,88:3:0	0,9,99:3:0
+17	2655	.	C	<X>	0	.	DP=23;I16=16,7,0,0,774,27190,0,0,1318,77282,0,0,392,8364,0,0;QS=3,0;MQSB=0.955805;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,9,83:3:0	0,9,95:3:0
+17	2656	.	G	<X>	0	.	DP=24;I16=17,7,0,0,781,25689,0,0,1378,80882,0,0,390,8320,0,0;QS=3,0;MQSB=0.95083;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,12,116:4:0	0,9,74:3:0
+17	2657	.	C	<X>	0	.	DP=24;I16=17,6,0,0,871,33435,0,0,1349,80041,0,0,381,8241,0,0;QS=3,0;MQSB=0.978183;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,9,98:3:0	0,9,99:3:0
+17	2658	.	T	<X>	0	.	DP=23;I16=17,6,0,0,897,35255,0,0,1318,77282,0,0,389,8319,0,0;QS=3,0;MQSB=0.92854;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,12,133:4:0	0,9,107:3:0
+17	2659	.	A	<X>	0	.	DP=23;I16=17,6,0,0,817,29729,0,0,1318,77282,0,0,389,8361,0,0;QS=3,0;MQSB=0.92854;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,12,120:4:0	0,9,93:3:0
+17	2660	.	G	<X>	0	.	DP=23;I16=17,6,0,0,900,35462,0,0,1318,77282,0,0,389,8379,0,0;QS=3,0;MQSB=0.92854;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,12,126:4:0	0,9,94:3:0
+17	2661	.	A	<X>	0	.	DP=24;I16=18,6,0,0,871,32185,0,0,1378,80882,0,0,390,8422,0,0;QS=3,0;MQSB=0.923116;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,12,127:4:0	0,9,104:3:0
+17	2662	.	T	<X>	0	.	DP=24;I16=17,6,0,0,836,30812,0,0,1349,80041,0,0,366,7816,0,0;QS=3,0;MQSB=0.83771;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,12,122:4:0	0,9,99:3:0
+17	2663	.	A	<X>	0	.	DP=24;I16=17,6,0,0,827,30583,0,0,1318,77282,0,0,389,8341,0,0;QS=3,0;MQSB=0.92854;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,12,104:4:0	0,9,101:3:0
+17	2664	.	C	<X>	0	.	DP=23;I16=17,6,0,0,787,28083,0,0,1318,77282,0,0,388,8270,0,0;QS=3,0;MQSB=0.92854;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,12,107:4:0	0,9,91:3:0
+17	2665	.	G	<X>	0	.	DP=23;I16=17,6,0,0,728,23290,0,0,1318,77282,0,0,386,8178,0,0;QS=3,0;MQSB=0.92854;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,12,112:4:0	0,9,78:3:0
+17	2666	.	T	<X>	0	.	DP=23;I16=17,5,0,0,799,29273,0,0,1289,76441,0,0,367,7825,0,0;QS=3,0;MQSB=0.981001;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,105:3:0	0,9,94:3:0
+17	2667	.	C	<X>	0	.	DP=23;I16=16,5,0,0,792,30190,0,0,1260,75600,0,0,345,7393,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,9,96:3:0	0,9,98:3:0
+17	2668	.	C	<X>	0	.	DP=24;I16=18,6,0,0,832,29692,0,0,1378,80882,0,0,381,8069,0,0;QS=3,0;MQSB=0.923116;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,12,107:4:0	0,9,95:3:0
+17	2669	.	C	<X>	0	.	DP=23;I16=18,5,0,0,829,30953,0,0,1318,77282,0,0,383,8087,0,0;QS=3,0;MQSB=0.889264;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,12,120:4:0	0,9,88:3:0
+17	2670	.	T	<X>	0	.	DP=23;I16=17,5,0,0,841,32669,0,0,1289,76441,0,0,368,7828,0,0;QS=3,0;MQSB=0.801124;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,12,131:4:0	0,9,100:3:0
+17	2671	.	C	<X>	0	.	DP=22;I16=17,5,0,0,842,32448,0,0,1258,73682,0,0,386,8110,0,0;QS=3,0;MQSB=0.895399;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,12,128:4:0	0,6,70:2:0
+17	2672	.	C	<X>	0	.	DP=22;I16=17,5,0,0,808,30180,0,0,1258,73682,0,0,388,8164,0,0;QS=3,0;MQSB=0.895399;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,12,129:4:0	0,6,75:2:0
+17	2673	.	C	<X>	0	.	DP=22;I16=17,5,0,0,842,32528,0,0,1258,73682,0,0,390,8246,0,0;QS=3,0;MQSB=0.895399;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,12,133:4:0	0,6,75:2:0
+17	2674	.	T	<X>	0	.	DP=23;I16=17,6,0,0,860,33242,0,0,1318,77282,0,0,392,8356,0,0;QS=3,0;MQSB=0.92854;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,12,142:4:0	0,6,79:2:0
+17	2675	.	T	<X>	0	.	DP=22;I16=16,6,0,0,756,26986,0,0,1258,73682,0,0,394,8392,0,0;QS=3,0;MQSB=0.934321;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,12,134:4:0	0,6,74:2:0
+17	2676	.	T	<X>	0	.	DP=22;I16=16,6,0,0,774,28022,0,0,1258,73682,0,0,396,8452,0,0;QS=3,0;MQSB=0.934321;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,12,135:4:0	0,6,75:2:0
+17	2677	.	C	<X>	0	.	DP=22;I16=16,6,0,0,866,34444,0,0,1258,73682,0,0,398,8536,0,0;QS=3,0;MQSB=0.934321;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,12,131:4:0	0,6,77:2:0
+17	2678	.	T	<X>	0	.	DP=22;I16=16,5,0,0,818,32216,0,0,1229,72841,0,0,374,7970,0,0;QS=3,0;MQSB=0.978919;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,111:3:0	0,6,80:2:0
+17	2679	.	T	<X>	0	.	DP=22;I16=16,6,0,0,808,29912,0,0,1258,73682,0,0,400,8680,0,0;QS=3,0;MQSB=0.934321;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,12,137:4:0	0,6,75:2:0
+17	2680	.	C	<X>	0	.	DP=23;I16=16,7,0,0,873,33605,0,0,1318,77282,0,0,400,8740,0,0;QS=3,0;MQSB=0.955805;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,12,131:4:0	0,6,70:2:0
+17	2681	.	T	<X>	0	.	DP=22;I16=15,7,0,0,820,31248,0,0,1258,73682,0,0,402,8824,0,0;QS=3,0;MQSB=0.961028;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,12,133:4:0	0,6,75:2:0
+17	2682	.	G	<X>	0	.	DP=22;I16=15,7,0,0,831,31865,0,0,1258,73682,0,0,403,8881,0,0;QS=3,0;MQSB=0.961028;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,12,135:4:0	0,6,64:2:0
+17	2683	.	G	<X>	0	.	DP=22;I16=13,6,0,0,702,26368,0,0,1109,65641,0,0,394,8926,0,0;QS=3,0;MQSB=0.850016;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,136:4:0	0,6,53:2:0
+17	2684	.	G	<X>	0	.	DP=22;I16=14,7,0,0,754,27678,0,0,1229,72841,0,0,403,9057,0,0;QS=3,0;MQSB=0.872525;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,12,128:4:0	0,6,62:2:0
+17	2685	.	G	<X>	0	.	DP=22;I16=15,7,0,0,736,25916,0,0,1258,73682,0,0,406,9184,0,0;QS=3,0;MQSB=0.961028;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,12,130:4:0	0,6,45:2:0
+17	2686	.	C	<X>	0	.	DP=22;I16=15,7,0,0,803,29933,0,0,1258,73682,0,0,406,9278,0,0;QS=3,0;MQSB=0.961028;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,12,134:4:0	0,6,68:2:0
+17	2687	.	A	<X>	0	.	DP=21;I16=13,7,0,0,716,26356,0,0,1169,69241,0,0,406,9340,0,0;QS=3,0;MQSB=0.875769;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,136:4:0	0,6,61:2:0
+17	2688	.	C	<X>	0	.	DP=20;I16=13,7,0,0,750,28308,0,0,1169,69241,0,0,407,9417,0,0;QS=3,0;MQSB=0.875769;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,134:4:0	0,6,66:2:0
+17	2689	.	A	<X>	0	.	DP=19;I16=12,7,0,0,741,29105,0,0,1109,65641,0,0,409,9507,0,0;QS=3,0;MQSB=0.879351;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,140:4:0	0,6,73:2:0
+17	2690	.	G	<X>	0	.	DP=20;I16=12,8,0,0,751,28929,0,0,1169,69241,0,0,411,9609,0,0;QS=3,0;MQSB=0.898397;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,135:4:0	0,6,61:2:0
+17	2691	.	G	<X>	0	.	DP=20;I16=12,7,0,0,682,25006,0,0,1109,65641,0,0,403,9603,0,0;QS=3,0;MQSB=0.879351;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,132:4:0	0,6,63:2:0
+17	2692	.	T	<X>	0	.	DP=20;I16=12,8,0,0,648,21758,0,0,1169,69241,0,0,417,9853,0,0;QS=3,0;MQSB=0.898397;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,125:4:0	0,6,72:2:0
+17	2693	.	C	<X>	0	.	DP=20;I16=12,8,0,0,779,30645,0,0,1169,69241,0,0,418,9898,0,0;QS=3,0;MQSB=0.898397;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,130:4:0	0,6,70:2:0
+17	2694	.	A	<X>	0	.	DP=21;I16=13,8,0,0,723,25649,0,0,1229,72841,0,0,417,9859,0,0;QS=3,0;MQSB=0.895122;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,12,126:4:0	0,6,73:2:0
+17	2695	.	C	<X>	0	.	DP=20;I16=12,8,0,0,757,28835,0,0,1169,69241,0,0,418,9834,0,0;QS=3,0;MQSB=0.898397;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,130:4:0	0,6,63:2:0
+17	2696	.	A	<X>	0	.	DP=20;I16=12,8,0,0,733,27357,0,0,1169,69241,0,0,419,9823,0,0;QS=3,0;MQSB=0.898397;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,130:4:0	0,6,69:2:0
+17	2697	.	C	<X>	0	.	DP=20;I16=12,8,0,0,738,27604,0,0,1169,69241,0,0,419,9777,0,0;QS=3,0;MQSB=0.898397;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,128:4:0	0,6,66:2:0
+17	2698	.	T	<X>	0	.	DP=21;I16=12,8,0,0,788,31268,0,0,1169,69241,0,0,419,9747,0,0;QS=3,0;MQSB=0.898397;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,144:4:0	0,6,77:2:0
+17	2699	.	C	<X>	0	.	DP=22;I16=13,9,0,0,864,34148,0,0,1258,73682,0,0,443,10309,0,0;QS=3,0;MQSB=0.686045;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,12,135:4:0	0,9,98:3:0
+17	2700	.	T	<X>	0	.	DP=22;I16=13,9,0,0,850,33296,0,0,1258,73682,0,0,444,10310,0,0;QS=3,0;MQSB=0.686045;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,12,141:4:0	0,9,105:3:0
+17	2701	.	C	<X>	0	.	DP=22;I16=13,9,0,0,863,34157,0,0,1258,73682,0,0,444,10278,0,0;QS=3,0;MQSB=0.686045;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,12,140:4:0	0,9,94:3:0
+17	2702	.	T	<X>	0	.	DP=22;I16=13,9,0,0,837,32525,0,0,1258,73682,0,0,444,10262,0,0;QS=3,0;MQSB=0.686045;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,12,143:4:0	0,9,83:3:0
+17	2703	.	T	<X>	0	.	DP=21;I16=12,8,0,0,717,25881,0,0,1169,69241,0,0,420,9636,0,0;QS=3,0;MQSB=0.898397;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,12,130:4:0	0,3,32:1:0
+17	2704	.	C	<X>	0	.	DP=21;I16=12,9,0,0,794,30766,0,0,1198,70082,0,0,445,10225,0,0;QS=3,0;MQSB=0.695144;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,12,137:4:0	0,6,55:2:0
+17	2705	.	C	<X>	0	.	DP=21;I16=12,9,0,0,809,31649,0,0,1198,70082,0,0,445,10205,0,0;QS=3,0;MQSB=0.695144;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,12,136:4:0	0,6,56:2:0
+17	2706	.	A	<X>	0	.	DP=22;I16=12,10,0,0,820,31386,0,0,1258,73682,0,0,444,10150,0,0;QS=3,0;MQSB=0.731218;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,12,141:4:0	0,6,70:2:0
+17	2707	.	G	<X>	0	.	DP=22;I16=12,10,0,0,832,32104,0,0,1258,73682,0,0,444,10110,0,0;QS=3,0;MQSB=0.731218;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,12,139:4:0	0,6,60:2:0
+17	2708	.	G	<X>	0	.	DP=22;I16=12,10,0,0,777,28329,0,0,1258,73682,0,0,444,10086,0,0;QS=3,0;MQSB=0.731218;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,12,136:4:0	0,6,57:2:0
+17	2709	.	T	<X>	0	.	DP=22;I16=12,9,0,0,761,28341,0,0,1229,72841,0,0,418,9404,0,0;QS=3,0;MQSB=0.913101;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,12,137:4:0	0,3,39:1:0
+17	2710	.	C	<X>	0	.	DP=23;I16=12,10,0,0,840,32478,0,0,1289,76441,0,0,417,9365,0,0;QS=3,0;MQSB=0.924723;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,12,134:4:0	0,3,38:1:0
+17	2711	.	T	<X>	0	.	DP=24;I16=13,11,0,0,893,33721,0,0,1378,80882,0,0,442,9970,0,0;QS=3,0;MQSB=0.75304;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,12,138:4:0	0,6,72:2:0
+17	2712	.	A	<X>	0	.	DP=24;I16=13,11,0,0,889,33333,0,0,1378,80882,0,0,443,9971,0,0;QS=3,0;MQSB=0.75304;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,12,141:4:0	0,6,65:2:0
+17	2713	.	G	T,<X>	0	.	DP=25;I16=13,11,0,1,915,35485,14,196,1378,80882,29,841,419,9369,25,625;QS=2.72549,0.27451,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.569783;BQB=1;MQ0F=0	PL:DP:DV	0,57,255,57,255,255:19:0	0,12,131,12,131,131:4:0	8,0,31,11,34,42:2:1
+17	2714	.	G	<X>	0	.	DP=25;I16=13,11,0,0,891,33457,0,0,1378,80882,0,0,444,9990,0,0;QS=3,0;MQSB=0.75304;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,12,132:4:0	0,6,64:2:0
+17	2715	.	A	<X>	0	.	DP=25;I16=13,12,0,0,888,32012,0,0,1407,81723,0,0,446,10014,0,0;QS=3,0;MQSB=0.569783;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,12,135:4:0	0,6,63:2:0
+17	2716	.	T	<X>	0	.	DP=26;I16=13,13,0,0,937,34241,0,0,1467,85323,0,0,446,10012,0,0;QS=3,0;MQSB=0.606531;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,12,134:4:0	0,9,90:3:0
+17	2717	.	G	<X>	0	.	DP=26;I16=13,12,0,0,939,35995,0,0,1438,84482,0,0,422,9410,0,0;QS=3,0;MQSB=0.778801;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,12,134:4:0	0,6,72:2:0
+17	2718	.	C	<X>	0	.	DP=24;I16=12,11,0,0,864,33118,0,0,1318,77282,0,0,425,9457,0,0;QS=3,0;MQSB=0.7613;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,12,130:4:0	0,6,65:2:0
+17	2719	.	A	<X>	0	.	DP=24;I16=12,12,0,0,911,35371,0,0,1347,78123,0,0,452,10102,0,0;QS=3,0;MQSB=0.582748;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,12,139:4:0	0,9,99:3:0
+17	2720	.	G	<X>	0	.	DP=24;I16=12,12,0,0,940,37044,0,0,1347,78123,0,0,453,10095,0,0;QS=3,0;MQSB=0.582748;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,12,136:4:0	0,9,97:3:0
+17	2721	.	C	<X>	0	.	DP=24;I16=12,11,0,0,881,34499,0,0,1318,77282,0,0,429,9485,0,0;QS=3,0;MQSB=0.7613;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,12,131:4:0	0,6,76:2:0
+17	2722	.	T	<X>	0	.	DP=24;I16=11,13,0,0,898,34310,0,0,1347,78123,0,0,456,10146,0,0;QS=3,0;MQSB=0.633229;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,15,156:5:0	0,9,98:3:0
+17	2723	.	G	<X>	0	.	DP=25;I16=12,13,0,0,941,36257,0,0,1407,81723,0,0,459,10203,0,0;QS=3,0;MQSB=0.619223;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,18,184:6:0	0,9,76:3:0
+17	2724	.	A	<X>	0	.	DP=25;I16=12,13,0,0,917,34211,0,0,1407,81723,0,0,462,10234,0,0;QS=3,0;MQSB=0.619223;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,18,188:6:0	0,9,84:3:0
+17	2725	.	G	<X>	0	.	DP=25;I16=12,12,0,0,916,35656,0,0,1378,80882,0,0,438,9566,0,0;QS=3,0;MQSB=0.786628;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,18,185:6:0	0,6,67:2:0
+17	2726	.	G	<X>	0	.	DP=25;I16=11,12,0,0,841,31809,0,0,1287,74523,0,0,437,9545,0,0;QS=3,0;MQSB=0.597127;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,18,186:6:0	0,6,46:2:0
+17	2727	.	G	<X>	0	.	DP=25;I16=12,13,0,0,889,32233,0,0,1407,81723,0,0,464,10182,0,0;QS=3,0;MQSB=0.619223;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,21,194:7:0	0,6,56:2:0
+17	2728	.	G	<X>	0	.	DP=25;I16=12,13,0,0,883,32287,0,0,1407,81723,0,0,467,10219,0,0;QS=3,0;MQSB=0.619223;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,21,189:7:0	0,6,50:2:0
+17	2729	.	T	<X>	0	.	DP=25;I16=12,13,0,0,871,31019,0,0,1407,81723,0,0,469,10233,0,0;QS=3,0;MQSB=0.619223;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,21,189:7:0	0,6,62:2:0
+17	2730	.	G	<X>	0	.	DP=25;I16=12,13,0,0,907,34299,0,0,1407,81723,0,0,471,10275,0,0;QS=3,0;MQSB=0.619223;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,21,192:7:0	0,6,49:2:0
+17	2731	.	C	<X>	0	.	DP=25;I16=12,13,0,0,893,33027,0,0,1407,81723,0,0,473,10345,0,0;QS=3,0;MQSB=0.619223;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,21,192:7:0	0,6,52:2:0
+17	2732	.	C	<X>	0	.	DP=25;I16=12,13,0,0,882,32170,0,0,1407,81723,0,0,473,10343,0,0;QS=3,0;MQSB=0.619223;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,21,195:7:0	0,6,38:2:0
+17	2733	.	C	A,<X>	0	.	DP=25;I16=12,12,0,1,835,30063,13,169,1378,80882,29,841,448,9744,25,625;QS=2.64865,0.351351,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.619223;BQB=1;MQ0F=0	PL:DP:DV	0,48,255,48,255,255:16:0	0,21,187,21,187,187:7:0	7,0,18,10,21,28:2:1
+17	2734	.	C	<X>	0	.	DP=25;I16=12,12,0,0,890,33726,0,0,1378,80882,0,0,449,9797,0,0;QS=3,0;MQSB=0.786628;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,24,208:8:0	0,3,39:1:0
+17	2735	.	T	<X>	0	.	DP=26;I16=13,12,0,0,955,36875,0,0,1438,84482,0,0,451,9877,0,0;QS=3,0;MQSB=0.778801;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,24,228:8:0	0,3,41:1:0
+17	2736	.	C	<X>	0	.	DP=26;I16=13,11,0,0,921,35553,0,0,1409,83641,0,0,428,9308,0,0;QS=3,0;MQSB=0.931547;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,24,220:8:0	0,3,33:1:0
+17	2737	.	T	<X>	0	.	DP=26;I16=13,13,0,0,967,36581,0,0,1467,85323,0,0,475,10403,0,0;QS=3,0;MQSB=0.606531;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,24,228:8:0	0,6,64:2:0
+17	2738	.	T	<X>	0	.	DP=26;I16=13,13,0,0,895,31873,0,0,1467,85323,0,0,474,10374,0,0;QS=3,0;MQSB=0.606531;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,24,201:8:0	0,6,47:2:0
+17	2739	.	A	<X>	0	.	DP=26;I16=13,12,0,0,871,31051,0,0,1407,81723,0,0,448,9698,0,0;QS=3,0;MQSB=0.569783;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,24,224:8:0	0,9,78:3:0
+17	2740	.	C	<X>	0	.	DP=26;I16=14,11,0,0,952,36456,0,0,1438,84482,0,0,448,9674,0,0;QS=3,0;MQSB=0.745495;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,24,216:8:0	0,6,71:2:0
+17	2741	.	C	<X>	0	.	DP=26;I16=14,11,0,0,945,36141,0,0,1438,84482,0,0,448,9678,0,0;QS=3,0;MQSB=0.745495;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,24,215:8:0	0,6,75:2:0
+17	2742	.	A	<X>	0	.	DP=27;I16=15,12,0,0,949,34263,0,0,1527,88923,0,0,472,10284,0,0;QS=3,0;MQSB=0.547344;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,27,230:9:0	0,9,92:3:0
+17	2743	.	T	<X>	0	.	DP=27;I16=15,12,0,0,955,34479,0,0,1527,88923,0,0,471,10243,0,0;QS=3,0;MQSB=0.547344;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,27,224:9:0	0,9,99:3:0
+17	2744	.	C	<X>	0	.	DP=26;I16=15,10,0,0,955,36951,0,0,1438,84482,0,0,445,9557,0,0;QS=3,0;MQSB=0.707404;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,27,234:9:0	0,6,76:2:0
+17	2745	.	T	<X>	0	.	DP=26;I16=15,11,0,0,962,36786,0,0,1467,85323,0,0,469,10151,0,0;QS=3,0;MQSB=0.505697;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,27,243:9:0	0,9,104:3:0
+17	2746	.	A	<X>	0	.	DP=26;I16=15,10,0,0,912,33536,0,0,1438,84482,0,0,443,9525,0,0;QS=3,0;MQSB=0.707404;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,27,235:9:0	0,6,78:2:0
+17	2747	.	A	<X>	0	.	DP=26;I16=15,11,0,0,945,35117,0,0,1467,85323,0,0,467,10179,0,0;QS=3,0;MQSB=0.505697;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,27,238:9:0	0,9,96:3:0
+17	2748	.	T	<X>	0	.	DP=27;I16=15,12,0,0,1005,37901,0,0,1527,88923,0,0,465,10187,0,0;QS=3,0;MQSB=0.547344;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,27,246:9:0	0,9,103:3:0
+17	2749	.	C	<X>	0	.	DP=26;I16=14,12,0,0,975,37353,0,0,1467,85323,0,0,463,10123,0,0;QS=3,0;MQSB=0.558035;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,27,232:9:0	0,9,98:3:0
+17	2750	.	T	<X>	0	.	DP=26;I16=15,11,0,0,982,37714,0,0,1498,88082,0,0,462,10086,0,0;QS=3,0;MQSB=0.738577;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,24,227:8:0	0,12,130:4:0
+17	2751	.	G	<X>	0	.	DP=26;I16=15,10,0,0,945,36031,0,0,1469,87241,0,0,437,9451,0,0;QS=3,0;MQSB=0.9171;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,24,205:8:0	0,9,103:3:0
+17	2752	.	T	<X>	0	.	DP=26;I16=15,11,0,0,870,30288,0,0,1498,88082,0,0,460,9998,0,0;QS=3,0;MQSB=0.738577;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,24,189:8:0	0,12,119:4:0
+17	2753	.	G	<X>	0	.	DP=26;I16=15,11,0,0,867,30913,0,0,1498,88082,0,0,458,9948,0,0;QS=3,0;MQSB=0.738577;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,24,202:8:0	0,12,116:4:0
+17	2754	.	C	<X>	0	.	DP=25;I16=14,10,0,0,873,32607,0,0,1409,83641,0,0,436,9484,0,0;QS=3,0;MQSB=0.919431;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,24,205:8:0	0,9,104:3:0
+17	2755	.	C	<X>	0	.	DP=25;I16=14,10,0,0,865,32243,0,0,1409,83641,0,0,436,9528,0,0;QS=3,0;MQSB=0.919431;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,24,209:8:0	0,9,97:3:0
+17	2756	.	C	<X>	0	.	DP=25;I16=14,9,0,0,838,31276,0,0,1380,82800,0,0,411,8971,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,24,204:8:0	0,9,97:3:0
+17	2757	.	T	<X>	0	.	DP=25;I16=14,11,0,0,904,33980,0,0,1438,84482,0,0,455,10011,0,0;QS=3,0;MQSB=0.745495;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,21,212:7:0	0,15,147:5:0
+17	2758	.	T	<X>	0	.	DP=25;I16=14,10,0,0,841,30293,0,0,1409,83641,0,0,439,9801,0,0;QS=3,0;MQSB=0.919431;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,21,195:7:0	0,12,133:4:0
+17	2759	.	A	<X>	0	.	DP=25;I16=14,11,0,0,884,31728,0,0,1438,84482,0,0,457,10195,0,0;QS=3,0;MQSB=0.745495;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,21,192:7:0	0,15,147:5:0
+17	2760	.	T	<X>	0	.	DP=25;I16=14,11,0,0,907,33965,0,0,1438,84482,0,0,457,10275,0,0;QS=3,0;MQSB=0.745495;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,21,204:7:0	0,15,150:5:0
+17	2761	.	T	<X>	0	.	DP=23;I16=13,9,0,0,838,32530,0,0,1289,76441,0,0,444,10130,0,0;QS=3,0;MQSB=0.910098;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,185:6:0	0,12,141:4:0
+17	2762	.	T	<X>	0	.	DP=24;I16=13,11,0,0,869,32261,0,0,1378,80882,0,0,459,10395,0,0;QS=3,0;MQSB=0.75304;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,178:6:0	0,18,177:6:0
+17	2763	.	C	A,<X>	0	.	DP=24;I16=13,10,0,1,843,31711,13,169,1349,80041,29,841,448,10290,12,144;QS=2.93333,0.0666667,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.75304;BQB=1;MQ0F=0	PL:DP:DV	0,36,255,36,255,255:12:0	0,18,170,18,170,170:6:0	0,5,147,15,150,153:6:1
+17	2764	.	C	<X>	0	.	DP=24;I16=13,10,0,0,854,32376,0,0,1349,80041,0,0,450,10374,0,0;QS=3,0;MQSB=0.921963;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,163:6:0	0,15,162:5:0
+17	2765	.	T	<X>	0	.	DP=24;I16=12,11,0,0,853,32173,0,0,1318,77282,0,0,457,10469,0,0;QS=3,0;MQSB=0.7613;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,154:5:0	0,18,189:6:0
+17	2766	.	C	<X>	0	.	DP=24;I16=12,11,0,0,887,34485,0,0,1349,80041,0,0,448,10398,0,0;QS=3,0;MQSB=0.934091;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,160:5:0	0,18,186:6:0
+17	2767	.	T	<X>	0	.	DP=24;I16=12,12,0,0,905,34757,0,0,1378,80882,0,0,458,10510,0,0;QS=3,0;MQSB=0.786628;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,153:5:0	0,21,217:7:0
+17	2768	.	G	<X>	0	.	DP=23;I16=11,11,0,0,852,33258,0,0,1289,76441,0,0,452,10462,0,0;QS=3,0;MQSB=0.936864;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,141:5:0	0,18,197:6:0
+17	2769	.	C	<X>	0	.	DP=23;I16=11,12,0,0,832,31390,0,0,1318,77282,0,0,459,10481,0,0;QS=3,0;MQSB=0.795196;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,142:5:0	0,21,202:7:0
+17	2770	.	T	<X>	0	.	DP=23;I16=11,12,0,0,828,30854,0,0,1318,77282,0,0,459,10471,0,0;QS=3,0;MQSB=0.795196;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,152:5:0	0,21,199:7:0
+17	2771	.	T	<X>	0	.	DP=23;I16=11,11,0,0,817,30957,0,0,1258,73682,0,0,454,10456,0,0;QS=3,0;MQSB=0.770381;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,154:5:0	0,18,198:6:0
+17	2772	.	T	<X>	0	.	DP=23;I16=11,12,0,0,856,32206,0,0,1318,77282,0,0,459,10511,0,0;QS=3,0;MQSB=0.795196;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,160:5:0	0,21,210:7:0
+17	2773	.	A	<X>	0	.	DP=23;I16=11,12,0,0,828,30664,0,0,1318,77282,0,0,459,10561,0,0;QS=3,0;MQSB=0.795196;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,140:5:0	0,21,209:7:0
+17	2774	.	G	<X>	0	.	DP=22;I16=11,11,0,0,843,32715,0,0,1258,73682,0,0,458,10530,0,0;QS=3,0;MQSB=0.770381;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,15,154:5:0	0,21,207:7:0
+17	2775	.	T	<X>	0	.	DP=22;I16=10,11,0,0,748,27720,0,0,1198,70082,0,0,432,9892,0,0;QS=3,0;MQSB=0.780412;MQ0F=0	PL:DP:DV	0,30,253:10:0	0,12,115:4:0	0,21,203:7:0
+17	2776	.	G	<X>	0	.	DP=22;I16=12,10,0,0,803,30251,0,0,1289,76441,0,0,456,10470,0,0;QS=3,0;MQSB=0.924723;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,15,135:5:0	0,21,210:7:0
+17	2777	.	A	<X>	0	.	DP=22;I16=12,10,0,0,852,33524,0,0,1289,76441,0,0,456,10438,0,0;QS=3,0;MQSB=0.924723;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,15,148:5:0	0,21,220:7:0
+17	2778	.	G	<X>	0	.	DP=23;I16=12,11,0,0,861,33049,0,0,1349,80041,0,0,456,10422,0,0;QS=3,0;MQSB=0.934091;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,154:5:0	0,21,224:7:0
+17	2779	.	G	<X>	0	.	DP=23;I16=11,11,0,0,834,32014,0,0,1289,76441,0,0,432,9798,0,0;QS=3,0;MQSB=0.936864;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,136:4:0	0,21,219:7:0
+17	2780	.	A	<X>	0	.	DP=23;I16=11,11,0,0,792,29162,0,0,1289,76441,0,0,433,9817,0,0;QS=3,0;MQSB=0.936864;MQ0F=0	PL:DP:DV	0,33,244:11:0	0,12,133:4:0	0,21,215:7:0
+17	2781	.	A	<X>	0	.	DP=23;I16=11,11,0,0,844,33092,0,0,1289,76441,0,0,441,10141,0,0;QS=3,0;MQSB=0.936864;MQ0F=0	PL:DP:DV	0,30,253:10:0	0,15,151:5:0	0,21,233:7:0
+17	2782	.	G	<X>	0	.	DP=23;I16=12,11,0,0,840,31826,0,0,1349,80041,0,0,458,10438,0,0;QS=3,0;MQSB=0.934091;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,154:5:0	0,21,218:7:0
+17	2783	.	A	<X>	0	.	DP=23;I16=11,11,0,0,860,33888,0,0,1289,76441,0,0,432,9790,0,0;QS=3,0;MQSB=0.936864;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,142:4:0	0,21,230:7:0
+17	2784	.	G	<X>	0	.	DP=23;I16=12,11,0,0,860,33092,0,0,1349,80041,0,0,456,10410,0,0;QS=3,0;MQSB=0.934091;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,143:5:0	0,21,212:7:0
+17	2785	.	G	<X>	0	.	DP=23;I16=11,11,0,0,797,29747,0,0,1289,76441,0,0,429,9749,0,0;QS=3,0;MQSB=0.936864;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,134:4:0	0,21,204:7:0
+17	2786	.	C	<X>	0	.	DP=24;I16=12,12,0,0,831,29497,0,0,1409,83641,0,0,451,10309,0,0;QS=3,0;MQSB=0.941765;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,141:5:0	0,21,199:7:0
+17	2787	.	C	<X>	0	.	DP=24;I16=11,12,0,0,792,28454,0,0,1349,80041,0,0,424,9642,0,0;QS=3,0;MQSB=0.944319;MQ0F=0	PL:DP:DV	0,36,252:12:0	0,12,127:4:0	0,21,200:7:0
+17	2788	.	C	<X>	0	.	DP=23;I16=11,11,0,0,791,29517,0,0,1289,76441,0,0,421,9523,0,0;QS=3,0;MQSB=0.936864;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,125:4:0	0,21,209:7:0
+17	2789	.	C	<X>	0	.	DP=24;I16=13,11,0,0,880,33470,0,0,1409,83641,0,0,443,10051,0,0;QS=3,0;MQSB=0.931547;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,150:5:0	0,21,226:7:0
+17	2790	.	T	<X>	0	.	DP=23;I16=13,10,0,0,886,34738,0,0,1349,80041,0,0,442,9976,0,0;QS=3,0;MQSB=0.921963;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,165:5:0	0,21,227:7:0
+17	2791	.	G	<X>	0	.	DP=23;I16=13,10,0,0,873,34037,0,0,1349,80041,0,0,441,9923,0,0;QS=3,0;MQSB=0.921963;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,155:5:0	0,21,226:7:0
+17	2792	.	G	<X>	0	.	DP=23;I16=13,10,0,0,832,30870,0,0,1349,80041,0,0,438,9792,0,0;QS=3,0;MQSB=0.921963;MQ0F=0	PL:DP:DV	0,33,254:11:0	0,15,146:5:0	0,21,221:7:0
+17	2793	.	T	<X>	0	.	DP=23;I16=13,10,0,0,827,30693,0,0,1349,80041,0,0,435,9683,0,0;QS=3,0;MQSB=0.921963;MQ0F=0	PL:DP:DV	0,33,247:11:0	0,15,157:5:0	0,21,214:7:0
+17	2794	.	C	<X>	0	.	DP=22;I16=12,10,0,0,786,29122,0,0,1289,76441,0,0,433,9595,0,0;QS=3,0;MQSB=0.924723;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,15,145:5:0	0,21,201:7:0
+17	2795	.	C	<X>	0	.	DP=22;I16=11,10,0,0,814,31804,0,0,1229,72841,0,0,428,9518,0,0;QS=3,0;MQSB=0.927743;MQ0F=0	PL:DP:DV	0,27,240:9:0	0,15,159:5:0	0,21,222:7:0
+17	2796	.	A	<X>	0	.	DP=22;I16=11,10,0,0,762,28412,0,0,1229,72841,0,0,427,9475,0,0;QS=3,0;MQSB=0.927743;MQ0F=0	PL:DP:DV	0,27,221:9:0	0,15,156:5:0	0,21,211:7:0
+17	2797	.	T	<X>	0	.	DP=22;I16=12,10,0,0,792,29116,0,0,1289,76441,0,0,427,9451,0,0;QS=3,0;MQSB=0.924723;MQ0F=0	PL:DP:DV	0,30,243:10:0	0,15,148:5:0	0,21,214:7:0
+17	2798	.	G	<X>	0	.	DP=22;I16=12,10,0,0,817,31105,0,0,1289,76441,0,0,424,9394,0,0;QS=3,0;MQSB=0.924723;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,15,152:5:0	0,21,205:7:0
+17	2799	.	A	<X>	0	.	DP=21;I16=11,10,0,0,788,30210,0,0,1229,72841,0,0,421,9309,0,0;QS=3,0;MQSB=0.927743;MQ0F=0	PL:DP:DV	0,27,220:9:0	0,15,167:5:0	0,21,218:7:0
+17	2800	.	A	<X>	0	.	DP=21;I16=11,10,0,0,836,33616,0,0,1229,72841,0,0,418,9246,0,0;QS=3,0;MQSB=0.927743;MQ0F=0	PL:DP:DV	0,27,237:9:0	0,15,164:5:0	0,21,237:7:0
+17	2801	.	G	<X>	0	.	DP=21;I16=11,10,0,0,792,30182,0,0,1229,72841,0,0,415,9205,0,0;QS=3,0;MQSB=0.927743;MQ0F=0	PL:DP:DV	0,27,234:9:0	0,15,157:5:0	0,21,214:7:0
+17	2802	.	G	<X>	0	.	DP=21;I16=11,9,0,0,729,27275,0,0,1169,69241,0,0,387,8559,0,0;QS=3,0;MQSB=0.916401;MQ0F=0	PL:DP:DV	0,24,229:8:0	0,15,135:5:0	0,21,215:7:0
+17	2803	.	G	<X>	0	.	DP=21;I16=11,10,0,0,737,26709,0,0,1229,72841,0,0,406,9036,0,0;QS=3,0;MQSB=0.927743;MQ0F=0	PL:DP:DV	0,27,233:9:0	0,15,125:5:0	0,21,207:7:0
+17	2804	.	G	<X>	0	.	DP=21;I16=11,10,0,0,727,26103,0,0,1229,72841,0,0,400,8908,0,0;QS=3,0;MQSB=0.927743;MQ0F=0	PL:DP:DV	0,27,218:9:0	0,15,129:5:0	0,21,210:7:0
+17	2805	.	C	<X>	0	.	DP=21;I16=10,10,0,0,714,26194,0,0,1169,69241,0,0,372,8316,0,0;QS=3,0;MQSB=0.931063;MQ0F=0	PL:DP:DV	0,27,229:9:0	0,12,111:4:0	0,21,205:7:0
+17	2806	.	C	<X>	0	.	DP=20;I16=11,8,0,0,682,25074,0,0,1109,65641,0,0,379,8611,0,0;QS=3,0;MQSB=0.902014;MQ0F=0	PL:DP:DV	0,24,215:8:0	0,15,138:5:0	0,18,191:6:0
+17	2807	.	T	<X>	0	.	DP=20;I16=11,9,0,0,755,29373,0,0,1169,69241,0,0,384,8640,0,0;QS=3,0;MQSB=0.916401;MQ0F=0	PL:DP:DV	0,24,221:8:0	0,15,152:5:0	0,21,227:7:0
+17	2808	.	T	<X>	0	.	DP=20;I16=11,9,0,0,749,28383,0,0,1169,69241,0,0,379,8587,0,0;QS=3,0;MQSB=0.916401;MQ0F=0	PL:DP:DV	0,24,209:8:0	0,15,157:5:0	0,21,225:7:0
+17	2809	.	T	<X>	0	.	DP=20;I16=11,8,0,0,697,26019,0,0,1109,65641,0,0,349,7927,0,0;QS=3,0;MQSB=0.902014;MQ0F=0	PL:DP:DV	0,21,189:7:0	0,15,148:5:0	0,21,226:7:0
+17	2810	.	C	<X>	0	.	DP=20;I16=12,8,0,0,754,28900,0,0,1169,69241,0,0,368,8436,0,0;QS=3,0;MQSB=0.898397;MQ0F=0	PL:DP:DV	0,24,229:8:0	0,15,150:5:0	0,21,215:7:0
+17	2811	.	A	<X>	0	.	DP=19;I16=11,8,0,0,759,30405,0,0,1109,65641,0,0,364,8340,0,0;QS=3,0;MQSB=0.902014;MQ0F=0	PL:DP:DV	0,21,209:7:0	0,15,166:5:0	0,21,228:7:0
+17	2812	.	G	<X>	0	.	DP=20;I16=11,9,0,0,758,29062,0,0,1169,69241,0,0,359,8213,0,0;QS=3,0;MQSB=0.916401;MQ0F=0	PL:DP:DV	0,24,229:8:0	0,15,150:5:0	0,21,216:7:0
+17	2813	.	A	<X>	0	.	DP=19;I16=11,8,0,0,702,27106,0,0,1140,68400,0,0,356,8104,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,195:7:0	0,15,160:5:0	0,21,217:7:0
+17	2814	.	G	<X>	0	.	DP=19;I16=11,8,0,0,703,26579,0,0,1140,68400,0,0,353,8013,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,217:7:0	0,15,147:5:0	0,21,204:7:0
+17	2815	.	A	<X>	0	.	DP=19;I16=10,7,0,0,597,21979,0,0,1020,61200,0,0,326,7470,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,18,170:6:0	0,12,122:4:0	0,21,208:7:0
+17	2816	.	C	<X>	0	.	DP=19;I16=11,8,0,0,630,21880,0,0,1140,68400,0,0,343,7685,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,193:7:0	0,15,134:5:0	0,21,180:7:0
+17	2817	.	G	<X>	0	.	DP=20;I16=11,8,0,0,612,20368,0,0,1140,68400,0,0,339,7547,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,200:7:0	0,15,115:5:0	0,21,178:7:0
+17	2818	.	G	<X>	0	.	DP=20;I16=11,8,0,0,688,25280,0,0,1140,68400,0,0,335,7377,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,216:7:0	0,15,132:5:0	0,21,206:7:0
+17	2819	.	G	<X>	0	.	DP=20;I16=11,8,0,0,696,25880,0,0,1140,68400,0,0,331,7227,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,222:7:0	0,15,142:5:0	0,21,195:7:0
+17	2820	.	G	<X>	0	.	DP=20;I16=10,8,0,0,624,22228,0,0,1080,64800,0,0,320,7048,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,205:7:0	0,12,119:4:0	0,21,188:7:0
+17	2821	.	A	<X>	0	.	DP=20;I16=9,7,0,0,496,16222,0,0,960,57600,0,0,279,6157,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,18,159:6:0	0,9,93:3:0	0,21,171:7:0
+17	2822	.	C	<X>	0	.	DP=19;I16=8,9,0,0,543,18163,0,0,1020,61200,0,0,310,7064,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,203:7:0	0,9,79:3:0	0,21,168:7:0
+17	2823	.	C	<X>	0	.	DP=18;I16=9,7,0,0,550,19506,0,0,960,57600,0,0,300,6640,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,201:7:0	0,6,58:2:0	0,21,192:7:0
+17	2824	.	C	<X>	0	.	DP=18;I16=9,7,0,0,584,21560,0,0,960,57600,0,0,299,6567,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,219:8:0	0,3,37:1:0	0,21,210:7:0
+17	2825	.	C	<X>	0	.	DP=18;I16=9,8,0,0,606,22286,0,0,1020,61200,0,0,324,7134,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,234:8:0	0,3,37:1:0	0,24,208:8:0
+17	2826	.	T	<X>	0	.	DP=18;I16=9,8,0,0,604,21766,0,0,1020,61200,0,0,323,7043,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,222:8:0	0,3,33:1:0	0,24,220:8:0
+17	2827	.	G	<X>	0	.	DP=18;I16=9,8,0,0,597,21643,0,0,1020,61200,0,0,322,6970,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,230:8:0	0,3,28:1:0	0,24,214:8:0
+17	2828	.	A	<X>	0	.	DP=20;I16=9,9,0,0,598,20740,0,0,1080,64800,0,0,321,6915,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,213:9:0	0,3,36:1:0	0,24,219:8:0
+17	2829	.	G	<X>	0	.	DP=20;I16=9,9,0,0,649,23719,0,0,1080,64800,0,0,305,6591,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,239:8:0	0,3,31:1:0	0,27,227:9:0
+17	2830	.	G	<X>	0	.	DP=20;I16=9,10,0,0,661,23841,0,0,1140,68400,0,0,323,6867,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,248:9:0	0,3,34:1:0	0,27,222:9:0
+17	2831	.	A	<X>	0	.	DP=21;I16=10,10,0,0,682,24052,0,0,1200,72000,0,0,324,6876,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,223:9:0	0,3,34:1:0	0,30,254:10:0
+17	2832	.	G	<X>	0	.	DP=21;I16=10,8,0,0,626,22384,0,0,1080,64800,0,0,281,5883,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,230:8:0	0,3,31:1:0	0,27,223:9:0
+17	2833	.	C	<X>	0	.	DP=21;I16=10,10,0,0,712,25708,0,0,1200,72000,0,0,327,6915,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,233:9:0	0,3,37:1:0	0,30,255:10:0
+17	2834	.	C	<X>	0	.	DP=21;I16=10,9,0,0,674,24470,0,0,1140,68400,0,0,306,6464,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,230:8:0	0,3,36:1:0	0,30,243:10:0
+17	2835	.	C	<X>	0	.	DP=20;I16=9,9,0,0,617,21835,0,0,1080,64800,0,0,305,6381,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,202:8:0	0,3,39:1:0	0,27,235:9:0
+17	2836	.	C	<X>	0	.	DP=20;I16=9,9,0,0,580,19624,0,0,1080,64800,0,0,306,6412,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,206:8:0	0,3,39:1:0	0,27,200:9:0
+17	2837	.	G	<X>	0	.	DP=21;I16=9,10,0,0,558,17614,0,0,1140,68400,0,0,330,7086,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,207:9:0	0,3,31:1:0	0,27,193:9:0
+17	2838	.	A	<X>	0	.	DP=20;I16=9,10,0,0,640,22674,0,0,1140,68400,0,0,331,7065,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,245:9:0	0,3,17:1:0	0,27,220:9:0
+17	2839	.	G	<X>	0	.	DP=20;I16=9,8,0,0,623,23267,0,0,1020,61200,0,0,282,5816,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,248:8:0	0,3,26:1:0	0,24,212:8:0
+17	2840	.	C	<X>	0	.	DP=20;I16=9,10,0,0,644,22798,0,0,1140,68400,0,0,333,7089,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,233:9:0	0,3,32:1:0	0,27,227:9:0
+17	2841	.	A	<X>	0	.	DP=20;I16=9,9,0,0,675,25801,0,0,1080,64800,0,0,309,6509,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,252:9:0	0,3,35:1:0	0,24,234:8:0
+17	2842	.	G	<X>	0	.	DP=20;I16=9,10,0,0,688,25554,0,0,1140,68400,0,0,332,7056,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,255:9:0	0,3,31:1:0	0,27,233:9:0
+17	2843	.	C	<X>	0	.	DP=20;I16=8,10,0,0,651,23969,0,0,1080,64800,0,0,309,6517,0,0;QS=2,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,0,0:0:0	0,24,211:8:0
+17	2844	.	A	<X>	0	.	DP=20;I16=8,11,0,0,685,25399,0,0,1140,68400,0,0,331,6969,0,0;QS=2,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,0,0:0:0	0,27,231:9:0
+17	2845	.	G	<X>	0	.	DP=20;I16=8,10,0,0,673,25399,0,0,1080,64800,0,0,311,6561,0,0;QS=2,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,0,0:0:0	0,24,228:8:0
+17	2846	.	C	<X>	0	.	DP=20;I16=8,10,0,0,617,22007,0,0,1080,64800,0,0,311,6577,0,0;QS=2,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,243:10:0	0,0,0:0:0	0,24,218:8:0
+17	2847	.	C	<X>	0	.	DP=20;I16=7,11,0,0,580,19468,0,0,1080,64800,0,0,321,6917,0,0;QS=2,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,241:10:0	0,0,0:0:0	0,24,187:8:0
+17	2848	.	G	<X>	0	.	DP=19;I16=7,10,0,0,542,17884,0,0,1020,61200,0,0,323,6999,0,0;QS=2,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,218:9:0	0,0,0:0:0	0,24,191:8:0
+17	2849	.	T	<X>	0	.	DP=19;I16=7,11,0,0,609,21717,0,0,1080,64800,0,0,341,7357,0,0;QS=2,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,231:9:0	0,0,0:0:0	0,27,214:9:0
+17	2850	.	C	<X>	0	.	DP=19;I16=7,11,0,0,574,18980,0,0,1080,64800,0,0,343,7461,0,0;QS=2,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,234:9:0	0,0,0:0:0	0,27,188:9:0
+17	2851	.	G	<X>	0	.	DP=17;I16=6,11,0,0,589,20831,0,0,1020,61200,0,0,346,7584,0,0;QS=2,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,239:9:0	0,0,0:0:0	0,24,194:8:0
+17	2852	.	T	<X>	0	.	DP=17;I16=6,11,0,0,625,23241,0,0,1020,61200,0,0,348,7676,0,0;QS=2,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,244:9:0	0,0,0:0:0	0,24,214:8:0
+17	2853	.	G	<X>	0	.	DP=17;I16=6,11,0,0,635,23949,0,0,1020,61200,0,0,349,7739,0,0;QS=2,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,255:9:0	0,0,0:0:0	0,24,202:8:0
+17	2854	.	T	<X>	0	.	DP=17;I16=6,11,0,0,602,21990,0,0,1020,61200,0,0,348,7722,0,0;QS=2,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,238:9:0	0,0,0:0:0	0,24,207:8:0
+17	2855	.	C	<X>	0	.	DP=17;I16=6,10,0,0,577,21539,0,0,960,57600,0,0,337,7623,0,0;QS=2,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,255:9:0	0,0,0:0:0	0,21,185:7:0
+17	2856	.	T	<X>	0	.	DP=17;I16=6,8,0,0,530,20570,0,0,840,50400,0,0,289,6507,0,0;QS=2,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,252:9:0	0,0,0:0:0	0,15,167:5:0
+17	2857	.	C	<X>	0	.	DP=18;I16=6,10,0,0,577,21641,0,0,960,57600,0,0,336,7664,0,0;QS=2,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,255:9:0	0,0,0:0:0	0,21,185:7:0
+17	2858	.	A	<X>	0	.	DP=19;I16=6,12,0,0,634,23006,0,0,1080,64800,0,0,355,8081,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,254:10:0	0,3,39:1:0	0,21,185:7:0
+17	2859	.	C	<X>	0	.	DP=19;I16=6,13,0,0,646,23056,0,0,1140,68400,0,0,361,8139,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,3,26:1:0	0,24,194:8:0
+17	2860	.	C	<X>	0	.	DP=19;I16=6,13,0,0,655,23687,0,0,1140,68400,0,0,360,8166,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,251:10:0	0,3,37:1:0	0,24,200:8:0
+17	2861	.	C	<X>	0	.	DP=20;I16=7,12,0,0,708,26756,0,0,1140,68400,0,0,333,7537,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,3,38:1:0	0,21,203:7:0
+17	2862	.	A	<X>	0	.	DP=20;I16=6,13,0,0,749,29753,0,0,1140,68400,0,0,332,7554,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,3,43:1:0	0,24,225:8:0
+17	2863	.	G	<X>	0	.	DP=19;I16=7,12,0,0,707,26901,0,0,1140,68400,0,0,356,8166,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,3,35:1:0	0,21,195:7:0
+17	2864	.	G	<X>	0	.	DP=19;I16=7,11,0,0,677,25833,0,0,1080,64800,0,0,352,8070,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,3,36:1:0	0,18,185:6:0
+17	2865	.	G	<X>	0	.	DP=19;I16=7,12,0,0,671,24569,0,0,1140,68400,0,0,350,7994,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,3,27:1:0	0,21,193:7:0
+17	2866	.	T	<X>	0	.	DP=18;I16=6,11,0,0,591,21071,0,0,1020,61200,0,0,338,7834,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,3,32:1:0	0,15,147:5:0
+17	2867	.	G	<X>	0	.	DP=18;I16=7,11,0,0,655,24279,0,0,1080,64800,0,0,347,7889,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,6,58:2:0	0,15,150:5:0
+17	2868	.	T	<X>	0	.	DP=18;I16=7,11,0,0,640,23702,0,0,1080,64800,0,0,347,7859,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,6,68:2:0	0,15,157:5:0
+17	2869	.	C	<X>	0	.	DP=18;I16=7,11,0,0,655,24737,0,0,1080,64800,0,0,346,7794,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,6,56:2:0	0,15,165:5:0
+17	2870	.	T	<X>	0	.	DP=18;I16=7,11,0,0,700,27480,0,0,1080,64800,0,0,345,7743,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,6,70:2:0	0,15,176:5:0
+17	2871	.	G	<X>	0	.	DP=18;I16=7,11,0,0,700,27554,0,0,1080,64800,0,0,344,7706,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,6,68:2:0	0,15,172:5:0
+17	2872	.	A	<X>	0	.	DP=18;I16=7,11,0,0,651,23869,0,0,1080,64800,0,0,343,7683,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,6,66:2:0	0,15,171:5:0
+17	2873	.	A	<X>	0	.	DP=18;I16=7,11,0,0,664,25000,0,0,1080,64800,0,0,342,7674,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,6,61:2:0	0,15,159:5:0
+17	2874	.	A	<X>	0	.	DP=18;I16=7,11,0,0,636,23286,0,0,1080,64800,0,0,341,7679,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,6,57:2:0	0,15,162:5:0
+17	2875	.	C	<X>	0	.	DP=18;I16=7,11,0,0,664,25148,0,0,1080,64800,0,0,340,7698,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,6,63:2:0	0,15,166:5:0
+17	2876	.	A	<X>	0	.	DP=18;I16=6,11,0,0,666,26684,0,0,1020,61200,0,0,314,7106,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,6,74:2:0	0,15,185:5:0
+17	2877	.	G	<X>	0	.	DP=17;I16=6,11,0,0,659,26009,0,0,1020,61200,0,0,339,7777,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,6,67:2:0	0,12,148:4:0
+17	2878	.	A	<X>	0	.	DP=17;I16=7,10,0,0,628,23656,0,0,1020,61200,0,0,340,7834,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,6,69:2:0	0,15,166:5:0
+17	2879	.	T	<X>	0	.	DP=18;I16=7,11,0,0,671,25359,0,0,1080,64800,0,0,342,7902,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,253:10:0	0,9,96:3:0	0,15,175:5:0
+17	2880	.	G	<X>	0	.	DP=19;I16=8,11,0,0,708,26694,0,0,1140,68400,0,0,345,7983,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,12,118:4:0	0,15,173:5:0
+17	2881	.	T	<X>	0	.	DP=19;I16=6,11,0,0,618,23304,0,0,1020,61200,0,0,299,6829,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,209:8:0	0,12,124:4:0	0,15,178:5:0
+17	2882	.	G	<X>	0	.	DP=19;I16=8,11,0,0,700,26464,0,0,1140,68400,0,0,353,8191,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,12,118:4:0	0,15,176:5:0
+17	2883	.	G	<X>	0	.	DP=19;I16=8,11,0,0,707,26939,0,0,1140,68400,0,0,357,8319,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,12,121:4:0	0,15,175:5:0
+17	2884	.	A	<X>	0	.	DP=19;I16=7,11,0,0,649,24531,0,0,1080,64800,0,0,335,7787,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,229:9:0	0,12,121:4:0	0,15,181:5:0
+17	2885	.	G	<X>	0	.	DP=19;I16=8,11,0,0,737,29253,0,0,1140,68400,0,0,362,8470,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,12,113:4:0	0,15,182:5:0
+17	2886	.	G	A,<X>	0	.	DP=18;I16=7,9,1,0,571,21281,20,400,960,57600,60,3600,334,7882,6,36;QS=2.76471,0.235294,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=1;BQB=1;MQ0F=0	PL:DP:DV	0,27,236,27,236,236:9:0	11,0,51,17,54,66:3:1	0,15,171,15,171,171:5:0
+17	2887	.	T	<X>	0	.	DP=19;I16=9,9,0,0,581,20407,0,0,1080,64800,0,0,341,7905,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,213:10:0	0,9,94:3:0	0,15,166:5:0
+17	2888	.	C	<X>	0	.	DP=20;I16=10,10,0,0,714,26630,0,0,1200,72000,0,0,368,8532,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,94:4:0	0,15,159:5:0
+17	2889	.	T	<X>	0	.	DP=19;I16=9,10,0,0,712,27106,0,0,1140,68400,0,0,372,8550,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,12,114:4:0	0,15,175:5:0
+17	2890	.	C	<X>	0	.	DP=19;I16=9,10,0,0,613,20711,0,0,1140,68400,0,0,376,8584,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,247:10:0	0,12,95:4:0	0,15,139:5:0
+17	2891	.	G	<X>	0	.	DP=20;I16=9,11,0,0,674,23754,0,0,1200,72000,0,0,380,8634,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,242:10:0	0,15,141:5:0	0,15,143:5:0
+17	2892	.	G	<X>	0	.	DP=21;I16=9,12,0,0,731,26677,0,0,1260,75600,0,0,385,8701,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,142:5:0	0,15,164:5:0
+17	2893	.	G	<X>	0	.	DP=21;I16=9,12,0,0,696,24498,0,0,1260,75600,0,0,389,8687,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,251:11:0	0,15,141:5:0	0,15,150:5:0
+17	2894	.	T	<X>	0	.	DP=21;I16=9,12,0,0,716,25490,0,0,1260,75600,0,0,393,8693,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,137:5:0	0,15,155:5:0
+17	2895	.	G	<X>	0	.	DP=22;I16=9,12,0,0,773,29225,0,0,1260,75600,0,0,372,8094,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,18,149:6:0	0,15,166:5:0
+17	2896	.	A	<X>	0	.	DP=22;I16=8,12,0,0,732,27684,0,0,1200,72000,0,0,361,7885,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,15,151:5:0	0,15,163:5:0
+17	2897	.	G	<X>	0	.	DP=22;I16=10,12,0,0,783,28783,0,0,1320,79200,0,0,407,8835,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,161:6:0	0,15,168:5:0
+17	2898	.	G	<X>	0	.	DP=22;I16=10,12,0,0,724,25596,0,0,1320,79200,0,0,412,8926,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,254:11:0	0,18,143:6:0	0,15,169:5:0
+17	2899	.	C	<X>	0	.	DP=22;I16=8,11,0,0,625,21143,0,0,1140,68400,0,0,356,7640,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,228:9:0	0,15,130:5:0	0,15,147:5:0
+17	2900	.	G	<X>	0	.	DP=24;I16=11,13,0,0,782,26700,0,0,1440,86400,0,0,420,9078,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,18,164:6:0	0,15,153:5:0
+17	2901	.	T	<X>	0	.	DP=24;I16=11,13,0,0,821,29195,0,0,1440,86400,0,0,426,9192,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,18,174:6:0	0,15,166:5:0
+17	2902	.	G	<X>	0	.	DP=24;I16=11,13,0,0,898,34176,0,0,1440,86400,0,0,432,9334,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,18,171:6:0	0,15,164:5:0
+17	2903	.	G	<X>	0	.	DP=24;I16=11,13,0,0,894,33764,0,0,1440,86400,0,0,437,9455,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,18,183:6:0	0,15,168:5:0
+17	2904	.	C	<X>	0	.	DP=24;I16=11,13,0,0,892,34010,0,0,1440,86400,0,0,440,9506,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,18,176:6:0	0,15,169:5:0
+17	2905	.	T	<X>	0	.	DP=25;I16=12,13,0,0,926,34994,0,0,1500,90000,0,0,442,9536,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,18,175:6:0	0,15,174:5:0
+17	2906	.	C	<X>	0	.	DP=25;I16=12,13,0,0,960,37070,0,0,1500,90000,0,0,444,9544,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,18,178:6:0	0,15,173:5:0
+17	2907	.	A	<X>	0	.	DP=25;I16=11,13,0,0,933,36707,0,0,1440,86400,0,0,429,9275,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,18,202:6:0	0,15,170:5:0
+17	2908	.	G	<X>	0	.	DP=25;I16=12,13,0,0,943,36315,0,0,1500,90000,0,0,446,9548,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,18,167:6:0	0,15,164:5:0
+17	2909	.	A	<X>	0	.	DP=25;I16=10,13,0,0,864,32764,0,0,1380,82800,0,0,425,9105,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,182:6:0	0,15,171:5:0
+17	2910	.	T	<X>	0	.	DP=25;I16=11,13,0,0,870,32054,0,0,1440,86400,0,0,447,9575,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,18,181:6:0	0,15,166:5:0
+17	2911	.	A	<X>	0	.	DP=25;I16=11,14,0,0,871,31227,0,0,1500,90000,0,0,473,10259,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,18,174:6:0	0,18,188:6:0
+17	2912	.	C	<X>	0	.	DP=24;I16=11,13,0,0,899,34121,0,0,1440,86400,0,0,474,10298,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,173:6:0	0,18,189:6:0
+17	2913	.	A	<X>	0	.	DP=24;I16=10,13,0,0,879,34357,0,0,1380,82800,0,0,449,9691,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,164:5:0	0,18,199:6:0
+17	2914	.	G	<X>	0	.	DP=24;I16=11,13,0,0,899,34575,0,0,1440,86400,0,0,472,10262,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,170:6:0	0,18,187:6:0
+17	2915	.	G	<X>	0	.	DP=24;I16=11,13,0,0,867,32523,0,0,1440,86400,0,0,470,10236,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,177:6:0	0,18,178:6:0
+17	2916	.	G	<X>	0	.	DP=24;I16=11,12,0,0,813,29935,0,0,1380,82800,0,0,443,9613,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,173:6:0	0,15,155:5:0
+17	2917	.	A	<X>	0	.	DP=25;I16=11,13,0,0,864,31926,0,0,1440,86400,0,0,459,10181,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,185:6:0	0,18,178:6:0
+17	2918	.	G	<X>	0	.	DP=25;I16=13,12,0,0,903,33489,0,0,1500,90000,0,0,462,10122,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,18,165:6:0	0,18,170:6:0
+17	2919	.	T	<X>	0	.	DP=25;I16=12,12,0,0,837,29647,0,0,1440,86400,0,0,443,9765,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,169:6:0	0,18,178:6:0
+17	2920	.	G	<X>	0	.	DP=25;I16=12,12,0,0,850,31266,0,0,1440,86400,0,0,433,9389,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,132:5:0	0,18,180:6:0
+17	2921	.	G	<X>	0	.	DP=25;I16=13,12,0,0,874,31518,0,0,1500,90000,0,0,455,9951,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,18,159:6:0	0,18,176:6:0
+17	2922	.	C	<X>	0	.	DP=26;I16=13,12,0,0,872,31374,0,0,1500,90000,0,0,438,9718,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,18,160:6:0	0,18,172:6:0
+17	2923	.	C	<X>	0	.	DP=26;I16=13,12,0,0,873,31687,0,0,1500,90000,0,0,437,9735,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,18,172:6:0	0,18,175:6:0
+17	2924	.	C	<X>	0	.	DP=25;I16=13,12,0,0,940,36016,0,0,1500,90000,0,0,449,9921,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,18,173:6:0	0,18,184:6:0
+17	2925	.	A	<X>	0	.	DP=25;I16=13,12,0,0,912,33580,0,0,1500,90000,0,0,448,9964,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,18,174:6:0	0,18,189:6:0
+17	2926	.	C	<X>	0	.	DP=25;I16=13,12,0,0,902,33224,0,0,1500,90000,0,0,445,9931,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,18,176:6:0	0,18,174:6:0
+17	2927	.	A	<X>	0	.	DP=25;I16=12,12,0,0,896,33828,0,0,1440,86400,0,0,417,9295,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,162:5:0	0,18,191:6:0
+17	2928	.	G	<X>	0	.	DP=24;I16=13,11,0,0,862,32078,0,0,1440,86400,0,0,440,9930,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,170:6:0	0,18,161:6:0
+17	2929	.	C	<X>	0	.	DP=23;I16=13,9,0,0,794,29716,0,0,1320,79200,0,0,430,9878,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,153:5:0	0,15,149:5:0
+17	2930	.	T	<X>	0	.	DP=23;I16=13,10,0,0,822,30260,0,0,1380,82800,0,0,438,10006,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,168:6:0	0,15,157:5:0
+17	2931	.	C	<X>	0	.	DP=23;I16=13,10,0,0,803,28963,0,0,1380,82800,0,0,436,10020,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,162:6:0	0,15,140:5:0
+17	2932	.	G	<X>	0	.	DP=22;I16=12,10,0,0,728,25158,0,0,1320,79200,0,0,435,10049,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,171:6:0	0,12,117:4:0
+17	2933	.	G	<X>	0	.	DP=22;I16=11,10,0,0,760,28336,0,0,1260,75600,0,0,430,10034,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,175:6:0	0,12,116:4:0
+17	2934	.	C	<X>	0	.	DP=21;I16=12,9,0,0,759,28241,0,0,1260,75600,0,0,432,10052,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,161:6:0	0,9,104:3:0
+17	2935	.	C	<X>	0	.	DP=21;I16=12,9,0,0,766,28494,0,0,1260,75600,0,0,431,10075,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,178:6:0	0,9,94:3:0
+17	2936	.	T	<X>	0	.	DP=21;I16=11,9,0,0,760,29284,0,0,1200,72000,0,0,429,10063,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,188:6:0	0,9,98:3:0
+17	2937	.	G	<X>	0	.	DP=20;I16=11,9,0,0,728,27374,0,0,1200,72000,0,0,428,10066,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,177:6:0	0,9,79:3:0
+17	2938	.	T	<X>	0	.	DP=20;I16=11,9,0,0,719,26217,0,0,1200,72000,0,0,427,10083,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,188:6:0	0,9,101:3:0
+17	2939	.	C	<X>	0	.	DP=19;I16=11,8,0,0,729,28277,0,0,1140,68400,0,0,427,10113,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,163:5:0	0,9,106:3:0
+17	2940	.	T	<X>	0	.	DP=19;I16=11,8,0,0,739,29133,0,0,1140,68400,0,0,427,10155,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,171:5:0	0,9,109:3:0
+17	2941	.	T	<X>	0	.	DP=19;I16=11,8,0,0,702,26358,0,0,1140,68400,0,0,427,10209,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,170:5:0	0,9,99:3:0
+17	2942	.	T	<X>	0	.	DP=19;I16=11,8,0,0,695,25671,0,0,1140,68400,0,0,427,10275,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,169:5:0	0,9,100:3:0
+17	2943	.	G	<X>	0	.	DP=18;I16=11,6,0,0,621,23187,0,0,1020,61200,0,0,401,9627,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,228:9:0	0,15,170:5:0	0,9,86:3:0
+17	2944	.	A	<X>	0	.	DP=18;I16=10,7,0,0,642,24406,0,0,1020,61200,0,0,399,9563,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,239:9:0	0,15,168:5:0	0,9,111:3:0
+17	2945	.	A	<X>	0	.	DP=18;I16=11,7,0,0,637,23199,0,0,1080,64800,0,0,422,10132,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,242:10:0	0,15,152:5:0	0,9,107:3:0
+17	2946	.	A	<X>	0	.	DP=18;I16=11,7,0,0,692,26794,0,0,1080,64800,0,0,420,10084,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,15,174:5:0	0,9,108:3:0
+17	2947	.	G	<X>	0	.	DP=18;I16=11,7,0,0,639,23329,0,0,1080,64800,0,0,418,10044,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,15,160:5:0	0,9,78:3:0
+17	2948	.	G	<X>	0	.	DP=19;I16=11,8,0,0,702,26272,0,0,1140,68400,0,0,415,9961,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,15,163:5:0	0,12,116:4:0
+17	2949	.	C	<X>	0	.	DP=19;I16=10,8,0,0,657,24565,0,0,1080,64800,0,0,388,9260,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,12,125:4:0	0,12,124:4:0
+17	2950	.	C	<X>	0	.	DP=19;I16=11,8,0,0,667,24359,0,0,1140,68400,0,0,411,9817,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,15,131:5:0	0,12,115:4:0
+17	2951	.	A	<X>	0	.	DP=20;I16=11,8,0,0,682,24956,0,0,1140,68400,0,0,409,9757,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,250:10:0	0,15,149:5:0	0,12,133:4:0
+17	2952	.	C	<X>	0	.	DP=20;I16=11,9,0,0,647,21709,0,0,1200,72000,0,0,408,9706,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,128:5:0	0,12,112:4:0
+17	2953	.	G	<X>	0	.	DP=21;I16=11,9,0,0,620,19954,0,0,1200,72000,0,0,407,9665,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,237:11:0	0,15,132:5:0	0,12,111:4:0
+17	2954	.	T	<X>	0	.	DP=21;I16=11,10,0,0,742,26662,0,0,1260,75600,0,0,414,9666,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,175:6:0	0,12,135:4:0
+17	2955	.	G	<X>	0	.	DP=22;I16=11,11,0,0,787,28475,0,0,1320,79200,0,0,412,9568,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,170:6:0	0,12,127:4:0
+17	2956	.	A	<X>	0	.	DP=22;I16=11,11,0,0,747,26449,0,0,1320,79200,0,0,410,9438,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,161:6:0	0,12,125:4:0
+17	2957	.	C	<X>	0	.	DP=22;I16=10,10,0,0,693,24757,0,0,1200,72000,0,0,358,8078,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,143:6:0	0,9,104:3:0
+17	2958	.	C	<X>	0	.	DP=21;I16=11,10,0,0,784,29744,0,0,1260,75600,0,0,407,9237,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,172:6:0	0,12,135:4:0
+17	2959	.	T	<X>	0	.	DP=21;I16=11,10,0,0,791,30411,0,0,1260,75600,0,0,406,9164,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,182:6:0	0,12,139:4:0
+17	2960	.	G	<X>	0	.	DP=21;I16=11,10,0,0,778,29502,0,0,1260,75600,0,0,405,9109,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,178:6:0	0,12,126:4:0
+17	2961	.	G	<X>	0	.	DP=20;I16=10,9,0,0,657,23303,0,0,1140,68400,0,0,380,8446,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,231:10:0	0,18,176:6:0	0,9,111:3:0
+17	2962	.	C	<X>	0	.	DP=21;I16=10,10,0,0,731,27459,0,0,1200,72000,0,0,385,8615,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,151:5:0	0,12,132:4:0
+17	2963	.	C	<X>	0	.	DP=21;I16=10,10,0,0,722,26502,0,0,1200,72000,0,0,378,8274,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,169:6:0	0,9,100:3:0
+17	2964	.	C	<X>	0	.	DP=22;I16=11,10,0,0,752,27740,0,0,1260,75600,0,0,379,8275,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,148:5:0	0,15,151:5:0
+17	2965	.	A	<X>	0	.	DP=22;I16=11,11,0,0,804,29606,0,0,1320,79200,0,0,397,8539,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,176:6:0	0,15,155:5:0
+17	2966	.	C	<X>	0	.	DP=22;I16=11,11,0,0,705,23557,0,0,1320,79200,0,0,396,8468,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,254:11:0	0,18,146:6:0	0,15,142:5:0
+17	2967	.	G	<X>	0	.	DP=24;I16=11,13,0,0,767,25405,0,0,1440,86400,0,0,393,8325,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,162:6:0	0,18,135:6:0
+17	2968	.	G	<X>	0	.	DP=23;I16=11,12,0,0,812,29824,0,0,1380,82800,0,0,393,8213,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,152:5:0	0,18,162:6:0
+17	2969	.	C	<X>	0	.	DP=23;I16=11,12,0,0,866,32982,0,0,1380,82800,0,0,393,8133,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,151:5:0	0,18,181:6:0
+17	2970	.	T	<X>	0	.	DP=24;I16=11,12,0,0,816,29806,0,0,1380,82800,0,0,393,8085,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,154:5:0	0,18,189:6:0
+17	2971	.	G	<X>	0	.	DP=24;I16=12,12,0,0,878,33010,0,0,1440,86400,0,0,392,7970,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,173:6:0	0,18,184:6:0
+17	2972	.	G	<X>	0	.	DP=24;I16=12,12,0,0,839,30363,0,0,1440,86400,0,0,391,7889,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,175:6:0	0,18,161:6:0
+17	2973	.	C	<X>	0	.	DP=24;I16=12,12,0,0,854,31154,0,0,1440,86400,0,0,390,7842,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,177:6:0	0,18,165:6:0
+17	2974	.	A	<X>	0	.	DP=24;I16=12,12,0,0,869,32231,0,0,1440,86400,0,0,388,7778,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,169:6:0	0,18,174:6:0
+17	2975	.	G	<X>	0	.	DP=24;I16=12,12,0,0,857,31835,0,0,1440,86400,0,0,384,7648,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,173:6:0	0,18,167:6:0
+17	2976	.	G	<X>	0	.	DP=25;I16=13,12,0,0,866,31118,0,0,1500,90000,0,0,380,7554,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,21,180:7:0	0,18,171:6:0
+17	2977	.	T	<X>	0	.	DP=26;I16=13,12,0,0,760,25216,0,0,1469,87241,0,0,373,7437,0,0;QS=3,0;MQSB=0.948139;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,18,151:6:0	0,18,155:6:0
+17	2978	.	G	<X>	0	.	DP=25;I16=12,12,0,0,862,31574,0,0,1409,83641,0,0,362,7290,0,0;QS=3,0;MQSB=0.941765;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,168:6:0	0,18,167:6:0
+17	2979	.	G	<X>	0	.	DP=24;I16=12,12,0,0,816,28440,0,0,1409,83641,0,0,370,7340,0,0;QS=3,0;MQSB=0.941765;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,18,164:6:0	0,15,142:5:0
+17	2980	.	G	<X>	0	.	DP=23;I16=12,11,0,0,834,30882,0,0,1349,80041,0,0,369,7293,0,0;QS=3,0;MQSB=0.944319;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,144:5:0	0,15,148:5:0
+17	2981	.	A	<X>	0	.	DP=23;I16=9,11,0,0,622,20306,0,0,1169,69241,0,0,318,6244,0,0;QS=3,0;MQSB=0.916401;MQ0F=0	PL:DP:DV	0,30,201:10:0	0,15,145:5:0	0,15,150:5:0
+17	2982	.	C	<X>	0	.	DP=23;I16=10,11,0,0,706,24366,0,0,1229,72841,0,0,340,6884,0,0;QS=3,0;MQSB=0.927743;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,9,93:3:0	0,15,144:5:0
+17	2983	.	C	<X>	0	.	DP=23;I16=12,11,0,0,781,27427,0,0,1349,80041,0,0,363,7197,0,0;QS=3,0;MQSB=0.944319;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,137:5:0	0,15,142:5:0
+17	2984	.	C	<X>	0	.	DP=23;I16=12,11,0,0,861,32655,0,0,1349,80041,0,0,361,7229,0,0;QS=3,0;MQSB=0.944319;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,154:5:0	0,15,157:5:0
+17	2985	.	A	<X>	0	.	DP=23;I16=12,11,0,0,798,28906,0,0,1349,80041,0,0,359,7293,0,0;QS=3,0;MQSB=0.944319;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,161:5:0	0,15,151:5:0
+17	2986	.	G	<X>	0	.	DP=21;I16=11,10,0,0,701,24335,0,0,1229,72841,0,0,358,7388,0,0;QS=3,0;MQSB=0.939898;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,129:5:0	0,12,126:4:0
+17	2987	.	C	<X>	0	.	DP=21;I16=10,10,0,0,720,26782,0,0,1169,69241,0,0,350,7448,0,0;QS=3,0;MQSB=0.931063;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,136:4:0	0,12,132:4:0
+17	2988	.	T	<X>	0	.	DP=20;I16=10,10,0,0,693,25143,0,0,1169,69241,0,0,358,7612,0,0;QS=3,0;MQSB=0.931063;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,132:5:0	0,12,136:4:0
+17	2989	.	G	<X>	0	.	DP=20;I16=10,10,0,0,708,25886,0,0,1169,69241,0,0,358,7736,0,0;QS=3,0;MQSB=0.931063;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,141:5:0	0,12,125:4:0
+17	2990	.	C	<X>	0	.	DP=20;I16=10,10,0,0,697,25083,0,0,1169,69241,0,0,357,7833,0,0;QS=3,0;MQSB=0.931063;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,149:5:0	0,12,129:4:0
+17	2991	.	A	<X>	0	.	DP=20;I16=10,10,0,0,717,26309,0,0,1169,69241,0,0,356,7952,0,0;QS=3,0;MQSB=0.931063;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,151:5:0	0,12,131:4:0
+17	2992	.	G	<X>	0	.	DP=18;I16=10,8,0,0,625,22505,0,0,1049,62041,0,0,356,8042,0,0;QS=3,0;MQSB=0.938795;MQ0F=0	PL:DP:DV	0,30,243:10:0	0,12,130:4:0	0,12,120:4:0
+17	2993	.	G	<X>	0	.	DP=18;I16=10,8,0,0,646,23620,0,0,1049,62041,0,0,354,8050,0,0;QS=3,0;MQSB=0.938795;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,12,118:4:0	0,12,123:4:0
+17	2994	.	G	<X>	0	.	DP=18;I16=10,8,0,0,620,21828,0,0,1049,62041,0,0,351,8025,0,0;QS=3,0;MQSB=0.938795;MQ0F=0	PL:DP:DV	0,30,254:10:0	0,12,115:4:0	0,12,116:4:0
+17	2995	.	G	<X>	0	.	DP=18;I16=10,8,0,0,628,22284,0,0,1049,62041,0,0,348,8018,0,0;QS=3,0;MQSB=0.938795;MQ0F=0	PL:DP:DV	0,30,248:10:0	0,12,110:4:0	0,12,135:4:0
+17	2996	.	T	<X>	0	.	DP=17;I16=8,8,0,0,497,16697,0,0,929,54841,0,0,323,7493,0,0;QS=3,0;MQSB=0.915545;MQ0F=0	PL:DP:DV	0,30,215:10:0	0,9,75:3:0	0,9,107:3:0
+17	2997	.	C	<X>	0	.	DP=17;I16=9,8,0,0,603,21925,0,0,989,58441,0,0,341,7901,0,0;QS=3,0;MQSB=0.928603;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,9,85:3:0	0,12,115:4:0
+17	2998	.	C	<X>	0	.	DP=17;I16=9,8,0,0,576,19964,0,0,989,58441,0,0,337,7841,0,0;QS=3,0;MQSB=0.928603;MQ0F=0	PL:DP:DV	0,30,247:10:0	0,9,84:3:0	0,12,123:4:0
+17	2999	.	A	<X>	0	.	DP=17;I16=9,8,0,0,599,22077,0,0,989,58441,0,0,333,7797,0,0;QS=3,0;MQSB=0.928603;MQ0F=0	PL:DP:DV	0,30,238:10:0	0,9,109:3:0	0,12,136:4:0
+17	3000	.	G	<X>	0	.	DP=15;I16=8,7,0,0,554,20620,0,0,869,51241,0,0,331,7767,0,0;QS=3,0;MQSB=0.921243;MQ0F=0	PL:DP:DV	0,24,220:8:0	0,9,102:3:0	0,12,135:4:0
+17	3001	.	C	<X>	0	.	DP=15;I16=7,7,0,0,521,19695,0,0,809,47641,0,0,309,7349,0,0;QS=3,0;MQSB=0.885987;MQ0F=0	PL:DP:DV	0,21,213:7:0	0,9,103:3:0	0,12,128:4:0
+17	3002	.	A	<X>	0	.	DP=15;I16=8,7,0,0,542,20082,0,0,869,51241,0,0,326,7692,0,0;QS=3,0;MQSB=0.921243;MQ0F=0	PL:DP:DV	0,24,224:8:0	0,9,92:3:0	0,12,139:4:0
+17	3003	.	G	<X>	0	.	DP=15;I16=8,7,0,0,540,19814,0,0,869,51241,0,0,322,7594,0,0;QS=3,0;MQSB=0.921243;MQ0F=0	PL:DP:DV	0,24,230:8:0	0,9,96:3:0	0,12,120:4:0
+17	3004	.	C	<X>	0	.	DP=15;I16=8,7,0,0,525,19113,0,0,869,51241,0,0,318,7504,0,0;QS=3,0;MQSB=0.921243;MQ0F=0	PL:DP:DV	0,24,211:8:0	0,9,100:3:0	0,12,129:4:0
+17	3005	.	A	<X>	0	.	DP=14;I16=7,7,0,0,491,17343,0,0,809,47641,0,0,315,7421,0,0;QS=3,0;MQSB=0.885987;MQ0F=0	PL:DP:DV	0,21,197:7:0	0,9,95:3:0	0,12,124:4:0
+17	3006	.	C	<X>	0	.	DP=16;I16=7,8,0,0,516,18376,0,0,869,51241,0,0,312,7344,0,0;QS=3,0;MQSB=0.898397;MQ0F=0	PL:DP:DV	0,24,200:8:0	0,9,95:3:0	0,12,135:4:0
+17	3007	.	C	<X>	0	.	DP=16;I16=7,8,0,0,553,20853,0,0,869,51241,0,0,310,7274,0,0;QS=3,0;MQSB=0.898397;MQ0F=0	PL:DP:DV	0,24,214:8:0	0,9,103:3:0	0,12,144:4:0
+17	3008	.	C	<X>	0	.	DP=16;I16=7,8,0,0,576,22238,0,0,869,51241,0,0,308,7212,0,0;QS=3,0;MQSB=0.898397;MQ0F=0	PL:DP:DV	0,24,228:8:0	0,9,105:3:0	0,12,145:4:0
+17	3009	.	A	<X>	0	.	DP=16;I16=7,8,0,0,493,16739,0,0,869,51241,0,0,306,7158,0,0;QS=3,0;MQSB=0.898397;MQ0F=0	PL:DP:DV	0,24,200:8:0	0,9,83:3:0	0,12,130:4:0
+17	3010	.	C	<X>	0	.	DP=15;I16=7,7,0,0,534,20464,0,0,809,47641,0,0,300,7096,0,0;QS=3,0;MQSB=0.885987;MQ0F=0	PL:DP:DV	0,21,211:7:0	0,9,106:3:0	0,12,135:4:0
+17	3011	.	A	<X>	0	.	DP=16;I16=7,8,0,0,559,21173,0,0,869,51241,0,0,302,7074,0,0;QS=3,0;MQSB=0.898397;MQ0F=0	PL:DP:DV	0,24,218:8:0	0,9,104:3:0	0,12,145:4:0
+17	3012	.	G	<X>	0	.	DP=16;I16=7,8,0,0,503,17903,0,0,869,51241,0,0,300,7044,0,0;QS=3,0;MQSB=0.898397;MQ0F=0	PL:DP:DV	0,24,193:8:0	0,9,93:3:0	0,12,141:4:0
+17	3013	.	C	<X>	0	.	DP=16;I16=7,9,0,0,549,19967,0,0,898,52082,0,0,305,7071,0,0;QS=3,0;MQSB=0.994413;MQ0F=0	PL:DP:DV	0,27,207:9:0	0,9,98:3:0	0,12,141:4:0
+17	3014	.	A	<X>	0	.	DP=18;I16=6,9,0,0,542,20362,0,0,838,48482,0,0,289,6959,0,0;QS=3,0;MQSB=0.984496;MQ0F=0	PL:DP:DV	0,24,195:8:0	0,9,109:3:0	0,12,141:4:0
+17	3015	.	G	<X>	0	.	DP=20;I16=7,9,0,0,549,19441,0,0,929,54841,0,0,311,7547,0,0;QS=3,0;MQSB=0.892753;MQ0F=0	PL:DP:DV	0,24,206:8:0	0,12,116:4:0	0,12,131:4:0
+17	3016	.	C	<X>	0	.	DP=20;I16=7,13,0,0,690,24374,0,0,1138,66482,0,0,337,7783,0,0;QS=3,0;MQSB=0.972138;MQ0F=0	PL:DP:DV	0,33,248:11:0	0,15,136:5:0	0,12,132:4:0
+17	3017	.	C	A,<X>	0	.	DP=20;I16=7,12,0,1,650,23264,23,529,1109,65641,29,841,329,7715,11,121;QS=2.93801,0.0619946,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.972138;BQB=1;MQ0F=0	PL:DP:DV	0,10,224,30,227,236:11:1	0,15,133,15,133,133:5:0	0,12,128,12,128,128:4:0
+17	3018	.	A	<X>	0	.	DP=21;I16=6,10,0,0,475,15057,0,0,929,54841,0,0,295,6991,0,0;QS=3,0;MQSB=0.863243;MQ0F=0	PL:DP:DV	0,27,192:9:0	0,12,111:4:0	0,9,81:3:0
+17	3019	.	C	<X>	0	.	DP=20;I16=6,12,0,0,618,21842,0,0,1049,62041,0,0,336,7818,0,0;QS=3,0;MQSB=0.85394;MQ0F=0	PL:DP:DV	0,30,242:10:0	0,15,129:5:0	0,9,104:3:0
+17	3020	.	C	<X>	0	.	DP=20;I16=6,12,0,0,588,21046,0,0,1049,62041,0,0,340,7888,0,0;QS=3,0;MQSB=0.85394;MQ0F=0	PL:DP:DV	0,30,221:10:0	0,15,129:5:0	0,9,114:3:0
+17	3021	.	T	<X>	0	.	DP=21;I16=5,13,0,0,618,22454,0,0,1049,62041,0,0,343,7921,0,0;QS=3,0;MQSB=0.814433;MQ0F=0	PL:DP:DV	0,30,216:10:0	0,15,147:5:0	0,9,109:3:0
+17	3022	.	G	<X>	0	.	DP=20;I16=5,13,0,0,672,25292,0,0,1049,62041,0,0,348,7968,0,0;QS=3,0;MQSB=0.814433;MQ0F=0	PL:DP:DV	0,30,234:10:0	0,15,153:5:0	0,9,109:3:0
+17	3023	.	T	G,<X>	0	.	DP=20;I16=5,12,0,1,554,19110,18,324,989,58441,60,3600,336,7740,17,289;QS=2.94231,0.0576923,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.814433;BQB=1;MQ0F=0	PL:DP:DV	0,12,191,27,194,199:10:1	0,15,125,15,125,125:5:0	0,9,111,9,111,111:3:0
+17	3024	.	G	<X>	0	.	DP=20;I16=5,14,0,0,684,25122,0,0,1109,65641,0,0,382,8680,0,0;QS=3,0;MQSB=0.810584;MQ0F=0	PL:DP:DV	0,30,235:10:0	0,18,152:6:0	0,9,113:3:0
+17	3025	.	G	<X>	0	.	DP=20;I16=5,14,0,0,625,21465,0,0,1109,65641,0,0,386,8722,0,0;QS=3,0;MQSB=0.810584;MQ0F=0	PL:DP:DV	0,30,225:10:0	0,18,133:6:0	0,9,109:3:0
+17	3026	.	C	<X>	0	.	DP=20;I16=5,13,0,0,632,23132,0,0,1018,59282,0,0,367,8217,0,0;QS=3,0;MQSB=0.925212;MQ0F=0	PL:DP:DV	0,33,235:11:0	0,12,105:4:0	0,9,107:3:0
+17	3027	.	A	<X>	0	.	DP=21;I16=6,15,0,0,693,24199,0,0,1198,70082,0,0,413,9199,0,0;QS=3,0;MQSB=0.940481;MQ0F=0	PL:DP:DV	0,33,222:11:0	0,21,175:7:0	0,9,108:3:0
+17	3028	.	G	<X>	0	.	DP=21;I16=6,15,0,0,753,27935,0,0,1198,70082,0,0,417,9239,0,0;QS=3,0;MQSB=0.940481;MQ0F=0	PL:DP:DV	0,33,241:11:0	0,21,192:7:0	0,9,107:3:0
+17	3029	.	G	<X>	0	.	DP=21;I16=6,15,0,0,787,29949,0,0,1198,70082,0,0,421,9303,0,0;QS=3,0;MQSB=0.940481;MQ0F=0	PL:DP:DV	0,33,251:11:0	0,21,189:7:0	0,9,109:3:0
+17	3030	.	G	<X>	0	.	DP=22;I16=6,16,0,0,720,24728,0,0,1258,73682,0,0,424,9342,0,0;QS=3,0;MQSB=0.934321;MQ0F=0	PL:DP:DV	0,36,229:12:0	0,21,174:7:0	0,9,106:3:0
+17	3031	.	A	<X>	0	.	DP=22;I16=5,16,0,0,693,24631,0,0,1198,70082,0,0,403,8783,0,0;QS=3,0;MQSB=0.902014;MQ0F=0	PL:DP:DV	0,36,222:12:0	0,18,162:6:0	0,9,113:3:0
+17	3032	.	G	<X>	0	.	DP=22;I16=6,15,0,0,727,26093,0,0,1229,72841,0,0,405,8775,0,0;QS=3,0;MQSB=0.843281;MQ0F=0	PL:DP:DV	0,33,237:11:0	0,21,180:7:0	0,9,106:3:0
+17	3033	.	G	<X>	0	.	DP=22;I16=6,15,0,0,697,24039,0,0,1198,70082,0,0,429,9407,0,0;QS=3,0;MQSB=0.940481;MQ0F=0	PL:DP:DV	0,33,235:11:0	0,21,160:7:0	0,9,106:3:0
+17	3034	.	A	<X>	0	.	DP=23;I16=6,14,0,0,617,20947,0,0,1138,66482,0,0,387,8491,0,0;QS=3,0;MQSB=0.947033;MQ0F=0	PL:DP:DV	0,33,203:11:0	0,15,134:5:0	0,12,126:4:0
+17	3035	.	G	<X>	0	.	DP=23;I16=7,13,0,0,641,22007,0,0,1138,66482,0,0,385,8379,0,0;QS=3,0;MQSB=0.972138;MQ0F=0	PL:DP:DV	0,30,208:10:0	0,18,151:6:0	0,12,128:4:0
+17	3036	.	C	<X>	0	.	DP=23;I16=6,15,0,0,688,23652,0,0,1198,70082,0,0,388,8258,0,0;QS=3,0;MQSB=0.940481;MQ0F=0	PL:DP:DV	0,36,216:12:0	0,15,132:5:0	0,12,140:4:0
+17	3037	.	T	<X>	0	.	DP=24;I16=7,16,0,0,797,28671,0,0,1318,77282,0,0,439,9521,0,0;QS=3,0;MQSB=0.955805;MQ0F=0	PL:DP:DV	0,36,242:12:0	0,21,170:7:0	0,12,143:4:0
+17	3038	.	T	<X>	0	.	DP=25;I16=8,17,0,0,815,27469,0,0,1438,84482,0,0,441,9561,0,0;QS=3,0;MQSB=0.966223;MQ0F=0	PL:DP:DV	0,42,249:14:0	0,21,190:7:0	0,12,125:4:0
+17	3039	.	G	<X>	0	.	DP=25;I16=8,17,0,0,780,25946,0,0,1438,84482,0,0,444,9630,0,0;QS=3,0;MQSB=0.966223;MQ0F=0	PL:DP:DV	0,42,249:14:0	0,21,156:7:0	0,12,127:4:0
+17	3040	.	T	<X>	0	.	DP=25;I16=7,15,0,0,701,23777,0,0,1258,73682,0,0,385,8279,0,0;QS=3,0;MQSB=0.961028;MQ0F=0	PL:DP:DV	0,36,239:12:0	0,18,154:6:0	0,12,130:4:0
+17	3041	.	G	<X>	0	.	DP=25;I16=8,16,0,0,824,29228,0,0,1378,80882,0,0,420,8982,0,0;QS=3,0;MQSB=0.970446;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,21,186:7:0	0,12,135:4:0
+17	3042	.	G	<X>	0	.	DP=25;I16=8,15,0,0,795,28227,0,0,1349,80041,0,0,409,8839,0,0;QS=3,0;MQSB=0.889418;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,18,148:6:0	0,12,120:4:0
+17	3043	.	T	<X>	0	.	DP=25;I16=8,16,0,0,723,23191,0,0,1378,80882,0,0,435,9415,0,0;QS=3,0;MQSB=0.970446;MQ0F=0	PL:DP:DV	0,39,233:13:0	0,21,151:7:0	0,12,124:4:0
+17	3044	.	A	C,<X>	0	.	DP=26;I16=8,15,0,1,665,20809,15,225,1318,77282,60,3600,392,8498,14,196;QS=2.96104,0.038961,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.970446;BQB=1;MQ0F=0	PL:DP:DV	0,26,216,39,219,220:14:1	0,18,133,18,133,133:6:0	0,12,124,12,124,124:4:0
+17	3045	.	C	<X>	0	.	DP=26;I16=8,16,0,0,754,25232,0,0,1378,80882,0,0,403,8627,0,0;QS=3,0;MQSB=0.970446;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,18,133:6:0	0,12,122:4:0
+17	3046	.	A	<X>	0	.	DP=25;I16=8,15,0,0,748,26170,0,0,1349,80041,0,0,400,8540,0,0;QS=3,0;MQSB=0.889418;MQ0F=0	PL:DP:DV	0,39,245:13:0	0,18,160:6:0	0,12,141:4:0
+17	3047	.	G	<X>	0	.	DP=25;I16=8,15,0,0,766,26998,0,0,1318,77282,0,0,396,8432,0,0;QS=3,0;MQSB=0.974802;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,18,143:6:0	0,12,129:4:0
+17	3048	.	T	<X>	0	.	DP=25;I16=8,11,0,0,608,20554,0,0,1109,65641,0,0,320,6762,0,0;QS=3,0;MQSB=0.902014;MQ0F=0	PL:DP:DV	0,30,226:10:0	0,15,128:5:0	0,12,129:4:0
+17	3049	.	G	<X>	0	.	DP=24;I16=8,16,0,0,831,29557,0,0,1378,80882,0,0,426,9068,0,0;QS=3,0;MQSB=0.970446;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,18,161:6:0	0,9,105:3:0
+17	3050	.	G	<X>	0	.	DP=24;I16=8,14,0,0,729,25093,0,0,1258,73682,0,0,379,8041,0,0;QS=3,0;MQSB=0.979255;MQ0F=0	PL:DP:DV	0,39,253:13:0	0,18,159:6:0	0,9,100:3:0
+17	3051	.	A	<X>	0	.	DP=23;I16=8,15,0,0,724,24200,0,0,1318,77282,0,0,423,9091,0,0;QS=3,0;MQSB=0.974802;MQ0F=0	PL:DP:DV	0,42,243:14:0	0,18,152:6:0	0,9,103:3:0
+17	3052	.	C	<X>	0	.	DP=23;I16=7,13,0,0,612,19876,0,0,1169,69241,0,0,363,7779,0,0;QS=3,0;MQSB=0.962269;MQ0F=0	PL:DP:DV	0,36,226:12:0	0,15,117:5:0	0,9,93:3:0
+17	3053	.	A	<X>	0	.	DP=22;I16=8,11,0,0,616,21288,0,0,1078,62882,0,0,360,7740,0,0;QS=3,0;MQSB=0.992359;MQ0F=0	PL:DP:DV	0,33,234:11:0	0,15,118:5:0	0,9,110:3:0
+17	3054	.	G	<X>	0	.	DP=22;I16=8,14,0,0,761,27617,0,0,1258,73682,0,0,414,8932,0,0;QS=3,0;MQSB=0.979255;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,126:5:0	0,9,99:3:0
+17	3055	.	G	<X>	0	.	DP=22;I16=8,9,0,0,566,19890,0,0,958,55682,0,0,333,7219,0,0;QS=3,0;MQSB=0.998843;MQ0F=0	PL:DP:DV	0,30,228:10:0	0,12,111:4:0	0,9,105:3:0
+17	3056	.	C	<X>	0	.	DP=22;I16=7,14,0,0,701,24685,0,0,1198,70082,0,0,420,9298,0,0;QS=3,0;MQSB=0.966484;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,125:4:0	0,12,122:4:0
+17	3057	.	C	<X>	0	.	DP=23;I16=8,13,0,0,706,24988,0,0,1198,70082,0,0,411,9253,0,0;QS=3,0;MQSB=0.983744;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,128:5:0	0,9,92:3:0
+17	3058	.	C	<X>	0	.	DP=23;I16=9,14,0,0,707,23327,0,0,1318,77282,0,0,429,9471,0,0;QS=3,0;MQSB=0.987676;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,131:5:0	0,12,116:4:0
+17	3059	.	T	G,<X>	0	.	DP=23;I16=9,11,0,1,638,21954,16,256,1169,69241,60,3600,355,7761,22,484;QS=2.95876,0.0412371,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.913101;BQB=1;MQ0F=0	PL:DP:DV	0,22,234,36,237,239:13:1	0,15,144,15,144,144:5:0	0,9,94,9,94,94:3:0
+17	3060	.	G	<X>	0	.	DP=24;I16=9,10,0,0,578,19136,0,0,1109,65641,0,0,324,6992,0,0;QS=3,0;MQSB=0.920044;MQ0F=0	PL:DP:DV	0,33,221:11:0	0,12,121:4:0	0,12,116:4:0
+17	3061	.	C	<X>	0	.	DP=24;I16=9,15,0,0,770,25918,0,0,1378,80882,0,0,446,10136,0,0;QS=3,0;MQSB=0.984127;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,138:5:0	0,15,145:5:0
+17	3062	.	C	<X>	0	.	DP=23;I16=9,13,0,0,727,25019,0,0,1289,76441,0,0,419,9551,0,0;QS=3,0;MQSB=0.910098;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,137:5:0	0,15,134:5:0
+17	3063	.	C	<X>	0	.	DP=23;I16=9,13,0,0,651,21695,0,0,1258,73682,0,0,415,9511,0,0;QS=3,0;MQSB=0.991121;MQ0F=0	PL:DP:DV	0,36,233:12:0	0,15,130:5:0	0,15,133:5:0
+17	3064	.	A	<X>	0	.	DP=23;I16=9,12,0,0,691,24125,0,0,1198,70082,0,0,385,8815,0,0;QS=3,0;MQSB=0.994334;MQ0F=0	PL:DP:DV	0,36,254:12:0	0,12,118:4:0	0,15,144:5:0
+17	3065	.	G	<X>	0	.	DP=22;I16=7,14,0,0,653,21733,0,0,1198,70082,0,0,426,9986,0,0;QS=3,0;MQSB=0.966484;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,109:4:0	0,12,118:4:0
+17	3066	.	A	<X>	0	.	DP=21;I16=7,10,0,0,501,16143,0,0,989,58441,0,0,326,7598,0,0;QS=3,0;MQSB=0.887766;MQ0F=0	PL:DP:DV	0,27,202:9:0	0,12,109:4:0	0,12,104:4:0
+17	3067	.	T	<X>	0	.	DP=21;I16=7,12,0,0,535,16779,0,0,1078,62882,0,0,373,8787,0,0;QS=3,0;MQSB=0.977926;MQ0F=0	PL:DP:DV	0,36,223:12:0	0,9,82:3:0	0,12,103:4:0
+17	3068	.	G	<X>	0	.	DP=20;I16=7,12,0,0,645,22781,0,0,1109,65641,0,0,396,9312,0,0;QS=3,0;MQSB=0.879351;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,115:4:0	0,9,84:3:0
+17	3069	.	G	<X>	0	.	DP=20;I16=7,10,0,0,468,14412,0,0,989,58441,0,0,346,8070,0,0;QS=3,0;MQSB=0.887766;MQ0F=0	PL:DP:DV	0,33,203:11:0	0,12,102:4:0	0,6,57:2:0
+17	3070	.	C	<X>	0	.	DP=20;I16=6,13,0,0,627,22135,0,0,1078,62882,0,0,414,9878,0,0;QS=3,0;MQSB=0.953977;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,9,98:3:0	0,9,98:3:0
+17	3071	.	C	<X>	0	.	DP=20;I16=7,13,0,0,715,26563,0,0,1138,66482,0,0,419,9893,0,0;QS=3,0;MQSB=0.972138;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,123:4:0	0,9,98:3:0
+17	3072	.	C	<X>	0	.	DP=20;I16=6,13,0,0,696,25784,0,0,1109,65641,0,0,414,9866,0,0;QS=3,0;MQSB=0.965977;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,128:4:0	0,9,106:3:0
+17	3073	.	C	<X>	0	.	DP=20;I16=6,13,0,0,706,26822,0,0,1109,65641,0,0,414,9872,0,0;QS=3,0;MQSB=0.965977;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,135:4:0	0,9,115:3:0
+17	3074	.	C	<X>	0	.	DP=20;I16=6,13,0,0,724,28052,0,0,1109,65641,0,0,414,9886,0,0;QS=3,0;MQSB=0.965977;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,135:4:0	0,9,116:3:0
+17	3075	.	C	<X>	0	.	DP=21;I16=6,13,0,0,630,21614,0,0,1109,65641,0,0,389,9283,0,0;QS=3,0;MQSB=0.965977;MQ0F=0	PL:DP:DV	0,33,239:11:0	0,15,140:5:0	0,9,94:3:0
+17	3076	.	G	<X>	0	.	DP=21;I16=6,14,0,0,645,21809,0,0,1169,69241,0,0,415,9939,0,0;QS=3,0;MQSB=0.969852;MQ0F=0	PL:DP:DV	0,36,252:12:0	0,15,126:5:0	0,9,91:3:0
+17	3077	.	C	<X>	0	.	DP=20;I16=5,15,0,0,694,25228,0,0,1169,69241,0,0,417,9979,0,0;QS=3,0;MQSB=0.976472;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,116:4:0	0,9,111:3:0
+17	3078	.	C	<X>	0	.	DP=20;I16=5,15,0,0,767,29761,0,0,1169,69241,0,0,420,10028,0,0;QS=3,0;MQSB=0.976472;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,113:4:0	0,9,111:3:0
+17	3079	.	T	<X>	0	.	DP=20;I16=5,15,0,0,749,28479,0,0,1169,69241,0,0,422,10038,0,0;QS=3,0;MQSB=0.976472;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,119:4:0	0,9,116:3:0
+17	3080	.	G	<X>	0	.	DP=21;I16=6,15,0,0,785,29901,0,0,1229,72841,0,0,424,10060,0,0;QS=3,0;MQSB=0.973096;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,124:4:0	0,9,103:3:0
+17	3081	.	C	<X>	0	.	DP=21;I16=6,15,0,0,752,27438,0,0,1229,72841,0,0,425,9997,0,0;QS=3,0;MQSB=0.973096;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,118:4:0	0,9,92:3:0
+17	3082	.	C	<X>	0	.	DP=21;I16=6,15,0,0,787,30211,0,0,1229,72841,0,0,426,9952,0,0;QS=3,0;MQSB=0.973096;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,118:4:0	0,9,112:3:0
+17	3083	.	T	C,<X>	0	.	DP=21;I16=6,14,0,1,764,29458,33,1089,1169,69241,60,3600,401,9249,25,625;QS=2.93666,0.0633397,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.973096;BQB=1;MQ0F=0	PL:DP:DV	0,9,255,39,255,255:14:1	0,12,130,12,130,130:4:0	0,9,113,9,113,113:3:0
+17	3084	.	G	<X>	0	.	DP=23;I16=6,17,0,0,859,32755,0,0,1349,80041,0,0,426,9812,0,0;QS=3,0;MQSB=0.978183;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,12,118:4:0	0,12,135:4:0
+17	3085	.	T	<X>	0	.	DP=23;I16=6,16,0,0,824,31132,0,0,1289,76441,0,0,426,9718,0,0;QS=3,0;MQSB=0.97584;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,124:4:0	0,12,135:4:0
+17	3086	.	G	<X>	0	.	DP=23;I16=6,17,0,0,853,32429,0,0,1349,80041,0,0,428,9648,0,0;QS=3,0;MQSB=0.978183;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,12,125:4:0	0,12,131:4:0
+17	3087	.	G	<X>	0	.	DP=23;I16=6,17,0,0,897,35253,0,0,1349,80041,0,0,429,9599,0,0;QS=3,0;MQSB=0.978183;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,12,130:4:0	0,12,137:4:0
+17	3088	.	A	<X>	0	.	DP=22;I16=6,16,0,0,834,31738,0,0,1289,76441,0,0,431,9571,0,0;QS=3,0;MQSB=0.97584;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,9,110:3:0	0,12,135:4:0
+17	3089	.	A	<X>	0	.	DP=23;I16=7,16,0,0,919,36903,0,0,1349,80041,0,0,432,9514,0,0;QS=3,0;MQSB=0.973027;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,9,113:3:0	0,15,175:5:0
+17	3090	.	G	<X>	0	.	DP=23;I16=7,16,0,0,885,34349,0,0,1349,80041,0,0,433,9431,0,0;QS=3,0;MQSB=0.973027;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,9,103:3:0	0,15,160:5:0
+17	3091	.	T	<X>	0	.	DP=23;I16=7,16,0,0,840,31352,0,0,1349,80041,0,0,434,9374,0,0;QS=3,0;MQSB=0.973027;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,9,105:3:0	0,15,153:5:0
+17	3092	.	T	<X>	0	.	DP=24;I16=8,16,0,0,895,33673,0,0,1409,83641,0,0,434,9294,0,0;QS=3,0;MQSB=0.970446;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,109:3:0	0,15,165:5:0
+17	3093	.	G	<X>	0	.	DP=25;I16=9,16,0,0,955,37033,0,0,1469,87241,0,0,434,9192,0,0;QS=3,0;MQSB=0.968069;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,12,133:4:0	0,15,157:5:0
+17	3094	.	A	<X>	0	.	DP=25;I16=9,15,0,0,891,33319,0,0,1409,83641,0,0,425,9019,0,0;QS=3,0;MQSB=0.96464;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,12,134:4:0	0,15,161:5:0
+17	3095	.	C	<X>	0	.	DP=25;I16=9,15,0,0,891,33469,0,0,1409,83641,0,0,425,8955,0,0;QS=3,0;MQSB=0.96464;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,12,131:4:0	0,15,163:5:0
+17	3096	.	C	<X>	0	.	DP=25;I16=9,16,0,0,952,36626,0,0,1469,87241,0,0,436,9014,0,0;QS=3,0;MQSB=0.968069;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,12,121:4:0	0,15,167:5:0
+17	3097	.	A	<X>	0	.	DP=25;I16=9,16,0,0,972,38200,0,0,1469,87241,0,0,436,8984,0,0;QS=3,0;MQSB=0.968069;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,12,144:4:0	0,15,174:5:0
+17	3098	.	G	<X>	0	.	DP=25;I16=9,16,0,0,959,37269,0,0,1469,87241,0,0,436,8986,0,0;QS=3,0;MQSB=0.968069;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,12,134:4:0	0,15,166:5:0
+17	3099	.	A	<X>	0	.	DP=25;I16=9,16,0,0,888,32632,0,0,1469,87241,0,0,435,8971,0,0;QS=3,0;MQSB=0.968069;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,12,124:4:0	0,15,165:5:0
+17	3100	.	C	<X>	0	.	DP=25;I16=9,16,0,0,870,31084,0,0,1469,87241,0,0,434,8990,0,0;QS=3,0;MQSB=0.968069;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,12,126:4:0	0,15,159:5:0
+17	3101	.	C	<X>	0	.	DP=25;I16=9,16,0,0,960,37090,0,0,1469,87241,0,0,432,8992,0,0;QS=3,0;MQSB=0.968069;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,12,134:4:0	0,15,161:5:0
+17	3102	.	A	<X>	0	.	DP=26;I16=10,16,0,0,952,35186,0,0,1529,90841,0,0,430,9026,0,0;QS=3,0;MQSB=0.965874;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,12,134:4:0	0,18,189:6:0
+17	3103	.	T	<X>	0	.	DP=26;I16=10,16,0,0,920,33094,0,0,1529,90841,0,0,427,8993,0,0;QS=3,0;MQSB=0.965874;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,12,131:4:0	0,18,187:6:0
+17	3104	.	C	T,<X>	0	.	DP=25;I16=8,15,2,0,900,35584,80,3202,1349,80041,120,7200,385,8143,40,850;QS=2.58763,0.412371,0;VDB=0.8;SGB=0.346553;RPB=0.717391;MQB=0.956522;MQSB=0.962269;BQB=0.978261;MQ0F=0	PL:DP:DV	0,48,255,48,255,255:16:0	0,12,144,12,144,144:4:0	59,0,93,68,99,157:5:2
+17	3105	.	T	<X>	0	.	DP=25;I16=10,15,0,0,959,37057,0,0,1469,87241,0,0,422,8976,0,0;QS=3,0;MQSB=0.962269;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,12,149:4:0	0,15,169:5:0
+17	3106	.	G	<X>	0	.	DP=23;I16=10,13,0,0,881,33891,0,0,1380,82800,0,0,420,8940,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,132:4:0	0,15,167:5:0
+17	3107	.	T	<X>	0	.	DP=24;I16=10,14,0,0,878,32496,0,0,1440,86400,0,0,418,8932,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,132:4:0	0,18,195:6:0
+17	3108	.	C	<X>	0	.	DP=24;I16=10,14,0,0,909,34897,0,0,1440,86400,0,0,417,8953,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,137:4:0	0,18,189:6:0
+17	3109	.	A	<X>	0	.	DP=24;I16=10,14,0,0,905,34249,0,0,1440,86400,0,0,416,9004,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,136:4:0	0,18,195:6:0
+17	3110	.	C	<X>	0	.	DP=24;I16=10,13,0,0,919,37099,0,0,1380,82800,0,0,413,8933,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,9,105:3:0	0,18,189:6:0
+17	3111	.	A	<X>	0	.	DP=25;I16=10,14,0,0,961,38943,0,0,1440,86400,0,0,410,8888,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,9,111:3:0	0,18,205:6:0
+17	3112	.	G	<X>	0	.	DP=25;I16=10,14,0,0,958,39370,0,0,1440,86400,0,0,407,8821,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,9,116:3:0	0,18,191:6:0
+17	3113	.	C	<X>	0	.	DP=25;I16=10,14,0,0,961,39641,0,0,1440,86400,0,0,403,8735,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,9,112:3:0	0,18,193:6:0
+17	3114	.	A	<X>	0	.	DP=24;I16=10,13,0,0,928,38448,0,0,1380,82800,0,0,400,8680,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,9,116:3:0	0,18,200:6:0
+17	3115	.	G	<X>	0	.	DP=23;I16=10,12,0,0,872,35800,0,0,1320,79200,0,0,397,8603,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,9,117:3:0	0,18,195:6:0
+17	3116	.	G	<X>	0	.	DP=23;I16=10,12,0,0,870,35372,0,0,1320,79200,0,0,394,8552,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,9,108:3:0	0,18,194:6:0
+17	3117	.	T	<X>	0	.	DP=22;I16=9,13,0,0,771,27537,0,0,1320,79200,0,0,399,8575,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,9,96:3:0	0,18,177:6:0
+17	3118	.	A	<X>	0	.	DP=22;I16=9,13,0,0,813,30285,0,0,1320,79200,0,0,397,8537,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,9,111:3:0	0,18,193:6:0
+17	3119	.	A	<X>	0	.	DP=22;I16=9,13,0,0,886,35954,0,0,1320,79200,0,0,393,8423,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,9,120:3:0	0,18,207:6:0
+17	3120	.	G	<X>	0	.	DP=22;I16=9,13,0,0,839,32281,0,0,1320,79200,0,0,389,8333,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,9,104:3:0	0,18,182:6:0
+17	3121	.	A	<X>	0	.	DP=22;I16=10,12,0,0,777,28399,0,0,1320,79200,0,0,386,8266,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,9,111:3:0	0,18,194:6:0
+17	3122	.	C	<X>	0	.	DP=22;I16=10,12,0,0,848,33002,0,0,1320,79200,0,0,384,8222,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,9,110:3:0	0,18,192:6:0
+17	3123	.	T	<X>	0	.	DP=22;I16=10,12,0,0,854,33456,0,0,1320,79200,0,0,382,8202,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,9,114:3:0	0,18,204:6:0
+17	3124	.	C	<X>	0	.	DP=22;I16=10,11,0,0,882,38286,0,0,1260,75600,0,0,381,8205,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,9,104:3:0	0,15,178:5:0
+17	3125	.	T	<X>	0	.	DP=22;I16=10,11,0,0,860,36764,0,0,1260,75600,0,0,380,8230,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,9,106:3:0	0,15,185:5:0
+17	3126	.	G	<X>	0	.	DP=22;I16=10,11,0,0,834,34998,0,0,1260,75600,0,0,379,8277,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,9,97:3:0	0,15,174:5:0
+17	3127	.	C	<X>	0	.	DP=23;I16=10,11,0,0,847,36381,0,0,1260,75600,0,0,378,8346,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,9,87:3:0	0,15,175:5:0
+17	3128	.	T	<X>	0	.	DP=22;I16=9,12,0,0,850,35972,0,0,1229,72841,0,0,402,9010,0,0;QS=3,0;MQSB=0.950149;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,9,107:3:0	0,15,182:5:0
+17	3129	.	T	<X>	0	.	DP=22;I16=9,12,0,0,809,32621,0,0,1229,72841,0,0,401,9067,0,0;QS=3,0;MQSB=0.950149;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,9,107:3:0	0,15,178:5:0
+17	3130	.	T	<X>	0	.	DP=21;I16=9,10,0,0,744,30322,0,0,1140,68400,0,0,376,8516,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,6,82:2:0	0,15,169:5:0
+17	3131	.	C	<X>	0	.	DP=21;I16=9,10,0,0,792,34778,0,0,1140,68400,0,0,376,8606,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,6,83:2:0	0,15,170:5:0
+17	3132	.	T	<X>	0	.	DP=21;I16=9,11,0,0,819,35197,0,0,1169,69241,0,0,400,9288,0,0;QS=3,0;MQSB=0.943233;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,9,109:3:0	0,15,174:5:0
+17	3133	.	G	<X>	0	.	DP=21;I16=9,11,0,0,800,34016,0,0,1169,69241,0,0,398,9312,0,0;QS=3,0;MQSB=0.943233;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,9,97:3:0	0,15,166:5:0
+17	3134	.	G	<X>	0	.	DP=22;I16=10,11,0,0,773,30227,0,0,1229,72841,0,0,396,9352,0,0;QS=3,0;MQSB=0.939898;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,9,97:3:0	0,15,163:5:0
+17	3135	.	G	<X>	0	.	DP=22;I16=9,12,0,0,812,33714,0,0,1229,72841,0,0,396,9408,0,0;QS=3,0;MQSB=0.950149;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,9,94:3:0	0,12,151:4:0
+17	3136	.	C	<X>	0	.	DP=22;I16=9,12,0,0,811,33469,0,0,1229,72841,0,0,396,9430,0,0;QS=3,0;MQSB=0.950149;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,9,102:3:0	0,12,140:4:0
+17	3137	.	A	<X>	0	.	DP=22;I16=10,11,0,0,786,31226,0,0,1229,72841,0,0,396,9416,0,0;QS=3,0;MQSB=0.939898;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,9,95:3:0	0,12,142:4:0
+17	3138	.	A	<X>	0	.	DP=21;I16=9,11,0,0,720,28200,0,0,1169,69241,0,0,398,9414,0,0;QS=3,0;MQSB=0.943233;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,9,98:3:0	0,12,147:4:0
+17	3139	.	C	<X>	0	.	DP=21;I16=9,11,0,0,755,31433,0,0,1169,69241,0,0,400,9424,0,0;QS=3,0;MQSB=0.943233;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,9,91:3:0	0,12,139:4:0
+17	3140	.	C	<X>	0	.	DP=21;I16=9,11,0,0,790,33238,0,0,1169,69241,0,0,402,9446,0,0;QS=3,0;MQSB=0.943233;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,9,102:3:0	0,12,145:4:0
+17	3141	.	C	<X>	0	.	DP=21;I16=9,11,0,0,819,35401,0,0,1169,69241,0,0,404,9480,0,0;QS=3,0;MQSB=0.943233;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,9,101:3:0	0,12,150:4:0
+17	3142	.	A	<X>	0	.	DP=21;I16=9,11,0,0,822,35744,0,0,1169,69241,0,0,405,9477,0,0;QS=3,0;MQSB=0.943233;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,9,107:3:0	0,12,155:4:0
+17	3143	.	G	<X>	0	.	DP=22;I16=10,11,0,0,846,36468,0,0,1198,70082,0,0,406,9488,0,0;QS=3,0;MQSB=0.99938;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,9,104:3:0	0,12,151:4:0
+17	3144	.	C	<X>	0	.	DP=23;I16=12,10,0,0,855,35905,0,0,1258,73682,0,0,409,9513,0,0;QS=3,0;MQSB=0.997828;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,9,104:3:0	0,15,165:5:0
+17	3145	.	A	<X>	0	.	DP=23;I16=12,10,0,0,869,35937,0,0,1258,73682,0,0,414,9554,0,0;QS=3,0;MQSB=0.997828;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,9,106:3:0	0,15,174:5:0
+17	3146	.	G	<X>	0	.	DP=23;I16=12,10,0,0,895,38345,0,0,1258,73682,0,0,419,9613,0,0;QS=3,0;MQSB=0.997828;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,9,105:3:0	0,15,179:5:0
+17	3147	.	G	<X>	0	.	DP=24;I16=11,11,0,0,851,34815,0,0,1289,76441,0,0,419,9623,0,0;QS=3,0;MQSB=0.936864;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,123:4:0	0,15,172:5:0
+17	3148	.	T	<X>	0	.	DP=24;I16=12,11,0,0,795,30097,0,0,1318,77282,0,0,428,9682,0,0;QS=3,0;MQSB=0.999527;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,107:4:0	0,15,149:5:0
+17	3149	.	G	<X>	0	.	DP=24;I16=12,11,0,0,910,38142,0,0,1318,77282,0,0,433,9743,0,0;QS=3,0;MQSB=0.999527;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,120:4:0	0,15,167:5:0
+17	3150	.	A	<X>	0	.	DP=24;I16=12,11,0,0,854,33784,0,0,1318,77282,0,0,438,9822,0,0;QS=3,0;MQSB=0.999527;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,129:4:0	0,15,167:5:0
+17	3151	.	C	<X>	0	.	DP=24;I16=12,11,0,0,873,35315,0,0,1318,77282,0,0,442,9870,0,0;QS=3,0;MQSB=0.999527;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,125:4:0	0,15,163:5:0
+17	3152	.	C	<X>	0	.	DP=24;I16=12,11,0,0,857,34239,0,0,1318,77282,0,0,445,9889,0,0;QS=3,0;MQSB=0.999527;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,123:4:0	0,15,155:5:0
+17	3153	.	C	<X>	0	.	DP=24;I16=12,11,0,0,891,36711,0,0,1318,77282,0,0,448,9930,0,0;QS=3,0;MQSB=0.999527;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,125:4:0	0,15,166:5:0
+17	3154	.	T	<X>	0	.	DP=25;I16=13,11,0,0,938,38052,0,0,1378,80882,0,0,451,9993,0,0;QS=3,0;MQSB=0.998323;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,133:4:0	0,18,194:6:0
+17	3155	.	G	<X>	0	.	DP=25;I16=13,11,0,0,953,39423,0,0,1378,80882,0,0,454,10030,0,0;QS=3,0;MQSB=0.998323;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,127:4:0	0,18,180:6:0
+17	3156	.	G	<X>	0	.	DP=25;I16=13,11,0,0,946,38818,0,0,1378,80882,0,0,457,10093,0,0;QS=3,0;MQSB=0.998323;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,126:4:0	0,18,189:6:0
+17	3157	.	A	<X>	0	.	DP=24;I16=12,12,0,0,896,33648,0,0,1378,80882,0,0,486,10806,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,130:4:0	0,18,193:6:0
+17	3158	.	A	<X>	0	.	DP=24;I16=12,12,0,0,856,31670,0,0,1378,80882,0,0,490,10918,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,125:4:0	0,18,192:6:0
+17	3159	.	T	<X>	0	.	DP=24;I16=11,12,0,0,864,32952,0,0,1349,80041,0,0,477,10749,0,0;QS=3,0;MQSB=0.944319;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,134:4:0	0,18,194:6:0
+17	3160	.	T	<X>	0	.	DP=24;I16=12,12,0,0,907,34719,0,0,1378,80882,0,0,494,11018,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,134:4:0	0,18,193:6:0
+17	3161	.	C	<X>	0	.	DP=24;I16=12,12,0,0,880,33336,0,0,1378,80882,0,0,494,11006,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,123:4:0	0,18,196:6:0
+17	3162	.	C	<X>	0	.	DP=24;I16=12,12,0,0,916,35764,0,0,1378,80882,0,0,494,11018,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,127:4:0	0,18,188:6:0
+17	3163	.	T	A,<X>	0	.	DP=24;I16=11,12,1,0,895,35099,13,169,1349,80041,29,841,473,10603,20,400;QS=2.97436,0.025641,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=1;BQB=1;MQ0F=0	PL:DP:DV	0,28,255,39,255,255:14:1	0,12,137,12,137,137:4:0	0,18,200,18,200,200:6:0
+17	3164	.	G	<X>	0	.	DP=24;I16=12,11,0,0,887,34437,0,0,1349,80041,0,0,467,10385,0,0;QS=3,0;MQSB=0.944319;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,9,106:3:0	0,18,188:6:0
+17	3165	.	T	<X>	0	.	DP=24;I16=12,12,0,0,880,32654,0,0,1378,80882,0,0,490,10990,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,133:4:0	0,18,189:6:0
+17	3166	.	C	<X>	0	.	DP=24;I16=12,11,0,0,871,33389,0,0,1349,80041,0,0,463,10369,0,0;QS=3,0;MQSB=0.944319;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,9,111:3:0	0,18,193:6:0
+17	3167	.	C	<X>	0	.	DP=23;I16=12,11,0,0,879,34199,0,0,1318,77282,0,0,487,11021,0,0;QS=3,0;MQSB=0.999527;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,131:4:0	0,18,189:6:0
+17	3168	.	A	<X>	0	.	DP=23;I16=12,11,0,0,874,33294,0,0,1318,77282,0,0,486,11070,0,0;QS=3,0;MQSB=0.999527;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,125:4:0	0,18,192:6:0
+17	3169	.	T	<X>	0	.	DP=23;I16=11,11,0,0,824,31124,0,0,1289,76441,0,0,458,10416,0,0;QS=3,0;MQSB=0.936864;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,128:4:0	0,18,187:6:0
+17	3170	.	C	<X>	0	.	DP=23;I16=11,11,0,0,877,35167,0,0,1289,76441,0,0,453,10307,0,0;QS=3,0;MQSB=0.936864;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,129:4:0	0,18,201:6:0
+17	3171	.	T	<X>	0	.	DP=23;I16=11,11,0,0,843,32615,0,0,1289,76441,0,0,448,10216,0,0;QS=3,0;MQSB=0.936864;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,127:4:0	0,18,201:6:0
+17	3172	.	G	<X>	0	.	DP=23;I16=12,11,0,0,813,29605,0,0,1318,77282,0,0,468,10768,0,0;QS=3,0;MQSB=0.999527;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,120:4:0	0,18,176:6:0
+17	3173	.	G	<X>	0	.	DP=23;I16=11,11,0,0,801,29659,0,0,1289,76441,0,0,436,9988,0,0;QS=3,0;MQSB=0.936864;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,126:4:0	0,18,174:6:0
+17	3174	.	C	<X>	0	.	DP=24;I16=13,11,0,0,938,36926,0,0,1378,80882,0,0,454,10476,0,0;QS=3,0;MQSB=0.998323;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,127:4:0	0,18,194:6:0
+17	3175	.	A	<X>	0	.	DP=25;I16=13,11,0,0,914,35230,0,0,1409,83641,0,0,422,9684,0,0;QS=3,0;MQSB=0.931547;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,127:4:0	0,21,209:7:0
+17	3176	.	G	<X>	0	.	DP=24;I16=14,10,0,0,909,34913,0,0,1378,80882,0,0,442,10164,0,0;QS=3,0;MQSB=0.993166;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,9,97:3:0	0,21,205:7:0
+17	3177	.	G	<X>	0	.	DP=23;I16=14,9,0,0,793,28159,0,0,1318,77282,0,0,438,10040,0,0;QS=3,0;MQSB=0.987676;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,9,93:3:0	0,21,195:7:0
+17	3178	.	T	<X>	0	.	DP=23;I16=13,9,0,0,754,26290,0,0,1289,76441,0,0,408,9262,0,0;QS=3,0;MQSB=0.910098;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,9,96:3:0	0,21,173:7:0
+17	3179	.	G	<X>	0	.	DP=23;I16=13,9,0,0,802,29686,0,0,1289,76441,0,0,403,9131,0,0;QS=3,0;MQSB=0.910098;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,9,97:3:0	0,21,188:7:0
+17	3180	.	G	<X>	0	.	DP=22;I16=12,9,0,0,701,24107,0,0,1229,72841,0,0,398,8970,0,0;QS=3,0;MQSB=0.913101;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,9,92:3:0	0,21,175:7:0
+17	3181	.	G	<X>	0	.	DP=22;I16=13,9,0,0,795,29503,0,0,1258,73682,0,0,418,9452,0,0;QS=3,0;MQSB=0.991121;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,9,99:3:0	0,21,193:7:0
+17	3182	.	C	<X>	0	.	DP=22;I16=12,9,0,0,772,28878,0,0,1198,70082,0,0,396,9038,0,0;QS=3,0;MQSB=0.994334;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,9,99:3:0	0,21,184:7:0
+17	3183	.	A	<X>	0	.	DP=22;I16=12,9,0,0,766,28304,0,0,1229,72841,0,0,382,8546,0,0;QS=3,0;MQSB=0.913101;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,9,106:3:0	0,21,193:7:0
+17	3184	.	T	<X>	0	.	DP=21;I16=12,8,0,0,721,26533,0,0,1169,69241,0,0,377,8409,0,0;QS=3,0;MQSB=0.898397;MQ0F=0	PL:DP:DV	0,30,248:10:0	0,9,106:3:0	0,21,196:7:0
+17	3185	.	T	<X>	0	.	DP=20;I16=13,7,0,0,740,27660,0,0,1138,66482,0,0,397,8865,0,0;QS=3,0;MQSB=0.972138;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,9,103:3:0	0,18,174:6:0
+17	3186	.	G	<X>	0	.	DP=20;I16=13,7,0,0,741,28311,0,0,1138,66482,0,0,391,8665,0,0;QS=3,0;MQSB=0.972138;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,9,103:3:0	0,18,169:6:0
+17	3187	.	A	<X>	0	.	DP=20;I16=13,7,0,0,693,24927,0,0,1138,66482,0,0,385,8485,0,0;QS=3,0;MQSB=0.972138;MQ0F=0	PL:DP:DV	0,33,247:11:0	0,9,102:3:0	0,18,171:6:0
+17	3188	.	A	<X>	0	.	DP=20;I16=13,7,0,0,704,25746,0,0,1138,66482,0,0,379,8325,0,0;QS=3,0;MQSB=0.972138;MQ0F=0	PL:DP:DV	0,33,249:11:0	0,9,100:3:0	0,18,174:6:0
+17	3189	.	A	<X>	0	.	DP=21;I16=13,8,0,0,763,28171,0,0,1198,70082,0,0,373,8185,0,0;QS=3,0;MQSB=0.983744;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,125:4:0	0,18,174:6:0
+17	3190	.	C	<X>	0	.	DP=20;I16=11,8,0,0,675,24915,0,0,1109,65641,0,0,344,7440,0,0;QS=3,0;MQSB=0.902014;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,12,123:4:0	0,15,148:5:0
+17	3191	.	T	<X>	0	.	DP=21;I16=11,9,0,0,773,30203,0,0,1169,69241,0,0,340,7340,0,0;QS=3,0;MQSB=0.916401;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,130:4:0	0,15,171:5:0
+17	3192	.	G	<X>	0	.	DP=21;I16=12,9,0,0,751,27785,0,0,1198,70082,0,0,362,7886,0,0;QS=3,0;MQSB=0.994334;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,125:4:0	0,15,152:5:0
+17	3193	.	G	<X>	0	.	DP=21;I16=12,9,0,0,756,27614,0,0,1198,70082,0,0,359,7829,0,0;QS=3,0;MQSB=0.994334;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,121:4:0	0,15,148:5:0
+17	3194	.	T	C,<X>	0	.	DP=21;I16=10,10,1,0,730,26992,18,324,1169,69241,29,841,332,7168,25,625;QS=2.95652,0.0434783,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.99938;BQB=1;MQ0F=0	PL:DP:DV	0,18,255,33,255,255:12:1	0,9,98,9,98,98:3:0	0,18,178,18,178,178:6:0
+17	3195	.	T	<X>	0	.	DP=21;I16=11,10,0,0,776,29184,0,0,1198,70082,0,0,356,7778,0,0;QS=3,0;MQSB=0.99938;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,9,95:3:0	0,18,189:6:0
+17	3196	.	T	<X>	0	.	DP=21;I16=10,10,0,0,722,26472,0,0,1169,69241,0,0,329,7111,0,0;QS=3,0;MQSB=0.931063;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,9,91:3:0	0,18,186:6:0
+17	3197	.	A	<X>	0	.	DP=22;I16=12,9,0,0,715,24911,0,0,1229,72841,0,0,352,7718,0,0;QS=3,0;MQSB=0.950149;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,9,103:3:0	0,18,179:6:0
+17	3198	.	A	<X>	0	.	DP=21;I16=12,8,0,0,745,28155,0,0,1169,69241,0,0,345,7675,0,0;QS=3,0;MQSB=0.953497;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,9,105:3:0	0,18,198:6:0
+17	3199	.	A	<X>	0	.	DP=21;I16=11,9,0,0,736,27514,0,0,1200,72000,0,0,326,7080,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,9,105:3:0	0,18,196:6:0
+17	3200	.	A	<X>	0	.	DP=20;I16=11,9,0,0,735,27533,0,0,1169,69241,0,0,350,7660,0,0;QS=3,0;MQSB=0.943233;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,9,108:3:0	0,18,195:6:0
+17	3201	.	A	<X>	0	.	DP=20;I16=11,8,0,0,706,26814,0,0,1109,65641,0,0,338,7486,0,0;QS=3,0;MQSB=0.946915;MQ0F=0	PL:DP:DV	0,30,248:10:0	0,9,107:3:0	0,18,198:6:0
+17	3202	.	T	<X>	0	.	DP=20;I16=10,9,0,0,692,25620,0,0,1140,68400,0,0,321,6907,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,249:10:0	0,9,109:3:0	0,18,187:6:0
+17	3203	.	G	A,<X>	0	.	DP=19;I16=9,9,1,0,644,23760,19,361,1080,64800,29,841,320,6872,25,625;QS=2.94823,0.0517711,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.934728;BQB=1;MQ0F=0	PL:DP:DV	0,14,239,30,242,248:11:1	0,9,105,9,105,105:3:0	0,15,160,15,160,160:5:0
+17	3204	.	T	<X>	0	.	DP=19;I16=9,8,0,0,619,22955,0,0,1020,61200,0,0,306,6686,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,234:9:0	0,9,101:3:0	0,15,169:5:0
+17	3205	.	C	<X>	0	.	DP=19;I16=9,9,0,0,672,25340,0,0,1080,64800,0,0,318,6856,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,9,99:3:0	0,15,157:5:0
+17	3206	.	A	<X>	0	.	DP=19;I16=10,9,0,0,661,23623,0,0,1109,65641,0,0,342,7500,0,0;QS=3,0;MQSB=0.934728;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,9,91:3:0	0,15,165:5:0
+17	3207	.	C	<X>	0	.	DP=19;I16=9,9,0,0,642,23618,0,0,1080,64800,0,0,316,6912,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,9,90:3:0	0,15,158:5:0
+17	3208	.	A	<X>	0	.	DP=18;I16=10,8,0,0,619,22023,0,0,1049,62041,0,0,341,7591,0,0;QS=3,0;MQSB=0.938795;MQ0F=0	PL:DP:DV	0,33,247:11:0	0,9,95:3:0	0,12,142:4:0
+17	3209	.	C	<X>	0	.	DP=19;I16=11,8,0,0,681,24747,0,0,1109,65641,0,0,340,7612,0,0;QS=3,0;MQSB=0.946915;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,9,106:3:0	0,12,134:4:0
+17	3210	.	C	<X>	0	.	DP=18;I16=11,7,0,0,664,24900,0,0,1049,62041,0,0,340,7602,0,0;QS=3,0;MQSB=0.951002;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,9,101:3:0	0,12,141:4:0
+17	3211	.	A	<X>	0	.	DP=17;I16=11,6,0,0,645,24627,0,0,989,58441,0,0,341,7611,0,0;QS=3,0;MQSB=0.955563;MQ0F=0	PL:DP:DV	0,30,243:10:0	0,9,106:3:0	0,12,140:4:0
+17	3212	.	T	<X>	0	.	DP=17;I16=10,6,0,0,575,21295,0,0,960,57600,0,0,316,6964,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,222:9:0	0,9,100:3:0	0,12,144:4:0
+17	3213	.	A	<X>	0	.	DP=17;I16=10,6,0,0,597,22631,0,0,960,57600,0,0,316,6962,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,228:9:0	0,9,117:3:0	0,12,138:4:0
+17	3214	.	G	<X>	0	.	DP=17;I16=11,6,0,0,615,23103,0,0,989,58441,0,0,341,7605,0,0;QS=3,0;MQSB=0.955563;MQ0F=0	PL:DP:DV	0,30,243:10:0	0,9,110:3:0	0,12,134:4:0
+17	3215	.	G	<X>	0	.	DP=17;I16=11,6,0,0,591,21523,0,0,989,58441,0,0,340,7592,0,0;QS=3,0;MQSB=0.955563;MQ0F=0	PL:DP:DV	0,30,241:10:0	0,9,93:3:0	0,12,128:4:0
+17	3216	.	C	<X>	0	.	DP=17;I16=11,6,0,0,623,23303,0,0,989,58441,0,0,339,7597,0,0;QS=3,0;MQSB=0.955563;MQ0F=0	PL:DP:DV	0,30,242:10:0	0,9,94:3:0	0,12,138:4:0
+17	3217	.	C	<X>	0	.	DP=17;I16=11,6,0,0,570,19896,0,0,989,58441,0,0,337,7569,0,0;QS=3,0;MQSB=0.955563;MQ0F=0	PL:DP:DV	0,30,236:10:0	0,9,84:3:0	0,12,123:4:0
+17	3218	.	G	C,<X>	0	.	DP=18;I16=10,7,1,0,547,18185,29,841,1020,61200,29,841,310,6932,24,576;QS=2.91667,0.0833333,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.951002;BQB=1;MQ0F=0	PL:DP:DV	0,4,202,30,205,221:11:1	0,9,96,9,96,96:3:0	0,12,112,12,112,112:4:0
+17	3219	.	G	A,<X>	0	.	DP=18;I16=10,7,1,0,606,22158,19,361,1020,61200,29,841,308,6888,23,529;QS=2.94837,0.0516304,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.951002;BQB=1;MQ0F=0	PL:DP:DV	0,14,234,30,237,243:11:1	0,9,107,9,107,107:3:0	0,12,126,12,126,126:4:0
+17	3220	.	G	<X>	0	.	DP=18;I16=11,7,0,0,631,22827,0,0,1049,62041,0,0,326,7248,0,0;QS=3,0;MQSB=0.951002;MQ0F=0	PL:DP:DV	0,33,252:11:0	0,9,112:3:0	0,12,126:4:0
+17	3221	.	C	<X>	0	.	DP=17;I16=9,7,0,0,598,22586,0,0,960,57600,0,0,301,6659,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,244:9:0	0,9,103:3:0	0,12,139:4:0
+17	3222	.	A	<X>	0	.	DP=17;I16=10,7,0,0,623,23037,0,0,989,58441,0,0,318,6972,0,0;QS=3,0;MQSB=0.943335;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,9,100:3:0	0,12,133:4:0
+17	3223	.	C	<X>	0	.	DP=17;I16=10,7,0,0,611,22603,0,0,989,58441,0,0,312,6764,0,0;QS=3,0;MQSB=0.943335;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,9,96:3:0	0,12,132:4:0
+17	3224	.	A	<X>	0	.	DP=16;I16=10,6,0,0,609,23381,0,0,929,54841,0,0,307,6575,0,0;QS=3,0;MQSB=0.948436;MQ0F=0	PL:DP:DV	0,27,238:9:0	0,9,97:3:0	0,12,141:4:0
+17	3225	.	G	<X>	0	.	DP=17;I16=11,6,0,0,604,22692,0,0,989,58441,0,0,302,6404,0,0;QS=3,0;MQSB=0.955563;MQ0F=0	PL:DP:DV	0,27,247:9:0	0,12,108:4:0	0,12,134:4:0
+17	3226	.	T	<X>	0	.	DP=18;I16=11,6,0,0,582,20466,0,0,1020,61200,0,0,282,5996,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,224:9:0	0,12,112:4:0	0,12,131:4:0
+17	3227	.	G	<X>	0	.	DP=18;I16=12,5,0,0,618,23008,0,0,989,58441,0,0,270,5496,0,0;QS=3,0;MQSB=0.965874;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,9,91:3:0	0,12,125:4:0
+17	3228	.	G	<X>	0	.	DP=18;I16=11,6,0,0,611,22581,0,0,1020,61200,0,0,278,5816,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,248:9:0	0,12,118:4:0	0,12,121:4:0
+17	3229	.	C	<X>	0	.	DP=19;I16=12,7,0,0,686,25394,0,0,1109,65641,0,0,289,5925,0,0;QS=3,0;MQSB=0.957193;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,118:4:0	0,12,126:4:0
+17	3230	.	T	<X>	0	.	DP=19;I16=12,6,0,0,669,25441,0,0,1049,62041,0,0,261,5187,0,0;QS=3,0;MQSB=0.961295;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,9,107:3:0	0,12,139:4:0
+17	3231	.	C	<X>	0	.	DP=19;I16=12,7,0,0,682,25046,0,0,1109,65641,0,0,283,5725,0,0;QS=3,0;MQSB=0.957193;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,112:4:0	0,12,128:4:0
+17	3232	.	A	<X>	0	.	DP=19;I16=11,7,0,0,597,20779,0,0,1080,64800,0,0,270,5564,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,229:10:0	0,12,117:4:0	0,12,132:4:0
+17	3233	.	C	<X>	0	.	DP=19;I16=12,7,0,0,573,18239,0,0,1109,65641,0,0,277,5629,0,0;QS=3,0;MQSB=0.957193;MQ0F=0	PL:DP:DV	0,33,238:11:0	0,12,91:4:0	0,12,110:4:0
+17	3234	.	G	T,<X>	0	.	DP=19;I16=10,6,1,0,511,17305,22,484,960,57600,29,841,233,4849,8,64;QS=2.93855,0.0614525,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.955563;BQB=1;MQ0F=0	PL:DP:DV	0,11,222,30,225,234:11:1	0,6,63,6,63,63:2:0	0,12,100,12,100,100:4:0
+17	3235	.	C	<X>	0	.	DP=18;I16=12,6,0,0,625,22649,0,0,1049,62041,0,0,274,5582,0,0;QS=3,0;MQSB=0.961295;MQ0F=0	PL:DP:DV	0,30,249:10:0	0,12,119:4:0	0,12,123:4:0
+17	3236	.	C	<X>	0	.	DP=18;I16=12,6,0,0,668,25124,0,0,1049,62041,0,0,273,5567,0,0;QS=3,0;MQSB=0.961295;MQ0F=0	PL:DP:DV	0,30,244:10:0	0,12,137:4:0	0,12,134:4:0
+17	3237	.	T	<X>	0	.	DP=17;I16=11,6,0,0,589,21235,0,0,989,58441,0,0,273,5573,0,0;QS=3,0;MQSB=0.955563;MQ0F=0	PL:DP:DV	0,27,230:9:0	0,12,102:4:0	0,12,136:4:0
+17	3238	.	G	<X>	0	.	DP=17;I16=11,6,0,0,609,22539,0,0,989,58441,0,0,273,5599,0,0;QS=3,0;MQSB=0.955563;MQ0F=0	PL:DP:DV	0,27,243:9:0	0,12,104:4:0	0,12,129:4:0
+17	3239	.	T	<X>	0	.	DP=17;I16=11,6,0,0,574,20204,0,0,989,58441,0,0,273,5645,0,0;QS=3,0;MQSB=0.955563;MQ0F=0	PL:DP:DV	0,27,220:9:0	0,12,107:4:0	0,12,131:4:0
+17	3240	.	A	<X>	0	.	DP=19;I16=12,7,0,0,624,21552,0,0,1109,65641,0,0,273,5711,0,0;QS=3,0;MQSB=0.957193;MQ0F=0	PL:DP:DV	0,33,248:11:0	0,12,101:4:0	0,12,132:4:0
+17	3241	.	A	<X>	0	.	DP=19;I16=11,6,0,0,619,23121,0,0,1020,61200,0,0,249,5173,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,252:10:0	0,9,96:3:0	0,12,143:4:0
+17	3242	.	T	<X>	0	.	DP=19;I16=12,7,0,0,655,23279,0,0,1140,68400,0,0,277,5911,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,252:10:0	0,12,104:4:0	0,15,152:5:0
+17	3243	.	C	<X>	0	.	DP=19;I16=12,7,0,0,682,25216,0,0,1140,68400,0,0,281,6047,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,12,111:4:0	0,15,148:5:0
+17	3244	.	C	<X>	0	.	DP=18;I16=11,6,0,0,587,21119,0,0,1020,61200,0,0,281,6139,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,221:8:0	0,12,116:4:0	0,15,142:5:0
+17	3245	.	C	<X>	0	.	DP=17;I16=10,7,0,0,631,23851,0,0,1020,61200,0,0,290,6282,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,255:9:0	0,12,126:4:0	0,12,131:4:0
+17	3246	.	A	<X>	0	.	DP=17;I16=10,7,0,0,646,24716,0,0,1020,61200,0,0,295,6427,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,255:9:0	0,12,129:4:0	0,12,139:4:0
+17	3247	.	G	<X>	0	.	DP=17;I16=10,7,0,0,606,22554,0,0,1020,61200,0,0,300,6590,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,255:9:0	0,12,92:4:0	0,12,133:4:0
+17	3248	.	C	<X>	0	.	DP=16;I16=10,6,0,0,603,23115,0,0,960,57600,0,0,306,6770,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,255:9:0	0,9,99:3:0	0,12,132:4:0
+17	3249	.	C	<X>	0	.	DP=16;I16=10,6,0,0,587,21913,0,0,960,57600,0,0,311,6917,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,246:9:0	0,9,99:3:0	0,12,133:4:0
+17	3250	.	C	<X>	0	.	DP=16;I16=10,6,0,0,616,24080,0,0,960,57600,0,0,316,7082,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,255:9:0	0,9,95:3:0	0,12,137:4:0
+17	3251	.	T	<X>	0	.	DP=16;I16=10,6,0,0,585,22193,0,0,960,57600,0,0,319,7165,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,241:9:0	0,9,104:3:0	0,12,135:4:0
+17	3252	.	T	<X>	0	.	DP=16;I16=10,6,0,0,553,19781,0,0,960,57600,0,0,321,7215,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,239:9:0	0,9,84:3:0	0,12,126:4:0
+17	3253	.	T	<X>	0	.	DP=16;I16=10,6,0,0,589,21933,0,0,960,57600,0,0,323,7281,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,245:9:0	0,9,102:3:0	0,12,132:4:0
+17	3254	.	G	<X>	0	.	DP=17;I16=10,7,0,0,631,23737,0,0,1020,61200,0,0,325,7363,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,255:9:0	0,9,100:3:0	0,15,154:5:0
+17	3255	.	G	<X>	0	.	DP=16;I16=9,7,0,0,554,20088,0,0,960,57600,0,0,328,7410,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,243:9:0	0,9,93:3:0	0,12,120:4:0
+17	3256	.	G	<X>	0	.	DP=16;I16=8,7,0,0,571,21985,0,0,900,54000,0,0,306,6846,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,255:9:0	0,6,62:2:0	0,12,142:4:0
+17	3257	.	A	<X>	0	.	DP=16;I16=9,7,0,0,585,21881,0,0,960,57600,0,0,334,7546,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,243:9:0	0,9,94:3:0	0,12,144:4:0
+17	3258	.	G	<X>	0	.	DP=17;I16=9,8,0,0,647,25407,0,0,1020,61200,0,0,337,7635,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,9,81:3:0	0,12,146:4:0
+17	3259	.	G	<X>	0	.	DP=17;I16=9,8,0,0,605,22237,0,0,1020,61200,0,0,341,7739,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,9,79:3:0	0,12,139:4:0
+17	3260	.	C	<X>	0	.	DP=17;I16=9,7,0,0,616,23908,0,0,960,57600,0,0,319,7183,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,6,64:2:0	0,12,133:4:0
+17	3261	.	C	<X>	0	.	DP=18;I16=9,9,0,0,655,24475,0,0,1080,64800,0,0,347,7891,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,9,90:3:0	0,12,138:4:0
+17	3262	.	A	<X>	0	.	DP=19;I16=10,9,0,0,712,27036,0,0,1140,68400,0,0,351,7989,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,123:4:0	0,12,148:4:0
+17	3263	.	G	<X>	0	.	DP=19;I16=10,9,0,0,715,27317,0,0,1140,68400,0,0,356,8104,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,116:4:0	0,12,146:4:0
+17	3264	.	G	<X>	0	.	DP=19;I16=10,9,0,0,676,24734,0,0,1140,68400,0,0,361,8237,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,93:4:0	0,12,143:4:0
+17	3265	.	G	<X>	0	.	DP=19;I16=10,9,0,0,701,26199,0,0,1140,68400,0,0,365,8339,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,109:4:0	0,12,137:4:0
+17	3266	.	T	<X>	0	.	DP=19;I16=9,9,0,0,597,20769,0,0,1080,64800,0,0,357,8229,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,82:4:0	0,9,113:3:0
+17	3267	.	G	<X>	0	.	DP=19;I16=10,9,0,0,659,24285,0,0,1140,68400,0,0,367,8299,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,76:4:0	0,12,133:4:0
+17	3268	.	G	<X>	0	.	DP=19;I16=10,9,0,0,668,24306,0,0,1140,68400,0,0,367,8255,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,92:4:0	0,12,142:4:0
+17	3269	.	G	<X>	0	.	DP=19;I16=10,9,0,0,714,27122,0,0,1140,68400,0,0,367,8227,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,115:4:0	0,12,137:4:0
+17	3270	.	T	<X>	0	.	DP=20;I16=10,9,0,0,606,20364,0,0,1140,68400,0,0,361,8141,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,251:11:0	0,12,83:4:0	0,12,136:4:0
+17	3271	.	G	<X>	0	.	DP=19;I16=10,9,0,0,709,26993,0,0,1140,68400,0,0,362,8108,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,100:4:0	0,12,143:4:0
+17	3272	.	G	<X>	0	.	DP=19;I16=10,9,0,0,672,24398,0,0,1140,68400,0,0,363,8093,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,97:4:0	0,12,140:4:0
+17	3273	.	A	<X>	0	.	DP=20;I16=10,10,0,0,735,27355,0,0,1200,72000,0,0,363,8047,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,153:5:0	0,12,147:4:0
+17	3274	.	T	<X>	0	.	DP=19;I16=9,10,0,0,699,26089,0,0,1140,68400,0,0,365,8021,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,15,142:5:0	0,12,149:4:0
+17	3275	.	C	<X>	0	.	DP=19;I16=9,10,0,0,727,28197,0,0,1140,68400,0,0,367,8015,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,15,137:5:0	0,12,139:4:0
+17	3276	.	A	<X>	0	.	DP=19;I16=9,10,0,0,681,25123,0,0,1140,68400,0,0,369,8029,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,253:10:0	0,15,150:5:0	0,12,141:4:0
+17	3277	.	C	<X>	0	.	DP=19;I16=9,10,0,0,733,28485,0,0,1140,68400,0,0,371,8063,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,15,153:5:0	0,12,146:4:0
+17	3278	.	T	<X>	0	.	DP=19;I16=9,10,0,0,737,28901,0,0,1140,68400,0,0,373,8117,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,15,168:5:0	0,12,153:4:0
+17	3279	.	T	<X>	0	.	DP=19;I16=9,10,0,0,714,27132,0,0,1140,68400,0,0,375,8191,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,15,148:5:0	0,12,150:4:0
+17	3280	.	G	<X>	0	.	DP=20;I16=9,11,0,0,758,29178,0,0,1200,72000,0,0,376,8234,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,143:5:0	0,12,146:4:0
+17	3281	.	A	<X>	0	.	DP=21;I16=10,11,0,0,822,32654,0,0,1260,75600,0,0,378,8296,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,179:6:0	0,12,157:4:0
+17	3282	.	G	<X>	0	.	DP=21;I16=10,11,0,0,815,32059,0,0,1260,75600,0,0,381,8379,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,173:6:0	0,12,150:4:0
+17	3283	.	G	<X>	0	.	DP=21;I16=10,11,0,0,790,30110,0,0,1260,75600,0,0,384,8484,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,161:6:0	0,12,146:4:0
+17	3284	.	T	<X>	0	.	DP=21;I16=10,11,0,0,748,27628,0,0,1260,75600,0,0,385,8511,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,155:6:0	0,12,146:4:0
+17	3285	.	C	<X>	0	.	DP=21;I16=10,11,0,0,776,29442,0,0,1260,75600,0,0,386,8560,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,169:6:0	0,12,143:4:0
+17	3286	.	A	<X>	0	.	DP=21;I16=10,11,0,0,826,32732,0,0,1260,75600,0,0,387,8631,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,187:6:0	0,12,153:4:0
+17	3287	.	G	<X>	0	.	DP=21;I16=10,11,0,0,804,31448,0,0,1260,75600,0,0,387,8673,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,164:6:0	0,12,150:4:0
+17	3288	.	G	<X>	0	.	DP=22;I16=10,11,0,0,754,27862,0,0,1260,75600,0,0,379,8635,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,141:5:0	0,15,164:5:0
+17	3289	.	A	<X>	0	.	DP=24;I16=13,11,0,0,897,34439,0,0,1440,86400,0,0,386,8714,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,18,166:6:0	0,15,178:5:0
+17	3290	.	G	<X>	0	.	DP=23;I16=12,10,0,0,832,31964,0,0,1320,79200,0,0,380,8684,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,112:4:0	0,15,168:5:0
+17	3291	.	T	<X>	0	.	DP=22;I16=11,9,0,0,707,25481,0,0,1200,72000,0,0,358,8112,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,9,95:3:0	0,15,168:5:0
+17	3292	.	T	<X>	0	.	DP=22;I16=13,9,0,0,783,28439,0,0,1320,79200,0,0,397,8929,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,127:5:0	0,15,164:5:0
+17	3293	.	C	<X>	0	.	DP=22;I16=13,9,0,0,852,33430,0,0,1320,79200,0,0,400,8992,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,136:5:0	0,15,170:5:0
+17	3294	.	A	<X>	0	.	DP=22;I16=13,9,0,0,818,30684,0,0,1320,79200,0,0,403,9077,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,145:5:0	0,15,162:5:0
+17	3295	.	A	<X>	0	.	DP=22;I16=14,8,0,0,820,31004,0,0,1320,79200,0,0,407,9183,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,140:5:0	0,12,143:4:0
+17	3296	.	G	<X>	0	.	DP=22;I16=14,8,0,0,837,32209,0,0,1320,79200,0,0,411,9259,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,133:5:0	0,12,140:4:0
+17	3297	.	A	<X>	0	.	DP=22;I16=14,8,0,0,787,28771,0,0,1320,79200,0,0,415,9355,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,134:5:0	0,12,140:4:0
+17	3298	.	C	<X>	0	.	DP=22;I16=13,9,0,0,826,31506,0,0,1320,79200,0,0,420,9470,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,113:4:0	0,12,135:4:0
+17	3299	.	C	<X>	0	.	DP=22;I16=13,9,0,0,857,33829,0,0,1320,79200,0,0,425,9553,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,117:4:0	0,12,140:4:0
+17	3300	.	A	<X>	0	.	DP=22;I16=13,9,0,0,861,33855,0,0,1320,79200,0,0,430,9654,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,134:4:0	0,12,144:4:0
+17	3301	.	G	<X>	0	.	DP=22;I16=13,9,0,0,869,34495,0,0,1320,79200,0,0,433,9675,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,131:4:0	0,12,141:4:0
+17	3302	.	C	<X>	0	.	DP=23;I16=14,9,0,0,863,32885,0,0,1380,82800,0,0,436,9718,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,115:4:0	0,15,155:5:0
+17	3303	.	C	<X>	0	.	DP=23;I16=14,9,0,0,887,34451,0,0,1380,82800,0,0,440,9784,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,125:4:0	0,15,153:5:0
+17	3304	.	T	<X>	0	.	DP=23;I16=14,9,0,0,886,34388,0,0,1380,82800,0,0,443,9825,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,134:4:0	0,15,167:5:0
+17	3305	.	G	<X>	0	.	DP=23;I16=14,9,0,0,878,33846,0,0,1380,82800,0,0,446,9892,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,119:4:0	0,15,151:5:0
+17	3306	.	G	<X>	0	.	DP=23;I16=14,9,0,0,886,34386,0,0,1380,82800,0,0,448,9934,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,127:4:0	0,15,150:5:0
+17	3307	.	C	<X>	0	.	DP=23;I16=14,8,0,0,812,30814,0,0,1320,79200,0,0,428,9508,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,116:4:0	0,15,153:5:0
+17	3308	.	C	<X>	0	.	DP=23;I16=14,9,0,0,835,31367,0,0,1380,82800,0,0,450,9986,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,118:4:0	0,15,151:5:0
+17	3309	.	A	<X>	0	.	DP=23;I16=14,9,0,0,875,33541,0,0,1380,82800,0,0,451,9995,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,128:4:0	0,15,162:5:0
+17	3310	.	A	<X>	0	.	DP=24;I16=15,9,0,0,882,32950,0,0,1440,86400,0,0,453,10027,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,152:5:0	0,15,164:5:0
+17	3311	.	C	<X>	0	.	DP=24;I16=15,9,0,0,913,35161,0,0,1440,86400,0,0,456,10084,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,145:5:0	0,15,157:5:0
+17	3312	.	A	<X>	0	.	DP=26;I16=16,9,0,0,950,36336,0,0,1500,90000,0,0,459,10167,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,153:5:0	0,15,160:5:0
+17	3313	.	T	<X>	0	.	DP=26;I16=16,10,0,0,987,37617,0,0,1560,93600,0,0,488,10902,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,18,180:6:0	0,15,161:5:0
+17	3314	.	G	<X>	0	.	DP=26;I16=16,10,0,0,1007,39401,0,0,1560,93600,0,0,491,10989,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,18,171:6:0	0,15,161:5:0
+17	3315	.	G	<X>	0	.	DP=26;I16=15,10,0,0,945,36073,0,0,1500,90000,0,0,484,10866,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,18,172:6:0	0,15,159:5:0
+17	3316	.	T	<X>	0	.	DP=26;I16=15,10,0,0,853,29881,0,0,1500,90000,0,0,464,10216,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,18,157:6:0	0,12,122:4:0
+17	3317	.	G	<X>	0	.	DP=27;I16=16,11,0,0,997,37431,0,0,1620,97200,0,0,488,10806,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,18,164:6:0	0,18,167:6:0
+17	3318	.	A	<X>	0	.	DP=26;I16=15,10,0,0,904,33212,0,0,1500,90000,0,0,481,10699,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,155:5:0	0,18,185:6:0
+17	3319	.	A	<X>	0	.	DP=25;I16=15,10,0,0,912,34090,0,0,1500,90000,0,0,482,10682,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,139:5:0	0,18,188:6:0
+17	3320	.	A	<X>	0	.	DP=25;I16=15,10,0,0,888,32722,0,0,1500,90000,0,0,483,10691,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,133:5:0	0,18,178:6:0
+17	3321	.	C	<X>	0	.	DP=25;I16=14,10,0,0,900,34142,0,0,1440,86400,0,0,471,10531,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,157:5:0	0,18,186:6:0
+17	3322	.	C	<X>	0	.	DP=25;I16=15,10,0,0,980,38582,0,0,1500,90000,0,0,483,10683,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,164:5:0	0,18,198:6:0
+17	3323	.	C	<X>	0	.	DP=25;I16=15,10,0,0,922,34948,0,0,1500,90000,0,0,483,10715,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,146:5:0	0,18,201:6:0
+17	3324	.	C	<X>	0	.	DP=25;I16=15,10,0,0,869,31271,0,0,1500,90000,0,0,482,10720,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,142:5:0	0,18,186:6:0
+17	3325	.	G	<X>	0	.	DP=25;I16=15,10,0,0,827,28293,0,0,1500,90000,0,0,481,10747,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,134:5:0	0,18,163:6:0
+17	3326	.	T	<X>	0	.	DP=24;I16=13,10,0,0,842,31362,0,0,1380,82800,0,0,464,10506,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,150:5:0	0,18,186:6:0
+17	3327	.	C	<X>	0	.	DP=24;I16=14,10,0,0,938,37076,0,0,1440,86400,0,0,481,10863,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,154:5:0	0,18,190:6:0
+17	3328	.	T	<X>	0	.	DP=25;I16=15,10,0,0,959,37033,0,0,1500,90000,0,0,480,10900,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,163:5:0	0,21,213:7:0
+17	3329	.	A	<X>	0	.	DP=24;I16=15,9,0,0,888,33082,0,0,1440,86400,0,0,481,10955,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,149:5:0	0,21,207:7:0
+17	3330	.	C	<X>	0	.	DP=25;I16=16,9,0,0,954,37064,0,0,1500,90000,0,0,481,10979,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,168:5:0	0,21,203:7:0
+17	3331	.	T	<X>	0	.	DP=25;I16=16,9,0,0,960,37332,0,0,1500,90000,0,0,482,11024,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,165:5:0	0,21,224:7:0
+17	3332	.	A	<X>	0	.	DP=25;I16=16,9,0,0,933,35065,0,0,1500,90000,0,0,483,11091,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,165:5:0	0,21,211:7:0
+17	3333	.	A	<X>	0	.	DP=26;I16=16,10,0,0,976,37344,0,0,1560,93600,0,0,483,11131,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,166:5:0	0,24,241:8:0
+17	3334	.	A	<X>	0	.	DP=25;I16=15,10,0,0,972,38210,0,0,1500,90000,0,0,485,11195,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,168:5:0	0,24,241:8:0
+17	3335	.	A	<X>	0	.	DP=25;I16=15,10,0,0,970,38200,0,0,1500,90000,0,0,486,11232,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,170:5:0	0,24,239:8:0
+17	3336	.	A	<X>	0	.	DP=25;I16=15,10,0,0,929,35277,0,0,1500,90000,0,0,485,11191,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,166:5:0	0,24,232:8:0
+17	3337	.	T	<X>	0	.	DP=25;I16=15,10,0,0,902,32856,0,0,1500,90000,0,0,484,11172,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,157:5:0	0,24,224:8:0
+17	3338	.	A	<X>	0	.	DP=25;I16=15,10,0,0,892,32056,0,0,1500,90000,0,0,481,11075,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,153:5:0	0,24,214:8:0
+17	3339	.	C	<X>	0	.	DP=25;I16=15,10,0,0,964,37444,0,0,1500,90000,0,0,478,11000,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,167:5:0	0,24,232:8:0
+17	3340	.	A	<X>	0	.	DP=23;I16=14,9,0,0,890,34616,0,0,1380,82800,0,0,477,10945,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,15,173:5:0	0,24,233:8:0
+17	3341	.	A	<X>	0	.	DP=23;I16=14,9,0,0,885,34459,0,0,1380,82800,0,0,476,10908,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,15,167:5:0	0,24,238:8:0
+17	3342	.	A	<X>	0	.	DP=23;I16=14,9,0,0,862,33262,0,0,1380,82800,0,0,475,10889,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,15,170:5:0	0,24,240:8:0
+17	3343	.	A	<X>	0	.	DP=22;I16=13,9,0,0,866,34280,0,0,1320,79200,0,0,474,10836,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,15,173:5:0	0,21,231:7:0
+17	3344	.	A	<X>	0	.	DP=22;I16=13,9,0,0,859,33731,0,0,1320,79200,0,0,473,10797,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,15,173:5:0	0,21,226:7:0
+17	3345	.	T	<X>	0	.	DP=22;I16=13,9,0,0,822,31100,0,0,1320,79200,0,0,472,10772,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,254:10:0	0,15,159:5:0	0,21,220:7:0
+17	3346	.	T	<X>	0	.	DP=22;I16=13,9,0,0,847,32679,0,0,1320,79200,0,0,470,10712,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,15,168:5:0	0,21,221:7:0
+17	3347	.	A	<X>	0	.	DP=23;I16=14,9,0,0,888,34650,0,0,1380,82800,0,0,468,10668,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,18,185:6:0	0,21,227:7:0
+17	3348	.	G	<X>	0	.	DP=23;I16=14,9,0,0,873,33609,0,0,1380,82800,0,0,467,10641,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,18,171:6:0	0,21,219:7:0
+17	3349	.	C	<X>	0	.	DP=24;I16=14,9,0,0,815,29785,0,0,1380,82800,0,0,465,10583,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,18,166:6:0	0,21,205:7:0
+17	3350	.	C	<X>	0	.	DP=24;I16=14,10,0,0,939,37249,0,0,1440,86400,0,0,464,10546,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,21,209:7:0	0,21,220:7:0
+17	3351	.	T	<X>	0	.	DP=24;I16=14,10,0,0,943,37255,0,0,1440,86400,0,0,463,10531,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,21,210:7:0	0,21,228:7:0
+17	3352	.	G	<X>	0	.	DP=24;I16=14,10,0,0,887,33267,0,0,1440,86400,0,0,462,10538,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,21,192:7:0	0,21,214:7:0
+17	3353	.	G	<X>	0	.	DP=24;I16=14,10,0,0,864,32092,0,0,1440,86400,0,0,461,10567,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,21,190:7:0	0,21,214:7:0
+17	3354	.	C	<X>	0	.	DP=24;I16=14,10,0,0,848,30714,0,0,1440,86400,0,0,459,10567,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,21,178:7:0	0,21,209:7:0
+17	3355	.	G	<X>	0	.	DP=23;I16=14,9,0,0,738,24386,0,0,1380,82800,0,0,457,10537,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,232:10:0	0,21,170:7:0	0,18,166:6:0
+17	3356	.	T	<X>	0	.	DP=23;I16=14,9,0,0,847,31689,0,0,1380,82800,0,0,454,10476,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,21,191:7:0	0,18,195:6:0
+17	3357	.	G	<X>	0	.	DP=23;I16=14,9,0,0,863,32919,0,0,1380,82800,0,0,449,10335,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,21,193:7:0	0,18,192:6:0
+17	3358	.	G	<X>	0	.	DP=22;I16=14,8,0,0,810,30184,0,0,1320,79200,0,0,445,10215,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,239:9:0	0,21,200:7:0	0,18,187:6:0
+17	3359	.	T	<X>	0	.	DP=23;I16=13,8,0,0,743,26737,0,0,1260,75600,0,0,404,9318,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,228:9:0	0,21,194:7:0	0,15,162:5:0
+17	3360	.	G	<X>	0	.	DP=23;I16=15,8,0,0,822,30058,0,0,1380,82800,0,0,436,9932,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,21,186:7:0	0,18,175:6:0
+17	3361	.	G	<X>	0	.	DP=22;I16=15,7,0,0,751,26793,0,0,1320,79200,0,0,433,9819,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,218:9:0	0,21,187:7:0	0,18,175:6:0
+17	3362	.	C	<X>	0	.	DP=22;I16=15,7,0,0,768,27462,0,0,1320,79200,0,0,430,9724,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,230:9:0	0,21,178:7:0	0,18,173:6:0
+17	3363	.	G	<X>	0	.	DP=21;I16=14,7,0,0,662,21572,0,0,1260,75600,0,0,428,9646,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,194:9:0	0,18,155:6:0	0,18,161:6:0
+17	3364	.	C	<X>	0	.	DP=21;I16=14,7,0,0,818,32184,0,0,1260,75600,0,0,423,9437,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,241:9:0	0,18,191:6:0	0,18,194:6:0
+17	3365	.	A	<X>	0	.	DP=21;I16=14,7,0,0,791,29983,0,0,1260,75600,0,0,418,9250,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,226:9:0	0,18,186:6:0	0,18,190:6:0
+17	3366	.	T	<X>	0	.	DP=21;I16=14,7,0,0,759,28053,0,0,1260,75600,0,0,413,9085,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,221:9:0	0,18,185:6:0	0,18,177:6:0
+17	3367	.	G	<X>	0	.	DP=21;I16=14,7,0,0,767,28539,0,0,1260,75600,0,0,408,8942,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,235:9:0	0,18,185:6:0	0,18,169:6:0
+17	3368	.	C	<X>	0	.	DP=21;I16=14,7,0,0,807,31329,0,0,1260,75600,0,0,403,8821,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,245:9:0	0,18,181:6:0	0,18,189:6:0
+17	3369	.	C	<X>	0	.	DP=21;I16=14,7,0,0,789,30271,0,0,1260,75600,0,0,398,8722,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,228:9:0	0,18,186:6:0	0,18,193:6:0
+17	3370	.	T	<X>	0	.	DP=21;I16=13,7,0,0,798,31960,0,0,1200,72000,0,0,392,8596,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,239:9:0	0,18,201:6:0	0,15,178:5:0
+17	3371	.	G	<X>	0	.	DP=20;I16=13,7,0,0,739,27875,0,0,1200,72000,0,0,387,8493,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,233:9:0	0,18,173:6:0	0,15,169:5:0
+17	3372	.	T	<X>	0	.	DP=20;I16=13,6,0,0,693,25677,0,0,1140,68400,0,0,359,7883,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,220:9:0	0,15,154:5:0	0,15,167:5:0
+17	3373	.	A	<X>	0	.	DP=20;I16=13,7,0,0,729,27019,0,0,1200,72000,0,0,375,8253,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,226:9:0	0,18,162:6:0	0,15,174:5:0
+17	3374	.	A	<X>	0	.	DP=19;I16=13,6,0,0,719,27437,0,0,1140,68400,0,0,369,8115,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,225:9:0	0,15,167:5:0	0,15,164:5:0
+17	3375	.	T	<X>	0	.	DP=20;I16=12,6,0,0,683,26039,0,0,1080,64800,0,0,337,7321,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,221:8:0	0,15,155:5:0	0,15,172:5:0
+17	3376	.	C	<X>	0	.	DP=20;I16=13,7,0,0,739,27867,0,0,1200,72000,0,0,356,7796,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,254:10:0	0,15,146:5:0	0,15,173:5:0
+17	3377	.	C	<X>	0	.	DP=20;I16=13,7,0,0,741,27905,0,0,1200,72000,0,0,350,7666,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,252:10:0	0,15,149:5:0	0,15,173:5:0
+17	3378	.	C	<X>	0	.	DP=20;I16=13,7,0,0,775,30179,0,0,1200,72000,0,0,343,7507,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,15,161:5:0	0,15,172:5:0
+17	3379	.	A	<X>	0	.	DP=20;I16=13,7,0,0,736,27530,0,0,1200,72000,0,0,336,7370,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,245:10:0	0,15,157:5:0	0,15,169:5:0
+17	3380	.	G	<X>	0	.	DP=19;I16=13,6,0,0,729,28249,0,0,1140,68400,0,0,330,7254,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,233:9:0	0,15,157:5:0	0,15,178:5:0
+17	3381	.	C	<X>	0	.	DP=19;I16=13,6,0,0,742,29288,0,0,1140,68400,0,0,324,7158,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,241:9:0	0,15,155:5:0	0,15,178:5:0
+17	3382	.	T	<X>	0	.	DP=17;I16=12,5,0,0,649,25245,0,0,1020,61200,0,0,320,7080,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,222:9:0	0,9,105:3:0	0,15,184:5:0
+17	3383	.	A	<X>	0	.	DP=17;I16=12,4,0,0,556,19808,0,0,960,57600,0,0,291,6393,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,27,196:9:0	0,6,71:2:0	0,15,167:5:0
+17	3384	.	C	<X>	0	.	DP=19;I16=14,5,0,0,701,26181,0,0,1140,68400,0,0,311,6923,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,235:10:0	0,9,98:3:0	0,18,187:6:0
+17	3385	.	T	<X>	0	.	DP=19;I16=14,5,0,0,730,28456,0,0,1140,68400,0,0,307,6797,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,237:10:0	0,9,109:3:0	0,18,195:6:0
+17	3386	.	T	<X>	0	.	DP=19;I16=14,5,0,0,642,22450,0,0,1140,68400,0,0,302,6642,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,197:10:0	0,9,104:3:0	0,18,188:6:0
+17	3387	.	G	<X>	0	.	DP=20;I16=14,6,0,0,723,26761,0,0,1200,72000,0,0,296,6460,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,230:10:0	0,9,105:3:0	0,21,210:7:0
+17	3388	.	G	<X>	0	.	DP=20;I16=14,6,0,0,705,25891,0,0,1200,72000,0,0,291,6303,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,225:10:0	0,9,109:3:0	0,21,202:7:0
+17	3389	.	G	<X>	0	.	DP=18;I16=10,7,0,0,617,22635,0,0,1020,61200,0,0,270,5808,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,190:7:0	0,9,105:3:0	0,21,207:7:0
+17	3390	.	A	<X>	0	.	DP=18;I16=11,7,0,0,631,22681,0,0,1080,64800,0,0,288,6056,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,200:8:0	0,9,105:3:0	0,21,198:7:0
+17	3391	.	A	<X>	0	.	DP=18;I16=11,7,0,0,663,24951,0,0,1080,64800,0,0,287,5965,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,192:8:0	0,9,113:3:0	0,21,224:7:0
+17	3392	.	G	<X>	0	.	DP=18;I16=11,7,0,0,666,25104,0,0,1080,64800,0,0,286,5896,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,211:8:0	0,9,103:3:0	0,21,216:7:0
+17	3393	.	C	<X>	0	.	DP=18;I16=11,7,0,0,686,26472,0,0,1080,64800,0,0,284,5800,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,222:8:0	0,9,106:3:0	0,21,214:7:0
+17	3394	.	T	<X>	0	.	DP=18;I16=11,7,0,0,699,27481,0,0,1080,64800,0,0,282,5728,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,219:8:0	0,9,114:3:0	0,21,222:7:0
+17	3395	.	G	<X>	0	.	DP=17;I16=10,7,0,0,656,25512,0,0,1020,61200,0,0,281,5679,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,205:7:0	0,9,105:3:0	0,21,222:7:0
+17	3396	.	A	<X>	0	.	DP=17;I16=10,7,0,0,644,25446,0,0,1020,61200,0,0,280,5652,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,182:7:0	0,9,119:3:0	0,21,232:7:0
+17	3397	.	G	<X>	0	.	DP=17;I16=10,7,0,0,633,23895,0,0,1020,61200,0,0,279,5647,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,193:7:0	0,9,107:3:0	0,21,218:7:0
+17	3398	.	G	<X>	0	.	DP=16;I16=10,6,0,0,610,23380,0,0,960,57600,0,0,279,5663,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,18,170:6:0	0,9,110:3:0	0,21,215:7:0
+17	3399	.	G	<X>	0	.	DP=17;I16=10,6,0,0,585,21729,0,0,960,57600,0,0,270,5618,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,15,147:5:0	0,12,122:4:0	0,21,216:7:0
+17	3400	.	A	<X>	0	.	DP=17;I16=10,6,0,0,576,21400,0,0,960,57600,0,0,264,5500,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,15,136:5:0	0,12,131:4:0	0,21,213:7:0
+17	3401	.	T	<X>	0	.	DP=17;I16=11,6,0,0,605,22159,0,0,1020,61200,0,0,280,5784,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,18,146:6:0	0,12,131:4:0	0,21,216:7:0
+17	3402	.	G	<X>	0	.	DP=17;I16=11,6,0,0,638,24150,0,0,1020,61200,0,0,280,5832,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,18,172:6:0	0,12,130:4:0	0,21,213:7:0
+17	3403	.	A	<X>	0	.	DP=16;I16=9,6,0,0,579,22815,0,0,900,54000,0,0,276,5874,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,15,139:5:0	0,12,140:4:0	0,18,205:6:0
+17	3404	.	G	<X>	0	.	DP=16;I16=10,6,0,0,564,20652,0,0,960,57600,0,0,281,5935,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,18,148:6:0	0,12,131:4:0	0,18,186:6:0
+17	3405	.	A	<X>	0	.	DP=16;I16=10,6,0,0,560,20158,0,0,960,57600,0,0,281,5991,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,18,157:6:0	0,12,124:4:0	0,18,179:6:0
+17	3406	.	A	<X>	0	.	DP=16;I16=10,6,0,0,568,20556,0,0,960,57600,0,0,281,6067,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,18,150:6:0	0,12,129:4:0	0,18,186:6:0
+17	3407	.	C	<X>	0	.	DP=17;I16=11,6,0,0,591,21225,0,0,1020,61200,0,0,281,6163,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,178:7:0	0,12,106:4:0	0,18,183:6:0
+17	3408	.	T	<X>	0	.	DP=17;I16=11,6,0,0,632,23754,0,0,1020,61200,0,0,282,6280,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,21,177:7:0	0,12,133:4:0	0,18,189:6:0
+17	3409	.	G	<X>	0	.	DP=16;I16=10,6,0,0,599,22667,0,0,960,57600,0,0,283,6369,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,18,172:6:0	0,12,119:4:0	0,18,192:6:0
+17	3410	.	C	<X>	0	.	DP=16;I16=10,6,0,0,585,21685,0,0,960,57600,0,0,282,6378,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,18,174:6:0	0,12,126:4:0	0,18,176:6:0
+17	3411	.	T	<X>	0	.	DP=15;I16=9,6,0,0,578,22492,0,0,900,54000,0,0,282,6404,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,18,165:6:0	0,9,114:3:0	0,18,196:6:0
+17	3412	.	T	<X>	0	.	DP=15;I16=9,6,0,0,546,20202,0,0,900,54000,0,0,283,6445,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,15,148:5:0	0,12,120:4:0	0,18,189:6:0
+17	3413	.	G	<X>	0	.	DP=15;I16=9,6,0,0,559,21023,0,0,900,54000,0,0,283,6401,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,15,158:5:0	0,12,124:4:0	0,18,184:6:0
+17	3414	.	A	<X>	0	.	DP=15;I16=9,6,0,0,512,17878,0,0,900,54000,0,0,283,6373,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,15,148:5:0	0,12,116:4:0	0,18,166:6:0
+17	3415	.	A	<X>	0	.	DP=16;I16=9,7,0,0,544,19656,0,0,960,57600,0,0,282,6310,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,15,142:5:0	0,12,132:4:0	0,21,179:7:0
+17	3416	.	C	<X>	0	.	DP=16;I16=9,7,0,0,562,20168,0,0,960,57600,0,0,282,6262,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,15,143:5:0	0,12,127:4:0	0,21,191:7:0
+17	3417	.	C	<X>	0	.	DP=16;I16=9,7,0,0,566,20666,0,0,960,57600,0,0,282,6230,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,15,147:5:0	0,12,126:4:0	0,21,192:7:0
+17	3418	.	T	<X>	0	.	DP=17;I16=10,5,0,0,557,21637,0,0,900,54000,0,0,268,5988,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,15,150:5:0	0,15,148:5:0	0,15,176:5:0
+17	3419	.	G	<X>	0	.	DP=17;I16=10,7,0,0,594,21642,0,0,1020,61200,0,0,310,6836,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,18,161:6:0	0,15,140:5:0	0,18,190:6:0
+17	3420	.	G	<X>	0	.	DP=17;I16=10,7,0,0,596,21580,0,0,1020,61200,0,0,312,6850,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,18,172:6:0	0,15,132:5:0	0,18,188:6:0
+17	3421	.	G	<X>	0	.	DP=18;I16=10,8,0,0,633,22781,0,0,1049,62041,0,0,314,6880,0,0;QS=3,0;MQSB=0.906029;MQ0F=0	PL:DP:DV	0,21,184:7:0	0,15,138:5:0	0,18,191:6:0
+17	3422	.	A	<X>	0	.	DP=18;I16=9,8,0,0,576,20954,0,0,989,58441,0,0,302,6702,0,0;QS=3,0;MQSB=0.91051;MQ0F=0	PL:DP:DV	0,18,167:6:0	0,15,130:5:0	0,18,188:6:0
+17	3423	.	G	<X>	0	.	DP=18;I16=9,9,0,0,651,24391,0,0,1049,62041,0,0,305,6747,0,0;QS=3,0;MQSB=0.924089;MQ0F=0	PL:DP:DV	0,21,200:7:0	0,15,149:5:0	0,18,183:6:0
+17	3424	.	G	<X>	0	.	DP=18;I16=8,8,0,0,555,20175,0,0,929,54841,0,0,275,6105,0,0;QS=3,0;MQSB=0.915545;MQ0F=0	PL:DP:DV	0,18,161:6:0	0,15,141:5:0	0,15,169:5:0
+17	3425	.	C	<X>	0	.	DP=18;I16=9,8,0,0,594,21676,0,0,1020,61200,0,0,307,6779,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,18,168:6:0	0,15,142:5:0	0,18,186:6:0
+17	3426	.	A	<X>	0	.	DP=18;I16=9,8,0,0,633,23967,0,0,1020,61200,0,0,308,6774,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,18,172:6:0	0,15,151:5:0	0,18,202:6:0
+17	3427	.	G	<X>	0	.	DP=18;I16=9,9,0,0,655,24639,0,0,1049,62041,0,0,315,6823,0,0;QS=3,0;MQSB=0.924089;MQ0F=0	PL:DP:DV	0,21,209:7:0	0,15,144:5:0	0,18,184:6:0
+17	3428	.	A	<X>	0	.	DP=18;I16=9,7,0,0,573,21235,0,0,960,57600,0,0,305,6793,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,15,158:5:0	0,15,147:5:0	0,18,178:6:0
+17	3429	.	C	<X>	0	.	DP=17;I16=8,9,0,0,516,16610,0,0,989,58441,0,0,320,6930,0,0;QS=3,0;MQSB=0.928603;MQ0F=0	PL:DP:DV	0,21,176:7:0	0,15,125:5:0	0,15,124:5:0
+17	3430	.	G	<X>	0	.	DP=18;I16=9,9,0,0,539,17155,0,0,1049,62041,0,0,323,7011,0,0;QS=3,0;MQSB=0.924089;MQ0F=0	PL:DP:DV	0,24,181:8:0	0,15,113:5:0	0,15,144:5:0
+17	3431	.	T	<X>	0	.	DP=18;I16=9,9,0,0,651,24101,0,0,1049,62041,0,0,327,7111,0,0;QS=3,0;MQSB=0.924089;MQ0F=0	PL:DP:DV	0,24,210:8:0	0,15,139:5:0	0,15,166:5:0
+17	3432	.	T	<X>	0	.	DP=18;I16=8,9,0,0,577,20601,0,0,989,58441,0,0,306,6606,0,0;QS=3,0;MQSB=0.928603;MQ0F=0	PL:DP:DV	0,21,162:7:0	0,15,144:5:0	0,15,165:5:0
+17	3433	.	G	<X>	0	.	DP=18;I16=9,9,0,0,623,22589,0,0,1049,62041,0,0,334,7320,0,0;QS=3,0;MQSB=0.924089;MQ0F=0	PL:DP:DV	0,24,199:8:0	0,15,138:5:0	0,15,164:5:0
+17	3434	.	C	<X>	0	.	DP=18;I16=10,7,0,0,582,20838,0,0,1020,61200,0,0,324,7208,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,208:8:0	0,15,130:5:0	0,12,137:4:0
+17	3435	.	A	<X>	0	.	DP=18;I16=10,8,0,0,595,21619,0,0,1049,62041,0,0,341,7453,0,0;QS=3,0;MQSB=0.906029;MQ0F=0	PL:DP:DV	0,27,185:9:0	0,15,150:5:0	0,12,151:4:0
+17	3436	.	G	<X>	0	.	DP=18;I16=10,8,0,0,617,22277,0,0,1049,62041,0,0,345,7549,0,0;QS=3,0;MQSB=0.906029;MQ0F=0	PL:DP:DV	0,27,218:9:0	0,15,146:5:0	0,12,133:4:0
+17	3437	.	T	G,<X>	0	.	DP=18;I16=10,7,0,1,594,21168,16,256,1020,61200,29,841,333,7409,16,256;QS=2.94286,0.0571429,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.906029;BQB=1;MQ0F=0	PL:DP:DV	0,11,188,24,191,195:9:1	0,15,148,15,148,148:5:0	0,12,132,12,132,132:4:0
+17	3438	.	G	<X>	0	.	DP=18;I16=10,7,0,0,622,23296,0,0,1020,61200,0,0,335,7461,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,215:8:0	0,15,152:5:0	0,12,140:4:0
+17	3439	.	A	<X>	0	.	DP=18;I16=10,8,0,0,619,22965,0,0,1049,62041,0,0,355,7853,0,0;QS=3,0;MQSB=0.906029;MQ0F=0	PL:DP:DV	0,27,215:9:0	0,15,153:5:0	0,12,132:4:0
+17	3440	.	G	<X>	0	.	DP=18;I16=10,7,0,0,610,22660,0,0,1020,61200,0,0,339,7613,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,221:8:0	0,15,143:5:0	0,12,131:4:0
+17	3441	.	C	<X>	0	.	DP=18;I16=10,6,0,0,585,22165,0,0,960,57600,0,0,315,7037,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,226:8:0	0,15,140:5:0	0,9,115:3:0
+17	3442	.	T	<X>	0	.	DP=20;I16=11,9,0,0,670,24716,0,0,1138,66482,0,0,362,8166,0,0;QS=3,0;MQSB=0.997118;MQ0F=0	PL:DP:DV	0,33,248:11:0	0,15,143:5:0	0,12,128:4:0
+17	3443	.	G	<X>	0	.	DP=20;I16=11,9,0,0,708,26092,0,0,1138,66482,0,0,366,8288,0,0;QS=3,0;MQSB=0.997118;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,143:5:0	0,12,137:4:0
+17	3444	.	A	<X>	0	.	DP=20;I16=11,9,0,0,698,25978,0,0,1138,66482,0,0,369,8379,0,0;QS=3,0;MQSB=0.997118;MQ0F=0	PL:DP:DV	0,33,244:11:0	0,15,161:5:0	0,12,131:4:0
+17	3445	.	G	<X>	0	.	DP=20;I16=11,9,0,0,718,26590,0,0,1138,66482,0,0,372,8488,0,0;QS=3,0;MQSB=0.997118;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,153:5:0	0,12,132:4:0
+17	3446	.	A	<X>	0	.	DP=20;I16=10,8,0,0,635,23323,0,0,1049,62041,0,0,325,7365,0,0;QS=3,0;MQSB=0.938795;MQ0F=0	PL:DP:DV	0,27,222:9:0	0,15,154:5:0	0,12,131:4:0
+17	3447	.	T	<X>	0	.	DP=20;I16=11,8,0,0,669,24331,0,0,1109,65641,0,0,352,8084,0,0;QS=3,0;MQSB=0.946915;MQ0F=0	PL:DP:DV	0,30,230:10:0	0,15,150:5:0	0,12,137:4:0
+17	3448	.	C	<X>	0	.	DP=19;I16=10,8,0,0,641,23693,0,0,1049,62041,0,0,355,8193,0,0;QS=3,0;MQSB=0.938795;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,12,113:4:0	0,12,128:4:0
+17	3449	.	A	<X>	0	.	DP=19;I16=10,8,0,0,565,19185,0,0,1049,62041,0,0,357,8265,0,0;QS=3,0;MQSB=0.938795;MQ0F=0	PL:DP:DV	0,30,217:10:0	0,12,111:4:0	0,12,119:4:0
+17	3450	.	C	<X>	0	.	DP=18;I16=8,8,0,0,520,17846,0,0,898,52082,0,0,334,7674,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,30,229:10:0	0,6,70:2:0	0,12,106:4:0
+17	3451	.	G	<X>	0	.	DP=18;I16=10,7,0,0,528,17178,0,0,989,58441,0,0,361,8345,0,0;QS=3,0;MQSB=0.943335;MQ0F=0	PL:DP:DV	0,30,226:10:0	0,9,56:3:0	0,12,123:4:0
+17	3452	.	C	<X>	0	.	DP=18;I16=10,8,0,0,657,24597,0,0,1018,59282,0,0,388,9028,0,0;QS=3,0;MQSB=0.99606;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,9,84:3:0	0,12,128:4:0
+17	3453	.	C	<X>	0	.	DP=18;I16=10,8,0,0,663,24951,0,0,1018,59282,0,0,390,9098,0,0;QS=3,0;MQSB=0.99606;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,9,90:3:0	0,12,125:4:0
+17	3454	.	A	<X>	0	.	DP=18;I16=10,8,0,0,614,21898,0,0,1018,59282,0,0,392,9180,0,0;QS=3,0;MQSB=0.99606;MQ0F=0	PL:DP:DV	0,33,251:11:0	0,9,90:3:0	0,12,128:4:0
+17	3455	.	C	<X>	0	.	DP=18;I16=10,8,0,0,650,23968,0,0,1018,59282,0,0,394,9274,0,0;QS=3,0;MQSB=0.99606;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,9,90:3:0	0,12,127:4:0
+17	3456	.	T	<X>	0	.	DP=18;I16=10,8,0,0,607,21961,0,0,1018,59282,0,0,395,9329,0,0;QS=3,0;MQSB=0.99606;MQ0F=0	PL:DP:DV	0,33,243:11:0	0,9,88:3:0	0,12,135:4:0
+17	3457	.	G	<X>	0	.	DP=18;I16=9,7,0,0,549,19861,0,0,898,52082,0,0,346,8144,0,0;QS=3,0;MQSB=0.994413;MQ0F=0	PL:DP:DV	0,33,254:11:0	0,6,63:2:0	0,9,107:3:0
+17	3458	.	C	<X>	0	.	DP=18;I16=10,8,0,0,638,23236,0,0,1018,59282,0,0,397,9469,0,0;QS=3,0;MQSB=0.99606;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,9,81:3:0	0,12,125:4:0
+17	3459	.	A	C,<X>	0	.	DP=17;I16=9,7,0,1,520,18390,22,484,929,54841,29,841,372,8830,25,625;QS=2.92971,0.0702875,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.998843;BQB=1;MQ0F=0	PL:DP:DV	0,8,201,27,204,213:10:1	0,9,84,9,84,84:3:0	0,12,116,12,116,116:4:0
+17	3460	.	C	<X>	0	.	DP=17;I16=8,7,0,0,554,20952,0,0,869,51241,0,0,345,8103,0,0;QS=3,0;MQSB=0.921243;MQ0F=0	PL:DP:DV	0,27,244:9:0	0,6,65:2:0	0,12,131:4:0
+17	3461	.	T	<X>	0	.	DP=17;I16=9,7,0,0,591,22805,0,0,929,54841,0,0,368,8638,0,0;QS=3,0;MQSB=0.933674;MQ0F=0	PL:DP:DV	0,27,231:9:0	0,9,103:3:0	0,12,133:4:0
+17	3462	.	C	<X>	0	.	DP=18;I16=9,9,0,0,672,25486,0,0,1018,59282,0,0,391,9185,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,9,90:3:0	0,12,130:4:0
+17	3463	.	C	<X>	0	.	DP=18;I16=8,9,0,0,584,21458,0,0,958,55682,0,0,369,8671,0,0;QS=3,0;MQSB=0.998843;MQ0F=0	PL:DP:DV	0,30,244:10:0	0,9,86:3:0	0,12,132:4:0
+17	3464	.	A	<X>	0	.	DP=18;I16=9,9,0,0,628,23490,0,0,1018,59282,0,0,387,8973,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,244:11:0	0,9,96:3:0	0,12,142:4:0
+17	3465	.	G	<X>	0	.	DP=19;I16=9,9,0,0,642,24008,0,0,1018,59282,0,0,384,8842,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,9,91:3:0	0,12,135:4:0
+17	3466	.	C	<X>	0	.	DP=20;I16=9,10,0,0,682,25218,0,0,1047,60123,0,0,378,8588,0,0;QS=3,0;MQSB=0.904084;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,9,101:3:0	0,15,147:5:0
+17	3467	.	C	<X>	0	.	DP=20;I16=10,9,0,0,685,25919,0,0,1047,60123,0,0,397,9139,0,0;QS=3,0;MQSB=0.948064;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,12,115:4:0	0,15,154:5:0
+17	3468	.	T	<X>	0	.	DP=20;I16=10,9,0,0,672,25426,0,0,1047,60123,0,0,374,8410,0,0;QS=3,0;MQSB=0.948064;MQ0F=0	PL:DP:DV	0,30,246:10:0	0,12,126:4:0	0,15,164:5:0
+17	3469	.	G	<X>	0	.	DP=21;I16=10,11,0,0,788,30064,0,0,1167,67323,0,0,396,8924,0,0;QS=3,0;MQSB=0.914611;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,146:5:0	0,15,163:5:0
+17	3470	.	G	<X>	0	.	DP=22;I16=11,11,0,0,796,29754,0,0,1196,68164,0,0,393,8781,0,0;QS=3,0;MQSB=0.770381;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,131:5:0	0,15,161:5:0
+17	3471	.	G	<X>	0	.	DP=23;I16=12,11,0,0,801,29083,0,0,1256,71764,0,0,391,8657,0,0;QS=3,0;MQSB=0.811552;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,133:5:0	0,15,151:5:0
+17	3472	.	C	<X>	0	.	DP=23;I16=12,11,0,0,757,26535,0,0,1256,71764,0,0,390,8554,0,0;QS=3,0;MQSB=0.811552;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,145:5:0	0,15,136:5:0
+17	3473	.	A	<X>	0	.	DP=23;I16=11,11,0,0,777,28175,0,0,1196,68164,0,0,379,8373,0,0;QS=3,0;MQSB=0.770381;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,148:5:0	0,15,153:5:0
+17	3474	.	A	<X>	0	.	DP=23;I16=12,11,0,0,807,29181,0,0,1256,71764,0,0,388,8414,0,0;QS=3,0;MQSB=0.811552;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,150:5:0	0,15,155:5:0
+17	3475	.	C	<X>	0	.	DP=22;I16=12,10,0,0,737,25849,0,0,1196,68164,0,0,387,8327,0,0;QS=3,0;MQSB=0.838545;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,137:5:0	0,15,143:5:0
+17	3476	.	A	<X>	0	.	DP=22;I16=12,10,0,0,790,29312,0,0,1196,68164,0,0,386,8262,0,0;QS=3,0;MQSB=0.838545;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,149:5:0	0,15,154:5:0
+17	3477	.	G	<X>	0	.	DP=22;I16=11,10,0,0,755,28237,0,0,1136,64564,0,0,363,7735,0,0;QS=3,0;MQSB=0.799507;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,126:4:0	0,15,153:5:0
+17	3478	.	A	<X>	0	.	DP=25;I16=13,11,0,0,857,31637,0,0,1316,75364,0,0,384,8198,0,0;QS=3,0;MQSB=0.845496;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,167:6:0	0,18,190:6:0
+17	3479	.	G	<X>	0	.	DP=25;I16=12,10,0,0,783,28623,0,0,1227,70923,0,0,355,7701,0,0;QS=3,0;MQSB=0.613159;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,152:5:0	0,18,160:6:0
+17	3480	.	T	<X>	0	.	DP=25;I16=13,11,0,0,788,27124,0,0,1316,75364,0,0,393,8531,0,0;QS=3,0;MQSB=0.845496;MQ0F=0	PL:DP:DV	0,33,249:11:0	0,21,182:7:0	0,18,155:6:0
+17	3481	.	A	<X>	0	.	DP=25;I16=12,12,0,0,858,30884,0,0,1347,78123,0,0,397,8685,0,0;QS=3,0;MQSB=0.941765;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,21,194:7:0	0,15,148:5:0
+17	3482	.	A	<X>	0	.	DP=25;I16=13,12,0,0,927,35013,0,0,1376,78964,0,0,412,8942,0,0;QS=3,0;MQSB=0.822311;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,21,202:7:0	0,18,182:6:0
+17	3483	.	G	<X>	0	.	DP=25;I16=12,12,0,0,794,27410,0,0,1316,75364,0,0,412,9002,0,0;QS=3,0;MQSB=0.786628;MQ0F=0	PL:DP:DV	0,33,253:11:0	0,21,183:7:0	0,18,158:6:0
+17	3484	.	A	C,<X>	0	.	DP=24;I16=12,9,0,1,710,25220,14,196,1198,70082,60,3600,346,7514,25,625;QS=2.93665,0.0633484,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.804615;BQB=1;MQ0F=0	PL:DP:DV	0,30,227,30,227,227:10:0	0,7,156,18,159,162:7:1	0,15,133,15,133,133:5:0
+17	3485	.	C	<X>	0	.	DP=23;I16=11,11,0,0,766,27656,0,0,1196,68164,0,0,393,8573,0,0;QS=3,0;MQSB=0.770381;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,163:6:0	0,15,120:5:0
+17	3486	.	T	<X>	0	.	DP=24;I16=12,10,0,0,799,30529,0,0,1196,68164,0,0,398,8756,0,0;QS=3,0;MQSB=0.838545;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,21,198:7:0	0,15,128:5:0
+17	3487	.	C	<X>	0	.	DP=24;I16=10,11,0,0,724,27586,0,0,1167,67323,0,0,393,8905,0,0;QS=3,0;MQSB=0.914611;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,162:6:0	0,12,92:4:0
+17	3488	.	T	<X>	0	.	DP=24;I16=12,10,0,0,742,27454,0,0,1196,68164,0,0,429,9571,0,0;QS=3,0;MQSB=0.838545;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,21,172:7:0	0,12,98:4:0
+17	3489	.	G	<X>	0	.	DP=25;I16=13,11,0,0,778,28994,0,0,1285,72605,0,0,433,9675,0,0;QS=3,0;MQSB=0.97965;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,24,177:8:0	0,12,75:4:0
+17	3490	.	T	C,<X>	0	.	DP=27;I16=14,10,1,0,806,28886,25,625,1254,69846,60,3600,427,9659,12,144;QS=2.90775,0.0922509,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.962269;BQB=1;MQ0F=0	PL:DP:DV	0,39,255,39,255,255:13:0	0,2,168,24,171,183:9:1	0,9,85,9,85,85:3:0
+17	3491	.	C	<X>	0	.	DP=28;I16=15,11,0,0,864,31232,0,0,1405,79805,0,0,445,9903,0,0;QS=3,0;MQSB=0.753395;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,27,197:9:0	0,9,78:3:0
+17	3492	.	T	<X>	0	.	DP=28;I16=15,11,0,0,852,31516,0,0,1405,79805,0,0,452,9986,0,0;QS=3,0;MQSB=0.753395;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,27,212:9:0	0,9,96:3:0
+17	3493	.	C	<X>	0	.	DP=28;I16=15,12,0,0,891,32181,0,0,1434,80646,0,0,464,10124,0,0;QS=3,0;MQSB=0.908075;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,27,214:9:0	0,9,80:3:0
+17	3493	.	CAAAAAAAAAAAAA	CAAAAAAAAAAAA,CAAAAAAAAAAAAAA	0	.	INDEL;IDV=2;IMF=0.125;DP=28;I16=9,9,0,2,443,11071,47,1129,1049,62041,89,4441,320,7120,30,650;QS=2.81818,0.0909091,0.0909091;VDB=0.504964;SGB=0.346553;MQSB=0.997118;MQ0F=0	PL:DP:DV	0,19,37,19,40,37:11:2	0,18,39,18,39,39:6:0	0,9,23,9,23,23:3:0
+17	3494	.	A	<X>	0	.	DP=30;I16=15,12,0,0,970,37408,0,0,1465,83405,0,0,440,9568,0,0;QS=3,0;MQSB=0.723173;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,27,220:9:0	0,12,117:4:0
+17	3495	.	A	<X>	0	.	DP=31;I16=15,13,0,0,966,36178,0,0,1525,87005,0,0,472,10270,0,0;QS=3,0;MQSB=0.695496;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,27,210:9:0	0,15,129:5:0
+17	3496	.	A	<X>	0	.	DP=31;I16=15,13,0,0,974,36928,0,0,1525,87005,0,0,477,10281,0,0;QS=3,0;MQSB=0.695496;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,27,207:9:0	0,15,138:5:0
+17	3497	.	A	<X>	0	.	DP=32;I16=14,14,0,0,1015,39525,0,0,1525,87005,0,0,460,9834,0,0;QS=3,0;MQSB=0.62781;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,24,208:8:0	0,18,148:6:0
+17	3498	.	A	<X>	0	.	DP=32;I16=14,14,0,0,982,37264,0,0,1556,89764,0,0,460,9628,0,0;QS=3,0;MQSB=0.813104;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,27,220:9:0	0,15,115:5:0
+17	3499	.	A	<X>	0	.	DP=32;I16=14,14,0,0,1024,40072,0,0,1525,87005,0,0,489,10267,0,0;QS=3,0;MQSB=0.62781;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,24,222:8:0	0,18,144:6:0
+17	3500	.	A	<X>	0	.	DP=31;I16=14,14,0,0,995,38097,0,0,1525,87005,0,0,494,10316,0,0;QS=3,0;MQSB=0.62781;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,24,214:8:0	0,18,150:6:0
+17	3501	.	A	<X>	0	.	DP=31;I16=14,14,0,0,1017,39845,0,0,1525,87005,0,0,499,10399,0,0;QS=3,0;MQSB=0.62781;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,24,221:8:0	0,18,149:6:0
+17	3502	.	A	<X>	0	.	DP=31;I16=14,14,0,0,1051,41955,0,0,1525,87005,0,0,504,10516,0,0;QS=3,0;MQSB=0.62781;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,24,223:8:0	0,18,154:6:0
+17	3503	.	A	<X>	0	.	DP=31;I16=14,14,0,0,1038,40832,0,0,1525,87005,0,0,509,10667,0,0;QS=3,0;MQSB=0.62781;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,24,229:8:0	0,18,155:6:0
+17	3504	.	A	<X>	0	.	DP=31;I16=14,14,0,0,1037,41235,0,0,1525,87005,0,0,512,10750,0,0;QS=3,0;MQSB=0.62781;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,24,229:8:0	0,18,145:6:0
+17	3505	.	A	<X>	0	.	DP=31;I16=14,14,0,0,1039,40959,0,0,1525,87005,0,0,514,10814,0,0;QS=3,0;MQSB=0.62781;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,24,233:8:0	0,18,156:6:0
+17	3506	.	A	<X>	0	.	DP=32;I16=11,13,0,0,889,34265,0,0,1378,80882,0,0,427,9079,0,0;QS=3,0;MQSB=0.998323;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,201:6:0	0,18,158:6:0
+17	3507	.	T	<X>	0	.	DP=31;I16=10,17,0,0,995,38431,0,0,1527,88923,0,0,493,10499,0,0;QS=3,0;MQSB=0.997168;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,18,187:6:0	0,18,153:6:0
+17	3508	.	C	<X>	0	.	DP=31;I16=10,17,0,0,997,40091,0,0,1527,88923,0,0,499,10675,0,0;QS=3,0;MQSB=0.997168;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,18,160:6:0	0,15,119:5:0
+17	3509	.	A	<X>	0	.	DP=30;I16=11,17,0,0,995,37147,0,0,1556,89764,0,0,529,11459,0,0;QS=3,0;MQSB=0.960952;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,18,175:6:0	0,15,125:5:0
+17	3510	.	C	A,<X>	0	.	DP=29;I16=9,17,1,0,959,37997,40,1600,1498,88082,29,841,483,10351,25,625;QS=2.95246,0.047541,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.997168;BQB=1;MQ0F=0	PL:DP:DV	0,19,255,45,255,255:16:1	0,18,150,18,150,150:6:0	0,15,119,15,119,119:5:0
+17	3511	.	A	<X>	0	.	DP=32;I16=11,17,0,0,923,33125,0,0,1587,92523,0,0,512,11150,0,0;QS=3,0;MQSB=0.993109;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,18,169:6:0	0,15,115:5:0
+17	3512	.	C	<X>	0	.	DP=32;I16=10,18,0,0,1058,42208,0,0,1618,95282,0,0,493,10733,0,0;QS=3,0;MQSB=0.891417;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,18,181:6:0	0,15,131:5:0
+17	3513	.	C	A,<X>	0	.	DP=32;I16=10,18,1,0,1074,42406,13,169,1618,95282,29,841,498,10926,25,625;QS=2.98,0.02,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.995968;BQB=1;MQ0F=0	PL:DP:DV	0,39,255,51,255,255:18:1	0,18,190,18,190,190:6:0	0,15,136,15,136,136:5:0
+17	3514	.	A	<X>	0	.	DP=33;I16=11,19,0,0,1101,42213,0,0,1707,99723,0,0,528,11778,0,0;QS=3,0;MQSB=0.997918;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,21,199:7:0	0,15,132:5:0
+17	3515	.	T	<X>	0	.	DP=33;I16=12,19,0,0,1130,43380,0,0,1736,100564,0,0,557,12563,0,0;QS=3,0;MQSB=0.960505;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,21,192:7:0	0,15,126:5:0
+17	3516	.	T	<X>	0	.	DP=34;I16=14,17,0,0,1147,44331,0,0,1767,103323,0,0,536,12078,0,0;QS=3,0;MQSB=0.924242;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,21,203:7:0	0,15,133:5:0
+17	3517	.	T	<X>	0	.	DP=34;I16=14,18,0,0,1183,46549,0,0,1796,104164,0,0,565,12773,0,0;QS=3,0;MQSB=0.988522;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,21,210:7:0	0,15,153:5:0
+17	3518	.	T	<X>	0	.	DP=34;I16=14,18,0,0,1165,44867,0,0,1796,104164,0,0,568,12826,0,0;QS=3,0;MQSB=0.988522;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,21,203:7:0	0,15,141:5:0
+17	3519	.	G	<X>	0	.	DP=33;I16=13,18,0,0,1158,46678,0,0,1736,100564,0,0,572,12912,0,0;QS=3,0;MQSB=0.980167;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,18,189:6:0	0,15,154:5:0
+17	3520	.	G	<X>	0	.	DP=33;I16=12,18,0,0,1111,42471,0,0,1707,99723,0,0,552,12438,0,0;QS=3,0;MQSB=0.991968;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,18,183:6:0	0,15,151:5:0
+17	3521	.	C	<X>	0	.	DP=32;I16=11,17,0,0,1077,43755,0,0,1649,98041,0,0,530,11850,0,0;QS=3,0;MQSB=0.967085;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,18,185:6:0	0,15,143:5:0
+17	3522	.	T	<X>	0	.	DP=32;I16=12,17,0,0,1125,46329,0,0,1678,98882,0,0,552,12274,0,0;QS=3,0;MQSB=0.993891;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,18,199:6:0	0,15,158:5:0
+17	3523	.	T	<X>	0	.	DP=31;I16=11,16,0,0,996,38204,0,0,1558,91682,0,0,544,12286,0,0;QS=3,0;MQSB=0.992419;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,18,193:6:0	0,15,145:5:0
+17	3524	.	C	<X>	0	.	DP=31;I16=11,16,0,0,1067,43883,0,0,1589,94441,0,0,538,11960,0,0;QS=3,0;MQSB=0.96384;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,18,192:6:0	0,15,152:5:0
+17	3525	.	A	<X>	0	.	DP=31;I16=13,16,0,0,1132,46402,0,0,1678,98882,0,0,556,12250,0,0;QS=3,0;MQSB=0.997839;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,18,200:6:0	0,15,165:5:0
+17	3526	.	G	<X>	0	.	DP=31;I16=12,16,0,0,1090,43912,0,0,1649,98041,0,0,543,12053,0,0;QS=3,0;MQSB=0.96195;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,18,181:6:0	0,15,147:5:0
+17	3527	.	A	<X>	0	.	DP=31;I16=13,16,0,0,1068,41740,0,0,1678,98882,0,0,560,12334,0,0;QS=3,0;MQSB=0.997839;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,18,170:6:0	0,15,157:5:0
+17	3528	.	T	<X>	0	.	DP=31;I16=13,16,0,0,1076,41782,0,0,1678,98882,0,0,561,12369,0,0;QS=3,0;MQSB=0.997839;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,18,193:6:0	0,15,152:5:0
+17	3529	.	T	<X>	0	.	DP=31;I16=12,16,0,0,1016,38674,0,0,1649,98041,0,0,550,12290,0,0;QS=3,0;MQSB=0.96195;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,18,184:6:0	0,15,154:5:0
+17	3530	.	G	<X>	0	.	DP=30;I16=12,17,0,0,1070,40570,0,0,1709,101641,0,0,578,13032,0,0;QS=3,0;MQSB=0.965321;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,18,176:6:0	0,18,175:6:0
+17	3531	.	C	A,<X>	0	.	DP=31;I16=13,17,1,0,1080,40304,38,1444,1738,102482,29,841,607,13801,10,100;QS=2.95773,0.0422741,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.924242;BQB=1;MQ0F=0	PL:DP:DV	0,28,255,54,255,255:19:1	0,18,172,18,172,172:6:0	0,18,175,18,175,175:6:0
+17	3532	.	A	<X>	0	.	DP=31;I16=14,17,0,0,1136,42380,0,0,1767,103323,0,0,619,14003,0,0;QS=3,0;MQSB=0.924242;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,18,180:6:0	0,18,184:6:0
+17	3533	.	T	<X>	0	.	DP=31;I16=13,17,0,0,1074,39206,0,0,1738,102482,0,0,595,13457,0,0;QS=3,0;MQSB=0.996503;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,18,180:6:0	0,18,176:6:0
+17	3534	.	A	<X>	0	.	DP=30;I16=12,17,0,0,1014,36168,0,0,1678,98882,0,0,597,13561,0,0;QS=3,0;MQSB=0.993891;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,18,165:6:0	0,18,175:6:0
+17	3535	.	T	<X>	0	.	DP=31;I16=14,17,0,0,1042,36456,0,0,1767,103323,0,0,624,14314,0,0;QS=3,0;MQSB=0.924242;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,18,162:6:0	0,18,164:6:0
+17	3536	.	C	<X>	0	.	DP=31;I16=13,17,0,0,1102,41182,0,0,1738,102482,0,0,602,13842,0,0;QS=3,0;MQSB=0.996503;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,18,178:6:0	0,18,180:6:0
+17	3537	.	C	<X>	0	.	DP=32;I16=13,17,0,0,1142,43828,0,0,1769,105241,0,0,598,13854,0,0;QS=3,0;MQSB=0.963674;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,21,194:7:0	0,18,185:6:0
+17	3538	.	T	<X>	0	.	DP=32;I16=14,17,0,0,1151,43471,0,0,1798,106082,0,0,603,13923,0,0;QS=3,0;MQSB=0.998229;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,21,211:7:0	0,18,185:6:0
+17	3539	.	C	<X>	0	.	DP=32;I16=12,17,0,0,1077,40959,0,0,1709,101641,0,0,600,13994,0,0;QS=3,0;MQSB=0.965321;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,18,170:6:0	0,18,173:6:0
+17	3540	.	C	<X>	0	.	DP=31;I16=13,17,0,0,1134,43546,0,0,1769,105241,0,0,603,14055,0,0;QS=3,0;MQSB=0.963674;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,21,209:7:0	0,18,172:6:0
+17	3541	.	T	<X>	0	.	DP=32;I16=13,18,0,0,1143,42901,0,0,1829,108841,0,0,604,14134,0,0;QS=3,0;MQSB=0.966712;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,24,224:8:0	0,18,187:6:0
+17	3542	.	G	<X>	0	.	DP=32;I16=13,18,0,0,1152,43714,0,0,1829,108841,0,0,604,14134,0,0;QS=3,0;MQSB=0.966712;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,24,223:8:0	0,18,172:6:0
+17	3543	.	C	<X>	0	.	DP=31;I16=13,17,0,0,1142,43818,0,0,1769,105241,0,0,605,14153,0,0;QS=3,0;MQSB=0.963674;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,24,221:8:0	0,18,188:6:0
+17	3544	.	A	<X>	0	.	DP=31;I16=13,17,0,0,1089,40065,0,0,1769,105241,0,0,606,14190,0,0;QS=3,0;MQSB=0.963674;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,24,221:8:0	0,18,173:6:0
+17	3545	.	A	<X>	0	.	DP=30;I16=13,16,0,0,1118,43688,0,0,1709,101641,0,0,607,14195,0,0;QS=3,0;MQSB=0.960189;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,21,228:7:0	0,18,196:6:0
+17	3546	.	G	<X>	0	.	DP=30;I16=14,16,0,0,1131,43425,0,0,1738,102482,0,0,630,14698,0,0;QS=3,0;MQSB=0.999136;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,21,206:7:0	0,18,179:6:0
+17	3547	.	G	<X>	0	.	DP=31;I16=13,17,0,0,1076,39798,0,0,1769,105241,0,0,607,14163,0,0;QS=3,0;MQSB=0.963674;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,21,189:7:0	0,18,187:6:0
+17	3548	.	A	<X>	0	.	DP=31;I16=13,17,0,0,1071,39059,0,0,1769,105241,0,0,608,14178,0,0;QS=3,0;MQSB=0.963674;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,21,208:7:0	0,18,179:6:0
+17	3549	.	T	<X>	0	.	DP=30;I16=13,16,0,0,1008,35928,0,0,1678,98882,0,0,605,13989,0,0;QS=3,0;MQSB=0.997839;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,18,180:6:0	0,15,152:5:0
+17	3550	.	A	<X>	0	.	DP=30;I16=13,16,0,0,1061,39371,0,0,1709,101641,0,0,612,14270,0,0;QS=3,0;MQSB=0.960189;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,21,194:7:0	0,15,173:5:0
+17	3551	.	T	<X>	0	.	DP=30;I16=13,16,0,0,1026,36844,0,0,1709,101641,0,0,613,14295,0,0;QS=3,0;MQSB=0.960189;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,21,192:7:0	0,15,162:5:0
+17	3552	.	A	<X>	0	.	DP=30;I16=14,16,0,0,1080,39588,0,0,1738,102482,0,0,631,14627,0,0;QS=3,0;MQSB=0.999136;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,21,202:7:0	0,15,158:5:0
+17	3553	.	T	A,<X>	0	.	DP=30;I16=13,16,1,0,1047,38333,20,400,1709,101641,29,841,616,14398,16,256;QS=2.96795,0.0320513,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.999136;BQB=1;MQ0F=0	PL:DP:DV	0,34,255,51,255,255:18:1	0,18,178,18,178,178:6:0	0,18,183,18,183,183:6:0
+17	3554	.	A	<X>	0	.	DP=30;I16=14,16,0,0,1063,38413,0,0,1738,102482,0,0,632,14602,0,0;QS=3,0;MQSB=0.999136;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,18,185:6:0	0,18,179:6:0
+17	3555	.	C	<X>	0	.	DP=30;I16=14,16,0,0,1021,35781,0,0,1738,102482,0,0,632,14574,0,0;QS=3,0;MQSB=0.999136;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,18,169:6:0	0,18,163:6:0
+17	3556	.	G	<X>	0	.	DP=30;I16=13,16,0,0,1014,36426,0,0,1709,101641,0,0,618,14350,0,0;QS=3,0;MQSB=0.960189;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,18,168:6:0	0,18,173:6:0
+17	3557	.	C	<X>	0	.	DP=31;I16=14,16,0,0,1001,34919,0,0,1769,105241,0,0,618,14342,0,0;QS=3,0;MQSB=0.958545;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,18,140:6:0	0,18,165:6:0
+17	3558	.	G	<X>	0	.	DP=31;I16=15,16,0,0,1036,35974,0,0,1798,106082,0,0,630,14476,0,0;QS=3,0;MQSB=0.999805;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,18,159:6:0	0,18,171:6:0
+17	3559	.	T	<X>	0	.	DP=30;I16=14,16,0,0,1086,40202,0,0,1769,105241,0,0,619,14341,0,0;QS=3,0;MQSB=0.958545;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,18,171:6:0	0,18,192:6:0
+17	3560	.	G	<X>	0	.	DP=31;I16=14,16,0,0,1151,45035,0,0,1738,102482,0,0,611,14127,0,0;QS=3,0;MQSB=0.999136;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,15,165:5:0	0,18,194:6:0
+17	3561	.	A	<X>	0	.	DP=31;I16=15,16,0,0,1147,43431,0,0,1798,106082,0,0,626,14366,0,0;QS=3,0;MQSB=0.999805;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,18,186:6:0	0,18,196:6:0
+17	3562	.	A	<X>	0	.	DP=31;I16=16,15,0,0,1157,43859,0,0,1798,106082,0,0,623,14257,0,0;QS=3,0;MQSB=0.999805;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,18,192:6:0	0,21,213:7:0
+17	3563	.	A	<X>	0	.	DP=31;I16=16,15,0,0,1162,44010,0,0,1798,106082,0,0,620,14124,0,0;QS=3,0;MQSB=0.999805;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,18,192:6:0	0,21,216:7:0
+17	3564	.	T	<X>	0	.	DP=31;I16=15,15,0,0,1132,43298,0,0,1769,105241,0,0,610,13932,0,0;QS=3,0;MQSB=0.952765;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,18,192:6:0	0,21,214:7:0
+17	3565	.	T	<X>	0	.	DP=32;I16=16,16,0,0,1163,42649,0,0,1858,109682,0,0,611,13791,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,18,189:6:0	0,21,212:7:0
+17	3566	.	C	<X>	0	.	DP=32;I16=16,16,0,0,1162,43586,0,0,1858,109682,0,0,606,13596,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,18,181:6:0	0,21,209:7:0
+17	3567	.	A	<X>	0	.	DP=32;I16=15,16,0,0,1181,45245,0,0,1829,108841,0,0,597,13375,0,0;QS=3,0;MQSB=0.957006;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,18,192:6:0	0,21,222:7:0
+17	3568	.	A	<X>	0	.	DP=32;I16=15,16,0,0,1194,46670,0,0,1829,108841,0,0,592,13200,0,0;QS=3,0;MQSB=0.957006;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,18,204:6:0	0,21,228:7:0
+17	3569	.	G	<X>	0	.	DP=31;I16=15,16,0,0,1164,44544,0,0,1829,108841,0,0,586,13006,0,0;QS=3,0;MQSB=0.957006;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,18,180:6:0	0,21,204:7:0
+17	3570	.	T	<X>	0	.	DP=30;I16=14,15,0,0,1029,37527,0,0,1709,101641,0,0,572,12730,0,0;QS=3,0;MQSB=0.954405;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,12,136:4:0	0,21,213:7:0
+17	3571	.	C	<X>	0	.	DP=28;I16=13,15,0,0,1066,41192,0,0,1649,98041,0,0,568,12564,0,0;QS=3,0;MQSB=0.956162;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,12,138:4:0	0,21,215:7:0
+17	3572	.	A	<X>	0	.	DP=29;I16=13,16,0,0,1108,42566,0,0,1709,101641,0,0,564,12426,0,0;QS=3,0;MQSB=0.960189;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,15,172:5:0	0,21,218:7:0
+17	3573	.	A	<X>	0	.	DP=29;I16=13,16,0,0,1119,43403,0,0,1709,101641,0,0,558,12168,0,0;QS=3,0;MQSB=0.960189;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,15,174:5:0	0,21,220:7:0
+17	3574	.	T	<X>	0	.	DP=29;I16=13,16,0,0,1104,42220,0,0,1709,101641,0,0,552,11942,0,0;QS=3,0;MQSB=0.960189;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,15,175:5:0	0,21,218:7:0
+17	3575	.	G	<X>	0	.	DP=29;I16=13,16,0,0,1122,43748,0,0,1709,101641,0,0,546,11748,0,0;QS=3,0;MQSB=0.960189;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,15,161:5:0	0,21,212:7:0
+17	3576	.	A	<X>	0	.	DP=29;I16=13,16,0,0,1043,38405,0,0,1709,101641,0,0,540,11586,0,0;QS=3,0;MQSB=0.960189;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,15,170:5:0	0,21,213:7:0
+17	3577	.	C	<X>	0	.	DP=30;I16=13,17,0,0,1123,42529,0,0,1769,105241,0,0,534,11456,0,0;QS=3,0;MQSB=0.963674;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,15,161:5:0	0,21,211:7:0
+17	3578	.	A	<X>	0	.	DP=30;I16=13,17,0,0,1148,44236,0,0,1769,105241,0,0,529,11359,0,0;QS=3,0;MQSB=0.963674;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,15,178:5:0	0,21,216:7:0
+17	3579	.	A	<X>	0	.	DP=29;I16=13,16,0,0,1051,38961,0,0,1709,101641,0,0,524,11244,0,0;QS=3,0;MQSB=0.960189;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,15,172:5:0	0,18,192:6:0
+17	3580	.	A	<X>	0	.	DP=29;I16=13,16,0,0,1104,42344,0,0,1709,101641,0,0,519,11159,0,0;QS=3,0;MQSB=0.960189;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,15,172:5:0	0,18,201:6:0
+17	3581	.	T	<X>	0	.	DP=29;I16=13,16,0,0,1088,41226,0,0,1709,101641,0,0,513,11055,0,0;QS=3,0;MQSB=0.960189;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,15,161:5:0	0,18,199:6:0
+17	3582	.	C	<X>	0	.	DP=29;I16=13,16,0,0,1120,43616,0,0,1709,101641,0,0,506,10934,0,0;QS=3,0;MQSB=0.960189;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,15,172:5:0	0,18,201:6:0
+17	3583	.	A	<X>	0	.	DP=30;I16=14,16,0,0,1130,43606,0,0,1769,105241,0,0,498,10796,0,0;QS=3,0;MQSB=0.958545;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,15,183:5:0	0,21,213:7:0
+17	3584	.	G	<X>	0	.	DP=29;I16=12,16,0,0,1027,38895,0,0,1649,98041,0,0,487,10665,0,0;QS=3,0;MQSB=0.96195;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,12,137:4:0	0,21,209:7:0
+17	3585	.	A	<X>	0	.	DP=31;I16=14,17,0,0,1057,37719,0,0,1829,108841,0,0,486,10616,0,0;QS=3,0;MQSB=0.962133;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,15,168:5:0	0,24,209:8:0
+17	3586	.	A	<X>	0	.	DP=30;I16=14,15,0,0,1053,40043,0,0,1709,101641,0,0,477,10461,0,0;QS=3,0;MQSB=0.954405;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,15,174:5:0	0,24,213:8:0
+17	3587	.	G	A,<X>	0	.	DP=29;I16=4,7,10,6,426,16884,555,20381,660,39600,960,57600,192,4420,280,5942;QS=1.32665,1.67335,0;VDB=0.902044;SGB=-3.91326;RPB=0.800999;MQB=1;MQSB=1;BQB=0.156944;MQ0F=0	PL:DP:DV	161,0,184,182,205,255:14:7	22,0,118,34,121,148:5:1	212,24,0,212,24,212:8:8
+17	3588	.	A	<X>	0	.	DP=29;I16=14,14,0,0,999,36973,0,0,1680,100800,0,0,470,10254,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,166:5:0	0,24,215:8:0
+17	3589	.	A	<X>	0	.	DP=28;I16=14,13,0,0,967,35935,0,0,1620,97200,0,0,467,10173,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,166:5:0	0,24,206:8:0
+17	3590	.	A	<X>	0	.	DP=27;I16=13,13,0,0,948,35860,0,0,1560,93600,0,0,464,10072,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,146:4:0	0,24,211:8:0
+17	3591	.	A	<X>	0	.	DP=26;I16=13,13,0,0,913,33539,0,0,1560,93600,0,0,459,9901,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,144:4:0	0,24,212:8:0
+17	3592	.	A	<X>	0	.	DP=26;I16=13,13,0,0,893,32087,0,0,1560,93600,0,0,453,9711,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,143:4:0	0,24,199:8:0
+17	3593	.	A	<X>	0	.	DP=26;I16=13,13,0,0,891,31363,0,0,1560,93600,0,0,447,9553,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,137:4:0	0,24,198:8:0
+17	3594	.	C	<X>	0	.	DP=25;I16=12,12,0,0,910,34868,0,0,1440,86400,0,0,426,9170,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,142:4:0	0,24,216:8:0
+17	3595	.	A	<X>	0	.	DP=24;I16=13,11,0,0,918,35274,0,0,1440,86400,0,0,438,9328,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,143:4:0	0,21,199:7:0
+17	3596	.	T	<X>	0	.	DP=24;I16=13,11,0,0,837,30077,0,0,1440,86400,0,0,434,9258,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,138:4:0	0,21,188:7:0
+17	3597	.	A	<X>	0	.	DP=24;I16=13,11,0,0,893,33549,0,0,1440,86400,0,0,430,9216,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,132:4:0	0,21,204:7:0
+17	3598	.	T	<X>	0	.	DP=23;I16=12,10,0,0,778,28226,0,0,1320,79200,0,0,415,9005,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,140:4:0	0,21,162:7:0
+17	3599	.	A	<X>	0	.	DP=23;I16=13,10,0,0,859,32403,0,0,1380,82800,0,0,425,9105,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,142:4:0	0,21,182:7:0
+17	3600	.	T	<X>	0	.	DP=24;I16=14,10,0,0,872,32086,0,0,1435,85825,0,0,422,9036,0,0;QS=3,0;MQSB=0.958048;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,139:4:0	0,21,183:7:0
+17	3601	.	A	<X>	0	.	DP=24;I16=14,10,0,0,862,31424,0,0,1435,85825,0,0,420,8994,0,0;QS=3,0;MQSB=0.958048;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,132:4:0	0,21,186:7:0
+17	3602	.	T	<X>	0	.	DP=25;I16=15,10,0,0,873,31323,0,0,1495,89425,0,0,418,8980,0,0;QS=3,0;MQSB=0.962269;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,161:5:0	0,21,174:7:0
+17	3603	.	A	<X>	0	.	DP=26;I16=15,11,0,0,907,32447,0,0,1555,93025,0,0,416,8944,0,0;QS=3,0;MQSB=0.960078;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,151:5:0	0,24,216:8:0
+17	3604	.	C	<X>	0	.	DP=27;I16=16,11,0,0,905,31199,0,0,1615,96625,0,0,415,8937,0,0;QS=3,0;MQSB=0.96384;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,18,147:6:0	0,24,201:8:0
+17	3605	.	G	<X>	0	.	DP=27;I16=15,11,0,0,853,28887,0,0,1555,93025,0,0,393,8477,0,0;QS=3,0;MQSB=0.960078;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,18,171:6:0	0,21,174:7:0
+17	3606	.	C	<X>	0	.	DP=27;I16=15,12,0,0,982,36756,0,0,1615,96625,0,0,415,8967,0,0;QS=3,0;MQSB=0.958048;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,187:6:0	0,27,231:9:0
+17	3607	.	A	<X>	0	.	DP=26;I16=15,11,0,0,927,33859,0,0,1555,93025,0,0,417,9005,0,0;QS=3,0;MQSB=0.960078;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,183:6:0	0,27,232:9:0
+17	3608	.	A	<X>	0	.	DP=27;I16=14,12,0,0,930,34054,0,0,1555,93025,0,0,394,8450,0,0;QS=3,0;MQSB=0.953497;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,176:6:0	0,24,232:8:0
+17	3609	.	A	<X>	0	.	DP=27;I16=15,12,0,0,955,34701,0,0,1615,96625,0,0,421,9127,0,0;QS=3,0;MQSB=0.958048;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,186:6:0	0,27,238:9:0
+17	3610	.	C	<X>	0	.	DP=27;I16=14,12,0,0,915,33071,0,0,1555,93025,0,0,397,8537,0,0;QS=3,0;MQSB=0.953497;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,172:6:0	0,24,221:8:0
+17	3611	.	C	<X>	0	.	DP=25;I16=13,11,0,0,899,33995,0,0,1435,85825,0,0,398,8502,0,0;QS=3,0;MQSB=0.950498;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,18,173:6:0	0,24,234:8:0
+17	3612	.	A	<X>	0	.	DP=25;I16=14,11,0,0,957,37723,0,0,1495,89425,0,0,424,9118,0,0;QS=3,0;MQSB=0.955682;MQ0F=0	PL:DP:DV	0,30,255:10:0	0,18,194:6:0	0,27,251:9:0
+17	3613	.	G	<X>	0	.	DP=26;I16=13,12,0,0,902,33110,0,0,1495,89425,0,0,399,8461,0,0;QS=3,0;MQSB=0.948139;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,172:6:0	0,24,223:8:0
+17	3614	.	T	<X>	0	.	DP=26;I16=14,12,0,0,912,33340,0,0,1555,93025,0,0,425,9083,0,0;QS=3,0;MQSB=0.953497;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,156:6:0	0,27,237:9:0
+17	3615	.	A	<X>	0	.	DP=26;I16=15,11,0,0,946,35138,0,0,1555,93025,0,0,427,9109,0,0;QS=3,0;MQSB=0.960078;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,176:6:0	0,27,242:9:0
+17	3616	.	T	<X>	0	.	DP=26;I16=15,11,0,0,965,36541,0,0,1555,93025,0,0,431,9163,0,0;QS=3,0;MQSB=0.960078;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,185:6:0	0,27,238:9:0
+17	3617	.	C	<X>	0	.	DP=25;I16=14,11,0,0,907,33675,0,0,1495,89425,0,0,436,9196,0,0;QS=3,0;MQSB=0.955682;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,176:6:0	0,24,215:8:0
+17	3618	.	C	<X>	0	.	DP=25;I16=14,11,0,0,964,37698,0,0,1495,89425,0,0,441,9259,0,0;QS=3,0;MQSB=0.955682;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,190:6:0	0,24,225:8:0
+17	3619	.	T	<X>	0	.	DP=25;I16=14,11,0,0,961,37553,0,0,1495,89425,0,0,446,9352,0,0;QS=3,0;MQSB=0.955682;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,194:6:0	0,24,238:8:0
+17	3620	.	A	<X>	0	.	DP=25;I16=14,11,0,0,880,31656,0,0,1495,89425,0,0,451,9475,0,0;QS=3,0;MQSB=0.955682;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,178:6:0	0,24,212:8:0
+17	3621	.	C	<X>	0	.	DP=25;I16=14,11,0,0,949,36561,0,0,1495,89425,0,0,456,9628,0,0;QS=3,0;MQSB=0.955682;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,18,182:6:0	0,24,230:8:0
+17	3622	.	T	<X>	0	.	DP=26;I16=15,11,0,0,983,38067,0,0,1555,93025,0,0,460,9762,0,0;QS=3,0;MQSB=0.960078;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,21,194:7:0	0,24,242:8:0
+17	3623	.	G	<X>	0	.	DP=27;I16=16,11,0,0,969,35645,0,0,1615,96625,0,0,465,9929,0,0;QS=3,0;MQSB=0.96384;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,21,195:7:0	0,24,209:8:0
+17	3624	.	T	<X>	0	.	DP=27;I16=15,11,0,0,948,35330,0,0,1555,93025,0,0,448,9596,0,0;QS=3,0;MQSB=0.960078;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,188:6:0	0,24,224:8:0
+17	3625	.	G	<X>	0	.	DP=27;I16=14,12,0,0,983,37483,0,0,1555,93025,0,0,453,9735,0,0;QS=3,0;MQSB=0.953497;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,21,210:7:0	0,24,219:8:0
+17	3626	.	T	<X>	0	.	DP=28;I16=15,12,0,0,998,37364,0,0,1615,96625,0,0,458,9854,0,0;QS=3,0;MQSB=0.958048;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,21,214:7:0	0,27,229:9:0
+17	3627	.	G	<X>	0	.	DP=29;I16=15,13,0,0,999,36375,0,0,1675,100225,0,0,464,10004,0,0;QS=3,0;MQSB=0.956162;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,21,199:7:0	0,27,224:9:0
+17	3628	.	T	<X>	0	.	DP=29;I16=15,13,0,0,1033,38721,0,0,1675,100225,0,0,471,10187,0,0;QS=3,0;MQSB=0.956162;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,21,206:7:0	0,27,232:9:0
+17	3629	.	G	<X>	0	.	DP=29;I16=15,13,0,0,1058,40226,0,0,1675,100225,0,0,476,10304,0,0;QS=3,0;MQSB=0.956162;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,21,207:7:0	0,27,235:9:0
+17	3630	.	T	<X>	0	.	DP=30;I16=15,14,0,0,1052,39072,0,0,1735,103825,0,0,480,10404,0,0;QS=3,0;MQSB=0.954405;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,21,216:7:0	0,27,223:9:0
+17	3631	.	C	<X>	0	.	DP=29;I16=13,14,0,0,884,29476,0,0,1615,96625,0,0,461,9911,0,0;QS=3,0;MQSB=0.94394;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,21,186:7:0	0,21,179:7:0
+17	3632	.	G	<X>	0	.	DP=29;I16=14,14,0,0,914,31068,0,0,1675,100225,0,0,491,10649,0,0;QS=3,0;MQSB=0.949591;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,21,183:7:0	0,24,181:8:0
+17	3633	.	T	<X>	0	.	DP=29;I16=14,14,0,0,1022,38214,0,0,1675,100225,0,0,496,10792,0,0;QS=3,0;MQSB=0.949591;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,21,216:7:0	0,24,222:8:0
+17	3634	.	T	<X>	0	.	DP=29;I16=14,14,0,0,1043,39891,0,0,1675,100225,0,0,500,10914,0,0;QS=3,0;MQSB=0.949591;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,21,219:7:0	0,24,227:8:0
+17	3635	.	T	<X>	0	.	DP=28;I16=13,14,0,0,1029,39507,0,0,1615,96625,0,0,505,11063,0,0;QS=3,0;MQSB=0.94394;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,21,219:7:0	0,24,224:8:0
+17	3636	.	G	<X>	0	.	DP=28;I16=13,14,0,0,1001,37681,0,0,1615,96625,0,0,510,11238,0,0;QS=3,0;MQSB=0.94394;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,21,201:7:0	0,24,217:8:0
+17	3637	.	T	<X>	0	.	DP=27;I16=13,14,0,0,1019,39331,0,0,1615,96625,0,0,515,11439,0,0;QS=3,0;MQSB=0.94394;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,21,212:7:0	0,24,240:8:0
+17	3638	.	T	<X>	0	.	DP=26;I16=12,14,0,0,967,36467,0,0,1555,93025,0,0,520,11616,0,0;QS=3,0;MQSB=0.937241;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,185:6:0	0,24,222:8:0
+17	3639	.	G	<X>	0	.	DP=27;I16=13,14,0,0,997,37265,0,0,1615,96625,0,0,524,11768,0,0;QS=3,0;MQSB=0.94394;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,183:6:0	0,27,221:9:0
+17	3640	.	T	<X>	0	.	DP=27;I16=13,14,0,0,1001,37533,0,0,1615,96625,0,0,527,11847,0,0;QS=3,0;MQSB=0.94394;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,191:6:0	0,27,229:9:0
+17	3641	.	G	<X>	0	.	DP=27;I16=13,14,0,0,977,36379,0,0,1615,96625,0,0,529,11905,0,0;QS=3,0;MQSB=0.94394;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,178:6:0	0,27,224:9:0
+17	3642	.	T	<X>	0	.	DP=26;I16=12,13,0,0,931,35169,0,0,1495,89425,0,0,506,11314,0,0;QS=3,0;MQSB=0.939413;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,169:5:0	0,24,225:8:0
+17	3643	.	T	<X>	0	.	DP=26;I16=13,13,0,0,968,36820,0,0,1555,93025,0,0,533,11997,0,0;QS=3,0;MQSB=0.945959;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,176:5:0	0,27,230:9:0
+17	3644	.	T	<X>	0	.	DP=26;I16=12,13,0,0,961,37477,0,0,1495,89425,0,0,517,11755,0,0;QS=3,0;MQSB=0.939413;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,175:5:0	0,24,236:8:0
+17	3645	.	T	<X>	0	.	DP=26;I16=13,13,0,0,980,37508,0,0,1555,93025,0,0,537,12185,0,0;QS=3,0;MQSB=0.945959;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,175:5:0	0,27,239:9:0
+17	3646	.	C	<X>	0	.	DP=26;I16=12,13,0,0,766,25026,0,0,1495,89425,0,0,514,11690,0,0;QS=3,0;MQSB=0.939413;MQ0F=0	PL:DP:DV	0,33,234:11:0	0,15,136:5:0	0,27,188:9:0
+17	3647	.	G	<X>	0	.	DP=26;I16=12,12,0,0,820,29600,0,0,1435,85825,0,0,492,11218,0,0;QS=3,0;MQSB=0.941765;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,151:5:0	0,21,173:7:0
+17	3648	.	A	<X>	0	.	DP=26;I16=13,12,0,0,924,34680,0,0,1495,89425,0,0,519,11919,0,0;QS=3,0;MQSB=0.948139;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,174:5:0	0,24,225:8:0
+17	3649	.	C	<X>	0	.	DP=26;I16=14,12,0,0,955,36105,0,0,1555,93025,0,0,545,12593,0,0;QS=3,0;MQSB=0.953497;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,173:5:0	0,27,226:9:0
+17	3650	.	A	<X>	0	.	DP=27;I16=15,12,0,0,1033,40511,0,0,1615,96625,0,0,546,12664,0,0;QS=3,0;MQSB=0.958048;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,196:6:0	0,27,246:9:0
+17	3651	.	G	<X>	0	.	DP=27;I16=15,12,0,0,1035,40351,0,0,1615,96625,0,0,547,12707,0,0;QS=3,0;MQSB=0.958048;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,194:6:0	0,27,233:9:0
+17	3652	.	C	<X>	0	.	DP=29;I16=15,13,0,0,1010,38264,0,0,1675,100225,0,0,521,12047,0,0;QS=3,0;MQSB=0.956162;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,18,198:6:0	0,27,225:9:0
+17	3653	.	T	<X>	0	.	DP=29;I16=16,13,0,0,1109,42919,0,0,1735,103825,0,0,546,12610,0,0;QS=3,0;MQSB=0.960189;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,18,202:6:0	0,27,239:9:0
+17	3654	.	G	<X>	0	.	DP=28;I16=14,12,0,0,981,37447,0,0,1555,93025,0,0,514,11882,0,0;QS=3,0;MQSB=0.953497;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,18,184:6:0	0,18,180:6:0
+17	3655	.	T	<X>	0	.	DP=28;I16=16,12,0,0,999,37029,0,0,1675,100225,0,0,541,12505,0,0;QS=3,0;MQSB=0.96195;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,18,190:6:0	0,21,179:7:0
+17	3656	.	C	<X>	0	.	DP=28;I16=15,12,0,0,963,35883,0,0,1615,96625,0,0,518,11848,0,0;QS=3,0;MQSB=0.958048;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,164:5:0	0,21,191:7:0
+17	3657	.	C	<X>	0	.	DP=28;I16=15,12,0,0,923,32223,0,0,1615,96625,0,0,520,11836,0,0;QS=3,0;MQSB=0.958048;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,154:5:0	0,21,192:7:0
+17	3658	.	G	<X>	0	.	DP=28;I16=15,12,0,0,876,29960,0,0,1615,96625,0,0,539,12405,0,0;QS=3,0;MQSB=0.958048;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,142:5:0	0,21,163:7:0
+17	3659	.	T	<X>	0	.	DP=28;I16=16,12,0,0,996,36682,0,0,1675,100225,0,0,548,12448,0,0;QS=3,0;MQSB=0.96195;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,18,163:6:0	0,21,186:7:0
+17	3660	.	G	<X>	0	.	DP=28;I16=15,12,0,0,997,37571,0,0,1615,96625,0,0,526,11920,0,0;QS=3,0;MQSB=0.958048;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,18,172:6:0	0,18,171:6:0
+17	3661	.	T	<X>	0	.	DP=28;I16=16,12,0,0,1013,37837,0,0,1675,100225,0,0,549,12423,0,0;QS=3,0;MQSB=0.96195;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,18,180:6:0	0,21,188:7:0
+17	3662	.	T	<X>	0	.	DP=28;I16=15,12,0,0,987,36627,0,0,1615,96625,0,0,528,11980,0,0;QS=3,0;MQSB=0.958048;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,18,182:6:0	0,18,184:6:0
+17	3663	.	A	<X>	0	.	DP=29;I16=16,12,0,0,997,36233,0,0,1675,100225,0,0,527,11959,0,0;QS=3,0;MQSB=0.96195;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,18,170:6:0	0,18,180:6:0
+17	3664	.	T	<X>	0	.	DP=29;I16=17,12,0,0,1044,38402,0,0,1735,103825,0,0,550,12490,0,0;QS=3,0;MQSB=0.965321;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,18,183:6:0	0,21,196:7:0
+17	3665	.	A	<X>	0	.	DP=27;I16=16,11,0,0,1017,38535,0,0,1615,96625,0,0,552,12510,0,0;QS=3,0;MQSB=0.96384;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,18,182:6:0	0,21,208:7:0
+17	3666	.	A	<X>	0	.	DP=27;I16=16,11,0,0,1036,40292,0,0,1615,96625,0,0,554,12550,0,0;QS=3,0;MQSB=0.96384;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,18,193:6:0	0,21,208:7:0
+17	3667	.	T	<X>	0	.	DP=27;I16=15,11,0,0,955,35895,0,0,1555,93025,0,0,540,12354,0,0;QS=3,0;MQSB=0.960078;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,18,189:6:0	0,18,189:6:0
+17	3668	.	A	<X>	0	.	DP=27;I16=16,11,0,0,981,36297,0,0,1615,96625,0,0,557,12641,0,0;QS=3,0;MQSB=0.96384;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,18,182:6:0	0,21,209:7:0
+17	3669	.	A	<X>	0	.	DP=27;I16=16,11,0,0,1030,39666,0,0,1615,96625,0,0,558,12694,0,0;QS=3,0;MQSB=0.96384;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,18,194:6:0	0,21,209:7:0
+17	3670	.	T	<X>	0	.	DP=28;I16=17,11,0,0,1057,40245,0,0,1675,100225,0,0,559,12769,0,0;QS=3,0;MQSB=0.967085;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,18,181:6:0	0,24,220:8:0
+17	3671	.	T	<X>	0	.	DP=28;I16=17,11,0,0,1059,40427,0,0,1675,100225,0,0,561,12867,0,0;QS=3,0;MQSB=0.967085;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,18,193:6:0	0,24,223:8:0
+17	3672	.	C	<X>	0	.	DP=28;I16=16,11,0,0,988,37264,0,0,1615,96625,0,0,550,12820,0,0;QS=3,0;MQSB=0.96384;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,18,169:6:0	0,21,205:7:0
+17	3673	.	C	<X>	0	.	DP=27;I16=16,10,0,0,1016,40148,0,0,1555,93025,0,0,528,12314,0,0;QS=3,0;MQSB=0.965874;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,154:5:0	0,24,219:8:0
+17	3674	.	T	<X>	0	.	DP=27;I16=17,10,0,0,1035,40645,0,0,1615,96625,0,0,556,13028,0,0;QS=3,0;MQSB=0.968979;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,155:5:0	0,24,228:8:0
+17	3675	.	C	<X>	0	.	DP=27;I16=17,10,0,0,1049,41413,0,0,1615,96625,0,0,558,13090,0,0;QS=3,0;MQSB=0.968979;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,149:5:0	0,24,222:8:0
+17	3676	.	T	<X>	0	.	DP=27;I16=17,10,0,0,1040,40640,0,0,1615,96625,0,0,559,13125,0,0;QS=3,0;MQSB=0.968979;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,159:5:0	0,24,231:8:0
+17	3677	.	A	<X>	0	.	DP=27;I16=16,10,0,0,922,34182,0,0,1555,93025,0,0,537,12557,0,0;QS=3,0;MQSB=0.965874;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,136:5:0	0,24,217:8:0
+17	3678	.	G	<X>	0	.	DP=27;I16=17,10,0,0,1009,38307,0,0,1615,96625,0,0,563,13159,0,0;QS=3,0;MQSB=0.968979;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,149:5:0	0,24,216:8:0
+17	3679	.	T	<X>	0	.	DP=27;I16=17,10,0,0,1018,39274,0,0,1615,96625,0,0,563,13105,0,0;QS=3,0;MQSB=0.968979;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,156:5:0	0,24,227:8:0
+17	3680	.	T	<X>	0	.	DP=27;I16=17,10,0,0,988,36872,0,0,1615,96625,0,0,562,13022,0,0;QS=3,0;MQSB=0.968979;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,157:5:0	0,24,202:8:0
+17	3681	.	C	<X>	0	.	DP=27;I16=17,10,0,0,1012,39154,0,0,1615,96625,0,0,560,12910,0,0;QS=3,0;MQSB=0.968979;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,157:5:0	0,24,217:8:0
+17	3682	.	A	<X>	0	.	DP=27;I16=17,10,0,0,1009,38221,0,0,1615,96625,0,0,557,12769,0,0;QS=3,0;MQSB=0.968979;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,156:5:0	0,24,220:8:0
+17	3683	.	A	<X>	0	.	DP=27;I16=17,9,0,0,966,36748,0,0,1555,93025,0,0,546,12552,0,0;QS=3,0;MQSB=0.971017;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,153:5:0	0,24,225:8:0
+17	3684	.	A	<X>	0	.	DP=26;I16=16,10,0,0,974,37440,0,0,1555,93025,0,0,550,12456,0,0;QS=3,0;MQSB=0.965874;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,155:5:0	0,21,215:7:0
+17	3685	.	T	<X>	0	.	DP=26;I16=16,10,0,0,954,36330,0,0,1555,93025,0,0,547,12333,0,0;QS=3,0;MQSB=0.965874;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,148:5:0	0,21,207:7:0
+17	3686	.	T	<X>	0	.	DP=26;I16=16,10,0,0,979,37645,0,0,1555,93025,0,0,544,12232,0,0;QS=3,0;MQSB=0.965874;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,162:5:0	0,21,216:7:0
+17	3687	.	T	<X>	0	.	DP=27;I16=16,11,0,0,1028,39276,0,0,1592,94394,0,0,541,12153,0,0;QS=3,0;MQSB=0.989102;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,159:5:0	0,24,229:8:0
+17	3688	.	A	<X>	0	.	DP=28;I16=17,10,0,0,1007,37883,0,0,1569,92163,0,0,526,11904,0,0;QS=3,0;MQSB=0.99874;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,148:5:0	0,24,232:8:0
+17	3689	.	T	<X>	0	.	DP=28;I16=17,11,0,0,1042,39780,0,0,1629,95763,0,0,535,11919,0,0;QS=3,0;MQSB=0.995584;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,162:5:0	0,24,233:8:0
+17	3690	.	T	<X>	0	.	DP=28;I16=17,11,0,0,1051,39981,0,0,1629,95763,0,0,532,11816,0,0;QS=3,0;MQSB=0.995584;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,160:5:0	0,24,225:8:0
+17	3691	.	C	<X>	0	.	DP=28;I16=16,11,0,0,1037,40549,0,0,1569,92163,0,0,520,11592,0,0;QS=3,0;MQSB=0.992419;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,155:5:0	0,21,214:7:0
+17	3692	.	A	<X>	0	.	DP=29;I16=18,11,0,0,1028,37574,0,0,1689,99363,0,0,522,11496,0,0;QS=3,0;MQSB=0.99773;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,15,156:5:0	0,24,209:8:0
+17	3693	.	T	<X>	0	.	DP=28;I16=18,10,0,0,1067,40901,0,0,1629,95763,0,0,519,11381,0,0;QS=3,0;MQSB=0.999713;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,160:5:0	0,24,230:8:0
+17	3694	.	T	<X>	0	.	DP=28;I16=18,10,0,0,1043,39659,0,0,1629,95763,0,0,516,11296,0,0;QS=3,0;MQSB=0.999713;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,159:5:0	0,24,234:8:0
+17	3695	.	T	<X>	0	.	DP=28;I16=18,10,0,0,1046,39662,0,0,1629,95763,0,0,513,11241,0,0;QS=3,0;MQSB=0.999713;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,156:5:0	0,24,233:8:0
+17	3696	.	T	<X>	0	.	DP=28;I16=18,10,0,0,1075,41567,0,0,1629,95763,0,0,509,11165,0,0;QS=3,0;MQSB=0.999713;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,162:5:0	0,24,235:8:0
+17	3697	.	T	<X>	0	.	DP=28;I16=18,10,0,0,1031,38399,0,0,1629,95763,0,0,505,11117,0,0;QS=3,0;MQSB=0.999713;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,155:5:0	0,24,229:8:0
+17	3698	.	A	<X>	0	.	DP=28;I16=18,9,0,0,983,36457,0,0,1569,92163,0,0,477,10515,0,0;QS=3,0;MQSB=0.999669;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,144:5:0	0,24,229:8:0
+17	3699	.	A	<X>	0	.	DP=27;I16=17,10,0,0,1011,38455,0,0,1569,92163,0,0,493,10861,0,0;QS=3,0;MQSB=0.99874;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,150:5:0	0,21,226:7:0
+17	3700	.	C	<X>	0	.	DP=28;I16=16,11,0,0,970,35910,0,0,1574,92738,0,0,473,10525,0,0;QS=3,0;MQSB=0.992419;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,18,168:6:0	0,24,212:8:0
+17	3701	.	T	<X>	0	.	DP=28;I16=17,11,0,0,1071,41669,0,0,1634,96338,0,0,484,10618,0,0;QS=3,0;MQSB=0.990092;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,18,196:6:0	0,24,233:8:0
+17	3702	.	T	<X>	0	.	DP=28;I16=17,10,0,0,1019,38653,0,0,1597,94969,0,0,462,10144,0,0;QS=3,0;MQSB=0.968979;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,18,184:6:0	0,21,207:7:0
+17	3703	.	C	<X>	0	.	DP=28;I16=17,11,0,0,1059,40561,0,0,1634,96338,0,0,470,10154,0,0;QS=3,0;MQSB=0.990092;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,18,183:6:0	0,24,232:8:0
+17	3704	.	A	<X>	0	.	DP=28;I16=17,10,0,0,1015,38483,0,0,1574,92738,0,0,439,9347,0,0;QS=3,0;MQSB=0.984677;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,18,182:6:0	0,21,211:7:0
+17	3705	.	T	<X>	0	.	DP=27;I16=17,10,0,0,992,37112,0,0,1574,92738,0,0,459,9773,0,0;QS=3,0;MQSB=0.984677;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,18,180:6:0	0,21,209:7:0
+17	3706	.	A	<X>	0	.	DP=27;I16=17,10,0,0,1040,40262,0,0,1574,92738,0,0,454,9608,0,0;QS=3,0;MQSB=0.984677;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,18,186:6:0	0,21,204:7:0
+17	3707	.	G	<X>	0	.	DP=26;I16=17,9,0,0,974,37394,0,0,1514,89138,0,0,450,9476,0,0;QS=3,0;MQSB=0.977029;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,18,173:6:0	0,18,168:6:0
+17	3708	.	T	<X>	0	.	DP=26;I16=18,7,0,0,911,33609,0,0,1454,85538,0,0,426,8934,0,0;QS=3,0;MQSB=0.914166;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,18,182:6:0	0,15,139:5:0
+17	3709	.	A	<X>	0	.	DP=26;I16=18,8,0,0,905,32473,0,0,1491,86907,0,0,445,9305,0,0;QS=3,0;MQSB=0.998458;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,18,168:6:0	0,18,162:6:0
+17	3710	.	C	<X>	0	.	DP=26;I16=18,8,0,0,924,33504,0,0,1491,86907,0,0,443,9267,0,0;QS=3,0;MQSB=0.998458;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,18,165:6:0	0,18,159:6:0
+17	3711	.	C	<X>	0	.	DP=26;I16=18,8,0,0,953,35965,0,0,1491,86907,0,0,441,9261,0,0;QS=3,0;MQSB=0.998458;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,18,164:6:0	0,18,173:6:0
+17	3712	.	A	<X>	0	.	DP=26;I16=18,8,0,0,893,31917,0,0,1491,86907,0,0,439,9287,0,0;QS=3,0;MQSB=0.998458;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,18,144:6:0	0,18,165:6:0
+17	3713	.	C	<X>	0	.	DP=26;I16=19,7,0,0,908,32834,0,0,1491,86907,0,0,437,9293,0,0;QS=3,0;MQSB=0.989612;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,18,163:6:0	0,18,164:6:0
+17	3714	.	A	<X>	0	.	DP=27;I16=19,6,0,0,920,34366,0,0,1408,81076,0,0,409,8651,0,0;QS=3,0;MQSB=0.999494;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,18,177:6:0	0,18,174:6:0
+17	3715	.	T	<X>	0	.	DP=28;I16=21,6,0,0,982,36286,0,0,1505,86045,0,0,408,8616,0,0;QS=3,0;MQSB=0.996181;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,18,180:6:0	0,18,164:6:0
+17	3716	.	T	<X>	0	.	DP=26;I16=19,7,0,0,927,33833,0,0,1445,82445,0,0,434,9236,0,0;QS=3,0;MQSB=0.966731;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,165:5:0	0,18,164:6:0
+17	3717	.	C	<X>	0	.	DP=26;I16=19,7,0,0,979,37527,0,0,1445,82445,0,0,435,9261,0,0;QS=3,0;MQSB=0.966731;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,165:5:0	0,18,168:6:0
+17	3718	.	T	<X>	0	.	DP=26;I16=19,7,0,0,994,39040,0,0,1445,82445,0,0,435,9265,0,0;QS=3,0;MQSB=0.966731;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,169:5:0	0,18,165:6:0
+17	3719	.	A	<X>	0	.	DP=26;I16=19,6,0,0,889,32163,0,0,1408,81076,0,0,410,8672,0,0;QS=3,0;MQSB=0.747144;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,148:5:0	0,15,142:5:0
+17	3720	.	C	<X>	0	.	DP=26;I16=19,7,0,0,934,34326,0,0,1445,82445,0,0,435,9357,0,0;QS=3,0;MQSB=0.966731;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,148:5:0	0,18,158:6:0
+17	3721	.	A	<X>	0	.	DP=27;I16=20,5,0,0,910,33944,0,0,1405,80725,0,0,385,8195,0,0;QS=3,0;MQSB=0.697274;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,153:5:0	0,15,145:5:0
+17	3722	.	C	<X>	0	.	DP=27;I16=20,7,0,0,964,35276,0,0,1502,85694,0,0,436,9562,0,0;QS=3,0;MQSB=0.927743;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,15,151:5:0	0,18,165:6:0
+17	3723	.	A	<X>	0	.	DP=25;I16=18,6,0,0,888,33516,0,0,1345,77125,0,0,414,9082,0,0;QS=3,0;MQSB=0.606531;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,12,134:4:0	0,15,145:5:0
+17	3724	.	C	<X>	0	.	DP=25;I16=18,7,0,0,944,35956,0,0,1382,78494,0,0,442,9878,0,0;QS=3,0;MQSB=0.889393;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,12,137:4:0	0,18,169:6:0
+17	3725	.	T	<X>	0	.	DP=25;I16=18,7,0,0,973,38263,0,0,1382,78494,0,0,445,10075,0,0;QS=3,0;MQSB=0.889393;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,12,138:4:0	0,18,190:6:0
+17	3726	.	G	<X>	0	.	DP=24;I16=18,6,0,0,865,32339,0,0,1322,74894,0,0,446,10146,0,0;QS=3,0;MQSB=0.934987;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,9,93:3:0	0,18,166:6:0
+17	3727	.	C	<X>	0	.	DP=22;I16=17,5,0,0,762,27812,0,0,1202,67694,0,0,447,10139,0,0;QS=3,0;MQSB=0.963102;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,9,82:3:0	0,15,143:5:0
+17	3728	.	C	<X>	0	.	DP=22;I16=17,5,0,0,792,29850,0,0,1202,67694,0,0,448,10154,0,0;QS=3,0;MQSB=0.963102;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,9,89:3:0	0,15,160:5:0
+17	3729	.	C	<X>	0	.	DP=22;I16=17,5,0,0,838,32312,0,0,1202,67694,0,0,449,10191,0,0;QS=3,0;MQSB=0.963102;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,9,93:3:0	0,15,164:5:0
+17	3730	.	A	<X>	0	.	DP=21;I16=17,4,0,0,749,27561,0,0,1142,64094,0,0,448,10100,0,0;QS=3,0;MQSB=0.995997;MQ0F=0	PL:DP:DV	0,39,241:13:0	0,9,98:3:0	0,15,159:5:0
+17	3731	.	T	<X>	0	.	DP=22;I16=18,4,0,0,787,29489,0,0,1152,64194,0,0,447,10031,0,0;QS=3,0;MQSB=0.967917;MQ0F=0	PL:DP:DV	0,42,253:14:0	0,9,101:3:0	0,15,139:5:0
+17	3732	.	G	<X>	0	.	DP=22;I16=18,4,0,0,811,30695,0,0,1152,64194,0,0,447,9985,0,0;QS=3,0;MQSB=0.967917;MQ0F=0	PL:DP:DV	0,42,252:14:0	0,9,101:3:0	0,15,149:5:0
+17	3733	.	T	<X>	0	.	DP=23;I16=19,4,0,0,820,29616,0,0,1212,67794,0,0,447,9963,0,0;QS=3,0;MQSB=0.979651;MQ0F=0	PL:DP:DV	0,45,248:15:0	0,9,101:3:0	0,15,152:5:0
+17	3734	.	C	<X>	0	.	DP=24;I16=20,4,0,0,863,32277,0,0,1272,71394,0,0,447,9915,0,0;QS=3,0;MQSB=0.988072;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,86:3:0	0,15,152:5:0
+17	3735	.	C	<X>	0	.	DP=24;I16=20,4,0,0,826,30112,0,0,1272,71394,0,0,448,9892,0,0;QS=3,0;MQSB=0.988072;MQ0F=0	PL:DP:DV	0,48,254:16:0	0,9,83:3:0	0,15,152:5:0
+17	3736	.	C	<X>	0	.	DP=25;I16=20,3,0,0,839,31471,0,0,1262,71294,0,0,419,9245,0,0;QS=3,0;MQSB=0.963194;MQ0F=0	PL:DP:DV	0,42,235:14:0	0,9,99:3:0	0,18,156:6:0
+17	3737	.	C	<X>	0	.	DP=25;I16=21,4,0,0,894,33402,0,0,1332,74994,0,0,451,9925,0,0;QS=3,0;MQSB=0.993838;MQ0F=0	PL:DP:DV	0,48,251:16:0	0,9,95:3:0	0,18,175:6:0
+17	3738	.	T	<X>	0	.	DP=25;I16=21,4,0,0,926,35484,0,0,1332,74994,0,0,452,9934,0,0;QS=3,0;MQSB=0.993838;MQ0F=0	PL:DP:DV	0,48,253:16:0	0,9,101:3:0	0,18,189:6:0
+17	3739	.	C	<X>	0	.	DP=25;I16=21,4,0,0,958,37390,0,0,1332,74994,0,0,452,9922,0,0;QS=3,0;MQSB=0.993838;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,105:3:0	0,18,181:6:0
+17	3740	.	A	<X>	0	.	DP=24;I16=20,4,0,0,848,31126,0,0,1272,71394,0,0,452,9886,0,0;QS=3,0;MQSB=0.988072;MQ0F=0	PL:DP:DV	0,48,247:16:0	0,9,109:3:0	0,15,163:5:0
+17	3741	.	A	<X>	0	.	DP=24;I16=19,4,0,0,814,30176,0,0,1212,67794,0,0,442,9742,0,0;QS=3,0;MQSB=0.979651;MQ0F=0	PL:DP:DV	0,48,238:16:0	0,6,82:2:0	0,15,172:5:0
+17	3742	.	G	<X>	0	.	DP=24;I16=20,4,0,0,893,34371,0,0,1272,71394,0,0,450,9782,0,0;QS=3,0;MQSB=0.988072;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,101:3:0	0,15,162:5:0
+17	3743	.	C	<X>	0	.	DP=24;I16=19,4,0,0,839,31673,0,0,1262,71294,0,0,437,9619,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,254:15:0	0,9,103:3:0	0,15,158:5:0
+17	3744	.	T	<X>	0	.	DP=24;I16=20,4,0,0,918,36126,0,0,1272,71394,0,0,448,9766,0,0;QS=3,0;MQSB=0.988072;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,118:3:0	0,15,164:5:0
+17	3745	.	T	<X>	0	.	DP=24;I16=19,4,0,0,808,29490,0,0,1212,67794,0,0,422,9166,0,0;QS=3,0;MQSB=0.979651;MQ0F=0	PL:DP:DV	0,45,233:15:0	0,9,108:3:0	0,15,158:5:0
+17	3746	.	C	<X>	0	.	DP=24;I16=20,4,0,0,886,33564,0,0,1272,71394,0,0,445,9789,0,0;QS=3,0;MQSB=0.988072;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,9,101:3:0	0,15,165:5:0
+17	3747	.	C	<X>	0	.	DP=24;I16=19,4,0,0,833,31071,0,0,1262,71294,0,0,426,9504,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,249:15:0	0,9,103:3:0	0,15,162:5:0
+17	3748	.	C	<X>	0	.	DP=24;I16=19,4,0,0,845,31753,0,0,1262,71294,0,0,422,9464,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,9,106:3:0	0,15,161:5:0
+17	3749	.	C	<X>	0	.	DP=24;I16=19,4,0,0,844,31888,0,0,1262,71294,0,0,417,9395,0,0;QS=3,0;MQSB=1;MQ0F=0	PL:DP:DV	0,45,250:15:0	0,9,111:3:0	0,15,154:5:0
+17	3750	.	T	<X>	0	.	DP=25;I16=21,4,0,0,876,32880,0,0,1309,72763,0,0,431,9709,0,0;QS=3,0;MQSB=0.966906;MQ0F=0	PL:DP:DV	0,51,251:17:0	0,9,112:3:0	0,15,146:5:0
+17	3751	.	G	<X>	0	.	DP=24;I16=19,4,0,0,836,31374,0,0,1239,69063,0,0,408,9274,0,0;QS=3,0;MQSB=0.986928;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,82:2:0	0,15,162:5:0
+17	3752	.	G	<X>	0	.	DP=22;I16=19,2,0,0,728,26270,0,0,1069,58363,0,0,404,9134,0,0;QS=3,0;MQSB=0.868421;MQ0F=0	PL:DP:DV	0,42,182:14:0	0,6,74:2:0	0,15,159:5:0
+17	3753	.	C	<X>	0	.	DP=22;I16=19,3,0,0,761,28017,0,0,1129,61963,0,0,426,9674,0,0;QS=3,0;MQSB=0.995434;MQ0F=0	PL:DP:DV	0,45,213:15:0	0,6,61:2:0	0,15,163:5:0
+17	3754	.	T	<X>	0	.	DP=23;I16=19,3,0,0,767,28751,0,0,1129,61963,0,0,425,9707,0,0;QS=3,0;MQSB=0.995434;MQ0F=0	PL:DP:DV	0,45,218:15:0	0,6,69:2:0	0,15,157:5:0
+17	3755	.	C	<X>	0	.	DP=21;I16=16,4,0,0,749,28747,0,0,1028,55504,0,0,404,9188,0,0;QS=3,0;MQSB=0.777932;MQ0F=0	PL:DP:DV	0,36,219:12:0	0,9,93:3:0	0,15,161:5:0
+17	3756	.	C	<X>	0	.	DP=22;I16=17,4,0,0,782,29994,0,0,1038,55604,0,0,430,9840,0,0;QS=3,0;MQSB=0.885747;MQ0F=0	PL:DP:DV	0,39,229:13:0	0,9,93:3:0	0,15,159:5:0
+17	3757	.	T	<X>	0	.	DP=23;I16=17,6,0,0,828,30942,0,0,1158,62804,0,0,456,10510,0,0;QS=3,0;MQSB=0.9945;MQ0F=0	PL:DP:DV	0,39,210:13:0	0,15,143:5:0	0,15,169:5:0
+17	3758	.	G	<X>	0	.	DP=23;I16=17,6,0,0,832,30792,0,0,1158,62804,0,0,458,10574,0,0;QS=3,0;MQSB=0.9945;MQ0F=0	PL:DP:DV	0,39,220:13:0	0,15,135:5:0	0,15,147:5:0
+17	3759	.	C	<X>	0	.	DP=23;I16=17,4,0,0,756,28338,0,0,1061,57835,0,0,409,9357,0,0;QS=3,0;MQSB=0.964547;MQ0F=0	PL:DP:DV	0,39,220:13:0	0,12,112:4:0	0,12,127:4:0
+17	3760	.	A	<X>	0	.	DP=24;I16=17,7,0,0,792,27956,0,0,1218,66404,0,0,459,10607,0,0;QS=3,0;MQSB=0.95083;MQ0F=0	PL:DP:DV	0,39,203:13:0	0,15,127:5:0	0,18,180:6:0
+17	3761	.	A	<X>	0	.	DP=24;I16=17,7,0,0,871,32185,0,0,1218,66404,0,0,460,10624,0,0;QS=3,0;MQSB=0.95083;MQ0F=0	PL:DP:DV	0,39,215:13:0	0,15,136:5:0	0,18,188:6:0
+17	3762	.	C	<X>	0	.	DP=25;I16=17,7,0,0,831,29665,0,0,1241,68635,0,0,435,9983,0,0;QS=3,0;MQSB=0.69242;MQ0F=0	PL:DP:DV	0,39,209:13:0	0,18,149:6:0	0,15,159:5:0
+17	3763	.	C	<X>	0	.	DP=24;I16=16,8,0,0,837,30619,0,0,1218,66404,0,0,460,10510,0,0;QS=3,0;MQSB=0.844324;MQ0F=0	PL:DP:DV	0,36,213:12:0	0,18,149:6:0	0,18,186:6:0
+17	3764	.	A	<X>	0	.	DP=25;I16=17,7,0,0,856,31506,0,0,1241,68635,0,0,437,9903,0,0;QS=3,0;MQSB=0.69242;MQ0F=0	PL:DP:DV	0,39,212:13:0	0,18,139:6:0	0,15,167:5:0
+17	3765	.	C	<X>	0	.	DP=25;I16=17,7,0,0,845,31099,0,0,1218,66404,0,0,436,9750,0,0;QS=3,0;MQSB=0.95083;MQ0F=0	PL:DP:DV	0,39,200:13:0	0,15,129:5:0	0,18,189:6:0
+17	3766	.	A	<X>	0	.	DP=26;I16=17,9,0,0,953,35331,0,0,1338,73604,0,0,462,10340,0,0;QS=3,0;MQSB=0.811273;MQ0F=0	PL:DP:DV	0,42,248:14:0	0,18,158:6:0	0,18,191:6:0
+17	3767	.	A	<X>	0	.	DP=26;I16=17,9,0,0,924,33656,0,0,1338,73604,0,0,464,10328,0,0;QS=3,0;MQSB=0.811273;MQ0F=0	PL:DP:DV	0,42,246:14:0	0,18,148:6:0	0,18,191:6:0
+17	3768	.	A	<X>	0	.	DP=26;I16=17,9,0,0,922,33842,0,0,1338,73604,0,0,466,10340,0,0;QS=3,0;MQSB=0.811273;MQ0F=0	PL:DP:DV	0,42,237:14:0	0,18,146:6:0	0,18,195:6:0
+17	3769	.	T	<X>	0	.	DP=26;I16=17,8,0,0,891,32735,0,0,1278,70004,0,0,461,10327,0,0;QS=3,0;MQSB=0.884621;MQ0F=0	PL:DP:DV	0,42,246:14:0	0,15,144:5:0	0,18,191:6:0
+17	3770	.	C	<X>	0	.	DP=26;I16=17,9,0,0,923,34049,0,0,1338,73604,0,0,470,10436,0,0;QS=3,0;MQSB=0.811273;MQ0F=0	PL:DP:DV	0,42,252:14:0	0,18,142:6:0	0,18,180:6:0
+17	3771	.	T	<X>	0	.	DP=25;I16=16,8,0,0,852,31694,0,0,1218,66404,0,0,464,10438,0,0;QS=3,0;MQSB=0.844324;MQ0F=0	PL:DP:DV	0,42,253:14:0	0,15,140:5:0	0,15,157:5:0
+17	3772	.	A	<X>	0	.	DP=26;I16=16,10,0,0,836,28434,0,0,1338,73604,0,0,476,10624,0,0;QS=3,0;MQSB=0.685145;MQ0F=0	PL:DP:DV	0,42,236:14:0	0,18,122:6:0	0,18,160:6:0
+17	3773	.	C	<X>	0	.	DP=26;I16=16,10,0,0,893,31801,0,0,1338,73604,0,0,480,10752,0,0;QS=3,0;MQSB=0.685145;MQ0F=0	PL:DP:DV	0,42,253:14:0	0,18,140:6:0	0,18,171:6:0
+17	3774	.	T	<X>	0	.	DP=25;I16=15,10,0,0,895,33455,0,0,1278,70004,0,0,485,10903,0,0;QS=3,0;MQSB=0.624282;MQ0F=0	PL:DP:DV	0,42,253:14:0	0,18,129:6:0	0,15,178:5:0
+17	3775	.	C	<X>	0	.	DP=25;I16=15,9,0,0,855,31825,0,0,1241,68635,0,0,477,10883,0,0;QS=3,0;MQSB=0.439649;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,18,147:6:0	0,12,143:4:0
+17	3776	.	T	<X>	0	.	DP=24;I16=15,7,0,0,838,32738,0,0,1152,64194,0,0,457,10375,0,0;QS=3,0;MQSB=0.225079;MQ0F=0	PL:DP:DV	0,39,229:13:0	0,15,149:5:0	0,12,152:4:0
+17	3777	.	C	<X>	0	.	DP=24;I16=15,9,0,0,864,32180,0,0,1218,66404,0,0,492,10998,0,0;QS=3,0;MQSB=0.705785;MQ0F=0	PL:DP:DV	0,39,220:13:0	0,18,160:6:0	0,15,168:5:0
+17	3778	.	T	<X>	0	.	DP=24;I16=14,9,0,0,859,32957,0,0,1208,66304,0,0,468,10372,0,0;QS=3,0;MQSB=0.836049;MQ0F=0	PL:DP:DV	0,36,227:12:0	0,18,157:6:0	0,15,167:5:0
+17	3779	.	G	<X>	0	.	DP=24;I16=15,9,0,0,844,31206,0,0,1218,66404,0,0,493,10971,0,0;QS=3,0;MQSB=0.705785;MQ0F=0	PL:DP:DV	0,39,220:13:0	0,18,152:6:0	0,15,167:5:0
+17	3780	.	C	<X>	0	.	DP=25;I16=14,10,0,0,829,29949,0,0,1268,69904,0,0,467,10295,0,0;QS=3,0;MQSB=0.765017;MQ0F=0	PL:DP:DV	0,39,235:13:0	0,18,144:6:0	0,15,169:5:0
+17	3781	.	C	<X>	0	.	DP=26;I16=16,10,0,0,939,34725,0,0,1315,71373,0,0,492,10896,0,0;QS=3,0;MQSB=0.541994;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,18,139:6:0	0,15,175:5:0
+17	3782	.	T	<X>	0	.	DP=26;I16=16,10,0,0,989,38031,0,0,1315,71373,0,0,493,10901,0,0;QS=3,0;MQSB=0.541994;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,18,169:6:0	0,15,176:5:0
+17	3783	.	C	<X>	0	.	DP=26;I16=16,10,0,0,941,34801,0,0,1315,71373,0,0,492,10836,0,0;QS=3,0;MQSB=0.541994;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,18,155:6:0	0,15,162:5:0
+17	3784	.	T	<X>	0	.	DP=27;I16=16,11,0,0,1001,38035,0,0,1375,74973,0,0,491,10801,0,0;QS=3,0;MQSB=0.467219;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,18,155:6:0	0,15,178:5:0
+17	3785	.	G	<X>	0	.	DP=28;I16=15,10,0,0,922,36426,0,0,1305,71273,0,0,450,9916,0,0;QS=3,0;MQSB=0.674458;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,125:5:0	0,15,179:5:0
+17	3786	.	T	<X>	0	.	DP=28;I16=16,11,0,0,935,35697,0,0,1375,74973,0,0,490,10774,0,0;QS=3,0;MQSB=0.467219;MQ0F=0	PL:DP:DV	0,48,250:16:0	0,18,145:6:0	0,15,186:5:0
+17	3787	.	G	<X>	0	.	DP=28;I16=16,11,0,0,963,37951,0,0,1375,74973,0,0,489,10781,0,0;QS=3,0;MQSB=0.467219;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,18,143:6:0	0,15,177:5:0
+17	3788	.	G	<X>	0	.	DP=26;I16=14,9,0,0,849,33683,0,0,1184,65386,0,0,459,10075,0,0;QS=3,0;MQSB=0.525788;MQ0F=0	PL:DP:DV	0,39,239:13:0	0,18,144:6:0	0,12,161:4:0
+17	3789	.	G	<X>	0	.	DP=26;I16=13,10,0,0,807,31019,0,0,1231,68535,0,0,438,9474,0,0;QS=3,0;MQSB=0.445672;MQ0F=0	PL:DP:DV	0,39,251:13:0	0,18,133:6:0	0,12,161:4:0
+17	3790	.	T	<X>	0	.	DP=26;I16=13,10,0,0,829,32293,0,0,1231,68535,0,0,435,9359,0,0;QS=3,0;MQSB=0.445672;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,18,150:6:0	0,12,159:4:0
+17	3791	.	T	<X>	0	.	DP=26;I16=15,10,0,0,887,34725,0,0,1301,72235,0,0,478,10336,0,0;QS=3,0;MQSB=0.382304;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,18,136:6:0	0,12,159:4:0
+17	3792	.	G	A,<X>	0	.	DP=26;I16=14,8,1,0,809,32805,38,1444,1175,66425,37,1369,417,8991,22,484;QS=2.92629,0.0737052,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.195278;BQB=1;MQ0F=0	PL:DP:DV	0,8,238,42,241,255:15:1	0,12,109,12,109,109:4:0	0,12,157,12,157,157:4:0
+17	3793	.	A	<X>	0	.	DP=26;I16=15,8,0,0,833,33775,0,0,1212,67794,0,0,435,9363,0,0;QS=3,0;MQSB=0.195278;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,12,93:4:0	0,12,159:4:0
+17	3794	.	C	<X>	0	.	DP=26;I16=15,9,0,0,845,33023,0,0,1241,68635,0,0,438,9324,0,0;QS=3,0;MQSB=0.439649;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,15,120:5:0	0,12,157:4:0
+17	3795	.	C	<X>	0	.	DP=26;I16=14,9,0,0,865,35649,0,0,1231,68535,0,0,408,8622,0,0;QS=3,0;MQSB=0.563599;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,132:5:0	0,12,161:4:0
+17	3796	.	T	<X>	0	.	DP=27;I16=15,11,0,0,964,38998,0,0,1361,75835,0,0,453,9821,0,0;QS=3,0;MQSB=0.334895;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,21,149:7:0	0,12,164:4:0
+17	3797	.	A	<X>	0	.	DP=27;I16=15,10,0,0,848,32392,0,0,1301,72235,0,0,424,9172,0,0;QS=3,0;MQSB=0.382304;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,18,124:6:0	0,12,159:4:0
+17	3798	.	T	<X>	0	.	DP=27;I16=14,11,0,0,921,37161,0,0,1301,72235,0,0,430,9554,0,0;QS=3,0;MQSB=0.283586;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,21,148:7:0	0,12,165:4:0
+17	3799	.	T	<X>	0	.	DP=27;I16=15,11,0,0,913,35929,0,0,1361,75835,0,0,439,9729,0,0;QS=3,0;MQSB=0.334895;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,21,150:7:0	0,12,161:4:0
+17	3800	.	C	<X>	0	.	DP=26;I16=13,10,0,0,866,36182,0,0,1181,65035,0,0,406,9092,0,0;QS=3,0;MQSB=0.272532;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,104:5:0	0,12,161:4:0
+17	3801	.	T	<X>	0	.	DP=23;I16=12,10,0,0,804,33600,0,0,1121,61435,0,0,430,9750,0,0;QS=3,0;MQSB=0.217267;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,99:5:0	0,9,133:3:0
+17	3802	.	G	<X>	0	.	DP=22;I16=10,9,0,0,730,30516,0,0,994,54486,0,0,380,8550,0,0;QS=3,0;MQSB=0.472367;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,106:4:0	0,9,130:3:0
+17	3803	.	G	<X>	0	.	DP=22;I16=11,9,0,0,703,27393,0,0,1051,57735,0,0,405,9241,0,0;QS=3,0;MQSB=0.372419;MQ0F=0	PL:DP:DV	0,39,249:13:0	0,12,92:4:0	0,9,129:3:0
+17	3804	.	A	<X>	0	.	DP=22;I16=11,9,0,0,740,30360,0,0,1051,57735,0,0,404,9274,0,0;QS=3,0;MQSB=0.372419;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,98:4:0	0,9,132:3:0
+17	3805	.	C	<X>	0	.	DP=22;I16=12,9,0,0,737,29243,0,0,1061,57835,0,0,428,9950,0,0;QS=3,0;MQSB=0.262932;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,81:4:0	0,9,130:3:0
+17	3806	.	A	<X>	0	.	DP=22;I16=12,9,0,0,798,32550,0,0,1061,57835,0,0,426,9968,0,0;QS=3,0;MQSB=0.262932;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,12,105:4:0	0,9,128:3:0
+17	3807	.	C	<X>	0	.	DP=22;I16=10,9,0,0,664,25304,0,0,994,54486,0,0,377,8885,0,0;QS=3,0;MQSB=0.472367;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,83:4:0	0,9,115:3:0
+17	3808	.	G	<X>	0	.	DP=21;I16=9,9,0,0,653,25297,0,0,957,53117,0,0,375,8873,0,0;QS=3,0;MQSB=0.597145;MQ0F=0	PL:DP:DV	0,33,233:11:0	0,12,109:4:0	0,9,132:3:0
+17	3809	.	T	<X>	0	.	DP=22;I16=11,10,0,0,779,32151,0,0,1084,60066,0,0,416,9810,0,0;QS=3,0;MQSB=0.285029;MQ0F=0	PL:DP:DV	0,39,249:13:0	0,12,115:4:0	0,12,161:4:0
+17	3810	.	C	<X>	0	.	DP=23;I16=9,11,0,0,811,34815,0,0,1077,60317,0,0,369,8739,0,0;QS=3,0;MQSB=0.499893;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,112:4:0	0,12,153:4:0
+17	3811	.	A	C,<X>	0	.	DP=23;I16=9,11,2,0,777,32631,39,785,1077,60317,67,3349,367,8669,42,914;QS=2.94104,0.0589569,0;VDB=0.18;SGB=0.346553;RPB=0.425;MQB=0.25;MQSB=0.246128;BQB=0.025;MQ0F=0	PL:DP:DV	0,15,248,36,254,255:14:2	0,12,116,12,116,116:4:0	0,12,158,12,158,158:4:0
+17	3812	.	T	<X>	0	.	DP=23;I16=10,11,0,0,802,32860,0,0,1084,60066,0,0,405,9447,0,0;QS=3,0;MQSB=0.187115;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,114:4:0	0,12,160:4:0
+17	3813	.	A	<X>	0	.	DP=22;I16=10,11,0,0,815,35077,0,0,1084,60066,0,0,402,9330,0,0;QS=3,0;MQSB=0.187115;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,119:4:0	0,12,170:4:0
+17	3814	.	G	<X>	0	.	DP=21;I16=8,11,0,0,775,33731,0,0,1037,58597,0,0,375,8605,0,0;QS=3,0;MQSB=0.41781;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,113:4:0	0,12,163:4:0
+17	3815	.	A	<X>	0	.	DP=20;I16=8,11,0,0,708,29130,0,0,1010,57328,0,0,397,9049,0,0;QS=3,0;MQSB=0.373354;MQ0F=0	PL:DP:DV	0,33,239:11:0	0,12,110:4:0	0,12,162:4:0
+17	3816	.	A	<X>	0	.	DP=20;I16=8,11,0,0,729,31027,0,0,1010,57328,0,0,395,8933,0,0;QS=3,0;MQSB=0.373354;MQ0F=0	PL:DP:DV	0,33,248:11:0	0,12,104:4:0	0,12,160:4:0
+17	3817	.	A	<X>	0	.	DP=20;I16=8,11,0,0,752,31580,0,0,1010,57328,0,0,393,8833,0,0;QS=3,0;MQSB=0.373354;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,12,110:4:0	0,12,161:4:0
+17	3818	.	T	<X>	0	.	DP=20;I16=8,11,0,0,728,30466,0,0,1010,57328,0,0,391,8749,0,0;QS=3,0;MQSB=0.373354;MQ0F=0	PL:DP:DV	0,33,252:11:0	0,12,115:4:0	0,12,160:4:0
+17	3819	.	A	<X>	0	.	DP=21;I16=9,11,0,0,790,34094,0,0,1039,58169,0,0,389,8681,0,0;QS=3,0;MQSB=0.247381;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,121:4:0	0,12,167:4:0
+17	3820	.	G	<X>	0	.	DP=21;I16=9,11,0,0,788,33636,0,0,1039,58169,0,0,388,8630,0,0;QS=3,0;MQSB=0.247381;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,112:4:0	0,12,157:4:0
+17	3821	.	A	<X>	0	.	DP=22;I16=10,11,0,0,832,35864,0,0,1099,61769,0,0,387,8597,0,0;QS=3,0;MQSB=0.317882;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,115:4:0	0,12,168:4:0
+17	3822	.	G	<X>	0	.	DP=22;I16=10,11,0,0,810,33228,0,0,1099,61769,0,0,386,8532,0,0;QS=3,0;MQSB=0.317882;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,103:4:0	0,12,157:4:0
+17	3823	.	T	<X>	0	.	DP=22;I16=9,11,0,0,753,30705,0,0,1042,58520,0,0,380,8460,0,0;QS=3,0;MQSB=0.434285;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,12,102:4:0	0,12,163:4:0
+17	3824	.	C	<X>	0	.	DP=22;I16=10,11,0,0,802,32368,0,0,1099,61769,0,0,384,8456,0,0;QS=3,0;MQSB=0.317882;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,105:4:0	0,12,159:4:0
+17	3825	.	C	<X>	0	.	DP=23;I16=10,11,0,0,813,33955,0,0,1079,59889,0,0,379,8387,0,0;QS=3,0;MQSB=0.317882;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,130:5:0	0,12,157:4:0
+17	3826	.	T	<X>	0	.	DP=23;I16=11,11,0,0,827,34611,0,0,1136,63138,0,0,381,8357,0,0;QS=3,0;MQSB=0.232836;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,133:5:0	0,12,155:4:0
+17	3827	.	G	<X>	0	.	DP=23;I16=11,10,0,0,820,34130,0,0,1076,59538,0,0,355,7715,0,0;QS=3,0;MQSB=0.269397;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,121:4:0	0,12,162:4:0
+17	3828	.	C	<X>	0	.	DP=23;I16=11,10,0,0,805,33147,0,0,1076,59538,0,0,354,7720,0,0;QS=3,0;MQSB=0.269397;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,12,114:4:0	0,12,157:4:0
+17	3829	.	A	<X>	0	.	DP=22;I16=9,11,0,0,763,31295,0,0,1069,59789,0,0,369,8241,0,0;QS=3,0;MQSB=0.477679;MQ0F=0	PL:DP:DV	0,33,255:11:0	0,15,132:5:0	0,12,158:4:0
+17	3830	.	A	<X>	0	.	DP=23;I16=11,11,0,0,825,32693,0,0,1136,63138,0,0,377,8321,0,0;QS=3,0;MQSB=0.232836;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,15,143:5:0	0,12,150:4:0
+17	3831	.	C	A,<X>	0	.	DP=23;I16=10,11,1,0,802,32198,14,196,1126,63038,10,100,370,8294,7,49;QS=2.97758,0.0224215,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.232836;BQB=1;MQ0F=0	PL:DP:DV	0,27,255,36,255,255:13:1	0,15,134,15,134,134:5:0	0,12,149,12,149,149:4:0
+17	3832	.	A	<X>	0	.	DP=24;I16=12,11,0,0,836,32436,0,0,1196,66738,0,0,377,8389,0,0;QS=3,0;MQSB=0.291845;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,15,136:5:0	0,12,139:4:0
+17	3833	.	C	<X>	0	.	DP=23;I16=10,11,0,0,690,24938,0,0,1076,59538,0,0,377,8409,0,0;QS=3,0;MQSB=0.175325;MQ0F=0	PL:DP:DV	0,36,249:12:0	0,15,113:5:0	0,12,131:4:0
+17	3834	.	G	<X>	0	.	DP=22;I16=9,10,0,0,684,26250,0,0,1037,58597,0,0,357,8079,0,0;QS=3,0;MQSB=0.124514;MQ0F=0	PL:DP:DV	0,33,242:11:0	0,12,122:4:0	0,12,156:4:0
+17	3835	.	T	<X>	0	.	DP=22;I16=10,11,0,0,773,30373,0,0,1076,59538,0,0,381,8475,0,0;QS=3,0;MQSB=0.175325;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,15,140:5:0	0,12,153:4:0
+17	3836	.	G	C,<X>	0	.	DP=24;I16=10,12,1,0,833,33183,14,196,1132,61648,10,100,378,8412,2,4;QS=2.97647,0.0235294,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.251407;BQB=1;MQ0F=0	PL:DP:DV	0,27,255,36,255,255:13:1	0,15,149,15,149,149:5:0	0,15,188,15,188,188:5:0
+17	3837	.	G	<X>	0	.	DP=24;I16=8,14,0,0,759,26931,0,0,1135,61999,0,0,399,8955,0,0;QS=3,0;MQSB=0.291667;MQ0F=0	PL:DP:DV	0,33,245:11:0	0,18,149:6:0	0,15,157:5:0
+17	3838	.	C	<X>	0	.	DP=24;I16=10,14,0,0,817,28975,0,0,1202,65348,0,0,409,8945,0,0;QS=3,0;MQSB=0.122456;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,18,143:6:0	0,15,148:5:0
+17	3839	.	C	<X>	0	.	DP=23;I16=9,13,0,0,688,22248,0,0,1132,61648,0,0,386,8238,0,0;QS=3,0;MQSB=0.248197;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,123:6:0	0,12,112:4:0
+17	3840	.	G	<X>	0	.	DP=23;I16=9,14,0,0,793,27941,0,0,1192,65248,0,0,413,8809,0,0;QS=3,0;MQSB=0.211072;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,160:6:0	0,15,146:5:0
+17	3841	.	T	<X>	0	.	DP=23;I16=9,14,0,0,867,33103,0,0,1192,65248,0,0,414,8734,0,0;QS=3,0;MQSB=0.211072;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,167:6:0	0,15,162:5:0
+17	3842	.	C	<X>	0	.	DP=23;I16=9,14,0,0,890,34728,0,0,1192,65248,0,0,415,8689,0,0;QS=3,0;MQSB=0.211072;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,167:6:0	0,15,159:5:0
+17	3843	.	T	<X>	0	.	DP=24;I16=9,14,0,0,896,35122,0,0,1192,65248,0,0,416,8674,0,0;QS=3,0;MQSB=0.211072;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,164:6:0	0,15,159:5:0
+17	3844	.	G	<X>	0	.	DP=26;I16=10,16,0,0,959,35715,0,0,1372,76048,0,0,442,9314,0,0;QS=3,0;MQSB=0.220358;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,21,177:7:0	0,18,172:6:0
+17	3845	.	T	<X>	0	.	DP=26;I16=10,16,0,0,970,36442,0,0,1372,76048,0,0,444,9310,0,0;QS=3,0;MQSB=0.220358;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,21,186:7:0	0,18,166:6:0
+17	3846	.	G	<X>	0	.	DP=27;I16=10,17,0,0,993,37297,0,0,1432,79648,0,0,446,9338,0,0;QS=3,0;MQSB=0.195223;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,21,175:7:0	0,21,172:7:0
+17	3847	.	T	<X>	0	.	DP=27;I16=10,16,0,0,952,35268,0,0,1372,76048,0,0,423,8723,0,0;QS=3,0;MQSB=0.220358;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,18,170:6:0	0,21,189:7:0
+17	3848	.	C	<X>	0	.	DP=27;I16=10,17,0,0,1025,39533,0,0,1432,79648,0,0,449,9341,0,0;QS=3,0;MQSB=0.195223;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,21,177:7:0	0,21,188:7:0
+17	3849	.	T	<X>	0	.	DP=27;I16=9,17,0,0,987,37685,0,0,1395,78279,0,0,450,9368,0,0;QS=3,0;MQSB=0.282527;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,21,179:7:0	0,21,190:7:0
+17	3850	.	G	<X>	0	.	DP=26;I16=9,17,0,0,957,35751,0,0,1395,78279,0,0,452,9428,0,0;QS=3,0;MQSB=0.282527;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,21,179:7:0	0,21,182:7:0
+17	3851	.	G	<X>	0	.	DP=26;I16=9,17,0,0,965,36475,0,0,1395,78279,0,0,453,9469,0,0;QS=3,0;MQSB=0.282527;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,21,177:7:0	0,21,183:7:0
+17	3852	.	C	<X>	0	.	DP=26;I16=9,16,0,0,921,34525,0,0,1335,74679,0,0,444,9440,0,0;QS=3,0;MQSB=0.310905;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,18,163:6:0	0,21,179:7:0
+17	3853	.	T	<X>	0	.	DP=28;I16=10,18,0,0,1050,40222,0,0,1484,82720,0,0,455,9641,0,0;QS=3,0;MQSB=0.515783;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,21,185:7:0	0,21,192:7:0
+17	3854	.	T	<X>	0	.	DP=28;I16=10,17,0,0,955,34605,0,0,1455,81879,0,0,451,9709,0,0;QS=3,0;MQSB=0.359211;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,18,171:6:0	0,18,178:6:0
+17	3855	.	C	<X>	0	.	DP=29;I16=10,18,0,0,992,36040,0,0,1515,85479,0,0,438,9264,0,0;QS=3,0;MQSB=0.331344;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,15,139:5:0	0,21,175:7:0
+17	3856	.	T	<X>	0	.	DP=30;I16=10,18,0,0,1033,38725,0,0,1546,88238,0,0,464,9982,0,0;QS=3,0;MQSB=0.190183;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,18,163:6:0	0,21,185:7:0
+17	3857	.	C	<X>	0	.	DP=30;I16=10,19,0,0,1077,40979,0,0,1575,89079,0,0,447,9505,0,0;QS=3,0;MQSB=0.306875;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,15,154:5:0	0,24,194:8:0
+17	3858	.	T	<X>	0	.	DP=31;I16=10,21,0,0,1141,42567,0,0,1695,96279,0,0,477,10255,0,0;QS=3,0;MQSB=0.266219;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,18,171:6:0	0,24,208:8:0
+17	3859	.	C	<X>	0	.	DP=32;I16=10,21,0,0,950,30078,0,0,1695,96279,0,0,484,10416,0,0;QS=3,0;MQSB=0.266219;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,18,136:6:0	0,24,156:8:0
+17	3860	.	G	<X>	0	.	DP=32;I16=10,22,0,0,1070,37794,0,0,1755,99879,0,0,516,11240,0,0;QS=3,0;MQSB=0.249261;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,18,154:6:0	0,27,209:9:0
+17	3861	.	C	<X>	0	.	DP=33;I16=11,20,0,0,1133,42547,0,0,1672,94048,0,0,517,11391,0,0;QS=3,0;MQSB=0.19205;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,18,162:6:0	0,24,199:8:0
+17	3862	.	T	<X>	0	.	DP=34;I16=11,22,0,0,1241,47443,0,0,1792,101248,0,0,526,11518,0,0;QS=3,0;MQSB=0.161533;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,21,185:7:0	0,27,221:9:0
+17	3863	.	T	<X>	0	.	DP=34;I16=12,22,0,0,1200,43542,0,0,1852,104848,0,0,541,11685,0,0;QS=3,0;MQSB=0.210327;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,21,199:7:0	0,27,213:9:0
+17	3864	.	A	<X>	0	.	DP=33;I16=11,22,0,0,1238,47448,0,0,1792,101248,0,0,550,11790,0,0;QS=3,0;MQSB=0.161533;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,21,210:7:0	0,27,230:9:0
+17	3865	.	G	<X>	0	.	DP=34;I16=11,23,0,0,1251,47113,0,0,1852,104848,0,0,559,11933,0,0;QS=3,0;MQSB=0.149071;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,21,200:7:0	0,27,212:9:0
+17	3866	.	C	<X>	0	.	DP=33;I16=11,21,0,0,1165,43545,0,0,1732,97648,0,0,545,11489,0,0;QS=3,0;MQSB=0.175751;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,21,189:7:0	0,24,197:8:0
+17	3867	.	A	<X>	0	.	DP=33;I16=11,22,0,0,1152,41510,0,0,1792,101248,0,0,580,12284,0,0;QS=3,0;MQSB=0.161533;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,21,188:7:0	0,27,195:9:0
+17	3868	.	T	<X>	0	.	DP=33;I16=11,22,0,0,1255,48141,0,0,1792,101248,0,0,590,12494,0,0;QS=3,0;MQSB=0.161533;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,21,202:7:0	0,27,221:9:0
+17	3869	.	C	<X>	0	.	DP=33;I16=11,21,0,0,1169,43987,0,0,1732,97648,0,0,589,12623,0,0;QS=3,0;MQSB=0.175751;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,18,164:6:0	0,27,211:9:0
+17	3870	.	T	<X>	0	.	DP=34;I16=11,23,0,0,1262,47808,0,0,1852,104848,0,0,608,12932,0,0;QS=3,0;MQSB=0.149071;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,24,215:8:0	0,27,211:9:0
+17	3871	.	T	<X>	0	.	DP=36;I16=11,25,0,0,1341,50655,0,0,1972,112048,0,0,617,13157,0,0;QS=3,0;MQSB=0.128391;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,24,221:8:0	0,27,223:9:0
+17	3872	.	G	<X>	0	.	DP=36;I16=11,25,0,0,1287,47095,0,0,1972,112048,0,0,626,13322,0,0;QS=3,0;MQSB=0.128391;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,24,211:8:0	0,27,200:9:0
+17	3873	.	T	<X>	0	.	DP=35;I16=10,24,0,0,1242,46680,0,0,1852,104848,0,0,626,13428,0,0;QS=3,0;MQSB=0.0982034;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,21,194:7:0	0,24,212:8:0
+17	3874	.	T	<X>	0	.	DP=36;I16=12,24,0,0,1290,47660,0,0,1972,112048,0,0,646,13774,0,0;QS=3,0;MQSB=0.182088;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,24,228:8:0	0,24,204:8:0
+17	3875	.	T	<X>	0	.	DP=37;I16=13,24,0,0,1324,48418,0,0,2029,115297,0,0,657,14061,0,0;QS=3,0;MQSB=0.117872;MQ0F=0	PL:DP:DV	0,63,255:21:0	0,24,231:8:0	0,24,197:8:0
+17	3876	.	C	<X>	0	.	DP=37;I16=13,22,0,0,1248,45354,0,0,1909,108097,0,0,623,13325,0,0;QS=3,0;MQSB=0.140806;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,21,196:7:0	0,24,180:8:0
+17	3877	.	C	<X>	0	.	DP=37;I16=13,24,0,0,1363,51201,0,0,2029,115297,0,0,681,14765,0,0;QS=3,0;MQSB=0.117872;MQ0F=0	PL:DP:DV	0,63,255:21:0	0,24,217:8:0	0,24,196:8:0
+17	3878	.	A	<X>	0	.	DP=37;I16=13,23,0,0,1309,48045,0,0,1969,111697,0,0,670,14654,0,0;QS=3,0;MQSB=0.128568;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,24,218:8:0	0,24,188:8:0
+17	3879	.	A	<X>	0	.	DP=38;I16=14,24,0,0,1453,56567,0,0,2066,116666,0,0,703,15543,0,0;QS=3,0;MQSB=0.076112;MQ0F=0	PL:DP:DV	0,66,255:22:0	0,24,226:8:0	0,24,206:8:0
+17	3880	.	G	<X>	0	.	DP=37;I16=14,22,0,0,1311,48735,0,0,1946,109466,0,0,689,15267,0,0;QS=3,0;MQSB=0.094094;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,24,209:8:0	0,24,183:8:0
+17	3881	.	G	<X>	0	.	DP=37;I16=14,21,0,0,1200,42778,0,0,1886,105866,0,0,690,15578,0,0;QS=3,0;MQSB=0.105399;MQ0F=0	PL:DP:DV	0,63,255:21:0	0,18,178:6:0	0,24,174:8:0
+17	3882	.	T	<X>	0	.	DP=37;I16=14,21,0,0,1192,42352,0,0,1886,105866,0,0,684,15348,0,0;QS=3,0;MQSB=0.105399;MQ0F=0	PL:DP:DV	0,63,255:21:0	0,21,189:7:0	0,21,178:7:0
+17	3883	.	C	<X>	0	.	DP=38;I16=15,22,0,0,1295,46659,0,0,2006,113066,0,0,717,16279,0,0;QS=3,0;MQSB=0.124405;MQ0F=0	PL:DP:DV	0,63,255:21:0	0,24,205:8:0	0,24,171:8:0
+17	3884	.	C	<X>	0	.	DP=39;I16=16,23,0,0,1363,49387,0,0,2103,118035,0,0,749,17141,0,0;QS=3,0;MQSB=0.0760633;MQ0F=0	PL:DP:DV	0,66,255:22:0	0,24,202:8:0	0,27,212:9:0
+17	3885	.	T	<X>	0	.	DP=40;I16=16,24,0,0,1445,53663,0,0,2163,121635,0,0,754,17262,0,0;QS=3,0;MQSB=0.0679472;MQ0F=0	PL:DP:DV	0,69,255:23:0	0,24,219:8:0	0,27,214:9:0
+17	3886	.	C	<X>	0	.	DP=39;I16=16,23,0,0,1370,49762,0,0,2103,118035,0,0,761,17421,0,0;QS=3,0;MQSB=0.0760633;MQ0F=0	PL:DP:DV	0,69,255:23:0	0,24,199:8:0	0,24,191:8:0
+17	3887	.	C	<X>	0	.	DP=39;I16=16,23,0,0,1364,49222,0,0,2103,118035,0,0,767,17567,0,0;QS=3,0;MQSB=0.0760633;MQ0F=0	PL:DP:DV	0,69,255:23:0	0,24,194:8:0	0,24,201:8:0
+17	3888	.	C	<X>	0	.	DP=39;I16=15,23,0,0,1387,51885,0,0,2043,114435,0,0,747,17073,0,0;QS=3,0;MQSB=0.0555905;MQ0F=0	PL:DP:DV	0,66,255:22:0	0,24,195:8:0	0,24,208:8:0
+17	3889	.	A	<X>	0	.	DP=38;I16=15,23,0,0,1364,49918,0,0,2066,116666,0,0,777,17811,0,0;QS=3,0;MQSB=0.112471;MQ0F=0	PL:DP:DV	0,66,255:22:0	0,24,202:8:0	0,24,218:8:0
+17	3890	.	C	<X>	0	.	DP=38;I16=14,23,0,0,1362,51064,0,0,2006,113066,0,0,757,17329,0,0;QS=3,0;MQSB=0.0844255;MQ0F=0	PL:DP:DV	0,63,255:21:0	0,24,203:8:0	0,24,216:8:0
+17	3891	.	A	<X>	0	.	DP=39;I16=15,24,0,0,1466,56312,0,0,2126,120266,0,0,786,18076,0,0;QS=3,0;MQSB=0.102114;MQ0F=0	PL:DP:DV	0,66,255:22:0	0,24,203:8:0	0,27,239:9:0
+17	3892	.	G	<X>	0	.	DP=38;I16=15,23,0,0,1340,48838,0,0,2066,116666,0,0,792,18226,0,0;QS=3,0;MQSB=0.112471;MQ0F=0	PL:DP:DV	0,63,255:21:0	0,24,186:8:0	0,27,208:9:0
+17	3893	.	T	<X>	0	.	DP=39;I16=15,24,0,0,1348,48170,0,0,2126,120266,0,0,798,18404,0,0;QS=3,0;MQSB=0.102114;MQ0F=0	PL:DP:DV	0,66,255:22:0	0,24,196:8:0	0,27,212:9:0
+17	3894	.	G	<X>	0	.	DP=39;I16=15,23,0,0,1364,49900,0,0,2066,116666,0,0,779,17937,0,0;QS=3,0;MQSB=0.112471;MQ0F=0	PL:DP:DV	0,63,255:21:0	0,24,202:8:0	0,27,208:9:0
+17	3895	.	T	<X>	0	.	DP=39;I16=15,24,0,0,1375,49773,0,0,2126,120266,0,0,810,18752,0,0;QS=3,0;MQSB=0.102114;MQ0F=0	PL:DP:DV	0,66,255:22:0	0,24,202:8:0	0,27,225:9:0
+17	3896	.	A	<X>	0	.	DP=40;I16=15,24,0,0,1468,57326,0,0,2126,120266,0,0,815,18923,0,0;QS=3,0;MQSB=0.102114;MQ0F=0	PL:DP:DV	0,66,255:22:0	0,24,224:8:0	0,27,233:9:0
+17	3897	.	G	<X>	0	.	DP=40;I16=15,24,0,0,1468,56812,0,0,2126,120266,0,0,819,19021,0,0;QS=3,0;MQSB=0.102114;MQ0F=0	PL:DP:DV	0,66,255:22:0	0,21,199:7:0	0,30,234:10:0
+17	3898	.	C	<X>	0	.	DP=40;I16=15,23,0,0,1487,59351,0,0,2066,116666,0,0,813,19023,0,0;QS=3,0;MQSB=0.112471;MQ0F=0	PL:DP:DV	0,66,255:22:0	0,18,186:6:0	0,30,238:10:0
+17	3899	.	A	<X>	0	.	DP=40;I16=15,24,0,0,1449,55055,0,0,2126,120266,0,0,829,19293,0,0;QS=3,0;MQSB=0.102114;MQ0F=0	PL:DP:DV	0,66,255:22:0	0,21,191:7:0	0,30,231:10:0
+17	3900	.	T	<X>	0	.	DP=40;I16=15,24,0,0,1458,55516,0,0,2126,120266,0,0,833,19417,0,0;QS=3,0;MQSB=0.102114;MQ0F=0	PL:DP:DV	0,66,255:22:0	0,21,197:7:0	0,30,240:10:0
+17	3901	.	G	<X>	0	.	DP=40;I16=14,22,0,0,1303,48245,0,0,1969,111697,0,0,761,17639,0,0;QS=3,0;MQSB=0.180757;MQ0F=0	PL:DP:DV	0,63,255:21:0	0,18,154:6:0	0,27,218:9:0
+17	3902	.	C	<X>	0	.	DP=40;I16=15,24,0,0,1436,55412,0,0,2126,120266,0,0,837,19537,0,0;QS=3,0;MQSB=0.102114;MQ0F=0	PL:DP:DV	0,66,255:22:0	0,21,166:7:0	0,30,217:10:0
+17	3903	.	A	<X>	0	.	DP=42;I16=15,24,0,0,1299,45567,0,0,2089,117417,0,0,814,19008,0,0;QS=3,0;MQSB=0.0901152;MQ0F=0	PL:DP:DV	0,63,255:21:0	0,24,175:8:0	0,30,204:10:0
+17	3904	.	C	<X>	0	.	DP=42;I16=15,24,0,0,1439,54545,0,0,2086,117066,0,0,815,19113,0,0;QS=3,0;MQSB=0.0426917;MQ0F=0	PL:DP:DV	0,63,255:21:0	0,24,191:8:0	0,30,244:10:0
+17	3905	.	C	<X>	0	.	DP=42;I16=15,25,0,0,1572,63314,0,0,2146,120666,0,0,822,19192,0,0;QS=3,0;MQSB=0.0381122;MQ0F=0	PL:DP:DV	0,63,255:21:0	0,24,212:8:0	0,33,255:11:0
+17	3906	.	T	<X>	0	.	DP=42;I16=16,25,0,0,1593,63039,0,0,2206,124266,0,0,846,19758,0,0;QS=3,0;MQSB=0.0536599;MQ0F=0	PL:DP:DV	0,66,255:22:0	0,24,210:8:0	0,33,253:11:0
+17	3907	.	G	<X>	0	.	DP=42;I16=16,25,0,0,1558,60192,0,0,2206,124266,0,0,846,19776,0,0;QS=3,0;MQSB=0.0536599;MQ0F=0	PL:DP:DV	0,66,255:22:0	0,24,203:8:0	0,33,249:11:0
+17	3908	.	C	<X>	0	.	DP=42;I16=16,25,0,0,1514,58968,0,0,2206,124266,0,0,845,19777,0,0;QS=3,0;MQSB=0.0536599;MQ0F=0	PL:DP:DV	0,66,255:22:0	0,24,193:8:0	0,33,244:11:0
+17	3909	.	T	<X>	0	.	DP=43;I16=16,25,0,0,1491,55895,0,0,2201,123691,0,0,835,19697,0,0;QS=3,0;MQSB=0.0757469;MQ0F=0	PL:DP:DV	0,69,255:23:0	0,24,202:8:0	0,30,237:10:0
+17	3910	.	A	<X>	0	.	DP=40;I16=16,23,0,0,1432,53926,0,0,2081,116491,0,0,844,19724,0,0;QS=3,0;MQSB=0.0949554;MQ0F=0	PL:DP:DV	0,66,255:22:0	0,21,193:7:0	0,30,224:10:0
+17	3911	.	C	<X>	0	.	DP=40;I16=16,23,0,0,1440,55290,0,0,2081,116491,0,0,843,19613,0,0;QS=3,0;MQSB=0.0949554;MQ0F=0	PL:DP:DV	0,66,255:22:0	0,21,184:7:0	0,30,214:10:0
+17	3912	.	A	C,<X>	0	.	DP=41;I16=17,22,0,1,1358,49508,16,256,2081,116491,60,3600,830,19358,11,121;QS=2.95181,0.0481928,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.125266;BQB=1;MQ0F=0	PL:DP:DV	0,69,255,69,255,255:23:0	0,21,166,21,166,166:7:0	0,14,202,27,205,208:10:1
+17	3913	.	C	<X>	0	.	DP=40;I16=16,23,0,0,1494,59096,0,0,2081,116491,0,0,824,19100,0,0;QS=3,0;MQSB=0.0949554;MQ0F=0	PL:DP:DV	0,66,255:22:0	0,21,183:7:0	0,30,234:10:0
+17	3914	.	T	<X>	0	.	DP=42;I16=16,24,0,0,1512,59342,0,0,2141,120091,0,0,823,19007,0,0;QS=3,0;MQSB=0.0846181;MQ0F=0	PL:DP:DV	0,69,255:23:0	0,21,192:7:0	0,30,228:10:0
+17	3915	.	C	<X>	0	.	DP=42;I16=16,24,0,0,1537,60953,0,0,2141,120091,0,0,799,18321,0,0;QS=3,0;MQSB=0.0846181;MQ0F=0	PL:DP:DV	0,72,255:24:0	0,18,176:6:0	0,30,229:10:0
+17	3916	.	C	<X>	0	.	DP=42;I16=16,25,0,0,1618,66342,0,0,2201,123691,0,0,825,18919,0,0;QS=3,0;MQSB=0.0757469;MQ0F=0	PL:DP:DV	0,72,255:24:0	0,21,190:7:0	0,30,251:10:0
+17	3917	.	T	<X>	0	.	DP=43;I16=16,25,0,0,1601,65219,0,0,2201,123691,0,0,825,18875,0,0;QS=3,0;MQSB=0.0757469;MQ0F=0	PL:DP:DV	0,72,255:24:0	0,21,191:7:0	0,30,254:10:0
+17	3918	.	T	<X>	0	.	DP=43;I16=16,25,0,0,1541,60711,0,0,2201,123691,0,0,801,18239,0,0;QS=3,0;MQSB=0.0757469;MQ0F=0	PL:DP:DV	0,75,255:25:0	0,18,179:6:0	0,30,254:10:0
+17	3919	.	C	<X>	0	.	DP=42;I16=15,26,0,0,1621,66337,0,0,2232,126450,0,0,826,18786,0,0;QS=3,0;MQSB=0.110793;MQ0F=0	PL:DP:DV	0,72,255:24:0	0,21,200:7:0	0,30,242:10:0
+17	3920	.	T	<X>	0	.	DP=42;I16=15,26,0,0,1605,64327,0,0,2232,126450,0,0,825,18691,0,0;QS=3,0;MQSB=0.110793;MQ0F=0	PL:DP:DV	0,72,255:24:0	0,21,207:7:0	0,30,251:10:0
+17	3921	.	T	<X>	0	.	DP=42;I16=15,26,0,0,1519,58507,0,0,2232,126450,0,0,824,18630,0,0;QS=3,0;MQSB=0.110793;MQ0F=0	PL:DP:DV	0,72,255:24:0	0,21,201:7:0	0,30,242:10:0
+17	3922	.	A	<X>	0	.	DP=42;I16=14,26,0,0,1539,61289,0,0,2195,125081,0,0,819,18545,0,0;QS=3,0;MQSB=0.168991;MQ0F=0	PL:DP:DV	0,72,255:24:0	0,18,179:6:0	0,30,244:10:0
+17	3923	.	G	<X>	0	.	DP=41;I16=14,25,0,0,1515,60945,0,0,2135,121481,0,0,792,17834,0,0;QS=3,0;MQSB=0.182501;MQ0F=0	PL:DP:DV	0,69,255:23:0	0,18,172:6:0	0,30,240:10:0
+17	3924	.	G	<X>	0	.	DP=41;I16=13,26,0,0,1524,61106,0,0,2135,121481,0,0,808,18356,0,0;QS=3,0;MQSB=0.128469;MQ0F=0	PL:DP:DV	0,69,255:23:0	0,18,158:6:0	0,30,247:10:0
+17	3925	.	G	<X>	0	.	DP=41;I16=14,25,0,0,1425,55687,0,0,2135,121481,0,0,788,17758,0,0;QS=3,0;MQSB=0.182501;MQ0F=0	PL:DP:DV	0,72,255:24:0	0,15,134:5:0	0,30,245:10:0
+17	3926	.	C	<X>	0	.	DP=41;I16=14,26,0,0,1512,59674,0,0,2195,125081,0,0,811,18393,0,0;QS=3,0;MQSB=0.168991;MQ0F=0	PL:DP:DV	0,72,255:24:0	0,18,152:6:0	0,30,237:10:0
+17	3927	.	T	<X>	0	.	DP=41;I16=14,26,0,0,1512,59566,0,0,2195,125081,0,0,808,18384,0,0;QS=3,0;MQSB=0.168991;MQ0F=0	PL:DP:DV	0,72,255:24:0	0,18,160:6:0	0,30,237:10:0
+17	3928	.	G	<X>	0	.	DP=41;I16=14,25,0,0,1479,58495,0,0,2135,121481,0,0,779,17731,0,0;QS=3,0;MQSB=0.182501;MQ0F=0	PL:DP:DV	0,72,255:24:0	0,18,149:6:0	0,27,233:9:0
+17	3929	.	A	<X>	0	.	DP=41;I16=13,26,0,0,1452,56436,0,0,2135,121481,0,0,796,18256,0,0;QS=3,0;MQSB=0.128469;MQ0F=0	PL:DP:DV	0,69,255:23:0	0,18,161:6:0	0,30,220:10:0
+17	3930	.	T	<X>	0	.	DP=40;I16=13,25,0,0,1387,52929,0,0,2078,118232,0,0,767,17521,0,0;QS=3,0;MQSB=0.25797;MQ0F=0	PL:DP:DV	0,69,255:23:0	0,15,149:5:0	0,30,224:10:0
+17	3931	.	A	<X>	0	.	DP=40;I16=13,25,0,0,1387,52877,0,0,2078,118232,0,0,761,17439,0,0;QS=3,0;MQSB=0.25797;MQ0F=0	PL:DP:DV	0,69,255:23:0	0,18,166:6:0	0,27,222:9:0
+17	3932	.	T	<X>	0	.	DP=39;I16=12,26,0,0,1394,53644,0,0,2078,118232,0,0,780,17964,0,0;QS=3,0;MQSB=0.190372;MQ0F=0	PL:DP:DV	0,66,255:22:0	0,18,161:6:0	0,30,231:10:0
+17	3933	.	T	<X>	0	.	DP=38;I16=12,24,0,0,1389,54743,0,0,1958,111032,0,0,752,17366,0,0;QS=3,0;MQSB=0.218161;MQ0F=0	PL:DP:DV	0,66,255:22:0	0,18,166:6:0	0,24,220:8:0
+17	3934	.	C	<X>	0	.	DP=38;I16=12,25,0,0,1395,54915,0,0,2018,114632,0,0,768,17758,0,0;QS=3,0;MQSB=0.203497;MQ0F=0	PL:DP:DV	0,66,255:22:0	0,18,152:6:0	0,27,209:9:0
+17	3935	.	C	<X>	0	.	DP=38;I16=12,24,0,0,1239,44621,0,0,1958,111032,0,0,737,17075,0,0;QS=3,0;MQSB=0.218161;MQ0F=0	PL:DP:DV	0,66,255:22:0	0,15,134:5:0	0,27,170:9:0
+17	3936	.	A	G,<X>	0	.	DP=37;I16=5,6,6,17,424,16384,801,30271,609,34563,1314,77018,225,5325,511,11851;QS=0.87994,2.12006,0;VDB=0.0574114;SGB=-4.60123;RPB=0.741697;MQB=0.812605;MQSB=0.143788;BQB=0.883831;MQ0F=0	PL:DP:DV	233,0,206,255,239,255:20:11	77,0,58,83,70,141:6:4	196,24,0,196,24,196:8:8
+17	3937	.	C	<X>	0	.	DP=36;I16=11,24,0,0,1155,39875,0,0,1952,112422,0,0,745,17291,0,0;QS=3,0;MQSB=0.219636;MQ0F=0	PL:DP:DV	0,63,255:21:0	0,18,143:6:0	0,24,156:8:0
+17	3938	.	G	<X>	0	.	DP=35;I16=11,23,0,0,1155,41761,0,0,1892,108822,0,0,737,17079,0,0;QS=3,0;MQSB=0.231054;MQ0F=0	PL:DP:DV	0,63,255:21:0	0,15,119:5:0	0,24,176:8:0
+17	3939	.	C	<X>	0	.	DP=35;I16=11,22,0,0,1273,50651,0,0,1832,105222,0,0,703,16221,0,0;QS=3,0;MQSB=0.243713;MQ0F=0	PL:DP:DV	0,63,255:21:0	0,15,135:5:0	0,21,174:7:0
+17	3940	.	A	<X>	0	.	DP=35;I16=11,22,0,0,1148,42754,0,0,1832,105222,0,0,691,15867,0,0;QS=3,0;MQSB=0.243713;MQ0F=0	PL:DP:DV	0,63,255:21:0	0,15,117:5:0	0,21,163:7:0
+17	3941	.	C	<X>	0	.	DP=35;I16=11,22,0,0,1216,47488,0,0,1832,105222,0,0,688,15892,0,0;QS=3,0;MQSB=0.243713;MQ0F=0	PL:DP:DV	0,63,255:21:0	0,15,133:5:0	0,21,181:7:0
+17	3942	.	C	<X>	0	.	DP=35;I16=11,23,0,0,1336,54166,0,0,1892,108822,0,0,690,15772,0,0;QS=3,0;MQSB=0.231054;MQ0F=0	PL:DP:DV	0,63,255:21:0	0,15,140:5:0	0,24,195:8:0
+17	3943	.	T	<X>	0	.	DP=35;I16=11,23,0,0,1296,51618,0,0,1892,108822,0,0,676,15406,0,0;QS=3,0;MQSB=0.231054;MQ0F=0	PL:DP:DV	0,63,255:21:0	0,15,142:5:0	0,24,195:8:0
+17	3944	.	G	<X>	0	.	DP=34;I16=10,22,0,0,1199,46445,0,0,1803,104381,0,0,654,14954,0,0;QS=3,0;MQSB=0.1117;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,15,149:5:0	0,24,195:8:0
+17	3945	.	C	<X>	0	.	DP=33;I16=10,22,0,0,1256,51226,0,0,1772,101622,0,0,649,14657,0,0;QS=3,0;MQSB=0.187579;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,15,142:5:0	0,21,177:7:0
+17	3946	.	T	<X>	0	.	DP=33;I16=10,21,0,0,1170,45884,0,0,1712,98022,0,0,609,13599,0,0;QS=3,0;MQSB=0.199344;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,15,144:5:0	0,18,158:6:0
+17	3947	.	A	<X>	0	.	DP=32;I16=10,21,0,0,1094,41048,0,0,1712,98022,0,0,620,13820,0,0;QS=3,0;MQSB=0.199344;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,15,128:5:0	0,18,149:6:0
+17	3948	.	C	<X>	0	.	DP=32;I16=10,20,0,0,1134,45104,0,0,1652,94422,0,0,596,13344,0,0;QS=3,0;MQSB=0.212591;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,12,105:4:0	0,18,155:6:0
+17	3949	.	A	C,<X>	0	.	DP=32;I16=10,17,0,1,1027,39909,24,576,1472,83622,60,3600,541,12211,25,625;QS=2.85093,0.149068,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.244621;BQB=1;MQ0F=0	PL:DP:DV	0,60,255,60,255,255:20:0	0,9,89,9,89,89:3:0	9,0,107,21,110,124:5:1
+17	3950	.	C	<X>	0	.	DP=33;I16=11,21,0,0,1191,46247,0,0,1772,101622,0,0,576,12680,0,0;QS=3,0;MQSB=0.257801;MQ0F=0	PL:DP:DV	0,63,255:21:0	0,15,118:5:0	0,18,168:6:0
+17	3951	.	T	<X>	0	.	DP=34;I16=12,19,0,0,1148,44272,0,0,1712,98022,0,0,530,11670,0,0;QS=3,0;MQSB=0.354733;MQ0F=0	PL:DP:DV	0,63,255:21:0	0,15,146:5:0	0,15,152:5:0
+17	3952	.	C	<X>	0	.	DP=35;I16=13,20,0,0,1176,43762,0,0,1832,105222,0,0,545,12025,0,0;QS=3,0;MQSB=0.394875;MQ0F=0	PL:DP:DV	0,66,255:22:0	0,18,158:6:0	0,15,143:5:0
+17	3953	.	C	<X>	0	.	DP=34;I16=13,20,0,0,1246,48436,0,0,1863,107981,0,0,538,11772,0,0;QS=3,0;MQSB=0.252983;MQ0F=0	PL:DP:DV	0,63,255:21:0	0,18,163:6:0	0,18,168:6:0
+17	3954	.	T	<X>	0	.	DP=33;I16=13,19,0,0,1195,45815,0,0,1803,104381,0,0,526,11438,0,0;QS=3,0;MQSB=0.264585;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,18,171:6:0	0,18,167:6:0
+17	3955	.	T	<X>	0	.	DP=32;I16=13,18,0,0,1180,46092,0,0,1743,100781,0,0,515,11139,0,0;QS=3,0;MQSB=0.277468;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,18,173:6:0	0,18,174:6:0
+17	3956	.	C	<X>	0	.	DP=32;I16=13,18,0,0,1181,47021,0,0,1743,100781,0,0,504,10874,0,0;QS=3,0;MQSB=0.277468;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,18,167:6:0	0,18,167:6:0
+17	3957	.	T	<X>	0	.	DP=31;I16=13,17,0,0,1153,46051,0,0,1683,97181,0,0,494,10642,0,0;QS=3,0;MQSB=0.291833;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,18,161:6:0	0,15,162:5:0
+17	3958	.	T	<X>	0	.	DP=31;I16=13,16,0,0,1070,40600,0,0,1623,93581,0,0,483,10393,0,0;QS=3,0;MQSB=0.307929;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,15,139:5:0	0,15,157:5:0
+17	3959	.	A	<X>	0	.	DP=30;I16=14,15,0,0,1062,39758,0,0,1623,93581,0,0,474,10176,0,0;QS=3,0;MQSB=0.377103;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,12,118:4:0	0,15,154:5:0
+17	3960	.	T	<X>	0	.	DP=30;I16=14,15,0,0,995,36027,0,0,1623,93581,0,0,464,9892,0,0;QS=3,0;MQSB=0.377103;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,12,105:4:0	0,15,142:5:0
+17	3961	.	G	<X>	0	.	DP=29;I16=12,16,0,0,1067,40899,0,0,1586,92212,0,0,457,9739,0,0;QS=3,0;MQSB=0.455864;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,12,114:4:0	0,12,122:4:0
+17	3962	.	G	<X>	0	.	DP=29;I16=13,16,0,0,1025,37125,0,0,1623,93581,0,0,471,10053,0,0;QS=3,0;MQSB=0.307929;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,12,108:4:0	0,15,144:5:0
+17	3963	.	C	<X>	0	.	DP=28;I16=13,15,0,0,1040,39100,0,0,1563,89981,0,0,463,9871,0,0;QS=3,0;MQSB=0.326055;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,12,111:4:0	0,12,126:4:0
+17	3964	.	T	<X>	0	.	DP=27;I16=12,15,0,0,1036,39928,0,0,1503,86381,0,0,456,9720,0,0;QS=3,0;MQSB=0.273507;MQ0F=0	PL:DP:DV	0,60,255:20:0	0,9,94:3:0	0,12,133:4:0
+17	3965	.	G	<X>	0	.	DP=26;I16=12,14,0,0,993,38165,0,0,1443,82781,0,0,450,9598,0,0;QS=3,0;MQSB=0.29215;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,9,92:3:0	0,12,134:4:0
+17	3966	.	A	<X>	0	.	DP=26;I16=12,13,0,0,930,34834,0,0,1406,81412,0,0,432,9310,0,0;QS=3,0;MQSB=0.520812;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,9,90:3:0	0,12,140:4:0
+17	3967	.	T	<X>	0	.	DP=26;I16=12,13,0,0,900,32830,0,0,1406,81412,0,0,421,9001,0,0;QS=3,0;MQSB=0.520812;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,9,90:3:0	0,9,100:3:0
+17	3968	.	A	<X>	0	.	DP=25;I16=12,13,0,0,885,31773,0,0,1406,81412,0,0,415,8853,0,0;QS=3,0;MQSB=0.520812;MQ0F=0	PL:DP:DV	0,57,255:19:0	0,9,90:3:0	0,9,99:3:0
+17	3969	.	T	<X>	0	.	DP=24;I16=11,13,0,0,886,32972,0,0,1369,80043,0,0,410,8736,0,0;QS=3,0;MQSB=0.702671;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,9,85:3:0	0,9,108:3:0
+17	3970	.	T	<X>	0	.	DP=24;I16=11,13,0,0,861,31313,0,0,1369,80043,0,0,405,8649,0,0;QS=3,0;MQSB=0.702671;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,9,83:3:0	0,9,104:3:0
+17	3971	.	C	<X>	0	.	DP=22;I16=11,11,0,0,815,30625,0,0,1249,72843,0,0,402,8590,0,0;QS=3,0;MQSB=0.751921;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,6,57:2:0	0,9,103:3:0
+17	3972	.	C	<X>	0	.	DP=22;I16=11,11,0,0,812,30486,0,0,1249,72843,0,0,399,8557,0,0;QS=3,0;MQSB=0.751921;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,6,55:2:0	0,9,96:3:0
+17	3973	.	A	<X>	0	.	DP=22;I16=11,11,0,0,795,28873,0,0,1249,72843,0,0,395,8501,0,0;QS=3,0;MQSB=0.751921;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,6,52:2:0	0,9,97:3:0
+17	3974	.	C	<X>	0	.	DP=22;I16=11,11,0,0,729,24447,0,0,1249,72843,0,0,392,8472,0,0;QS=3,0;MQSB=0.751921;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,6,55:2:0	0,9,78:3:0
+17	3975	.	G	<X>	0	.	DP=22;I16=11,11,0,0,717,24525,0,0,1249,72843,0,0,390,8470,0,0;QS=3,0;MQSB=0.751921;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,6,46:2:0	0,9,96:3:0
+17	3976	.	C	<X>	0	.	DP=22;I16=11,11,0,0,816,30652,0,0,1249,72843,0,0,387,8445,0,0;QS=3,0;MQSB=0.751921;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,6,55:2:0	0,9,97:3:0
+17	3977	.	A	<X>	0	.	DP=23;I16=11,11,0,0,740,25384,0,0,1249,72843,0,0,382,8346,0,0;QS=3,0;MQSB=0.751921;MQ0F=0	PL:DP:DV	0,51,255:17:0	0,6,48:2:0	0,9,90:3:0
+17	3978	.	C	<X>	0	.	DP=23;I16=11,12,0,0,769,26631,0,0,1309,76443,0,0,377,8223,0,0;QS=3,0;MQSB=0.726094;MQ0F=0	PL:DP:DV	0,54,255:18:0	0,6,47:2:0	0,9,103:3:0
+17	3979	.	C	<X>	0	.	DP=21;I16=9,11,0,0,744,28160,0,0,1152,67874,0,0,361,7905,0,0;QS=3,0;MQSB=0.885207;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,6,51:2:0	0,9,104:3:0
+17	3980	.	T	<X>	0	.	DP=21;I16=10,11,0,0,756,27872,0,0,1212,71474,0,0,367,7855,0,0;QS=3,0;MQSB=0.914611;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,51:2:0	0,9,98:3:0
+17	3981	.	G	<X>	0	.	DP=21;I16=10,11,0,0,785,29641,0,0,1212,71474,0,0,362,7710,0,0;QS=3,0;MQSB=0.914611;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,50:2:0	0,9,93:3:0
+17	3982	.	C	<X>	0	.	DP=21;I16=10,11,0,0,779,29495,0,0,1212,71474,0,0,357,7591,0,0;QS=3,0;MQSB=0.914611;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,55:2:0	0,9,97:3:0
+17	3983	.	T	<X>	0	.	DP=20;I16=9,11,0,0,720,26274,0,0,1155,68225,0,0,353,7497,0,0;QS=3,0;MQSB=0.993528;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,6,57:2:0	0,9,93:3:0
+17	3984	.	A	<X>	0	.	DP=21;I16=10,11,0,0,739,26279,0,0,1192,69594,0,0,348,7378,0,0;QS=3,0;MQSB=0.885602;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,53:2:0	0,9,80:3:0
+17	3985	.	C	<X>	0	.	DP=20;I16=10,10,0,0,728,26998,0,0,1132,65994,0,0,344,7234,0,0;QS=3,0;MQSB=0.902256;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,6,55:2:0	0,9,91:3:0
+17	3986	.	A	<X>	0	.	DP=20;I16=10,10,0,0,685,23815,0,0,1132,65994,0,0,340,7114,0,0;QS=3,0;MQSB=0.902256;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,6,56:2:0	0,9,84:3:0
+17	3987	.	C	<X>	0	.	DP=20;I16=10,10,0,0,736,28118,0,0,1132,65994,0,0,336,7018,0,0;QS=3,0;MQSB=0.902256;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,6,55:2:0	0,9,94:3:0
+17	3988	.	T	<X>	0	.	DP=21;I16=10,10,0,0,741,27797,0,0,1132,65994,0,0,332,6946,0,0;QS=3,0;MQSB=0.902256;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,6,58:2:0	0,9,91:3:0
+17	3989	.	C	<X>	0	.	DP=21;I16=10,11,0,0,729,26185,0,0,1192,69594,0,0,327,6801,0,0;QS=3,0;MQSB=0.885602;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,55:2:0	0,9,88:3:0
+17	3990	.	C	<X>	0	.	DP=21;I16=10,11,0,0,766,28674,0,0,1192,69594,0,0,322,6686,0,0;QS=3,0;MQSB=0.885602;MQ0F=0	PL:DP:DV	0,48,255:16:0	0,6,55:2:0	0,9,95:3:0
+17	3991	.	T	<X>	0	.	DP=20;I16=9,11,0,0,729,27311,0,0,1132,65994,0,0,318,6600,0,0;QS=3,0;MQSB=0.850154;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,6,55:2:0	0,9,89:3:0
+17	3992	.	T	<X>	0	.	DP=19;I16=9,10,0,0,667,24173,0,0,1072,62394,0,0,313,6441,0,0;QS=3,0;MQSB=0.868634;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,6,56:2:0	0,6,72:2:0
+17	3993	.	C	<X>	0	.	DP=18;I16=9,9,0,0,701,27529,0,0,1012,58794,0,0,309,6307,0,0;QS=3,0;MQSB=0.888755;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,6,59:2:0	0,6,70:2:0
+17	3994	.	T	<X>	0	.	DP=19;I16=10,9,0,0,718,27520,0,0,1049,60163,0,0,305,6197,0,0;QS=3,0;MQSB=0.716531;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,6,58:2:0	0,6,72:2:0
+17	3995	.	T	<X>	0	.	DP=19;I16=9,9,0,0,641,23025,0,0,989,56563,0,0,277,5487,0,0;QS=3,0;MQSB=0.650623;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,6,53:2:0	0,6,69:2:0
+17	3996	.	A	<X>	0	.	DP=19;I16=9,9,0,0,665,24815,0,0,989,56563,0,0,274,5428,0,0;QS=3,0;MQSB=0.650623;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,6,54:2:0	0,6,73:2:0
+17	3997	.	G	C,<X>	0	.	DP=19;I16=10,8,0,1,645,23703,21,441,989,56563,60,3600,287,5843,6,36;QS=2.96023,0.0397727,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.716531;BQB=1;MQ0F=0	PL:DP:DV	0,24,255,42,255,255:15:1	0,6,57,6,57,57:2:0	0,6,60,6,60,60:2:0
+17	3998	.	G	<X>	0	.	DP=18;I16=9,8,0,0,626,23710,0,0,929,52963,0,0,265,5203,0,0;QS=3,0;MQSB=0.687289;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,6,58:2:0	0,3,36:1:0
+17	3999	.	G	A,<X>	0	.	DP=18;I16=9,7,0,1,596,22974,37,1369,869,49363,60,3600,263,5387,4,16;QS=2.92871,0.0712909,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.687289;BQB=1;MQ0F=0	PL:DP:DV	0,5,255,39,255,255:14:1	0,6,56,6,56,56:2:0	0,3,38,3,38,38:1:0
+17	4000	.	C	<X>	0	.	DP=18;I16=10,8,0,0,669,25389,0,0,989,56563,0,0,283,5753,0,0;QS=3,0;MQSB=0.751866;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,6,55:2:0	0,3,36:1:0
+17	4001	.	T	<X>	0	.	DP=18;I16=10,8,0,0,680,26006,0,0,989,56563,0,0,279,5727,0,0;QS=3,0;MQSB=0.751866;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,6,56:2:0	0,3,33:1:0
+17	4002	.	G	<X>	0	.	DP=17;I16=10,7,0,0,621,23281,0,0,929,52963,0,0,276,5724,0,0;QS=2,0;MQSB=0.79189;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,6,44:2:0	0,0,0:0:0
+17	4003	.	A	<X>	0	.	DP=17;I16=10,7,0,0,597,21507,0,0,929,52963,0,0,272,5692,0,0;QS=2,0;MQSB=0.79189;MQ0F=0	PL:DP:DV	0,45,255:15:0	0,6,55:2:0	0,0,0:0:0
+17	4004	.	T	<X>	0	.	DP=15;I16=9,6,0,0,527,19031,0,0,849,48963,0,0,270,5678,0,0;QS=2,0;MQSB=0.957526;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,3,40:1:0	0,0,0:0:0
+17	4005	.	A	<X>	0	.	DP=15;I16=8,5,0,0,479,17731,0,0,729,41763,0,0,237,5195,0,0;QS=2,0;MQSB=0.958048;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,3,35:1:0	0,0,0:0:0
+17	4006	.	T	<X>	0	.	DP=15;I16=9,6,0,0,554,20776,0,0,849,48963,0,0,266,5698,0,0;QS=2,0;MQSB=0.957526;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,3,40:1:0	0,0,0:0:0
+17	4007	.	T	G,<X>	0	.	DP=15;I16=9,5,0,1,490,17810,15,225,789,45363,60,3600,245,5371,19,361;QS=1.96746,0.032538,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.957526;BQB=1;MQ0F=0	PL:DP:DV	0,26,255,39,255,255:14:1	0,3,41,3,41,41:1:0	0,0,0,0,0,0:0:0
+17	4008	.	C	<X>	0	.	DP=15;I16=9,6,0,0,488,16890,0,0,849,48963,0,0,262,5782,0,0;QS=2,0;MQSB=0.957526;MQ0F=0	PL:DP:DV	0,42,255:14:0	0,3,30:1:0	0,0,0:0:0
+17	4009	.	C	<X>	0	.	DP=14;I16=9,5,0,0,524,20150,0,0,794,45938,0,0,261,5847,0,0;QS=2,0;MQSB=0.800737;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,3,40:1:0	0,0,0:0:0
+17	4010	.	A	<X>	0	.	DP=14;I16=9,5,0,0,523,19731,0,0,794,45938,0,0,259,5875,0,0;QS=2,0;MQSB=0.800737;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,3,41:1:0	0,0,0:0:0
+17	4011	.	C	<X>	0	.	DP=14;I16=9,5,0,0,489,17613,0,0,794,45938,0,0,257,5915,0,0;QS=2,0;MQSB=0.800737;MQ0F=0	PL:DP:DV	0,39,255:13:0	0,3,41:1:0	0,0,0:0:0
+17	4012	.	A	<X>	0	.	DP=14;I16=7,5,0,0,365,11867,0,0,674,38738,0,0,223,5293,0,0;QS=2,0;MQSB=0.6821;MQ0F=0	PL:DP:DV	0,33,231:11:0	0,3,30:1:0	0,0,0:0:0
+17	4013	.	C	<X>	0	.	DP=14;I16=8,5,0,0,451,15885,0,0,734,42338,0,0,247,5995,0,0;QS=2,0;MQSB=0.765017;MQ0F=0	PL:DP:DV	0,36,255:12:0	0,3,37:1:0	0,0,0:0:0
+17	4014	.	A	<X>	0	.	DP=12;I16=8,2,0,0,358,13372,0,0,554,31538,0,0,222,5404,0,0;QS=2,0;MQSB=0.75;MQ0F=0	PL:DP:DV	0,27,213:9:0	0,3,34:1:0	0,0,0:0:0
+17	4015	.	C	<X>	0	.	DP=12;I16=8,2,0,0,350,12812,0,0,554,31538,0,0,222,5442,0,0;QS=2,0;MQSB=0.75;MQ0F=0	PL:DP:DV	0,27,222:9:0	0,3,21:1:0	0,0,0:0:0
+17	4016	.	C	<X>	0	.	DP=12;I16=8,3,0,0,350,11956,0,0,614,35138,0,0,247,6109,0,0;QS=2,0;MQSB=0.829029;MQ0F=0	PL:DP:DV	0,30,215:10:0	0,3,32:1:0	0,0,0:0:0
+17	4017	.	C	<X>	0	.	DP=11;I16=5,2,0,0,227,7765,0,0,374,20738,0,0,173,4279,0,0;QS=2,0;MQSB=0.6;MQ0F=0	PL:DP:DV	0,18,161:6:0	0,3,20:1:0	0,0,0:0:0
+17	4018	.	G	<X>	0	.	DP=11;I16=8,2,0,0,284,8442,0,0,554,31538,0,0,249,6201,0,0;QS=2,0;MQSB=0.75;MQ0F=0	PL:DP:DV	0,27,183:9:0	0,3,17:1:0	0,0,0:0:0
+17	4019	.	C	<X>	0	.	DP=11;I16=9,2,0,0,383,14427,0,0,614,35138,0,0,250,6250,0,0;QS=2,0;MQSB=0.777778;MQ0F=0	PL:DP:DV	0,30,228:10:0	0,3,33:1:0	0,0,0:0:0
+17	4020	.	T	<X>	0	.	DP=10;I16=8,2,0,0,362,13668,0,0,554,31538,0,0,250,6250,0,0;QS=2,0;MQSB=0.75;MQ0F=0	PL:DP:DV	0,27,213:9:0	0,3,38:1:0	0,0,0:0:0
+17	4021	.	A	<X>	0	.	DP=10;I16=8,1,0,0,304,10512,0,0,494,27938,0,0,225,5625,0,0;QS=2,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,177:8:0	0,3,33:1:0	0,0,0:0:0
+17	4022	.	C	<X>	0	.	DP=10;I16=7,2,0,0,310,11582,0,0,494,27938,0,0,225,5625,0,0;QS=2,0;MQSB=0.714286;MQ0F=0	PL:DP:DV	0,24,202:8:0	0,3,36:1:0	0,0,0:0:0
+17	4023	.	A	<X>	0	.	DP=10;I16=8,2,0,0,354,13116,0,0,554,31538,0,0,250,6250,0,0;QS=2,0;MQSB=0.75;MQ0F=0	PL:DP:DV	0,27,209:9:0	0,3,40:1:0	0,0,0:0:0
+17	4024	.	C	<X>	0	.	DP=10;I16=8,2,0,0,361,13669,0,0,554,31538,0,0,250,6250,0,0;QS=2,0;MQSB=0.75;MQ0F=0	PL:DP:DV	0,27,214:9:0	0,3,39:1:0	0,0,0:0:0
+17	4025	.	T	<X>	0	.	DP=10;I16=8,1,0,0,360,14488,0,0,494,27938,0,0,224,5576,0,0;QS=2,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,199:8:0	0,3,42:1:0	0,0,0:0:0
+17	4026	.	C	<X>	0	.	DP=10;I16=8,2,0,0,329,11655,0,0,554,31538,0,0,248,6154,0,0;QS=2,0;MQSB=0.75;MQ0F=0	PL:DP:DV	0,27,192:9:0	0,3,39:1:0	0,0,0:0:0
+17	4027	.	C	<X>	0	.	DP=10;I16=8,2,0,0,380,14888,0,0,554,31538,0,0,246,6060,0,0;QS=2,0;MQSB=0.75;MQ0F=0	PL:DP:DV	0,27,231:9:0	0,3,38:1:0	0,0,0:0:0
+17	4028	.	T	<X>	0	.	DP=10;I16=8,2,0,0,333,12157,0,0,554,31538,0,0,244,5970,0,0;QS=2,0;MQSB=0.75;MQ0F=0	PL:DP:DV	0,27,202:9:0	0,3,41:1:0	0,0,0:0:0
+17	4029	.	T	<X>	0	.	DP=10;I16=8,2,0,0,377,14333,0,0,554,31538,0,0,242,5884,0,0;QS=2,0;MQSB=0.75;MQ0F=0	PL:DP:DV	0,27,225:9:0	0,3,38:1:0	0,0,0:0:0
+17	4030	.	C	<X>	0	.	DP=10;I16=8,2,0,0,348,12558,0,0,554,31538,0,0,240,5802,0,0;QS=2,0;MQSB=0.75;MQ0F=0	PL:DP:DV	0,27,211:9:0	0,3,30:1:0	0,0,0:0:0
+17	4031	.	T	<X>	0	.	DP=10;I16=8,2,0,0,388,15302,0,0,554,31538,0,0,238,5724,0,0;QS=2,0;MQSB=0.75;MQ0F=0	PL:DP:DV	0,27,229:9:0	0,3,39:1:0	0,0,0:0:0
+17	4032	.	T	<X>	0	.	DP=10;I16=8,2,0,0,341,11901,0,0,554,31538,0,0,236,5650,0,0;QS=2,0;MQSB=0.75;MQ0F=0	PL:DP:DV	0,27,204:9:0	0,3,39:1:0	0,0,0:0:0
+17	4033	.	A	<X>	0	.	DP=10;I16=7,2,0,0,299,10717,0,0,494,27938,0,0,218,5324,0,0;QS=2,0;MQSB=0.714286;MQ0F=0	PL:DP:DV	0,24,193:8:0	0,3,38:1:0	0,0,0:0:0
+17	4034	.	G	<X>	0	.	DP=10;I16=8,2,0,0,347,12527,0,0,554,31538,0,0,231,5465,0,0;QS=2,0;MQSB=0.75;MQ0F=0	PL:DP:DV	0,27,211:9:0	0,3,39:1:0	0,0,0:0:0
+17	4035	.	G	T,<X>	0	.	DP=10;I16=7,2,1,0,316,11900,13,169,494,27938,60,3600,202,4682,25,625;QS=1.9547,0.0452962,0;SGB=-0.556633;RPB=1;MQB=1;MQSB=0.75;BQB=1;MQ0F=0	PL:DP:DV	0,13,195,24,198,200:9:1	0,3,31,3,31,31:1:0	0,0,0,0,0,0:0:0
+17	4036	.	G	<X>	0	.	DP=10;I16=8,1,0,0,269,8839,0,0,494,27938,0,0,198,4532,0,0;QS=2,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,156:8:0	0,3,34:1:0	0,0,0:0:0
+17	4037	.	C	<X>	0	.	DP=10;I16=8,2,0,0,342,12466,0,0,554,31538,0,0,219,5015,0,0;QS=2,0;MQSB=0.75;MQ0F=0	PL:DP:DV	0,27,210:9:0	0,3,30:1:0	0,0,0:0:0
+17	4038	.	T	<X>	0	.	DP=10;I16=8,2,0,0,335,12149,0,0,554,31538,0,0,215,4881,0,0;QS=2,0;MQSB=0.75;MQ0F=0	PL:DP:DV	0,27,203:9:0	0,3,29:1:0	0,0,0:0:0
+17	4039	.	G	<X>	0	.	DP=10;I16=8,1,0,0,302,10798,0,0,494,27938,0,0,186,4130,0,0;QS=2,0;MQSB=1;MQ0F=0	PL:DP:DV	0,24,180:8:0	0,3,31:1:0	0,0,0:0:0
+17	4040	.	A	<X>	0	.	DP=10;I16=8,2,0,0,380,14602,0,0,554,31538,0,0,207,4637,0,0;QS=2,0;MQSB=0.75;MQ0F=0	PL:DP:DV	0,27,223:9:0	0,3,41:1:0	0,0,0:0:0
+17	4041	.	T	<X>	0	.	DP=10;I16=8,2,0,0,367,13633,0,0,554,31538,0,0,202,4478,0,0;QS=2,0;MQSB=0.75;MQ0F=0	PL:DP:DV	0,27,216:9:0	0,3,40:1:0	0,0,0:0:0
+17	4042	.	A	<X>	0	.	DP=10;I16=8,2,0,0,337,11657,0,0,554,31538,0,0,197,4329,0,0;QS=2,0;MQSB=0.75;MQ0F=0	PL:DP:DV	0,27,205:9:0	0,3,34:1:0	0,0,0:0:0
+17	4043	.	T	<X>	0	.	DP=10;I16=8,2,0,0,314,10428,0,0,554,31538,0,0,192,4190,0,0;QS=2,0;MQSB=0.75;MQ0F=0	PL:DP:DV	0,27,190:9:0	0,3,35:1:0	0,0,0:0:0
+17	4044	.	T	<X>	0	.	DP=10;I16=8,2,0,0,333,11579,0,0,554,31538,0,0,187,4061,0,0;QS=2,0;MQSB=0.75;MQ0F=0	PL:DP:DV	0,27,199:9:0	0,3,37:1:0	0,0,0:0:0
+17	4045	.	C	<X>	0	.	DP=10;I16=7,2,0,0,291,10099,0,0,494,27938,0,0,176,3906,0,0;QS=1,0;MQSB=0.714286;MQ0F=0	PL:DP:DV	0,27,204:9:0	0,0,0:0:0	0,0,0:0:0
+17	4046	.	C	<X>	0	.	DP=10;I16=8,2,0,0,356,13032,0,0,554,31538,0,0,177,3833,0,0;QS=2,0;MQSB=0.75;MQ0F=0	PL:DP:DV	0,27,212:9:0	0,3,35:1:0	0,0,0:0:0
+17	4047	.	A	<X>	0	.	DP=10;I16=8,2,0,0,347,12557,0,0,554,31538,0,0,172,3734,0,0;QS=2,0;MQSB=0.75;MQ0F=0	PL:DP:DV	0,27,204:9:0	0,3,40:1:0	0,0,0:0:0
+17	4048	.	C	<X>	0	.	DP=10;I16=8,2,0,0,342,12124,0,0,554,31538,0,0,167,3645,0,0;QS=2,0;MQSB=0.75;MQ0F=0	PL:DP:DV	0,27,202:9:0	0,3,37:1:0	0,0,0:0:0
+17	4049	.	G	<X>	0	.	DP=10;I16=7,2,0,0,260,7786,0,0,494,27938,0,0,146,3310,0,0;QS=2,0;MQSB=0.714286;MQ0F=0	PL:DP:DV	0,24,173:8:0	0,3,24:1:0	0,0,0:0:0
+17	4050	.	C	<X>	0	.	DP=9;I16=6,2,0,0,291,10813,0,0,434,24338,0,0,157,3495,0,0;QS=1,0;MQSB=0.666667;MQ0F=0	PL:DP:DV	0,24,204:8:0	0,0,0:0:0	0,0,0:0:0
+17	4051	.	A	<X>	0	.	DP=8;I16=5,2,0,0,259,9679,0,0,374,20738,0,0,146,3370,0,0;QS=1,0;MQSB=0.6;MQ0F=0	PL:DP:DV	0,21,192:7:0	0,0,0:0:0	0,0,0:0:0
+17	4052	.	C	<X>	0	.	DP=8;I16=5,2,0,0,247,9025,0,0,374,20738,0,0,143,3281,0,0;QS=1,0;MQSB=0.6;MQ0F=0	PL:DP:DV	0,21,190:7:0	0,0,0:0:0	0,0,0:0:0
+17	4053	.	C	<X>	0	.	DP=8;I16=6,2,0,0,254,9000,0,0,434,24338,0,0,146,3234,0,0;QS=1,0;MQSB=0.666667;MQ0F=0	PL:DP:DV	0,24,184:8:0	0,0,0:0:0	0,0,0:0:0
+17	4054	.	C	<X>	0	.	DP=8;I16=3,2,0,0,160,5344,0,0,254,13538,0,0,122,2984,0,0;QS=1,0;MQSB=0.333333;MQ0F=0	PL:DP:DV	0,15,134:5:0	0,0,0:0:0	0,0,0:0:0
+17	4055	.	G	<X>	0	.	DP=8;I16=6,2,0,0,230,6982,0,0,434,24338,0,0,138,3066,0,0;QS=1,0;MQSB=0.666667;MQ0F=0	PL:DP:DV	0,24,169:8:0	0,0,0:0:0	0,0,0:0:0
+17	4056	.	C	<X>	0	.	DP=8;I16=6,2,0,0,275,10153,0,0,434,24338,0,0,134,2994,0,0;QS=1,0;MQSB=0.666667;MQ0F=0	PL:DP:DV	0,24,197:8:0	0,0,0:0:0	0,0,0:0:0
+17	4057	.	T	<X>	0	.	DP=8;I16=5,2,0,0,243,8603,0,0,374,20738,0,0,127,2877,0,0;QS=1,0;MQSB=0.6;MQ0F=0	PL:DP:DV	0,21,182:7:0	0,0,0:0:0	0,0,0:0:0
+17	4058	.	A	<X>	0	.	DP=7;I16=4,2,0,0,214,7742,0,0,314,17138,0,0,116,2728,0,0;QS=1,0;MQSB=0.5;MQ0F=0	PL:DP:DV	0,18,171:6:0	0,0,0:0:0	0,0,0:0:0
+17	4059	.	C	<X>	0	.	DP=6;I16=4,2,0,0,204,7164,0,0,314,17138,0,0,119,2635,0,0;QS=1,0;MQSB=0.5;MQ0F=0	PL:DP:DV	0,18,168:6:0	0,0,0:0:0	0,0,0:0:0
+17	4060	.	A	<X>	0	.	DP=6;I16=4,2,0,0,227,8683,0,0,314,17138,0,0,115,2501,0,0;QS=1,0;MQSB=0.5;MQ0F=0	PL:DP:DV	0,18,177:6:0	0,0,0:0:0	0,0,0:0:0
+17	4061	.	C	<X>	0	.	DP=6;I16=4,2,0,0,193,6681,0,0,314,17138,0,0,111,2375,0,0;QS=1,0;MQSB=0.5;MQ0F=0	PL:DP:DV	0,18,157:6:0	0,0,0:0:0	0,0,0:0:0
+17	4062	.	T	<X>	0	.	DP=6;I16=4,1,0,0,195,7621,0,0,254,13538,0,0,82,1632,0,0;QS=1,0;MQSB=1;MQ0F=0	PL:DP:DV	0,15,151:5:0	0,0,0:0:0	0,0,0:0:0
+17	4063	.	C	<X>	0	.	DP=6;I16=4,2,0,0,216,7984,0,0,314,17138,0,0,102,2098,0,0;QS=1,0;MQSB=0.5;MQ0F=0	PL:DP:DV	0,18,170:6:0	0,0,0:0:0	0,0,0:0:0
+17	4064	.	C	<X>	0	.	DP=6;I16=4,2,0,0,227,8747,0,0,314,17138,0,0,97,1949,0,0;QS=1,0;MQSB=0.5;MQ0F=0	PL:DP:DV	0,18,177:6:0	0,0,0:0:0	0,0,0:0:0
+17	4065	.	T	<X>	0	.	DP=6;I16=4,2,0,0,202,6880,0,0,314,17138,0,0,92,1810,0,0;QS=1,0;MQSB=0.5;MQ0F=0	PL:DP:DV	0,18,161:6:0	0,0,0:0:0	0,0,0:0:0
+17	4066	.	T	<X>	0	.	DP=5;I16=3,2,0,0,180,6554,0,0,254,13538,0,0,88,1680,0,0;QS=1,0;MQSB=0.333333;MQ0F=0	PL:DP:DV	0,15,153:5:0	0,0,0:0:0	0,0,0:0:0
+17	4067	.	C	<X>	0	.	DP=5;I16=3,2,0,0,181,6637,0,0,254,13538,0,0,84,1558,0,0;QS=1,0;MQSB=0.333333;MQ0F=0	PL:DP:DV	0,15,153:5:0	0,0,0:0:0	0,0,0:0:0
+17	4068	.	T	<X>	0	.	DP=5;I16=3,2,0,0,198,7868,0,0,254,13538,0,0,80,1444,0,0;QS=1,0;MQSB=0.333333;MQ0F=0	PL:DP:DV	0,15,164:5:0	0,0,0:0:0	0,0,0:0:0
+17	4069	.	T	<X>	0	.	DP=5;I16=3,2,0,0,177,6325,0,0,254,13538,0,0,76,1338,0,0;QS=1,0;MQSB=0.333333;MQ0F=0	PL:DP:DV	0,15,154:5:0	0,0,0:0:0	0,0,0:0:0
+17	4070	.	A	<X>	0	.	DP=5;I16=3,2,0,0,161,5263,0,0,254,13538,0,0,72,1240,0,0;QS=1,0;MQSB=0.333333;MQ0F=0	PL:DP:DV	0,15,140:5:0	0,0,0:0:0	0,0,0:0:0
+17	4071	.	G	<X>	0	.	DP=5;I16=3,2,0,0,166,5658,0,0,254,13538,0,0,68,1150,0,0;QS=1,0;MQSB=0.333333;MQ0F=0	PL:DP:DV	0,15,142:5:0	0,0,0:0:0	0,0,0:0:0
+17	4072	.	G	<X>	0	.	DP=5;I16=2,2,0,0,138,4974,0,0,194,9938,0,0,55,987,0,0;QS=1,0;MQSB=0;MQ0F=0	PL:DP:DV	0,12,122:4:0	0,0,0:0:0	0,0,0:0:0
+17	4073	.	G	<X>	0	.	DP=5;I16=3,2,0,0,156,5082,0,0,254,13538,0,0,60,994,0,0;QS=1,0;MQSB=0.333333;MQ0F=0	PL:DP:DV	0,15,136:5:0	0,0,0:0:0	0,0,0:0:0
+17	4074	.	C	<X>	0	.	DP=5;I16=3,2,0,0,160,5602,0,0,254,13538,0,0,56,928,0,0;QS=1,0;MQSB=0.333333;MQ0F=0	PL:DP:DV	0,15,142:5:0	0,0,0:0:0	0,0,0:0:0
+17	4075	.	T	<X>	0	.	DP=5;I16=3,2,0,0,187,7069,0,0,254,13538,0,0,52,870,0,0;QS=1,0;MQSB=0.333333;MQ0F=0	PL:DP:DV	0,15,155:5:0	0,0,0:0:0	0,0,0:0:0
+17	4076	.	G	<X>	0	.	DP=5;I16=3,2,0,0,174,6298,0,0,254,13538,0,0,48,820,0,0;QS=1,0;MQSB=0.333333;MQ0F=0	PL:DP:DV	0,15,149:5:0	0,0,0:0:0	0,0,0:0:0
+17	4077	.	A	<X>	0	.	DP=4;I16=3,1,0,0,138,4810,0,0,194,9938,0,0,44,728,0,0;QS=1,0;MQSB=1;MQ0F=0	PL:DP:DV	0,12,121:4:0	0,0,0:0:0	0,0,0:0:0
+17	4078	.	T	<X>	0	.	DP=4;I16=3,1,0,0,143,5173,0,0,194,9938,0,0,40,644,0,0;QS=1,0;MQSB=1;MQ0F=0	PL:DP:DV	0,12,124:4:0	0,0,0:0:0	0,0,0:0:0
+17	4079	.	A	<X>	0	.	DP=4;I16=3,1,0,0,121,3847,0,0,194,9938,0,0,36,568,0,0;QS=1,0;MQSB=1;MQ0F=0	PL:DP:DV	0,12,107:4:0	0,0,0:0:0	0,0,0:0:0
+17	4080	.	T	<X>	0	.	DP=4;I16=3,0,0,0,106,3778,0,0,134,6338,0,0,25,451,0,0;QS=1,0;MQ0F=0	PL:DP:DV	0,9,87:3:0	0,0,0:0:0	0,0,0:0:0
+17	4081	.	T	<X>	0	.	DP=4;I16=3,1,0,0,106,2934,0,0,194,9938,0,0,28,440,0,0;QS=1,0;MQSB=1;MQ0F=0	PL:DP:DV	0,12,94:4:0	0,0,0:0:0	0,0,0:0:0
+17	4082	.	C	<X>	0	.	DP=3;I16=2,1,0,0,110,4042,0,0,134,6338,0,0,25,387,0,0;QS=1,0;MQSB=1;MQ0F=0	PL:DP:DV	0,9,103:3:0	0,0,0:0:0	0,0,0:0:0
+17	4083	.	C	<X>	0	.	DP=3;I16=2,1,0,0,104,3648,0,0,134,6338,0,0,22,340,0,0;QS=1,0;MQSB=1;MQ0F=0	PL:DP:DV	0,9,98:3:0	0,0,0:0:0	0,0,0:0:0
+17	4084	.	A	<X>	0	.	DP=2;I16=1,1,0,0,78,3050,0,0,97,4969,0,0,20,298,0,0;QS=1,0;MQSB=1;MQ0F=0	PL:DP:DV	0,6,74:2:0	0,0,0:0:0	0,0,0:0:0
+17	4085	.	C	<X>	0	.	DP=2;I16=1,1,0,0,62,1940,0,0,97,4969,0,0,18,260,0,0;QS=1,0;MQSB=1;MQ0F=0	PL:DP:DV	0,6,62:2:0	0,0,0:0:0	0,0,0:0:0
+17	4086	.	G	<X>	0	.	DP=2;I16=1,1,0,0,56,1640,0,0,97,4969,0,0,16,226,0,0;QS=1,0;MQSB=1;MQ0F=0	PL:DP:DV	0,6,56:2:0	0,0,0:0:0	0,0,0:0:0
+17	4087	.	C	<X>	0	.	DP=2;I16=1,1,0,0,69,2405,0,0,97,4969,0,0,14,196,0,0;QS=1,0;MQSB=1;MQ0F=0	PL:DP:DV	0,6,68:2:0	0,0,0:0:0	0,0,0:0:0
+17	4088	.	A	<X>	0	.	DP=1;I16=1,0,0,0,39,1521,0,0,37,1369,0,0,13,169,0,0;QS=1,0;MQ0F=0	PL:DP:DV	0,3,37:1:0	0,0,0:0:0	0,0,0:0:0
+17	4089	.	C	<X>	0	.	DP=1;I16=1,0,0,0,36,1296,0,0,37,1369,0,0,12,144,0,0;QS=1,0;MQ0F=0	PL:DP:DV	0,3,36:1:0	0,0,0:0:0	0,0,0:0:0
+17	4090	.	C	<X>	0	.	DP=1;I16=1,0,0,0,33,1089,0,0,37,1369,0,0,11,121,0,0;QS=1,0;MQ0F=0	PL:DP:DV	0,3,33:1:0	0,0,0:0:0	0,0,0:0:0
+17	4091	.	T	<X>	0	.	DP=1;I16=1,0,0,0,36,1296,0,0,37,1369,0,0,10,100,0,0;QS=1,0;MQ0F=0	PL:DP:DV	0,3,36:1:0	0,0,0:0:0	0,0,0:0:0
+17	4092	.	G	<X>	0	.	DP=1;I16=1,0,0,0,37,1369,0,0,37,1369,0,0,9,81,0,0;QS=1,0;MQ0F=0	PL:DP:DV	0,3,37:1:0	0,0,0:0:0	0,0,0:0:0
+17	4093	.	C	<X>	0	.	DP=1;I16=1,0,0,0,35,1225,0,0,37,1369,0,0,8,64,0,0;QS=1,0;MQ0F=0	PL:DP:DV	0,3,35:1:0	0,0,0:0:0	0,0,0:0:0
+17	4094	.	T	<X>	0	.	DP=1;I16=1,0,0,0,40,1600,0,0,37,1369,0,0,7,49,0,0;QS=1,0;MQ0F=0	PL:DP:DV	0,3,37:1:0	0,0,0:0:0	0,0,0:0:0
+17	4095	.	A	<X>	0	.	DP=1;I16=1,0,0,0,35,1225,0,0,37,1369,0,0,6,36,0,0;QS=1,0;MQ0F=0	PL:DP:DV	0,3,35:1:0	0,0,0:0:0	0,0,0:0:0
+17	4096	.	C	<X>	0	.	DP=1;I16=1,0,0,0,32,1024,0,0,37,1369,0,0,5,25,0,0;QS=1,0;MQ0F=0	PL:DP:DV	0,3,32:1:0	0,0,0:0:0	0,0,0:0:0
+17	4097	.	A	<X>	0	.	DP=1;I16=1,0,0,0,35,1225,0,0,37,1369,0,0,4,16,0,0;QS=1,0;MQ0F=0	PL:DP:DV	0,3,35:1:0	0,0,0:0:0	0,0,0:0:0
+17	4098	.	C	<X>	0	.	DP=1;I16=1,0,0,0,31,961,0,0,37,1369,0,0,3,9,0,0;QS=1,0;MQ0F=0	PL:DP:DV	0,3,31:1:0	0,0,0:0:0	0,0,0:0:0
+17	4099	.	T	<X>	0	.	DP=1;I16=1,0,0,0,32,1024,0,0,37,1369,0,0,2,4,0,0;QS=1,0;MQ0F=0	PL:DP:DV	0,3,32:1:0	0,0,0:0:0	0,0,0:0:0
+17	4100	.	C	<X>	0	.	DP=1;I16=1,0,0,0,27,729,0,0,37,1369,0,0,1,1,0,0;QS=1,0;MQ0F=0	PL:DP:DV	0,3,27:1:0	0,0,0:0:0	0,0,0:0:0
+17	4101	.	C	<X>	0	.	DP=1;I16=1,0,0,0,26,676,0,0,37,1369,0,0,0,0,0,0;QS=1,0;MQ0F=0	PL:DP:DV	0,3,26:1:0	0,0,0:0:0	0,0,0:0:0
diff --git a/test/norm.fa b/test/norm.fa
new file mode 100644
index 0000000..2ef85f1
--- /dev/null
+++ b/test/norm.fa
@@ -0,0 +1,24 @@
+>20 20:1339000-1339300
+AGGATGGGGCTCATTAATAGAGCTCCACTTGTCTCCAGAATCACTGGTGAGGAAGGGGAG
+TGTTGCCCCCACATTCGTGCACAGCAGGGATGGTTCACCGAACTCCACACCAGTCTCTGC
+AGAGCCTGTTGGGGAGAGGAGGGCTGTGGTTTCTTTGATGGTGTTCACCTGGAGTAGAGC
+AAGTATTGTCAAAAGGGTCATCCTCGGAGGTTGCAGTGAGCCGAGATCGCACCATTGCAC
+TGCAGCCTGGGAGACAGAGCAAGACTCCATCTCAAAAAAAAAAAAAAAAAAAAAGGCCAT
+C
+>1 1:10143-10443
+CTAACCCCTAACCCTAACCCTAACCCTAACCCTAACCTAACCCTAACCCTAACCCTAACC
+CTAACCCTAACCCTAACCCTAACCCTAACCCCTAACCCTAACCCTAAACCCTAAACCCTA
+ACCCTAACCCTAACCCTAACCCTAACCCCAACCCCAACCCCAACCCCAACCCCAACCCCA
+ACCCTAACCCCTAACCCTAACCCTAACCCTACCCTAACCCTAACCCTAACCCTAACCCTA
+ACCCTAACCCCTAACCCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCCTAACCC
+>2 1:1382388-1382602
+GGGCGTCTCATAGCTGGAGCAATGGCGAGCGCCTGGACAAGGGAGGGGAAGGGGTTCTTA
+TTACTGACGCGGGTAGCCCCTACTGCTGTGTGGTTCCCCTATTTTTTTTTTTTTCTTTTT
+GAGACGGAGTCTCGCTCTGTCACCCAGGCTGGAGTGCAGTGGCACAATCTCGGCTCACTG
+CAAGCTCCACCTCCTGGGTTCACGCCATTCTCCTG
+>3 madeup
+ACTGGACACGTGGACACACACACACACACACACACACACACAGTCAAACCACCTACCAGA
+>4 20:8917026-8917085
+TCCCCTCTTGACCTCTCTCTATTTTTTTTTTTTTTTCTGAGATGGATTTTTGCTCTTGTT
+>5 20:18724313-18724343
+GTCTCAAAAAAAAAAAAAAAAAAAAGAAAAG
diff --git a/test/norm.fa.fai b/test/norm.fa.fai
new file mode 100644
index 0000000..72d2ebe
--- /dev/null
+++ b/test/norm.fa.fai
@@ -0,0 +1,6 @@
+20	301	23	60	61
+1	300	347	60	61
+2	215	673	60	61
+3	60	902	60	61
+4	60	985	60	61
+5	31	1070	31	32
diff --git a/test/norm.merge.out b/test/norm.merge.out
new file mode 100644
index 0000000..6dd3f31
--- /dev/null
+++ b/test/norm.merge.out
@@ -0,0 +1,52 @@
+##fileformat=VCFv4.1
+##FILTER=<ID=PASS,Description="All filters passed">
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=PL,Number=G,Type=Integer,Description="Phred-scaled likelihood">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Depth">
+##contig=<ID=1,length=2147483647>
+##contig=<ID=2,length=2147483647>
+##contig=<ID=20,length=2147483647>
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##INFO=<ID=XRF,Number=R,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAF,Number=A,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGF,Number=G,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XRI,Number=R,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAI,Number=A,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGI,Number=G,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XRS,Number=R,Type=String,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAS,Number=A,Type=String,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGS,Number=G,Type=String,Description="Test Number=AGR in INFO">
+##FORMAT=<ID=FRF,Number=R,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAF,Number=A,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FGF,Number=G,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRI,Number=R,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAI,Number=A,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FGI,Number=G,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRS,Number=R,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAS,Number=A,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FGS,Number=G,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FSTR,Number=1,Type=String,Description="Test String in FORMAT">
+##INFO=<ID=ISTR,Number=1,Type=String,Description="Test String in INFO">
+##FILTER=<ID=FAIL1,Description="Failed filter 1">
+##FILTER=<ID=FAIL2,Description="Failed filter 2">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	XY00001	XY00002
+1	105	.	TAAACCCTAAA	TAA,TAACCCTAAA	999	PASS	INDEL;AN=4;AC=2,2;DP=19;ISTR=SomeString;XRF=1e+06,2e+06,500000;XRI=1111,2222,5555;XRS=AAA,BBB,DDD;XAF=1e+06,500000;XAI=1111,5555;XAS=AAA,DDD;XGF=1e+06,2e+06,3e+06,500000,.,9e+09;XGI=1111,2222,3333,5555,.,9999;XGS=A,B,C,E,.,F	GT:PL:DP:FRF:FRI:FRS:FAF:FAI:FAS:FGF:FGI:FGS	1/2:1,2,3,4,.,6:1:1e+06,2e+06,500000:1111,2222,5555:AAAA,BBB,CC:1e+06,500000:1111,5555:A,BB:1e+06,2e+06,3e+06,500000,.,9e+09:1111,2222,3333,5555,.,9999:A,BB,CCC,EEEE,.,FFFFF	1/2: [...]
+2	1	.	GGGCGTCTCATAGCTGGAGCAATGGCGAGCGCCTGGACAAGGGAGGGGAAGGGGTTCTTATTACTGACGCGGGTAGCCCCTACTGCTGTGTGGTTCCCCTATTTTTTTTTTTTTCTTTTTGAGACGGAGTCTCGCTCTGTCACCCAGGCTGGAGTGCAGTGGCACAATCTCGGCTCACTGCAAGCTCCACCT	ACGT	999	PASS	INDEL;AN=4;AC=2	GT:DP	1/0:1	1/0:1
+2	101	.	ATTTTTTTTTTTTT	ATTTTTTTTTTTTTTT	999	PASS	INDEL;AN=4;AC=4	GT:DP	1/1:1	1/1:1
+2	114	.	TC	TTCC,TTC	999	FAIL1	INDEL;AN=4;AC=2,2	GT:DP	1/2:1	1/2:1
+2	115	.	C	T	999	PASS	INDEL;AN=4;AC=4	GT:DP	1/1:1	1/1:1
+20	3	.	GATG	CTATG,GACT	999	PASS	INDEL;AN=4;AC=2,2	GT	2/1	2/1
+20	5	id0001;id0002	TGGG	TAC,TG,TGGGG,AC	.	PASS	INDEL;AN=4;AC=2,2,0,0	GT:PL:DP	1/2:1,2,3,4,.,6,7,.,.,10,11,.,.,.,15:1	1/2:1,2,3,4,.,6,7,.,.,10,11,.,.,.,15:1
+20	59	id0003	AG	.	999	PASS	AN=4	GT:PL:DP	0/0:0:4	0/0:0:4
+20	80	.	CACAG	CACAT	999	PASS	AN=4;AC=2	GT:PL:DP	0/1:255,0,255:13	0/1:255,0,255:13
+20	81	.	A	C	999	PASS	AN=4;AC=2	GT:PL:DP	0/1:255,0,255:13	0/1:255,0,255:13
+20	95	.	TCACCG	ACACCG	999	PASS	AN=4;AC=2	GT:PL:DP	0/1:255,0,255:13	0/1:255,0,255:13
+20	95	.	TCACCG	AAAAAA	999	PASS	AN=4;AC=2	GT:PL:DP	0/1:255,0,255:13	0/1:255,0,255:13
+20	273	.	CAAAAAAAAAAAAAAAAAAAAA	CAAAAAAAAAAAAAAAAAAAAAAA,CAAAAAAAAAAAAAAAAAAAAAAAA	999	PASS	INDEL;AN=4;AC=2,2	GT:PL:DP	1/2:0,3,5,3,.,5:1	1/2:0,3,5,3,.,5:1
+20	274	.	AAAAAAAAA	AAAAAAAAAAAAAAAAAAA	999	PASS	INDEL;AN=0;AC=0	GT:PL:DP	./.:0,0,0:0	./.:0,0,0:0
+20	275	.	A	C,G	0	FAIL1;FAIL2	INDEL;AN=2;AC=0,2	GT:PL:DP:FGF:FGI:FGS:FSTR	2:0,0,0:0:1e+06,2e+06,3e+06:1111,2222,3333:A,BB,CCC:WORD	2:0,0,0:0:1e+06,2e+06,3e+06:1111,2222,3333:A,BB,CCC:WORD
+20	278	.	AAAAAAAAAAAAAAAAA	AAAAAAAAAAAAAAAAAAA	999	PASS	INDEL;AN=0;AC=0	GT:PL:DP	./.:0,0,0:0	./.:0,0,0:0
+20	300	.	A	C,G	999	PASS	INDEL;AN=0;AC=0,0	GT:PL:DP	./.:0,0,0,0,.,0:0	./.:0,0,0,0,.,0:0
diff --git a/test/norm.merge.strict.out b/test/norm.merge.strict.out
new file mode 100644
index 0000000..c24dc9b
--- /dev/null
+++ b/test/norm.merge.strict.out
@@ -0,0 +1,52 @@
+##fileformat=VCFv4.1
+##FILTER=<ID=PASS,Description="All filters passed">
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=PL,Number=G,Type=Integer,Description="Phred-scaled likelihood">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Depth">
+##contig=<ID=1,length=2147483647>
+##contig=<ID=2,length=2147483647>
+##contig=<ID=20,length=2147483647>
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##INFO=<ID=XRF,Number=R,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAF,Number=A,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGF,Number=G,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XRI,Number=R,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAI,Number=A,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGI,Number=G,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XRS,Number=R,Type=String,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAS,Number=A,Type=String,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGS,Number=G,Type=String,Description="Test Number=AGR in INFO">
+##FORMAT=<ID=FRF,Number=R,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAF,Number=A,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FGF,Number=G,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRI,Number=R,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAI,Number=A,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FGI,Number=G,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRS,Number=R,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAS,Number=A,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FGS,Number=G,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FSTR,Number=1,Type=String,Description="Test String in FORMAT">
+##INFO=<ID=ISTR,Number=1,Type=String,Description="Test String in INFO">
+##FILTER=<ID=FAIL1,Description="Failed filter 1">
+##FILTER=<ID=FAIL2,Description="Failed filter 2">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	XY00001	XY00002
+1	105	.	TAAACCCTAAA	TAA,TAACCCTAAA	999	PASS	INDEL;AN=4;AC=2,2;DP=19;ISTR=SomeString;XRF=1e+06,2e+06,500000;XRI=1111,2222,5555;XRS=AAA,BBB,DDD;XAF=1e+06,500000;XAI=1111,5555;XAS=AAA,DDD;XGF=1e+06,2e+06,3e+06,500000,.,9e+09;XGI=1111,2222,3333,5555,.,9999;XGS=A,B,C,E,.,F	GT:PL:DP:FRF:FRI:FRS:FAF:FAI:FAS:FGF:FGI:FGS	1/2:1,2,3,4,.,6:1:1e+06,2e+06,500000:1111,2222,5555:AAAA,BBB,CC:1e+06,500000:1111,5555:A,BB:1e+06,2e+06,3e+06,500000,.,9e+09:1111,2222,3333,5555,.,9999:A,BB,CCC,EEEE,.,FFFFF	1/2: [...]
+2	1	.	GGGCGTCTCATAGCTGGAGCAATGGCGAGCGCCTGGACAAGGGAGGGGAAGGGGTTCTTATTACTGACGCGGGTAGCCCCTACTGCTGTGTGGTTCCCCTATTTTTTTTTTTTTCTTTTTGAGACGGAGTCTCGCTCTGTCACCCAGGCTGGAGTGCAGTGGCACAATCTCGGCTCACTGCAAGCTCCACCT	ACGT	999	PASS	INDEL;AN=4;AC=2	GT:DP	1/0:1	1/0:1
+2	101	.	ATTTTTTTTTTTTT	ATTTTTTTTTTTTTTT	999	PASS	INDEL;AN=4;AC=4	GT:DP	1/1:1	1/1:1
+2	114	.	TC	TTCC,TTC	999	PASS	INDEL;AN=4;AC=2,2	GT:DP	1/2:1	1/2:1
+2	115	.	C	T	999	PASS	INDEL;AN=4;AC=4	GT:DP	1/1:1	1/1:1
+20	3	.	GATG	CTATG,GACT	999	PASS	INDEL;AN=4;AC=2,2	GT	2/1	2/1
+20	5	id0001;id0002	TGGG	TAC,TG,TGGGG,AC	.	PASS	INDEL;AN=4;AC=2,2,0,0	GT:PL:DP	1/2:1,2,3,4,.,6,7,.,.,10,11,.,.,.,15:1	1/2:1,2,3,4,.,6,7,.,.,10,11,.,.,.,15:1
+20	59	id0003	AG	.	999	PASS	AN=4	GT:PL:DP	0/0:0:4	0/0:0:4
+20	80	.	CACAG	CACAT	999	PASS	AN=4;AC=2	GT:PL:DP	0/1:255,0,255:13	0/1:255,0,255:13
+20	81	.	A	C	999	PASS	AN=4;AC=2	GT:PL:DP	0/1:255,0,255:13	0/1:255,0,255:13
+20	95	.	TCACCG	ACACCG	999	PASS	AN=4;AC=2	GT:PL:DP	0/1:255,0,255:13	0/1:255,0,255:13
+20	95	.	TCACCG	AAAAAA	999	PASS	AN=4;AC=2	GT:PL:DP	0/1:255,0,255:13	0/1:255,0,255:13
+20	273	.	CAAAAAAAAAAAAAAAAAAAAA	CAAAAAAAAAAAAAAAAAAAAAAA,CAAAAAAAAAAAAAAAAAAAAAAAA	999	PASS	INDEL;AN=4;AC=2,2	GT:PL:DP	1/2:0,3,5,3,.,5:1	1/2:0,3,5,3,.,5:1
+20	274	.	AAAAAAAAA	AAAAAAAAAAAAAAAAAAA	999	PASS	INDEL;AN=0;AC=0	GT:PL:DP	./.:0,0,0:0	./.:0,0,0:0
+20	275	.	A	C,G	0	FAIL1;FAIL2	INDEL;AN=2;AC=0,2	GT:PL:DP:FGF:FGI:FGS:FSTR	2:0,0,0:0:1e+06,2e+06,3e+06:1111,2222,3333:A,BB,CCC:WORD	2:0,0,0:0:1e+06,2e+06,3e+06:1111,2222,3333:A,BB,CCC:WORD
+20	278	.	AAAAAAAAAAAAAAAAA	AAAAAAAAAAAAAAAAAAA	999	PASS	INDEL;AN=0;AC=0	GT:PL:DP	./.:0,0,0:0	./.:0,0,0:0
+20	300	.	A	C,G	999	PASS	INDEL;AN=0;AC=0,0	GT:PL:DP	./.:0,0,0,0,.,0:0	./.:0,0,0,0,.,0:0
diff --git a/test/norm.merge.vcf b/test/norm.merge.vcf
new file mode 100644
index 0000000..a24e36f
--- /dev/null
+++ b/test/norm.merge.vcf
@@ -0,0 +1,61 @@
+##fileformat=VCFv4.1
+##FILTER=<ID=PASS,Description="All filters passed">
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=PL,Number=G,Type=Integer,Description="Phred-scaled likelihood">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Depth">
+##contig=<ID=1,length=2147483647>
+##contig=<ID=2,length=2147483647>
+##contig=<ID=20,length=2147483647>
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##INFO=<ID=XRF,Number=R,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAF,Number=A,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGF,Number=G,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XRI,Number=R,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAI,Number=A,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGI,Number=G,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XRS,Number=R,Type=String,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAS,Number=A,Type=String,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGS,Number=G,Type=String,Description="Test Number=AGR in INFO">
+##FORMAT=<ID=FRF,Number=R,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAF,Number=A,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FGF,Number=G,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRI,Number=R,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAI,Number=A,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FGI,Number=G,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRS,Number=R,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAS,Number=A,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FGS,Number=G,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FSTR,Number=1,Type=String,Description="Test String in FORMAT">
+##INFO=<ID=ISTR,Number=1,Type=String,Description="Test String in INFO">
+##FILTER=<ID=FAIL1,Description="Failed filter 1">
+##FILTER=<ID=FAIL2,Description="Failed filter 2">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	XY00001	XY00002
+1	105	.	TAAACCCTAAA	TAA	999	PASS	INDEL;AN=4;AC=2;DP=19;ISTR=SomeString;XRF=1e+06,2e+06;XRI=1111,2222;XRS=AAA,BBB;XAF=1e+06;XAI=1111;XAS=AAA;XGF=1e+06,2e+06,3e+06;XGI=1111,2222,3333;XGS=A,B,C	GT:PL:DP:FRF:FRI:FRS:FAF:FAI:FAS:FGF:FGI:FGS	1/0:1,2,3:1:1e+06,2e+06:1111,2222:AAAA,BBB:1e+06:1111:A:1e+06,2e+06,3e+06:1111,2222,3333:A,BB,CCC	1/0:1,2,3:1:1e+06,2e+06:1111,2222:AAAA,BBB:1e+06:1111:A:1e+06,2e+06,3e+06:1111,2222,3333:A,BB,CCC
+1	105	.	TAAACCCTAAA	TAACCCTAAA	999	PASS	INDEL;AN=4;AC=2;DP=19;ISTR=SomeString;XRF=1e+06,500000;XRI=1111,5555;XRS=AAA,DDD;XAF=500000;XAI=5555;XAS=DDD;XGF=1e+06,500000,9e+09;XGI=1111,5555,9999;XGS=A,E,F	GT:PL:DP:FRF:FRI:FRS:FAF:FAI:FAS:FGF:FGI:FGS	0/1:1,4,6:1:1e+06,500000:1111,5555:AAAA,CC:500000:5555:BB:1e+06,500000,9e+09:1111,5555,9999:A,EEEE,FFFFF	0/1:1,4,6:1:1e+06,500000:1111,5555:AAAA,CC:500000:5555:BB:1e+06,500000,9e+09:1111,5555,9999:A,EEEE,FFFFF
+2	1	.	GGGCGTCTCATAGCTGGAGCAATGGCGAGCGCCTGGACAAGGGAGGGGAAGGGGTTCTTATTACTGACGCGGGTAGCCCCTACTGCTGTGTGGTTCCCCTATTTTTTTTTTTTTCTTTTTGAGACGGAGTCTCGCTCTGTCACCCAGGCTGGAGTGCAGTGGCACAATCTCGGCTCACTGCAAGCTCCACCT	ACGT	999	PASS	INDEL;AN=4;AC=2	GT:DP	1/0:1	1/0:1
+2	101	.	ATTTTTTTTTTTTT	ATTTTTTTTTTTTTTT	999	PASS	INDEL;AN=4;AC=4	GT:DP	1/1:1	1/1:1
+2	114	.	TC	TTCC	999	FAIL1	INDEL;AN=4;AC=2	GT:DP	1/0:1	1/0:1
+2	114	.	TC	TTC	999	PASS	INDEL;AN=4;AC=2	GT:DP	0/1:1	0/1:1
+2	115	.	C	T	999	PASS	INDEL;AN=4;AC=4	GT:DP	1/1:1	1/1:1
+20	3	.	G	CT	999	PASS	INDEL;AN=4;AC=2	GT	0/1	0/1
+20	3	.	GATG	GACT	999	PASS	INDEL;AN=4;AC=2	GT	1/0	1/0
+20	5	.	TGGG	TAC	.	PASS	INDEL;AN=4;AC=2	GT:PL:DP	1/0:1,2,3:1	1/0:1,2,3:1
+20	5	id0001	TGGG	TG	.	PASS	INDEL;AN=4;AC=2	GT:PL:DP	0/1:1,4,6:1	0/1:1,4,6:1
+20	5	id0002	TGGG	TGGGG	.	PASS	INDEL;AN=4;AC=0	GT:PL:DP	0/0:1,7,10:1	0/0:1,7,10:1
+20	5	.	TGGG	AC	.	PASS	INDEL;AN=4;AC=0	GT:PL:DP	0/0:1,11,15:1	0/0:1,11,15:1
+20	59	id0003	AG	.	999	PASS	AN=4	GT:PL:DP	0/0:0:4	0/0:0:4
+20	80	.	CACAG	CACAT	999	PASS	AN=4;AC=2	GT:PL:DP	0/1:255,0,255:13	0/1:255,0,255:13
+20	81	.	A	C	999	PASS	AN=4;AC=2	GT:PL:DP	0/1:255,0,255:13	0/1:255,0,255:13
+20	95	.	TCACCG	ACACCG	999	PASS	AN=4;AC=2	GT:PL:DP	0/1:255,0,255:13	0/1:255,0,255:13
+20	95	.	TCACCG	AAAAAA	999	PASS	AN=4;AC=2	GT:PL:DP	0/1:255,0,255:13	0/1:255,0,255:13
+20	273	.	CAAAAAAAAAAAAAAAAAAAAA	CAAAAAAAAAAAAAAAAAAAAAAA	999	PASS	INDEL;AN=4;AC=2	GT:PL:DP	1/0:0,3,5:1	1/0:0,3,5:1
+20	273	.	CAAAAAAAAAAAAAAAAAAAAA	CAAAAAAAAAAAAAAAAAAAAAAAA	999	PASS	INDEL;AN=4;AC=2	GT:PL:DP	0/1:0,3,5:1	0/1:0,3,5:1
+20	274	.	AAAAAAAAA	AAAAAAAAAAAAAAAAAAA	999	PASS	INDEL;AN=0;AC=0	GT:PL:DP	./.:0,0,0:0	./.:0,0,0:0
+20	275	.	A	C	0	FAIL1	INDEL;AN=2;AC=0	GT:PL:DP:FGF:FGI:FGS:FSTR	0:0,0:0:1e+06,2e+06:1111,2222:A,BB:WORD	0:0,0:0:1e+06,2e+06:1111,2222:A,BB:WORD
+20	275	.	A	G	0	FAIL2	INDEL;AN=2;AC=2	GT:PL:DP:FGF:FGI:FGS:FSTR	1:0,0:0:1e+06,3e+06:1111,3333:A,CCC:WORD	1:0,0:0:1e+06,3e+06:1111,3333:A,CCC:WORD
+20	278	.	AAAAAAAAAAAAAAAAA	AAAAAAAAAAAAAAAAAAA	999	PASS	INDEL;AN=0;AC=0	GT:PL:DP	./.:0,0,0:0	./.:0,0,0:0
+20	300	.	A	C	998	PASS	INDEL;AN=0;AC=0	GT:PL:DP	./.:0,0,0:0	./.:0,0,0:0
+20	300	.	A	G	999	PASS	INDEL;AN=0;AC=0	GT:PL:DP	./.:0,0,0:0	./.:0,0,0:0
diff --git a/test/norm.out b/test/norm.out
new file mode 100644
index 0000000..6db87c1
--- /dev/null
+++ b/test/norm.out
@@ -0,0 +1,57 @@
+##fileformat=VCFv4.1
+##FILTER=<ID=PASS,Description="All filters passed">
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=PL,Number=G,Type=Integer,Description="Phred-scaled likelihood">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Depth">
+##contig=<ID=1,length=2147483647>
+##contig=<ID=2,length=2147483647>
+##contig=<ID=3,length=2147483647>
+##contig=<ID=4,length=2147483647>
+##contig=<ID=5,length=2147483647>
+##contig=<ID=20,length=2147483647>
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##INFO=<ID=XRF,Number=R,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAF,Number=A,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGF,Number=G,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XRI,Number=R,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAI,Number=A,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGI,Number=G,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XRS,Number=R,Type=String,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAS,Number=A,Type=String,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGS,Number=G,Type=String,Description="Test Number=AGR in INFO">
+##FORMAT=<ID=FRF,Number=R,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAF,Number=A,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FGF,Number=G,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRI,Number=R,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAI,Number=A,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FGI,Number=G,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRS,Number=R,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAS,Number=A,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FGS,Number=G,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FSTR,Number=1,Type=String,Description="Test String in FORMAT">
+##INFO=<ID=ISTR,Number=1,Type=String,Description="Test String in INFO">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	XY00001	XY00002
+1	105	.	TAAACCCTA	T,TAACCCTA	999	PASS	INDEL;AN=4;AC=2,2;DP=19;ISTR=SomeString;XRF=1e+06,2e+06,500000;XRI=1111,2222,5555;XRS=AAA,BBB,DDD;XAF=1e+06,500000;XAI=1111,5555;XAS=AAA,DDD;XGF=1e+06,2e+06,3e+06,500000,.,9e+09;XGI=1111,2222,3333,5555,.,9999;XGS=A,B,C,E,.,F	GT:PL:DP:FRF:FRI:FRS:FAF:FAI:FAS:FGF:FGI:FGS	1/2:1,2,3,4,5,6:1:1e+06,2e+06,500000:1111,2222,5555:AAAA,BBB,CC:1e+06,500000:1111,5555:A,BB:1e+06,2e+06,3e+06,500000,.,9e+09:1111,2222,3333,5555,.,9999:A,BB,CCC,EEEE,.,FFFFF	1/2:1,2,3, [...]
+2	1	.	GGGCGTCTCATAGCTGGAGCAATGGCGAGCGCCTGGACAAGGGAGGGGAAGGGGTTCTTATTACTGACGCGGGTAGCCCCTACTGCTGTGTGGTTCCCCTATTTTTTTTTTTTTCTTTTTGAGACGGAGTCTCGCTCTGTCACCCAGGCTGGAGTGCAGTGGCACAATCTCGGCTCACTGCAAGCTCCACC	ACG	999	PASS	INDEL;AN=4;AC=2	GT:DP	1/0:1	1/0:1
+2	101	.	A	ATT	999	PASS	INDEL;AN=4;AC=4	GT:DP	1/1:1	1/1:1
+2	114	.	T	TTC,TT	999	PASS	INDEL;AN=4;AC=2,2	GT:DP	1/2:1	1/2:1
+2	115	.	C	T	999	PASS	INDEL;AN=4;AC=4	GT:DP	1/1:1	1/1:1
+20	3	.	G	CT	999	PASS	INDEL;AN=4;AC=2	GT	0/1	0/1
+20	5	.	TG	CT	999	PASS	INDEL;AN=4;AC=2	GT	1/0	1/0
+20	5	.	TGGG	TAC,TG,TGGGG,AC	.	PASS	INDEL;AN=4;AC=2,2,0,0	GT:PL:DP	1/2:1,2,3,4,5,6,7,8,9,10,11,12,13,14,15:1	1/2:1,2,3,4,5,6,7,8,9,10,11,12,13,14,15:1
+20	59	.	AG	.	999	PASS	AN=4	GT:PL:DP	0/0:0:4	0/0:0:4
+20	81	.	A	C	999	PASS	AN=4;AC=2	GT:PL:DP	0/1:255,0,255:13	0/1:255,0,255:13
+20	84	.	G	T	999	PASS	AN=4;AC=2	GT:PL:DP	0/1:255,0,255:13	0/1:255,0,255:13
+20	95	.	T	A	999	PASS	AN=4;AC=2	GT:PL:DP	0/1:255,0,255:13	0/1:255,0,255:13
+20	95	.	TCACCG	AAAAAA	999	PASS	AN=4;AC=2	GT:PL:DP	0/1:255,0,255:13	0/1:255,0,255:13
+20	273	.	C	CAA,CAAA	999	PASS	INDEL;AN=4;AC=2,2	GT:PL:DP	1/2:0,3,5,3,5,5:1	1/2:0,3,5,3,5,5:1
+20	273	.	C	CAAAAAAAAAA	999	PASS	INDEL;AN=0;AC=0	GT:PL:DP	./.:0,0,0:0	./.:0,0,0:0
+20	273	.	C	CAA	999	PASS	INDEL;AN=0;AC=0	GT:PL:DP	./.:0,0,0:0	./.:0,0,0:0
+20	275	.	A	C,G	999	PASS	INDEL;AN=2;AC=0,2	GT:PL:DP:FGF:FGI:FGS:FSTR	2:0,0,0:0:1e+06,2e+06,3e+06:1111,2222,3333:A,BB,CCC:WORD	2:0,0,0:0:1e+06,2e+06,3e+06:1111,2222,3333:A,BB,CCC:WORD
+3	10	.	GTGGAC	GTGGACACAC,GTGGACAC,GTGGACACACAC,GTGG,GTGGACACACACAC,ATGGACACACAC	999	PASS	INDEL;AN=0	GT:DP	./.:0	./.:0
+3	17	.	CA	C	999	PASS	INDEL;AN=0	GT:DP	./.:0	./.:0
+4	36	.	TC	C,TT,TTC	999	PASS	INDEL;AN=0	GT:DP	./.:0	./.:0
+5	21	.	A	AAG	999	PASS	INDEL;AN=0	GT:DP	./.:0	./.:0
diff --git a/test/norm.split.out b/test/norm.split.out
new file mode 100644
index 0000000..cf70808
--- /dev/null
+++ b/test/norm.split.out
@@ -0,0 +1,59 @@
+##fileformat=VCFv4.1
+##FILTER=<ID=PASS,Description="All filters passed">
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=PL,Number=G,Type=Integer,Description="Phred-scaled likelihood">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Depth">
+##contig=<ID=1,length=2147483647>
+##contig=<ID=2,length=2147483647>
+##contig=<ID=20,length=2147483647>
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##INFO=<ID=XRF,Number=R,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAF,Number=A,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGF,Number=G,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XRI,Number=R,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAI,Number=A,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGI,Number=G,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XRS,Number=R,Type=String,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAS,Number=A,Type=String,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGS,Number=G,Type=String,Description="Test Number=AGR in INFO">
+##FORMAT=<ID=FRF,Number=R,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAF,Number=A,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FGF,Number=G,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRI,Number=R,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAI,Number=A,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FGI,Number=G,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRS,Number=R,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAS,Number=A,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FGS,Number=G,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FSTR,Number=1,Type=String,Description="Test String in FORMAT">
+##INFO=<ID=ISTR,Number=1,Type=String,Description="Test String in INFO">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	XY00001	XY00002
+1	105	.	TAAACCCTAAA	TAA	999	PASS	INDEL;AN=4;AC=2;DP=19;ISTR=SomeString;XRF=1e+06,2e+06;XRI=1111,2222;XRS=AAA,BBB;XAF=1e+06;XAI=1111;XAS=AAA;XGF=1e+06,2e+06,3e+06;XGI=1111,2222,3333;XGS=A,B,C	GT:PL:DP:FRF:FRI:FRS:FAF:FAI:FAS:FGF:FGI:FGS	1/0:1,2,3:1:1e+06,2e+06:1111,2222:AAAA,BBB:1e+06:1111:A:1e+06,2e+06,3e+06:1111,2222,3333:A,BB,CCC	1/0:1,2,3:1:1e+06,2e+06:1111,2222:AAAA,BBB:1e+06:1111:A:1e+06,2e+06,3e+06:1111,2222,3333:A,BB,CCC
+1	105	.	TAAACCCTAAA	TAACCCTAAA	999	PASS	INDEL;AN=4;AC=2;DP=19;ISTR=SomeString;XRF=1e+06,500000;XRI=1111,5555;XRS=AAA,DDD;XAF=500000;XAI=5555;XAS=DDD;XGF=1e+06,500000,9e+09;XGI=1111,5555,9999;XGS=A,E,F	GT:PL:DP:FRF:FRI:FRS:FAF:FAI:FAS:FGF:FGI:FGS	0/1:1,4,6:1:1e+06,500000:1111,5555:AAAA,CC:500000:5555:BB:1e+06,500000,9e+09:1111,5555,9999:A,EEEE,FFFFF	0/1:1,4,6:1:1e+06,500000:1111,5555:AAAA,CC:500000:5555:BB:1e+06,500000,9e+09:1111,5555,9999:A,EEEE,FFFFF
+2	1	.	GGGCGTCTCATAGCTGGAGCAATGGCGAGCGCCTGGACAAGGGAGGGGAAGGGGTTCTTATTACTGACGCGGGTAGCCCCTACTGCTGTGTGGTTCCCCTATTTTTTTTTTTTTCTTTTTGAGACGGAGTCTCGCTCTGTCACCCAGGCTGGAGTGCAGTGGCACAATCTCGGCTCACTGCAAGCTCCACCT	ACGT	999	PASS	INDEL;AN=4;AC=2	GT:DP	1/0:1	1/0:1
+2	101	.	ATTTTTTTTTTTTT	ATTTTTTTTTTTTTTT	999	PASS	INDEL;AN=4;AC=4	GT:DP	1/1:1	1/1:1
+2	114	.	TC	TTCC	999	PASS	INDEL;AN=4;AC=2	GT:DP	1/0:1	1/0:1
+2	114	.	TC	TTC	999	PASS	INDEL;AN=4;AC=2	GT:DP	0/1:1	0/1:1
+2	115	.	C	T	999	PASS	INDEL;AN=4;AC=4	GT:DP	1/1:1	1/1:1
+20	3	.	G	CT	999	PASS	INDEL;AN=4;AC=2	GT	0/1	0/1
+20	3	.	GATG	GACT	999	PASS	INDEL;AN=4;AC=2	GT	1/0	1/0
+20	5	.	TGGG	TAC	.	PASS	INDEL;AN=4;AC=2	GT:PL:DP	1/0:1,2,3:1	1/0:1,2,3:1
+20	5	.	TGGG	TG	.	PASS	INDEL;AN=4;AC=2	GT:PL:DP	0/1:1,4,6:1	0/1:1,4,6:1
+20	5	.	TGGG	TGGGG	.	PASS	INDEL;AN=4;AC=0	GT:PL:DP	0/0:1,7,10:1	0/0:1,7,10:1
+20	5	.	TGGG	AC	.	PASS	INDEL;AN=4;AC=0	GT:PL:DP	0/0:1,11,15:1	0/0:1,11,15:1
+20	59	.	AG	.	999	PASS	AN=4	GT:PL:DP	0/0:0:4	0/0:0:4
+20	80	.	CACAG	CACAT	999	PASS	AN=4;AC=2	GT:PL:DP	0/1:255,0,255:13	0/1:255,0,255:13
+20	81	.	A	C	999	PASS	AN=4;AC=2	GT:PL:DP	0/1:255,0,255:13	0/1:255,0,255:13
+20	95	.	TCACCG	ACACCG	999	PASS	AN=4;AC=2	GT:PL:DP	0/1:255,0,255:13	0/1:255,0,255:13
+20	95	.	TCACCG	AAAAAA	999	PASS	AN=4;AC=2	GT:PL:DP	0/1:255,0,255:13	0/1:255,0,255:13
+20	273	.	CAAAAAAAAAAAAAAAAAAAAA	CAAAAAAAAAAAAAAAAAAAAAAA	999	PASS	INDEL;AN=4;AC=2	GT:PL:DP	1/0:0,3,5:1	1/0:0,3,5:1
+20	273	.	CAAAAAAAAAAAAAAAAAAAAA	CAAAAAAAAAAAAAAAAAAAAAAAA	999	PASS	INDEL;AN=4;AC=2	GT:PL:DP	0/1:0,3,5:1	0/1:0,3,5:1
+20	274	.	AAAAAAAAA	AAAAAAAAAAAAAAAAAAA	999	PASS	INDEL;AN=0;AC=0	GT:PL:DP	./.:0,0,0:0	./.:0,0,0:0
+20	275	.	A	C	999	PASS	INDEL;AN=2;AC=0	GT:PL:DP:FGF:FGI:FGS:FSTR	0:0,0:0:1e+06,2e+06:1111,2222:A,BB:WORD	0:0,0:0:1e+06,2e+06:1111,2222:A,BB:WORD
+20	275	.	A	G	999	PASS	INDEL;AN=2;AC=2	GT:PL:DP:FGF:FGI:FGS:FSTR	1:0,0:0:1e+06,3e+06:1111,3333:A,CCC:WORD	1:0,0:0:1e+06,3e+06:1111,3333:A,CCC:WORD
+20	278	.	AAAAAAAAAAAAAAAAA	AAAAAAAAAAAAAAAAAAA	999	PASS	INDEL;AN=0;AC=0	GT:PL:DP	./.:0,0,0:0	./.:0,0,0:0
+20	300	.	A	C	999	PASS	INDEL;AN=0;AC=0	GT:PL:DP	./.:0,0,0:0	./.:0,0,0:0
+20	300	.	A	G	999	PASS	INDEL;AN=0;AC=0	GT:PL:DP	./.:0,0,0:0	./.:0,0,0:0
diff --git a/test/norm.split.vcf b/test/norm.split.vcf
new file mode 100644
index 0000000..6e55d18
--- /dev/null
+++ b/test/norm.split.vcf
@@ -0,0 +1,51 @@
+##fileformat=VCFv4.1
+##FILTER=<ID=PASS,Description="All filters passed">
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=PL,Number=G,Type=Integer,Description="Phred-scaled likelihood">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Depth">
+##contig=<ID=1,length=2147483647>
+##contig=<ID=2,length=2147483647>
+##contig=<ID=20,length=2147483647>
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##INFO=<ID=XRF,Number=R,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAF,Number=A,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGF,Number=G,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XRI,Number=R,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAI,Number=A,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGI,Number=G,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XRS,Number=R,Type=String,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAS,Number=A,Type=String,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGS,Number=G,Type=String,Description="Test Number=AGR in INFO">
+##FORMAT=<ID=FRF,Number=R,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAF,Number=A,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FGF,Number=G,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRI,Number=R,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAI,Number=A,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FGI,Number=G,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRS,Number=R,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAS,Number=A,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FGS,Number=G,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FSTR,Number=1,Type=String,Description="Test String in FORMAT">
+##INFO=<ID=ISTR,Number=1,Type=String,Description="Test String in INFO">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	XY00001	XY00002
+1	105	.	TAAACCCTAAA	TAA,TAACCCTAAA	999	PASS	INDEL;AN=4;AC=2,2;DP=19;ISTR=SomeString;XRF=1e+06,2e+06,500000;XRI=1111,2222,5555;XRS=AAA,BBB,DDD;XAF=1e+06,500000;XAI=1111,5555;XAS=AAA,DDD;XGF=1e+06,2e+06,3e+06,500000,.,9e+09;XGI=1111,2222,3333,5555,.,9999;XGS=A,B,C,E,.,F	GT:PL:DP:FRF:FRI:FRS:FAF:FAI:FAS:FGF:FGI:FGS	1/2:1,2,3,4,5,6:1:1e+06,2e+06,500000:1111,2222,5555:AAAA,BBB,CC:1e+06,500000:1111,5555:A,BB:1e+06,2e+06,3e+06,500000,.,9e+09:1111,2222,3333,5555,.,9999:A,BB,CCC,EEEE,.,FFFFF	1/2: [...]
+2	1	.	GGGCGTCTCATAGCTGGAGCAATGGCGAGCGCCTGGACAAGGGAGGGGAAGGGGTTCTTATTACTGACGCGGGTAGCCCCTACTGCTGTGTGGTTCCCCTATTTTTTTTTTTTTCTTTTTGAGACGGAGTCTCGCTCTGTCACCCAGGCTGGAGTGCAGTGGCACAATCTCGGCTCACTGCAAGCTCCACCT	ACGT	999	PASS	INDEL;AN=4;AC=2	GT:DP	1/0:1	1/0:1
+2	101	.	ATTTTTTTTTTTTT	ATTTTTTTTTTTTTTT	999	PASS	INDEL;AN=4;AC=4	GT:DP	1/1:1	1/1:1
+2	114	.	TC	TTCC,TTC	999	PASS	INDEL;AN=4;AC=2,2	GT:DP	1/2:1	1/2:1
+2	115	.	C	T	999	PASS	INDEL;AN=4;AC=4	GT:DP	1/1:1	1/1:1
+20	3	.	G	CT	999	PASS	INDEL;AN=4;AC=2	GT	0/1	0/1
+20	3	.	GATG	GACT	999	PASS	INDEL;AN=4;AC=2	GT	1/0	1/0
+20	5	.	TGGG	TAC,TG,TGGGG,AC	.	PASS	INDEL;AN=4;AC=2,2,0,0	GT:PL:DP	1/2:1,2,3,4,5,6,7,8,9,10,11,12,13,14,15:1	1/2:1,2,3,4,5,6,7,8,9,10,11,12,13,14,15:1
+20	59	.	AG	.	999	PASS	AN=4	GT:PL:DP	0/0:0:4	0/0:0:4
+20	80	.	CACAG	CACAT	999	PASS	AN=4;AC=2	GT:PL:DP	0/1:255,0,255:13	0/1:255,0,255:13
+20	81	.	A	C	999	PASS	AN=4;AC=2	GT:PL:DP	0/1:255,0,255:13	0/1:255,0,255:13
+20	95	.	TCACCG	ACACCG	999	PASS	AN=4;AC=2	GT:PL:DP	0/1:255,0,255:13	0/1:255,0,255:13
+20	95	.	TCACCG	AAAAAA	999	PASS	AN=4;AC=2	GT:PL:DP	0/1:255,0,255:13	0/1:255,0,255:13
+20	273	.	CAAAAAAAAAAAAAAAAAAAAA	CAAAAAAAAAAAAAAAAAAAAAAA,CAAAAAAAAAAAAAAAAAAAAAAAA	999	PASS	INDEL;AN=4;AC=2,2	GT:PL:DP	1/2:0,3,5,3,5,5:1	1/2:0,3,5,3,5,5:1
+20	274	.	AAAAAAAAA	AAAAAAAAAAAAAAAAAAA	999	PASS	INDEL;AN=0;AC=0	GT:PL:DP	./.:0,0,0:0	./.:0,0,0:0
+20	275	.	A	C,G	999	PASS	INDEL;AN=2;AC=0,2	GT:PL:DP:FGF:FGI:FGS:FSTR	2:0,0,0:0:1e+06,2e+06,3e+06:1111,2222,3333:A,BB,CCC:WORD	2:0,0,0:0:1e+06,2e+06,3e+06:1111,2222,3333:A,BB,CCC:WORD
+20	278	.	AAAAAAAAAAAAAAAAA	AAAAAAAAAAAAAAAAAAA	999	PASS	INDEL;AN=0;AC=0	GT:PL:DP	./.:0,0,0:0	./.:0,0,0:0
+20	300	.	A	C,G	999	PASS	INDEL;AN=0;AC=0,0	GT:PL:DP	./.:0,0,0,0,0,0:0	./.:0,0,0,0,0,0:0
diff --git a/test/norm.vcf b/test/norm.vcf
new file mode 100644
index 0000000..52f5f88
--- /dev/null
+++ b/test/norm.vcf
@@ -0,0 +1,57 @@
+##fileformat=VCFv4.1
+##FILTER=<ID=PASS,Description="All filters passed">
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=PL,Number=G,Type=Integer,Description="Phred-scaled likelihood">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Depth">
+##contig=<ID=1,length=2147483647>
+##contig=<ID=2,length=2147483647>
+##contig=<ID=3,length=2147483647>
+##contig=<ID=4,length=2147483647>
+##contig=<ID=5,length=2147483647>
+##contig=<ID=20,length=2147483647>
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##INFO=<ID=XRF,Number=R,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAF,Number=A,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGF,Number=G,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XRI,Number=R,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAI,Number=A,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGI,Number=G,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XRS,Number=R,Type=String,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAS,Number=A,Type=String,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGS,Number=G,Type=String,Description="Test Number=AGR in INFO">
+##FORMAT=<ID=FRF,Number=R,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAF,Number=A,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FGF,Number=G,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRI,Number=R,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAI,Number=A,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FGI,Number=G,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRS,Number=R,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAS,Number=A,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FGS,Number=G,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FSTR,Number=1,Type=String,Description="Test String in FORMAT">
+##INFO=<ID=ISTR,Number=1,Type=String,Description="Test String in INFO">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	XY00001	XY00002
+1	105	.	TAAACCCTAAA	TAA,TAACCCTAAA	999	PASS	INDEL;AN=4;AC=2,2;DP=19;ISTR=SomeString;XRF=1e+06,2e+06,500000;XRI=1111,2222,5555;XRS=AAA,BBB,DDD;XAF=1e+06,500000;XAI=1111,5555;XAS=AAA,DDD;XGF=1e+06,2e+06,3e+06,500000,.,9e+09;XGI=1111,2222,3333,5555,.,9999;XGS=A,B,C,E,.,F	GT:PL:DP:FRF:FRI:FRS:FAF:FAI:FAS:FGF:FGI:FGS	1/2:1,2,3,4,5,6:1:1e+06,2e+06,500000:1111,2222,5555:AAAA,BBB,CC:1e+06,500000:1111,5555:A,BB:1e+06,2e+06,3e+06,500000,.,9e+09:1111,2222,3333,5555,.,9999:A,BB,CCC,EEEE,.,FFFFF	1/2: [...]
+2	1	.	GGGCGTCTCATAGCTGGAGCAATGGCGAGCGCCTGGACAAGGGAGGGGAAGGGGTTCTTATTACTGACGCGGGTAGCCCCTACTGCTGTGTGGTTCCCCTATTTTTTTTTTTTTCTTTTTGAGACGGAGTCTCGCTCTGTCACCCAGGCTGGAGTGCAGTGGCACAATCTCGGCTCACTGCAAGCTCCACCT	ACGT	999	PASS	INDEL;AN=4;AC=2	GT:DP	1/0:1	1/0:1
+2	101	.	ATTTTTTTTTTTTT	ATTTTTTTTTTTTTTT	999	PASS	INDEL;AN=4;AC=4	GT:DP	1/1:1	1/1:1
+2	114	.	TC	TTCC,TTC	999	PASS	INDEL;AN=4;AC=2,2	GT:DP	1/2:1	1/2:1
+2	115	.	C	T	999	PASS	INDEL;AN=4;AC=4	GT:DP	1/1:1	1/1:1
+20	3	.	G	CT	999	PASS	INDEL;AN=4;AC=2	GT	0/1	0/1
+20	3	.	GATG	GACT	999	PASS	INDEL;AN=4;AC=2	GT	1/0	1/0
+20	5	.	TGGG	TAC,TG,TGGGG,AC	.	PASS	INDEL;AN=4;AC=2,2,0,0	GT:PL:DP	1/2:1,2,3,4,5,6,7,8,9,10,11,12,13,14,15:1	1/2:1,2,3,4,5,6,7,8,9,10,11,12,13,14,15:1
+20	59	.	AG	.	999	PASS	AN=4	GT:PL:DP	0/0:0:4	0/0:0:4
+20	80	.	CACAG	CACAT	999	PASS	AN=4;AC=2	GT:PL:DP	0/1:255,0,255:13	0/1:255,0,255:13
+20	81	.	A	C	999	PASS	AN=4;AC=2	GT:PL:DP	0/1:255,0,255:13	0/1:255,0,255:13
+20	95	.	TCACCG	ACACCG	999	PASS	AN=4;AC=2	GT:PL:DP	0/1:255,0,255:13	0/1:255,0,255:13
+20	95	.	TCACCG	AAAAAA	999	PASS	AN=4;AC=2	GT:PL:DP	0/1:255,0,255:13	0/1:255,0,255:13
+20	273	.	CAAAAAAAAAAAAAAAAAAAAA	CAAAAAAAAAAAAAAAAAAAAAAA,CAAAAAAAAAAAAAAAAAAAAAAAA	999	PASS	INDEL;AN=4;AC=2,2	GT:PL:DP	1/2:0,3,5,3,5,5:1	1/2:0,3,5,3,5,5:1
+20	274	.	AAAAAAAAA	AAAAAAAAAAAAAAAAAAA	999	PASS	INDEL;AN=0;AC=0	GT:PL:DP	./.:0,0,0:0	./.:0,0,0:0
+20	275	.	A	C,G	999	PASS	INDEL;AN=2;AC=0,2	GT:PL:DP:FGF:FGI:FGS:FSTR	2:0,0,0:0:1e+06,2e+06,3e+06:1111,2222,3333:A,BB,CCC:WORD	2:0,0,0:0:1e+06,2e+06,3e+06:1111,2222,3333:A,BB,CCC:WORD
+20	278	.	AAAAAAAAAAAAAAAAA	AAAAAAAAAAAAAAAAAAA	999	PASS	INDEL;AN=0;AC=0	GT:PL:DP	./.:0,0,0:0	./.:0,0,0:0
+3	10	.	GTGGAC	GTGGACACAC,GTGGACAC,GTGGACACACAC,GTGG,GTGGACACACACAC,ATGGACACACAC	999	PASS	INDEL;AN=0	GT:DP	./.:0	./.:0
+3	15	.	CACA	CAC	999	PASS	INDEL;AN=0	GT:DP	./.:0	./.:0
+4	21	.	ATTTTTTTTTTTTTTTC	ATTTTTTTTTTTTTTC,ATTTTTTTTTTTTTTTT,ATTTTTTTTTTTTTTTTC	999	PASS	INDEL;AN=0	GT:DP	./.:0	./.:0
+5	22	.	A	AGA	999	PASS	INDEL;AN=0	GT:DP	./.:0	./.:0
diff --git a/test/plugin-missing2ref.out.vcf b/test/plugin-missing2ref.out.vcf
new file mode 100644
index 0000000..2e8d1b9
--- /dev/null
+++ b/test/plugin-missing2ref.out.vcf
@@ -0,0 +1,30 @@
+##fileformat=VCFv4.1
+##FILTER=<ID=PASS,Description="All filters passed">
+##INFO=<ID=TEST,Number=1,Type=Integer,Description="Testing Tag">
+##FORMAT=<ID=TT,Number=A,Type=Integer,Description="Testing Tag, with commas and \"escapes\" and escaped escapes combined with \\\"quotes\\\\\"">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=GL,Number=G,Type=Float,Description="Genotype Likelihood">
+##FILTER=<ID=q10,Description="Quality below 10">
+##FILTER=<ID=test,Description="Testing filter">
+##contig=<ID=1,assembly=b37,length=249250621>
+##contig=<ID=2,assembly=b37,length=249250621>
+##contig=<ID=3,assembly=b37,length=198022430>
+##contig=<ID=4,assembly=b37,length=191154276>
+##test=<ID=4,IE=5>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##readme=AAAAAA
+##readme=BBBBBB
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##INFO=<ID=STR,Number=1,Type=String,Description="Test string type">
+##bcftools_pluginCommand=plugin missing2ref -o test.out.vcf -- missing2ref -p -m
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B	C	D
+1	3000150	.	C	T	59.2	PASS	.	GT:GQ	1|1:245	1|1:245	0/1:245	1/1:245
+1	3000151	.	C	T	59.2	PASS	.	GT:DP:GQ	0|0:32:245	0|0:32:245	0|0:32:245	0|0:32:245
+1	3062915	id3D	GTTT	G	12.9	q10	DP4=1,2,3,4;INDEL;STR=test	GT:GQ:DP:GL	0/1:409:35:-20,-5,-20	0/1:409:35:-20,-5,-20	0/1:409:35:-20,-5,-20	0/1:409:35:-20,-5,-20
+1	3062915	idSNP	G	T,C	12.6	test	TEST=5;DP4=1,2,3,4	GT:TT:GQ:DP:GL	0/1:0,1:409:35:-20,-5,-20,-20,-5,-20	2:0,1:409:35:-20,-5,-20	2/2:0,1:409:35:-20,-5,-20	2|2:0,1:409:35:-20,-5,-20
+2	3199812	.	G	GTT,GT	82.7	PASS	.	GT:GQ:DP	0|0:322:26	0|0:322:26	0|0:322:26	0|0:322:26
+3	3212016	.	CTT	C,CT	79	PASS	.	GT:GQ:DP	0|0:91:26	0|0:91:26	0|0:91:26	0|0:91:26
+4	3258448	.	TACACACAC	T	59.9	PASS	.	GT:GQ:DP	0|0:325:31	0|0:325:31	0|0:325:31	0|0:325:31
diff --git a/test/plugin-missing2ref.vcf b/test/plugin-missing2ref.vcf
new file mode 100644
index 0000000..2fe8c0a
--- /dev/null
+++ b/test/plugin-missing2ref.vcf
@@ -0,0 +1,29 @@
+##fileformat=VCFv4.1
+##FILTER=<ID=PASS,Description="All filters passed">
+##INFO=<ID=TEST,Number=1,Type=Integer,Description="Testing Tag">
+##FORMAT=<ID=TT,Number=A,Type=Integer,Description="Testing Tag, with commas and \"escapes\" and escaped escapes combined with \\\"quotes\\\\\"">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=GL,Number=G,Type=Float,Description="Genotype Likelihood">
+##FILTER=<ID=q10,Description="Quality below 10">
+##FILTER=<ID=test,Description="Testing filter">
+##contig=<ID=1,assembly=b37,length=249250621>
+##contig=<ID=2,assembly=b37,length=249250621>
+##contig=<ID=3,assembly=b37,length=198022430>
+##contig=<ID=4,assembly=b37,length=191154276>
+##test=<ID=4,IE=5>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##readme=AAAAAA
+##readme=BBBBBB
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##INFO=<ID=STR,Number=1,Type=String,Description="Test string type">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B	C	D
+1	3000150	.	C	T	59.2	PASS	.	GT:GQ	./.:245	./.:245	0/1:245	1/1:245
+1	3000151	.	C	T	59.2	PASS	.	GT:DP:GQ	./.:32:245	./.:32:245	0|0:32:245	0|0:32:245
+1	3062915	id3D	GTTT	G	12.9	q10	DP4=1,2,3,4;INDEL;STR=test	GT:GQ:DP:GL	0/1:409:35:-20,-5,-20	0/1:409:35:-20,-5,-20	0/1:409:35:-20,-5,-20	0/1:409:35:-20,-5,-20
+1	3062915	idSNP	G	T,C	12.6	test	TEST=5;DP4=1,2,3,4	GT:TT:GQ:DP:GL	0/1:0,1:409:35:-20,-5,-20,-20,-5,-20	2:0,1:409:35:-20,-5,-20	2/2:0,1:409:35:-20,-5,-20	./.:0,1:409:35:-20,-5,-20
+2	3199812	.	G	GTT,GT	82.7	PASS	.	GT:GQ:DP	./.:322:26	./.:322:26	./.:322:26	./.:322:26
+3	3212016	.	CTT	C,CT	79	PASS	.	GT:GQ:DP	./.:91:26	./.:91:26	./.:91:26	./.:91:26
+4	3258448	.	TACACACAC	T	59.9	PASS	.	GT:GQ:DP	./.:325:31	./.:325:31	./.:325:31	./.:325:31
diff --git a/test/plugin1.vcf b/test/plugin1.vcf
new file mode 100644
index 0000000..e639868
--- /dev/null
+++ b/test/plugin1.vcf
@@ -0,0 +1,36 @@
+##fileformat=VCFv4.1
+##FILTER=<ID=PASS,Description="All filters passed">
+##INFO=<ID=TEST,Number=1,Type=Integer,Description="Testing Tag">
+##FORMAT=<ID=TT,Number=A,Type=Integer,Description="Testing Tag, with commas and \"escapes\" and escaped escapes combined with \\\"quotes\\\\\"">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=GL,Number=G,Type=Float,Description="Genotype Likelihood">
+##FILTER=<ID=q10,Description="Quality below 10">
+##FILTER=<ID=test,Description="Testing filter">
+##contig=<ID=1,assembly=b37,length=249250621>
+##contig=<ID=2,assembly=b37,length=249250621>
+##contig=<ID=3,assembly=b37,length=198022430>
+##contig=<ID=4,assembly=b37,length=191154276>
+##test=<ID=4,IE=5>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##readme=AAAAAA
+##readme=BBBBBB
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##INFO=<ID=STR,Number=1,Type=String,Description="Test string type">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B
+1	3000150	.	C	T	59.2	PASS	.	GT:GQ	./.:245	./.:245
+1	3000151	.	C	T	59.2	PASS	.	GT:DP:GQ	./.:32:245	./.:32:245
+1	3062915	id3D	GTTT	G	12.9	q10	DP4=1,2,3,4;INDEL;STR=test	GT:GQ:DP:GL	0/1:409:35:-20,-5,-20	0/1:409:35:-20,-5,-20
+1	3062915	idSNP	G	T,C	12.6	test	TEST=5;DP4=1,2,3,4	GT:TT:GQ:DP:GL	0/1:0,1:409:35:-20,-5,-20,-20,-5,-20	2:0,1:409:35:-20,-5,-20
+1	3106154	.	CAAA	C	342	PASS	.	GT:GQ:DP	./.:245:32	./.:245:32
+1	3106154	.	C	CT	59.2	PASS	.	GT:GQ:DP	./.:245:32	./.:245:32
+1	3157410	.	GA	G	90.6	q10	.	GT:GQ:DP	1/1:21:21	1/1:21:21
+1	3162006	.	GAA	G	60.2	PASS	.	GT:GQ:DP	./.:212:22	./.:212:22
+1	3177144	.	G	T	45	PASS	.	GT:GQ:DP	./.:150:30	./.:150:30
+1	3177144	.	G	.	45	PASS	.	GT:GQ:DP	./.:150:30	./.:150:30
+1	3184885	.	TAAAA	TA,T	61.5	PASS	.	GT:GQ:DP	./.:12:10	./.:12:10
+2	3199812	.	G	GTT,GT	82.7	PASS	.	GT:GQ:DP	./.:322:26	./.:322:26
+3	3212016	.	CTT	C,CT	79	PASS	.	GT:GQ:DP	./.:91:26	./.:91:26
+4	3258448	.	TACACACAC	T	59.9	PASS	.	GT:GQ:DP	./.:325:31	./.:325:31
diff --git a/test/query.10.out b/test/query.10.out
new file mode 100644
index 0000000..fb8c4e4
--- /dev/null
+++ b/test/query.10.out
@@ -0,0 +1 @@
+3258449 1/1 0/1
diff --git a/test/query.11.out b/test/query.11.out
new file mode 100644
index 0000000..d9a859d
--- /dev/null
+++ b/test/query.11.out
@@ -0,0 +1,2 @@
+3062915 0/1 0/2
+3258449 1/1 0/1
diff --git a/test/query.12.out b/test/query.12.out
new file mode 100644
index 0000000..d1292d9
--- /dev/null
+++ b/test/query.12.out
@@ -0,0 +1,5 @@
+I8=. I16=. I32=. IF=. IA8=. IA16=. IA32=. IAF=. IA8=. IA16=. IA32=. IAF=.  .:.:.:. .:.:.:.
+I8=. I16=. I32=. IF=. IA8=. IA16=. IA32=. IAF=. IA8=. IA16=. IA32=. IAF=.  .:.:.:. .:.:.:.
+I8=. I16=. I32=. IF=. IA8=10,. IA16=1000,. IA32=100000,. IAF=0.003,. IA8=. IA16=. IA32=. IAF=.  10:1000:100000:0.003 .:.:.:.
+I8=. I16=. I32=. IF=. IA8=. IA16=. IA32=. IAF=. IA8=. IA16=. IA32=. IAF=.  10:1000:100000:0.003 .:.:.:.
+I8=. I16=. I32=. IF=. IA8=. IA16=. IA32=. IAF=. IA8=. IA16=. IA32=. IAF=.  10:1000:100000:0.003 .:.:.:.
diff --git a/test/query.13.out b/test/query.13.out
new file mode 100644
index 0000000..c2651d4
--- /dev/null
+++ b/test/query.13.out
@@ -0,0 +1,3 @@
+3000151 1 0
+3000152 0 1
+3000153 1 1
diff --git a/test/query.14.out b/test/query.14.out
new file mode 100644
index 0000000..a3b53bc
--- /dev/null
+++ b/test/query.14.out
@@ -0,0 +1,3 @@
+3000150 0 0
+3000151 1 0
+3000152 0 1
diff --git a/test/query.15.out b/test/query.15.out
new file mode 100644
index 0000000..b601ad9
--- /dev/null
+++ b/test/query.15.out
@@ -0,0 +1 @@
+3000150 0 0
diff --git a/test/query.16.out b/test/query.16.out
new file mode 100644
index 0000000..2e18f68
--- /dev/null
+++ b/test/query.16.out
@@ -0,0 +1 @@
+3000153 1 1
diff --git a/test/query.17.out b/test/query.17.out
new file mode 100644
index 0000000..93a4845
--- /dev/null
+++ b/test/query.17.out
@@ -0,0 +1 @@
+1 2 3 4
diff --git a/test/query.2.out b/test/query.2.out
new file mode 100644
index 0000000..904574b
--- /dev/null
+++ b/test/query.2.out
@@ -0,0 +1 @@
+1111,2222,3333
diff --git a/test/query.2.vcf b/test/query.2.vcf
new file mode 100644
index 0000000..dbcd97c
--- /dev/null
+++ b/test/query.2.vcf
@@ -0,0 +1,11 @@
+##fileformat=VCFv4.1
+##INFO=<ID=TEST,Number=1,Type=Integer,Description="Testing Tag">
+##INFO=<ID=XX_A,Number=1,Type=Integer,Description="Testing Tag">
+##INFO=<ID=XX.A,Number=1,Type=Integer,Description="Testing Tag">
+##INFO=<ID=XX.A0,Number=1,Type=Integer,Description="Testing Tag">
+##INFO=<ID=xx.a0,Number=1,Type=Integer,Description="Testing Tag">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Testing Tag">
+##contig=<ID=1,assembly=b37,length=249250621>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	C	D
+1	3062915	.	GTTT	G	48.7	.	XX_A=1;XX.A=2;XX.A0=3;xx.a0=4	GT	0/1	0/1
diff --git a/test/query.3.out b/test/query.3.out
new file mode 100644
index 0000000..85c3b81
--- /dev/null
+++ b/test/query.3.out
@@ -0,0 +1 @@
+1e+06,2e+06,3e+06
diff --git a/test/query.4.out b/test/query.4.out
new file mode 100644
index 0000000..4995c78
--- /dev/null
+++ b/test/query.4.out
@@ -0,0 +1 @@
+ABC,DEF,GHI,JKL,MNO,PQR
diff --git a/test/query.5.out b/test/query.5.out
new file mode 100644
index 0000000..34eb7c5
--- /dev/null
+++ b/test/query.5.out
@@ -0,0 +1,2 @@
+3106154 C CT
+3212016 CTT C,CT
diff --git a/test/query.6.out b/test/query.6.out
new file mode 100644
index 0000000..a616d26
--- /dev/null
+++ b/test/query.6.out
@@ -0,0 +1,4 @@
+3062915 G C,T
+3184885 TAAAA TA,T
+3199812 G GTT,GT
+3212016 CTT C,CT
diff --git a/test/query.7.out b/test/query.7.out
new file mode 100644
index 0000000..f476c62
--- /dev/null
+++ b/test/query.7.out
@@ -0,0 +1 @@
+3106154 0
diff --git a/test/query.8.out b/test/query.8.out
new file mode 100644
index 0000000..f327bf8
--- /dev/null
+++ b/test/query.8.out
@@ -0,0 +1,3 @@
+3062915 -20,-5,-20 -10,-5,-20
+3062915 -20,-5,-20,-20,-5,-20 -10,-5,-20,-20,-5,-20
+3062915 -20,-5,-20 -10,-5,-20
diff --git a/test/query.9.out b/test/query.9.out
new file mode 100644
index 0000000..7135f88
--- /dev/null
+++ b/test/query.9.out
@@ -0,0 +1 @@
+3162007 1X4M,1X3M1X
diff --git a/test/query.filter.vcf b/test/query.filter.vcf
new file mode 100644
index 0000000..b43d70a
--- /dev/null
+++ b/test/query.filter.vcf
@@ -0,0 +1,20 @@
+##fileformat=VCFv4.1
+##INFO=<ID=TEST,Number=1,Type=Integer,Description="Testing Tag">
+##FORMAT=<ID=TT,Number=A,Type=Integer,Description="Testing Tag, with commas and \"escapes\" and escaped escapes combined with \\\"quotes\\\\\"">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=GL,Number=G,Type=Float,Description="Genotype Likelihood">
+##FILTER=<ID=q10,Description="Quality below 10">
+##FILTER=<ID=test,Description="Testing filter">
+##contig=<ID=1,assembly=b37,length=249250621>
+##contig=<ID=2,assembly=b37,length=249250621>
+##contig=<ID=3,assembly=b37,length=198022430>
+##contig=<ID=4,assembly=b37,length=191154276>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B
+1	3000150	.	C	T	59.2	PASS	.	GT	0	0
+1	3000151	.	C	T	59.2	PASS	.	GT	1	0
+1	3000152	.	C	T	59.2	PASS	.	GT	0	1
+1	3000153	.	C	T	59.2	PASS	.	GT	1	1
diff --git a/test/query.out b/test/query.out
new file mode 100644
index 0000000..119849c
--- /dev/null
+++ b/test/query.out
@@ -0,0 +1,13 @@
+1	3062915	GTTT	G	1,2,3,4	4	0/1	GTTT/G	0/1	GTTT/G
+1	3062915	G	C,T	1,2,3,4	4	0/1	G/C	0/2	G/T
+1	3062915	GTT	G	1,2,3,4	4	0/1	GTT/G	0/1	GTT/G
+1	3106154	CAAA	C	.	0	.	.	./.	./.
+1	3106154	C	CT	.	4	0/1	C/CT	0/1	C/CT
+1	3157410	G	T	.	4	1/1	T/T	1/1	T/T
+1	3162006	GAA	G	.	4	0/1	GAA/G	0/1	GAA/G
+1	3177144	G	.	.	4	0/0	G/G	0/0	G/G
+1	3184885	TAAAA	TA,T	.	4	1/2	TA/T	1/2	TA/T
+2	3199812	G	GTT,GT	.	4	1/2	GTT/GT	1/2	GTT/GT
+3	3212016	CTT	C,CT	.	4	1/2	C/CT	1/2	C/CT
+4	3258448	TACACACAC	T	.	4	0/1	TACACACAC/T	0/1	TACACACAC/T
+4	3258449	A	C	.	4	1/1	C/C	0/1	A/C
diff --git a/test/query.vcf b/test/query.vcf
new file mode 100644
index 0000000..d2fffeb
--- /dev/null
+++ b/test/query.vcf
@@ -0,0 +1,33 @@
+##fileformat=VCFv4.1
+##INFO=<ID=TEST,Number=1,Type=Integer,Description="Testing Tag">
+##FORMAT=<ID=TT,Number=A,Type=Integer,Description="Testing Tag, with commas and \"escapes\" and escaped escapes combined with \\\"quotes\\\\\"">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=GL,Number=G,Type=Float,Description="Genotype Likelihood">
+##FILTER=<ID=q10,Description="Quality below 10">
+##FILTER=<ID=test,Description="Testing filter">
+##contig=<ID=1,assembly=b37,length=249250621>
+##contig=<ID=3,assembly=b37,length=198022430>
+##contig=<ID=4,assembly=b37,length=191154276>
+##contig=<ID=2,assembly=b37,length=249250621>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##readme=AAAAAA
+##readme=BBBBBB
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	C	D
+1	3062915	id3D	GTTT	G	48.7	q10	DP4=1,2,3,4;AN=4;AC=2	GT:GQ:DP:GL	0/1:409:35:-20,-5,-20	0/1:109:25:-10,-5,-20
+1	3062915	idSNP	G	C,T	419	test	TEST=5;DP4=1,2,3,4;AN=4;AC=1,1	GT:TT:GQ:DP:GL	0/1:0,1:409:35:-20,-5,-20,-20,-5,-20	0/2:0,1:109:35:-10,-5,-20,-20,-5,-20
+1	3062915	id2D	GTT	G	999	q10	DP4=1,2,3,4;AN=4;AC=2	GT:GQ:DP:GL	0/1:409:35:-20,-5,-20	0/1:109:25:-10,-5,-20
+1	3106154	.	CAAA	C	72.6	PASS	AN=0;AC=0	GT:GQ:DP	.:245:32	./.:145:22
+1	3106154	.	C	CT	459	PASS	AN=4;AC=2	GT:GQ:DP	0/1:245:32	0/1:145:22
+1	3157410	.	G	T	46.7	q10	AN=4;AC=4	GT:GQ:DP	1/1:21:21	1/1:11:11
+1	3162006	.	GAA	G	206	PASS	AN=4;AC=2	GT:GQ:DP	0/1:212:22	0/1:112:12
+1	3177144	.	G	.	364	PASS	AN=4;AC=0	GT:GQ:DP	0/0:150:30	0/0:150:20
+1	3184885	.	TAAAA	TA,T	8.42	PASS	AN=4;AC=2,2	GT:GQ:DP	1/2:22:20	1/2:12:10
+2	3199812	.	G	GTT,GT	291	PASS	AN=4;AC=2,2	GT:GQ:DP	1/2:322:26	1/2:122:16
+3	3212016	.	CTT	C,CT	52.5	PASS	AN=4;AC=2,2	GT:GQ:DP	1/2:91:26	1/2:11:16
+4	3258448	.	TACACACAC	T	123	PASS	AN=4;AC=2	GT:GQ:DP	0/1:325:31	0/1:125:11
+4	3258449	.	A	C	123	PASS	AN=4;AC=3	GT:GQ:DP	1/1:325:31	0/1:125:11
diff --git a/test/regions.out b/test/regions.out
new file mode 100644
index 0000000..ba45b84
--- /dev/null
+++ b/test/regions.out
@@ -0,0 +1,10 @@
+1 3062915 GTT,G
+1 3062915 G,T
+1 3106154 CA,C
+1 3106154 C,T,CT
+1 3157410 G,A
+1 3162006 G,A
+1 3184885 T,TA
+2 3199815 C,T
+3 3212016 C,A
+3 3212036 C,A
diff --git a/test/regions.tab b/test/regions.tab
new file mode 100644
index 0000000..514dc36
--- /dev/null
+++ b/test/regions.tab
@@ -0,0 +1,8 @@
+1	3062915	3062915
+1	3106154	3106154
+1	3157410	3157410
+1	3162006	3162006
+1	3184885	3184885
+2	3199815	3199815
+3	3212016	3212016
+3	3212036	3212036
diff --git a/test/regions.vcf b/test/regions.vcf
new file mode 100644
index 0000000..d5613c1
--- /dev/null
+++ b/test/regions.vcf
@@ -0,0 +1,29 @@
+##fileformat=VCFv4.1
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=GL,Number=G,Type=Float,Description="Genotype Likelihood">
+##FILTER=<ID=q10,Description="Quality below 10">
+##test=<xx=A,yy=B,zz=C>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##contig=<ID=1,length=249250621>
+##contig=<ID=2,length=243199373>
+##contig=<ID=3,length=243199373>
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A
+1	3062915	.	GTT	G	1806	q10	DP=35;DP4=1,2,3,4;AN=2;AC=1	GT:GQ:DP:GL	0/1:409:35:-20,-5,-20
+1	3062915	.	G	T	1806	q10	DP=35;DP4=1,2,3,4;AN=2;AC=1	GT:GQ:DP:GL	0/1:409:35:-20,-5,-20
+1	3106154	.	CA	C	1792	PASS	DP=32;AN=2;AC=1	GT:GQ:DP	0/1:245:32
+1	3106154	.	C	T,CT	1792	PASS	DP=32;AN=2;AC=1	GT:GQ:DP	0/1:245:32
+1	3157410	.	G	A	628	q10	DP=21;AN=2;AC=2	GT:GQ:DP	1/1:21:21
+1	3162006	.	G	A	1016	PASS	DP=22;AN=2;AC=1	GT:GQ:DP	0/1:212:22
+1	3177144	.	GT	G	727	PASS	DP=30;AN=2;AC=1	GT:GQ:DP	0/1:150:30
+1	3184885	.	T	TA	246	PASS	DP=10;AN=2;AC=1,1	GT:GQ:DP	1/2:12:10
+2	3199812	.	G	T	481	PASS	DP=26;AN=2;AC=1,1	GT:GQ:DP	1/2:322:26
+2	3199815	.	C	T	481	PASS	DP=26;AN=2;AC=1,1	GT:GQ:DP	1/2:322:26
+3	3212016	.	C	A	565	PASS	DP=26;AN=2;AC=1,1	GT:GQ:DP	1/2:91:26
+3	3212026	.	C	A	565	PASS	DP=26;AN=2;AC=1,1	GT:GQ:DP	1/2:91:26
+3	3212036	.	C	A	565	PASS	DP=26;AN=2;AC=1,1	GT:GQ:DP	1/2:91:26
diff --git a/test/reheader.1.out b/test/reheader.1.out
new file mode 100644
index 0000000..61d244d
--- /dev/null
+++ b/test/reheader.1.out
@@ -0,0 +1,38 @@
+##fileformat=VCFv4.2
+##FILTER=<ID=PASS,Description="All filters passed">
+##INFO=<ID=DP2,Number=2,Type=Integer,Description="Depth">
+##FILTER=<ID=Test,Description="Test filter">
+##FORMAT=<ID=DP2,Number=2,Type=Integer,Description="Depth">
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=PL,Number=G,Type=Integer,Description="Phred-scaled likelihood">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Depth">
+##contig=<ID=12,length=123456789>
+##contig=<ID=20,length=2147483647>
+##contig=<ID=5,length=2147483647>
+##contig=<ID=1,length=2147483647>
+##contig=<ID=2,length=2147483647>
+##contig=<ID=3,length=2147483647>
+##contig=<ID=4,length=2147483647>
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	AAA0001	BBB0002
+2	101	.	ATTTTTTTTTTTTT	ATTTTTTTTTTTTTTT	999	PASS	INDEL;AN=4;AC=4	GT:DP	1/1:1	1/1:1
+2	114	.	TC	TTCC,TTC	999	PASS	INDEL;AN=4;AC=2,2	GT:DP	1/2:1	1/2:1
+2	115	.	C	T	999	PASS	INDEL;AN=4;AC=4	GT:DP	1/1:1	1/1:1
+20	3	.	G	CT	999	PASS	INDEL;AN=4;AC=2	GT	0/1	0/1
+20	3	.	GATG	GACT	999	PASS	INDEL;AN=4;AC=2	GT	1/0	1/0
+20	5	.	TGGG	TAC,TG,TGGGG,AC	.	PASS	INDEL;AN=4;AC=2,2,0,0	GT:PL:DP	1/2:1,2,3,4,5,6,7,8,9,10,11,12,13,14,15:1	1/2:1,2,3,4,5,6,7,8,9,10,11,12,13,14,15:1
+20	59	.	AG	.	999	PASS	AN=4	GT:PL:DP	0/0:0:4	0/0:0:4
+20	80	.	CACAG	CACAT	999	PASS	AN=4;AC=2	GT:PL:DP	0/1:255,0,255:13	0/1:255,0,255:13
+20	81	.	A	C	999	PASS	AN=4;AC=2	GT:PL:DP	0/1:255,0,255:13	0/1:255,0,255:13
+20	95	.	TCACCG	ACACCG	999	PASS	AN=4;AC=2	GT:PL:DP	0/1:255,0,255:13	0/1:255,0,255:13
+20	95	.	TCACCG	AAAAAA	999	Test	AN=4;AC=2	GT:PL:DP	0/1:255,0,255:13	0/1:255,0,255:13
+20	273	.	CAAAAAAAAAAAAAAAAAAAAA	CAAAAAAAAAAAAAAAAAAAAAAA,CAAAAAAAAAAAAAAAAAAAAAAAA	999	PASS	INDEL;AN=4;AC=2,2	GT:PL:DP	1/2:0,3,5,3,5,5:1	1/2:0,3,5,3,5,5:1
+20	274	.	AAAAAAAAA	AAAAAAAAAAAAAAAAAAA	999	PASS	INDEL;AN=0;AC=0	GT:PL:DP	./.:0,0,0:0	./.:0,0,0:0
+20	278	.	AAAAAAAAAAAAAAAAA	AAAAAAAAAAAAAAAAAAA	999	PASS	INDEL;AN=0;AC=0	GT:PL:DP	./.:0,0,0:0	./.:0,0,0:0
+3	10	.	GTGGAC	GTGGACACAC,GTGGACAC,GTGGACACACAC,GTGG,GTGGACACACACAC,ATGGACACACAC	999	PASS	INDEL;AN=0	GT:DP	./.:0	./.:0
+3	15	.	CACA	CAC	999	PASS	INDEL;AN=0	GT:DP	./.:0	./.:0
+4	21	.	ATTTTTTTTTTTTTTTC	ATTTTTTTTTTTTTTC,ATTTTTTTTTTTTTTTT,ATTTTTTTTTTTTTTTTC	999	PASS	INDEL;AN=0	GT:DP	./.:0	./.:0
+5	22	.	A	AGA	999	PASS	INDEL;AN=0	GT:DP	./.:0	./.:0
diff --git a/test/reheader.1.out.bcf b/test/reheader.1.out.bcf
new file mode 100644
index 0000000..c5a372d
--- /dev/null
+++ b/test/reheader.1.out.bcf
@@ -0,0 +1,38 @@
+##fileformat=VCFv4.2
+##FILTER=<ID=PASS,Description="All filters passed">
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=PL,Number=G,Type=Integer,Description="Phred-scaled likelihood">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Depth">
+##contig=<ID=1,length=2147483647>
+##contig=<ID=2,length=2147483647>
+##contig=<ID=3,length=2147483647>
+##contig=<ID=4,length=2147483647>
+##contig=<ID=5,length=2147483647>
+##contig=<ID=20,length=2147483647>
+##FILTER=<ID=Test,Description="Test filter">
+##INFO=<ID=DP2,Number=2,Type=Integer,Description="Depth">
+##FORMAT=<ID=DP2,Number=2,Type=Integer,Description="Depth">
+##contig=<ID=12,length=123456789>
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	AAA0001	BBB0002
+2	101	.	ATTTTTTTTTTTTT	ATTTTTTTTTTTTTTT	999	PASS	INDEL;AN=4;AC=4	GT:DP	1/1:1	1/1:1
+2	114	.	TC	TTCC,TTC	999	PASS	INDEL;AN=4;AC=2,2	GT:DP	1/2:1	1/2:1
+2	115	.	C	T	999	PASS	INDEL;AN=4;AC=4	GT:DP	1/1:1	1/1:1
+20	3	.	G	CT	999	PASS	INDEL;AN=4;AC=2	GT	0/1	0/1
+20	3	.	GATG	GACT	999	PASS	INDEL;AN=4;AC=2	GT	1/0	1/0
+20	5	.	TGGG	TAC,TG,TGGGG,AC	.	PASS	INDEL;AN=4;AC=2,2,0,0	GT:PL:DP	1/2:1,2,3,4,5,6,7,8,9,10,11,12,13,14,15:1	1/2:1,2,3,4,5,6,7,8,9,10,11,12,13,14,15:1
+20	59	.	AG	.	999	PASS	AN=4	GT:PL:DP	0/0:0:4	0/0:0:4
+20	80	.	CACAG	CACAT	999	PASS	AN=4;AC=2	GT:PL:DP	0/1:255,0,255:13	0/1:255,0,255:13
+20	81	.	A	C	999	PASS	AN=4;AC=2	GT:PL:DP	0/1:255,0,255:13	0/1:255,0,255:13
+20	95	.	TCACCG	ACACCG	999	PASS	AN=4;AC=2	GT:PL:DP	0/1:255,0,255:13	0/1:255,0,255:13
+20	95	.	TCACCG	AAAAAA	999	Test	AN=4;AC=2	GT:PL:DP	0/1:255,0,255:13	0/1:255,0,255:13
+20	273	.	CAAAAAAAAAAAAAAAAAAAAA	CAAAAAAAAAAAAAAAAAAAAAAA,CAAAAAAAAAAAAAAAAAAAAAAAA	999	PASS	INDEL;AN=4;AC=2,2	GT:PL:DP	1/2:0,3,5,3,5,5:1	1/2:0,3,5,3,5,5:1
+20	274	.	AAAAAAAAA	AAAAAAAAAAAAAAAAAAA	999	PASS	INDEL;AN=0;AC=0	GT:PL:DP	./.:0,0,0:0	./.:0,0,0:0
+20	278	.	AAAAAAAAAAAAAAAAA	AAAAAAAAAAAAAAAAAAA	999	PASS	INDEL;AN=0;AC=0	GT:PL:DP	./.:0,0,0:0	./.:0,0,0:0
+3	10	.	GTGGAC	GTGGACACAC,GTGGACAC,GTGGACACACAC,GTGG,GTGGACACACACAC,ATGGACACACAC	999	PASS	INDEL;AN=0	GT:DP	./.:0	./.:0
+3	15	.	CACA	CAC	999	PASS	INDEL;AN=0	GT:DP	./.:0	./.:0
+4	21	.	ATTTTTTTTTTTTTTTC	ATTTTTTTTTTTTTTC,ATTTTTTTTTTTTTTTT,ATTTTTTTTTTTTTTTTC	999	PASS	INDEL;AN=0	GT:DP	./.:0	./.:0
+5	22	.	A	AGA	999	PASS	INDEL;AN=0	GT:DP	./.:0	./.:0
diff --git a/test/reheader.2.out b/test/reheader.2.out
new file mode 100644
index 0000000..6729715
--- /dev/null
+++ b/test/reheader.2.out
@@ -0,0 +1,55 @@
+##fileformat=VCFv4.1
+##FILTER=<ID=PASS,Description="All filters passed">
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##INFO=<ID=XRF,Number=R,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAF,Number=A,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGF,Number=G,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XRI,Number=R,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAI,Number=A,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGI,Number=G,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XRS,Number=R,Type=String,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAS,Number=A,Type=String,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGS,Number=G,Type=String,Description="Test Number=AGR in INFO">
+##FORMAT=<ID=FRF,Number=R,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAF,Number=A,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FGF,Number=G,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRI,Number=R,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAI,Number=A,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FGI,Number=G,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRS,Number=R,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAS,Number=A,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FGS,Number=G,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FSTR,Number=1,Type=String,Description="Test String in FORMAT">
+##INFO=<ID=ISTR,Number=1,Type=String,Description="Test String in INFO">
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=PL,Number=G,Type=Integer,Description="Phred-scaled likelihood">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Depth">
+##contig=<ID=1,length=2147483647>
+##contig=<ID=2,length=2147483647>
+##contig=<ID=3,length=2147483647>
+##contig=<ID=4,length=2147483647>
+##contig=<ID=5,length=2147483647>
+##contig=<ID=20,length=2147483647>
+##FILTER=<ID=Test,Description="Test Filter">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	AAA	BBB
+2	101	.	ATTTTTTTTTTTTT	ATTTTTTTTTTTTTTT	999	PASS	INDEL;AN=4;AC=4	GT:DP	1/1:1	1/1:1
+2	114	.	TC	TTCC,TTC	999	PASS	INDEL;AN=4;AC=2,2	GT:DP	1/2:1	1/2:1
+2	115	.	C	T	999	PASS	INDEL;AN=4;AC=4	GT:DP	1/1:1	1/1:1
+20	3	.	G	CT	999	PASS	INDEL;AN=4;AC=2	GT	0/1	0/1
+20	3	.	GATG	GACT	999	PASS	INDEL;AN=4;AC=2	GT	1/0	1/0
+20	5	.	TGGG	TAC,TG,TGGGG,AC	.	PASS	INDEL;AN=4;AC=2,2,0,0	GT:PL:DP	1/2:1,2,3,4,5,6,7,8,9,10,11,12,13,14,15:1	1/2:1,2,3,4,5,6,7,8,9,10,11,12,13,14,15:1
+20	59	.	AG	.	999	PASS	AN=4	GT:PL:DP	0/0:0:4	0/0:0:4
+20	80	.	CACAG	CACAT	999	PASS	AN=4;AC=2	GT:PL:DP	0/1:255,0,255:13	0/1:255,0,255:13
+20	81	.	A	C	999	PASS	AN=4;AC=2	GT:PL:DP	0/1:255,0,255:13	0/1:255,0,255:13
+20	95	.	TCACCG	ACACCG	999	PASS	AN=4;AC=2	GT:PL:DP	0/1:255,0,255:13	0/1:255,0,255:13
+20	95	.	TCACCG	AAAAAA	999	Test	AN=4;AC=2	GT:PL:DP	0/1:255,0,255:13	0/1:255,0,255:13
+20	273	.	CAAAAAAAAAAAAAAAAAAAAA	CAAAAAAAAAAAAAAAAAAAAAAA,CAAAAAAAAAAAAAAAAAAAAAAAA	999	PASS	INDEL;AN=4;AC=2,2	GT:PL:DP	1/2:0,3,5,3,5,5:1	1/2:0,3,5,3,5,5:1
+20	274	.	AAAAAAAAA	AAAAAAAAAAAAAAAAAAA	999	PASS	INDEL;AN=0;AC=0	GT:PL:DP	./.:0,0,0:0	./.:0,0,0:0
+20	278	.	AAAAAAAAAAAAAAAAA	AAAAAAAAAAAAAAAAAAA	999	PASS	INDEL;AN=0;AC=0	GT:PL:DP	./.:0,0,0:0	./.:0,0,0:0
+3	10	.	GTGGAC	GTGGACACAC,GTGGACAC,GTGGACACACAC,GTGG,GTGGACACACACAC,ATGGACACACAC	999	PASS	INDEL;AN=0	GT:DP	./.:0	./.:0
+3	15	.	CACA	CAC	999	PASS	INDEL;AN=0	GT:DP	./.:0	./.:0
+4	21	.	ATTTTTTTTTTTTTTTC	ATTTTTTTTTTTTTTC,ATTTTTTTTTTTTTTTT,ATTTTTTTTTTTTTTTTC	999	PASS	INDEL;AN=0	GT:DP	./.:0	./.:0
+5	22	.	A	AGA	999	PASS	INDEL;AN=0	GT:DP	./.:0	./.:0
diff --git a/test/reheader.hdr b/test/reheader.hdr
new file mode 100644
index 0000000..ab9e808
--- /dev/null
+++ b/test/reheader.hdr
@@ -0,0 +1,19 @@
+##fileformat=VCFv4.2
+##INFO=<ID=DP2,Number=2,Type=Integer,Description="Depth">
+##FILTER=<ID=Test,Description="Test filter">
+##FORMAT=<ID=DP2,Number=2,Type=Integer,Description="Depth">
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=PL,Number=G,Type=Integer,Description="Phred-scaled likelihood">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Depth">
+##contig=<ID=12,length=123456789>
+##contig=<ID=20,length=2147483647>
+##contig=<ID=5,length=2147483647>
+##contig=<ID=1,length=2147483647>
+##contig=<ID=2,length=2147483647>
+##contig=<ID=3,length=2147483647>
+##contig=<ID=4,length=2147483647>
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	AAA0001	BBB0002
diff --git a/test/reheader.samples b/test/reheader.samples
new file mode 100644
index 0000000..b384270
--- /dev/null
+++ b/test/reheader.samples
@@ -0,0 +1,2 @@
+AAA
+BBB
diff --git a/test/reheader.samples2 b/test/reheader.samples2
new file mode 100644
index 0000000..884cb11
--- /dev/null
+++ b/test/reheader.samples2
@@ -0,0 +1,2 @@
+XY00002 BBB
+XY00001 AAA
diff --git a/test/reheader.vcf b/test/reheader.vcf
new file mode 100644
index 0000000..3c4f72e
--- /dev/null
+++ b/test/reheader.vcf
@@ -0,0 +1,54 @@
+##fileformat=VCFv4.1
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##INFO=<ID=XRF,Number=R,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAF,Number=A,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGF,Number=G,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XRI,Number=R,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAI,Number=A,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGI,Number=G,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XRS,Number=R,Type=String,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAS,Number=A,Type=String,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGS,Number=G,Type=String,Description="Test Number=AGR in INFO">
+##FORMAT=<ID=FRF,Number=R,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAF,Number=A,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FGF,Number=G,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRI,Number=R,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAI,Number=A,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FGI,Number=G,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRS,Number=R,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAS,Number=A,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FGS,Number=G,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FSTR,Number=1,Type=String,Description="Test String in FORMAT">
+##INFO=<ID=ISTR,Number=1,Type=String,Description="Test String in INFO">
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=PL,Number=G,Type=Integer,Description="Phred-scaled likelihood">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Depth">
+##contig=<ID=1,length=2147483647>
+##contig=<ID=2,length=2147483647>
+##contig=<ID=3,length=2147483647>
+##contig=<ID=4,length=2147483647>
+##contig=<ID=5,length=2147483647>
+##contig=<ID=20,length=2147483647>
+##FILTER=<ID=Test,Description="Test Filter">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	XY00001	XY00002
+2	101	.	ATTTTTTTTTTTTT	ATTTTTTTTTTTTTTT	999	PASS	INDEL;AN=4;AC=4	GT:DP	1/1:1	1/1:1
+2	114	.	TC	TTCC,TTC	999	PASS	INDEL;AN=4;AC=2,2	GT:DP	1/2:1	1/2:1
+2	115	.	C	T	999	PASS	INDEL;AN=4;AC=4	GT:DP	1/1:1	1/1:1
+20	3	.	G	CT	999	PASS	INDEL;AN=4;AC=2	GT	0/1	0/1
+20	3	.	GATG	GACT	999	PASS	INDEL;AN=4;AC=2	GT	1/0	1/0
+20	5	.	TGGG	TAC,TG,TGGGG,AC	.	PASS	INDEL;AN=4;AC=2,2,0,0	GT:PL:DP	1/2:1,2,3,4,5,6,7,8,9,10,11,12,13,14,15:1	1/2:1,2,3,4,5,6,7,8,9,10,11,12,13,14,15:1
+20	59	.	AG	.	999	PASS	AN=4	GT:PL:DP	0/0:0:4	0/0:0:4
+20	80	.	CACAG	CACAT	999	PASS	AN=4;AC=2	GT:PL:DP	0/1:255,0,255:13	0/1:255,0,255:13
+20	81	.	A	C	999	PASS	AN=4;AC=2	GT:PL:DP	0/1:255,0,255:13	0/1:255,0,255:13
+20	95	.	TCACCG	ACACCG	999	PASS	AN=4;AC=2	GT:PL:DP	0/1:255,0,255:13	0/1:255,0,255:13
+20	95	.	TCACCG	AAAAAA	999	Test	AN=4;AC=2	GT:PL:DP	0/1:255,0,255:13	0/1:255,0,255:13
+20	273	.	CAAAAAAAAAAAAAAAAAAAAA	CAAAAAAAAAAAAAAAAAAAAAAA,CAAAAAAAAAAAAAAAAAAAAAAAA	999	PASS	INDEL;AN=4;AC=2,2	GT:PL:DP	1/2:0,3,5,3,5,5:1	1/2:0,3,5,3,5,5:1
+20	274	.	AAAAAAAAA	AAAAAAAAAAAAAAAAAAA	999	PASS	INDEL;AN=0;AC=0	GT:PL:DP	./.:0,0,0:0	./.:0,0,0:0
+20	278	.	AAAAAAAAAAAAAAAAA	AAAAAAAAAAAAAAAAAAA	999	PASS	INDEL;AN=0;AC=0	GT:PL:DP	./.:0,0,0:0	./.:0,0,0:0
+3	10	.	GTGGAC	GTGGACACAC,GTGGACAC,GTGGACACACAC,GTGG,GTGGACACACACAC,ATGGACACACAC	999	PASS	INDEL;AN=0	GT:DP	./.:0	./.:0
+3	15	.	CACA	CAC	999	PASS	INDEL;AN=0	GT:DP	./.:0	./.:0
+4	21	.	ATTTTTTTTTTTTTTTC	ATTTTTTTTTTTTTTC,ATTTTTTTTTTTTTTTT,ATTTTTTTTTTTTTTTTC	999	PASS	INDEL;AN=0	GT:DP	./.:0	./.:0
+5	22	.	A	AGA	999	PASS	INDEL;AN=0	GT:DP	./.:0	./.:0
diff --git a/test/stats.a.vcf b/test/stats.a.vcf
new file mode 100644
index 0000000..0240798
--- /dev/null
+++ b/test/stats.a.vcf
@@ -0,0 +1,8 @@
+##fileformat=VCFv4.2
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##contig=<ID=1,assembly=b37,length=249250621>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B	C
+1	1000	.	G	A	.	PASS	.	GT	0/0	0/1	1/1
+1	1001	.	G	A	.	PASS	.	GT	0/0	0/1	1/1
+1	1002	.	G	A	.	PASS	.	GT	0/0	0/1	1/1
diff --git a/test/stats.b.vcf b/test/stats.b.vcf
new file mode 100644
index 0000000..a4a346c
--- /dev/null
+++ b/test/stats.b.vcf
@@ -0,0 +1,8 @@
+##fileformat=VCFv4.2
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##contig=<ID=1,assembly=b37,length=249250621>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B	C
+1	1000	.	G	A	.	PASS	.	GT	0/1	0/0	0/0
+1	1001	.	G	A	.	PASS	.	GT	0/0	0/0	0/0
+1	1002	.	G	A	.	PASS	.	GT	0/0	0/1	0/0
diff --git a/test/stats.chk b/test/stats.chk
new file mode 100644
index 0000000..e23ca31
--- /dev/null
+++ b/test/stats.chk
@@ -0,0 +1,87 @@
+SN	0	number of samples:	3
+SN	1	number of samples:	3
+SN	0	number of records:	0
+SN	0	number of SNPs:	0
+SN	0	number of MNPs:	0
+SN	0	number of indels:	0
+SN	0	number of others:	0
+SN	0	number of multiallelic sites:	0
+SN	0	number of multiallelic SNP sites:	0
+SN	1	number of records:	0
+SN	1	number of SNPs:	0
+SN	1	number of MNPs:	0
+SN	1	number of indels:	0
+SN	1	number of others:	0
+SN	1	number of multiallelic sites:	0
+SN	1	number of multiallelic SNP sites:	0
+SN	2	number of records:	3
+SN	2	number of SNPs:	3
+SN	2	number of MNPs:	0
+SN	2	number of indels:	0
+SN	2	number of others:	0
+SN	2	number of multiallelic sites:	0
+SN	2	number of multiallelic SNP sites:	0
+TSTV	0	0	0	0.00	0	0	0.00
+TSTV	1	0	0	0.00	0	0	0.00
+TSTV	2	3	0	0.00	3	0	0.00
+SiS	0	1	0	0	0	0	0	0	0
+SiS	1	1	0	0	0	0	0	0	0
+SiS	2	1	0	0	0	0	0	0	0
+AF	2	49.000000	3	3	0	0	0	0	0
+QUAL	2	998	3	3	0	0
+ST	0	A>C	0
+ST	0	A>G	0
+ST	0	A>T	0
+ST	0	C>A	0
+ST	0	C>G	0
+ST	0	C>T	0
+ST	0	G>A	0
+ST	0	G>C	0
+ST	0	G>T	0
+ST	0	T>A	0
+ST	0	T>C	0
+ST	0	T>G	0
+ST	1	A>C	0
+ST	1	A>G	0
+ST	1	A>T	0
+ST	1	C>A	0
+ST	1	C>G	0
+ST	1	C>T	0
+ST	1	G>A	0
+ST	1	G>C	0
+ST	1	G>T	0
+ST	1	T>A	0
+ST	1	T>C	0
+ST	1	T>G	0
+ST	2	A>C	0
+ST	2	A>G	0
+ST	2	A>T	0
+ST	2	C>A	0
+ST	2	C>G	0
+ST	2	C>T	0
+ST	2	G>A	3
+ST	2	G>C	0
+ST	2	G>T	0
+ST	2	T>A	0
+ST	2	T>C	0
+ST	2	T>G	0
+SN	2	number of samples:	3
+GCsAF	2	49.000000	2	1	0	1	2	3	0.375000	2
+NRDs	2	85.714286	33.333333	66.666667	100.000000
+NRDi	2	0.000000	0.000000	0.000000	0.000000
+GCsS	2	A	100.000	2	0	0	1	0	0
+GCsS	2	B	66.667	0	1	0	0	2	0
+GCsS	2	C	100.000	0	0	0	0	0	3
+GCiS	2	A	0.000	0	0	0	0	0	0
+GCiS	2	B	0.000	0	0	0	0	0	0
+GCiS	2	C	0.000	0	0	0	0	0	0
+PSC	0	A	0	0	0	0	0	0	0.0	0
+PSC	0	B	0	0	0	0	0	0	0.0	0
+PSC	0	C	0	0	0	0	0	0	0.0	0
+PSC	1	A	0	0	0	0	0	0	0.0	0
+PSC	1	B	0	0	0	0	0	0	0.0	0
+PSC	1	C	0	0	0	0	0	0	0.0	0
+PSC	2	A	3	0	0	0	0	0	0.0	0
+PSC	2	B	0	0	3	3	0	0	0.0	0
+PSC	2	C	0	3	0	3	0	0	0.0	0
+HWE	2	49.000000	3	0.330000	0.330000	0.330000
diff --git a/test/tabix.1.3000151.out b/test/tabix.1.3000151.out
new file mode 100644
index 0000000..e9d5c87
--- /dev/null
+++ b/test/tabix.1.3000151.out
@@ -0,0 +1 @@
+1	3000151	.	C	T	59.2	PASS	AN=4;AC=2	GT:DP:GQ	0/1:32:245	0/1:32:245
diff --git a/test/tabix.2.3199812.out b/test/tabix.2.3199812.out
new file mode 100644
index 0000000..be2f66e
--- /dev/null
+++ b/test/tabix.2.3199812.out
@@ -0,0 +1 @@
+2	3199812	.	G	GTT,GT	82.7	PASS	AN=4;AC=2,2	GT:GQ:DP	1/2:322:26	1/2:322:26
diff --git a/test/test-rbuf.c b/test/test-rbuf.c
new file mode 100644
index 0000000..c428339
--- /dev/null
+++ b/test/test-rbuf.c
@@ -0,0 +1,73 @@
+/*  test/test-rbuf.c -- rbuf_t test harness.
+
+    Copyright (C) 2014 Genome Research Ltd.
+
+    Author: Petr Danecek <pd3 at sanger.ac.uk>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.  */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "rbuf.h"
+
+void debug_print(rbuf_t *rbuf, int *dat)
+{
+    int i;
+    for (i=-1; rbuf_next(rbuf, &i); ) printf(" %2d", i); printf("\n");
+    for (i=-1; rbuf_next(rbuf, &i); ) printf(" %2d", dat[i]); printf("\n");
+}
+
+int main(int argc, char **argv)
+{
+    int i, j, *dat = (int*)calloc(10,sizeof(int));
+    rbuf_t rbuf;
+    rbuf_init(&rbuf,10);
+
+    rbuf.f = 5; // force wrapping
+    for (i=0; i<9; i++)
+    {
+        j = rbuf_append(&rbuf);
+        dat[j] = i+1;
+    }
+    printf("Inserted 1-9 starting at offset 5:\n");
+    debug_print(&rbuf, dat);
+
+    i = rbuf_kth(&rbuf, 3);
+    printf("4th is %d\n", dat[i]);
+
+    printf("Deleting 1-2:\n");
+    rbuf_shift_n(&rbuf, 2);
+    debug_print(&rbuf, dat);
+
+    printf("Prepending 0-8:\n");
+    for (i=0; i<9; i++)
+    {
+        j = rbuf_prepend(&rbuf);
+        dat[j] = i;
+    }
+    debug_print(&rbuf, dat);
+
+    printf("Expanding:\n");
+    rbuf_expand0(&rbuf,int,dat);
+    debug_print(&rbuf, dat);
+
+    free(dat);
+    return 0;
+}
+
diff --git a/test/test.pl b/test/test.pl
new file mode 100755
index 0000000..24051ed
--- /dev/null
+++ b/test/test.pl
@@ -0,0 +1,769 @@
+#!/usr/bin/env perl
+#
+#   Copyright (C) 2012-2014 Genome Research Ltd.
+#
+#   Author: Petr Danecek <pd3 at sanger.ac.uk>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+
+use strict;
+use warnings;
+use Carp;
+#use IPC::Open2;
+use FindBin;
+use lib "$FindBin::Bin";
+use Getopt::Long;
+use File::Temp qw/ tempfile tempdir /;
+
+my $opts = parse_params();
+
+test_usage($opts,cmd=>'bcftools');
+test_tabix($opts,in=>'merge.a',reg=>'2:3199812-3199812',out=>'tabix.2.3199812.out');
+test_tabix($opts,in=>'merge.a',reg=>'1:3000151-3000151',out=>'tabix.1.3000151.out');
+test_tabix($opts,in=>'large_chrom_tbi_limit',reg=>'chr11:1-536870912',out=>'large_chrom_tbi_limit.20.1.536870912.out'); # 536870912 (1<<29) is the current limit for tbi. cannot retrieve regions larger than that
+test_index($opts,in=>'large_chrom_csi_limit',reg=>'chr20:1-2147483647',out=>'large_chrom_csi_limit.20.1.2147483647.out'); # 2147483647 (1<<31-1) is the current chrom limit for csi. bcf conversion and indexing fail above this
+test_index($opts,in=>'large_chrom_csi_limit',reg=>'chr20',out=>'large_chrom.20.1.2147483647.out'); # this fails until bug resolved
+test_vcf_idxstats($opts,in=>'idx',args=>'-s',out=>'idx.out');
+test_vcf_idxstats($opts,in=>'idx',args=>'-n',out=>'idx_count.out');
+test_vcf_idxstats($opts,in=>'empty',args=>'-s',out=>'empty.idx.out');
+test_vcf_idxstats($opts,in=>'empty',args=>'-n',out=>'empty.idx_count.out');
+test_vcf_check($opts,in=>'check',out=>'check.chk');
+test_vcf_stats($opts,in=>['stats.a','stats.b'],out=>'stats.chk',args=>'-s -');
+test_vcf_isec($opts,in=>['isec.a','isec.b'],out=>'isec.ab.out',args=>'-n =2');
+test_vcf_isec($opts,in=>['isec.a','isec.b'],out=>'isec.ab.flt.out',args=>'-n =2 -i"STRLEN(REF)==2"');
+test_vcf_isec($opts,in=>['isec.a','isec.b'],out=>'isec.ab.both.out',args=>'-n =2 -c both');
+test_vcf_isec($opts,in=>['isec.a','isec.b'],out=>'isec.ab.any.out',args=>'-n =2 -c any');
+test_vcf_isec($opts,in=>['isec.a','isec.b'],out=>'isec.ab.C.out',args=>'-C -c any');
+test_vcf_isec2($opts,vcf_in=>['isec.a'],tab_in=>'isec',out=>'isec.tab.out',args=>'');
+test_vcf_merge($opts,in=>['merge.a','merge.b','merge.c'],out=>'merge.abc.out',args=>'--force-samples');
+test_vcf_merge($opts,in=>['merge.2.a','merge.2.b'],out=>'merge.2.none.out',args=>'--force-samples -m none');
+test_vcf_merge($opts,in=>['merge.2.a','merge.2.b'],out=>'merge.2.both.out',args=>'--force-samples -m both');
+test_vcf_merge($opts,in=>['merge.2.a','merge.2.b'],out=>'merge.2.all.out',args=>'--force-samples -m all');
+test_vcf_merge($opts,in=>['merge.3.a','merge.3.b'],out=>'merge.3.out',args=>'--force-samples -i TR:sum,TA:sum,TG:sum');
+test_vcf_merge($opts,in=>['merge.4.a','merge.4.b'],out=>'merge.4.out',args=>'--force-samples -m id');
+test_vcf_query($opts,in=>'query',out=>'query.out',args=>q[-f '%CHROM\\t%POS\\t%REF\\t%ALT\\t%DP4\\t%AN[\\t%GT\\t%TGT]\\n']);
+test_vcf_query($opts,in=>'view.filter',out=>'query.2.out',args=>q[-f'%XRI\\n' -i'XRI[*]>1111']);
+test_vcf_query($opts,in=>'view.filter',out=>'query.3.out',args=>q[-f'%XRF\\n' -i'XRF[*]=2e6']);
+test_vcf_query($opts,in=>'view.filter',out=>'query.4.out',args=>q[-f'%XGS\\n' -i'XGS[5]="PQR"']);
+test_vcf_query($opts,in=>'view.filter',out=>'query.4.out',args=>q[-f'%XGS\\n' -i'XGS[*]="GHI"']);
+test_vcf_query($opts,in=>'view.filter',out=>'query.4.out',args=>q[-f'%XGS\\n' -i'XGS[2]~"H"']);
+test_vcf_query($opts,in=>'view.filter',out=>'query.4.out',args=>q[-f'%XGS\\n' -i'XGS[3]!~"H"']);
+test_vcf_query($opts,in=>'view.filter',out=>'query.4.out',args=>q[-f'%XGS\\n' -i'XGS[*]~"H"']);
+test_vcf_query($opts,in=>'view.filter',out=>'query.4.out',args=>q[-f'%XGS\\n' -i'XGS[*]~"HI,JK"']);
+test_vcf_query($opts,in=>'query',out=>'query.5.out',args=>q[-f'%POS %REF %ALT\\n' -i'REF~"C" && ALT~"CT"']);
+test_vcf_query($opts,in=>'query',out=>'query.6.out',args=>q[-f'%POS %REF %ALT\\n' -i'N_ALT=2']);
+test_vcf_query($opts,in=>'query',out=>'query.7.out',args=>q[-f'%POS %AN\\n' -i'AN!=2*N_SAMPLES']);
+test_vcf_query($opts,in=>'query',out=>'query.8.out',args=>q[-f'%POS[ %GL]\\n' -i'min(abs(GL[0]))=10']);
+test_vcf_query($opts,in=>'view.filter',out=>'query.9.out',args=>q[-f'%POS %CIGAR\\n' -i'strlen(CIGAR[*])=4']);
+test_vcf_query($opts,in=>'query',out=>'query.10.out',args=>q[-f'%POS[ %GT]\\n' -i'AC[0]=3']);
+test_vcf_query($opts,in=>'query',out=>'query.10.out',args=>q[-f'%POS[ %GT]\\n' -i'AF[0]=3/4']);
+test_vcf_query($opts,in=>'query',out=>'query.11.out',args=>q[-f'%POS[ %GT]\\n' -i'MAC[0]=1']);
+test_vcf_query($opts,in=>'query',out=>'query.11.out',args=>q[-f'%POS[ %GT]\\n' -i'MAF[0]=1/4']);
+test_vcf_query($opts,in=>'view.vectors',out=>'query.12.out',args=>q[-f'I8=%I8 I16=%I16 I32=%I32 IF=%IF IA8=%IA8 IA16=%IA16 IA32=%IA32 IAF=%IAF IA8=%IA8{1} IA16=%IA16{1} IA32=%IA32{1} IAF=%IAF{1} [ %F8:%F16:%F32:%FF]\\n']);
+test_vcf_query($opts,in=>'query.filter',out=>'query.13.out',args=>q[-f'%POS[ %GT]\\n' -i'GT ="1"']);
+test_vcf_query($opts,in=>'query.filter',out=>'query.14.out',args=>q[-f'%POS[ %GT]\\n' -i'GT!="1"']);
+test_vcf_query($opts,in=>'query.filter',out=>'query.15.out',args=>q[-f'%POS[ %GT]\\n' -e'GT ="1"']);
+test_vcf_query($opts,in=>'query.filter',out=>'query.16.out',args=>q[-f'%POS[ %GT]\\n' -e'GT!="1"']);
+test_vcf_query($opts,in=>'query.2',out=>'query.17.out',args=>q[-f'%XX_A %XX.A %XX.A0 %xx.a0\\n']);
+test_vcf_norm($opts,in=>'norm',out=>'norm.out',fai=>'norm');
+test_vcf_norm($opts,in=>'norm.split',out=>'norm.split.out',args=>'-m-');
+test_vcf_norm($opts,in=>'norm.merge',out=>'norm.merge.out',args=>'-m+');
+test_vcf_norm($opts,in=>'norm.merge',out=>'norm.merge.strict.out',args=>'-m+ -s');
+test_vcf_view($opts,in=>'view',out=>'view.1.out',args=>'-aUc1 -C1 -s NA00002 -v snps',reg=>'');
+test_vcf_view($opts,in=>'view',out=>'view.2.out',args=>'-f PASS -Xks NA00003',reg=>'-r20,Y');
+test_vcf_view($opts,in=>'view',out=>'view.3.out',args=>'-xs NA00003',reg=>'');
+test_vcf_view($opts,in=>'view',out=>'view.4.out',args=>q[-i 'QUAL==999 && (FS<20 || FS>=41.02) && ICF>-0.1 && HWE*2>1.2'],reg=>'');
+test_vcf_view($opts,in=>'view',out=>'view.5.out',args=>q[-p],reg=>'');
+test_vcf_view($opts,in=>'view',out=>'view.6.out',args=>q[-P],reg=>'');
+test_vcf_view($opts,in=>'view',out=>'view.7.out',args=>q[-hm2 -M2 -q0.3 -Q0.7],reg=>'');
+test_vcf_view($opts,in=>'view',out=>'view.8.out',args=>q[-Hu],reg=>'');
+test_vcf_view($opts,in=>'view',out=>'view.9.out',args=>q[-GVsnps],reg=>'');
+test_vcf_view($opts,in=>'view',out=>'view.10.out',args=>q[-ne 'INDEL=1 || PV4[0]<0.006'],reg=>'');
+test_vcf_view($opts,in=>'view',out=>'view.exclude.out',args=>'-s ^NA00003',reg=>'');
+test_vcf_view($opts,in=>'view.omitgenotypes',out=>'view.omitgenotypes.out',args=>'',reg=>'');
+test_vcf_view($opts,in=>'view.vectors',out=>'view.vectors.A.out',args=>'-asA',reg=>'');
+test_vcf_view($opts,in=>'view.vectors',out=>'view.vectors.B.out',args=>'-asB',reg=>'');
+test_vcf_view($opts,in=>'view.filter',out=>'view.filter.1.out',args=>q[-H -i'FMT/FGS[0]="AAAAAA"'],reg=>'');    # test expressions
+test_vcf_view($opts,in=>'view.filter',out=>'view.filter.2.out',args=>q[-H -i'FMT/FGS[2]="C"'],reg=>'');
+test_vcf_view($opts,in=>'view.filter',out=>'view.filter.3.out',args=>q[-H -i'FMT/FGS[4]="EE"'],reg=>'');
+test_vcf_view($opts,in=>'view.filter',out=>'view.filter.4.out',args=>q[-H -i'FMT/FRS[1]="BB"'],reg=>'');
+test_vcf_view($opts,in=>'view.filter',out=>'view.filter.5.out',args=>q[-H -i'TXT0="text"'],reg=>'');
+test_vcf_view($opts,in=>'view.chrs',out=>'view.chrs.out',args=>'',reg=>'',tgts=>'view.chrs.tab');
+test_vcf_filter($opts,in=>'view.filter',out=>'view.filter.6.out',args=>q[-S. -e'TXT0="text"'],reg=>'');
+test_vcf_filter($opts,in=>'view.filter',out=>'view.filter.7.out',args=>q[-S. -e'FMT/FRS[1]="BB"'],reg=>'');
+test_vcf_filter($opts,in=>'view.filter',out=>'view.filter.8.out',args=>q[-S. -e'FMT/FGS[0]="AAAAAA"'],reg=>'');
+test_vcf_filter($opts,in=>'view.filter',out=>'view.filter.9.out',args=>q[-S. -e'FMT/FGS[1]="BBB"'],reg=>'');
+test_vcf_filter($opts,in=>'view.filter',out=>'view.filter.10.out',args=>q[-S. -e'FMT/FGS[4]="EE"'],reg=>'');
+test_vcf_filter($opts,in=>'view.filter',out=>'view.filter.11.out',args=>q[-S. -e'FMT/STR="XX"'],reg=>'');
+test_vcf_view($opts,in=>'view.minmaxac',out=>'view.minmaxac.1.out',args=>q[-H -C5:nonmajor],reg=>'');
+test_vcf_view($opts,in=>'view.minmaxac',out=>'view.minmaxac.2.out',args=>q[-H -c6:nonmajor],reg=>'');
+test_vcf_view($opts,in=>'view.minmaxac',out=>'view.minmaxac.1.out',args=>q[-H -q0.3:major],reg=>'');
+test_vcf_call($opts,in=>'mpileup',out=>'mpileup.1.out',args=>'-mv');
+test_vcf_call($opts,in=>'mpileup',out=>'mpileup.2.out',args=>'-mvg0');
+test_vcf_call_cAls($opts,in=>'mpileup',out=>'mpileup.cAls.out',tab=>'mpileup');
+test_vcf_filter($opts,in=>'filter.1',out=>'filter.1.out',args=>'-mx -g2 -G2');
+test_vcf_filter($opts,in=>'filter.2',out=>'filter.2.out',args=>q[-e'QUAL==59.2 || (INDEL=0 & (FMT/GQ=25 | FMT/DP=10))' -sModified -S.]);
+test_vcf_filter($opts,in=>'filter.3',out=>'filter.3.out',args=>q[-e'DP=19'],fmt=>'%POS\\t%FILTER\\t%DP[\\t%GT]\\n');
+test_vcf_filter($opts,in=>'filter.3',out=>'filter.4.out',args=>q[-e'DP=19' -s XX],fmt=>'%POS\\t%FILTER\\t%DP[\\t%GT]\\n');
+test_vcf_filter($opts,in=>'filter.3',out=>'filter.5.out',args=>q[-e'DP=19' -s XX -m+],fmt=>'%POS\\t%FILTER\\t%DP[\\t%GT]\\n');
+test_vcf_filter($opts,in=>'filter.3',out=>'filter.6.out',args=>q[-e'DP=19' -s XX -mx],fmt=>'%POS\\t%FILTER\\t%DP[\\t%GT]\\n');
+test_vcf_filter($opts,in=>'filter.3',out=>'filter.7.out',args=>q[-e'DP=19' -s XX -m+x],fmt=>'%POS\\t%FILTER\\t%DP[\\t%GT]\\n');
+test_vcf_filter($opts,in=>'filter.3',out=>'filter.3.out',args=>q[-e'FMT/GT="0/2"'],fmt=>'%POS\\t%FILTER\\t%DP[\\t%GT]\\n');
+test_vcf_filter($opts,in=>'filter.3',out=>'filter.4.out',args=>q[-e'FMT/GT="0/2"' -s XX],fmt=>'%POS\\t%FILTER\\t%DP[\\t%GT]\\n');
+test_vcf_filter($opts,in=>'filter.3',out=>'filter.5.out',args=>q[-e'FMT/GT="0/2"' -s XX -m+],fmt=>'%POS\\t%FILTER\\t%DP[\\t%GT]\\n');
+test_vcf_filter($opts,in=>'filter.3',out=>'filter.6.out',args=>q[-e'FMT/GT="0/2"' -s XX -mx],fmt=>'%POS\\t%FILTER\\t%DP[\\t%GT]\\n');
+test_vcf_filter($opts,in=>'filter.3',out=>'filter.7.out',args=>q[-e'FMT/GT="0/2"' -s XX -m+x],fmt=>'%POS\\t%FILTER\\t%DP[\\t%GT]\\n');
+test_vcf_filter($opts,in=>'filter.2',out=>'filter.8.out',args=>q[-i'FMT/GT="0/0" && AC[*]=2'],fmt=>'%POS\\t%AC[\\t%GT]\\n');
+test_vcf_filter($opts,in=>'filter.2',out=>'filter.8.out',args=>q[-i'AC[*]=2 && FMT/GT="0/0"'],fmt=>'%POS\\t%AC[\\t%GT]\\n');
+test_vcf_regions($opts,in=>'regions');
+test_vcf_annotate($opts,in=>'annotate',tab=>'annotate',out=>'annotate.out',args=>'-c CHROM,POS,REF,ALT,ID,QUAL,INFO/T_INT,INFO/T_FLOAT,INDEL');
+test_vcf_annotate($opts,in=>'annotate',tab=>'annotate2',out=>'annotate2.out',args=>'-c CHROM,FROM,TO,T_STR');
+test_vcf_annotate($opts,in=>'annotate',vcf=>'annots',out=>'annotate3.out',args=>'-c STR,ID,QUAL,FILTER');
+test_vcf_annotate($opts,in=>'annotate2',vcf=>'annots2',out=>'annotate4.out',args=>'-c ID,QUAL,FILTER,INFO,FMT');
+test_vcf_annotate($opts,in=>'annotate2',vcf=>'annots2',out=>'annotate5.out',args=>'-c ID,QUAL,+FILTER,+INFO,FMT/GT -s A');
+test_vcf_annotate($opts,in=>'annotate3',out=>'annotate6.out',args=>'-x ID,QUAL,^FILTER/fltA,FILTER/fltB,^INFO/AA,INFO/BB,^FMT/GT,FMT/PL');
+test_vcf_annotate($opts,in=>'annotate3',out=>'annotate7.out',args=>'-x FORMAT');
+test_vcf_annotate($opts,in=>'annotate4',vcf=>'annots4',out=>'annotate8.out',args=>'-c +INFO');
+test_vcf_annotate($opts,in=>'annotate4',tab=>'annots4',out=>'annotate8.out',args=>'-c CHROM,POS,REF,ALT,+FA,+FR,+IA,+IR,+SA,+SR');
+test_vcf_plugin($opts,in=>'plugin1',out=>'missing2ref.out',cmd=>'+missing2ref');
+test_vcf_plugin($opts,in=>'plugin1',out=>'fill-AN-AC.out',cmd=>'+fill-AN-AC');
+test_vcf_plugin($opts,in=>'plugin1',out=>'dosage.out',cmd=>'+dosage');
+test_vcf_plugin($opts,in=>'fixploidy',out=>'fixploidy.out',cmd=>'+fixploidy',args=>'-- -s {PATH}/fixploidy.samples -p {PATH}/fixploidy.ploidy');
+test_vcf_plugin($opts,in=>'vcf2sex',out=>'vcf2sex.out',cmd=>'+vcf2sex',args=>'-- -n 5');
+test_vcf_plugin($opts,in=>'vcf2sex',out=>'vcf2sex.out',cmd=>'+vcf2sex',args=>'-- -gn 5');
+test_vcf_concat($opts,in=>['concat.1.a','concat.1.b'],out=>'concat.1.vcf.out',do_bcf=>0,args=>'');
+test_vcf_concat($opts,in=>['concat.1.a','concat.1.b'],out=>'concat.1.bcf.out',do_bcf=>1,args=>'');
+test_vcf_concat($opts,in=>['concat.2.a','concat.2.b'],out=>'concat.2.vcf.out',do_bcf=>0,args=>'-a');
+test_vcf_concat($opts,in=>['concat.2.a','concat.2.b'],out=>'concat.2.bcf.out',do_bcf=>1,args=>'-a');
+test_vcf_concat($opts,in=>['concat.2.a','concat.2.b'],out=>'concat.4.vcf.out',do_bcf=>0,args=>'-aD');
+test_vcf_concat($opts,in=>['concat.2.a','concat.2.b'],out=>'concat.4.bcf.out',do_bcf=>1,args=>'-aD');
+test_vcf_concat($opts,in=>['concat.3.a','concat.3.b','concat.3.0','concat.3.c','concat.3.d','concat.3.e','concat.3.f'],out=>'concat.3.vcf.out',do_bcf=>0,args=>'-l');
+test_vcf_concat($opts,in=>['concat.3.a','concat.3.b','concat.3.0','concat.3.c','concat.3.d','concat.3.e','concat.3.f'],out=>'concat.3.bcf.out',do_bcf=>1,args=>'-l');
+test_vcf_reheader($opts,in=>'reheader',out=>'reheader.1.out',header=>'reheader.hdr');
+test_vcf_reheader($opts,in=>'reheader',out=>'reheader.2.out',samples=>'reheader.samples');
+test_vcf_reheader($opts,in=>'reheader',out=>'reheader.2.out',samples=>'reheader.samples2');
+test_rename_chrs($opts,in=>'annotate');
+test_vcf_convert($opts,in=>'convert',out=>'convert.gs.gt.gen',args=>'-g -,.');
+test_vcf_convert($opts,in=>'convert',out=>'convert.gs.gt.samples',args=>'-g .,-');
+test_vcf_convert($opts,in=>'convert',out=>'convert.gs.pl.gen',args=>'-g -,. --tag PL');
+test_vcf_convert($opts,in=>'convert',out=>'convert.gs.pl.samples',args=>'-g .,- --tag PL');
+test_vcf_convert($opts,in=>'check',out=>'check.gs.vcfids.gen',args=>'-g -,. --vcf-ids');
+test_vcf_convert($opts,in=>'check',out=>'check.gs.vcfids.samples',args=>'-g .,- --vcf-ids');
+test_vcf_convert($opts,in=>'check',out=>'check.gs.chrom.gen',args=>'-g -,. --chrom');
+test_vcf_convert($opts,in=>'check',out=>'check.gs.chrom.samples',args=>'-g .,- --chrom');
+test_vcf_convert($opts,in=>'check',out=>'check.gs.vcfids_chrom.gen',args=>'-g -,. --chrom --vcf-ids');
+test_vcf_convert($opts,in=>'check',out=>'check.gs.vcfids_chrom.samples',args=>'-g .,- --chrom --vcf-ids');
+test_vcf_convert($opts,in=>'convert',out=>'convert.hls.haps',args=>'-h -,.,.');
+test_vcf_convert($opts,in=>'convert',out=>'convert.hls.legend',args=>'-h .,-,.');
+test_vcf_convert($opts,in=>'convert',out=>'convert.hls.samples',args=>'-h .,.,-');
+test_vcf_convert($opts,in=>'convert',out=>'convert.hs.hap',args=>'--hapsample -,.');
+test_vcf_convert($opts,in=>'convert',out=>'convert.hs.sample',args=>'--hapsample .,-');
+test_vcf_convert_gvcf($opts,in=>'convert.gvcf',out=>'convert.gvcf.out',args=>'--gvcf2vcf');
+test_vcf_convert_tsv2vcf($opts,in=>'convert.23andme',out=>'convert.23andme.vcf',args=>'-c ID,CHROM,POS,AA -s SAMPLE1',fai=>'23andme');
+test_vcf_consensus($opts,in=>'consensus',out=>'consensus.1.out',fa=>'consensus.fa',mask=>'consensus.tab',args=>'');
+test_vcf_consensus_chain($opts,in=>'consensus',out=>'consensus.1.chain',chain=>'consensus.1.chain',fa=>'consensus.fa',mask=>'consensus.tab',args=>'');
+test_vcf_consensus($opts,in=>'consensus',out=>'consensus.2.out',fa=>'consensus.fa',mask=>'consensus.tab',args=>'-H 1');
+test_vcf_consensus_chain($opts,in=>'consensus',out=>'consensus.2.chain',chain=>'consensus.2.chain',fa=>'consensus.fa',mask=>'consensus.tab',args=>'-H 1');
+test_vcf_consensus($opts,in=>'consensus',out=>'consensus.3.out',fa=>'consensus.fa',mask=>'consensus.tab',args=>'-i');
+test_vcf_consensus_chain($opts,in=>'consensus',out=>'consensus.3.chain',chain=>'consensus.3.chain',fa=>'consensus.fa',mask=>'consensus.tab',args=>'-i');
+test_vcf_consensus($opts,in=>'consensus',out=>'consensus.4.out',fa=>'consensus.fa',args=>'-H 1');
+test_vcf_consensus_chain($opts,in=>'consensus',out=>'consensus.4.chain',chain=>'consensus.4.chain',fa=>'consensus.fa',args=>'-H 1');
+
+print "\nNumber of tests:\n";
+printf "    total   .. %d\n", $$opts{nok}+$$opts{nfailed};
+printf "    passed  .. %d\n", $$opts{nok};
+printf "    failed  .. %d\n", $$opts{nfailed};
+print "\n";
+
+exit ($$opts{nfailed} != 0);
+
+#--------------------
+
+sub error
+{
+    my (@msg) = @_;
+    if ( scalar @msg ) { confess @msg; }
+    print
+        "About: htslib consistency test script\n",
+        "Usage: test.pl [OPTIONS]\n",
+        "Options:\n",
+        "   -p, --plugins                   Test also plugins, requires libhts.so.\n",
+        "   -r, --redo-outputs              Recreate expected output files.\n",
+        "   -t, --temp-dir <path>           When given, temporary files will not be removed.\n",
+        "   -h, -?, --help                  This help message.\n",
+        "\n";
+    exit -1;
+}
+sub parse_params
+{
+    my $opts = { bgzip=>"bgzip", keep_files=>0, nok=>0, nfailed=>0, tabix=>"tabix", plugins=>0 };
+    my $help;
+    Getopt::Long::Configure('bundling');
+    my $ret = GetOptions (
+            'e|exec=s' => sub { my ($tool, $path) = split /=/, $_[1]; $$opts{$tool} = $path if $path },
+            't|temp-dir:s' => \$$opts{keep_files},
+            'p|plugins' => \$$opts{test_plugins},
+            'r|redo-outputs' => \$$opts{redo_outputs},
+            'h|?|help' => \$help
+            );
+    if ( !$ret or $help ) { error(); }
+    $$opts{tmp} = $$opts{keep_files} ? $$opts{keep_files} : tempdir(CLEANUP=>1);
+    if ( $$opts{keep_files} ) { cmd("mkdir -p $$opts{keep_files}"); }
+    $$opts{path} = $FindBin::RealBin;
+    $$opts{bin}  = $FindBin::RealBin;
+    $$opts{bin}  =~ s{/test/?$}{};
+    return $opts;
+}
+sub _cmd
+{
+    my ($cmd) = @_;
+    my $kid_io;
+    my @out;
+    my $pid = open($kid_io, "-|");
+    if ( !defined $pid ) { error("Cannot fork: $!"); }
+    if ($pid)
+    {
+        # parent
+        @out = <$kid_io>;
+        close($kid_io);
+    }
+    else
+    {
+        # child
+        exec('/bin/bash', '-o','pipefail','-c', $cmd) or error("Cannot execute the command [/bin/sh -o pipefail -c $cmd]: $!");
+    }
+    return ($? >> 8, join('', at out));
+}
+sub cmd
+{
+    my ($cmd) = @_;
+    my ($ret,$out) = _cmd($cmd);
+    if ( $ret ) { error("The command failed: $cmd\n", $out); }
+    return $out;
+}
+sub test_cmd
+{
+    my ($opts,%args) = @_;
+    if ( !exists($args{out}) )
+    {
+        if ( !exists($args{in}) ) { error("FIXME: expected out or in key\n"); }
+        $args{out} = "$args{in}.out";
+    }
+    my ($package, $filename, $line, $test)=caller(1);
+    $test =~ s/^.+:://;
+
+    print "$test:\n";
+    print "\t$args{cmd}\n";
+
+    my ($ret,$out) = _cmd("$args{cmd}");
+    if ( $ret ) { failed($opts,$test,"Non-zero status $ret"); return; }
+    if ( $$opts{redo_outputs} && -e "$$opts{path}/$args{out}" )
+    {
+        rename("$$opts{path}/$args{out}","$$opts{path}/$args{out}.old");
+        open(my $fh,'>',"$$opts{path}/$args{out}") or error("$$opts{path}/$args{out}: $!");
+        print $fh $out;
+        close($fh);
+        my ($ret,$out) = _cmd("diff -q $$opts{path}/$args{out} $$opts{path}/$args{out}.old");
+        if ( !$ret && $out eq '' ) { unlink("$$opts{path}/$args{out}.old"); }
+        else
+        {
+            print "\tthe expected output changed, saving:\n";
+            print "\t  old .. $$opts{path}/$args{out}.old\n";
+            print "\t  new .. $$opts{path}/$args{out}\n";
+        }
+    }
+    my $exp = '';
+    if ( open(my $fh,'<',"$$opts{path}/$args{out}") )
+    {
+        my @exp = <$fh>;
+        $exp = join('', at exp);
+        close($fh);
+    }
+    elsif ( !$$opts{redo_outputs} ) { failed($opts,$test,"$$opts{path}/$args{out}: $!"); return; }
+
+    if ( $exp ne $out )
+    {
+        open(my $fh,'>',"$$opts{path}/$args{out}.new") or error("$$opts{path}/$args{out}.new");
+        print $fh $out;
+        close($fh);
+        if ( !-e "$$opts{path}/$args{out}" )
+        {
+            rename("$$opts{path}/$args{out}.new","$$opts{path}/$args{out}") or error("rename $$opts{path}/$args{out}.new $$opts{path}/$args{out}: $!");
+            print "\tthe file with expected output does not exist, creating new one:\n";
+            print "\t\t$$opts{path}/$args{out}\n";
+        }
+        else
+        {
+            failed($opts,$test,"The outputs differ:\n\t\t$$opts{path}/$args{out}\n\t\t$$opts{path}/$args{out}.new");
+        }
+        return;
+    }
+    passed($opts,$test);
+}
+sub failed
+{
+    my ($opts,$test,$reason) = @_;
+    $$opts{nfailed}++;
+    if ( defined $reason ) { print "\n\t$reason"; }
+    print "\n.. failed ...\n\n";
+}
+sub passed
+{
+    my ($opts,$test) = @_;
+    $$opts{nok}++;
+    print ".. ok\n\n";
+}
+sub is_file_newer
+{
+    my ($afile,$bfile) = @_;
+    my (@astat) = stat($afile) or return 0;
+    my (@bstat) = stat($bfile) or return 0;
+    if ( $astat[9]>$bstat[9] ) { return 1 }
+    return 0;
+}
+sub bgzip_tabix
+{
+    my ($opts,%args) = @_;
+    my $file = "$args{file}.$args{suffix}";
+    if ( $$opts{redo_outputs} or !-e "$$opts{tmp}/$file.gz" or is_file_newer("$$opts{path}/$file","$$opts{tmp}/$file.gz") )
+    {
+        cmd("cat $$opts{path}/$file | $$opts{bgzip} -c > $$opts{tmp}/$file.gz");
+    }
+    if ( $$opts{redo_outputs} or !-e "$$opts{tmp}/$file.gz.tbi" or is_file_newer("$$opts{tmp}/$file.gz","$$opts{tmp}/$file.gz.tbi") )
+    {
+        cmd("$$opts{tabix} -f $args{args} $$opts{tmp}/$file.gz");
+    }
+}
+sub bgzip_tabix_vcf
+{
+    my ($opts,$file) = @_;
+    bgzip_tabix($opts,file=>$file,suffix=>'vcf',args=>'-p vcf');
+}
+
+
+# The tests --------------------------
+
+sub test_tabix
+{
+    my ($opts,%args) = @_;
+    bgzip_tabix_vcf($opts,$args{in});
+    test_cmd($opts,%args,cmd=>"$$opts{tabix} $$opts{tmp}/$args{in}.vcf.gz $args{reg}");
+
+    cmd("$$opts{bin}/bcftools view -Ob $$opts{tmp}/$args{in}.vcf.gz > $$opts{tmp}/$args{in}.bcf");
+    cmd("$$opts{bin}/bcftools index -f $$opts{tmp}/$args{in}.bcf");
+    test_cmd($opts,%args,cmd=>"$$opts{bin}/bcftools view -H $$opts{tmp}/$args{in}.bcf $args{reg}");
+}
+sub test_index
+{
+    my ($opts,%args) = @_;
+    cmd("$$opts{bin}/bcftools view -Oz $$opts{path}/$args{in}.vcf > $$opts{tmp}/$args{in}.vcf.gz");
+    cmd("$$opts{bin}/bcftools index -f $$opts{tmp}/$args{in}.vcf.gz");
+    test_cmd($opts,%args,cmd=>"$$opts{bin}/bcftools view -H $$opts{tmp}/$args{in}.vcf.gz $args{reg}");
+
+    cmd("$$opts{bin}/bcftools view -Ob $$opts{path}/$args{in}.vcf > $$opts{tmp}/$args{in}.bcf");
+    cmd("$$opts{bin}/bcftools index -f $$opts{tmp}/$args{in}.bcf");
+    test_cmd($opts,%args,cmd=>"$$opts{bin}/bcftools view -H $$opts{tmp}/$args{in}.bcf $args{reg}");
+}
+
+sub test_vcf_idxstats
+{
+    my ($opts,%args) = @_;
+    cmd("$$opts{bin}/bcftools view -Oz $$opts{path}/$args{in}.vcf > $$opts{tmp}/$args{in}.vcf.gz");
+    cmd("$$opts{bin}/bcftools index --tbi -f $$opts{tmp}/$args{in}.vcf.gz");
+    test_cmd($opts,%args,cmd=>"$$opts{bin}/bcftools index $args{args} $$opts{tmp}/$args{in}.vcf.gz");
+    cmd("$$opts{bin}/bcftools index --csi -f $$opts{tmp}/$args{in}.vcf.gz");
+    test_cmd($opts,%args,cmd=>"$$opts{bin}/bcftools index $args{args} $$opts{tmp}/$args{in}.vcf.gz");
+
+    cmd("$$opts{bin}/bcftools view -Ob $$opts{path}/$args{in}.vcf > $$opts{tmp}/$args{in}.bcf");
+    cmd("$$opts{bin}/bcftools index -f $$opts{tmp}/$args{in}.bcf");
+    test_cmd($opts,%args,cmd=>"$$opts{bin}/bcftools index $args{args} $$opts{tmp}/$args{in}.bcf");
+}
+
+sub test_vcf_check
+{
+    my ($opts,%args) = @_;
+    bgzip_tabix_vcf($opts,$args{in});
+    test_cmd($opts,%args,cmd=>"$$opts{bin}/bcftools stats -s - $$opts{tmp}/$args{in}.vcf.gz | grep -v '^# The command' | grep -v '^# This' | grep -v '^ID\t'");
+    test_cmd($opts,%args,cmd=>"$$opts{bin}/bcftools view -Ob $$opts{tmp}/$args{in}.vcf.gz | $$opts{bin}/bcftools stats -s - | grep -v '^# The command' | grep -v '^# This' | grep -v '^ID\t'");
+}
+sub test_vcf_stats
+{
+    my ($opts,%args) = @_;
+    my $files = '';
+    for my $file (@{$args{in}})
+    {
+        bgzip_tabix_vcf($opts,$file);
+        $files .= " $$opts{tmp}/$file.vcf.gz";
+    }
+    test_cmd($opts,%args,cmd=>"$$opts{bin}/bcftools stats $args{args} $files | grep -v '^#' | grep -v '^ID\t'");
+}
+sub test_vcf_merge
+{
+    my ($opts,%args) = @_;
+    my @files;
+    for my $file (@{$args{in}})
+    {
+        bgzip_tabix_vcf($opts,$file);
+        push @files, "$$opts{tmp}/$file.vcf.gz";
+    }
+    my $args  = exists($args{args}) ? $args{args} : '';
+    my $files = join(' ', at files);
+    test_cmd($opts,%args,cmd=>"$$opts{bin}/bcftools merge $args $files | grep -v ^##bcftools_");
+    test_cmd($opts,%args,cmd=>"$$opts{bin}/bcftools merge -Ob $args $files | $$opts{bin}/bcftools view | grep -v ^##bcftools_");
+}
+sub test_vcf_isec
+{
+    my ($opts,%args) = @_;
+    my @files;
+    for my $file (@{$args{in}})
+    {
+        bgzip_tabix_vcf($opts,$file);
+        push @files, "$$opts{tmp}/$file.vcf.gz";
+    }
+    my $files = join(' ', at files);
+    test_cmd($opts,%args,cmd=>"$$opts{bin}/bcftools isec $args{args} $files");
+    test_cmd($opts,%args,cmd=>"$$opts{bin}/bcftools isec -Ob $args{args} $files");
+}
+sub test_vcf_isec2
+{
+    my ($opts,%args) = @_;
+    my @files;
+    for my $file (@{$args{vcf_in}})
+    {
+        bgzip_tabix_vcf($opts,$file);
+        push @files, "$$opts{tmp}/$file.vcf.gz";
+    }
+    my $files = join(' ', at files);
+    bgzip_tabix($opts,file=>$args{tab_in},suffix=>'tab',args=>'-s 1 -b 2 -e 3');
+    test_cmd($opts,%args,cmd=>"$$opts{bin}/bcftools isec $args{args} -T $$opts{tmp}/$args{tab_in}.tab.gz $files 2>/dev/null | grep -v ^##bcftools_");
+    test_cmd($opts,%args,cmd=>"$$opts{bin}/bcftools isec -Ob $args{args} -T $$opts{tmp}/$args{tab_in}.tab.gz $files 2>/dev/null | $$opts{bin}/bcftools view | grep -v ^##bcftools_");
+}
+sub test_vcf_query
+{
+    my ($opts,%args) = @_;
+    bgzip_tabix_vcf($opts,$args{in});
+    test_cmd($opts,%args,cmd=>"$$opts{bin}/bcftools query $args{args} $$opts{tmp}/$args{in}.vcf.gz");
+    test_cmd($opts,%args,cmd=>"$$opts{bin}/bcftools view -Ob $$opts{tmp}/$args{in}.vcf.gz | $$opts{bin}/bcftools query $args{args}");
+}
+sub test_vcf_convert
+{
+    my ($opts,%args) = @_;
+    bgzip_tabix_vcf($opts,$args{in});
+    test_cmd($opts,%args,cmd=>"$$opts{bin}/bcftools convert $args{args} $$opts{tmp}/$args{in}.vcf.gz");
+    test_cmd($opts,%args,cmd=>"$$opts{bin}/bcftools view -Ob $$opts{tmp}/$args{in}.vcf.gz | $$opts{bin}/bcftools convert $args{args}");
+}
+sub test_vcf_convert_gvcf
+{
+    my ($opts,%args) = @_;
+    bgzip_tabix_vcf($opts,$args{in});
+    test_cmd($opts,%args,cmd=>"$$opts{bin}/bcftools convert $args{args} $$opts{tmp}/$args{in}.vcf.gz | grep -v ^##bcftools");
+    test_cmd($opts,%args,cmd=>"$$opts{bin}/bcftools view -Ob $$opts{tmp}/$args{in}.vcf.gz | $$opts{bin}/bcftools convert $args{args} | grep -v ^##bcftools");
+}
+sub test_vcf_convert_tsv2vcf
+{
+    my ($opts,%args) = @_;
+    my $params = '';
+    if ( exists($args{args}) ) { $params .= " $args{args}"; }
+    if ( exists($args{fai} ) ) { $params .= " -f $$opts{path}/$args{fai}.fa"; }
+    test_cmd($opts,%args,cmd=>"$$opts{bin}/bcftools convert $params --tsv2vcf $$opts{path}/$args{in} | grep -v ^##bcftools_");
+    test_cmd($opts,%args,cmd=>"$$opts{bin}/bcftools convert -Ou $params --tsv2vcf $$opts{path}/$args{in} | $$opts{bin}/bcftools view | grep -v ^##bcftools_");
+}
+sub test_vcf_norm
+{
+    my ($opts,%args) = @_;
+    bgzip_tabix_vcf($opts,$args{in});
+    my $params = '';
+    if ( exists($args{args}) ) { $params .= " $args{args}"; }
+    if ( exists($args{fai} ) ) { $params .= " -f $$opts{path}/$args{fai}.fa"; }
+    test_cmd($opts,%args,cmd=>"$$opts{bin}/bcftools norm $params $$opts{tmp}/$args{in}.vcf.gz | grep -v ^##bcftools_");
+    test_cmd($opts,%args,cmd=>"$$opts{bin}/bcftools norm -Ob $params $$opts{tmp}/$args{in}.vcf.gz | $$opts{bin}/bcftools view | grep -v ^##bcftools_");
+}
+sub test_vcf_view
+{
+    my ($opts,%args) = @_;
+    bgzip_tabix_vcf($opts,$args{in});
+
+    if ( !exists($args{args}) ) { $args{args} = ''; }
+    if ( exists($args{tgts}) ) { $args{args} .= "-T $$opts{path}/$args{tgts}"; }
+    test_cmd($opts,%args,cmd=>"$$opts{bin}/bcftools view $args{args} $$opts{tmp}/$args{in}.vcf.gz $args{reg} | grep -v ^##bcftools_");
+    unless ($args{args} =~ /-H/) {
+        test_cmd($opts,%args,cmd=>"$$opts{bin}/bcftools view -Ob $args{args} $$opts{tmp}/$args{in}.vcf.gz $args{reg} | $$opts{bin}/bcftools view | grep -v ^##bcftools_");
+    }
+}
+sub test_vcf_call
+{
+    my ($opts,%args) = @_;
+    test_cmd($opts,%args,cmd=>"$$opts{bin}/bcftools call $args{args} $$opts{path}/$args{in}.vcf | grep -v ^##bcftools_");
+    test_cmd($opts,%args,cmd=>"$$opts{bin}/bcftools call -Ob $args{args} $$opts{path}/$args{in}.vcf | $$opts{bin}/bcftools view | grep -v ^##bcftools_");
+}
+sub test_vcf_call_cAls
+{
+    my ($opts,%args) = @_;
+    bgzip_tabix($opts,file=>$args{tab},suffix=>'tab',args=>'-s1 -b2 -e2');
+    test_cmd($opts,%args,cmd=>"$$opts{bin}/bcftools call -mA -C alleles -T $$opts{tmp}/$args{tab}.tab.gz $$opts{path}/$args{in}.vcf | grep -v ^##bcftools_");
+    test_cmd($opts,%args,cmd=>"$$opts{bin}/bcftools call -Ob -mA -C alleles -T $$opts{tmp}/$args{tab}.tab.gz $$opts{path}/$args{in}.vcf | $$opts{bin}/bcftools view | grep -v ^##bcftools_");
+}
+sub test_vcf_filter
+{
+    my ($opts,%args) = @_;
+    my $pipe = 'grep -v ^##bcftools_';
+    if ( exists($args{fmt}) )
+    {
+        $pipe = "$$opts{bin}/bcftools query -f '$args{fmt}'";
+    }
+    test_cmd($opts,%args,cmd=>"$$opts{bin}/bcftools filter $args{args} $$opts{path}/$args{in}.vcf | $pipe");
+    test_cmd($opts,%args,cmd=>"$$opts{bin}/bcftools filter -Ob $args{args} $$opts{path}/$args{in}.vcf | $$opts{bin}/bcftools view | $pipe");
+}
+sub test_vcf_regions
+{
+    my ($opts,%args) = @_;
+    bgzip_tabix_vcf($opts,$args{in});
+
+    # regions vs targets, holding tab in memory
+    my $query = q[%CHROM %POS %REF,%ALT\n];
+    test_cmd($opts,cmd=>qq[$$opts{bin}/bcftools query -f'$query' -T $$opts{path}/$args{in}.tab $$opts{tmp}/$args{in}.vcf.gz],out=>'regions.out');
+    test_cmd($opts,cmd=>qq[$$opts{bin}/bcftools view -Ob $$opts{tmp}/$args{in}.vcf.gz | $$opts{bin}/bcftools query -f'$query' -T $$opts{path}/$args{in}.tab],out=>'regions.out');
+    test_cmd($opts,cmd=>qq[$$opts{bin}/bcftools query -f'$query' -R $$opts{path}/$args{in}.tab $$opts{tmp}/$args{in}.vcf.gz],out=>'regions.out');
+
+    # regions vs targets, reading tabix-ed tab
+    cmd(qq[cat $$opts{path}/$args{in}.tab | $$opts{bgzip} -c > $$opts{tmp}/$args{in}.tab.gz]);
+    cmd(qq[$$opts{tabix} -f -s1 -b2 -e3 $$opts{tmp}/$args{in}.tab.gz]);
+    test_cmd($opts,cmd=>qq[$$opts{bin}/bcftools query -f'$query' -T $$opts{tmp}/$args{in}.tab.gz $$opts{tmp}/$args{in}.vcf.gz],out=>'regions.out');
+    test_cmd($opts,cmd=>qq[$$opts{bin}/bcftools view -Ob $$opts{tmp}/$args{in}.vcf.gz | $$opts{bin}/bcftools query -f'$query' -T $$opts{tmp}/$args{in}.tab.gz],out=>'regions.out');
+    test_cmd($opts,cmd=>qq[$$opts{bin}/bcftools query -f'$query' -R $$opts{tmp}/$args{in}.tab.gz $$opts{tmp}/$args{in}.vcf.gz],out=>'regions.out');
+
+    # regions vs targets, holding bed in memory
+    cmd(qq[cat $$opts{path}/$args{in}.tab | awk '{OFS="\\t"}{print \$1,\$2-1,\$3}' > $$opts{tmp}/$args{in}.bed]);
+    test_cmd($opts,cmd=>qq[$$opts{bin}/bcftools query -f'$query' -T $$opts{tmp}/$args{in}.bed $$opts{tmp}/$args{in}.vcf.gz],out=>'regions.out');
+    test_cmd($opts,cmd=>qq[$$opts{bin}/bcftools view -Ob $$opts{tmp}/$args{in}.vcf.gz | $$opts{bin}/bcftools query -f'$query' -T $$opts{tmp}/$args{in}.bed],out=>'regions.out');
+    test_cmd($opts,cmd=>qq[$$opts{bin}/bcftools query -f'$query' -R $$opts{tmp}/$args{in}.bed $$opts{tmp}/$args{in}.vcf.gz],out=>'regions.out');
+
+    # regions vs targets, reading tabix-ed bed
+    cmd(qq[cat $$opts{tmp}/$args{in}.bed | $$opts{bgzip} -c > $$opts{tmp}/$args{in}.bed.gz]);
+    cmd(qq[$$opts{tabix} -f -p bed $$opts{tmp}/$args{in}.bed.gz]);
+    test_cmd($opts,cmd=>qq[$$opts{bin}/bcftools query -f'$query' -T $$opts{tmp}/$args{in}.bed.gz $$opts{tmp}/$args{in}.vcf.gz],out=>'regions.out');
+    test_cmd($opts,cmd=>qq[$$opts{bin}/bcftools view -Ob $$opts{tmp}/$args{in}.vcf.gz | $$opts{bin}/bcftools query -f'$query' -T $$opts{tmp}/$args{in}.bed.gz],out=>'regions.out');
+    test_cmd($opts,cmd=>qq[$$opts{bin}/bcftools query -f'$query' -R $$opts{tmp}/$args{in}.bed.gz $$opts{tmp}/$args{in}.vcf.gz],out=>'regions.out');
+}
+sub test_usage
+{
+    my ($opts,%args) = @_;
+
+    my $test = "test_usage";
+    print "$test:\n";
+    print "\t$args{cmd}\n";
+
+    my $tty_input;
+    if (-t) {
+        $args{redirection} = "";  # no redirection necessary
+    }
+    elsif (eval { require IO::Pty }) {
+        $tty_input = new IO::Pty;
+        # ensure stdin is a terminal, so that subcommands display their usage
+        $args{redirection} = "<'" . $tty_input->ttyname . "'";
+    }
+    else {
+        warn "$0: module IO::Pty not found; skipping usage tests\n";
+        return;
+    }
+
+    my $command = $args{cmd};
+    my $commandpath = $$opts{bin}."/".$command;
+    my ($ret,$out) = _cmd("$commandpath $args{redirection} 2>&1");
+    if ( $out =~ m/\/bin\/bash.*no.*such/i ) { failed($opts,$test,"could not run $commandpath: $out"); return; }
+
+    my @sections = ($out =~ m/(^[A-Za-z]+.*?)(?:(?=^[A-Za-z]+:)|\z)/msg);
+
+    my $have_usage = 0;
+    my $have_version = 0;
+    my $have_subcommands = 0;
+    my $usage = "";
+    my @subcommands = ();
+    foreach my $section (@sections) {
+        if ( $section =~ m/^usage/i ) {
+            $have_usage = 1;
+            $section =~ s/^[[:word:]]+[[:punct:]]?[[:space:]]*//;
+            $usage = $section;
+        } elsif ( $section =~ m/^version/i ) {
+            $have_version = 1;
+        } elsif ( $section =~ m/^command/i ) {
+            $have_subcommands = 1;
+            foreach my $line (split /\n/, $section) {
+                push @subcommands, $1 if $line =~ /^\s{2,}(\w+)\s{2,}/;
+            }
+        }
+    }
+
+    if ( !$have_usage ) { failed($opts,$test,"did not have Usage:"); return; }
+    if ( !$have_version ) { failed($opts,$test,"did not have Version:"); return; }
+    if ( !$have_subcommands ) { failed($opts,$test,"did not have Commands:"); return; }
+
+    if ( !($usage =~ m/$command/) ) { failed($opts,$test,"usage did not mention $command"); return; }
+
+    if ( scalar(@subcommands) < 1 ) { failed($opts,$test,"could not parse subcommands"); return; }
+
+    passed($opts,$test);
+
+    # now test subcommand usage as well
+    foreach my $subcommand (@subcommands) {
+        test_usage_subcommand($opts,%args,subcmd=>$subcommand);
+    }
+}
+sub test_usage_subcommand
+{
+    my ($opts,%args) = @_;
+
+    my $test = "test_usage_subcommand";
+    print "$test:\n";
+    print "\t$args{cmd} $args{subcmd}\n";
+
+    my $command = $args{cmd};
+    my $subcommand = $args{subcmd};
+    my $commandpath = $$opts{bin}."/".$command;
+    my ($ret,$out) = _cmd("$commandpath $subcommand $args{redirection} 2>&1");
+    if ( $out =~ m/\/bin\/bash.*no.*such/i ) { failed($opts,$test,"could not run $commandpath $subcommand: $out"); return; }
+
+    my @sections = ($out =~ m/(^[A-Za-z]+.*?)(?:(?=^[A-Za-z]+:)|\z)/msg);
+
+    my $have_usage = 0;
+    my $usage = "";
+    foreach my $section (@sections) {
+        if ( $section =~ m/^usage/i ) {
+            $have_usage = 1;
+            $section =~ s/^[[:word:]]+[[:punct:]]?[[:space:]]*//;
+            $usage = $section;
+        }
+    }
+
+    if ( !$have_usage ) { failed($opts,$test,"did not have Usage:"); return; }
+
+    if ( !($usage =~ m/$command[[:space:]]+$subcommand/) ) { failed($opts,$test,"usage did not mention $command $subcommand"); return; }
+
+    passed($opts,$test);
+}
+sub test_vcf_annotate
+{
+    my ($opts,%args) = @_;
+    my ($annot_fname,$in_fname,$hdr);
+    if ( exists($args{tab}) )
+    {
+        bgzip_tabix($opts,file=>$args{tab},suffix=>'tab',args=>'-s1 -b2 -e2');
+        $annot_fname = "-a $$opts{tmp}/$args{tab}.tab.gz";
+        $in_fname = "$$opts{path}/$args{in}.vcf";
+        $hdr = "-h $$opts{path}/$args{in}.hdr";
+    }
+    elsif ( exists($args{vcf}) )
+    {
+        bgzip_tabix_vcf($opts,"$args{in}");
+        bgzip_tabix_vcf($opts,$args{vcf});
+        $annot_fname = "-a $$opts{tmp}/$args{vcf}.vcf.gz";
+        $in_fname = "$$opts{tmp}/$args{in}.vcf.gz";
+        $hdr = '';
+    }
+    else
+    {
+        $in_fname = "$$opts{path}/$args{in}.vcf";
+        $annot_fname = '';
+        $hdr = '';
+    }
+    test_cmd($opts,%args,cmd=>"$$opts{bin}/bcftools annotate $annot_fname $hdr $args{args} $in_fname | $$opts{bin}/bcftools view | grep -v ^##bcftools_");
+    test_cmd($opts,%args,cmd=>"$$opts{bin}/bcftools annotate -Ob $annot_fname $hdr $args{args} $in_fname | $$opts{bin}/bcftools view | grep -v ^##bcftools_");
+}
+sub test_vcf_plugin
+{
+    my ($opts,%args) = @_;
+    if ( !$$opts{test_plugins} ) { return; }
+    $ENV{BCFTOOLS_PLUGINS} = "$$opts{bin}/plugins";
+    if ( !exists($args{args}) ) { $args{args} = ''; }
+    $args{args} =~ s/{PATH}/$$opts{path}/g;
+    bgzip_tabix_vcf($opts,"$args{in}");
+    test_cmd($opts,%args,cmd=>"$$opts{bin}/bcftools $args{cmd} $$opts{tmp}/$args{in}.vcf.gz $args{args} | grep -v ^##bcftools_");
+
+    cmd("$$opts{bin}/bcftools view -Ob $$opts{tmp}/$args{in}.vcf.gz > $$opts{tmp}/$args{in}.bcf");
+    cmd("$$opts{bin}/bcftools index -f $$opts{tmp}/$args{in}.bcf");
+    test_cmd($opts,%args,cmd=>"$$opts{bin}/bcftools $args{cmd} $$opts{tmp}/$args{in}.bcf $args{args} | grep -v ^##bcftools_");
+}
+sub test_vcf_concat
+{
+    my ($opts,%args) = @_;
+    my $files;
+    for my $file (@{$args{in}})
+    {
+        if ( $args{do_bcf} )
+        {
+            cmd("$$opts{bin}/bcftools view -Ob $$opts{tmp}/$file.vcf.gz > $$opts{tmp}/$file.bcf");
+            cmd("$$opts{bin}/bcftools index -f $$opts{tmp}/$file.bcf");
+            $files .= " $$opts{tmp}/$file.bcf";
+        }
+        else
+        {
+            bgzip_tabix_vcf($opts,$file);
+            $files .= " $$opts{tmp}/$file.vcf.gz";
+        }
+    }
+    test_cmd($opts,%args,cmd=>"$$opts{bin}/bcftools concat $args{args} $files | grep -v ^##bcftools_");
+    test_cmd($opts,%args,cmd=>"$$opts{bin}/bcftools concat -Ob $args{args} $files | $$opts{bin}/bcftools view | grep -v ^##bcftools_");
+}
+sub test_vcf_reheader
+{
+    my ($opts,%args) = @_;
+    cmd("$$opts{bin}/bcftools view -Ob $$opts{path}/$args{in}.vcf > $$opts{tmp}/$args{in}.bcf");
+    cmd("$$opts{bin}/bcftools view -Oz $$opts{path}/$args{in}.vcf > $$opts{tmp}/$args{in}.vcf.gz");
+
+    my $arg = exists($args{header}) ? "-h $$opts{path}/$args{header}" : "-s $$opts{path}/$args{samples}";
+    for my $file ("$$opts{path}/$args{in}.vcf","$$opts{tmp}/$args{in}.bcf","$$opts{tmp}/$args{in}.vcf.gz")
+    {
+        # bcf header lines can come in different order
+        my %bcf_args = ();
+        if ( $file=~/\.bcf$/ && -e "$$opts{path}/$args{out}.bcf" ) { %bcf_args = ( out=>"$args{out}.bcf" ); }
+        test_cmd($opts,%args,%bcf_args,cmd=>"$$opts{bin}/bcftools reheader $arg $file | $$opts{bin}/bcftools view | grep -v ^##bcftools_");
+        test_cmd($opts,%args,%bcf_args,cmd=>"cat $file | $$opts{bin}/bcftools reheader $arg | $$opts{bin}/bcftools view | grep -v ^##bcftools_");
+    }
+}
+sub test_rename_chrs
+{
+    my ($opts,%args) = @_;
+    cmd("$$opts{bin}/bcftools view -Ob $$opts{path}/$args{in}.vcf > $$opts{tmp}/$args{in}.bcf");
+    cmd("$$opts{bin}/bcftools query -f'chr%CHROM\\t%POS\\n' $$opts{path}/$args{in}.vcf > $$opts{path}/rename.out.tmp");
+    cmd("$$opts{bin}/bcftools query -f'%CHROM\\tchr%CHROM\\n' $$opts{path}/$args{in}.vcf | uniq > $$opts{tmp}/rename.map");
+    my $prevfailed = $$opts{nfailed};
+    for my $file ("$$opts{tmp}/$args{in}.bcf","$$opts{path}/$args{in}.vcf")
+    {
+        test_cmd($opts,%args,out=>"rename.out.tmp",cmd=>"$$opts{bin}/bcftools annotate --rename-chrs $$opts{tmp}/rename.map -Ov $file | $$opts{bin}/bcftools query -f'%CHROM\\t%POS\\n'");
+        test_cmd($opts,%args,out=>"rename.out.tmp",cmd=>"$$opts{bin}/bcftools annotate --rename-chrs $$opts{tmp}/rename.map -Ob $file | $$opts{bin}/bcftools query -f'%CHROM\\t%POS\\n'");
+    }
+    unlink "$$opts{path}/rename.out.tmp" if $$opts{nfailed} == $prevfailed;
+}
+sub test_vcf_consensus
+{
+    my ($opts,%args) = @_;
+    bgzip_tabix_vcf($opts,$args{in});
+    my $mask = $args{mask} ? "-m $$opts{path}/$args{mask}" : '';
+    my $chain = $args{chain} ? "-c $$opts{tmp}/$args{chain}" : '';
+    test_cmd($opts,%args,cmd=>"$$opts{bin}/bcftools consensus $$opts{tmp}/$args{in}.vcf.gz -f $$opts{path}/$args{fa} $args{args} $mask $chain");
+}
+sub test_vcf_consensus_chain
+{
+    my ($opts,%args) = @_;
+    bgzip_tabix_vcf($opts,$args{in});
+    my $mask = $args{mask} ? "-m $$opts{path}/$args{mask}" : '';
+    my $chain = $args{chain} ? "-c $$opts{tmp}/$args{chain}.new" : '';
+    test_cmd($opts,%args,cmd=>"$$opts{bin}/bcftools consensus $$opts{tmp}/$args{in}.vcf.gz -f $$opts{path}/$args{fa} $args{args} $mask $chain > /dev/null; cat $$opts{tmp}/$args{chain}.new");
+}
+
diff --git a/test/vcf2sex.out b/test/vcf2sex.out
new file mode 100644
index 0000000..894f6ef
--- /dev/null
+++ b/test/vcf2sex.out
@@ -0,0 +1,2 @@
+MALE	M
+FEMALE	F
diff --git a/test/vcf2sex.vcf b/test/vcf2sex.vcf
new file mode 100644
index 0000000..81d3f8d
--- /dev/null
+++ b/test/vcf2sex.vcf
@@ -0,0 +1,24 @@
+##fileformat=VCFv4.2
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##contig=<ID=X,assembly=b37,length=249250621>
+##contig=<ID=Y,assembly=b37,length=249250621>
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	MALE	FEMALE
+X	1	.	C	A	.	PASS	.	GT	1	0/1
+X	12000	.	C	A	.	PASS	.	GT	0	0/1
+X	24000	.	C	A	.	PASS	.	GT	1	0/1
+X	36000	.	C	A	.	PASS	.	GT	0	0/1
+X	48000	.	C	A	.	PASS	.	GT	1	0/1
+X	60000	.	C	A	.	PASS	.	GT	0	0/1
+X	100000	.	C	A	.	PASS	.	GT	0/1	0/1
+X	2699521	.	C	A	.	PASS	.	GT	0	0/1
+X	33145825	.	C	A	.	PASS	.	GT	1	0/1
+X	63592129	.	C	A	.	PASS	.	GT	1	0/1
+X	94038433	.	C	A	.	PASS	.	GT	0	0/1
+X	124484737	.	C	A	.	PASS	.	GT	0	0/1
+X	154931043	.	C	A	.	PASS	.	GT	0/1	0/1
+Y	1	.	C	A	.	PASS	.	GT	0	.
+Y	11874713	.	C	A	.	PASS	.	GT	0	.
+Y	23749426	.	C	A	.	PASS	.	GT	0	.
+Y	35624139	.	C	A	.	PASS	.	GT	0	.
+Y	47498852	.	C	A	.	PASS	.	GT	0	.
+Y	59373565	.	C	A	.	PASS	.	GT	0	.
diff --git a/test/view.1.out b/test/view.1.out
new file mode 100644
index 0000000..15fc23f
--- /dev/null
+++ b/test/view.1.out
@@ -0,0 +1,39 @@
+##fileformat=VCFv4.1
+##FILTER=<ID=PASS,Description="All filters passed">
+##reference=file:///seq/references/1000Genomes-NCBI37.fasta
+##contig=<ID=11,length=135006516>
+##contig=<ID=20,length=63025520>
+##contig=<ID=X,length=155270560>
+##contig=<ID=Y,length=59373566>
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Raw read depth">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##INFO=<ID=Dels,Number=1,Type=Float,Description="Fraction of reads containing spanning deletions">
+##INFO=<ID=FS,Number=1,Type=Float,Description="Phred-scaled p-value using Fisher's exact test to detect strand bias">
+##INFO=<ID=HRun,Number=1,Type=Integer,Description="Largest contiguous homopolymer run of variant allele in either direction">
+##INFO=<ID=HWE,Number=1,Type=Float,Description="Hardy-Weinberg equilibrium test (PMID:15789306)">
+##INFO=<ID=ICF,Number=1,Type=Float,Description="Inbreeding coefficient F">
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##INFO=<ID=IS,Number=2,Type=Float,Description="Maximum number of reads supporting an indel and fraction of indel reads">
+##INFO=<ID=MQ,Number=1,Type=Integer,Description="Root-mean-square mapping quality of covering reads">
+##INFO=<ID=MQ0,Number=1,Type=Integer,Description="Total mapping quality zero reads">
+##INFO=<ID=PV4,Number=4,Type=Float,Description="P-values for strand bias, baseQ bias, mapQ bias and tail distance bias">
+##INFO=<ID=QD,Number=1,Type=Float,Description="Variant confidence/quality by depth">
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="# high-quality bases">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=PL,Number=G,Type=Integer,Description="List of Phred-scaled genotype likelihoods">
+##FILTER=<ID=StrandBias,Description="Min P-value for strand bias (INFO/PV4) [0.0001]">
+##FILTER=<ID=BaseQualBias,Description="Min P-value for baseQ bias (INFO/PV4) [1e-100]">
+##FILTER=<ID=MapQualBias,Description="Min P-value for mapQ bias (INFO/PV4) [0]">
+##FILTER=<ID=EndDistBias,Description="Min P-value for end distance bias (INFO/PV4) [0.0001]">
+##FILTER=<ID=MinAB,Description="Minimum number of alternate bases (INFO/DP4) [2]">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	NA00002
+20	138125	rs2298108	G	T	999	PASS	DP4=174391,20849,82080,4950;DP=286107;Dels=0;FS=3200;HWE=0.199462;ICF=0.01858;MQ0=0;MQ=46;PV4=0,0,0,1;QD=17.22;AN=2;AC=1	GT:PL:DP:GQ	0/1:140,0,255:71:99
+20	138148	rs2298109	C	T	999	PASS	DP4=194136,45753,94945,14367;DP=356657;Dels=0;FS=3200;HWE=0.177865;ICF=0.0198;MQ0=0;MQ=47;PV4=0,0,0,1;QD=14.57;AN=2;AC=1	GT:PL:DP:GQ	0/1:192,0,255:82:99
+20	304568	.	C	T	999	PASS	DP4=16413,4543,945,156;DP=43557;Dels=0;FS=3200;HWE=0.076855;ICF=0.0213;MQ0=0;MQ=50;PV4=0,0,0,1;QD=15.45;AN=2;AC=1	GT:PL:DP:GQ	0|1:192,0,255:13:99
+X	2942109	rs5939407	T	C	999	PASS	DP4=23273,27816,40128,48208;DP=146673;Dels=0;FS=43.639;HWE=0.622715;ICF=-0.01176;MQ0=1;MQ=46;PV4=0.65,1,0,1;QD=14.81;AN=1;AC=1	GT:PL:DP:GQ	1:255,0:33:99
+X	3048719	.	T	C	999	PASS	DP4=13263,27466,40128,48208;DP=146673;Dels=0;FS=43.639;HWE=0.622715;ICF=-0.01176;MQ0=1;MQ=46;PV4=0.65,1,0,1;QD=14.81;AN=1;AC=1	GT:PL:DP:GQ	1:255,0:33:99
+Y	8657215	.	C	A	999	PASS	DP4=74915,114274,1948,2955;DP=195469;Dels=0;FS=3.181;MQ0=0;MQ=50;PV4=0.86,1,0,1;QD=33.77;AN=1;AC=1	GT:PL:DP:GQ	1:255,0:64:99
+Y	10011673	rs78249411	G	A	999	MinAB	DP4=47351,30839,178796,279653;DP=550762;Dels=0;FS=41.028;MQ0=37362;MQ=26;PV4=0,0,0,1;QD=17.45;AN=1;AC=1	GT:PL:DP:GQ	1:95,0:130:99
diff --git a/test/view.10.out b/test/view.10.out
new file mode 100644
index 0000000..9ef4bce
--- /dev/null
+++ b/test/view.10.out
@@ -0,0 +1,36 @@
+##fileformat=VCFv4.1
+##FILTER=<ID=PASS,Description="All filters passed">
+##reference=file:///seq/references/1000Genomes-NCBI37.fasta
+##contig=<ID=11,length=135006516>
+##contig=<ID=20,length=63025520>
+##contig=<ID=X,length=155270560>
+##contig=<ID=Y,length=59373566>
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Raw read depth">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##INFO=<ID=Dels,Number=1,Type=Float,Description="Fraction of reads containing spanning deletions">
+##INFO=<ID=FS,Number=1,Type=Float,Description="Phred-scaled p-value using Fisher's exact test to detect strand bias">
+##INFO=<ID=HRun,Number=1,Type=Integer,Description="Largest contiguous homopolymer run of variant allele in either direction">
+##INFO=<ID=HWE,Number=1,Type=Float,Description="Hardy-Weinberg equilibrium test (PMID:15789306)">
+##INFO=<ID=ICF,Number=1,Type=Float,Description="Inbreeding coefficient F">
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##INFO=<ID=IS,Number=2,Type=Float,Description="Maximum number of reads supporting an indel and fraction of indel reads">
+##INFO=<ID=MQ,Number=1,Type=Integer,Description="Root-mean-square mapping quality of covering reads">
+##INFO=<ID=MQ0,Number=1,Type=Integer,Description="Total mapping quality zero reads">
+##INFO=<ID=PV4,Number=4,Type=Float,Description="P-values for strand bias, baseQ bias, mapQ bias and tail distance bias">
+##INFO=<ID=QD,Number=1,Type=Float,Description="Variant confidence/quality by depth">
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="# high-quality bases">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=PL,Number=G,Type=Integer,Description="List of Phred-scaled genotype likelihoods">
+##FILTER=<ID=StrandBias,Description="Min P-value for strand bias (INFO/PV4) [0.0001]">
+##FILTER=<ID=BaseQualBias,Description="Min P-value for baseQ bias (INFO/PV4) [1e-100]">
+##FILTER=<ID=MapQualBias,Description="Min P-value for mapQ bias (INFO/PV4) [0]">
+##FILTER=<ID=EndDistBias,Description="Min P-value for end distance bias (INFO/PV4) [0.0001]">
+##FILTER=<ID=MinAB,Description="Minimum number of alternate bases (INFO/DP4) [2]">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	NA00001	NA00002	NA00003
+11	2343543	.	A	.	999	PASS	DP=100223	GT:PL:DP:GQ	0/0:0,255,255:193:99	0/0:0,255,255:211:99	0/0:0,255,255:182:99
+11	5464562	.	C	T	999	PASS	DP=0	GT:PL:DP:GQ	./.:0,0,0:.:.	./.:0,0,0:.:.	./.:0,0,0:.:.
+X	3048719	.	T	C	999	PASS	DP4=13263,27466,40128,48208;DP=146673;Dels=0;FS=43.639;HWE=0.622715;ICF=-0.01176;MQ0=1;MQ=46;PV4=0.65,1,0,1;QD=14.81;AN=4;AC=3	GT:PL:DP:GQ	0:0,255:20:99	1:255,0:33:99	0|1:255,0,157:52:99
+Y	8657215	.	C	A	999	PASS	DP4=74915,114274,1948,2955;DP=195469;Dels=0;FS=3.181;MQ0=0;MQ=50;PV4=0.86,1,0,1;QD=33.77;AN=2;AC=1	GT:PL:DP:GQ	0:0,255:47:99	1:255,0:64:99	.:.:.:.
diff --git a/test/view.2.out b/test/view.2.out
new file mode 100644
index 0000000..437e274
--- /dev/null
+++ b/test/view.2.out
@@ -0,0 +1,35 @@
+##fileformat=VCFv4.1
+##FILTER=<ID=PASS,Description="All filters passed">
+##reference=file:///seq/references/1000Genomes-NCBI37.fasta
+##contig=<ID=11,length=135006516>
+##contig=<ID=20,length=63025520>
+##contig=<ID=X,length=155270560>
+##contig=<ID=Y,length=59373566>
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Raw read depth">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##INFO=<ID=Dels,Number=1,Type=Float,Description="Fraction of reads containing spanning deletions">
+##INFO=<ID=FS,Number=1,Type=Float,Description="Phred-scaled p-value using Fisher's exact test to detect strand bias">
+##INFO=<ID=HRun,Number=1,Type=Integer,Description="Largest contiguous homopolymer run of variant allele in either direction">
+##INFO=<ID=HWE,Number=1,Type=Float,Description="Hardy-Weinberg equilibrium test (PMID:15789306)">
+##INFO=<ID=ICF,Number=1,Type=Float,Description="Inbreeding coefficient F">
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##INFO=<ID=IS,Number=2,Type=Float,Description="Maximum number of reads supporting an indel and fraction of indel reads">
+##INFO=<ID=MQ,Number=1,Type=Integer,Description="Root-mean-square mapping quality of covering reads">
+##INFO=<ID=MQ0,Number=1,Type=Integer,Description="Total mapping quality zero reads">
+##INFO=<ID=PV4,Number=4,Type=Float,Description="P-values for strand bias, baseQ bias, mapQ bias and tail distance bias">
+##INFO=<ID=QD,Number=1,Type=Float,Description="Variant confidence/quality by depth">
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="# high-quality bases">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=PL,Number=G,Type=Integer,Description="List of Phred-scaled genotype likelihoods">
+##FILTER=<ID=StrandBias,Description="Min P-value for strand bias (INFO/PV4) [0.0001]">
+##FILTER=<ID=BaseQualBias,Description="Min P-value for baseQ bias (INFO/PV4) [1e-100]">
+##FILTER=<ID=MapQualBias,Description="Min P-value for mapQ bias (INFO/PV4) [0]">
+##FILTER=<ID=EndDistBias,Description="Min P-value for end distance bias (INFO/PV4) [0.0001]">
+##FILTER=<ID=MinAB,Description="Minimum number of alternate bases (INFO/DP4) [2]">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	NA00003
+20	76962	rs6111385	T	C	999	PASS	DP4=110138,70822,421911,262673;DP=911531;Dels=0;FS=21.447;HWE=0.491006;ICF=-0.01062;MQ0=1;MQ=46;PV4=2.5e-09,0,0,1;QD=22.31;AC=2;AN=2	GT:PL:DP:GQ	1/1:255,255,0:182:99
+20	138125	rs2298108	G	T	999	PASS	DP4=174391,20849,82080,4950;DP=286107;Dels=0;FS=3200;HWE=0.199462;ICF=0.01858;MQ0=0;MQ=46;PV4=0,0,0,1;QD=17.22;AN=2;AC=2	GT:PL:DP:GQ	1/1:255,199,0:66:99
+20	138148	rs2298109	C	T	999	PASS	DP4=194136,45753,94945,14367;DP=356657;Dels=0;FS=3200;HWE=0.177865;ICF=0.0198;MQ0=0;MQ=47;PV4=0,0,0,1;QD=14.57;AN=2;AC=2	GT:PL:DP:GQ	1/1:255,235,0:78:99
diff --git a/test/view.3.out b/test/view.3.out
new file mode 100644
index 0000000..6752be6
--- /dev/null
+++ b/test/view.3.out
@@ -0,0 +1,34 @@
+##fileformat=VCFv4.1
+##FILTER=<ID=PASS,Description="All filters passed">
+##reference=file:///seq/references/1000Genomes-NCBI37.fasta
+##contig=<ID=11,length=135006516>
+##contig=<ID=20,length=63025520>
+##contig=<ID=X,length=155270560>
+##contig=<ID=Y,length=59373566>
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Raw read depth">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##INFO=<ID=Dels,Number=1,Type=Float,Description="Fraction of reads containing spanning deletions">
+##INFO=<ID=FS,Number=1,Type=Float,Description="Phred-scaled p-value using Fisher's exact test to detect strand bias">
+##INFO=<ID=HRun,Number=1,Type=Integer,Description="Largest contiguous homopolymer run of variant allele in either direction">
+##INFO=<ID=HWE,Number=1,Type=Float,Description="Hardy-Weinberg equilibrium test (PMID:15789306)">
+##INFO=<ID=ICF,Number=1,Type=Float,Description="Inbreeding coefficient F">
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##INFO=<ID=IS,Number=2,Type=Float,Description="Maximum number of reads supporting an indel and fraction of indel reads">
+##INFO=<ID=MQ,Number=1,Type=Integer,Description="Root-mean-square mapping quality of covering reads">
+##INFO=<ID=MQ0,Number=1,Type=Integer,Description="Total mapping quality zero reads">
+##INFO=<ID=PV4,Number=4,Type=Float,Description="P-values for strand bias, baseQ bias, mapQ bias and tail distance bias">
+##INFO=<ID=QD,Number=1,Type=Float,Description="Variant confidence/quality by depth">
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="# high-quality bases">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=PL,Number=G,Type=Integer,Description="List of Phred-scaled genotype likelihoods">
+##FILTER=<ID=StrandBias,Description="Min P-value for strand bias (INFO/PV4) [0.0001]">
+##FILTER=<ID=BaseQualBias,Description="Min P-value for baseQ bias (INFO/PV4) [1e-100]">
+##FILTER=<ID=MapQualBias,Description="Min P-value for mapQ bias (INFO/PV4) [0]">
+##FILTER=<ID=EndDistBias,Description="Min P-value for end distance bias (INFO/PV4) [0.0001]">
+##FILTER=<ID=MinAB,Description="Minimum number of alternate bases (INFO/DP4) [2]">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	NA00003
+X	2928329	rs62584840	C	T	999	PASS	DP4=302,9137,32,1329;DP=11020;Dels=0;FS=13.38;HWE=0.284332;ICF=0.0253;MQ0=0;MQ=49;PV4=0.094,0,0,1;QD=18.61;AN=2;AC=1	GT:PL:DP:GQ	0/1:73,0,19:4:30
+X	2933066	rs61746890	G	C	999	PASS	DP4=69865,100561,461,783;DP=173729;Dels=0;FS=10.833;MQ0=0;MQ=50;PV4=0.005,3.6e-14,0,1;QD=15.33;AN=2;AC=1	GT:PL:DP:GQ	0/1:255,255,255:62:99
diff --git a/test/view.4.out b/test/view.4.out
new file mode 100644
index 0000000..863f524
--- /dev/null
+++ b/test/view.4.out
@@ -0,0 +1,34 @@
+##fileformat=VCFv4.1
+##FILTER=<ID=PASS,Description="All filters passed">
+##reference=file:///seq/references/1000Genomes-NCBI37.fasta
+##contig=<ID=11,length=135006516>
+##contig=<ID=20,length=63025520>
+##contig=<ID=X,length=155270560>
+##contig=<ID=Y,length=59373566>
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Raw read depth">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##INFO=<ID=Dels,Number=1,Type=Float,Description="Fraction of reads containing spanning deletions">
+##INFO=<ID=FS,Number=1,Type=Float,Description="Phred-scaled p-value using Fisher's exact test to detect strand bias">
+##INFO=<ID=HRun,Number=1,Type=Integer,Description="Largest contiguous homopolymer run of variant allele in either direction">
+##INFO=<ID=HWE,Number=1,Type=Float,Description="Hardy-Weinberg equilibrium test (PMID:15789306)">
+##INFO=<ID=ICF,Number=1,Type=Float,Description="Inbreeding coefficient F">
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##INFO=<ID=IS,Number=2,Type=Float,Description="Maximum number of reads supporting an indel and fraction of indel reads">
+##INFO=<ID=MQ,Number=1,Type=Integer,Description="Root-mean-square mapping quality of covering reads">
+##INFO=<ID=MQ0,Number=1,Type=Integer,Description="Total mapping quality zero reads">
+##INFO=<ID=PV4,Number=4,Type=Float,Description="P-values for strand bias, baseQ bias, mapQ bias and tail distance bias">
+##INFO=<ID=QD,Number=1,Type=Float,Description="Variant confidence/quality by depth">
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="# high-quality bases">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=PL,Number=G,Type=Integer,Description="List of Phred-scaled genotype likelihoods">
+##FILTER=<ID=StrandBias,Description="Min P-value for strand bias (INFO/PV4) [0.0001]">
+##FILTER=<ID=BaseQualBias,Description="Min P-value for baseQ bias (INFO/PV4) [1e-100]">
+##FILTER=<ID=MapQualBias,Description="Min P-value for mapQ bias (INFO/PV4) [0]">
+##FILTER=<ID=EndDistBias,Description="Min P-value for end distance bias (INFO/PV4) [0.0001]">
+##FILTER=<ID=MinAB,Description="Minimum number of alternate bases (INFO/DP4) [2]">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	NA00001	NA00002	NA00003
+X	2942109	rs5939407	T	C	999	PASS	DP4=23273,27816,40128,48208;DP=146673;Dels=0;FS=43.639;HWE=0.622715;ICF=-0.01176;MQ0=1;MQ=46;PV4=0.65,1,0,1;QD=14.81;AN=4;AC=3	GT:PL:DP:GQ	0:0,255:20:99	1:255,0:33:99	1/1:255,157,0:52:99
+X	3048719	.	T	C	999	PASS	DP4=13263,27466,40128,48208;DP=146673;Dels=0;FS=43.639;HWE=0.622715;ICF=-0.01176;MQ0=1;MQ=46;PV4=0.65,1,0,1;QD=14.81;AN=4;AC=3	GT:PL:DP:GQ	0:0,255:20:99	1:255,0:33:99	0|1:255,0,157:52:99
diff --git a/test/view.5.out b/test/view.5.out
new file mode 100644
index 0000000..d427121
--- /dev/null
+++ b/test/view.5.out
@@ -0,0 +1,36 @@
+##fileformat=VCFv4.1
+##FILTER=<ID=PASS,Description="All filters passed">
+##reference=file:///seq/references/1000Genomes-NCBI37.fasta
+##contig=<ID=11,length=135006516>
+##contig=<ID=20,length=63025520>
+##contig=<ID=X,length=155270560>
+##contig=<ID=Y,length=59373566>
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Raw read depth">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##INFO=<ID=Dels,Number=1,Type=Float,Description="Fraction of reads containing spanning deletions">
+##INFO=<ID=FS,Number=1,Type=Float,Description="Phred-scaled p-value using Fisher's exact test to detect strand bias">
+##INFO=<ID=HRun,Number=1,Type=Integer,Description="Largest contiguous homopolymer run of variant allele in either direction">
+##INFO=<ID=HWE,Number=1,Type=Float,Description="Hardy-Weinberg equilibrium test (PMID:15789306)">
+##INFO=<ID=ICF,Number=1,Type=Float,Description="Inbreeding coefficient F">
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##INFO=<ID=IS,Number=2,Type=Float,Description="Maximum number of reads supporting an indel and fraction of indel reads">
+##INFO=<ID=MQ,Number=1,Type=Integer,Description="Root-mean-square mapping quality of covering reads">
+##INFO=<ID=MQ0,Number=1,Type=Integer,Description="Total mapping quality zero reads">
+##INFO=<ID=PV4,Number=4,Type=Float,Description="P-values for strand bias, baseQ bias, mapQ bias and tail distance bias">
+##INFO=<ID=QD,Number=1,Type=Float,Description="Variant confidence/quality by depth">
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="# high-quality bases">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=PL,Number=G,Type=Integer,Description="List of Phred-scaled genotype likelihoods">
+##FILTER=<ID=StrandBias,Description="Min P-value for strand bias (INFO/PV4) [0.0001]">
+##FILTER=<ID=BaseQualBias,Description="Min P-value for baseQ bias (INFO/PV4) [1e-100]">
+##FILTER=<ID=MapQualBias,Description="Min P-value for mapQ bias (INFO/PV4) [0]">
+##FILTER=<ID=EndDistBias,Description="Min P-value for end distance bias (INFO/PV4) [0.0001]">
+##FILTER=<ID=MinAB,Description="Minimum number of alternate bases (INFO/DP4) [2]">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	NA00001	NA00002	NA00003
+20	304568	.	C	T	999	PASS	DP4=16413,4543,945,156;DP=43557;Dels=0;FS=3200;HWE=0.076855;ICF=0.0213;MQ0=0;MQ=50;PV4=0,0,0,1;QD=15.45;AN=6;AC=4	GT:PL:DP:GQ	0|1:95,0,255:90:99	0|1:192,0,255:13:99	1|1:255,95,0:60:99
+X	3048719	.	T	C	999	PASS	DP4=13263,27466,40128,48208;DP=146673;Dels=0;FS=43.639;HWE=0.622715;ICF=-0.01176;MQ0=1;MQ=46;PV4=0.65,1,0,1;QD=14.81;AN=4;AC=3	GT:PL:DP:GQ	0:0,255:20:99	1:255,0:33:99	0|1:255,0,157:52:99
+Y	8657215	.	C	A	999	PASS	DP4=74915,114274,1948,2955;DP=195469;Dels=0;FS=3.181;MQ0=0;MQ=50;PV4=0.86,1,0,1;QD=33.77;AN=2;AC=1	GT:PL:DP:GQ	0:0,255:47:99	1:255,0:64:99	.:.:.:.
+Y	10011673	rs78249411	G	A	999	MinAB	DP4=47351,30839,178796,279653;DP=550762;Dels=0;FS=41.028;MQ0=37362;MQ=26;PV4=0,0,0,1;QD=17.45;AN=2;AC=2	GT:PL:DP:GQ	1:126,101:146:37	1:95,0:130:99	.:.:.:.
diff --git a/test/view.6.out b/test/view.6.out
new file mode 100644
index 0000000..f0d6d75
--- /dev/null
+++ b/test/view.6.out
@@ -0,0 +1,43 @@
+##fileformat=VCFv4.1
+##FILTER=<ID=PASS,Description="All filters passed">
+##reference=file:///seq/references/1000Genomes-NCBI37.fasta
+##contig=<ID=11,length=135006516>
+##contig=<ID=20,length=63025520>
+##contig=<ID=X,length=155270560>
+##contig=<ID=Y,length=59373566>
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Raw read depth">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##INFO=<ID=Dels,Number=1,Type=Float,Description="Fraction of reads containing spanning deletions">
+##INFO=<ID=FS,Number=1,Type=Float,Description="Phred-scaled p-value using Fisher's exact test to detect strand bias">
+##INFO=<ID=HRun,Number=1,Type=Integer,Description="Largest contiguous homopolymer run of variant allele in either direction">
+##INFO=<ID=HWE,Number=1,Type=Float,Description="Hardy-Weinberg equilibrium test (PMID:15789306)">
+##INFO=<ID=ICF,Number=1,Type=Float,Description="Inbreeding coefficient F">
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##INFO=<ID=IS,Number=2,Type=Float,Description="Maximum number of reads supporting an indel and fraction of indel reads">
+##INFO=<ID=MQ,Number=1,Type=Integer,Description="Root-mean-square mapping quality of covering reads">
+##INFO=<ID=MQ0,Number=1,Type=Integer,Description="Total mapping quality zero reads">
+##INFO=<ID=PV4,Number=4,Type=Float,Description="P-values for strand bias, baseQ bias, mapQ bias and tail distance bias">
+##INFO=<ID=QD,Number=1,Type=Float,Description="Variant confidence/quality by depth">
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="# high-quality bases">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=PL,Number=G,Type=Integer,Description="List of Phred-scaled genotype likelihoods">
+##FILTER=<ID=StrandBias,Description="Min P-value for strand bias (INFO/PV4) [0.0001]">
+##FILTER=<ID=BaseQualBias,Description="Min P-value for baseQ bias (INFO/PV4) [1e-100]">
+##FILTER=<ID=MapQualBias,Description="Min P-value for mapQ bias (INFO/PV4) [0]">
+##FILTER=<ID=EndDistBias,Description="Min P-value for end distance bias (INFO/PV4) [0.0001]">
+##FILTER=<ID=MinAB,Description="Minimum number of alternate bases (INFO/DP4) [2]">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	NA00001	NA00002	NA00003
+11	2343543	.	A	.	999	PASS	DP=100223	GT:PL:DP:GQ	0/0:0,255,255:193:99	0/0:0,255,255:211:99	0/0:0,255,255:182:99
+11	5464562	.	C	T	999	PASS	DP=0	GT:PL:DP:GQ	./.:0,0,0:.:.	./.:0,0,0:.:.	./.:0,0,0:.:.
+20	76962	rs6111385	T	C	999	PASS	DP4=110138,70822,421911,262673;DP=911531;Dels=0;FS=21.447;HWE=0.491006;ICF=-0.01062;MQ0=1;MQ=46;PV4=2.5e-09,0,0,1;QD=22.31	GT:PL:DP:GQ	0/1:255,0,255:193:99	1/1:255,255,0:211:99	1/1:255,255,0:182:99
+20	126310	.	ACC	A	999	StrandBias;EndDistBias	DP4=125718,95950,113812,80890;DP=461867;HWE=0.24036;ICF=0.01738;INDEL;IS=374,0.937343;MQ=49;PV4=9e-30,1,0,3.8e-13;QD=0.0172;AN=6;AC=4	GT:DP:GQ:PL	0/1:117:99:255,0,132	0/1:111:99:255,0,139	1/1:78:99:255,213,0
+20	138125	rs2298108	G	T	999	PASS	DP4=174391,20849,82080,4950;DP=286107;Dels=0;FS=3200;HWE=0.199462;ICF=0.01858;MQ0=0;MQ=46;PV4=0,0,0,1;QD=17.22;AN=6;AC=4	GT:PL:DP:GQ	0/1:135,0,163:66:99	0/1:140,0,255:71:99	1/1:255,199,0:66:99
+20	138148	rs2298109	C	T	999	PASS	DP4=194136,45753,94945,14367;DP=356657;Dels=0;FS=3200;HWE=0.177865;ICF=0.0198;MQ0=0;MQ=47;PV4=0,0,0,1;QD=14.57;AN=6;AC=4	GT:PL:DP:GQ	0/1:195,0,255:87:99	0/1:192,0,255:82:99	1/1:255,235,0:78:99
+20	271225	.	T	TTTA,TA	999	StrandBias	DP4=29281,42401,27887,29245;DP=272732;INDEL;IS=95,0.748031;MQ=47;PV4=0,1,0,1;QD=0.0948;AN=6;AC=2,2	GT:DP:GQ:PL	0/2:33:49:151,53,203,0,52,159	0/1:51:99:255,0,213,255,255,255	1/2:47:99:255,255,255,255,0,241
+20	326891	.	A	AC	999	PASS	DP4=125718,95950,113812,80890;DP=461867;HWE=0.24036;ICF=0.01738;INDEL;IS=374,0.937343;MQ=49;PV4=9e-30,1,0,3.8e-13;QD=0.0172;AN=4;AC=2	GT:DP:GQ:PL	0|1:117:99:255,0,132	0|1:111:99:255,0,139	./.:.:.:.,.,.
+X	2928329	rs62584840	C	T	999	PASS	DP4=302,9137,32,1329;DP=11020;Dels=0;FS=13.38;HWE=0.284332;ICF=0.0253;MQ0=0;MQ=49;PV4=0.094,0,0,1;QD=18.61;AN=4;AC=1	GT:PL:DP:GQ	0:0,56:2:73	0:0,81:3:98	0/1:73,0,19:4:30
+X	2933066	rs61746890	G	C	999	PASS	DP4=69865,100561,461,783;DP=173729;Dels=0;FS=10.833;MQ0=0;MQ=50;PV4=0.005,3.6e-14,0,1;QD=15.33;AN=4;AC=1	GT:PL:DP:GQ	0:0,255:39:99	0:0,255:37:99	0/1:255,255,255:62:99
+X	2942109	rs5939407	T	C	999	PASS	DP4=23273,27816,40128,48208;DP=146673;Dels=0;FS=43.639;HWE=0.622715;ICF=-0.01176;MQ0=1;MQ=46;PV4=0.65,1,0,1;QD=14.81;AN=4;AC=3	GT:PL:DP:GQ	0:0,255:20:99	1:255,0:33:99	1/1:255,157,0:52:99
diff --git a/test/view.7.out b/test/view.7.out
new file mode 100644
index 0000000..de660d0
--- /dev/null
+++ b/test/view.7.out
@@ -0,0 +1,32 @@
+##fileformat=VCFv4.1
+##FILTER=<ID=PASS,Description="All filters passed">
+##reference=file:///seq/references/1000Genomes-NCBI37.fasta
+##contig=<ID=11,length=135006516>
+##contig=<ID=20,length=63025520>
+##contig=<ID=X,length=155270560>
+##contig=<ID=Y,length=59373566>
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Raw read depth">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##INFO=<ID=Dels,Number=1,Type=Float,Description="Fraction of reads containing spanning deletions">
+##INFO=<ID=FS,Number=1,Type=Float,Description="Phred-scaled p-value using Fisher's exact test to detect strand bias">
+##INFO=<ID=HRun,Number=1,Type=Integer,Description="Largest contiguous homopolymer run of variant allele in either direction">
+##INFO=<ID=HWE,Number=1,Type=Float,Description="Hardy-Weinberg equilibrium test (PMID:15789306)">
+##INFO=<ID=ICF,Number=1,Type=Float,Description="Inbreeding coefficient F">
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##INFO=<ID=IS,Number=2,Type=Float,Description="Maximum number of reads supporting an indel and fraction of indel reads">
+##INFO=<ID=MQ,Number=1,Type=Integer,Description="Root-mean-square mapping quality of covering reads">
+##INFO=<ID=MQ0,Number=1,Type=Integer,Description="Total mapping quality zero reads">
+##INFO=<ID=PV4,Number=4,Type=Float,Description="P-values for strand bias, baseQ bias, mapQ bias and tail distance bias">
+##INFO=<ID=QD,Number=1,Type=Float,Description="Variant confidence/quality by depth">
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="# high-quality bases">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=PL,Number=G,Type=Integer,Description="List of Phred-scaled genotype likelihoods">
+##FILTER=<ID=StrandBias,Description="Min P-value for strand bias (INFO/PV4) [0.0001]">
+##FILTER=<ID=BaseQualBias,Description="Min P-value for baseQ bias (INFO/PV4) [1e-100]">
+##FILTER=<ID=MapQualBias,Description="Min P-value for mapQ bias (INFO/PV4) [0]">
+##FILTER=<ID=EndDistBias,Description="Min P-value for end distance bias (INFO/PV4) [0.0001]">
+##FILTER=<ID=MinAB,Description="Minimum number of alternate bases (INFO/DP4) [2]">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	NA00001	NA00002	NA00003
diff --git a/test/view.8.out b/test/view.8.out
new file mode 100644
index 0000000..74f3cff
--- /dev/null
+++ b/test/view.8.out
@@ -0,0 +1 @@
+11	5464562	.	C	T	999	PASS	DP=0;AC=0;AN=0	GT:PL:DP:GQ	./.:0,0,0:.:.	./.:0,0,0:.:.	./.:0,0,0:.:.
diff --git a/test/view.9.out b/test/view.9.out
new file mode 100644
index 0000000..b5b13bd
--- /dev/null
+++ b/test/view.9.out
@@ -0,0 +1,36 @@
+##fileformat=VCFv4.1
+##FILTER=<ID=PASS,Description="All filters passed">
+##reference=file:///seq/references/1000Genomes-NCBI37.fasta
+##contig=<ID=11,length=135006516>
+##contig=<ID=20,length=63025520>
+##contig=<ID=X,length=155270560>
+##contig=<ID=Y,length=59373566>
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Raw read depth">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##INFO=<ID=Dels,Number=1,Type=Float,Description="Fraction of reads containing spanning deletions">
+##INFO=<ID=FS,Number=1,Type=Float,Description="Phred-scaled p-value using Fisher's exact test to detect strand bias">
+##INFO=<ID=HRun,Number=1,Type=Integer,Description="Largest contiguous homopolymer run of variant allele in either direction">
+##INFO=<ID=HWE,Number=1,Type=Float,Description="Hardy-Weinberg equilibrium test (PMID:15789306)">
+##INFO=<ID=ICF,Number=1,Type=Float,Description="Inbreeding coefficient F">
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##INFO=<ID=IS,Number=2,Type=Float,Description="Maximum number of reads supporting an indel and fraction of indel reads">
+##INFO=<ID=MQ,Number=1,Type=Integer,Description="Root-mean-square mapping quality of covering reads">
+##INFO=<ID=MQ0,Number=1,Type=Integer,Description="Total mapping quality zero reads">
+##INFO=<ID=PV4,Number=4,Type=Float,Description="P-values for strand bias, baseQ bias, mapQ bias and tail distance bias">
+##INFO=<ID=QD,Number=1,Type=Float,Description="Variant confidence/quality by depth">
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="# high-quality bases">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=PL,Number=G,Type=Integer,Description="List of Phred-scaled genotype likelihoods">
+##FILTER=<ID=StrandBias,Description="Min P-value for strand bias (INFO/PV4) [0.0001]">
+##FILTER=<ID=BaseQualBias,Description="Min P-value for baseQ bias (INFO/PV4) [1e-100]">
+##FILTER=<ID=MapQualBias,Description="Min P-value for mapQ bias (INFO/PV4) [0]">
+##FILTER=<ID=EndDistBias,Description="Min P-value for end distance bias (INFO/PV4) [0.0001]">
+##FILTER=<ID=MinAB,Description="Minimum number of alternate bases (INFO/DP4) [2]">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO
+11	2343543	.	A	.	999	PASS	DP=100223
+20	126310	.	ACC	A	999	StrandBias;EndDistBias	DP4=125718,95950,113812,80890;DP=461867;HWE=0.24036;ICF=0.01738;INDEL;IS=374,0.937343;MQ=49;PV4=9e-30,1,0,3.8e-13;QD=0.0172;AN=6;AC=4
+20	271225	.	T	TTTA,TA	999	StrandBias	DP4=29281,42401,27887,29245;DP=272732;INDEL;IS=95,0.748031;MQ=47;PV4=0,1,0,1;QD=0.0948;AN=6;AC=2,2
+20	326891	.	A	AC	999	PASS	DP4=125718,95950,113812,80890;DP=461867;HWE=0.24036;ICF=0.01738;INDEL;IS=374,0.937343;MQ=49;PV4=9e-30,1,0,3.8e-13;QD=0.0172;AN=4;AC=2
diff --git a/test/view.chrs.out b/test/view.chrs.out
new file mode 100644
index 0000000..b6db11b
--- /dev/null
+++ b/test/view.chrs.out
@@ -0,0 +1,81 @@
+##fileformat=VCFv4.1
+##FILTER=<ID=PASS,Description="All filters passed">
+##contig=<ID=Pf3D7_01_v3,length=249250621>
+##contig=<ID=Pf3D7_02_v3,length=249250621>
+##contig=<ID=Pf3D7_03_v3,length=249250621>
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	AAA	BBB
+Pf3D7_01_v3	1	.	A	T	.	.	.	GT	.	.
+Pf3D7_01_v3	2	.	A	G	.	.	.	GT	.	.
+Pf3D7_01_v3	33	.	T	A	.	.	.	GT	.	.
+Pf3D7_01_v3	36	.	A	G	.	.	.	GT	.	.
+Pf3D7_01_v3	57	.	C	T	.	.	.	GT	.	.
+Pf3D7_01_v3	61	.	A	T	.	.	.	GT	.	.
+Pf3D7_01_v3	72	.	T	C,A	.	.	.	GT	.	.
+Pf3D7_01_v3	73	.	T	A	.	.	.	GT	.	.
+Pf3D7_01_v3	74	.	A	T,C	.	.	.	GT	.	.
+Pf3D7_01_v3	84	.	C	T	.	.	.	GT	.	.
+Pf3D7_01_v3	110	.	T	A	.	.	.	GT	.	.
+Pf3D7_01_v3	111	.	T	A	.	.	.	GT	.	.
+Pf3D7_01_v3	129	.	T	A	.	.	.	GT	.	.
+Pf3D7_01_v3	146	.	A	C,T	.	.	.	GT	.	.
+Pf3D7_01_v3	147	.	A	C,T	.	.	.	GT	.	.
+Pf3D7_01_v3	152	.	G	T	.	.	.	GT	.	.
+Pf3D7_01_v3	168	.	T	A	.	.	.	GT	.	.
+Pf3D7_01_v3	169	.	A	G	.	.	.	GT	.	.
+Pf3D7_01_v3	175	.	A	T	.	.	.	GT	.	.
+Pf3D7_01_v3	195	.	T	A	.	.	.	GT	.	.
+Pf3D7_01_v3	196	.	A	C	.	.	.	GT	.	.
+Pf3D7_01_v3	199	.	T	C	.	.	.	GT	.	.
+Pf3D7_01_v3	204	.	C	T	.	.	.	GT	.	.
+Pf3D7_01_v3	213	.	G	A	.	.	.	GT	.	.
+Pf3D7_01_v3	222	.	A	G	.	.	.	GT	.	.
+Pf3D7_01_v3	223	.	A	G	.	.	.	GT	.	.
+Pf3D7_01_v3	227	.	T	A	.	.	.	GT	.	.
+Pf3D7_02_v3	90	.	C	T	.	.	.	GT	.	.
+Pf3D7_02_v3	100	.	T	A	.	.	.	GT	.	.
+Pf3D7_02_v3	111	.	T	A	.	.	.	GT	.	.
+Pf3D7_02_v3	129	.	T	A	.	.	.	GT	.	.
+Pf3D7_02_v3	146	.	A	C,T	.	.	.	GT	.	.
+Pf3D7_02_v3	147	.	A	C,T	.	.	.	GT	.	.
+Pf3D7_02_v3	152	.	G	T	.	.	.	GT	.	.
+Pf3D7_02_v3	168	.	T	A	.	.	.	GT	.	.
+Pf3D7_02_v3	169	.	A	G	.	.	.	GT	.	.
+Pf3D7_02_v3	175	.	A	T	.	.	.	GT	.	.
+Pf3D7_02_v3	195	.	T	A	.	.	.	GT	.	.
+Pf3D7_02_v3	196	.	A	C	.	.	.	GT	.	.
+Pf3D7_02_v3	199	.	T	C	.	.	.	GT	.	.
+Pf3D7_02_v3	204	.	C	T	.	.	.	GT	.	.
+Pf3D7_02_v3	213	.	G	A	.	.	.	GT	.	.
+Pf3D7_02_v3	222	.	A	G	.	.	.	GT	.	.
+Pf3D7_02_v3	223	.	A	G	.	.	.	GT	.	.
+Pf3D7_02_v3	227	.	T	A	.	.	.	GT	.	.
+Pf3D7_02_v3	235	.	A	G	.	.	.	GT	.	.
+Pf3D7_03_v3	1	.	A	T	.	.	.	GT	.	.
+Pf3D7_03_v3	2	.	A	G	.	.	.	GT	.	.
+Pf3D7_03_v3	33	.	T	A	.	.	.	GT	.	.
+Pf3D7_03_v3	36	.	A	G	.	.	.	GT	.	.
+Pf3D7_03_v3	57	.	C	T	.	.	.	GT	.	.
+Pf3D7_03_v3	61	.	A	T	.	.	.	GT	.	.
+Pf3D7_03_v3	72	.	T	C,A	.	.	.	GT	.	.
+Pf3D7_03_v3	73	.	T	A	.	.	.	GT	.	.
+Pf3D7_03_v3	74	.	A	T,C	.	.	.	GT	.	.
+Pf3D7_03_v3	84	.	C	T	.	.	.	GT	.	.
+Pf3D7_03_v3	110	.	T	A	.	.	.	GT	.	.
+Pf3D7_03_v3	111	.	T	A	.	.	.	GT	.	.
+Pf3D7_03_v3	129	.	T	A	.	.	.	GT	.	.
+Pf3D7_03_v3	146	.	A	C,T	.	.	.	GT	.	.
+Pf3D7_03_v3	147	.	A	C,T	.	.	.	GT	.	.
+Pf3D7_03_v3	152	.	G	T	.	.	.	GT	.	.
+Pf3D7_03_v3	168	.	T	A	.	.	.	GT	.	.
+Pf3D7_03_v3	169	.	A	G	.	.	.	GT	.	.
+Pf3D7_03_v3	175	.	A	T	.	.	.	GT	.	.
+Pf3D7_03_v3	195	.	T	A	.	.	.	GT	.	.
+Pf3D7_03_v3	196	.	A	C	.	.	.	GT	.	.
+Pf3D7_03_v3	199	.	T	C	.	.	.	GT	.	.
+Pf3D7_03_v3	204	.	C	T	.	.	.	GT	.	.
+Pf3D7_03_v3	213	.	G	A	.	.	.	GT	.	.
+Pf3D7_03_v3	222	.	A	G	.	.	.	GT	.	.
+Pf3D7_03_v3	223	.	A	G	.	.	.	GT	.	.
+Pf3D7_03_v3	227	.	T	A	.	.	.	GT	.	.
+Pf3D7_03_v3	235	.	A	G	.	.	.	GT	.	.
diff --git a/test/view.chrs.tab b/test/view.chrs.tab
new file mode 100644
index 0000000..90c0993
--- /dev/null
+++ b/test/view.chrs.tab
@@ -0,0 +1,74 @@
+Pf3D7_01_v3	1
+Pf3D7_01_v3	2
+Pf3D7_01_v3	33
+Pf3D7_01_v3	36
+Pf3D7_01_v3	57
+Pf3D7_01_v3	61
+Pf3D7_01_v3	72
+Pf3D7_01_v3	73
+Pf3D7_01_v3	74
+Pf3D7_01_v3	84
+Pf3D7_01_v3	110
+Pf3D7_01_v3	111
+Pf3D7_01_v3	129
+Pf3D7_01_v3	146
+Pf3D7_01_v3	147
+Pf3D7_01_v3	152
+Pf3D7_01_v3	168
+Pf3D7_01_v3	169
+Pf3D7_01_v3	175
+Pf3D7_01_v3	195
+Pf3D7_01_v3	196
+Pf3D7_01_v3	199
+Pf3D7_01_v3	204
+Pf3D7_01_v3	213
+Pf3D7_01_v3	222
+Pf3D7_01_v3	223
+Pf3D7_01_v3	227
+Pf3D7_02_v3	90
+Pf3D7_02_v3	100
+Pf3D7_02_v3	111
+Pf3D7_02_v3	129
+Pf3D7_02_v3	146
+Pf3D7_02_v3	147
+Pf3D7_02_v3	152
+Pf3D7_02_v3	168
+Pf3D7_02_v3	169
+Pf3D7_02_v3	175
+Pf3D7_02_v3	195
+Pf3D7_02_v3	196
+Pf3D7_02_v3	199
+Pf3D7_02_v3	204
+Pf3D7_02_v3	213
+Pf3D7_02_v3	222
+Pf3D7_02_v3	223
+Pf3D7_02_v3	227
+Pf3D7_02_v3	235
+Pf3D7_03_v3	1
+Pf3D7_03_v3	2
+Pf3D7_03_v3	33
+Pf3D7_03_v3	36
+Pf3D7_03_v3	57
+Pf3D7_03_v3	61
+Pf3D7_03_v3	72
+Pf3D7_03_v3	73
+Pf3D7_03_v3	74
+Pf3D7_03_v3	84
+Pf3D7_03_v3	110
+Pf3D7_03_v3	111
+Pf3D7_03_v3	129
+Pf3D7_03_v3	146
+Pf3D7_03_v3	147
+Pf3D7_03_v3	152
+Pf3D7_03_v3	168
+Pf3D7_03_v3	169
+Pf3D7_03_v3	175
+Pf3D7_03_v3	195
+Pf3D7_03_v3	196
+Pf3D7_03_v3	199
+Pf3D7_03_v3	204
+Pf3D7_03_v3	213
+Pf3D7_03_v3	222
+Pf3D7_03_v3	223
+Pf3D7_03_v3	227
+Pf3D7_03_v3	235
diff --git a/test/view.chrs.vcf b/test/view.chrs.vcf
new file mode 100644
index 0000000..8fc5139
--- /dev/null
+++ b/test/view.chrs.vcf
@@ -0,0 +1,90 @@
+##fileformat=VCFv4.1
+##contig=<ID=Pf3D7_01_v3,length=249250621>
+##contig=<ID=Pf3D7_02_v3,length=249250621>
+##contig=<ID=Pf3D7_03_v3,length=249250621>
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	AAA	BBB
+Pf3D7_01_v3	1	.	A	T	.	.	.	GT	.	.
+Pf3D7_01_v3	2	.	A	G	.	.	.	GT	.	.
+Pf3D7_01_v3	33	.	T	A	.	.	.	GT	.	.
+Pf3D7_01_v3	36	.	A	G	.	.	.	GT	.	.
+Pf3D7_01_v3	57	.	C	T	.	.	.	GT	.	.
+Pf3D7_01_v3	61	.	A	T	.	.	.	GT	.	.
+Pf3D7_01_v3	72	.	T	C,A	.	.	.	GT	.	.
+Pf3D7_01_v3	73	.	T	A	.	.	.	GT	.	.
+Pf3D7_01_v3	74	.	A	T,C	.	.	.	GT	.	.
+Pf3D7_01_v3	84	.	C	T	.	.	.	GT	.	.
+Pf3D7_01_v3	110	.	T	A	.	.	.	GT	.	.
+Pf3D7_01_v3	111	.	T	A	.	.	.	GT	.	.
+Pf3D7_01_v3	129	.	T	A	.	.	.	GT	.	.
+Pf3D7_01_v3	146	.	A	C,T	.	.	.	GT	.	.
+Pf3D7_01_v3	147	.	A	C,T	.	.	.	GT	.	.
+Pf3D7_01_v3	152	.	G	T	.	.	.	GT	.	.
+Pf3D7_01_v3	168	.	T	A	.	.	.	GT	.	.
+Pf3D7_01_v3	169	.	A	G	.	.	.	GT	.	.
+Pf3D7_01_v3	175	.	A	T	.	.	.	GT	.	.
+Pf3D7_01_v3	195	.	T	A	.	.	.	GT	.	.
+Pf3D7_01_v3	196	.	A	C	.	.	.	GT	.	.
+Pf3D7_01_v3	199	.	T	C	.	.	.	GT	.	.
+Pf3D7_01_v3	204	.	C	T	.	.	.	GT	.	.
+Pf3D7_01_v3	213	.	G	A	.	.	.	GT	.	.
+Pf3D7_01_v3	222	.	A	G	.	.	.	GT	.	.
+Pf3D7_01_v3	223	.	A	G	.	.	.	GT	.	.
+Pf3D7_01_v3	227	.	T	A	.	.	.	GT	.	.
+Pf3D7_01_v3	235	.	A	G	.	.	.	GT	.	.
+Pf3D7_02_v3	1	.	A	T	.	.	.	GT	.	.
+Pf3D7_02_v3	2	.	A	G	.	.	.	GT	.	.
+Pf3D7_02_v3	33	.	T	A	.	.	.	GT	.	.
+Pf3D7_02_v3	36	.	A	G	.	.	.	GT	.	.
+Pf3D7_02_v3	57	.	C	T	.	.	.	GT	.	.
+Pf3D7_02_v3	61	.	A	T	.	.	.	GT	.	.
+Pf3D7_02_v3	72	.	T	C,A	.	.	.	GT	.	.
+Pf3D7_02_v3	73	.	T	A	.	.	.	GT	.	.
+Pf3D7_02_v3	74	.	A	T,C	.	.	.	GT	.	.
+Pf3D7_02_v3	90	.	C	T	.	.	.	GT	.	.
+Pf3D7_02_v3	100	.	T	A	.	.	.	GT	.	.
+Pf3D7_02_v3	111	.	T	A	.	.	.	GT	.	.
+Pf3D7_02_v3	129	.	T	A	.	.	.	GT	.	.
+Pf3D7_02_v3	146	.	A	C,T	.	.	.	GT	.	.
+Pf3D7_02_v3	147	.	A	C,T	.	.	.	GT	.	.
+Pf3D7_02_v3	152	.	G	T	.	.	.	GT	.	.
+Pf3D7_02_v3	168	.	T	A	.	.	.	GT	.	.
+Pf3D7_02_v3	169	.	A	G	.	.	.	GT	.	.
+Pf3D7_02_v3	175	.	A	T	.	.	.	GT	.	.
+Pf3D7_02_v3	195	.	T	A	.	.	.	GT	.	.
+Pf3D7_02_v3	196	.	A	C	.	.	.	GT	.	.
+Pf3D7_02_v3	199	.	T	C	.	.	.	GT	.	.
+Pf3D7_02_v3	204	.	C	T	.	.	.	GT	.	.
+Pf3D7_02_v3	213	.	G	A	.	.	.	GT	.	.
+Pf3D7_02_v3	222	.	A	G	.	.	.	GT	.	.
+Pf3D7_02_v3	223	.	A	G	.	.	.	GT	.	.
+Pf3D7_02_v3	227	.	T	A	.	.	.	GT	.	.
+Pf3D7_02_v3	235	.	A	G	.	.	.	GT	.	.
+Pf3D7_03_v3	1	.	A	T	.	.	.	GT	.	.
+Pf3D7_03_v3	2	.	A	G	.	.	.	GT	.	.
+Pf3D7_03_v3	33	.	T	A	.	.	.	GT	.	.
+Pf3D7_03_v3	36	.	A	G	.	.	.	GT	.	.
+Pf3D7_03_v3	57	.	C	T	.	.	.	GT	.	.
+Pf3D7_03_v3	61	.	A	T	.	.	.	GT	.	.
+Pf3D7_03_v3	72	.	T	C,A	.	.	.	GT	.	.
+Pf3D7_03_v3	73	.	T	A	.	.	.	GT	.	.
+Pf3D7_03_v3	74	.	A	T,C	.	.	.	GT	.	.
+Pf3D7_03_v3	84	.	C	T	.	.	.	GT	.	.
+Pf3D7_03_v3	110	.	T	A	.	.	.	GT	.	.
+Pf3D7_03_v3	111	.	T	A	.	.	.	GT	.	.
+Pf3D7_03_v3	129	.	T	A	.	.	.	GT	.	.
+Pf3D7_03_v3	146	.	A	C,T	.	.	.	GT	.	.
+Pf3D7_03_v3	147	.	A	C,T	.	.	.	GT	.	.
+Pf3D7_03_v3	152	.	G	T	.	.	.	GT	.	.
+Pf3D7_03_v3	168	.	T	A	.	.	.	GT	.	.
+Pf3D7_03_v3	169	.	A	G	.	.	.	GT	.	.
+Pf3D7_03_v3	175	.	A	T	.	.	.	GT	.	.
+Pf3D7_03_v3	195	.	T	A	.	.	.	GT	.	.
+Pf3D7_03_v3	196	.	A	C	.	.	.	GT	.	.
+Pf3D7_03_v3	199	.	T	C	.	.	.	GT	.	.
+Pf3D7_03_v3	204	.	C	T	.	.	.	GT	.	.
+Pf3D7_03_v3	213	.	G	A	.	.	.	GT	.	.
+Pf3D7_03_v3	222	.	A	G	.	.	.	GT	.	.
+Pf3D7_03_v3	223	.	A	G	.	.	.	GT	.	.
+Pf3D7_03_v3	227	.	T	A	.	.	.	GT	.	.
+Pf3D7_03_v3	235	.	A	G	.	.	.	GT	.	.
diff --git a/test/view.exclude.out b/test/view.exclude.out
new file mode 100644
index 0000000..324c320
--- /dev/null
+++ b/test/view.exclude.out
@@ -0,0 +1,47 @@
+##fileformat=VCFv4.1
+##FILTER=<ID=PASS,Description="All filters passed">
+##reference=file:///seq/references/1000Genomes-NCBI37.fasta
+##contig=<ID=11,length=135006516>
+##contig=<ID=20,length=63025520>
+##contig=<ID=X,length=155270560>
+##contig=<ID=Y,length=59373566>
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Raw read depth">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##INFO=<ID=Dels,Number=1,Type=Float,Description="Fraction of reads containing spanning deletions">
+##INFO=<ID=FS,Number=1,Type=Float,Description="Phred-scaled p-value using Fisher's exact test to detect strand bias">
+##INFO=<ID=HRun,Number=1,Type=Integer,Description="Largest contiguous homopolymer run of variant allele in either direction">
+##INFO=<ID=HWE,Number=1,Type=Float,Description="Hardy-Weinberg equilibrium test (PMID:15789306)">
+##INFO=<ID=ICF,Number=1,Type=Float,Description="Inbreeding coefficient F">
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##INFO=<ID=IS,Number=2,Type=Float,Description="Maximum number of reads supporting an indel and fraction of indel reads">
+##INFO=<ID=MQ,Number=1,Type=Integer,Description="Root-mean-square mapping quality of covering reads">
+##INFO=<ID=MQ0,Number=1,Type=Integer,Description="Total mapping quality zero reads">
+##INFO=<ID=PV4,Number=4,Type=Float,Description="P-values for strand bias, baseQ bias, mapQ bias and tail distance bias">
+##INFO=<ID=QD,Number=1,Type=Float,Description="Variant confidence/quality by depth">
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="# high-quality bases">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=PL,Number=G,Type=Integer,Description="List of Phred-scaled genotype likelihoods">
+##FILTER=<ID=StrandBias,Description="Min P-value for strand bias (INFO/PV4) [0.0001]">
+##FILTER=<ID=BaseQualBias,Description="Min P-value for baseQ bias (INFO/PV4) [1e-100]">
+##FILTER=<ID=MapQualBias,Description="Min P-value for mapQ bias (INFO/PV4) [0]">
+##FILTER=<ID=EndDistBias,Description="Min P-value for end distance bias (INFO/PV4) [0.0001]">
+##FILTER=<ID=MinAB,Description="Minimum number of alternate bases (INFO/DP4) [2]">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	NA00001	NA00002
+11	2343543	.	A	.	999	PASS	DP=100223;AN=4	GT:PL:DP:GQ	0/0:0,255,255:193:99	0/0:0,255,255:211:99
+11	5464562	.	C	T	999	PASS	DP=0;AC=0;AN=0	GT:PL:DP:GQ	./.:0,0,0:.:.	./.:0,0,0:.:.
+20	76962	rs6111385	T	C	999	PASS	DP4=110138,70822,421911,262673;DP=911531;Dels=0;FS=21.447;HWE=0.491006;ICF=-0.01062;MQ0=1;MQ=46;PV4=2.5e-09,0,0,1;QD=22.31;AC=3;AN=4	GT:PL:DP:GQ	0/1:255,0,255:193:99	1/1:255,255,0:211:99
+20	126310	.	ACC	A	999	StrandBias;EndDistBias	DP4=125718,95950,113812,80890;DP=461867;HWE=0.24036;ICF=0.01738;INDEL;IS=374,0.937343;MQ=49;PV4=9e-30,1,0,3.8e-13;QD=0.0172;AN=4;AC=2	GT:DP:GQ:PL	0/1:117:99:255,0,132	0/1:111:99:255,0,139
+20	138125	rs2298108	G	T	999	PASS	DP4=174391,20849,82080,4950;DP=286107;Dels=0;FS=3200;HWE=0.199462;ICF=0.01858;MQ0=0;MQ=46;PV4=0,0,0,1;QD=17.22;AN=4;AC=2	GT:PL:DP:GQ	0/1:135,0,163:66:99	0/1:140,0,255:71:99
+20	138148	rs2298109	C	T	999	PASS	DP4=194136,45753,94945,14367;DP=356657;Dels=0;FS=3200;HWE=0.177865;ICF=0.0198;MQ0=0;MQ=47;PV4=0,0,0,1;QD=14.57;AN=4;AC=2	GT:PL:DP:GQ	0/1:195,0,255:87:99	0/1:192,0,255:82:99
+20	271225	.	T	TTTA,TA	999	StrandBias	DP4=29281,42401,27887,29245;DP=272732;INDEL;IS=95,0.748031;MQ=47;PV4=0,1,0,1;QD=0.0948;AN=4;AC=1,1	GT:DP:GQ:PL	0/2:33:49:151,53,203,0,52,159	0/1:51:99:255,0,213,255,255,255
+20	304568	.	C	T	999	PASS	DP4=16413,4543,945,156;DP=43557;Dels=0;FS=3200;HWE=0.076855;ICF=0.0213;MQ0=0;MQ=50;PV4=0,0,0,1;QD=15.45;AN=4;AC=2	GT:PL:DP:GQ	0|1:95,0,255:90:99	0|1:192,0,255:13:99
+20	326891	.	A	AC	999	PASS	DP4=125718,95950,113812,80890;DP=461867;HWE=0.24036;ICF=0.01738;INDEL;IS=374,0.937343;MQ=49;PV4=9e-30,1,0,3.8e-13;QD=0.0172;AN=4;AC=2	GT:DP:GQ:PL	0|1:117:99:255,0,132	0|1:111:99:255,0,139
+X	2928329	rs62584840	C	T	999	PASS	DP4=302,9137,32,1329;DP=11020;Dels=0;FS=13.38;HWE=0.284332;ICF=0.0253;MQ0=0;MQ=49;PV4=0.094,0,0,1;QD=18.61;AN=2;AC=0	GT:PL:DP:GQ	0:0,56:2:73	0:0,81:3:98
+X	2933066	rs61746890	G	C	999	PASS	DP4=69865,100561,461,783;DP=173729;Dels=0;FS=10.833;MQ0=0;MQ=50;PV4=0.005,3.6e-14,0,1;QD=15.33;AN=2;AC=0	GT:PL:DP:GQ	0:0,255:39:99	0:0,255:37:99
+X	2942109	rs5939407	T	C	999	PASS	DP4=23273,27816,40128,48208;DP=146673;Dels=0;FS=43.639;HWE=0.622715;ICF=-0.01176;MQ0=1;MQ=46;PV4=0.65,1,0,1;QD=14.81;AN=2;AC=1	GT:PL:DP:GQ	0:0,255:20:99	1:255,0:33:99
+X	3048719	.	T	C	999	PASS	DP4=13263,27466,40128,48208;DP=146673;Dels=0;FS=43.639;HWE=0.622715;ICF=-0.01176;MQ0=1;MQ=46;PV4=0.65,1,0,1;QD=14.81;AN=2;AC=1	GT:PL:DP:GQ	0:0,255:20:99	1:255,0:33:99
+Y	8657215	.	C	A	999	PASS	DP4=74915,114274,1948,2955;DP=195469;Dels=0;FS=3.181;MQ0=0;MQ=50;PV4=0.86,1,0,1;QD=33.77;AN=2;AC=1	GT:PL:DP:GQ	0:0,255:47:99	1:255,0:64:99
+Y	10011673	rs78249411	G	A	999	MinAB	DP4=47351,30839,178796,279653;DP=550762;Dels=0;FS=41.028;MQ0=37362;MQ=26;PV4=0,0,0,1;QD=17.45;AN=2;AC=2	GT:PL:DP:GQ	1:126,101:146:37	1:95,0:130:99
diff --git a/test/view.filter.1.out b/test/view.filter.1.out
new file mode 100644
index 0000000..9d00ad5
--- /dev/null
+++ b/test/view.filter.1.out
@@ -0,0 +1 @@
+1	3162007	.	TAGGG	CAGGG,CAGGT	238	PASS	AO=52101,113;CIGAR=1X4M,1X3M1X;TXT0=text	GT:FGS:FGI:FGF:FAS:FAI:FAF:FRS:FRI:FRF	0/1:AAAAAA,BBBBB,CCCC,DDD,EE,F:1,2,3,4,5,6:0.1,0.02,0.003,0.0004,5e-05,6e-06:AAA,B:1,2:0.1,0.02:A,BB,CCC:1,2,3:0.1,0.02,0.003	2:AAAAAA,BBB,C:1,2,3:0.1,0.02,0.003:AAA,B:1,2:0.1,0.02:A,BB,CCC:1,2,3:0.1,0.02,0.003
diff --git a/test/view.filter.10.out b/test/view.filter.10.out
new file mode 100644
index 0000000..04d8165
--- /dev/null
+++ b/test/view.filter.10.out
@@ -0,0 +1,43 @@
+##fileformat=VCFv4.2
+##FILTER=<ID=PASS,Description="All filters passed">
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##INFO=<ID=STR,Number=A,Type=String,Description="Testing string and Number=A in INFO">
+##INFO=<ID=TXT0,Number=1,Type=String,Description="Testing in INFO">
+##INFO=<ID=TXT,Number=.,Type=String,Description="Testing in INFO">
+##INFO=<ID=XRF,Number=R,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAF,Number=A,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGF,Number=G,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XRI,Number=R,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAI,Number=A,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGI,Number=G,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XRS,Number=R,Type=String,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAS,Number=A,Type=String,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGS,Number=G,Type=String,Description="Test Number=AGR in INFO">
+##SAMPLE=<ID=NORMAL,SampleName=B,Description="Less-than (\"<\") and greater-than (\">\") quoting nonsense where double brackets would do just fine",softwareName=<Nonsense,Software>,softwareVer=<119,65>,softwareParam=<.>,MetadataResource=http://somewhere.com/path>
+##INFO=<ID=CIGAR,Number=A,Type=String,Description="test">
+##INFO=<ID=AO,Number=A,Type=Integer,Description="Alternate allele observations, with partial observations recorded fractionally">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=FGS,Number=G,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FGI,Number=G,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FGF,Number=G,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAS,Number=A,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAI,Number=A,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAF,Number=A,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRS,Number=R,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRI,Number=R,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRF,Number=R,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=STR,Number=1,Type=String,Description="Test">
+##FILTER=<ID=q20,Description="Mapping quality below 20">
+##contig=<ID=1,assembly=b37,length=249250621>
+##contig=<ID=2,assembly=b37,length=243199373>
+##contig=<ID=3,assembly=b37,length=198022430>
+##contig=<ID=4,assembly=b37,length=191154276>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B
+1	3162006	.	GAA	G,GA	238	PASS	DP=19;AN=4;AC=1,1;XRF=1e+06,2e+06,3e+06;XRI=1111,2222,3333;XRS=ABC,DEF,GHI;XAF=1e+06,2e+06;XAI=1111,2222;XAS=ABC,DEF;XGF=1e+06,2e+06,3e+06,4e+06,5e+06,6e+06;XGI=11,22,33,44,55,66;XGS=ABC,DEF,GHI,JKL,MNO,PQR;TXT=ABC,DEF,GHI	GT:GQ:DP:STR	0/1:589:19:XX	0/2:1:1:YY
+1	3162007	.	TAGGG	CAGGG,CAGGT	238	PASS	AO=52101,113;CIGAR=1X4M,1X3M1X;TXT0=text	GT:FGS:FGI:FGF:FAS:FAI:FAF:FRS:FRI:FRF	./.:AAAAAA,BBBBB,CCCC,DDD,EE,F:1,2,3,4,5,6:0.1,0.02,0.003,0.0004,5e-05,6e-06:AAA,B:1,2:0.1,0.02:A,BB,CCC:1,2,3:0.1,0.02,0.003	2:AAAAAA,BBB,C:1,2,3:0.1,0.02,0.003:AAA,B:1,2:0.1,0.02:A,BB,CCC:1,2,3:0.1,0.02,0.003
diff --git a/test/view.filter.11.out b/test/view.filter.11.out
new file mode 100644
index 0000000..d412670
--- /dev/null
+++ b/test/view.filter.11.out
@@ -0,0 +1,43 @@
+##fileformat=VCFv4.2
+##FILTER=<ID=PASS,Description="All filters passed">
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##INFO=<ID=STR,Number=A,Type=String,Description="Testing string and Number=A in INFO">
+##INFO=<ID=TXT0,Number=1,Type=String,Description="Testing in INFO">
+##INFO=<ID=TXT,Number=.,Type=String,Description="Testing in INFO">
+##INFO=<ID=XRF,Number=R,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAF,Number=A,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGF,Number=G,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XRI,Number=R,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAI,Number=A,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGI,Number=G,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XRS,Number=R,Type=String,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAS,Number=A,Type=String,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGS,Number=G,Type=String,Description="Test Number=AGR in INFO">
+##SAMPLE=<ID=NORMAL,SampleName=B,Description="Less-than (\"<\") and greater-than (\">\") quoting nonsense where double brackets would do just fine",softwareName=<Nonsense,Software>,softwareVer=<119,65>,softwareParam=<.>,MetadataResource=http://somewhere.com/path>
+##INFO=<ID=CIGAR,Number=A,Type=String,Description="test">
+##INFO=<ID=AO,Number=A,Type=Integer,Description="Alternate allele observations, with partial observations recorded fractionally">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=FGS,Number=G,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FGI,Number=G,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FGF,Number=G,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAS,Number=A,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAI,Number=A,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAF,Number=A,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRS,Number=R,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRI,Number=R,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRF,Number=R,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=STR,Number=1,Type=String,Description="Test">
+##FILTER=<ID=q20,Description="Mapping quality below 20">
+##contig=<ID=1,assembly=b37,length=249250621>
+##contig=<ID=2,assembly=b37,length=243199373>
+##contig=<ID=3,assembly=b37,length=198022430>
+##contig=<ID=4,assembly=b37,length=191154276>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B
+1	3162006	.	GAA	G,GA	238	PASS	DP=19;AN=2;AC=0,1;XRF=1e+06,2e+06,3e+06;XRI=1111,2222,3333;XRS=ABC,DEF,GHI;XAF=1e+06,2e+06;XAI=1111,2222;XAS=ABC,DEF;XGF=1e+06,2e+06,3e+06,4e+06,5e+06,6e+06;XGI=11,22,33,44,55,66;XGS=ABC,DEF,GHI,JKL,MNO,PQR;TXT=ABC,DEF,GHI	GT:GQ:DP:STR	./.:589:19:XX	0/2:1:1:YY
+1	3162007	.	TAGGG	CAGGG,CAGGT	238	PASS	AO=52101,113;CIGAR=1X4M,1X3M1X;TXT0=text	GT:FGS:FGI:FGF:FAS:FAI:FAF:FRS:FRI:FRF	0/1:AAAAAA,BBBBB,CCCC,DDD,EE,F:1,2,3,4,5,6:0.1,0.02,0.003,0.0004,5e-05,6e-06:AAA,B:1,2:0.1,0.02:A,BB,CCC:1,2,3:0.1,0.02,0.003	2:AAAAAA,BBB,C:1,2,3:0.1,0.02,0.003:AAA,B:1,2:0.1,0.02:A,BB,CCC:1,2,3:0.1,0.02,0.003
diff --git a/test/view.filter.2.out b/test/view.filter.2.out
new file mode 100644
index 0000000..9d00ad5
--- /dev/null
+++ b/test/view.filter.2.out
@@ -0,0 +1 @@
+1	3162007	.	TAGGG	CAGGG,CAGGT	238	PASS	AO=52101,113;CIGAR=1X4M,1X3M1X;TXT0=text	GT:FGS:FGI:FGF:FAS:FAI:FAF:FRS:FRI:FRF	0/1:AAAAAA,BBBBB,CCCC,DDD,EE,F:1,2,3,4,5,6:0.1,0.02,0.003,0.0004,5e-05,6e-06:AAA,B:1,2:0.1,0.02:A,BB,CCC:1,2,3:0.1,0.02,0.003	2:AAAAAA,BBB,C:1,2,3:0.1,0.02,0.003:AAA,B:1,2:0.1,0.02:A,BB,CCC:1,2,3:0.1,0.02,0.003
diff --git a/test/view.filter.3.out b/test/view.filter.3.out
new file mode 100644
index 0000000..9d00ad5
--- /dev/null
+++ b/test/view.filter.3.out
@@ -0,0 +1 @@
+1	3162007	.	TAGGG	CAGGG,CAGGT	238	PASS	AO=52101,113;CIGAR=1X4M,1X3M1X;TXT0=text	GT:FGS:FGI:FGF:FAS:FAI:FAF:FRS:FRI:FRF	0/1:AAAAAA,BBBBB,CCCC,DDD,EE,F:1,2,3,4,5,6:0.1,0.02,0.003,0.0004,5e-05,6e-06:AAA,B:1,2:0.1,0.02:A,BB,CCC:1,2,3:0.1,0.02,0.003	2:AAAAAA,BBB,C:1,2,3:0.1,0.02,0.003:AAA,B:1,2:0.1,0.02:A,BB,CCC:1,2,3:0.1,0.02,0.003
diff --git a/test/view.filter.4.out b/test/view.filter.4.out
new file mode 100644
index 0000000..9d00ad5
--- /dev/null
+++ b/test/view.filter.4.out
@@ -0,0 +1 @@
+1	3162007	.	TAGGG	CAGGG,CAGGT	238	PASS	AO=52101,113;CIGAR=1X4M,1X3M1X;TXT0=text	GT:FGS:FGI:FGF:FAS:FAI:FAF:FRS:FRI:FRF	0/1:AAAAAA,BBBBB,CCCC,DDD,EE,F:1,2,3,4,5,6:0.1,0.02,0.003,0.0004,5e-05,6e-06:AAA,B:1,2:0.1,0.02:A,BB,CCC:1,2,3:0.1,0.02,0.003	2:AAAAAA,BBB,C:1,2,3:0.1,0.02,0.003:AAA,B:1,2:0.1,0.02:A,BB,CCC:1,2,3:0.1,0.02,0.003
diff --git a/test/view.filter.5.out b/test/view.filter.5.out
new file mode 100644
index 0000000..9d00ad5
--- /dev/null
+++ b/test/view.filter.5.out
@@ -0,0 +1 @@
+1	3162007	.	TAGGG	CAGGG,CAGGT	238	PASS	AO=52101,113;CIGAR=1X4M,1X3M1X;TXT0=text	GT:FGS:FGI:FGF:FAS:FAI:FAF:FRS:FRI:FRF	0/1:AAAAAA,BBBBB,CCCC,DDD,EE,F:1,2,3,4,5,6:0.1,0.02,0.003,0.0004,5e-05,6e-06:AAA,B:1,2:0.1,0.02:A,BB,CCC:1,2,3:0.1,0.02,0.003	2:AAAAAA,BBB,C:1,2,3:0.1,0.02,0.003:AAA,B:1,2:0.1,0.02:A,BB,CCC:1,2,3:0.1,0.02,0.003
diff --git a/test/view.filter.6.out b/test/view.filter.6.out
new file mode 100644
index 0000000..fdf89aa
--- /dev/null
+++ b/test/view.filter.6.out
@@ -0,0 +1,43 @@
+##fileformat=VCFv4.2
+##FILTER=<ID=PASS,Description="All filters passed">
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##INFO=<ID=STR,Number=A,Type=String,Description="Testing string and Number=A in INFO">
+##INFO=<ID=TXT0,Number=1,Type=String,Description="Testing in INFO">
+##INFO=<ID=TXT,Number=.,Type=String,Description="Testing in INFO">
+##INFO=<ID=XRF,Number=R,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAF,Number=A,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGF,Number=G,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XRI,Number=R,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAI,Number=A,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGI,Number=G,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XRS,Number=R,Type=String,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAS,Number=A,Type=String,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGS,Number=G,Type=String,Description="Test Number=AGR in INFO">
+##SAMPLE=<ID=NORMAL,SampleName=B,Description="Less-than (\"<\") and greater-than (\">\") quoting nonsense where double brackets would do just fine",softwareName=<Nonsense,Software>,softwareVer=<119,65>,softwareParam=<.>,MetadataResource=http://somewhere.com/path>
+##INFO=<ID=CIGAR,Number=A,Type=String,Description="test">
+##INFO=<ID=AO,Number=A,Type=Integer,Description="Alternate allele observations, with partial observations recorded fractionally">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=FGS,Number=G,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FGI,Number=G,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FGF,Number=G,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAS,Number=A,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAI,Number=A,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAF,Number=A,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRS,Number=R,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRI,Number=R,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRF,Number=R,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=STR,Number=1,Type=String,Description="Test">
+##FILTER=<ID=q20,Description="Mapping quality below 20">
+##contig=<ID=1,assembly=b37,length=249250621>
+##contig=<ID=2,assembly=b37,length=243199373>
+##contig=<ID=3,assembly=b37,length=198022430>
+##contig=<ID=4,assembly=b37,length=191154276>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B
+1	3162006	.	GAA	G,GA	238	PASS	DP=19;AN=4;AC=1,1;XRF=1e+06,2e+06,3e+06;XRI=1111,2222,3333;XRS=ABC,DEF,GHI;XAF=1e+06,2e+06;XAI=1111,2222;XAS=ABC,DEF;XGF=1e+06,2e+06,3e+06,4e+06,5e+06,6e+06;XGI=11,22,33,44,55,66;XGS=ABC,DEF,GHI,JKL,MNO,PQR;TXT=ABC,DEF,GHI	GT:GQ:DP:STR	0/1:589:19:XX	0/2:1:1:YY
+1	3162007	.	TAGGG	CAGGG,CAGGT	238	PASS	AO=52101,113;CIGAR=1X4M,1X3M1X;TXT0=text	GT:FGS:FGI:FGF:FAS:FAI:FAF:FRS:FRI:FRF	./.:AAAAAA,BBBBB,CCCC,DDD,EE,F:1,2,3,4,5,6:0.1,0.02,0.003,0.0004,5e-05,6e-06:AAA,B:1,2:0.1,0.02:A,BB,CCC:1,2,3:0.1,0.02,0.003	.:AAAAAA,BBB,C:1,2,3:0.1,0.02,0.003:AAA,B:1,2:0.1,0.02:A,BB,CCC:1,2,3:0.1,0.02,0.003
diff --git a/test/view.filter.7.out b/test/view.filter.7.out
new file mode 100644
index 0000000..fdf89aa
--- /dev/null
+++ b/test/view.filter.7.out
@@ -0,0 +1,43 @@
+##fileformat=VCFv4.2
+##FILTER=<ID=PASS,Description="All filters passed">
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##INFO=<ID=STR,Number=A,Type=String,Description="Testing string and Number=A in INFO">
+##INFO=<ID=TXT0,Number=1,Type=String,Description="Testing in INFO">
+##INFO=<ID=TXT,Number=.,Type=String,Description="Testing in INFO">
+##INFO=<ID=XRF,Number=R,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAF,Number=A,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGF,Number=G,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XRI,Number=R,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAI,Number=A,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGI,Number=G,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XRS,Number=R,Type=String,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAS,Number=A,Type=String,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGS,Number=G,Type=String,Description="Test Number=AGR in INFO">
+##SAMPLE=<ID=NORMAL,SampleName=B,Description="Less-than (\"<\") and greater-than (\">\") quoting nonsense where double brackets would do just fine",softwareName=<Nonsense,Software>,softwareVer=<119,65>,softwareParam=<.>,MetadataResource=http://somewhere.com/path>
+##INFO=<ID=CIGAR,Number=A,Type=String,Description="test">
+##INFO=<ID=AO,Number=A,Type=Integer,Description="Alternate allele observations, with partial observations recorded fractionally">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=FGS,Number=G,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FGI,Number=G,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FGF,Number=G,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAS,Number=A,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAI,Number=A,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAF,Number=A,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRS,Number=R,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRI,Number=R,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRF,Number=R,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=STR,Number=1,Type=String,Description="Test">
+##FILTER=<ID=q20,Description="Mapping quality below 20">
+##contig=<ID=1,assembly=b37,length=249250621>
+##contig=<ID=2,assembly=b37,length=243199373>
+##contig=<ID=3,assembly=b37,length=198022430>
+##contig=<ID=4,assembly=b37,length=191154276>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B
+1	3162006	.	GAA	G,GA	238	PASS	DP=19;AN=4;AC=1,1;XRF=1e+06,2e+06,3e+06;XRI=1111,2222,3333;XRS=ABC,DEF,GHI;XAF=1e+06,2e+06;XAI=1111,2222;XAS=ABC,DEF;XGF=1e+06,2e+06,3e+06,4e+06,5e+06,6e+06;XGI=11,22,33,44,55,66;XGS=ABC,DEF,GHI,JKL,MNO,PQR;TXT=ABC,DEF,GHI	GT:GQ:DP:STR	0/1:589:19:XX	0/2:1:1:YY
+1	3162007	.	TAGGG	CAGGG,CAGGT	238	PASS	AO=52101,113;CIGAR=1X4M,1X3M1X;TXT0=text	GT:FGS:FGI:FGF:FAS:FAI:FAF:FRS:FRI:FRF	./.:AAAAAA,BBBBB,CCCC,DDD,EE,F:1,2,3,4,5,6:0.1,0.02,0.003,0.0004,5e-05,6e-06:AAA,B:1,2:0.1,0.02:A,BB,CCC:1,2,3:0.1,0.02,0.003	.:AAAAAA,BBB,C:1,2,3:0.1,0.02,0.003:AAA,B:1,2:0.1,0.02:A,BB,CCC:1,2,3:0.1,0.02,0.003
diff --git a/test/view.filter.8.out b/test/view.filter.8.out
new file mode 100644
index 0000000..fdf89aa
--- /dev/null
+++ b/test/view.filter.8.out
@@ -0,0 +1,43 @@
+##fileformat=VCFv4.2
+##FILTER=<ID=PASS,Description="All filters passed">
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##INFO=<ID=STR,Number=A,Type=String,Description="Testing string and Number=A in INFO">
+##INFO=<ID=TXT0,Number=1,Type=String,Description="Testing in INFO">
+##INFO=<ID=TXT,Number=.,Type=String,Description="Testing in INFO">
+##INFO=<ID=XRF,Number=R,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAF,Number=A,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGF,Number=G,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XRI,Number=R,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAI,Number=A,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGI,Number=G,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XRS,Number=R,Type=String,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAS,Number=A,Type=String,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGS,Number=G,Type=String,Description="Test Number=AGR in INFO">
+##SAMPLE=<ID=NORMAL,SampleName=B,Description="Less-than (\"<\") and greater-than (\">\") quoting nonsense where double brackets would do just fine",softwareName=<Nonsense,Software>,softwareVer=<119,65>,softwareParam=<.>,MetadataResource=http://somewhere.com/path>
+##INFO=<ID=CIGAR,Number=A,Type=String,Description="test">
+##INFO=<ID=AO,Number=A,Type=Integer,Description="Alternate allele observations, with partial observations recorded fractionally">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=FGS,Number=G,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FGI,Number=G,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FGF,Number=G,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAS,Number=A,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAI,Number=A,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAF,Number=A,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRS,Number=R,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRI,Number=R,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRF,Number=R,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=STR,Number=1,Type=String,Description="Test">
+##FILTER=<ID=q20,Description="Mapping quality below 20">
+##contig=<ID=1,assembly=b37,length=249250621>
+##contig=<ID=2,assembly=b37,length=243199373>
+##contig=<ID=3,assembly=b37,length=198022430>
+##contig=<ID=4,assembly=b37,length=191154276>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B
+1	3162006	.	GAA	G,GA	238	PASS	DP=19;AN=4;AC=1,1;XRF=1e+06,2e+06,3e+06;XRI=1111,2222,3333;XRS=ABC,DEF,GHI;XAF=1e+06,2e+06;XAI=1111,2222;XAS=ABC,DEF;XGF=1e+06,2e+06,3e+06,4e+06,5e+06,6e+06;XGI=11,22,33,44,55,66;XGS=ABC,DEF,GHI,JKL,MNO,PQR;TXT=ABC,DEF,GHI	GT:GQ:DP:STR	0/1:589:19:XX	0/2:1:1:YY
+1	3162007	.	TAGGG	CAGGG,CAGGT	238	PASS	AO=52101,113;CIGAR=1X4M,1X3M1X;TXT0=text	GT:FGS:FGI:FGF:FAS:FAI:FAF:FRS:FRI:FRF	./.:AAAAAA,BBBBB,CCCC,DDD,EE,F:1,2,3,4,5,6:0.1,0.02,0.003,0.0004,5e-05,6e-06:AAA,B:1,2:0.1,0.02:A,BB,CCC:1,2,3:0.1,0.02,0.003	.:AAAAAA,BBB,C:1,2,3:0.1,0.02,0.003:AAA,B:1,2:0.1,0.02:A,BB,CCC:1,2,3:0.1,0.02,0.003
diff --git a/test/view.filter.9.out b/test/view.filter.9.out
new file mode 100644
index 0000000..aa86f34
--- /dev/null
+++ b/test/view.filter.9.out
@@ -0,0 +1,43 @@
+##fileformat=VCFv4.2
+##FILTER=<ID=PASS,Description="All filters passed">
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##INFO=<ID=STR,Number=A,Type=String,Description="Testing string and Number=A in INFO">
+##INFO=<ID=TXT0,Number=1,Type=String,Description="Testing in INFO">
+##INFO=<ID=TXT,Number=.,Type=String,Description="Testing in INFO">
+##INFO=<ID=XRF,Number=R,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAF,Number=A,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGF,Number=G,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XRI,Number=R,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAI,Number=A,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGI,Number=G,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XRS,Number=R,Type=String,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAS,Number=A,Type=String,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGS,Number=G,Type=String,Description="Test Number=AGR in INFO">
+##SAMPLE=<ID=NORMAL,SampleName=B,Description="Less-than (\"<\") and greater-than (\">\") quoting nonsense where double brackets would do just fine",softwareName=<Nonsense,Software>,softwareVer=<119,65>,softwareParam=<.>,MetadataResource=http://somewhere.com/path>
+##INFO=<ID=CIGAR,Number=A,Type=String,Description="test">
+##INFO=<ID=AO,Number=A,Type=Integer,Description="Alternate allele observations, with partial observations recorded fractionally">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=FGS,Number=G,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FGI,Number=G,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FGF,Number=G,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAS,Number=A,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAI,Number=A,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAF,Number=A,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRS,Number=R,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRI,Number=R,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRF,Number=R,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=STR,Number=1,Type=String,Description="Test">
+##FILTER=<ID=q20,Description="Mapping quality below 20">
+##contig=<ID=1,assembly=b37,length=249250621>
+##contig=<ID=2,assembly=b37,length=243199373>
+##contig=<ID=3,assembly=b37,length=198022430>
+##contig=<ID=4,assembly=b37,length=191154276>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B
+1	3162006	.	GAA	G,GA	238	PASS	DP=19;AN=4;AC=1,1;XRF=1e+06,2e+06,3e+06;XRI=1111,2222,3333;XRS=ABC,DEF,GHI;XAF=1e+06,2e+06;XAI=1111,2222;XAS=ABC,DEF;XGF=1e+06,2e+06,3e+06,4e+06,5e+06,6e+06;XGI=11,22,33,44,55,66;XGS=ABC,DEF,GHI,JKL,MNO,PQR;TXT=ABC,DEF,GHI	GT:GQ:DP:STR	0/1:589:19:XX	0/2:1:1:YY
+1	3162007	.	TAGGG	CAGGG,CAGGT	238	PASS	AO=52101,113;CIGAR=1X4M,1X3M1X;TXT0=text	GT:FGS:FGI:FGF:FAS:FAI:FAF:FRS:FRI:FRF	0/1:AAAAAA,BBBBB,CCCC,DDD,EE,F:1,2,3,4,5,6:0.1,0.02,0.003,0.0004,5e-05,6e-06:AAA,B:1,2:0.1,0.02:A,BB,CCC:1,2,3:0.1,0.02,0.003	.:AAAAAA,BBB,C:1,2,3:0.1,0.02,0.003:AAA,B:1,2:0.1,0.02:A,BB,CCC:1,2,3:0.1,0.02,0.003
diff --git a/test/view.filter.vcf b/test/view.filter.vcf
new file mode 100644
index 0000000..df6bc7b
--- /dev/null
+++ b/test/view.filter.vcf
@@ -0,0 +1,42 @@
+##fileformat=VCFv4.2
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##INFO=<ID=STR,Number=A,Type=String,Description="Testing string and Number=A in INFO">
+##INFO=<ID=TXT0,Number=1,Type=String,Description="Testing in INFO">
+##INFO=<ID=TXT,Number=.,Type=String,Description="Testing in INFO">
+##INFO=<ID=XRF,Number=R,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAF,Number=A,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGF,Number=G,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XRI,Number=R,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAI,Number=A,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGI,Number=G,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XRS,Number=R,Type=String,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAS,Number=A,Type=String,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGS,Number=G,Type=String,Description="Test Number=AGR in INFO">
+##SAMPLE=<ID=NORMAL,SampleName=B,Description="Less-than (\"<\") and greater-than (\">\") quoting nonsense where double brackets would do just fine",softwareName=<Nonsense,Software>,softwareVer=<119,65>,softwareParam=<.>,MetadataResource=http://somewhere.com/path>
+##INFO=<ID=CIGAR,Number=A,Type=String,Description="test">
+##INFO=<ID=AO,Number=A,Type=Integer,Description="Alternate allele observations, with partial observations recorded fractionally">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=FGS,Number=G,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FGI,Number=G,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FGF,Number=G,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAS,Number=A,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAI,Number=A,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAF,Number=A,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRS,Number=R,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRI,Number=R,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRF,Number=R,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=STR,Number=1,Type=String,Description="Test">
+##FILTER=<ID=q20,Description="Mapping quality below 20">
+##contig=<ID=1,assembly=b37,length=249250621>
+##contig=<ID=2,assembly=b37,length=243199373>
+##contig=<ID=3,assembly=b37,length=198022430>
+##contig=<ID=4,assembly=b37,length=191154276>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B
+1	3162006	.	GAA	G,GA	238	PASS	DP=19;AN=4;AC=1,1;XRF=1e6,2e6,3e6;XRI=1111,2222,3333;XRS=ABC,DEF,GHI;XAF=1e6,2e6;XAI=1111,2222;XAS=ABC,DEF;XGF=1e6,2e6,3e6,4e6,5e6,6e6;XGI=11,22,33,44,55,66;XGS=ABC,DEF,GHI,JKL,MNO,PQR;TXT=ABC,DEF,GHI	GT:GQ:DP:STR	0/1:589:19:XX	0/2:1:1:YY
+1	3162007	.	TAGGG	CAGGG,CAGGT	238	PASS	AO=52101,113;CIGAR=1X4M,1X3M1X;TXT0=text	GT:FGS:FGI:FGF:FAS:FAI:FAF:FRS:FRI:FRF	0/1:AAAAAA,BBBBB,CCCC,DDD,EE,F:1,2,3,4,5,6:1e-1,2e-2,3e-3,4e-4,5e-5,6e-6:AAA,B:1,2:1e-1,2e-2:A,BB,CCC:1,2,3:1e-1,2e-2,3e-3	2:AAAAAA,BBB,C:1,2,3:1e-1,2e-2,3e-3:AAA,B:1,2:1e-1,2e-2:A,BB,CCC:1,2,3:1e-1,2e-2,3e-3
diff --git a/test/view.minmaxac.1.out b/test/view.minmaxac.1.out
new file mode 100644
index 0000000..e76c09f
--- /dev/null
+++ b/test/view.minmaxac.1.out
@@ -0,0 +1 @@
+20	1234567	.	A	G,C,T	50	PASS	NS=3;DP=9;AC=3,1,1;AN=8	GT:GQ:DP:TS	0/1:35:4:A,.	0/2:17:2:.	1/1:40:3:.	0/3:17:2:.
diff --git a/test/view.minmaxac.2.out b/test/view.minmaxac.2.out
new file mode 100644
index 0000000..eccc02a
--- /dev/null
+++ b/test/view.minmaxac.2.out
@@ -0,0 +1 @@
+20	1234568	.	A	G,C,T	50	PASS	NS=3;DP=9;AC=2,2,2;AN=8	GT:GQ:DP:TS	0/1:35:4:A,.	2/2:17:2:.	3/3:40:3:.	0/1:17:2:.
diff --git a/test/view.minmaxac.vcf b/test/view.minmaxac.vcf
new file mode 100644
index 0000000..0010d2f
--- /dev/null
+++ b/test/view.minmaxac.vcf
@@ -0,0 +1,13 @@
+##fileformat=VCFv4.2
+##reference=file:///seq/references/1000GenomesPilot-NCBI36.fasta
+##contig=<ID=20,length=62435964,assembly=B36,md5=f126cdf8a6e0c7f379d618ff66beb2da,species="Homo sapiens",taxonomy=x>
+##INFO=<ID=NS,Number=1,Type=Integer,Description="Number of Samples With Data">
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=HQ,Number=2,Type=Integer,Description="Haplotype Quality">
+##FORMAT=<ID=TS,Number=2,Type=String,Description="Test Empty Format String">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	NA00001	NA00002	NA00003	NA00004
+20	1234567	.	A	G,C,T	50	PASS	NS=3;DP=9	GT:GQ:DP:TS	0/1:35:4:A,.	0/2:17:2	1/1:40:3	0/3:17:2
+20	1234568	.	A	G,C,T	50	PASS	NS=3;DP=9	GT:GQ:DP:TS	0/1:35:4:A,.	2/2:17:2	3/3:40:3	0/1:17:2
diff --git a/test/view.omitgenotypes.out b/test/view.omitgenotypes.out
new file mode 100644
index 0000000..1b3dc20
--- /dev/null
+++ b/test/view.omitgenotypes.out
@@ -0,0 +1,17 @@
+##fileformat=VCFv4.2
+##FILTER=<ID=PASS,Description="All filters passed">
+##reference=file:///seq/references/1000GenomesPilot-NCBI36.fasta
+##contig=<ID=20,length=62435964,assembly=B36,md5=f126cdf8a6e0c7f379d618ff66beb2da,species="Homo sapiens",taxonomy=x>
+##INFO=<ID=NS,Number=1,Type=Integer,Description="Number of Samples With Data">
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=HQ,Number=2,Type=Integer,Description="Haplotype Quality">
+##FORMAT=<ID=TS,Number=2,Type=String,Description="Test Empty Format String">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	NA00001	NA00002	NA00003
+20	14370	rs6054257	G	A	29	PASS	NS=3;DP=14	GT:GQ:DP:HQ	0|0:48:1:51,51	1|0:48:8:51,51	1/1:43:5:.,.
+20	17330	.	T	A	3	PASS	NS=3;DP=11	GT:GQ:DP:HQ	./.:.:.:.,.	./.:.:.:.,.	./.:.:.:.,.
+20	1110696	rs6040355	A	G,T	67	PASS	NS=2;DP=10	GT:GQ:DP:HQ:TS	./.:.:.:.:.	./.:.:.:.:.	./.:.:.:.:.
+20	1230237	.	T	.	47	PASS	NS=3;DP=13	GT:GQ:DP:HQ:TS	.:.:.:.:.	.:.:.:.:.	.:.:.:.:.
+20	1234567	microsat1	GTC	G,GTCT	50	PASS	NS=3;DP=9	GT:GQ:DP:TS	0/1:35:4:A,.	0/2:17:2:.	1/1:40:3:.
diff --git a/test/view.omitgenotypes.vcf b/test/view.omitgenotypes.vcf
new file mode 100644
index 0000000..a140f67
--- /dev/null
+++ b/test/view.omitgenotypes.vcf
@@ -0,0 +1,16 @@
+##fileformat=VCFv4.2
+##reference=file:///seq/references/1000GenomesPilot-NCBI36.fasta
+##contig=<ID=20,length=62435964,assembly=B36,md5=f126cdf8a6e0c7f379d618ff66beb2da,species="Homo sapiens",taxonomy=x>
+##INFO=<ID=NS,Number=1,Type=Integer,Description="Number of Samples With Data">
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=HQ,Number=2,Type=Integer,Description="Haplotype Quality">
+##FORMAT=<ID=TS,Number=2,Type=String,Description="Test Empty Format String">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	NA00001	NA00002	NA00003
+20	14370	rs6054257	G	A	29	PASS	NS=3;DP=14	GT:GQ:DP:HQ	0|0:48:1:51,51	1|0:48:8:51,51	1/1:43:5:.,.
+20	17330	.	T	A	3	PASS	NS=3;DP=11	GT:GQ:DP:HQ	./.:.:.:.,.	./.:.:.:.,.	./.:.:.:.,.
+20	1110696	rs6040355	A	G,T	67	PASS	NS=2;DP=10	GT:GQ:DP:HQ:TS	./.	./.	./.
+20	1230237	.	T	.	47	PASS	NS=3;DP=13	GT:GQ:DP:HQ:TS	.	.	.
+20	1234567	microsat1	GTC	G,GTCT	50	PASS	NS=3;DP=9	GT:GQ:DP:TS	0/1:35:4:A,.	0/2:17:2	1/1:40:3
diff --git a/test/view.vcf b/test/view.vcf
new file mode 100644
index 0000000..9e6c2fd
--- /dev/null
+++ b/test/view.vcf
@@ -0,0 +1,46 @@
+##fileformat=VCFv4.1
+##reference=file:///seq/references/1000Genomes-NCBI37.fasta
+##contig=<ID=11,length=135006516>
+##contig=<ID=20,length=63025520>
+##contig=<ID=X,length=155270560>
+##contig=<ID=Y,length=59373566>
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Raw read depth">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##INFO=<ID=Dels,Number=1,Type=Float,Description="Fraction of reads containing spanning deletions">
+##INFO=<ID=FS,Number=1,Type=Float,Description="Phred-scaled p-value using Fisher's exact test to detect strand bias">
+##INFO=<ID=HRun,Number=1,Type=Integer,Description="Largest contiguous homopolymer run of variant allele in either direction">
+##INFO=<ID=HWE,Number=1,Type=Float,Description="Hardy-Weinberg equilibrium test (PMID:15789306)">
+##INFO=<ID=ICF,Number=1,Type=Float,Description="Inbreeding coefficient F">
+##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
+##INFO=<ID=IS,Number=2,Type=Float,Description="Maximum number of reads supporting an indel and fraction of indel reads">
+##INFO=<ID=MQ,Number=1,Type=Integer,Description="Root-mean-square mapping quality of covering reads">
+##INFO=<ID=MQ0,Number=1,Type=Integer,Description="Total mapping quality zero reads">
+##INFO=<ID=PV4,Number=4,Type=Float,Description="P-values for strand bias, baseQ bias, mapQ bias and tail distance bias">
+##INFO=<ID=QD,Number=1,Type=Float,Description="Variant confidence/quality by depth">
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="# high-quality bases">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=PL,Number=G,Type=Integer,Description="List of Phred-scaled genotype likelihoods">
+##FILTER=<ID=StrandBias,Description="Min P-value for strand bias (INFO/PV4) [0.0001]">
+##FILTER=<ID=BaseQualBias,Description="Min P-value for baseQ bias (INFO/PV4) [1e-100]">
+##FILTER=<ID=MapQualBias,Description="Min P-value for mapQ bias (INFO/PV4) [0]">
+##FILTER=<ID=EndDistBias,Description="Min P-value for end distance bias (INFO/PV4) [0.0001]">
+##FILTER=<ID=MinAB,Description="Minimum number of alternate bases (INFO/DP4) [2]">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	NA00001	NA00002	NA00003
+11	2343543	.	A	.	999	PASS	DP=100223	GT:PL:DP:GQ	0/0:0,255,255:193:99	0/0:0,255,255:211:99	0/0:0,255,255:182:99
+11	5464562	.	C	T	999	PASS	DP=0	GT:PL:DP:GQ	./.:0,0,0:.:.	./.:0,0,0:.:.	./.:0,0,0:.:.
+20	76962	rs6111385	T	C	999	PASS	DP4=110138,70822,421911,262673;DP=911531;Dels=0;FS=21.447;HWE=0.491006;ICF=-0.01062;MQ0=1;MQ=46;PV4=2.5e-09,0,0,1;QD=22.31	GT:PL:DP:GQ	0/1:255,0,255:193:99	1/1:255,255,0:211:99	1/1:255,255,0:182:99
+20	126310	.	ACC	A	999	StrandBias;EndDistBias	DP4=125718,95950,113812,80890;DP=461867;HWE=0.24036;ICF=0.01738;INDEL;IS=374,0.937343;MQ=49;PV4=9e-30,1,0,3.8e-13;QD=0.0172;AN=6;AC=4	GT:DP:GQ:PL	0/1:117:99:255,0,132	0/1:111:99:255,0,139	1/1:78:99:255,213,0
+20	138125	rs2298108	G	T	999	PASS	DP4=174391,20849,82080,4950;DP=286107;Dels=0;FS=3200;HWE=0.199462;ICF=0.01858;MQ0=0;MQ=46;PV4=0,0,0,1;QD=17.22;AN=6;AC=4	GT:PL:DP:GQ	0/1:135,0,163:66:99	0/1:140,0,255:71:99	1/1:255,199,0:66:99
+20	138148	rs2298109	C	T	999	PASS	DP4=194136,45753,94945,14367;DP=356657;Dels=0;FS=3200;HWE=0.177865;ICF=0.0198;MQ0=0;MQ=47;PV4=0,0,0,1;QD=14.57;AN=6;AC=4	GT:PL:DP:GQ	0/1:195,0,255:87:99	0/1:192,0,255:82:99	1/1:255,235,0:78:99
+20	271225	.	T	TTTA,TA	999	StrandBias	DP4=29281,42401,27887,29245;DP=272732;INDEL;IS=95,0.748031;MQ=47;PV4=0,1,0,1;QD=0.0948;AN=6;AC=2,2	GT:DP:GQ:PL	0/2:33:49:151,53,203,0,52,159	0/1:51:99:255,0,213,255,255,255	1/2:47:99:255,255,255,255,0,241
+20	304568	.	C	T	999	PASS	DP4=16413,4543,945,156;DP=43557;Dels=0;FS=3200;HWE=0.076855;ICF=0.0213;MQ0=0;MQ=50;PV4=0,0,0,1;QD=15.45;AN=6;AC=4	GT:PL:DP:GQ	0|1:95,0,255:90:99	0|1:192,0,255:13:99	1|1:255,95,0:60:99
+20	326891	.	A	AC	999	PASS	DP4=125718,95950,113812,80890;DP=461867;HWE=0.24036;ICF=0.01738;INDEL;IS=374,0.937343;MQ=49;PV4=9e-30,1,0,3.8e-13;QD=0.0172;AN=4;AC=2	GT:DP:GQ:PL	0|1:117:99:255,0,132	0|1:111:99:255,0,139	./.:.:.:.,.,.
+X	2928329	rs62584840	C	T	999	PASS	DP4=302,9137,32,1329;DP=11020;Dels=0;FS=13.38;HWE=0.284332;ICF=0.0253;MQ0=0;MQ=49;PV4=0.094,0,0,1;QD=18.61;AN=4;AC=1	GT:PL:DP:GQ	0:0,56:2:73	0:0,81:3:98	0/1:73,0,19:4:30
+X	2933066	rs61746890	G	C	999	PASS	DP4=69865,100561,461,783;DP=173729;Dels=0;FS=10.833;MQ0=0;MQ=50;PV4=0.005,3.6e-14,0,1;QD=15.33;AN=4;AC=1	GT:PL:DP:GQ	0:0,255:39:99	0:0,255:37:99	0/1:255,255,255:62:99
+X	2942109	rs5939407	T	C	999	PASS	DP4=23273,27816,40128,48208;DP=146673;Dels=0;FS=43.639;HWE=0.622715;ICF=-0.01176;MQ0=1;MQ=46;PV4=0.65,1,0,1;QD=14.81;AN=4;AC=3	GT:PL:DP:GQ	0:0,255:20:99	1:255,0:33:99	1/1:255,157,0:52:99
+X	3048719	.	T	C	999	PASS	DP4=13263,27466,40128,48208;DP=146673;Dels=0;FS=43.639;HWE=0.622715;ICF=-0.01176;MQ0=1;MQ=46;PV4=0.65,1,0,1;QD=14.81;AN=4;AC=3	GT:PL:DP:GQ	0:0,255:20:99	1:255,0:33:99	0|1:255,0,157:52:99
+Y	8657215	.	C	A	999	PASS	DP4=74915,114274,1948,2955;DP=195469;Dels=0;FS=3.181;MQ0=0;MQ=50;PV4=0.86,1,0,1;QD=33.77;AN=2;AC=1	GT:PL:DP:GQ	0:0,255:47:99	1:255,0:64:99	.
+Y	10011673	rs78249411	G	A	999	MinAB	DP4=47351,30839,178796,279653;DP=550762;Dels=0;FS=41.028;MQ0=37362;MQ=26;PV4=0,0,0,1;QD=17.45;AN=2;AC=2	GT:PL:DP:GQ	1:126,101:146:37	1:95,0:130:99	.
diff --git a/test/view.vectors.A.out b/test/view.vectors.A.out
new file mode 100644
index 0000000..c8be333
--- /dev/null
+++ b/test/view.vectors.A.out
@@ -0,0 +1,56 @@
+##fileformat=VCFv4.2
+##FILTER=<ID=PASS,Description="All filters passed">
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##INFO=<ID=STR,Number=A,Type=String,Description="Testing string and Number=A in INFO">
+##INFO=<ID=TXT,Number=.,Type=String,Description="Testing in INFO">
+##INFO=<ID=XRF,Number=R,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAF,Number=A,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGF,Number=G,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XRI,Number=R,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAI,Number=A,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGI,Number=G,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XRS,Number=R,Type=String,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAS,Number=A,Type=String,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGS,Number=G,Type=String,Description="Test Number=AGR in INFO">
+##SAMPLE=<ID=NORMAL,SampleName=B,Description="Less-than (\"<\") and greater-than (\">\") quoting nonsense where double brackets would do just fine",softwareName=<Nonsense,Software>,softwareVer=<119,65>,softwareParam=<.>,MetadataResource=http://somewhere.com/path>
+##INFO=<ID=CIGAR,Number=A,Type=String,Description="test">
+##INFO=<ID=AO,Number=A,Type=Integer,Description="Alternate allele observations, with partial observations recorded fractionally">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=FGS,Number=G,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FGI,Number=G,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FGF,Number=G,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAS,Number=A,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAI,Number=A,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAF,Number=A,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRS,Number=R,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRI,Number=R,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRF,Number=R,Type=Float,Description="Test Number=AGR in FORMAT">
+##FILTER=<ID=q20,Description="Mapping quality below 20">
+##contig=<ID=1,assembly=b37,length=249250621>
+##contig=<ID=2,assembly=b37,length=243199373>
+##contig=<ID=3,assembly=b37,length=198022430>
+##contig=<ID=4,assembly=b37,length=191154276>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##INFO=<ID=IA8,Number=.,Type=Integer,Description="test">
+##INFO=<ID=IA16,Number=.,Type=Integer,Description="test">
+##INFO=<ID=IA32,Number=.,Type=Integer,Description="test">
+##INFO=<ID=IAF,Number=.,Type=Float,Description="test">
+##INFO=<ID=I8,Number=1,Type=Integer,Description="test">
+##INFO=<ID=I16,Number=1,Type=Integer,Description="test">
+##INFO=<ID=I32,Number=1,Type=Integer,Description="test">
+##INFO=<ID=IF,Number=1,Type=Float,Description="test">
+##FORMAT=<ID=F8,Number=1,Type=Integer,Description="test">
+##FORMAT=<ID=F16,Number=1,Type=Integer,Description="test">
+##FORMAT=<ID=F32,Number=1,Type=Integer,Description="test">
+##FORMAT=<ID=FF,Number=1,Type=Float,Description="test">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A
+1	3162006	.	GAA	G	238	PASS	DP=19;AN=2;AC=1;XRF=1e+06,2e+06;XRI=1111,2222;XRS=ABC,DEF;XAF=1e+06;XAI=1111;XAS=ABC;XGF=1e+06,2e+06,3e+06;XGI=11,22,33;XGS=ABC,DEF,GHI;TXT=ABC,DEF,GHI	GT:GQ:DP	0/1:589:19
+1	3162007	.	TAGGG	CAGGG	238	PASS	AO=52101;CIGAR=1X4M;AC=1;AN=2	GT:FGS:FGI:FGF:FAS:FAI:FAF:FRS:FRI:FRF	0/1:AAAAAA,BBBBB,CCCC:1,2,3:0.1,0.02,0.003:AAA:1:0.1:A,BB:1,2:0.1,0.02
+1	3162008	.	TAGGG	CAGGG	238	PASS	IA8=10,.;IA16=1000,.;IA32=100000,.;IAF=0.003,.;CIGAR=1X4M;AC=1;AN=2	GT:F8:F16:F32:FF	0/1:10:1000:100000:0.003
+1	3162009	.	TAGGG	CAGGG	238	PASS	IA8=.;IA16=.;IA32=.;IAF=.;CIGAR=1X4M;AC=1;AN=2	GT:F8:F16:F32:FF	0/1:10:1000:100000:0.003
+1	3162010	.	TAGGG	CAGGG	238	PASS	I8=.;I16=.;I32=.;IF=.;CIGAR=1X4M;AC=1;AN=2	GT:F8:F16:F32:FF	0/1:10:1000:100000:0.003
diff --git a/test/view.vectors.B.out b/test/view.vectors.B.out
new file mode 100644
index 0000000..6083f67
--- /dev/null
+++ b/test/view.vectors.B.out
@@ -0,0 +1,56 @@
+##fileformat=VCFv4.2
+##FILTER=<ID=PASS,Description="All filters passed">
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##INFO=<ID=STR,Number=A,Type=String,Description="Testing string and Number=A in INFO">
+##INFO=<ID=TXT,Number=.,Type=String,Description="Testing in INFO">
+##INFO=<ID=XRF,Number=R,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAF,Number=A,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGF,Number=G,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XRI,Number=R,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAI,Number=A,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGI,Number=G,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XRS,Number=R,Type=String,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAS,Number=A,Type=String,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGS,Number=G,Type=String,Description="Test Number=AGR in INFO">
+##SAMPLE=<ID=NORMAL,SampleName=B,Description="Less-than (\"<\") and greater-than (\">\") quoting nonsense where double brackets would do just fine",softwareName=<Nonsense,Software>,softwareVer=<119,65>,softwareParam=<.>,MetadataResource=http://somewhere.com/path>
+##INFO=<ID=CIGAR,Number=A,Type=String,Description="test">
+##INFO=<ID=AO,Number=A,Type=Integer,Description="Alternate allele observations, with partial observations recorded fractionally">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=FGS,Number=G,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FGI,Number=G,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FGF,Number=G,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAS,Number=A,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAI,Number=A,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAF,Number=A,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRS,Number=R,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRI,Number=R,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRF,Number=R,Type=Float,Description="Test Number=AGR in FORMAT">
+##FILTER=<ID=q20,Description="Mapping quality below 20">
+##contig=<ID=1,assembly=b37,length=249250621>
+##contig=<ID=2,assembly=b37,length=243199373>
+##contig=<ID=3,assembly=b37,length=198022430>
+##contig=<ID=4,assembly=b37,length=191154276>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##INFO=<ID=IA8,Number=.,Type=Integer,Description="test">
+##INFO=<ID=IA16,Number=.,Type=Integer,Description="test">
+##INFO=<ID=IA32,Number=.,Type=Integer,Description="test">
+##INFO=<ID=IAF,Number=.,Type=Float,Description="test">
+##INFO=<ID=I8,Number=1,Type=Integer,Description="test">
+##INFO=<ID=I16,Number=1,Type=Integer,Description="test">
+##INFO=<ID=I32,Number=1,Type=Integer,Description="test">
+##INFO=<ID=IF,Number=1,Type=Float,Description="test">
+##FORMAT=<ID=F8,Number=1,Type=Integer,Description="test">
+##FORMAT=<ID=F16,Number=1,Type=Integer,Description="test">
+##FORMAT=<ID=F32,Number=1,Type=Integer,Description="test">
+##FORMAT=<ID=FF,Number=1,Type=Float,Description="test">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	B
+1	3162006	.	GAA	GA	238	PASS	DP=19;AN=2;AC=1;XRF=1e+06,3e+06;XRI=1111,3333;XRS=ABC,GHI;XAF=2e+06;XAI=2222;XAS=DEF;XGF=1e+06,4e+06,6e+06;XGI=11,44,66;XGS=ABC,JKL,PQR;TXT=ABC,DEF,GHI	GT:GQ:DP	0/1:1:1
+1	3162007	.	TAGGG	CAGGT	238	PASS	AO=113;CIGAR=1X3M1X;AC=1;AN=1	GT:FGS:FGI:FGF:FAS:FAI:FAF:FRS:FRI:FRF	1:AAAAAA,C:1,3:0.1,0.003:B:2:0.02:A,CCC:1,3:0.1,0.003
+1	3162008	.	TAGGG	CAGGT	238	PASS	IA8=10,.;IA16=1000,.;IA32=100000,.;IAF=0.003,.;CIGAR=1X3M1X;AC=1;AN=1	GT:F8:F16:F32:FF	1:.:.:.:.
+1	3162009	.	TAGGG	CAGGT	238	PASS	IA8=.;IA16=.;IA32=.;IAF=.;CIGAR=1X3M1X;AC=1;AN=1	GT:F8:F16:F32:FF	1:.:.:.:.
+1	3162010	.	TAGGG	CAGGT	238	PASS	I8=.;I16=.;I32=.;IF=.;CIGAR=1X3M1X;AC=1;AN=1	GT:F8:F16:F32:FF	1:.:.:.:.
diff --git a/test/view.vectors.vcf b/test/view.vectors.vcf
new file mode 100644
index 0000000..903e57b
--- /dev/null
+++ b/test/view.vectors.vcf
@@ -0,0 +1,55 @@
+##fileformat=VCFv4.2
+##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
+##INFO=<ID=DP4,Number=4,Type=Integer,Description="# high-quality ref-forward bases, ref-reverse, alt-forward and alt-reverse bases">
+##INFO=<ID=STR,Number=A,Type=String,Description="Testing string and Number=A in INFO">
+##INFO=<ID=TXT,Number=.,Type=String,Description="Testing in INFO">
+##INFO=<ID=XRF,Number=R,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAF,Number=A,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGF,Number=G,Type=Float,Description="Test Number=AGR in INFO">
+##INFO=<ID=XRI,Number=R,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAI,Number=A,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGI,Number=G,Type=Integer,Description="Test Number=AGR in INFO">
+##INFO=<ID=XRS,Number=R,Type=String,Description="Test Number=AGR in INFO">
+##INFO=<ID=XAS,Number=A,Type=String,Description="Test Number=AGR in INFO">
+##INFO=<ID=XGS,Number=G,Type=String,Description="Test Number=AGR in INFO">
+##SAMPLE=<ID=NORMAL,SampleName=B,Description="Less-than (\"<\") and greater-than (\">\") quoting nonsense where double brackets would do just fine",softwareName=<Nonsense,Software>,softwareVer=<119,65>,softwareParam=<.>,MetadataResource=http://somewhere.com/path>
+##INFO=<ID=CIGAR,Number=A,Type=String,Description="test">
+##INFO=<ID=AO,Number=A,Type=Integer,Description="Alternate allele observations, with partial observations recorded fractionally">
+##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
+##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
+##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
+##FORMAT=<ID=FGS,Number=G,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FGI,Number=G,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FGF,Number=G,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAS,Number=A,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAI,Number=A,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FAF,Number=A,Type=Float,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRS,Number=R,Type=String,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRI,Number=R,Type=Integer,Description="Test Number=AGR in FORMAT">
+##FORMAT=<ID=FRF,Number=R,Type=Float,Description="Test Number=AGR in FORMAT">
+##FILTER=<ID=q20,Description="Mapping quality below 20">
+##contig=<ID=1,assembly=b37,length=249250621>
+##contig=<ID=2,assembly=b37,length=243199373>
+##contig=<ID=3,assembly=b37,length=198022430>
+##contig=<ID=4,assembly=b37,length=191154276>
+##reference=file:///lustre/scratch105/projects/g1k/ref/main_project/human_g1k_v37.fasta
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##INFO=<ID=IA8,Number=.,Type=Integer,Description="test">
+##INFO=<ID=IA16,Number=.,Type=Integer,Description="test">
+##INFO=<ID=IA32,Number=.,Type=Integer,Description="test">
+##INFO=<ID=IAF,Number=.,Type=Float,Description="test">
+##INFO=<ID=I8,Number=1,Type=Integer,Description="test">
+##INFO=<ID=I16,Number=1,Type=Integer,Description="test">
+##INFO=<ID=I32,Number=1,Type=Integer,Description="test">
+##INFO=<ID=IF,Number=1,Type=Float,Description="test">
+##FORMAT=<ID=F8,Number=1,Type=Integer,Description="test">
+##FORMAT=<ID=F16,Number=1,Type=Integer,Description="test">
+##FORMAT=<ID=F32,Number=1,Type=Integer,Description="test">
+##FORMAT=<ID=FF,Number=1,Type=Float,Description="test">
+#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	A	B
+1	3162006	.	GAA	G,GA	238	PASS	DP=19;AN=4;AC=1,1;XRF=1e6,2e6,3e6;XRI=1111,2222,3333;XRS=ABC,DEF,GHI;XAF=1e6,2e6;XAI=1111,2222;XAS=ABC,DEF;XGF=1e6,2e6,3e6,4e6,5e6,6e6;XGI=11,22,33,44,55,66;XGS=ABC,DEF,GHI,JKL,MNO,PQR;TXT=ABC,DEF,GHI	GT:GQ:DP	0/1:589:19	0/2:1:1
+1	3162007	.	TAGGG	CAGGG,CAGGT	238	PASS	AO=52101,113;CIGAR=1X4M,1X3M1X	GT:FGS:FGI:FGF:FAS:FAI:FAF:FRS:FRI:FRF	0/1:AAAAAA,BBBBB,CCCC,DDD,EE,F:1,2,3,4,5,6:1e-1,2e-2,3e-3,4e-4,5e-5,6e-6:AAA,B:1,2:1e-1,2e-2:A,BB,CCC:1,2,3:1e-1,2e-2,3e-3	2:AAAAAA,BBB,C:1,2,3:1e-1,2e-2,3e-3:AAA,B:1,2:1e-1,2e-2:A,BB,CCC:1,2,3:1e-1,2e-2,3e-3
+1	3162008	.	TAGGG	CAGGG,CAGGT	238	PASS	IA8=10,.;IA16=1000,.;IA32=100000,.;IAF=3e-3,.;CIGAR=1X4M,1X3M1X	GT:F8:F16:F32:FF	0/1:10:1000:100000:3e-3	2:.:.:.:.
+1	3162009	.	TAGGG	CAGGG,CAGGT	238	PASS	IA8=.;IA16=.;IA32=.;IAF=.;CIGAR=1X4M,1X3M1X	GT:F8:F16:F32:FF	0/1:10:1000:100000:3e-3	2:.:.:.:.
+1	3162010	.	TAGGG	CAGGG,CAGGT	238	PASS	I8=.;I16=.;I32=.;IF=.;CIGAR=1X4M,1X3M1X	GT:F8:F16:F32:FF	0/1:10:1000:100000:3e-3	2:.:.:.:.
diff --git a/tsv2vcf.c b/tsv2vcf.c
new file mode 100644
index 0000000..8826f18
--- /dev/null
+++ b/tsv2vcf.c
@@ -0,0 +1,121 @@
+/*  tsv2vcf.c -- convert from whitespace-separated fields to VCF
+
+    Copyright (C) 2014 Genome Research Ltd.
+
+    Author: Petr Danecek <pd3 at sanger.ac.uk>
+
+    Permission is hereby granted, free of charge, to any person obtaining a copy
+    of this software and associated documentation files (the "Software"), to deal
+    in the Software without restriction, including without limitation the rights
+    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+    copies of the Software, and to permit persons to whom the Software is
+    furnished to do so, subject to the following conditions:
+    
+    The above copyright notice and this permission notice shall be included in
+    all copies or substantial portions of the Software.
+    
+    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+    THE SOFTWARE.
+*/
+
+#include <ctype.h>
+#include "tsv2vcf.h"
+
+tsv_t *tsv_init(const char *str)
+{
+    tsv_t *tsv = (tsv_t *) calloc(1,sizeof(tsv_t));
+    kstring_t tmp = {0,0,0};
+    const char *ss = str, *se = ss;
+    tsv->ncols = 0;
+    while ( *ss )
+    {
+        if ( *se && *se!=',' ) { se++; continue; }
+        tsv->ncols++;
+        tsv->cols = (tsv_col_t*) realloc(tsv->cols,sizeof(tsv_col_t)*tsv->ncols);
+        tsv->cols[tsv->ncols-1].name   = NULL;
+        tsv->cols[tsv->ncols-1].setter = NULL;
+        tmp.l = 0;
+        kputsn(ss, se-ss, &tmp);
+        if ( strcasecmp("-",tmp.s) )
+            tsv->cols[tsv->ncols-1].name = strdup(tmp.s);
+        if ( !*se ) break;
+        ss = ++se;
+    }
+    free(tmp.s);
+    return tsv;
+}
+
+void tsv_destroy(tsv_t *tsv)
+{
+    int i;
+    for (i=0; i<tsv->ncols; i++) free(tsv->cols[i].name);
+    free(tsv->cols);
+    free(tsv);
+}
+
+int tsv_register(tsv_t *tsv, const char *id, tsv_setter_t setter, void *usr)
+{
+    int i;
+    for (i=0; i<tsv->ncols; i++)
+    {
+        if ( !tsv->cols[i].name || strcasecmp(tsv->cols[i].name,id) ) continue;
+        tsv->cols[i].setter = setter;
+        tsv->cols[i].usr    = usr;
+        return 0;
+    }
+    return -1;
+}
+
+int tsv_parse(tsv_t *tsv, bcf1_t *rec, char *str)
+{
+    int status = 0;
+    tsv->icol = 0;
+    tsv->ss = tsv->se = str;
+    while ( *tsv->ss && tsv->icol < tsv->ncols )
+    {
+        while ( *tsv->se && !isspace(*tsv->se) ) tsv->se++;
+        if ( tsv->cols[tsv->icol].setter )
+        {
+            int ret = tsv->cols[tsv->icol].setter(tsv,rec,tsv->cols[tsv->icol].usr);
+            if ( ret<0 ) return -1;
+            status++;
+        }
+        while ( *tsv->se && isspace(*tsv->se) ) tsv->se++;
+        tsv->ss = tsv->se;
+        tsv->icol++;
+    }
+    return status ? 0 : -1;
+}
+
+int tsv_setter_chrom(tsv_t *tsv, bcf1_t *rec, void *usr)
+{
+    char tmp = *tsv->se;
+    *tsv->se = 0;
+    rec->rid = bcf_hdr_name2id((bcf_hdr_t*)usr, tsv->ss);
+    *tsv->se = tmp;
+    return rec->rid==-1 ? -1 : 0;
+}
+
+int tsv_setter_pos(tsv_t *tsv, bcf1_t *rec, void *usr)
+{
+    char *endptr;
+    rec->pos = strtol(tsv->ss, &endptr, 10) - 1;
+    if ( tsv->ss==endptr ) return -1;
+    return 0;
+}
+
+int tsv_setter_id(tsv_t *tsv, bcf1_t *rec, void *usr)
+{
+    char tmp = *tsv->se;
+    *tsv->se = 0;
+    bcf_update_id((bcf_hdr_t*)usr, rec, tsv->ss);
+    *tsv->se = tmp;
+    return 0;
+}
+
+
diff --git a/tsv2vcf.h b/tsv2vcf.h
new file mode 100644
index 0000000..6fe5b45
--- /dev/null
+++ b/tsv2vcf.h
@@ -0,0 +1,85 @@
+/*  tsv2vcf.h -- convert from whitespace-separated fields to VCF
+
+    Copyright (C) 2014 Genome Research Ltd.
+
+    Author: Petr Danecek <pd3 at sanger.ac.uk>
+
+    Permission is hereby granted, free of charge, to any person obtaining a copy
+    of this software and associated documentation files (the "Software"), to deal
+    in the Software without restriction, including without limitation the rights
+    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+    copies of the Software, and to permit persons to whom the Software is
+    furnished to do so, subject to the following conditions:
+    
+    The above copyright notice and this permission notice shall be included in
+    all copies or substantial portions of the Software.
+    
+    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+    THE SOFTWARE.
+*/
+
+#ifndef __TSV2VCF_H__
+#define __TSV2VCF_H__
+
+#include <htslib/vcf.h>
+
+typedef struct _tsv_t tsv_t;
+typedef int (*tsv_setter_t)(tsv_t *, bcf1_t *, void *);
+
+typedef struct
+{
+    char *name;
+    tsv_setter_t setter;
+    void *usr;
+}
+tsv_col_t;
+
+struct _tsv_t
+{
+    int ncols, icol;
+    tsv_col_t *cols;
+    char *se, *ss;
+};
+
+tsv_t *tsv_init(const char *str);
+void tsv_destroy(tsv_t *tsv);
+int tsv_register(tsv_t *tsv, const char *id, tsv_setter_t setter, void *usr);
+
+/**
+ *  tsv_parse() - parse tsv line and fill VCF record
+ *  Returns 0 on success or -1 on parse error
+ */
+int tsv_parse(tsv_t *tsv, bcf1_t *rec, char *str);
+
+/**
+ *  tstv_next() - position ss,se to next field; first pass with ss=se=str
+ *  Returns 0 on success, or -1 if no more fields
+ */
+static inline int tsv_next(tsv_t *tsv)
+{
+    if ( !*tsv->se ) return -1;
+    if ( tsv->ss==tsv->se )
+    {
+        while ( *tsv->se && !isspace(*tsv->se) ) tsv->se++;
+        return 0;
+    }
+    while ( *tsv->se && isspace(*tsv->se) ) tsv->se++;
+    tsv->ss = tsv->se;
+    while ( *tsv->se && !isspace(*tsv->se) ) tsv->se++;
+    return 0;
+}
+
+/**
+ *  The setters return 0 on success or negative value if the line is to be skipped.
+ */
+int tsv_setter_chrom(tsv_t *tsv, bcf1_t *rec, void *usr);
+int tsv_setter_pos(tsv_t *tsv, bcf1_t *rec, void *usr);
+int tsv_setter_id(tsv_t *tsv, bcf1_t *rec, void *usr);
+
+#endif
+
diff --git a/vcfannotate.c b/vcfannotate.c
new file mode 100644
index 0000000..00630a5
--- /dev/null
+++ b/vcfannotate.c
@@ -0,0 +1,1704 @@
+/*  vcfannotate.c -- Annotate and edit VCF/BCF files.
+
+    Copyright (C) 2013-2014 Genome Research Ltd.
+
+    Author: Petr Danecek <pd3 at sanger.ac.uk>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.  */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <getopt.h>
+#include <ctype.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <dirent.h>
+#include <math.h>
+#include <htslib/vcf.h>
+#include <htslib/synced_bcf_reader.h>
+#include <htslib/kseq.h>
+#include <htslib/khash_str2int.h>
+#include <dlfcn.h>
+#include "bcftools.h"
+#include "vcmp.h"
+#include "filter.h"
+#include "convert.h"
+
+struct _args_t;
+
+typedef struct _rm_tag_t
+{
+    char *key;
+    int hdr_id;
+    void (*handler)(struct _args_t *, bcf1_t *, struct _rm_tag_t *);
+}
+rm_tag_t;
+
+typedef struct
+{
+    char **cols;
+    int ncols, mcols;
+    char **als;
+    int nals, mals;
+    kstring_t line;
+    int rid, start, end;
+}
+annot_line_t;
+
+#define REPLACE_MISSING  0  // replace only missing values
+#define REPLACE_ALL      1  // replace both missing and existing values
+#define REPLACE_EXISTING 2  // replace only if tgt is not missing
+typedef struct _annot_col_t
+{
+    int icol, replace, number;  // number: one of BCF_VL_* types
+    char *hdr_key;
+    int (*setter)(struct _args_t *, bcf1_t *, struct _annot_col_t *, void*);
+}
+annot_col_t;
+
+// Logic of the filters: include or exclude sites which match the filters?
+#define FLT_INCLUDE 1
+#define FLT_EXCLUDE 2
+
+typedef struct _args_t
+{
+    bcf_srs_t *files;
+    bcf_hdr_t *hdr, *hdr_out;
+    htsFile *out_fh;
+    int output_type;
+    bcf_sr_regions_t *tgts;
+
+    filter_t *filter;
+    char *filter_str;
+    int filter_logic;   // include or exclude sites which match the filters? One of FLT_INCLUDE/FLT_EXCLUDE
+
+    rm_tag_t *rm;           // tags scheduled for removal
+    int nrm;
+    int flt_keep_pass;      // when all filters removed, reset to PASS
+
+    vcmp_t *vcmp;           // for matching annotation and VCF lines by allele
+    annot_line_t *alines;   // buffered annotation lines
+    int nalines, malines;
+    int ref_idx, alt_idx, chr_idx, from_idx, to_idx;   // -1 if not present
+    annot_col_t *cols;      // column indexes and setters
+    int ncols;
+
+    char *set_ids_fmt;
+    convert_t *set_ids;
+    int set_ids_replace;
+
+    int *sample_map, nsample_map, sample_is_file;   // map[idst] -> isrc
+    int mtmpi, mtmpf, mtmps;
+    int mtmpi2, mtmpf2, mtmps2;
+    int mtmpi3, mtmpf3, mtmps3;
+    int32_t *tmpi, *tmpi2, *tmpi3;
+    float *tmpf, *tmpf2, *tmpf3;
+    char *tmps, *tmps2, **tmpp, **tmpp2;
+    kstring_t tmpks;
+
+    char **argv, *output_fname, *targets_fname, *regions_list, *header_fname;
+    char *remove_annots, *columns, *rename_chrs, *sample_names;
+    int argc, drop_header, tgts_is_vcf;
+}
+args_t;
+
+char *msprintf(const char *fmt, ...);
+
+void remove_id(args_t *args, bcf1_t *line, rm_tag_t *tag)
+{
+    bcf_update_id(args->hdr,line,NULL);
+}
+void remove_filter(args_t *args, bcf1_t *line, rm_tag_t *tag)
+{
+    if ( !tag->key ) bcf_update_filter(args->hdr, line, NULL, args->flt_keep_pass);
+    else bcf_remove_filter(args->hdr, line, tag->hdr_id, args->flt_keep_pass);
+}
+void remove_qual(args_t *args, bcf1_t *line, rm_tag_t *tag)
+{
+    bcf_float_set_missing(line->qual);
+}
+void remove_info(args_t *args, bcf1_t *line, rm_tag_t *tag)
+{
+    // remove all INFO fields
+    if ( !(line->unpacked & BCF_UN_INFO) ) bcf_unpack(line, BCF_UN_INFO);
+
+    int i;
+    for (i=0; i<line->n_info; i++)
+    {
+        bcf_info_t *inf = &line->d.info[i];
+        if ( inf->vptr_free )
+        {
+            free(inf->vptr - inf->vptr_off);
+            inf->vptr_free = 0;
+        }
+        line->d.shared_dirty |= BCF1_DIRTY_INF;
+        inf->vptr = NULL;
+    }
+}
+void remove_info_tag(args_t *args, bcf1_t *line, rm_tag_t *tag)
+{
+    bcf_update_info(args->hdr, line, tag->key, NULL, 0, BCF_HT_INT);  // the type does not matter with n=0
+}
+void remove_format_tag(args_t *args, bcf1_t *line, rm_tag_t *tag)
+{
+    bcf_update_format(args->hdr, line, tag->key, NULL, 0, BCF_HT_INT);  // the type does not matter with n=0
+}
+void remove_format(args_t *args, bcf1_t *line, rm_tag_t *tag)
+{
+    // remove all FORMAT fields except GT
+    if ( !(line->unpacked & BCF_UN_FMT) ) bcf_unpack(line, BCF_UN_FMT);
+
+    int i;
+    for (i=0; i<line->n_fmt; i++)
+    {
+        bcf_fmt_t *fmt = &line->d.fmt[i];
+        const char *key = bcf_hdr_int2id(args->hdr,BCF_DT_ID,fmt->id);
+        if ( key[0]=='G' && key[1]=='T' && !key[2] ) continue;
+
+        if ( fmt->p_free )
+        {
+            free(fmt->p - fmt->p_off);
+            fmt->p_free = 0;
+        }
+        line->d.indiv_dirty = 1;
+        fmt->p = NULL;
+    }
+}
+
+static void remove_hdr_lines(bcf_hdr_t *hdr, int type)
+{
+    int i = 0, nrm = 0;
+    while ( i<hdr->nhrec )
+    {
+        if ( hdr->hrec[i]->type!=type ) { i++; continue; }
+        bcf_hrec_t *hrec = hdr->hrec[i];
+        if ( type==BCF_HL_FMT )
+        {
+            // everything except FORMAT/GT
+            int id = bcf_hrec_find_key(hrec, "ID");
+            if ( id>=0 && !strcmp(hrec->vals[id],"GT") ) { i++; continue; }
+        }
+        nrm++;
+        hdr->nhrec--;
+        if ( i < hdr->nhrec )
+            memmove(&hdr->hrec[i],&hdr->hrec[i+1],(hdr->nhrec-i)*sizeof(bcf_hrec_t*));
+        bcf_hrec_destroy(hrec);
+    }
+    if ( nrm ) bcf_hdr_sync(hdr);
+}
+
+static void init_remove_annots(args_t *args)
+{
+    int keep_info = 0, keep_fmt = 0, keep_flt = 0;
+    void *keep = khash_str2int_init();
+    kstring_t str = {0,0,0};
+    char *ss = args->remove_annots;
+    while ( *ss )
+    {
+        args->nrm++;
+        args->rm = (rm_tag_t*) realloc(args->rm,sizeof(rm_tag_t)*args->nrm);
+        rm_tag_t *tag = &args->rm[args->nrm-1];
+        tag->key = NULL;
+
+        int type = BCF_HL_GEN;
+        if ( !strncasecmp("INFO/",ss,5) ) { type = BCF_HL_INFO; ss += 5; }
+        else if ( !strncasecmp("INF/",ss,4) ) { type = BCF_HL_INFO; ss += 4; }
+        else if ( !strncasecmp("FORMAT/",ss,7) ) { type = BCF_HL_FMT; ss += 7; }
+        else if ( !strncasecmp("FMT/",ss,4) ) { type = BCF_HL_FMT; ss += 4; }
+        else if ( !strncasecmp("FILTER/",ss,7) ) { type = BCF_HL_FLT; ss += 7; }
+        else if ( !strncasecmp("^INFO/",ss,6) ) { type = BCF_HL_INFO; ss += 6; keep_info = 1; }
+        else if ( !strncasecmp("^INF/",ss,5) ) { type = BCF_HL_INFO; ss += 5; keep_info = 1; }
+        else if ( !strncasecmp("^FORMAT/",ss,8) ) { type = BCF_HL_FMT; ss += 8; keep_fmt = 1; }
+        else if ( !strncasecmp("^FMT/",ss,5) ) { type = BCF_HL_FMT; ss += 5; keep_fmt = 1; }
+        else if ( !strncasecmp("^FILTER/",ss,8) ) { type = BCF_HL_FLT; ss += 8; keep_flt = 1; }
+
+        char *se = ss;
+        while ( *se && *se!=',' ) se++;
+        str.l = 0;
+        kputsn(ss, se-ss, &str);
+
+        if ( type==BCF_HL_FLT )
+        {
+            if ( !keep_flt )
+            {
+                args->flt_keep_pass = 1;
+                tag->handler = remove_filter;
+                tag->key = strdup(str.s);
+                tag->hdr_id = bcf_hdr_id2int(args->hdr, BCF_DT_ID, tag->key);
+                if ( !bcf_hdr_idinfo_exists(args->hdr,BCF_HL_FLT,tag->hdr_id) ) error("Cannot remove %s, not defined in the header.\n", str.s);
+                bcf_hdr_remove(args->hdr_out,BCF_HL_FLT,tag->key);
+            }
+            else
+            {
+                int value, ret = khash_str2int_get(keep, str.s, &value);
+                if ( ret==-1 ) khash_str2int_set(keep, strdup(str.s),1<<BCF_HL_FLT);
+                else khash_str2int_set(keep, str.s, value | 1<<BCF_HL_FLT);
+                args->nrm--;
+            }
+        }
+        else if ( type!=BCF_HL_GEN )
+        {
+            int id = bcf_hdr_id2int(args->hdr,BCF_DT_ID,str.s);
+            if ( !bcf_hdr_idinfo_exists(args->hdr,type,id) )
+            {
+                fprintf(stderr,"Warning: The tag \"%s\" not defined in the header\n", str.s);
+                args->nrm--;
+            }
+            else if ( (type==BCF_HL_FMT && keep_fmt) || (type==BCF_HL_INFO && keep_info) )
+            {
+                int value, ret = khash_str2int_get(keep, str.s, &value);
+                if ( ret==-1 ) khash_str2int_set(keep, strdup(str.s),1<<type);
+                else khash_str2int_set(keep, str.s, value | 1<<type);
+                args->nrm--;
+            }
+            else
+            {
+                tag->key = strdup(str.s);
+                if ( type==BCF_HL_INFO ) tag->handler = remove_info_tag;
+                else if ( type==BCF_HL_FMT ) tag->handler = remove_format_tag;
+                bcf_hdr_remove(args->hdr_out,type,tag->key);
+            }
+        }
+        else if ( !strcasecmp("ID",str.s) ) tag->handler = remove_id;
+        else if ( !strcasecmp("FILTER",str.s) )
+        {
+            tag->handler = remove_filter;
+            remove_hdr_lines(args->hdr_out,BCF_HL_FLT);
+        }
+        else if ( !strcasecmp("QUAL",str.s) ) tag->handler = remove_qual;
+        else if ( !strcasecmp("INFO",str.s) ) 
+        {
+            tag->handler = remove_info;
+            remove_hdr_lines(args->hdr_out,BCF_HL_INFO);
+        }
+        else if ( !strcasecmp("FMT",str.s) || !strcasecmp("FORMAT",str.s) )
+        {
+            tag->handler = remove_format;
+            remove_hdr_lines(args->hdr_out,BCF_HL_FMT);
+        }
+        else if ( str.l )
+        {
+            if ( str.s[0]=='#' && str.s[1]=='#' )
+                bcf_hdr_remove(args->hdr_out,BCF_HL_GEN,str.s+2);
+            else
+                bcf_hdr_remove(args->hdr_out,BCF_HL_STR,str.s);
+            args->nrm--;
+        }
+
+        ss = *se ? se+1 : se;
+    }
+    free(str.s);
+    if ( keep_flt || keep_info || keep_flt )
+    {
+        int j;
+        for (j=0; j<args->hdr->nhrec; j++)
+        {
+            bcf_hrec_t *hrec = args->hdr->hrec[j];
+            if ( hrec->type!=BCF_HL_FLT && hrec->type!=BCF_HL_INFO && hrec->type!=BCF_HL_FMT ) continue;
+            if ( !keep_flt && hrec->type==BCF_HL_FLT ) continue;
+            if ( !keep_info && hrec->type==BCF_HL_INFO ) continue;
+            if ( !keep_fmt && hrec->type==BCF_HL_FMT ) continue;
+            int k = bcf_hrec_find_key(hrec,"ID");
+            assert( k>=0 ); // this should always be true for valid VCFs
+            int value, ret = khash_str2int_get(keep,hrec->vals[k],&value);
+            if ( ret==0 && value>>hrec->type ) // keep
+            {
+                if ( hrec->type==BCF_HL_FLT && !strcmp("PASS",hrec->vals[k]) ) args->flt_keep_pass = 1;
+                continue;
+            }
+            args->nrm++;
+            args->rm = (rm_tag_t*) realloc(args->rm,sizeof(rm_tag_t)*args->nrm);
+            rm_tag_t *tag = &args->rm[args->nrm-1];
+            if ( hrec->type==BCF_HL_INFO ) tag->handler = remove_info_tag;
+            else if ( hrec->type==BCF_HL_FMT ) tag->handler = remove_format_tag;
+            else 
+            {
+                tag->handler = remove_filter;
+                tag->hdr_id = bcf_hdr_id2int(args->hdr, BCF_DT_ID, hrec->vals[k]);
+            }
+            tag->key = strdup(hrec->vals[k]);
+            bcf_hdr_remove(args->hdr_out,hrec->type,tag->key);
+        }
+    }
+    khash_str2int_destroy_free(keep);
+    if ( !args->nrm ) error("No matching tag in -x %s\n", args->remove_annots);
+    bcf_hdr_sync(args->hdr_out);
+}
+static void init_header_lines(args_t *args)
+{
+    htsFile *file = hts_open(args->header_fname, "rb");
+    if ( !file ) error("Error reading %s\n", args->header_fname);
+    kstring_t str = {0,0,0};
+    while ( hts_getline(file, KS_SEP_LINE, &str) > 0 )
+    {
+        if ( bcf_hdr_append(args->hdr_out,str.s) ) error("Could not parse %s: %s\n", args->header_fname, str.s);
+        bcf_hdr_append(args->hdr,str.s);    // the input file may not have the header line if run with -h (and nothing else)
+    }
+    hts_close(file);
+    free(str.s);
+    bcf_hdr_sync(args->hdr_out);
+    bcf_hdr_sync(args->hdr);
+}
+static int setter_filter(args_t *args, bcf1_t *line, annot_col_t *col, void *data)
+{
+    annot_line_t *tab = (annot_line_t*) data;
+    hts_expand(int,1,args->mtmpi,args->tmpi);
+    args->tmpi[0] = bcf_hdr_id2int(args->hdr_out, BCF_DT_ID, tab->cols[col->icol]);
+    if ( args->tmpi[0]<0 ) error("The FILTER is not defined in the header: %s\n", tab->cols[col->icol]);
+    if ( col->replace!=REPLACE_MISSING )
+        bcf_update_filter(args->hdr_out,line,args->tmpi,1);
+    else
+        bcf_add_filter(args->hdr_out,line,args->tmpi[0]);
+    return 0;
+}
+static int vcf_setter_filter(args_t *args, bcf1_t *line, annot_col_t *col, void *data)
+{
+    bcf1_t *rec = (bcf1_t*) data;
+    if ( !(rec->unpacked & BCF_UN_FLT) ) bcf_unpack(rec, BCF_UN_FLT);
+    hts_expand(int,rec->d.n_flt,args->mtmpi,args->tmpi);
+    int i;
+    if ( col->replace!=REPLACE_MISSING )
+    {
+        for (i=0; i<rec->d.n_flt; i++)
+        {
+            const char *flt = bcf_hdr_int2id(args->files->readers[1].header, BCF_DT_ID, rec->d.flt[i]);
+            args->tmpi[i] = bcf_hdr_id2int(args->hdr_out, BCF_DT_ID, flt);
+        }
+        bcf_update_filter(args->hdr_out,line,args->tmpi,rec->d.n_flt);
+        return 0;
+    }
+    else
+    {
+        for (i=0; i<rec->d.n_flt; i++)
+        {
+            const char *flt = bcf_hdr_int2id(args->files->readers[1].header, BCF_DT_ID, rec->d.flt[i]);
+            bcf_add_filter(args->hdr_out,line,bcf_hdr_id2int(args->hdr_out, BCF_DT_ID, flt));
+        }
+        return 0;
+    }
+}
+static int setter_id(args_t *args, bcf1_t *line, annot_col_t *col, void *data)
+{
+    // possible cases:
+    //      IN  ANNOT   OUT     ACHIEVED_BY
+    //      x   y       x        -c +ID
+    //      x   y       y        -c ID
+    //      x   y       x,y      /not supported/
+    //      x   .       x        -c +ID, ID
+    //      x   .       .        -x ID
+    //      .   y       y        -c +ID, -c ID
+    //
+    annot_line_t *tab = (annot_line_t*) data;
+    if ( tab->cols[col->icol] && tab->cols[col->icol][0]=='.' && !tab->cols[col->icol][1] ) return 0; // don't replace with "."
+    if ( col->replace!=REPLACE_MISSING ) return bcf_update_id(args->hdr_out,line,tab->cols[col->icol]);
+
+    // running with +ID, only update missing ids
+    if ( !line->d.id || (line->d.id[0]=='.' && !line->d.id[1]) )
+        return bcf_update_id(args->hdr_out,line,tab->cols[col->icol]);
+    return 0;
+}
+static int vcf_setter_id(args_t *args, bcf1_t *line, annot_col_t *col, void *data)
+{
+    bcf1_t *rec = (bcf1_t*) data;
+    if ( rec->d.id && rec->d.id[0]=='.' && !rec->d.id[1] ) return 0;    // don't replace with "."
+    if ( col->replace!=REPLACE_MISSING ) return bcf_update_id(args->hdr_out,line,rec->d.id);
+
+    // running with +ID, only update missing ids
+    if ( !line->d.id || (line->d.id[0]=='.' && !line->d.id[1]) )
+        return bcf_update_id(args->hdr_out,line,rec->d.id);
+    return 0;
+}
+static int setter_qual(args_t *args, bcf1_t *line, annot_col_t *col, void *data)
+{
+    annot_line_t *tab = (annot_line_t*) data;
+    char *str = tab->cols[col->icol];
+    if ( str[0]=='.' && str[1]==0 ) return 0;   // empty
+
+    if ( col->replace==REPLACE_MISSING && !bcf_float_is_missing(line->qual) ) return 0;
+
+    line->qual = strtod(str, &str);
+    if ( str == tab->cols[col->icol] )
+        error("Could not parse %s at %s:%d .. [%s]\n", col->hdr_key,bcf_seqname(args->hdr,line),line->pos+1,tab->cols[col->icol]);
+    return 0;
+}
+static int vcf_setter_qual(args_t *args, bcf1_t *line, annot_col_t *col, void *data)
+{
+    bcf1_t *rec = (bcf1_t*) data;
+    if ( bcf_float_is_missing(rec->qual) ) return 0;
+    if ( col->replace==REPLACE_MISSING && !bcf_float_is_missing(line->qual) ) return 0;
+    line->qual = rec->qual;
+    return 0;
+}
+static int setter_info_flag(args_t *args, bcf1_t *line, annot_col_t *col, void *data)
+{
+    annot_line_t *tab = (annot_line_t*) data;
+    char *str = tab->cols[col->icol];
+    if ( str[0]=='.' && str[1]==0 ) return 0;
+
+    if ( str[0]=='1' && str[1]==0 ) return bcf_update_info_flag(args->hdr_out,line,col->hdr_key,NULL,1);
+    if ( str[0]=='0' && str[1]==0 ) return bcf_update_info_flag(args->hdr_out,line,col->hdr_key,NULL,0);
+    error("Could not parse %s at %s:%d .. [%s]\n", bcf_seqname(args->hdr,line),line->pos+1,tab->cols[col->icol]);
+    return -1;
+}
+static int vcf_setter_info_flag(args_t *args, bcf1_t *line, annot_col_t *col, void *data)
+{
+    bcf1_t *rec = (bcf1_t*) data;
+    int flag = bcf_get_info_flag(args->files->readers[1].header,rec,col->hdr_key,NULL,NULL);
+    bcf_update_info_flag(args->hdr_out,line,col->hdr_key,NULL,flag);
+    return 0;
+}
+static int setter_ARinfo_int32(args_t *args, bcf1_t *line, annot_col_t *col, int nals, char **als, int ntmpi)
+{
+    if ( col->number==BCF_VL_A && ntmpi!=nals-1 && (ntmpi!=1 || args->tmpi[0]!=bcf_int32_missing || args->tmpi[1]!=bcf_int32_vector_end) )
+        error("Incorrect number of values (%d) for the %s tag at %s:%d\n", ntmpi,col->hdr_key,bcf_seqname(args->hdr,line),line->pos+1);
+    else if ( col->number==BCF_VL_R && ntmpi!=nals && (ntmpi!=1 || args->tmpi[0]!=bcf_int32_missing || args->tmpi[1]!=bcf_int32_vector_end) )
+        error("Incorrect number of values (%d) for the %s tag at %s:%d\n", ntmpi,col->hdr_key,bcf_seqname(args->hdr,line),line->pos+1);
+
+    int ndst = col->number==BCF_VL_A ? line->n_allele - 1 : line->n_allele;
+    int *map = vcmp_map_ARvalues(args->vcmp,ndst,nals,als,line->n_allele,line->d.allele);
+    if ( !map ) error("REF alleles not compatible at %s:%d\n");
+
+    // fill in any missing values in the target VCF (or all, if not present)
+    int ntmpi2 = bcf_get_info_float(args->hdr, line, col->hdr_key, &args->tmpi2, &args->mtmpi2);
+    if ( ntmpi2 < ndst ) hts_expand(int32_t,ndst,args->mtmpi2,args->tmpi2);
+
+    int i;
+    for (i=0; i<ndst; i++)
+    {
+        if ( map[i]<0 )
+        {
+            if ( ntmpi2 < ndst ) args->tmpi2[i] = bcf_int32_missing;
+            continue;
+        }
+        if ( ntmpi2==ndst && col->replace==REPLACE_MISSING
+                && args->tmpi2[i]!=bcf_int32_missing
+                && args->tmpi2[i]!=bcf_int32_vector_end ) continue;
+
+        args->tmpi2[i] = args->tmpi[ map[i] ];
+    }
+    bcf_update_info_int32(args->hdr_out,line,col->hdr_key,args->tmpi2,ndst);
+    return 0;
+}
+static int setter_info_int(args_t *args, bcf1_t *line, annot_col_t *col, void *data)
+{
+    annot_line_t *tab = (annot_line_t*) data;
+    char *str = tab->cols[col->icol], *end = str;
+    if ( str[0]=='.' && str[1]==0 ) return 0;
+
+    int ntmpi = 0;
+    while ( *end )
+    {
+        int val = strtol(str, &end, 10); 
+        if ( end==str )
+            error("Could not parse %s at %s:%d .. [%s]\n", bcf_seqname(args->hdr,line),line->pos+1,tab->cols[col->icol]);
+        ntmpi++;
+        hts_expand(int32_t,ntmpi,args->mtmpi,args->tmpi);
+        args->tmpi[ntmpi-1] = val;
+        str = end+1;
+    }
+
+    if ( col->number==BCF_VL_A || col->number==BCF_VL_R ) 
+        return setter_ARinfo_int32(args,line,col,tab->nals,tab->als,ntmpi);
+
+    if ( col->replace==REPLACE_MISSING )
+    {
+        int ret = bcf_get_info_int32(args->hdr, line, col->hdr_key, &args->tmpi2, &args->mtmpi2);
+        if ( ret>0 && args->tmpi2[0]!=bcf_int32_missing ) return 0;
+    }
+
+    bcf_update_info_int32(args->hdr_out,line,col->hdr_key,args->tmpi,ntmpi);
+    return 0;
+}
+static int vcf_setter_info_int(args_t *args, bcf1_t *line, annot_col_t *col, void *data)
+{
+    bcf1_t *rec = (bcf1_t*) data;
+    int ntmpi = bcf_get_info_int32(args->files->readers[1].header,rec,col->hdr_key,&args->tmpi,&args->mtmpi);
+    if ( ntmpi < 0 ) return 0;    // nothing to add
+
+    if ( col->number==BCF_VL_A || col->number==BCF_VL_R ) 
+        return setter_ARinfo_int32(args,line,col,rec->n_allele,rec->d.allele,ntmpi);
+
+    if ( col->replace==REPLACE_MISSING )
+    {
+        int ret = bcf_get_info_int32(args->hdr, line, col->hdr_key, &args->tmpi2, &args->mtmpi2);
+        if ( ret>0 && args->tmpi2[0]!=bcf_int32_missing ) return 0;
+    }
+
+    bcf_update_info_int32(args->hdr_out,line,col->hdr_key,args->tmpi,ntmpi);
+    return 0;
+}
+static int setter_ARinfo_real(args_t *args, bcf1_t *line, annot_col_t *col, int nals, char **als, int ntmpf)
+{
+    if ( col->number==BCF_VL_A && ntmpf!=nals-1 && (ntmpf!=1 || !bcf_float_is_missing(args->tmpf[0]) || !bcf_float_is_vector_end(args->tmpf[0])) )
+        error("Incorrect number of values (%d) for the %s tag at %s:%d\n", ntmpf,col->hdr_key,bcf_seqname(args->hdr,line),line->pos+1);
+    else if ( col->number==BCF_VL_R && ntmpf!=nals && (ntmpf!=1 || !bcf_float_is_missing(args->tmpf[0]) || !bcf_float_is_vector_end(args->tmpf[0])) )
+        error("Incorrect number of values (%d) for the %s tag at %s:%d\n", ntmpf,col->hdr_key,bcf_seqname(args->hdr,line),line->pos+1);
+
+    int ndst = col->number==BCF_VL_A ? line->n_allele - 1 : line->n_allele;
+    int *map = vcmp_map_ARvalues(args->vcmp,ndst,nals,als,line->n_allele,line->d.allele);
+    if ( !map ) error("REF alleles not compatible at %s:%d\n");
+
+    // fill in any missing values in the target VCF (or all, if not present)
+    int ntmpf2 = bcf_get_info_float(args->hdr, line, col->hdr_key, &args->tmpf2, &args->mtmpf2);
+    if ( ntmpf2 < ndst ) hts_expand(float,ndst,args->mtmpf2,args->tmpf2);
+
+    int i;
+    for (i=0; i<ndst; i++)
+    {
+        if ( map[i]<0 )
+        {
+            if ( ntmpf2 < ndst ) bcf_float_set_missing(args->tmpf2[i]);
+            continue;
+        }
+        if ( ntmpf2==ndst && col->replace==REPLACE_MISSING
+                && !bcf_float_is_missing(args->tmpf2[i])
+                && !bcf_float_is_vector_end(args->tmpf2[i]) ) continue;
+
+        args->tmpf2[i] = args->tmpf[ map[i] ];
+    }
+    bcf_update_info_float(args->hdr_out,line,col->hdr_key,args->tmpf2,ndst);
+    return 0;
+}
+static int setter_info_real(args_t *args, bcf1_t *line, annot_col_t *col, void *data)
+{
+    annot_line_t *tab = (annot_line_t*) data;
+    char *str = tab->cols[col->icol], *end = str;
+    if ( str[0]=='.' && str[1]==0 ) return 0;
+
+    int ntmpf = 0;
+    while ( *end )
+    {
+        double val = strtod(str, &end);
+        if ( end==str )
+            error("Could not parse %s at %s:%d .. [%s]\n", bcf_seqname(args->hdr,line),line->pos+1,tab->cols[col->icol]);
+        ntmpf++;
+        hts_expand(float,ntmpf,args->mtmpf,args->tmpf);
+        args->tmpf[ntmpf-1] = val;
+        str = end+1;
+    }
+
+    if ( col->number==BCF_VL_A || col->number==BCF_VL_R ) 
+        return setter_ARinfo_real(args,line,col,tab->nals,tab->als,ntmpf);
+
+    if ( col->replace==REPLACE_MISSING )
+    {
+        int ret = bcf_get_info_float(args->hdr, line, col->hdr_key, &args->tmpf2, &args->mtmpf2);
+        if ( ret>0 && !bcf_float_is_missing(args->tmpf2[0]) ) return 0;
+    }
+
+    bcf_update_info_float(args->hdr_out,line,col->hdr_key,args->tmpf,ntmpf);
+    return 0;
+}
+static int vcf_setter_info_real(args_t *args, bcf1_t *line, annot_col_t *col, void *data)
+{
+    bcf1_t *rec = (bcf1_t*) data;
+    int ntmpf = bcf_get_info_float(args->files->readers[1].header,rec,col->hdr_key,&args->tmpf,&args->mtmpf);
+    if ( ntmpf < 0 ) return 0;    // nothing to add
+
+    if ( col->number==BCF_VL_A || col->number==BCF_VL_R ) 
+        return setter_ARinfo_real(args,line,col,rec->n_allele,rec->d.allele,ntmpf);
+
+    if ( col->replace==REPLACE_MISSING )
+    {
+        int ret = bcf_get_info_float(args->hdr, line, col->hdr_key, &args->tmpf2, &args->mtmpf2);
+        if ( ret>0 && !bcf_float_is_missing(args->tmpf2[0]) ) return 0;
+    }
+
+    bcf_update_info_float(args->hdr_out,line,col->hdr_key,args->tmpf,ntmpf);
+    return 0;
+}
+int copy_string_field(char *src, int isrc, int src_len, kstring_t *dst, int idst); // see vcfmerge.c
+static int setter_ARinfo_string(args_t *args, bcf1_t *line, annot_col_t *col, int nals, char **als)
+{
+    int nsrc = 1, lsrc = 0;
+    while ( args->tmps[lsrc] )
+    {
+        if ( args->tmps[lsrc]==',' ) nsrc++;
+        lsrc++;
+    }
+    if ( col->number==BCF_VL_A && nsrc!=nals-1 && (nsrc!=1 || args->tmps[0]!='.' || args->tmps[1]!=0 ) )
+        error("Incorrect number of values (%d) for the %s tag at %s:%d\n", nsrc,col->hdr_key,bcf_seqname(args->hdr,line),line->pos+1);
+    else if ( col->number==BCF_VL_R && nsrc!=nals && (nsrc!=1 || args->tmps[0]!='.' || args->tmps[1]!=0 ) )
+        error("Incorrect number of values (%d) for the %s tag at %s:%d\n", nsrc,col->hdr_key,bcf_seqname(args->hdr,line),line->pos+1);
+
+    int ndst = col->number==BCF_VL_A ? line->n_allele - 1 : line->n_allele;
+    int *map = vcmp_map_ARvalues(args->vcmp,ndst,nals,als,line->n_allele,line->d.allele);
+    if ( !map ) error("REF alleles not compatible at %s:%d\n");
+
+    // fill in any missing values in the target VCF (or all, if not present)
+    int i, empty = 0, nstr, mstr = args->tmpks.m;
+    nstr = bcf_get_info_string(args->hdr, line, col->hdr_key, &args->tmpks.s, &mstr); 
+    args->tmpks.m = mstr;
+    if ( nstr<0 || (nstr==1 && args->tmpks.s[0]=='.' && args->tmpks.s[1]==0) )
+    {
+        empty = 0;
+        args->tmpks.l = 0;
+        kputc('.',&args->tmpks);
+        for (i=1; i<ndst; i++) kputs(",.",&args->tmpks);
+    }
+    else args->tmpks.l = nstr;
+    for (i=0; i<ndst; i++)
+    {
+        if ( map[i]<0 )
+        {
+            if ( empty ) copy_string_field(".",0,1,&args->tmpks,i);
+            continue;
+        }
+        if ( col->replace==REPLACE_MISSING )
+        {
+            // Do not replace filled values. The field must be looked up again because
+            // of realloc in copy_string_field
+            int n = 0;
+            char *str = args->tmpks.s;
+            while ( *str && n<i )
+            {
+                if ( *str==',' ) n++;
+                str++;
+            }
+            if ( str[0]!='.' || (str[1]!=',' && str[1]!=0) ) continue;  // value already set
+        }
+        int ret = copy_string_field(args->tmps,map[i],lsrc,&args->tmpks,i);
+        assert( ret==0 );
+    }
+    bcf_update_info_string(args->hdr_out,line,col->hdr_key,args->tmpks.s);
+    return 0;
+}
+static int setter_info_str(args_t *args, bcf1_t *line, annot_col_t *col, void *data)
+{
+    annot_line_t *tab = (annot_line_t*) data;
+    int len = strlen(tab->cols[col->icol]);
+    if ( !len ) return 0;
+    hts_expand(char,len+1,args->mtmps,args->tmps);
+    memcpy(args->tmps,tab->cols[col->icol],len+1);
+    if ( args->tmps[0]=='.' && args->tmps[1]==0 ) return 0;
+
+    if ( col->number==BCF_VL_A || col->number==BCF_VL_R ) 
+        return setter_ARinfo_string(args,line,col,tab->nals,tab->als);
+
+    if ( col->replace==REPLACE_MISSING )
+    {
+        int ret = bcf_get_info_string(args->hdr, line, col->hdr_key, &args->tmps2, &args->mtmps2);
+        if ( ret>0 && (args->tmps2[0]!='.' || args->tmps2[1]!=0) ) return 0;
+    }
+
+    bcf_update_info_string(args->hdr_out,line,col->hdr_key,args->tmps);
+    return 0;
+}
+static int vcf_setter_info_str(args_t *args, bcf1_t *line, annot_col_t *col, void *data)
+{
+    bcf1_t *rec = (bcf1_t*) data;
+    int ntmps = bcf_get_info_string(args->files->readers[1].header,rec,col->hdr_key,&args->tmps,&args->mtmps);
+    if ( ntmps < 0 ) return 0;    // nothing to add
+
+    if ( col->number==BCF_VL_A || col->number==BCF_VL_R ) 
+        return setter_ARinfo_string(args,line,col,rec->n_allele,rec->d.allele);
+
+    if ( col->replace==REPLACE_MISSING )
+    {
+        int ret = bcf_get_info_string(args->hdr, line, col->hdr_key, &args->tmps2, &args->mtmps2);
+        if ( ret>0 && (args->tmps2[0]!='.' || args->tmps2[1]!=0) ) return 0;
+    }
+
+    bcf_update_info_string(args->hdr_out,line,col->hdr_key,args->tmps);
+    return 0;
+}
+static int vcf_setter_format_gt(args_t *args, bcf1_t *line, annot_col_t *col, void *data)
+{
+    bcf1_t *rec = (bcf1_t*) data;
+    int nsrc = bcf_get_genotypes(args->files->readers[1].header,rec,&args->tmpi,&args->mtmpi);
+    if ( nsrc==-3 ) return 0;    // the tag is not present
+    if ( nsrc<=0 ) return 1;     // error
+
+    if ( !args->sample_map )
+        return bcf_update_genotypes(args->hdr_out,line,args->tmpi,nsrc);
+
+    int i, j, ndst = bcf_get_genotypes(args->hdr,line,&args->tmpi2,&args->mtmpi2);
+    if ( ndst > 0 ) ndst /= bcf_hdr_nsamples(args->hdr_out);
+    nsrc /= bcf_hdr_nsamples(args->files->readers[1].header);
+    if ( ndst<=0 )  // field not present in dst file
+    {
+        if ( col->replace==REPLACE_EXISTING ) return 0;
+        hts_expand(int32_t, nsrc*bcf_hdr_nsamples(args->hdr_out), args->mtmpi2, args->tmpi2);
+        for (i=0; i<bcf_hdr_nsamples(args->hdr_out); i++)
+        {
+            int32_t *dst = args->tmpi2 + nsrc*i;
+            if ( args->sample_map[i]==-1 )
+            {
+                dst[0] = bcf_gt_missing;
+                for (j=1; j<nsrc; j++) dst[j] = bcf_int32_vector_end;
+            }
+            else
+            {
+                int32_t *src = args->tmpi + nsrc*args->sample_map[i];
+                for (j=0; j<nsrc; j++) dst[j] = src[j];
+            }
+        }
+        return bcf_update_genotypes(args->hdr_out,line,args->tmpi2,nsrc*bcf_hdr_nsamples(args->hdr_out));
+    }
+    else if ( ndst >= nsrc )     
+    {
+        for (i=0; i<bcf_hdr_nsamples(args->hdr_out); i++)
+        {
+            if ( args->sample_map[i]==-1 ) continue;
+            int32_t *src = args->tmpi  + nsrc*args->sample_map[i];
+            int32_t *dst = args->tmpi2 + ndst*i;
+            if ( col->replace==REPLACE_EXISTING && bcf_gt_is_missing(dst[0]) ) continue;
+            if ( col->replace==REPLACE_MISSING  && !bcf_gt_is_missing(dst[0]) ) continue;
+            for (j=0; j<nsrc; j++) dst[j] = src[j];
+            for (; j<ndst; j++) dst[j] = bcf_int32_vector_end;
+        }
+        return bcf_update_genotypes(args->hdr_out,line,args->tmpi2,ndst*bcf_hdr_nsamples(args->hdr_out));
+    }
+    else    // ndst < nsrc
+    {
+        hts_expand(int32_t, nsrc*bcf_hdr_nsamples(args->hdr_out), args->mtmpi3, args->tmpi3);
+        for (i=0; i<bcf_hdr_nsamples(args->hdr_out); i++)
+        {
+            int32_t *ori = args->tmpi2 + ndst*i;
+            int32_t *dst = args->tmpi3 + nsrc*i;
+            int keep_ori = 0;
+            if ( args->sample_map[i]==-1 ) keep_ori = 1;
+            else if ( col->replace==REPLACE_EXISTING && bcf_gt_is_missing(ori[0]) ) keep_ori = 1;
+            else if ( col->replace==REPLACE_MISSING  && !bcf_gt_is_missing(ori[0]) ) keep_ori = 1;
+            if ( keep_ori )
+            {
+                for (j=0; j<ndst; j++) dst[j] = ori[j];
+                for (; j<nsrc; j++) dst[j] = bcf_int32_vector_end;
+            }
+            else
+            {
+                int32_t *src = args->tmpi + nsrc*args->sample_map[i];
+                for (j=0; j<nsrc; j++) dst[j] = src[j];
+            }
+        }
+        return bcf_update_genotypes(args->hdr_out,line,args->tmpi3,nsrc*bcf_hdr_nsamples(args->hdr_out));
+    }
+}
+static int vcf_setter_format_int(args_t *args, bcf1_t *line, annot_col_t *col, void *data)
+{
+    bcf1_t *rec = (bcf1_t*) data;
+    int nsrc = bcf_get_format_int32(args->files->readers[1].header,rec,col->hdr_key,&args->tmpi,&args->mtmpi);
+    if ( nsrc==-3 ) return 0;    // the tag is not present
+    if ( nsrc<=0 ) return 1;     // error
+
+    if ( !args->sample_map )
+        return bcf_update_format_int32(args->hdr_out,line,col->hdr_key,args->tmpi,nsrc);
+
+    int i, j, ndst = bcf_get_format_int32(args->hdr,line,col->hdr_key,&args->tmpi2,&args->mtmpi2);
+    if ( ndst > 0 ) ndst /= bcf_hdr_nsamples(args->hdr_out);
+    nsrc /= bcf_hdr_nsamples(args->files->readers[1].header);
+    if ( ndst<=0 )
+    {
+        if ( col->replace==REPLACE_EXISTING ) return 0;    // overwrite only if present
+        hts_expand(int32_t, nsrc*bcf_hdr_nsamples(args->hdr_out), args->mtmpi2, args->tmpi2);
+        for (i=0; i<bcf_hdr_nsamples(args->hdr_out); i++)
+        {
+            int32_t *dst = args->tmpi2 + nsrc*i;
+            if ( args->sample_map[i]==-1 )
+            {
+                dst[0] = bcf_int32_missing;
+                for (j=1; j<nsrc; j++) dst[j] = bcf_int32_vector_end;
+            }
+            else
+            {
+                int32_t *src = args->tmpi + nsrc*args->sample_map[i];
+                for (j=0; j<nsrc; j++) dst[j] = src[j];
+            }
+        }
+        return bcf_update_format_int32(args->hdr_out,line,col->hdr_key,args->tmpi2,nsrc*bcf_hdr_nsamples(args->hdr_out));
+    }
+    else if ( ndst >= nsrc )     
+    {
+        for (i=0; i<bcf_hdr_nsamples(args->hdr_out); i++)
+        {
+            if ( args->sample_map[i]==-1 ) continue;
+            int32_t *src = args->tmpi  + nsrc*args->sample_map[i];
+            int32_t *dst = args->tmpi2 + ndst*i;
+            if ( col->replace==REPLACE_EXISTING && dst[0]==bcf_int32_missing ) continue;
+            if ( col->replace==REPLACE_MISSING  && dst[0]!=bcf_int32_missing ) continue;
+            for (j=0; j<nsrc; j++) dst[j] = src[j];
+            for (; j<ndst; j++) dst[j] = bcf_int32_vector_end;
+        }
+        return bcf_update_format_int32(args->hdr_out,line,col->hdr_key,args->tmpi2,ndst*bcf_hdr_nsamples(args->hdr_out));
+    }
+    else    // ndst < nsrc
+    {
+        hts_expand(int32_t, nsrc*bcf_hdr_nsamples(args->hdr_out), args->mtmpi3, args->tmpi3);
+        for (i=0; i<bcf_hdr_nsamples(args->hdr_out); i++)
+        {
+            int32_t *ori = args->tmpi2 + ndst*i;
+            int32_t *dst = args->tmpi3 + nsrc*i;
+            int keep_ori = 0;
+            if ( args->sample_map[i]==-1 ) keep_ori = 1;
+            else if ( col->replace==REPLACE_EXISTING && ori[0]==bcf_int32_missing ) keep_ori = 1;
+            else if ( col->replace==REPLACE_MISSING  && ori[0]!=bcf_int32_missing ) keep_ori = 1;
+            if ( keep_ori )
+            {
+                for (j=0; j<ndst; j++) dst[j] = ori[j];
+                for (; j<nsrc; j++) dst[j] = bcf_int32_vector_end;
+            }
+            else
+            {
+                int32_t *src = args->tmpi + nsrc*args->sample_map[i];
+                for (j=0; j<nsrc; j++) dst[j] = src[j];
+            }
+        }
+        return bcf_update_format_int32(args->hdr_out,line,col->hdr_key,args->tmpi3,nsrc*bcf_hdr_nsamples(args->hdr_out));
+    }
+}
+static int vcf_setter_format_real(args_t *args, bcf1_t *line, annot_col_t *col, void *data)
+{
+    bcf1_t *rec = (bcf1_t*) data;
+    int nsrc = bcf_get_format_float(args->files->readers[1].header,rec,col->hdr_key,&args->tmpf,&args->mtmpf);
+    if ( nsrc==-3 ) return 0;    // the tag is not present
+    if ( nsrc<=0 ) return 1;     // error
+
+    if ( !args->sample_map )
+        return bcf_update_format_float(args->hdr_out,line,col->hdr_key,args->tmpf,nsrc);
+
+    int i, j, ndst = bcf_get_format_float(args->hdr,line,col->hdr_key,&args->tmpf2,&args->mtmpf2);
+    if ( ndst > 0 ) ndst /= bcf_hdr_nsamples(args->hdr_out);
+    nsrc /= bcf_hdr_nsamples(args->files->readers[1].header);
+    if ( ndst<=0 )
+    {
+        if ( col->replace==REPLACE_EXISTING ) return 0;    // overwrite only if present
+        hts_expand(float, nsrc*bcf_hdr_nsamples(args->hdr_out), args->mtmpf2, args->tmpf2);
+        for (i=0; i<bcf_hdr_nsamples(args->hdr_out); i++)
+        {
+            float *dst = args->tmpf2 + nsrc*i;
+            if ( args->sample_map[i]==-1 )
+            {
+                bcf_float_set_missing(dst[0]);
+                for (j=1; j<nsrc; j++) bcf_float_set_vector_end(dst[j]);
+            }
+            else
+            {
+                float *src = args->tmpf + nsrc*args->sample_map[i];
+                for (j=0; j<nsrc; j++) dst[j] = src[j];
+            }
+        }
+        return bcf_update_format_float(args->hdr_out,line,col->hdr_key,args->tmpf2,nsrc*bcf_hdr_nsamples(args->hdr_out));
+    }
+    else if ( ndst >= nsrc )     
+    {
+        for (i=0; i<bcf_hdr_nsamples(args->hdr_out); i++)
+        {
+            if ( args->sample_map[i]==-1 ) continue;
+            float *src = args->tmpf  + nsrc*args->sample_map[i];
+            float *dst = args->tmpf2 + ndst*i;
+            if ( col->replace==REPLACE_EXISTING && bcf_float_is_missing(dst[0]) ) continue;
+            if ( col->replace==REPLACE_MISSING  && !bcf_float_is_missing(dst[0]) ) continue;
+            for (j=0; j<nsrc; j++) dst[j] = src[j];
+            for (; j<ndst; j++) bcf_float_set_vector_end(dst[j]);
+        }
+        return bcf_update_format_float(args->hdr_out,line,col->hdr_key,args->tmpf2,ndst*bcf_hdr_nsamples(args->hdr_out));
+    }
+    else    // ndst < nsrc
+    {
+        hts_expand(float, nsrc*bcf_hdr_nsamples(args->hdr_out), args->mtmpf3, args->tmpf3);
+        for (i=0; i<bcf_hdr_nsamples(args->hdr_out); i++)
+        {
+            float *ori = args->tmpf2 + ndst*i;
+            float *dst = args->tmpf3 + nsrc*i;
+            int keep_ori = 0;
+            if ( args->sample_map[i]==-1 ) keep_ori = 1;
+            else if ( col->replace==REPLACE_EXISTING && bcf_float_is_missing(ori[0]) ) keep_ori = 1;
+            else if ( col->replace==REPLACE_MISSING  && !bcf_float_is_missing(ori[0]) ) keep_ori = 1;
+            if ( keep_ori )
+            {
+                for (j=0; j<ndst; j++) dst[j] = ori[j];
+                for (; j<nsrc; j++) bcf_float_set_vector_end(dst[j]);
+            }
+            else
+            {
+                float *src = args->tmpf + nsrc*args->sample_map[i];
+                for (j=0; j<nsrc; j++) dst[j] = src[j];
+            }
+        }
+        return bcf_update_format_float(args->hdr_out,line,col->hdr_key,args->tmpf3,nsrc*bcf_hdr_nsamples(args->hdr_out));
+    }
+}
+static int vcf_setter_format_str(args_t *args, bcf1_t *line, annot_col_t *col, void *data)
+{
+    bcf1_t *rec = (bcf1_t*) data;
+    args->tmpp[0] = args->tmps;
+    int ret = bcf_get_format_string(args->files->readers[1].header,rec,col->hdr_key,&args->tmpp,&args->mtmps);
+    args->tmps = args->tmpp[0]; // tmps might be realloced
+    if ( ret==-3 ) return 0;    // the tag is not present
+    if ( ret<=0 ) return 1;     // error
+
+    if ( !args->sample_map )
+        return bcf_update_format_string(args->hdr_out,line,col->hdr_key,(const char**)args->tmpp,bcf_hdr_nsamples(args->hdr_out));
+
+    int i;
+    args->tmpp2[0] = args->tmps2;
+    ret = bcf_get_format_string(args->hdr,line,col->hdr_key,&args->tmpp2,&args->mtmps2);
+    args->tmps2 = args->tmpp2[0];   // tmps2 might be realloced
+
+    if ( ret<=0 )   // not present in dst
+    {
+        hts_expand(char,bcf_hdr_nsamples(args->hdr_out)*2,args->mtmps2,args->tmps2);
+        for (i=0; i<bcf_hdr_nsamples(args->hdr_out); i++)
+        {
+            args->tmps2[2*i]   = '.';
+            args->tmps2[2*i+1] = 0;
+            args->tmpp2[i] = args->tmps2+2*i;
+        }
+    }
+
+    for (i=0; i<bcf_hdr_nsamples(args->hdr_out); i++)
+    {
+        int isrc = args->sample_map[i];
+        if ( isrc==-1 ) continue;
+        args->tmpp2[i] = args->tmpp[isrc];
+    }
+    return bcf_update_format_string(args->hdr_out,line,col->hdr_key,(const char**)args->tmpp2,bcf_hdr_nsamples(args->hdr_out));
+}
+static void set_samples(args_t *args, bcf_hdr_t *src, bcf_hdr_t *dst, int need_samples)
+{
+    int i;
+    if ( !args->sample_names )
+    {
+        int nmatch = 0, order_ok = 1;
+        for (i=0; i<bcf_hdr_nsamples(src); i++)
+        {
+            int id = bcf_hdr_id2int(dst, BCF_DT_SAMPLE, src->samples[i]);
+            if ( id!=-1 ) 
+            {
+                nmatch++;
+                if ( i!=id ) order_ok = 0;
+            }
+        }
+        if ( bcf_hdr_nsamples(src)==bcf_hdr_nsamples(dst) && nmatch==bcf_hdr_nsamples(src) && order_ok && !need_samples ) 
+            return;    // the same samples in both files
+
+        if ( !nmatch ) error("No matching samples found in the source and the destination file\n");
+        if ( nmatch!=bcf_hdr_nsamples(src) || nmatch!=bcf_hdr_nsamples(dst) ) fprintf(stderr,"%d sample(s) in common\n", nmatch);
+
+        args->nsample_map = bcf_hdr_nsamples(dst);
+        args->sample_map  = (int*) malloc(sizeof(int)*args->nsample_map);
+        for (i=0; i<args->nsample_map; i++)
+        {
+            int id = bcf_hdr_id2int(src, BCF_DT_SAMPLE, dst->samples[i]);
+            args->sample_map[i] = id;   // idst -> isrc, -1 if not present
+        }
+        return;
+    }
+
+    args->nsample_map = bcf_hdr_nsamples(dst);
+    args->sample_map  = (int*) malloc(sizeof(int)*args->nsample_map);
+    for (i=0; i<args->nsample_map; i++) args->sample_map[i] = -1;
+
+    int nsamples = 0;
+    char **samples = hts_readlist(args->sample_names, args->sample_is_file, &nsamples);
+    for (i=0; i<nsamples; i++)
+    {
+        int isrc, idst;
+        char *ss = samples[i], *se = samples[i];
+        while ( *se && !isspace(*se) ) se++;
+        if ( !*se ) 
+        {
+            // only one sample name
+            isrc = bcf_hdr_id2int(src, BCF_DT_SAMPLE,ss);
+            if ( isrc==-1 ) error("Sample \"%s\" not found in the source file\n", ss);
+            idst = bcf_hdr_id2int(dst, BCF_DT_SAMPLE,ss);
+            if ( idst==-1 ) error("Sample \"%s\" not found in the destination file\n", ss);
+            args->sample_map[idst] = isrc;
+            continue;
+        }
+        *se = 0;
+        isrc = bcf_hdr_id2int(src, BCF_DT_SAMPLE,ss);
+        if ( isrc==-1 ) error("Sample \"%s\" not found in the source file\n", ss);
+
+        ss = se+1;
+        while ( isspace(*ss) ) ss++;
+        se = ss;
+        while ( *se && !isspace(*se) ) se++;
+
+        idst = bcf_hdr_id2int(dst, BCF_DT_SAMPLE,ss);
+        if ( idst==-1 ) error("Sample \"%s\" not found in the destination file\n", ss);
+
+        args->sample_map[idst] = isrc;
+    }
+    for (i=0; i<nsamples; i++) free(samples[i]);
+    free(samples);
+}
+static char *columns_complement(char *columns, void **skip_info, void **skip_fmt)
+{
+    kstring_t str = {0,0,0};
+    char *ss = columns, *se = ss;
+    while ( *ss )
+    {
+        if ( *se && *se!=',' ) { se++; continue; }
+        if ( *ss!='^' )
+        {
+            if ( str.l ) kputc(',',&str);
+            kputsn(ss, se-ss, &str);
+            if ( !*se ) break;
+            ss = ++se;
+            continue;
+        }
+
+        if ( !strncasecmp("^INFO/",ss,6) )
+        {
+            if ( !*skip_info )
+            {
+                *skip_info = khash_str2int_init();
+                if ( str.l ) kputc(',',&str);
+                kputs("INFO",&str);
+            }
+            char tmp = *se; *se = 0;
+            khash_str2int_inc(*skip_info, strdup(ss+6));
+            *se = tmp;
+        }
+        else if ( !strncasecmp("^FORMAT/",ss,8) || !strncasecmp("^FMT/",ss,5) )
+        {
+            int n = !strncasecmp("^FMT/",ss,5) ? 5 : 8;
+            if ( !*skip_fmt )
+            {
+                *skip_fmt = khash_str2int_init();
+                if ( str.l ) kputc(',',&str);
+                kputs("FORMAT",&str);
+            }
+            char tmp = *se; *se = 0;
+            khash_str2int_inc(*skip_fmt, strdup(ss+n));
+            *se = tmp;
+        }
+        else
+        {
+            if ( !*skip_info )
+            {
+                *skip_info = khash_str2int_init();
+                if ( str.l ) kputc(',',&str);
+                kputs("INFO",&str);
+            }
+            char tmp = *se; *se = 0;
+            khash_str2int_inc(*skip_info, strdup(ss+1));
+            *se = tmp;
+        }
+
+        if ( !*se ) break;
+        ss = ++se;
+    }
+    free(columns);
+    return str.s;
+}
+static void init_columns(args_t *args)
+{
+    void *skip_fmt = NULL, *skip_info = NULL;
+    if ( args->tgts_is_vcf )
+        args->columns = columns_complement(args->columns, &skip_info, &skip_fmt);
+
+    kstring_t str = {0,0,0}, tmp = {0,0,0};
+    char *ss = args->columns, *se = ss;
+    args->ncols = 0;
+    int i = -1, has_fmt_str = 0, force_samples = -1;
+    while ( *ss )
+    {
+        if ( *se && *se!=',' ) { se++; continue; }
+        int replace = REPLACE_ALL;
+        if ( *ss=='+' ) { replace = REPLACE_MISSING; ss++; }
+        else if ( *ss=='-' ) { replace = REPLACE_EXISTING; ss++; }
+        i++;
+        str.l = 0;
+        kputsn(ss, se-ss, &str);
+        if ( !str.s[0] || !strcasecmp("-",str.s) ) ;
+        else if ( !strcasecmp("CHROM",str.s) ) args->chr_idx = i;
+        else if ( !strcasecmp("POS",str.s) ) args->from_idx = i;
+        else if ( !strcasecmp("FROM",str.s) ) args->from_idx = i;
+        else if ( !strcasecmp("TO",str.s) ) args->to_idx = i;
+        else if ( !strcasecmp("REF",str.s) ) args->ref_idx = i;
+        else if ( !strcasecmp("ALT",str.s) ) args->alt_idx = i;
+        else if ( !strcasecmp("ID",str.s) )
+        {
+            if ( replace==REPLACE_EXISTING ) error("todo: -ID\n");
+            args->ncols++; args->cols = (annot_col_t*) realloc(args->cols,sizeof(annot_col_t)*args->ncols);
+            annot_col_t *col = &args->cols[args->ncols-1];
+            col->icol = i;
+            col->replace = replace;
+            col->setter = args->tgts_is_vcf ? vcf_setter_id : setter_id;
+            col->hdr_key = strdup(str.s);
+        }
+        else if ( !strcasecmp("FILTER",str.s) )
+        {
+            if ( replace==REPLACE_EXISTING ) error("todo: -FILTER\n");
+            args->ncols++; args->cols = (annot_col_t*) realloc(args->cols,sizeof(annot_col_t)*args->ncols);
+            annot_col_t *col = &args->cols[args->ncols-1];
+            col->icol = i;
+            col->replace = replace;
+            col->setter = args->tgts_is_vcf ? vcf_setter_filter : setter_filter;
+            col->hdr_key = strdup(str.s);
+            if ( args->tgts_is_vcf )
+            {
+                bcf_hdr_t *tgts_hdr = args->files->readers[1].header;
+                int j;
+                for (j=0; j<tgts_hdr->nhrec; j++)
+                {
+                    bcf_hrec_t *hrec = tgts_hdr->hrec[j];
+                    if ( hrec->type!=BCF_HL_FLT ) continue;
+                    int k = bcf_hrec_find_key(hrec,"ID");
+                    assert( k>=0 ); // this should always be true for valid VCFs
+                    tmp.l = 0;
+                    bcf_hrec_format(hrec, &tmp);
+                    bcf_hdr_append(args->hdr_out, tmp.s);
+                }
+                bcf_hdr_sync(args->hdr_out);
+            }
+        }
+        else if ( !strcasecmp("QUAL",str.s) )
+        {
+            if ( replace==REPLACE_EXISTING ) error("todo: -QUAL\n");
+            args->ncols++; args->cols = (annot_col_t*) realloc(args->cols,sizeof(annot_col_t)*args->ncols);
+            annot_col_t *col = &args->cols[args->ncols-1];
+            col->icol = i;
+            col->replace = replace;
+            col->setter = args->tgts_is_vcf ? vcf_setter_qual : setter_qual;
+            col->hdr_key = strdup(str.s);
+        }
+        else if ( args->tgts_is_vcf && !strcasecmp("INFO",str.s) ) // All INFO fields
+        {
+            if ( replace==REPLACE_EXISTING ) error("todo: -INFO/TAG\n");
+            bcf_hdr_t *tgts_hdr = args->files->readers[1].header;
+            int j;
+            for (j=0; j<tgts_hdr->nhrec; j++)
+            {
+                bcf_hrec_t *hrec = tgts_hdr->hrec[j];
+                if ( hrec->type!=BCF_HL_INFO ) continue;
+                int k = bcf_hrec_find_key(hrec,"ID");
+                assert( k>=0 ); // this should always be true for valid VCFs
+                if ( skip_info && khash_str2int_has_key(skip_info,hrec->vals[k]) ) continue;
+                tmp.l = 0;
+                bcf_hrec_format(hrec, &tmp);
+                bcf_hdr_append(args->hdr_out, tmp.s);
+                bcf_hdr_sync(args->hdr_out);
+                int hdr_id = bcf_hdr_id2int(args->hdr_out, BCF_DT_ID, hrec->vals[k]);
+                args->ncols++; args->cols = (annot_col_t*) realloc(args->cols,sizeof(annot_col_t)*args->ncols);
+                annot_col_t *col = &args->cols[args->ncols-1];
+                col->icol = -1;
+                col->replace = replace;
+                col->hdr_key = strdup(hrec->vals[k]);
+                col->number  = bcf_hdr_id2length(args->hdr_out,BCF_HL_INFO,hdr_id);
+                switch ( bcf_hdr_id2type(args->hdr_out,BCF_HL_INFO,hdr_id) )
+                {
+                    case BCF_HT_FLAG:   col->setter = vcf_setter_info_flag; break;
+                    case BCF_HT_INT:    col->setter = vcf_setter_info_int; break;
+                    case BCF_HT_REAL:   col->setter = vcf_setter_info_real; break;
+                    case BCF_HT_STR:    col->setter = vcf_setter_info_str; break;
+                    default: error("The type of %s not recognised (%d)\n", str.s,bcf_hdr_id2type(args->hdr_out,BCF_HL_INFO,hdr_id));
+                }
+            }
+        }
+        else if ( args->tgts_is_vcf && (!strcasecmp("FORMAT",str.s) || !strcasecmp("FMT",str.s)) ) // All FORMAT fields
+        {
+            bcf_hdr_t *tgts_hdr = args->files->readers[1].header;
+            if ( force_samples<0 ) force_samples = replace;
+            if ( force_samples>=0 && replace!=REPLACE_ALL ) force_samples = replace;
+            int j;
+            for (j=0; j<tgts_hdr->nhrec; j++)
+            {
+                bcf_hrec_t *hrec = tgts_hdr->hrec[j];
+                if ( hrec->type!=BCF_HL_FMT) continue;
+                int k = bcf_hrec_find_key(hrec,"ID");
+                assert( k>=0 ); // this should always be true for valid VCFs
+                if ( skip_fmt && khash_str2int_has_key(skip_fmt,hrec->vals[k]) ) continue;
+                tmp.l = 0;
+                bcf_hrec_format(hrec, &tmp);
+                bcf_hdr_append(args->hdr_out, tmp.s);
+                bcf_hdr_sync(args->hdr_out);
+                int hdr_id = bcf_hdr_id2int(args->hdr_out, BCF_DT_ID, hrec->vals[k]);
+                args->ncols++; args->cols = (annot_col_t*) realloc(args->cols,sizeof(annot_col_t)*args->ncols);
+                annot_col_t *col = &args->cols[args->ncols-1];
+                col->icol = -1;
+                col->replace = replace;
+                col->hdr_key = strdup(hrec->vals[k]);
+                if ( !strcasecmp("GT",col->hdr_key) ) col->setter = vcf_setter_format_gt;
+                else
+                    switch ( bcf_hdr_id2type(args->hdr_out,BCF_HL_FMT,hdr_id) )
+                    {
+                        case BCF_HT_INT:    col->setter = vcf_setter_format_int; break;
+                        case BCF_HT_REAL:   col->setter = vcf_setter_format_real; break;
+                        case BCF_HT_STR:    col->setter = vcf_setter_format_str; has_fmt_str = 1; break;
+                        default: error("The type of %s not recognised (%d)\n", str.s,bcf_hdr_id2type(args->hdr_out,BCF_HL_FMT,hdr_id));
+                    }
+            }
+        }
+        else if ( args->tgts_is_vcf && (!strncasecmp("FORMAT/",str.s, 7) || !strncasecmp("FMT/",str.s,4)) )
+        {
+            char *key = str.s + (!strncasecmp("FMT/",str.s,4) ? 4 : 7);
+            if ( force_samples<0 ) force_samples = replace;
+            if ( force_samples>=0 && replace!=REPLACE_ALL ) force_samples = replace;;
+            bcf_hrec_t *hrec = bcf_hdr_get_hrec(args->files->readers[1].header, BCF_HL_FMT, "ID", key, NULL);
+            tmp.l = 0;
+            bcf_hrec_format(hrec, &tmp);
+            bcf_hdr_append(args->hdr_out, tmp.s);
+            bcf_hdr_sync(args->hdr_out);
+            int hdr_id = bcf_hdr_id2int(args->hdr_out, BCF_DT_ID, key);
+            args->ncols++; args->cols = (annot_col_t*) realloc(args->cols,sizeof(annot_col_t)*args->ncols);
+            annot_col_t *col = &args->cols[args->ncols-1];
+            col->icol = -1;
+            col->replace = replace;
+            col->hdr_key = strdup(key);
+            if ( !strcasecmp("GT",key) ) col->setter = vcf_setter_format_gt;
+            else
+                switch ( bcf_hdr_id2type(args->hdr_out,BCF_HL_FMT,hdr_id) )
+                {
+                    case BCF_HT_INT:    col->setter = vcf_setter_format_int; break;
+                    case BCF_HT_REAL:   col->setter = vcf_setter_format_real; break;
+                    case BCF_HT_STR:    col->setter = vcf_setter_format_str; has_fmt_str = 1; break;
+                    default: error("The type of %s not recognised (%d)\n", str.s,bcf_hdr_id2type(args->hdr_out,BCF_HL_FMT,hdr_id));
+                }
+        }
+        else
+        {
+            if ( replace==REPLACE_EXISTING ) error("todo: -INFO/TAG\n");
+            if ( !strncasecmp("INFO/",str.s,5) ) { memmove(str.s,str.s+5,str.l-4); }
+            int hdr_id = bcf_hdr_id2int(args->hdr_out, BCF_DT_ID, str.s);
+            if ( !bcf_hdr_idinfo_exists(args->hdr_out,BCF_HL_INFO,hdr_id) )
+            {
+                if ( args->tgts_is_vcf ) // reading annotations from a VCF, add a new header line
+                {
+                    bcf_hrec_t *hrec = bcf_hdr_get_hrec(args->files->readers[1].header, BCF_HL_INFO, "ID", str.s, NULL);
+                    if ( !hrec ) error("The tag \"%s\" is not defined in %s\n", str.s,args->files->readers[1].fname);
+                    tmp.l = 0;
+                    bcf_hrec_format(hrec, &tmp);
+                    bcf_hdr_append(args->hdr_out, tmp.s);
+                    bcf_hdr_sync(args->hdr_out);
+                    hdr_id = bcf_hdr_id2int(args->hdr_out, BCF_DT_ID, str.s);
+                }
+                else
+                    error("The tag \"%s\" is not defined in %s\n", str.s, args->targets_fname);
+                assert( bcf_hdr_idinfo_exists(args->hdr_out,BCF_HL_INFO,hdr_id) );
+            }
+
+            args->ncols++; args->cols = (annot_col_t*) realloc(args->cols,sizeof(annot_col_t)*args->ncols);
+            annot_col_t *col = &args->cols[args->ncols-1];
+            col->icol = i;
+            col->replace = replace;
+            col->hdr_key = strdup(str.s);
+            col->number  = bcf_hdr_id2length(args->hdr_out,BCF_HL_INFO,hdr_id);
+            switch ( bcf_hdr_id2type(args->hdr_out,BCF_HL_INFO,hdr_id) )
+            {
+                case BCF_HT_FLAG:   col->setter = args->tgts_is_vcf ? vcf_setter_info_flag : setter_info_flag; break;
+                case BCF_HT_INT:    col->setter = args->tgts_is_vcf ? vcf_setter_info_int  : setter_info_int; break;
+                case BCF_HT_REAL:   col->setter = args->tgts_is_vcf ? vcf_setter_info_real : setter_info_real; break;
+                case BCF_HT_STR:    col->setter = args->tgts_is_vcf ? vcf_setter_info_str  : setter_info_str; break;
+                default: error("The type of %s not recognised (%d)\n", str.s,bcf_hdr_id2type(args->hdr_out,BCF_HL_INFO,hdr_id));
+            }
+        }
+        if ( !*se ) break;
+        ss = ++se;
+    }
+    free(str.s);
+    free(tmp.s);
+    if ( args->to_idx==-1 ) args->to_idx = args->from_idx;
+    free(args->columns);
+    if ( skip_info ) khash_str2int_destroy_free(skip_info);
+    if ( skip_fmt ) khash_str2int_destroy_free(skip_fmt);
+    if ( has_fmt_str )
+    {
+        int n = bcf_hdr_nsamples(args->hdr_out) > bcf_hdr_nsamples(args->files->readers[1].header) ? bcf_hdr_nsamples(args->hdr_out) : bcf_hdr_nsamples(args->files->readers[1].header);
+        args->tmpp  = (char**)malloc(sizeof(char*)*n);
+        args->tmpp2 = (char**)malloc(sizeof(char*)*n);
+    }
+    if ( force_samples>=0 )
+        set_samples(args, args->files->readers[1].header, args->hdr, force_samples==REPLACE_ALL ? 0 : 1);
+}
+
+static void rename_chrs(args_t *args, char *fname)
+{
+    int n, i;
+    char **map = hts_readlist(fname, 1, &n);
+    if ( !map ) error("Could not read: %s\n", fname);
+    for (i=0; i<n; i++)
+    {
+        char *ss = map[i];
+        while ( *ss && !isspace(*ss) ) ss++;
+        if ( !*ss ) error("Could not parse: %s\n", fname);
+        *ss = 0;
+        int rid = bcf_hdr_name2id(args->hdr_out, map[i]);
+        bcf_hrec_t *hrec = bcf_hdr_get_hrec(args->hdr_out, BCF_HL_CTG, "ID", map[i], NULL);
+        if ( !hrec ) continue;  // the sequence not present
+        int j = bcf_hrec_find_key(hrec, "ID");
+        assert( j>=0 );
+        free(hrec->vals[j]);
+        ss++;
+        while ( *ss && isspace(*ss) ) ss++;
+        char *se = ss;
+        while ( *se && !isspace(*se) ) se++;
+        *se = 0;
+        hrec->vals[j] = strdup(ss);
+        args->hdr_out->id[BCF_DT_CTG][rid].key = hrec->vals[j];
+    }
+    for (i=0; i<n; i++) free(map[i]);
+    free(map);
+}
+
+static void init_data(args_t *args)
+{
+    args->hdr = args->files->readers[0].header;
+    args->hdr_out = bcf_hdr_dup(args->hdr);
+
+    if ( args->remove_annots ) init_remove_annots(args);
+    if ( args->header_fname ) init_header_lines(args);
+    if ( args->targets_fname && args->tgts_is_vcf )
+    {
+        // reading annots from a VCF
+        if ( !bcf_sr_add_reader(args->files, args->targets_fname) )
+            error("Failed to open %s: %s\n", args->targets_fname,bcf_sr_strerror(args->files->errnum));
+    }
+    if ( args->columns ) init_columns(args);
+    if ( args->targets_fname && !args->tgts_is_vcf )
+    {
+        if ( !args->columns ) error("The -c option not given\n");
+        if ( args->chr_idx==-1 ) error("The -c CHROM option not given\n");
+        if ( args->from_idx==-1 ) error("The -c POS option not given\n");
+        if ( args->to_idx==-1 ) args->to_idx = -args->from_idx - 1;
+
+        args->tgts = bcf_sr_regions_init(args->targets_fname,1,args->chr_idx,args->from_idx,args->to_idx);
+        if ( !args->tgts ) error("Could not initialize the annotation file: %s\n", args->targets_fname);
+        if ( !args->tgts->tbx ) error("Expected tabix-indexed annotation file: %s\n", args->targets_fname);
+    }
+    args->vcmp = vcmp_init();
+
+    if ( args->filter_str )
+        args->filter = filter_init(args->hdr, args->filter_str);
+
+    if ( args->set_ids_fmt )
+    {
+        if ( args->set_ids_fmt[0]=='+' ) { args->set_ids_replace = 0; args->set_ids_fmt++; }
+        args->set_ids = convert_init(args->hdr_out, NULL, 0, args->set_ids_fmt);
+    }
+
+    bcf_hdr_append_version(args->hdr_out, args->argc, args->argv, "bcftools_annotate");
+    if ( !args->drop_header )
+    {
+        if ( args->rename_chrs ) rename_chrs(args, args->rename_chrs);
+
+        args->out_fh = hts_open(args->output_fname,hts_bcf_wmode(args->output_type));
+        if ( args->out_fh == NULL ) error("Can't write to \"%s\": %s\n", args->output_fname, strerror(errno));
+        bcf_hdr_write(args->out_fh, args->hdr_out);
+    }
+}
+
+static void destroy_data(args_t *args)
+{
+    int i;
+    for (i=0; i<args->nrm; i++) free(args->rm[i].key);
+    free(args->rm);
+    if ( args->hdr_out ) bcf_hdr_destroy(args->hdr_out);
+    if (args->vcmp) vcmp_destroy(args->vcmp);
+    for (i=0; i<args->ncols; i++)
+        free(args->cols[i].hdr_key);
+    free(args->cols);
+    for (i=0; i<args->malines; i++)
+    {
+        free(args->alines[i].cols);
+        free(args->alines[i].als);
+        free(args->alines[i].line.s);
+    }
+    free(args->alines);
+    if ( args->tgts ) bcf_sr_regions_destroy(args->tgts);
+    free(args->tmpks.s);
+    free(args->tmpi);
+    free(args->tmpf);
+    free(args->tmps);
+    free(args->tmpp);
+    free(args->tmpi2);
+    free(args->tmpf2);
+    free(args->tmps2);
+    free(args->tmpp2);
+    free(args->tmpi3);
+    free(args->tmpf3);
+    if ( args->set_ids )
+        convert_destroy(args->set_ids);
+    if ( args->filter )
+        filter_destroy(args->filter);
+    if (args->out_fh) hts_close(args->out_fh);
+    free(args->sample_map);
+}
+
+static void buffer_annot_lines(args_t *args, bcf1_t *line, int start_pos, int end_pos)
+{
+    if ( args->nalines && args->alines[0].rid != line->rid ) args->nalines = 0;
+
+    int i = 0;
+    while ( i<args->nalines )
+    {
+        if ( line->pos > args->alines[i].end )
+        {
+            args->nalines--;
+            if ( args->nalines && i<args->nalines )
+            {
+                annot_line_t tmp = args->alines[i];
+                memmove(&args->alines[i],&args->alines[i+1],(args->nalines-i)*sizeof(annot_line_t));
+                args->alines[args->nalines] = tmp;
+            }
+        }
+        else i++;
+    }
+
+    if ( args->ref_idx==-1 && args->nalines ) return;
+
+    while ( !bcf_sr_regions_overlap(args->tgts, bcf_seqname(args->hdr,line), start_pos,end_pos) )
+    {
+        args->nalines++;
+        hts_expand0(annot_line_t,args->nalines,args->malines,args->alines);
+        annot_line_t *tmp = &args->alines[args->nalines-1];
+        tmp->rid   = line->rid;
+        tmp->start = args->tgts->start;
+        tmp->end   = args->tgts->end;
+        tmp->line.l = 0;
+        kputs(args->tgts->line.s, &tmp->line);
+        char *s = tmp->line.s;
+        tmp->ncols = 1;
+        hts_expand(char*,tmp->ncols,tmp->mcols,tmp->cols);
+        tmp->cols[0] = s;
+        while ( *s )
+        {
+            if ( *s=='\t' )
+            {
+                tmp->ncols++;
+                hts_expand(char*,tmp->ncols,tmp->mcols,tmp->cols);
+                tmp->cols[tmp->ncols-1] = s+1;
+                *s = 0;
+            }
+            s++;
+        }
+        if ( args->ref_idx != -1 )
+        {
+            assert( args->ref_idx < tmp->ncols );
+            assert( args->alt_idx < tmp->ncols );
+            tmp->nals = 2;
+            hts_expand(char*,tmp->nals,tmp->mals,tmp->als);
+            tmp->als[0] = tmp->cols[args->ref_idx];
+            tmp->als[1] = s = tmp->cols[args->alt_idx];
+            while ( *s )
+            {
+                if ( *s==',' )
+                {
+                    tmp->nals++;
+                    hts_expand(char*,tmp->nals,tmp->mals,tmp->als);
+                    tmp->als[tmp->nals-1] = s+1;
+                    *s = 0;
+                }
+                s++;
+            }
+            int iseq = args->tgts->iseq;
+            if ( bcf_sr_regions_next(args->tgts)<0 || args->tgts->iseq!=iseq ) break;
+        }
+        else break;
+    }
+}
+
+static void annotate(args_t *args, bcf1_t *line)
+{
+    int i, j;
+    for (i=0; i<args->nrm; i++)
+        args->rm[i].handler(args, line, &args->rm[i]);
+
+    if ( args->tgts )
+    {
+        // Buffer annotation lines. When multiple ALT alleles are present in the
+        // annotation file, at least one must match one of the VCF alleles.
+        int len = 0;
+        bcf_get_variant_types(line);
+        for (i=1; i<line->n_allele; i++)
+            if ( len > line->d.var[i].n ) len = line->d.var[i].n;
+        int end_pos = len<0 ? line->pos - len : line->pos;
+        buffer_annot_lines(args, line, line->pos, end_pos);
+        for (i=0; i<args->nalines; i++)
+        {
+            if ( line->pos > args->alines[i].end || end_pos < args->alines[i].start ) continue;
+            if ( args->ref_idx != -1 )
+            {
+                if ( vcmp_set_ref(args->vcmp, line->d.allele[0], args->alines[i].als[0]) < 0 ) continue;   // refs not compatible
+                for (j=1; j<args->alines[i].nals; j++)
+                {
+                    if ( line->n_allele==1 && args->alines[i].als[j][0]=='.' && args->alines[i].als[j][1]==0 ) break;   // no ALT allele in VCF and annot file has "."
+                    if ( vcmp_find_allele(args->vcmp, line->d.allele+1, line->n_allele - 1, args->alines[i].als[j]) >= 0 ) break;
+                }
+                if ( j==args->alines[i].nals ) continue;    // none of the annot alleles present in VCF's ALT
+            }
+            break;
+        }
+
+        if ( i<args->nalines )
+        {
+            for (j=0; j<args->ncols; j++)
+                if ( args->cols[j].setter(args,line,&args->cols[j],&args->alines[i]) )
+                    error("fixme: Could not set %s at %s:%d\n", args->cols[j].hdr_key,bcf_seqname(args->hdr,line),line->pos+1);
+        }
+    }
+    else if ( args->files->nreaders == 2 && bcf_sr_has_line(args->files,1) )
+    {
+        bcf1_t *aline = bcf_sr_get_line(args->files,1);
+        for (j=0; j<args->ncols; j++)
+            if ( args->cols[j].setter(args,line,&args->cols[j],aline) )
+                error("fixme: Could not set %s at %s:%d\n", args->cols[j].hdr_key,bcf_seqname(args->hdr,line),line->pos+1);
+    }
+    if ( args->set_ids )
+    {
+        args->tmpks.l = 0;
+        convert_line(args->set_ids, line, &args->tmpks);
+        if ( args->tmpks.l )
+        {
+            int replace = 0;
+            if ( args->set_ids_replace ) replace = 1;
+            else if ( !line->d.id || (line->d.id[0]=='.' && !line->d.id[1]) ) replace = 1;
+            if ( replace )
+                bcf_update_id(args->hdr_out,line,args->tmpks.s);
+        }
+    }
+}
+
+static void usage(args_t *args)
+{
+    fprintf(stderr, "\n");
+    fprintf(stderr, "About:   Annotate and edit VCF/BCF files.\n");
+    fprintf(stderr, "Usage:   bcftools annotate [options] <in.vcf.gz>\n");
+    fprintf(stderr, "\n");
+    fprintf(stderr, "Options:\n");
+    fprintf(stderr, "   -a, --annotations <file>       VCF file or tabix-indexed file with annotations: CHR\\tPOS[\\tVALUE]+\n");
+    fprintf(stderr, "   -c, --columns <list>           list of columns in the annotation file, e.g. CHROM,POS,REF,ALT,-,INFO/TAG. See man page for details\n");
+    fprintf(stderr, "   -e, --exclude <expr>           exclude sites for which the expression is true (see man page for details)\n");
+    fprintf(stderr, "   -h, --header-lines <file>      lines which should be appended to the VCF header\n");
+    fprintf(stderr, "   -I, --set-id [+]<format>       set ID column, see man pagee for details\n");
+    fprintf(stderr, "   -i, --include <expr>           select sites for which the expression is true (see man pagee for details)\n");
+    fprintf(stderr, "   -o, --output <file>            write output to a file [standard output]\n");
+    fprintf(stderr, "   -O, --output-type <b|u|z|v>    b: compressed BCF, u: uncompressed BCF, z: compressed VCF, v: uncompressed VCF [v]\n");
+    fprintf(stderr, "   -r, --regions <region>         restrict to comma-separated list of regions\n");
+    fprintf(stderr, "   -R, --regions-file <file>      restrict to regions listed in a file\n");
+    fprintf(stderr, "       --rename-chrs <file>       rename sequences according to map file: from\\tto\n");
+    fprintf(stderr, "   -s, --samples [^]<list>        comma separated list of samples to annotate (or exclude with \"^\" prefix)\n");
+    fprintf(stderr, "   -S, --samples-file [^]<file>   file of samples to annotate (or exclude with \"^\" prefix)\n");
+    fprintf(stderr, "   -x, --remove <list>            list of annotations to remove (e.g. ID,INFO/DP,FORMAT/DP,FILTER). See man page for details\n");
+    fprintf(stderr, "\n");
+    exit(1);
+}
+
+int main_vcfannotate(int argc, char *argv[])
+{
+    int c;
+    args_t *args  = (args_t*) calloc(1,sizeof(args_t));
+    args->argc    = argc; args->argv = argv;
+    args->files   = bcf_sr_init();
+    args->output_fname = "-";
+    args->output_type = FT_VCF;
+    args->ref_idx = args->alt_idx = args->chr_idx = args->from_idx = args->to_idx = -1;
+    args->set_ids_replace = 1;
+    int regions_is_file = 0;
+
+    static struct option loptions[] =
+    {
+        {"set-id",1,0,'I'},
+        {"output",1,0,'o'},
+        {"output-type",1,0,'O'},
+        {"annotations",1,0,'a'},
+        {"include",1,0,'i'},
+        {"exclude",1,0,'e'},
+        {"regions",1,0,'r'},
+        {"regions-file",1,0,'R'},
+        {"remove",1,0,'x'},
+        {"columns",1,0,'c'},
+        {"rename-chrs",1,0,1},
+        {"header-lines",1,0,'h'},
+        {"samples",1,0,'s'},
+        {"samples-file",1,0,'S'},
+        {0,0,0,0}
+    };
+    while ((c = getopt_long(argc, argv, "h:?o:O:r:R:a:x:c:i:e:S:s:I:",loptions,NULL)) >= 0)
+    {
+        switch (c) {
+            case 'I': args->set_ids_fmt = optarg; break;
+            case 's': args->sample_names = optarg; break;
+            case 'S': args->sample_names = optarg; args->sample_is_file = 1; break;
+            case 'c': args->columns = strdup(optarg); break;
+            case 'o': args->output_fname = optarg; break;
+            case 'O':
+                switch (optarg[0]) {
+                    case 'b': args->output_type = FT_BCF_GZ; break;
+                    case 'u': args->output_type = FT_BCF; break;
+                    case 'z': args->output_type = FT_VCF_GZ; break;
+                    case 'v': args->output_type = FT_VCF; break;
+                    default: error("The output type \"%s\" not recognised\n", optarg);
+                };
+                break;
+            case 'e': args->filter_str = optarg; args->filter_logic |= FLT_EXCLUDE; break;
+            case 'i': args->filter_str = optarg; args->filter_logic |= FLT_INCLUDE; break;
+            case 'x': args->remove_annots = optarg; break;
+            case 'a': args->targets_fname = optarg; break;
+            case 'r': args->regions_list = optarg; break;
+            case 'R': args->regions_list = optarg; regions_is_file = 1; break;
+            case 'h': args->header_fname = optarg; break;
+            case  1 : args->rename_chrs = optarg; break;
+            case '?': usage(args); break;
+            default: error("Unknown argument: %s\n", optarg);
+        }
+    }
+
+    char *fname = NULL;
+    if ( optind>=argc )
+    {
+        if ( !isatty(fileno((FILE *)stdin)) ) fname = "-";  // reading from stdin
+        else usage(args);
+    }
+    else fname = argv[optind];
+
+    if ( args->regions_list )
+    {
+        if ( bcf_sr_set_regions(args->files, args->regions_list, regions_is_file)<0 )
+            error("Failed to read the regions: %s\n", args->regions_list);
+    }
+    if ( args->targets_fname )
+    {
+        htsFile *fp = hts_open(args->targets_fname,"r"); 
+        htsFormat type = *hts_get_format(fp);
+        hts_close(fp);
+
+        if ( type.format==vcf || type.format==bcf )
+        {
+            args->tgts_is_vcf = 1;
+            args->files->require_index = 1;
+            args->files->collapse |= COLLAPSE_SOME;
+        }
+    }
+    if ( !bcf_sr_add_reader(args->files, fname) ) error("Failed to open %s: %s\n", fname,bcf_sr_strerror(args->files->errnum));
+
+    init_data(args);
+    while ( bcf_sr_next_line(args->files) )
+    {
+        if ( !bcf_sr_has_line(args->files,0) ) continue;
+        bcf1_t *line = bcf_sr_get_line(args->files,0);
+        if ( line->errcode ) error("Encountered error, cannot proceed. Please check the error output above.\n");
+        if ( args->filter )
+        {
+            int pass = filter_test(args->filter, line, NULL);
+            if ( args->filter_logic & FLT_EXCLUDE ) pass = pass ? 0 : 1;
+            if ( !pass ) continue;
+        }
+        annotate(args, line);
+        bcf_write1(args->out_fh, args->hdr_out, line);
+    }
+    destroy_data(args);
+    bcf_sr_destroy(args->files);
+    free(args);
+    return 0;
+}
diff --git a/vcfcall.c b/vcfcall.c
new file mode 100644
index 0000000..dab7cb7
--- /dev/null
+++ b/vcfcall.c
@@ -0,0 +1,710 @@
+/*  vcfcall.c -- SNP/indel variant calling from VCF/BCF.
+
+    Copyright (C) 2013-2014 Genome Research Ltd.
+
+    Author: Petr Danecek <pd3 at sanger.ac.uk>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.  */
+
+#include <stdarg.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <getopt.h>
+#include <math.h>
+#include <htslib/vcf.h>
+#include <time.h>
+#include <zlib.h>
+#include <stdarg.h>
+#include <htslib/kfunc.h>
+#include <htslib/synced_bcf_reader.h>
+#include <ctype.h>
+#include "bcftools.h"
+#include "call.h"
+#include "prob1.h"
+
+void error(const char *format, ...);
+
+#ifdef _WIN32
+#define srand48(x) srand(x)
+#define lrand48() rand()
+#endif
+
+#define CF_NO_GENO      1
+#define CF_INS_MISSED   (1<<1)
+#define CF_CCALL        (1<<2)
+#define CF_GVCF         (1<<3)
+//                      (1<<4)
+//                      (1<<5)
+#define CF_ACGT_ONLY    (1<<6)
+#define CF_QCALL        (1<<7)
+#define CF_ADJLD        (1<<8)
+#define CF_NO_INDEL     (1<<9)
+#define CF_ANNO_MAX     (1<<10)
+#define CF_MCALL        (1<<11)
+#define CF_PAIRCALL     (1<<12)
+#define CF_QCNT         (1<<13)
+#define CF_INDEL_ONLY   (1<<14)
+
+typedef struct
+{
+    int flag;   // combination of CF_* flags above
+    int output_type;
+    htsFile *bcf_in, *out_fh;
+    char *bcf_fname, *output_fname;
+    char **samples;             // for subsampling and ploidy
+    int nsamples, *samples_map;
+    char *regions, *targets;    // regions to process
+    int regions_is_file, targets_is_file;
+
+    bcf1_t *missed_line;
+    call_t aux;     // parameters and temporary data
+    gvcf_t gvcf;
+
+    int argc;
+    char **argv;
+
+    //  int flag, prior_type, n1, n_sub, *sublist, n_perm;
+    //  uint32_t *trio_aux;
+    //  char *prior_file, **subsam;
+    //  uint8_t *ploidy;
+    //  double theta, pref, indel_frac, min_smpl_frac, min_lrt;
+    // Permutation tests
+    //  int n_perm, *seeds;
+    //  double min_perm_p;
+    //  void *bed;
+}
+args_t;
+
+static family_t *get_family(family_t *fam, int nfam, char *name)
+{
+    int i;
+    for (i=0; i<nfam; i++)
+    {
+        if ( !strcmp(fam[i].name, name) ) return &fam[i];
+    }
+    return NULL;
+}
+
+static char **add_sample(char **sam, int *n, int *m, char *name, int ploidy, int *ith)
+{
+    int i;
+    for (i=0; i<*n; i++)
+    {
+        if ( !strcmp(sam[i], name) )
+        {
+            *ith = i;
+            return sam;
+        }
+    }
+    hts_expand(char*,(*n+1),*m,sam);
+    int len = strlen(name);
+    sam[*n] = (char*) malloc(len+2);
+    memcpy(sam[*n],name,len+1);
+    sam[*n][len+1] = ploidy;
+    *ith = *n;
+    (*n)++;
+    return sam;
+}
+
+static char **parse_ped_samples(call_t *call, char **vals, int _n)
+{
+    int i, j, max = 0, n = 0;
+    kstring_t str = {0,0,0};
+    char **sam = NULL;
+    for (i=0; i<_n; i++)
+    {
+        str.l = 0;
+        kputs(vals[i], &str);
+        char *col_ends[5], *tmp = str.s;
+        j = 0;
+        while ( *tmp && j<5 )
+        {
+            if ( isspace(*tmp) )
+            {
+                *tmp = 0;
+                ++tmp;
+                while ( isspace(*tmp) ) tmp++;  // allow multiple spaces
+                col_ends[j] = tmp-1;
+                j++;
+                continue;
+            }
+            tmp++;
+        }
+        if ( j!=5 ) break;
+
+        family_t *fam = get_family(call->fams, call->nfams, str.s);
+        if ( !fam )
+        {
+            call->nfams++;
+            hts_expand(family_t, call->nfams, call->mfams, call->fams);
+            fam = &call->fams[call->nfams-1];
+            fam->name = strdup(str.s);
+            for (j=0; j<3; j++) fam->sample[j] = -1;
+        }
+
+        int ploidy = 2;
+        if ( call->flag & (CALL_CHR_X|CALL_CHR_Y) )
+        {
+            if ( col_ends[3][1]=='1' ) ploidy = 1; // male: one chrX and one chrY copy
+            else
+                ploidy = call->flag & CALL_CHR_X ? 2 : 0; // female: two chrX copies, no chrY
+        }
+        sam = add_sample(sam, &n, &max, col_ends[0]+1, ploidy, &j);
+        if ( strcmp(col_ends[1]+1,"0") )    // father
+        {
+            if ( fam->sample[CHILD]>=0 ) error("Multiple childs in %s [%s,%s]\n", str.s, sam[j],sam[fam->sample[CHILD]]);
+            fam->sample[CHILD] = j;
+            if ( fam->sample[FATHER]>=0 ) error("Two fathers in %s?\n", str.s);
+            sam = add_sample(sam, &n, &max, col_ends[1]+1, call->flag & (CALL_CHR_X|CALL_CHR_Y) ? 1 : 2, &fam->sample[FATHER]);
+        }
+        if ( strcmp(col_ends[2]+1,"0") )    // mother
+        {
+            if ( fam->sample[MOTHER]>=0 ) error("Two mothers in %s?\n", str.s);
+            sam = add_sample(sam, &n, &max, col_ends[2]+1, call->flag & CALL_CHR_Y ? 0 : 2, &fam->sample[MOTHER]);
+        }
+    }
+    free(str.s);
+
+    if ( i!=_n ) // not a ped file
+    {
+        if ( i>0 ) error("Could not parse the samples, thought it was PED format, some rows have 5 columns?!\n");
+        return NULL;
+    }
+    assert( n==_n );
+    for (i=0; i<call->nfams; i++)
+        assert( call->fams[i].sample[0]>=0 && call->fams[i].sample[1]>=0 && call->fams[i].sample[2]>=0 ); // multiple childs, not a trio
+
+    return sam;
+}
+
+
+/*
+ *  Reads sample names and their ploidy (optional) from a file.
+ *  Alternatively, if no such file exists, the file name is interpreted
+ *  as a comma-separated list of samples. When ploidy is not present,
+ *  the default ploidy 2 is assumed.
+ *
+ *  Returns an array of sample names, where the byte value just after \0
+ *  indicates the ploidy.
+ */
+static char **read_samples(call_t *call, const char *fn, int is_file, int *_n)
+{
+    int i, n;
+    char **vals = hts_readlist(fn, is_file, &n);
+    if ( !vals ) error("Could not read the file: %s\n", fn);
+
+    char **smpls = parse_ped_samples(call, vals, n);
+    if ( !smpls )
+    {
+        smpls = (char**) malloc(sizeof(char*)*n);
+        for (i=0; i<n; i++)
+        {
+            char *s = vals[i];
+            while ( *s && !isspace(*s) ) s++;
+            int len = s-vals[i];
+            smpls[i] = (char*) malloc(len+2);
+            strncpy(smpls[i],vals[i],len);
+            smpls[i][len] = 0;
+            while ( *s && isspace(*s) ) s++;
+            int x = 2;
+            if ( *s )
+            {
+                x = (int)s[0] - '0'; // Convert ASCII digit to decimal
+                if (x != 0 && x != 1 && x != 2) error("Ploidy can only be 0, 1 or 2: %s\n", vals[i]);
+            }
+            smpls[i][len+1] = x;
+        }
+    }
+
+    for (i=0; i<n; i++) free(vals[i]);
+    free(vals);
+
+    *_n = n;
+    return smpls;
+}
+
+static void init_missed_line(args_t *args)
+{
+    int i;
+    for (i=0; i<bcf_hdr_nsamples(args->aux.hdr); i++)
+    {
+        args->aux.gts[i*2]   = bcf_gt_missing;
+        args->aux.gts[i*2+1] = bcf_int32_vector_end;
+    }
+    args->missed_line = bcf_init1();
+    bcf_update_genotypes(args->aux.hdr, args->missed_line, args->aux.gts, 2*bcf_hdr_nsamples(args->aux.hdr));
+    bcf_float_set_missing(args->missed_line->qual);
+}
+
+static void print_missed_line(bcf_sr_regions_t *regs, void *data)
+{
+    args_t *args = (args_t*) data;
+    call_t *call = &args->aux;
+    bcf1_t *missed = args->missed_line;
+
+    if ( args->flag & CF_GVCF ) error("todo: Combine --gvcf and --insert-missed\n");
+
+    char *ss = regs->line.s;
+    int i = 0;
+    while ( i<args->aux.srs->targets_als-1 && *ss )
+    {
+        if ( *ss=='\t' ) i++;
+        ss++;
+    }
+    if ( !*ss ) error("Could not parse: [%s] (%d)\n", regs->line.s,args->aux.srs->targets_als);
+
+    missed->rid  = bcf_hdr_name2id(call->hdr,regs->seq_names[regs->prev_seq]);
+    missed->pos  = regs->start;
+    bcf_update_alleles_str(call->hdr, missed,ss);
+
+    bcf_write1(args->out_fh, call->hdr, missed);
+}
+
+static void init_data(args_t *args)
+{
+    args->aux.srs = bcf_sr_init();
+
+    // Open files for input and output, initialize structures
+    if ( args->targets )
+    {
+        if ( bcf_sr_set_targets(args->aux.srs, args->targets, args->targets_is_file, args->aux.flag&CALL_CONSTR_ALLELES ? 3 : 0)<0 )
+            error("Failed to read the targets: %s\n", args->targets);
+
+        if ( args->aux.flag&CALL_CONSTR_ALLELES && args->flag&CF_INS_MISSED )
+        {
+            args->aux.srs->targets->missed_reg_handler = print_missed_line;
+            args->aux.srs->targets->missed_reg_data = args;
+        }
+    }
+    if ( args->regions )
+    {
+        if ( bcf_sr_set_regions(args->aux.srs, args->regions, args->regions_is_file)<0 )
+            error("Failed to read the targets: %s\n", args->regions);
+    }
+
+    int i;
+    if ( !bcf_sr_add_reader(args->aux.srs, args->bcf_fname) ) error("Failed to open %s: %s\n", args->bcf_fname,bcf_sr_strerror(args->aux.srs->errnum));
+
+    if ( args->nsamples && args->nsamples != bcf_hdr_nsamples(args->aux.srs->readers[0].header) )
+    {
+        args->samples_map = (int *) malloc(sizeof(int)*args->nsamples);
+        args->aux.hdr = bcf_hdr_subset(args->aux.srs->readers[0].header, args->nsamples, args->samples, args->samples_map);
+        if ( !args->aux.hdr ) error("Error occurred while subsetting samples\n");
+        for (i=0; i<args->nsamples; i++)
+            if ( args->samples_map[i]<0 ) error("No such sample: %s\n", args->samples[i]);
+        if ( !bcf_hdr_nsamples(args->aux.hdr) ) error("No matching sample found\n");
+    }
+    else
+    {
+        args->aux.hdr = bcf_hdr_dup(args->aux.srs->readers[0].header);
+        for (i=0; i<args->nsamples; i++)
+            if ( bcf_hdr_id2int(args->aux.hdr,BCF_DT_SAMPLE,args->samples[i])<0 )
+                error("No such sample: %s\n", args->samples[i]);
+    }
+
+    // Reorder ploidy and family indexes to match mpileup's output and exclude samples which are not available
+    if ( args->aux.ploidy )
+    {
+        for (i=0; i<args->aux.nfams; i++)
+        {
+            int j;
+            for (j=0; j<3; j++)
+            {
+                int k = bcf_hdr_id2int(args->aux.hdr, BCF_DT_SAMPLE, args->samples[ args->aux.fams[i].sample[j] ]);
+                if ( k<0 ) error("No such sample: %s\n", args->samples[ args->aux.fams[i].sample[j] ]);
+                args->aux.fams[i].sample[j] = k;
+            }
+        }
+        uint8_t *ploidy = (uint8_t*) calloc(bcf_hdr_nsamples(args->aux.hdr), 1);
+        for (i=0; i<args->nsamples; i++)    // i index in -s sample list
+        {
+            int j = bcf_hdr_id2int(args->aux.hdr, BCF_DT_SAMPLE, args->samples[i]);     // j index in the output VCF / subset VCF
+            if ( j<0 )
+            {
+                fprintf(stderr,"Warning: no such sample: \"%s\"\n", args->samples[i]);
+                continue;
+            }
+            ploidy[j] = args->aux.ploidy[i];
+        }
+        args->nsamples = bcf_hdr_nsamples(args->aux.hdr);
+        for (i=0; i<args->nsamples; i++)
+            assert( ploidy[i]==0 || ploidy[i]==1 || ploidy[i]==2 );
+        free(args->aux.ploidy);
+        args->aux.ploidy = ploidy;
+    }
+
+    args->out_fh = hts_open(args->output_fname, hts_bcf_wmode(args->output_type));
+    if ( args->out_fh == NULL ) error("Can't write to \"%s\": %s\n", args->output_fname, strerror(errno));
+
+    if ( args->flag & CF_QCALL )
+        return;
+
+    if ( args->flag & CF_MCALL )
+        mcall_init(&args->aux);
+
+    if ( args->flag & CF_CCALL )
+        ccall_init(&args->aux);
+
+    if ( args->flag&CF_GVCF )
+    {
+        bcf_hdr_append(args->aux.hdr,"##INFO=<ID=END,Number=1,Type=Integer,Description=\"End position of the variant described in this record\">");
+        args->gvcf.rid  = -1;
+        args->gvcf.line = bcf_init1();
+        args->gvcf.gt   = (int32_t*) malloc(2*sizeof(int32_t)*bcf_hdr_nsamples(args->aux.hdr));
+        for (i=0; i<bcf_hdr_nsamples(args->aux.hdr); i++)
+        {
+            args->gvcf.gt[2*i+0] = bcf_gt_unphased(0);
+            args->gvcf.gt[2*i+1] = bcf_gt_unphased(0);
+        }
+    }
+
+    bcf_hdr_remove(args->aux.hdr, BCF_HL_INFO, "QS");
+    bcf_hdr_remove(args->aux.hdr, BCF_HL_INFO, "I16");
+
+    bcf_hdr_append_version(args->aux.hdr, args->argc, args->argv, "bcftools_call");
+    bcf_hdr_write(args->out_fh, args->aux.hdr);
+
+    if ( args->flag&CF_INS_MISSED ) init_missed_line(args);
+}
+
+static void destroy_data(args_t *args)
+{
+    if ( args->flag & CF_CCALL ) ccall_destroy(&args->aux);
+    else if ( args->flag & CF_MCALL ) mcall_destroy(&args->aux);
+    else if ( args->flag & CF_QCALL ) qcall_destroy(&args->aux);
+    int i;
+    for (i=0; i<args->nsamples; i++) free(args->samples[i]);
+    if ( args->aux.fams )
+    {
+        for (i=0; i<args->aux.nfams; i++) free(args->aux.fams[i].name);
+        free(args->aux.fams);
+    }
+    if ( args->missed_line ) bcf_destroy(args->missed_line);
+    if ( args->gvcf.line ) bcf_destroy(args->gvcf.line);
+    free(args->gvcf.gt);
+    free(args->gvcf.dp);
+    free(args->samples);
+    free(args->samples_map);
+    free(args->aux.ploidy);
+    bcf_hdr_destroy(args->aux.hdr);
+    hts_close(args->out_fh);
+    bcf_sr_destroy(args->aux.srs);
+}
+
+void parse_novel_rate(args_t *args, const char *str)
+{
+    if ( sscanf(str,"%le,%le,%le",&args->aux.trio_Pm_SNPs,&args->aux.trio_Pm_del,&args->aux.trio_Pm_ins)==3 )  // explicit for all
+    {
+        args->aux.trio_Pm_SNPs = 1 - args->aux.trio_Pm_SNPs;
+        args->aux.trio_Pm_del  = 1 - args->aux.trio_Pm_del;
+        args->aux.trio_Pm_ins  = 1 - args->aux.trio_Pm_ins;
+    }
+    else if ( sscanf(str,"%le,%le",&args->aux.trio_Pm_SNPs,&args->aux.trio_Pm_del)==2 )   // dynamic for indels
+    {
+        args->aux.trio_Pm_SNPs = 1 - args->aux.trio_Pm_SNPs;
+        args->aux.trio_Pm_ins  = -1;    // negative value for dynamic calculation
+    }
+    else if ( sscanf(str,"%le",&args->aux.trio_Pm_SNPs)==1 )  // same for all
+    {
+        args->aux.trio_Pm_SNPs = 1 - args->aux.trio_Pm_SNPs;
+        args->aux.trio_Pm_del  = -1;
+        args->aux.trio_Pm_ins  = -1;
+    }
+    else error("Could not parse --novel-rate %s\n", str);
+}
+
+static int parse_format_flag(const char *str)
+{
+    int flag = 0;
+    const char *ss = str;
+    while ( *ss )
+    {
+        const char *se = ss;
+        while ( *se && *se!=',' ) se++;
+        if ( !strncasecmp(ss,"GQ",se-ss) ) flag |= CALL_FMT_GQ;
+        else if ( !strncasecmp(ss,"GP",se-ss) ) flag |= CALL_FMT_GP;
+        else
+        {
+            fprintf(stderr,"Could not parse \"%s\"\n", str);
+            exit(1);
+        }
+        if ( !*se ) break;
+        ss = se + 1;
+    }
+    return flag;
+}
+
+
+static void usage(args_t *args)
+{
+    fprintf(stderr, "\n");
+    fprintf(stderr, "About:   SNP/indel variant calling from VCF/BCF. To be used in conjunction with samtools mpileup.\n");
+    fprintf(stderr, "         This command replaces the former \"bcftools view\" caller. Some of the original\n");
+    fprintf(stderr, "         functionality has been temporarily lost in the process of transition to htslib,\n");
+    fprintf(stderr, "         but will be added back on popular demand. The original calling model can be\n");
+    fprintf(stderr, "         invoked with the -c option.\n");
+    fprintf(stderr, "Usage:   bcftools call [options] <in.vcf.gz>\n");
+    fprintf(stderr, "\n");
+    fprintf(stderr, "File format options:\n");
+    fprintf(stderr, "   -o, --output <file>             write output to a file [standard output]\n");
+    fprintf(stderr, "   -O, --output-type <b|u|z|v>     output type: 'b' compressed BCF; 'u' uncompressed BCF; 'z' compressed VCF; 'v' uncompressed VCF [v]\n");
+    fprintf(stderr, "   -r, --regions <region>          restrict to comma-separated list of regions\n");
+    fprintf(stderr, "   -R, --regions-file <file>       restrict to regions listed in a file\n");
+    fprintf(stderr, "   -s, --samples <list>            list of samples to include [all samples]\n");
+    fprintf(stderr, "   -S, --samples-file <file>       PED file or a file with optional second column for ploidy (0, 1 or 2) [all samples]\n");
+    fprintf(stderr, "   -t, --targets <region>          similar to -r but streams rather than index-jumps\n");
+    fprintf(stderr, "   -T, --targets-file <file>       similar to -R but streams rather than index-jumps\n");
+    fprintf(stderr, "\n");
+    fprintf(stderr, "Input/output options:\n");
+    fprintf(stderr, "   -A, --keep-alts                 keep all possible alternate alleles at variant sites\n");
+    fprintf(stderr, "   -f, --format-fields <list>      output format fields: GQ,GP (lowercase allowed) []\n");
+    fprintf(stderr, "   -g, --gvcf <minDP>              output gVCF blocks of homozygous REF calls\n");
+    fprintf(stderr, "   -i, --insert-missed             output also sites missed by mpileup but present in -T\n");
+    fprintf(stderr, "   -M, --keep-masked-ref           keep sites with masked reference allele (REF=N)\n");
+    fprintf(stderr, "   -V, --skip-variants <type>      skip indels/snps\n");
+    fprintf(stderr, "   -v, --variants-only             output variant sites only\n");
+    fprintf(stderr, "\n");
+    fprintf(stderr, "Consensus/variant calling options:\n");
+    fprintf(stderr, "   -c, --consensus-caller          the original calling method (conflicts with -m)\n");
+    fprintf(stderr, "   -C, --constrain <str>           one of: alleles, trio (see manual)\n");
+    fprintf(stderr, "   -m, --multiallelic-caller       alternative model for multiallelic and rare-variant calling (conflicts with -c)\n");
+    fprintf(stderr, "   -n, --novel-rate <float>,[...]  likelihood of novel mutation for constrained trio calling, see man page for details [1e-8,1e-9,1e-9]\n");
+    fprintf(stderr, "   -p, --pval-threshold <float>    variant if P(ref|D)<FLOAT with -c [0.5]\n");
+    fprintf(stderr, "   -P, --prior <float>             mutation rate (use bigger for greater sensitivity) [1.1e-3]\n");
+    fprintf(stderr, "   -X, --chromosome-X              haploid output for male samples (requires PED file with -s)\n");
+    fprintf(stderr, "   -Y, --chromosome-Y              haploid output for males and skips females (requires PED file with -s)\n");
+
+    // todo (and more)
+    // fprintf(stderr, "\nContrast calling and association test options:\n");
+    // fprintf(stderr, "       -1 INT    number of group-1 samples [0]\n");
+    // fprintf(stderr, "       -C FLOAT  posterior constrast for LRT<FLOAT and P(ref|D)<0.5 [%g]\n", args->aux.min_lrt);
+    // fprintf(stderr, "       -U INT    number of permutations for association testing (effective with -1) [0]\n");
+    // fprintf(stderr, "       -X FLOAT  only perform permutations for P(chi^2)<FLOAT [%g]\n", args->aux.min_perm_p);
+    fprintf(stderr, "\n");
+    exit(-1);
+}
+
+int main_vcfcall(int argc, char *argv[])
+{
+    char *samples_fname = NULL;
+    args_t args;
+    memset(&args, 0, sizeof(args_t));
+    args.argc = argc; args.argv = argv;
+    args.aux.prior_type = -1;
+    args.aux.indel_frac = -1;
+    args.aux.theta      = 1.1e-3;
+    args.aux.pref       = 0.5;
+    args.aux.min_perm_p = 0.01;
+    args.aux.min_lrt    = 1;
+    args.flag           = CF_ACGT_ONLY;
+    args.output_fname   = "-";
+    args.output_type    = FT_VCF;
+    args.aux.trio_Pm_SNPs = 1 - 1e-8;
+    args.aux.trio_Pm_ins  = args.aux.trio_Pm_del  = 1 - 1e-9;
+
+    int i, c, samples_is_file = 0;
+
+    static struct option loptions[] =
+    {
+        {"help",0,0,'h'},
+        {"gvcf",1,0,'g'},
+        {"format-fields",1,0,'f'},
+        {"output",1,0,'o'},
+        {"output-type",1,0,'O'},
+        {"regions",1,0,'r'},
+        {"regions-file",1,0,'R'},
+        {"samples",1,0,'s'},
+        {"samples-file",1,0,'S'},
+        {"targets",1,0,'t'},
+        {"targets-file",1,0,'T'},
+        {"keep-alts",0,0,'A'},
+        {"insert-missed",0,0,'i'},
+        {"skip-Ns",0,0,'N'},            // now the new default
+        {"keep-masked-refs",0,0,'M'},
+        {"skip-variants",1,0,'V'},
+        {"variants-only",0,0,'v'},
+        {"consensus-caller",0,0,'c'},
+        {"constrain",1,0,'C'},
+        {"multiallelic-caller",0,0,'m'},
+        {"pval-threshold",1,0,'p'},
+        {"prior",1,0,'P'},
+        {"chromosome-X",0,0,'X'},
+        {"chromosome-Y",0,0,'Y'},
+        {"novel-rate",1,0,'n'},
+        {0,0,0,0}
+    };
+
+    char *tmp = NULL;
+    while ((c = getopt_long(argc, argv, "h?o:O:r:R:s:S:t:T:ANMV:vcmp:C:XYn:P:f:ig:", loptions, NULL)) >= 0)
+    {
+        switch (c)
+        {
+            case 'g':
+                args.flag |= CF_GVCF;
+                args.gvcf.min_dp = strtol(optarg,&tmp,10);
+                if ( *tmp ) error("Could not parse, expected integer argument: -g %s\n", optarg);
+                break;
+            case 'f': args.aux.output_tags |= parse_format_flag(optarg); break;
+            case 'M': args.flag &= ~CF_ACGT_ONLY; break;     // keep sites where REF is N
+            case 'N': args.flag |= CF_ACGT_ONLY; break;      // omit sites where first base in REF is N (the new default)
+            case 'A': args.aux.flag |= CALL_KEEPALT; break;
+            case 'c': args.flag |= CF_CCALL; break;          // the original EM based calling method
+            case 'i': args.flag |= CF_INS_MISSED; break;
+            case 'v': args.aux.flag |= CALL_VARONLY; break;
+            case 'o': args.output_fname = optarg; break;
+            case 'O':
+                      switch (optarg[0]) {
+                          case 'b': args.output_type = FT_BCF_GZ; break;
+                          case 'u': args.output_type = FT_BCF; break;
+                          case 'z': args.output_type = FT_VCF_GZ; break;
+                          case 'v': args.output_type = FT_VCF; break;
+                          default: error("The output type \"%s\" not recognised\n", optarg);
+                      }
+                      break;
+            case 'C':
+                      if ( !strcasecmp(optarg,"alleles") ) args.aux.flag |= CALL_CONSTR_ALLELES;
+                      else if ( !strcasecmp(optarg,"trio") ) args.aux.flag |= CALL_CONSTR_TRIO;
+                      else error("Unknown argument to -C: \"%s\"\n", optarg);
+                      break;
+            case 'X': args.aux.flag |= CALL_CHR_X; break;
+            case 'Y': args.aux.flag |= CALL_CHR_Y; break;
+            case 'V':
+                      if ( !strcasecmp(optarg,"snps") ) args.flag |= CF_INDEL_ONLY;
+                      else if ( !strcasecmp(optarg,"indels") ) args.flag |= CF_NO_INDEL;
+                      else error("Unknown skip category \"%s\" (-S argument must be \"snps\" or \"indels\")\n", optarg);
+                      break;
+            case 'm': args.flag |= CF_MCALL; break;         // multiallelic calling method
+            case 'p':
+                args.aux.pref = strtod(optarg,&tmp);
+                if ( *tmp ) error("Could not parse: --pval-threshold %s\n", optarg);
+                break;
+            case 'P': args.aux.theta = strtod(optarg,&tmp);
+                      if ( *tmp ) error("Could not parse, expected float argument: -P %s\n", optarg);
+                      break;
+            case 'n': parse_novel_rate(&args,optarg); break;
+            case 'r': args.regions = optarg; break;
+            case 'R': args.regions = optarg; args.regions_is_file = 1; break;
+            case 't': args.targets = optarg; break;
+            case 'T': args.targets = optarg; args.targets_is_file = 1; break;
+            case 's': samples_fname = optarg; break;
+            case 'S': samples_fname = optarg; samples_is_file = 1; break;
+            default: usage(&args);
+        }
+    }
+    if ( optind>=argc )
+    {
+        if ( !isatty(fileno((FILE *)stdin)) ) args.bcf_fname = "-";  // reading from stdin
+        else usage(&args);
+    }
+    else args.bcf_fname = argv[optind++];
+
+    // Sanity check options and initialize
+    if ( samples_fname )
+    {
+        args.samples = read_samples(&args.aux, samples_fname, samples_is_file, &args.nsamples);
+        args.aux.ploidy = (uint8_t*) calloc(args.nsamples+1, 1);
+        args.aux.all_diploid = 1;
+        for (i=0; i<args.nsamples; i++)
+        {
+            args.aux.ploidy[i] = args.samples[i][strlen(args.samples[i]) + 1];
+            if ( args.aux.ploidy[i]!=2 ) args.aux.all_diploid = 0;
+        }
+    }
+    if ( args.flag & CF_GVCF )
+    {
+        // Force some flags to avoid unnecessary branching
+        args.aux.flag &= ~CALL_KEEPALT;
+        args.aux.flag |= CALL_VARONLY;
+    }
+    if ( (args.flag & CF_CCALL ? 1 : 0) + (args.flag & CF_MCALL ? 1 : 0) + (args.flag & CF_QCALL ? 1 : 0) > 1 ) error("Only one of -c or -m options can be given\n");
+    if ( !(args.flag & CF_CCALL) && !(args.flag & CF_MCALL) && !(args.flag & CF_QCALL) ) error("Expected -c or -m option\n");
+    if ( args.aux.n_perm && args.aux.ngrp1_samples<=0 ) error("Expected -1 with -U\n");    // not sure about this, please fix
+    if ( args.aux.flag & CALL_CONSTR_ALLELES )
+    {
+        if ( !args.targets ) error("Expected -t or -T with \"-C alleles\"\n");
+        if ( !(args.flag & CF_MCALL) ) error("The \"-C alleles\" mode requires -m\n");
+    }
+    if ( args.aux.flag & CALL_CHR_X && args.aux.flag & CALL_CHR_Y ) error("Only one of -X or -Y should be given\n");
+    if ( args.flag & CF_INS_MISSED && !(args.aux.flag&CALL_CONSTR_ALLELES) ) error("The -i option requires -C alleles\n");
+    init_data(&args);
+
+    while ( bcf_sr_next_line(args.aux.srs) )
+    {
+        bcf1_t *bcf_rec = args.aux.srs->readers[0].buffer[0];
+        if ( args.samples_map ) bcf_subset(args.aux.hdr, bcf_rec, args.nsamples, args.samples_map);
+        bcf_unpack(bcf_rec, BCF_UN_STR);
+
+        // Skip unwanted sites
+        if ( args.aux.flag & CALL_VARONLY )
+        {
+            int is_ref = 0;
+            if ( bcf_rec->n_allele==1 ) is_ref = 1;     // not a variant
+            else if ( bcf_rec->n_allele==2 )
+            {
+                // second allele is mpileup's X, not a variant
+                if ( bcf_rec->d.allele[1][0]=='X' ) is_ref = 1;
+                else if ( bcf_rec->d.allele[1][0]=='<' && bcf_rec->d.allele[1][1]=='X' && bcf_rec->d.allele[1][2]=='>' ) is_ref = 1;
+                else if ( bcf_rec->d.allele[1][0]=='<' && bcf_rec->d.allele[1][1]=='*' && bcf_rec->d.allele[1][2]=='>' ) is_ref = 1;
+            }
+            if ( is_ref )
+            {
+                // gVCF output
+                if ( args.flag & CF_GVCF ) gvcf_write(args.out_fh, &args.gvcf, args.aux.hdr, bcf_rec, 1);
+                continue;
+            }
+        }
+        if ( (args.flag & CF_INDEL_ONLY) && bcf_is_snp(bcf_rec) ) continue;    // not an indel
+        if ( (args.flag & CF_NO_INDEL) && !bcf_is_snp(bcf_rec) ) continue;     // not a SNP
+        if ( (args.flag & CF_ACGT_ONLY) && (bcf_rec->d.allele[0][0]=='N' || bcf_rec->d.allele[0][0]=='n') ) continue;   // REF[0] is 'N'
+
+        bcf_unpack(bcf_rec, BCF_UN_ALL);
+
+        // Various output modes: QCall output (todo)
+        if ( args.flag & CF_QCALL )
+        {
+            qcall(&args.aux, bcf_rec);
+            continue;
+        }
+
+        // Calling modes which output VCFs
+        int ret;
+        if ( args.flag & CF_MCALL )
+            ret = mcall(&args.aux, bcf_rec);
+        else
+            ret = ccall(&args.aux, bcf_rec);
+        if ( ret==-1 ) error("Something is wrong\n");
+
+        // gVCF output
+        if ( args.flag & CF_GVCF )
+        {
+            gvcf_write(args.out_fh, &args.gvcf, args.aux.hdr, bcf_rec, ret?0:1);
+            continue;
+        }
+
+        // Normal output
+        if ( (args.aux.flag & CALL_VARONLY) && ret==0 ) continue;     // not a variant
+        bcf_write1(args.out_fh, args.aux.hdr, bcf_rec);
+    }
+    if ( args.flag & CF_GVCF ) gvcf_write(args.out_fh, &args.gvcf, args.aux.hdr, NULL, 0);
+    if ( args.flag & CF_INS_MISSED ) bcf_sr_regions_flush(args.aux.srs->targets);
+    destroy_data(&args);
+    return 0;
+}
+
diff --git a/vcfcnv.c b/vcfcnv.c
new file mode 100644
index 0000000..7011795
--- /dev/null
+++ b/vcfcnv.c
@@ -0,0 +1,942 @@
+/* The MIT License
+
+   Copyright (c) 2014 Genome Research Ltd.
+
+   Author: Petr Danecek <pd3 at sanger.ac.uk>
+   
+   Permission is hereby granted, free of charge, to any person obtaining a copy
+   of this software and associated documentation files (the "Software"), to deal
+   in the Software without restriction, including without limitation the rights
+   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+   copies of the Software, and to permit persons to whom the Software is
+   furnished to do so, subject to the following conditions:
+   
+   The above copyright notice and this permission notice shall be included in
+   all copies or substantial portions of the Software.
+   
+   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+   THE SOFTWARE.
+
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <getopt.h>
+#include <math.h>
+#include <htslib/vcf.h>
+#include <htslib/synced_bcf_reader.h>
+#include <htslib/kstring.h>
+#include <htslib/kfunc.h>
+#include <htslib/khash_str2int.h>
+#include "bcftools.h"
+#include "HMM.h"
+
+#define DBG_HMM_PRN 0
+
+#define N_STATES 5
+#define CN0 0
+#define CN1 1
+#define CN2 2
+#define CN3 3
+#define CNx 4
+
+typedef struct
+{
+    char *name;
+    int idx;
+    double pobs[N_STATES];
+    FILE *dat_fh, *cn_fh, *summary_fh;
+    char *dat_fname, *cn_fname, *summary_fname;
+}
+sample_t;
+
+typedef struct _args_t
+{
+    bcf_srs_t *files;
+    bcf_hdr_t *hdr;
+    int prev_rid, ntot, nused;
+    sample_t query_sample, control_sample;
+
+    int nstates;    // number of states: N_STATES for one sample, N_STATES^2 for two samples
+    double baf_sigma2, lrr_sigma2;          // squared std dev of B-allele frequency and LRR distribution
+    double lrr_bias, baf_bias;              // LRR/BAF weights
+    double same_prob, ij_prob;              // prior of both samples being the same and the transition probability P(i|j)
+    double err_prob;                        // constant probability of erroneous measurement
+    double pRR, pRA, pAA, pRR_dflt, pRA_dflt, pAA_dflt;
+
+    double *tprob, *tprob_arr;  // array of transition matrices, precalculated up to ntprob_arr positions
+    int ntprob_arr;
+
+    hmm_t *hmm;
+    double *eprob;          // emission probs [nstates*nsites,msites]
+    uint32_t *sites;        // positions [nsites,msites]
+    int nsites, msites;
+
+    double baum_welch_th;
+    float plot_th;
+    FILE *summary_fh;
+    char **argv, *regions_list, *summary_fname, *output_dir;
+    char *targets_list, *af_fname;
+    int argc;
+}
+args_t;
+
+FILE *open_file(char **fname, const char *mode, const char *fmt, ...);
+
+
+static inline void hmm2cn_state(int nstates, int i, int *a, int *b)
+{
+    *a = i / N_STATES;
+    *b = i - (*a)*N_STATES;
+}
+static double *init_tprob_matrix(int ndim, double ij_prob, double same_prob)
+{
+    int i,j;
+    double *mat = (double*) malloc(sizeof(double)*ndim*ndim);
+
+    assert( ndim==N_STATES || ndim==N_STATES*N_STATES);
+    double pii = 1 - ij_prob*(N_STATES-1);
+
+    if ( ndim==N_STATES )   // one sample
+    {
+        if ( pii < ij_prob ) error("Error: -x set a bit too high, P(x|x) < P(x|y): %e vs %e\n", pii,ij_prob);
+        for (j=0; j<ndim; j++)
+        {
+            double sum = 0;
+            for (i=0; i<ndim; i++)
+            {
+                // transition from j-th to i-th state
+                if ( i==j )
+                    MAT(mat,ndim,i,j) = pii;
+                else
+                    MAT(mat,ndim,i,j) = ij_prob;
+                sum += MAT(mat,ndim,i,j);
+            }
+            assert( fabs(sum - 1.0)<1e-15 );
+        }
+    }
+    else    // two samples
+    {
+        for (j=0; j<ndim; j++)
+        {
+            int ja,jb;
+            hmm2cn_state(ndim, j, &ja, &jb);
+
+            double sum = 0;
+            for (i=0; i<ndim; i++)
+            {
+                int ia,ib;
+                hmm2cn_state(ndim, i, &ia, &ib);
+
+                // transition from (ja,jb)-th to (ia,ib)-th state
+                double pa = ja==ia ? pii : ij_prob;
+                double pb = jb==ib ? pii : ij_prob;
+
+                if ( ia==ib && ja==jb )
+                    MAT(mat,ndim,i,j) = pa*pb - pa*pb*same_prob + sqrt(pa*pb)*same_prob;
+                else if ( ia==ib )
+                    MAT(mat,ndim,i,j) = pa*pb;
+                else
+                    MAT(mat,ndim,i,j) = pa*pb*(1-same_prob);
+
+                sum += MAT(mat,ndim,i,j);
+            }
+            for (i=0; i<ndim; i++) MAT(mat,ndim,i,j) /= sum;
+        }
+    }
+    return mat;
+}
+
+static void init_sample_files(sample_t *smpl, char *dir)
+{
+    smpl->dat_fh = open_file(&smpl->dat_fname,"w","%s/dat.%s.tab",dir,smpl->name);
+    smpl->cn_fh  = open_file(&smpl->cn_fname,"w","%s/cn.%s.tab",dir,smpl->name);
+    smpl->summary_fh = open_file(&smpl->summary_fname,"w","%s/summary.%s.tab",dir,smpl->name);
+    fprintf(smpl->dat_fh,"# [1]Chromosome\t[2]Position\t[3]BAF\t[4]LRR\n");
+    fprintf(smpl->cn_fh,"# [1]Chromosome\t[2]Position\t[3]CN\t[4]P(CN0)\t[5]P(CN1)\t[6]P(CN2)\t[7]P(CN3)\t[8]P(CNx)\n");
+    fprintf(smpl->summary_fh,"# RG, Regions [2]Chromosome\t[3]Start\t[4]End\t[5]Copy Number state\t[6]Quality\n");
+}
+static void close_sample_files(sample_t *smpl)
+{
+    fclose(smpl->dat_fh);
+    fclose(smpl->cn_fh);
+    fclose(smpl->summary_fh);
+}
+
+static void init_data(args_t *args)
+{
+    args->prev_rid = -1;
+    args->hdr = args->files->readers[0].header;
+
+    if ( !args->query_sample.name )
+    {
+        if ( bcf_hdr_nsamples(args->hdr)>1 ) error("Multi-sample VCF, missing the -s option\n");
+        args->query_sample.name = strdup(args->hdr->samples[0]);
+    }
+    else 
+        if ( bcf_hdr_id2int(args->hdr,BCF_DT_SAMPLE,args->query_sample.name)<0 ) error("The sample \"%s\" not found\n", args->query_sample.name);
+    if ( !args->files->readers[0].file->is_bin )
+    {
+        int ret;
+        kstring_t tmp = {0,0,0};
+        if ( args->control_sample.name )
+        {
+            ksprintf(&tmp, "%s,%s", args->query_sample.name,args->control_sample.name);
+            ret = bcf_hdr_set_samples(args->hdr, tmp.s, 0);
+        }
+        else
+        {
+            ret = bcf_hdr_set_samples(args->hdr, args->query_sample.name, 0);
+            tmp.s = args->query_sample.name;
+        }
+        if ( ret<0 ) error("Error parsing the list of samples: %s\n", tmp.s);
+        else if ( ret>0 ) error("The sample not found in the VCF: %s\n", ret==1 ? args->query_sample.name : args->control_sample.name);
+
+        if ( args->control_sample.name ) free(tmp.s);
+    }
+    args->query_sample.idx = bcf_hdr_id2int(args->hdr,BCF_DT_SAMPLE,args->query_sample.name);
+    args->control_sample.idx = args->control_sample.name ? bcf_hdr_id2int(args->hdr,BCF_DT_SAMPLE,args->control_sample.name) : -1;
+    args->nstates = args->control_sample.name ? N_STATES*N_STATES : N_STATES;
+    args->tprob = init_tprob_matrix(args->nstates, args->ij_prob, args->same_prob);
+    args->hmm = hmm_init(args->nstates, args->tprob, 10000);
+
+    args->summary_fh = stdout;
+    if ( args->output_dir )
+    {
+        init_sample_files(&args->query_sample, args->output_dir);
+        if ( args->control_sample.name )
+        {
+            init_sample_files(&args->control_sample, args->output_dir);
+            args->summary_fh = open_file(&args->summary_fname,"w","%s/summary.tab",args->output_dir);
+        }
+        else
+            args->summary_fh = NULL;    // one sample only, no two-file summary
+    }
+
+    int i;
+    FILE *fh = args->summary_fh ? args->summary_fh : args->query_sample.summary_fh;
+
+    fprintf(fh, "# This file was produced by: bcftools cnv(%s+htslib-%s)\n", bcftools_version(),hts_version());
+    fprintf(fh, "# The command line was:\tbcftools %s", args->argv[0]);
+    for (i=1; i<args->argc; i++) fprintf(fh, " %s",args->argv[i]);
+    if ( args->control_sample.name )
+        fprintf(fh, "\n#\n"
+                "# RG, Regions\t[2]Chromosome\t[3]Start\t[4]End\t[5]Copy number:%s\t[6]Copy number:%s\t[7]Quality\n",
+                args->query_sample.name,args->control_sample.name
+               );
+    else
+        fprintf(fh, "\n#\n"
+                "# RG, Regions\t[2]Chromosome\t[3]Start\t[4]End\t[5]Copy number:%s\t[6]Quality\n",
+                args->query_sample.name
+               );
+}
+
+char *msprintf(const char *fmt, ...);
+static void py_plot_cnv(char *script, float th)
+{
+    if ( th>100 ) return;   // create no plots
+
+    char *cmd = msprintf("python %s -p %f", script, th);
+    int ret = system(cmd);
+    if ( ret) fprintf(stderr, "The command returned non-zero status %d: %s\n", ret, cmd);
+    free(cmd);
+}
+
+static void plot_sample(args_t *args, sample_t *smpl)
+{
+    char *fname;
+    FILE *fp = open_file(&fname,"w","%s/plot.%s.py",args->output_dir,smpl->name);
+    fprintf(fp,
+            "import matplotlib as mpl\n"
+            "mpl.use('Agg')\n"
+            "import matplotlib.pyplot as plt\n"
+            "import csv\n"
+            "import numpy as np\n"
+            "csv.register_dialect('tab', delimiter='\\t', quoting=csv.QUOTE_NONE)\n"
+            "\n"
+            "dat = {}\n"
+            "with open('%s', 'rb') as f:\n"
+            "    reader = csv.reader(f, 'tab')\n"
+            "    for row in reader:\n"
+            "        chr = row[0]\n"
+            "        if chr[0]=='#': continue\n"
+            "        if chr not in dat: dat[chr] = []\n"
+            "        dat[chr].append([row[1], float(row[2]), float(row[3])])\n"
+            "\n"
+            "cnv = {}\n"
+            "with open('%s', 'rb') as f:\n"
+            "    reader = csv.reader(f, 'tab')\n"
+            "    for row in reader:\n"
+            "        chr = row[0]\n"
+            "        if chr[0]=='#': continue\n"
+            "        if chr not in cnv: cnv[chr] = []\n"
+            "        row[2] = int(row[2]) + 0.5\n"
+            "        cnv[chr].append(row[1:])\n"
+            "\n"
+            "for chr in dat:\n"
+            "    fig,(ax1, ax2, ax3) = plt.subplots(3,1,figsize=(10,8),sharex=True)\n"
+            "    ax1.plot([x[0] for x in dat[chr]],[x[2] for x in dat[chr]], '.', ms=3)\n"
+            "    ax2.plot([x[0] for x in dat[chr]],[x[1] for x in dat[chr]], '.', ms=3)\n"
+            "    cn_dat = cnv[chr]\n"
+            "    xgrid = [float(x[0]) for x in cn_dat]\n"
+            "    ygrid = np.linspace(0,5,6)\n"
+            "    xgrid, ygrid = np.meshgrid(xgrid, ygrid)\n"
+            "    heat = np.zeros_like(xgrid)\n"
+            "    for x in range(len(heat[0])-1):\n"
+            "       heat[0][x] = cn_dat[x][2]\n"
+            "       heat[1][x] = cn_dat[x][3]\n"
+            "       heat[2][x] = cn_dat[x][4]\n"
+            "       heat[3][x] = cn_dat[x][5]\n"
+            "       heat[4][x] = cn_dat[x][6]\n"
+            "    mesh = ax3.pcolormesh(xgrid, ygrid, heat, cmap='bwr_r')\n"
+            "    mesh.set_clim(vmin=-1,vmax=1)\n"
+            "    ax3.plot([x[0] for x in cn_dat],[x[1] for x in cn_dat],'.-',ms=3,color='black')\n"
+            "    fig.suptitle('%s (chr '+chr+')')\n"
+            "    ax1.set_title('Log-R intensities Ratio',fontsize=10)\n"
+            "    ax2.set_title('B-Allele Frequency',fontsize=10)\n"
+            "    ax3.set_title('Copy Number Variation',fontsize=10)\n"
+            "    ax1.set_ylabel('LRR')\n"
+            "    ax2.set_ylabel('BAF')\n"
+            "    ax3.set_ylabel('CN')\n"
+            "    ax3.set_xlabel('Coordinate (chrom '+chr+')',fontsize=10)\n"
+            "    ax3.set_ylim(-0.1,5.1)\n"
+            "    ax3.set_yticks([0.5,1.5,2.5,3.5,4.5])\n"
+            "    ax3.set_yticklabels(['CN0','CN1','CN2','CN3','CN4'])\n"
+            "    plt.subplots_adjust(left=0.08,right=0.95,bottom=0.08,top=0.92)\n"
+            "    plt.savefig('%s/plot.%s.chr'+chr+'.png')\n"
+            "    plt.close()\n"
+            "\n", 
+            smpl->dat_fname,smpl->cn_fname,smpl->name,args->output_dir,smpl->name
+    );
+    fclose(fp);
+
+    py_plot_cnv(fname, args->plot_th);
+    free(fname);
+}
+
+static void create_plots(args_t *args)
+{
+    close_sample_files(&args->query_sample);
+    if ( args->control_sample.name ) close_sample_files(&args->control_sample);
+    if ( args->summary_fh ) fclose(args->summary_fh);
+
+    if ( !args->control_sample.name )
+    {
+        plot_sample(args, &args->query_sample);
+        return;
+    }
+
+    char *fname;
+    FILE *fp = open_file(&fname,"w","%s/plot.%s.%s.py",args->output_dir,args->control_sample.name,args->query_sample.name);
+    fprintf(fp,
+            "import matplotlib as mpl\n"
+            "mpl.use('Agg')\n"
+            "import matplotlib.pyplot as plt\n"
+            "import csv,argparse\n"
+            "import numpy as np\n"
+            "csv.register_dialect('tab', delimiter='\\t', quoting=csv.QUOTE_NONE)\n"
+            "\n"
+            "control_sample = '%s'\n"
+            "query_sample   = '%s'\n"
+            "\n"
+            "parser = argparse.ArgumentParser()\n"
+            "parser.add_argument('-p', '--plot-threshold', type=float)\n"
+            "parser.add_argument('-c', '--chromosome')\n"
+            "args = parser.parse_args()\n"
+            "if args.plot_threshold==None: args.plot_threshold = 0\n"
+            "\n"
+            "def chroms_to_plot(th):\n"
+            "   dat = {}\n"
+            "   with open('%s/summary.tab', 'rb') as f:\n"
+            "       reader = csv.reader(f, 'tab')\n"
+            "       for row in reader:\n"
+            "           if row[0]!='RG': continue\n"
+            "           chr   = row[1]\n"
+            "           start = row[2]\n"
+            "           end   = row[3]\n"
+            "           qual  = float(row[6])\n"
+            "           if row[4]==row[5] and args.plot_threshold!=0: continue\n"
+            "           if chr not in dat: dat[chr] = 0.0\n"
+            "           if qual > dat[chr]: dat[chr] = qual\n"
+            "   out = {}\n"
+            "   for chr in dat:\n"
+            "       if (chr not in dat) or dat[chr]<th: continue\n"
+            "       out[chr] = 1\n"
+            "   return out\n"
+            "if args.chromosome!=None:\n"
+            "   plot_chroms = { args.chromosome:1 }\n"
+            "else:\n"
+            "   plot_chroms = chroms_to_plot(args.plot_threshold)\n"
+            "\n"
+            "def read_dat(file,dat):\n"
+            "   with open(file, 'rb') as f:\n"
+            "       reader = csv.reader(f, 'tab')\n"
+            "       for row in reader:\n"
+            "           chr = row[0]\n"
+            "           if chr[0]=='#': continue\n"
+            "           if chr not in plot_chroms: continue\n"
+            "           if chr not in dat: dat[chr] = []\n"
+            "           dat[chr].append([row[1], float(row[2]), float(row[3])])\n"
+            "def read_cnv(file,cnv):\n"
+            "   with open(file, 'rb') as f:\n"
+            "       reader = csv.reader(f, 'tab')\n"
+            "       for row in reader:\n"
+            "           chr = row[0]\n"
+            "           if chr[0]=='#': continue\n"
+            "           if chr not in cnv: cnv[chr] = []\n"
+            "           row[2] = int(row[2]) + 0.5\n"
+            "           cnv[chr].append(row[1:])\n"
+            "def find_diffs(a,b):\n"
+            "    out = []\n"
+            "    diff = []\n"
+            "    for i in range(len(a)):\n"
+            "        if a[i][1]!=b[i][1]:\n"
+            "            if i>0: diff.append([b[i-1][0],b[i-1][1],a[i-1][1]])\n"
+            "            diff.append([b[i][0],b[i][1],a[i][1]])\n"
+            "        elif len(diff):\n"
+            "            diff.append([b[i][0],b[i][1],a[i][1]])\n"
+            "            out.append(diff)\n"
+            "            diff = []\n"
+            "    if len(diff): out.append(diff)\n"
+            "    return out\n"
+            "\n"
+            "control_dat = {}\n"
+            "control_cnv = {}\n"
+            "query_dat   = {}\n"
+            "query_cnv   = {}\n"
+            "read_dat('%s',control_dat)\n"
+            "read_dat('%s',query_dat)\n"
+            "read_cnv('%s',control_cnv)\n"
+            "read_cnv('%s',query_cnv)\n"
+            "\n"
+            "for chr in query_dat:\n"
+            "    fig,(ax1,ax2,ax3,ax4,ax5,ax6) = plt.subplots(6,1,figsize=(10,8),sharex=True)\n"
+            "    ax1.plot([x[0] for x in control_dat[chr]],[x[2] for x in control_dat[chr]], '.', ms=3,color='red')\n"
+            "    ax2.plot([x[0] for x in control_dat[chr]],[x[1] for x in control_dat[chr]], '.', ms=3,color='red')\n"
+            "    cn_dat = control_cnv[chr]\n"
+            "    xgrid = [float(x[0]) for x in cn_dat]\n"
+            "    ygrid = np.linspace(0,5,6)\n"
+            "    xgrid, ygrid = np.meshgrid(xgrid, ygrid)\n"
+            "    heat = np.zeros_like(xgrid)\n"
+            "    for x in range(len(heat[0])-1):\n"
+            "       heat[0][x] = cn_dat[x][2]\n"
+            "       heat[1][x] = cn_dat[x][3]\n"
+            "       heat[2][x] = cn_dat[x][4]\n"
+            "       heat[3][x] = cn_dat[x][5]\n"
+            "       heat[4][x] = cn_dat[x][6]\n"
+            "    mesh = ax3.pcolormesh(xgrid, ygrid, heat, cmap='bwr')\n"
+            "    mesh.set_clim(vmin=-1,vmax=1)\n"
+            "    ax3.plot([x[0] for x in cn_dat],[x[1] for x in cn_dat],'-',ms=3,color='black',lw=1.7)\n"
+            "\n"
+            "    ax6.plot([x[0] for x in query_dat[chr]],[x[2] for x in query_dat[chr]], '.', ms=3)\n"
+            "    ax5.plot([x[0] for x in query_dat[chr]],[x[1] for x in query_dat[chr]], '.', ms=3)\n"
+            "    cn_dat = query_cnv[chr]\n"
+            "    xgrid = [float(x[0]) for x in cn_dat]\n"
+            "    ygrid = np.linspace(0,5,6)\n"
+            "    xgrid, ygrid = np.meshgrid(xgrid, ygrid)\n"
+            "    heat = np.zeros_like(xgrid)\n"
+            "    for x in range(len(heat[0])-1):\n"
+            "       heat[0][x] = cn_dat[x][2]\n"
+            "       heat[1][x] = cn_dat[x][3]\n"
+            "       heat[2][x] = cn_dat[x][4]\n"
+            "       heat[3][x] = cn_dat[x][5]\n"
+            "       heat[4][x] = cn_dat[x][6]\n"
+            "    mesh = ax4.pcolormesh(xgrid, ygrid, heat, cmap='bwr_r')\n"
+            "    mesh.set_clim(vmin=-1,vmax=1)\n"
+            "    ax4.plot([x[0] for x in cn_dat],[x[1] for x in cn_dat],'-',ms=3,color='black',lw=1.7)\n"
+            "    ax3.annotate(control_sample, xy=(0.02,0.1), xycoords='axes fraction', color='red',fontsize=12, va='bottom',ha='left')\n"
+            "    ax4.annotate(query_sample, xy=(0.02,0.9), xycoords='axes fraction', color='blue',fontsize=12, va='top',ha='left')\n"
+            "\n"
+            "    diffs = find_diffs(control_cnv[chr],query_cnv[chr])\n"
+            "    for diff in diffs:\n"
+            "        ax3.plot([x[0] for x in diff],[x[1] for x in diff],'-',ms=3,color='blue',lw=1.7)\n"
+            "        ax4.plot([x[0] for x in diff],[x[2] for x in diff],'-',ms=3,color='red',lw=1.7)\n"
+            "\n"
+            "    fig.suptitle('chr '+chr+', '+control_sample+' vs '+query_sample)\n"
+            "    ax1.tick_params(axis='both', labelsize=8)\n"
+            "    ax2.tick_params(axis='both', labelsize=8)\n"
+            "    ax3.tick_params(axis='both', labelsize=8)\n"
+            "    ax4.tick_params(axis='both', labelsize=8)\n"
+            "    ax5.tick_params(axis='both', labelsize=8)\n"
+            "    ax6.tick_params(axis='both', labelsize=8)\n"
+            "    ax6.set_xlabel('Coordinate (chrom '+chr+')',fontsize=8)\n"
+            "    ax1.set_ylabel('LRR')\n"
+            "    ax2.set_ylabel('BAF')\n"
+            "    ax3.set_ylabel('CN')\n"
+            "    ax6.set_ylabel('LRR')\n"
+            "    ax5.set_ylabel('BAF')\n"
+            "    ax4.set_ylabel('CN')\n"
+            "    ax3.set_ylim(-0.1,5.1)\n"
+            "    ax3.set_yticks([0.5,1.5,2.5,3.5,4.5])\n"
+            "    ax3.set_yticklabels(['CN0','CN1','CN2','CN3','CN4'])\n"
+            "    ax4.set_ylim(-0.1,5.1)\n"
+            "    ax4.set_yticks([0.5,1.5,2.5,3.5,4.5])\n"
+            "    ax4.set_yticklabels(['CN0','CN1','CN2','CN3','CN4'])\n"
+            "    plt.subplots_adjust(left=0.08,right=0.95,bottom=0.08,top=0.92,hspace=0)\n"
+            "    plt.savefig('%s/plot.%s.%s.chr'+chr+'.png')\n"
+            "    plt.close()\n"
+            "\n", 
+            args->control_sample.name,args->query_sample.name,
+            args->output_dir,
+            args->control_sample.dat_fname,args->query_sample.dat_fname,
+            args->control_sample.cn_fname,args->query_sample.cn_fname,
+            args->output_dir,args->control_sample.name,args->query_sample.name
+        );
+        fclose(fp);
+
+    py_plot_cnv(fname,args->plot_th);
+    free(fname);
+}
+
+static void destroy_data(args_t *args)
+{
+    bcf_sr_destroy(args->files);
+    hmm_destroy(args->hmm);
+    free(args->sites);
+    free(args->eprob);
+    free(args->tprob);
+    free(args->summary_fname);
+    free(args->query_sample.name);
+    free(args->query_sample.dat_fname);
+    free(args->query_sample.cn_fname);
+    free(args->query_sample.summary_fname);
+    free(args->control_sample.dat_fname);
+    free(args->control_sample.cn_fname);
+    free(args->control_sample.summary_fname);
+}
+
+static inline char copy_number_state(args_t *args, int istate, int ismpl)
+{
+    char code[] = "01234";
+    if ( !args->control_sample.name ) return code[istate];
+    int idx = ismpl ? istate - (istate/N_STATES)*N_STATES : istate/N_STATES;
+    return code[idx];
+}
+
+static double phred_score(double prob)
+{
+    if ( prob==0 ) return 99;
+    prob = -4.3429*log(prob);
+    return prob>99 ? 99 : prob;
+}
+
+static double avg_ii_prob(int n, double *mat)
+{
+    int i;
+    double avg = 0;
+    for (i=0; i<n; i++) avg += MAT(mat,n,i,i);
+    return avg/n;
+}
+
+static void cnv_flush_viterbi(args_t *args)
+{
+    if ( !args->nsites ) return;
+
+    hmm_t *hmm = args->hmm;
+    hmm_set_tprob(args->hmm, args->tprob, 10000);
+    while ( args->baum_welch_th!=0 )
+    {
+        double ori_ii = avg_ii_prob(hmm->nstates,hmm->tprob_arr);
+        hmm_run_baum_welch(hmm, args->nsites, args->eprob, args->sites);
+        double new_ii = avg_ii_prob(hmm->nstates,hmm->tprob_arr);
+        fprintf(stderr,"%e\t%e\t%e\n", ori_ii,new_ii,new_ii-ori_ii);
+        double *tprob = init_tprob_matrix(hmm->nstates, 1-new_ii, args->same_prob);
+        hmm_set_tprob(args->hmm, tprob, 10000);
+        free(tprob);
+        if ( fabs(new_ii - ori_ii) < args->baum_welch_th )
+        {
+            int i,j;
+            for (i=0; i<hmm->nstates; i++)
+            {
+                for (j=0; j<hmm->nstates; j++)
+                {
+                    printf(" %.15f", MAT(hmm->tprob_arr,hmm->nstates,j,i));
+                }
+                printf("\n");
+            }
+            break;
+        }
+    }
+    hmm_run_viterbi(hmm, args->nsites, args->eprob, args->sites);
+    hmm_run_fwd_bwd(hmm, args->nsites, args->eprob, args->sites);
+
+
+    // Output the results
+    double qual = 0;
+    int i,j, isite, start_cn = hmm->vpath[0], start_pos = args->sites[0], istart_pos = 0;
+    for (isite=0; isite<args->nsites; isite++)
+    {
+        int state = hmm->vpath[args->nstates*isite];
+        double *pval = hmm->fwd + isite*args->nstates;
+
+        qual += pval[start_cn];
+
+        // output CN and fwd-bwd likelihood for each site
+        if ( args->query_sample.cn_fh )
+        {
+            fprintf(args->query_sample.cn_fh, "%s\t%d\t%c", bcf_hdr_id2name(args->hdr,args->prev_rid), args->sites[isite]+1, copy_number_state(args,state,0));
+            if ( !args->control_sample.cn_fh )
+                for (i=0; i<args->nstates; i++) fprintf(args->query_sample.cn_fh, "\t%f", pval[i]);
+            else
+                for (i=0; i<N_STATES; i++)
+                {
+                    double sum = 0;
+                    for (j=0; j<N_STATES; j++) sum += pval[i*N_STATES+j];
+                    fprintf(args->query_sample.cn_fh, "\t%f", sum);
+                }
+            fprintf(args->query_sample.cn_fh, "\n");
+        }
+        if ( args->control_sample.cn_fh )
+        {
+            fprintf(args->control_sample.cn_fh, "%s\t%d\t%c", bcf_hdr_id2name(args->hdr,args->prev_rid), args->sites[isite]+1, copy_number_state(args,state,1));
+            for (i=0; i<N_STATES; i++)
+            {
+                double sum = 0;
+                for (j=0; j<N_STATES; j++) sum += pval[i+N_STATES*j];
+                fprintf(args->control_sample.cn_fh, "\t%f", sum);
+            }
+            fprintf(args->control_sample.cn_fh, "\n");
+        }
+
+        if ( start_cn != state )
+        {
+            char start_cn_query = copy_number_state(args,start_cn,0);
+            qual = phred_score(1 - qual/(isite - istart_pos));
+            fprintf(args->query_sample.summary_fh,"RG\t%s\t%d\t%d\t%c\t%.1f\n",bcf_hdr_id2name(args->hdr,args->prev_rid), start_pos+1, args->sites[isite],start_cn_query,qual);
+
+            if ( args->control_sample.name )
+            {
+                // regions 0-based, half-open
+                char start_cn_ctrl = copy_number_state(args,start_cn,1);
+                fprintf(args->control_sample.summary_fh,"RG\t%s\t%d\t%d\t%c\t%.1f\n",bcf_hdr_id2name(args->hdr,args->prev_rid), start_pos+1, args->sites[isite],start_cn_ctrl,qual);
+                fprintf(args->summary_fh,"RG\t%s\t%d\t%d\t%c\t%c\t%.1f\n",bcf_hdr_id2name(args->hdr,args->prev_rid), start_pos+1, args->sites[isite],start_cn_query,start_cn_ctrl,qual);
+            }
+
+            istart_pos = isite;
+            start_pos = args->sites[isite];
+            start_cn = state;
+            qual = 0;
+        }
+    }
+    qual = phred_score(1 - qual/(isite - istart_pos));
+    char start_cn_query = copy_number_state(args,start_cn,0);
+    fprintf(args->query_sample.summary_fh,"RG\t%s\t%d\t%d\t%c\t%.1f\n",bcf_hdr_id2name(args->hdr,args->prev_rid), start_pos+1, args->sites[isite-1]+1,start_cn_query,qual);
+    if ( args->control_sample.name )
+    {
+        char start_cn_ctrl = copy_number_state(args,start_cn,1);
+        fprintf(args->control_sample.summary_fh,"RG\t%s\t%d\t%d\t%c\t%.1f\n",bcf_hdr_id2name(args->hdr,args->prev_rid), start_pos+1, args->sites[isite-1]+1,start_cn_ctrl,qual);
+        fprintf(args->summary_fh,"RG\t%s\t%d\t%d\t%c\t%c\t%.1f\n",bcf_hdr_id2name(args->hdr,args->prev_rid), start_pos+1, args->sites[isite-1]+1,start_cn_query,start_cn_ctrl,qual);
+    }
+}
+
+static int set_observed_prob(args_t *args, bcf_fmt_t *baf_fmt, bcf_fmt_t *lrr_fmt, sample_t *smpl)
+{
+    float baf, lrr;
+    baf = ((float*)(baf_fmt->p + baf_fmt->size*smpl->idx))[0];
+    if ( bcf_float_is_missing(baf) || isnan(baf) ) baf = -0.1;    // arbitrary negative value == missing value
+
+    lrr = ((float*)(lrr_fmt->p + lrr_fmt->size*smpl->idx))[0];
+    if ( bcf_float_is_missing(lrr) || isnan(lrr) ) baf = -0.1;
+
+    if ( baf>=0 )    // skip missing values
+        fprintf(smpl->dat_fh,"%s\t%d\t%.3f\t%.3f\n",bcf_hdr_id2name(args->hdr,args->prev_rid), args->sites[args->nsites-1]+1,baf,lrr);
+
+    if ( baf<0 )
+    {
+        // no call: either some technical issue or the call could not be made because it is CN0
+        int i;
+        smpl->pobs[CN0] = 0.5;
+        for (i=1; i<N_STATES; i++) smpl->pobs[i] = (1.0-smpl->pobs[CN0])/(N_STATES-1);
+        return 0;
+    }
+
+    double pk0, pk14, pk13, pk12, pk23, pk34, pk1;
+    pk0  = exp(-baf*baf/args->baf_sigma2);
+    pk14 = exp(-(baf-1/4.)*(baf-1/4.)/args->baf_sigma2);
+    pk13 = exp(-(baf-1/3.)*(baf-1/3.)/args->baf_sigma2);
+    pk12 = exp(-(baf-1/2.)*(baf-1/2.)/args->baf_sigma2);
+    pk23 = exp(-(baf-2/3.)*(baf-2/3.)/args->baf_sigma2);
+    pk34 = exp(-(baf-3/4.)*(baf-3/4.)/args->baf_sigma2);
+    pk1  = exp(-(baf-1.0)*(baf-1.0)/args->baf_sigma2);
+
+    double cn1_baf, cn2_baf, cn3_baf, cn4_baf;
+    cn1_baf = pk0*(args->pRR+args->pRA/2.)  + pk1*(args->pAA+args->pRA/2.);
+    cn2_baf = pk0*args->pRR + pk1*args->pAA + pk12*args->pRA;
+    cn3_baf = pk0*args->pRR + pk1*args->pAA + (pk13 + pk23)*args->pRA/2.;
+    cn4_baf = pk0*args->pRR + pk1*args->pAA + (pk14 + pk12 + pk34)*args->pRA/3.;
+
+    double cn1_lrr, cn2_lrr, cn3_lrr, cn4_lrr;
+    cn1_lrr = exp(-(lrr + 0.45)*(lrr + 0.45)/args->lrr_sigma2);
+    cn2_lrr = exp(-(lrr - 0.00)*(lrr - 0.00)/args->lrr_sigma2);
+    cn3_lrr = exp(-(lrr - 0.30)*(lrr - 0.30)/args->lrr_sigma2);
+    cn4_lrr = exp(-(lrr - 0.75)*(lrr - 0.75)/args->lrr_sigma2);
+
+    smpl->pobs[CN0] = 0;
+    smpl->pobs[CN1] = args->err_prob + (1 - args->baf_bias + args->baf_bias*cn1_baf)*(1 - args->lrr_bias + args->lrr_bias*cn1_lrr);
+    smpl->pobs[CN2] = args->err_prob + (1 - args->baf_bias + args->baf_bias*cn2_baf)*(1 - args->lrr_bias + args->lrr_bias*cn2_lrr);
+    smpl->pobs[CN3] = args->err_prob + (1 - args->baf_bias + args->baf_bias*cn3_baf)*(1 - args->lrr_bias + args->lrr_bias*cn3_lrr);
+    smpl->pobs[CNx] = args->err_prob + (1 - args->baf_bias + args->baf_bias*cn4_baf)*(1 - args->lrr_bias + args->lrr_bias*cn4_lrr);
+
+    return 0;
+}
+
+static void set_emission_prob(args_t *args)
+{
+    double *eprob = &args->eprob[args->nstates*(args->nsites-1)];
+    int i;
+    for (i=0; i<N_STATES; i++)
+        eprob[i] = args->query_sample.pobs[i];
+}
+
+static void set_emission_prob2(args_t *args)
+{
+    double *eprob = &args->eprob[args->nstates*(args->nsites-1)];
+    int i, j;
+    for (i=0; i<N_STATES; i++)
+    {
+        for (j=0; j<N_STATES; j++)
+        {
+            eprob[i*N_STATES+j] = args->query_sample.pobs[i]*args->control_sample.pobs[j];
+        }
+    }
+}
+
+int read_AF(bcf_sr_regions_t *tgt, bcf1_t *line, double *alt_freq);
+
+static void cnv_next_line(args_t *args, bcf1_t *line)
+{
+    if ( !line ) 
+    {
+        // Done, flush viterbi
+        cnv_flush_viterbi(args);
+        return;
+    }
+
+    if ( line->rid!=args->prev_rid )
+    {
+        // New chromosome
+        cnv_flush_viterbi(args);
+        args->prev_rid = line->rid;
+        args->nsites = 0;
+    }
+
+    // Process line
+    args->ntot++;
+
+    bcf_fmt_t *baf_fmt, *lrr_fmt;
+    if ( !(baf_fmt = bcf_get_fmt(args->hdr, line, "BAF")) ) return; 
+    if ( !(lrr_fmt = bcf_get_fmt(args->hdr, line, "LRR")) ) return;
+
+    // Realloc buffers needed by viterbi and fwd-bwd
+    args->nsites++;
+    int m = args->msites;
+    hts_expand(uint32_t,args->nsites,args->msites,args->sites);
+    if ( args->msites!=m )
+        args->eprob = (double*) realloc(args->eprob,sizeof(double)*args->msites*args->nstates);
+    args->sites[args->nsites-1] = line->pos;
+
+    double alt_freq;
+    if ( !args->af_fname || read_AF(args->files->targets, line, &alt_freq) < 0 )
+    {
+        args->pRR = args->pRR_dflt;
+        args->pRA = args->pRA_dflt;
+        args->pAA = args->pAA_dflt;
+    }
+    else
+    {
+        args->pRR = (1 - alt_freq)*(1 - alt_freq);
+        args->pRA = 2*(1 - alt_freq)*alt_freq;
+        args->pAA = alt_freq*alt_freq;
+    }
+
+    int ret = set_observed_prob(args, baf_fmt,lrr_fmt, &args->query_sample);
+    if ( ret<0 ) 
+    {
+        args->nsites--;
+        return;
+    }
+    if ( args->control_sample.name )
+    {
+        ret = set_observed_prob(args, baf_fmt,lrr_fmt, &args->control_sample);
+        if ( ret<0 )
+        {
+            args->nsites--;
+            return;
+        }
+    }
+
+    if ( args->control_sample.name )
+        set_emission_prob2(args);
+    else
+        set_emission_prob(args);
+
+    args->nused++;
+}
+
+static void usage(args_t *args)
+{
+    fprintf(stderr, "\n");
+    fprintf(stderr, "About:   Copy number variation caller, requires Illumina's B-allele frequency (BAF) and Log R\n");
+    fprintf(stderr, "         Ratio intensity (LRR). The HMM considers the following copy number states: CN 2\n");
+    fprintf(stderr, "         (normal), 1 (single-copy loss), 0 (complete loss), 3 (single-copy gain), x (other)\n");
+    fprintf(stderr, "Usage:   bcftools cnv [OPTIONS] <file.vcf>\n");
+    fprintf(stderr, "General Options:\n");
+    fprintf(stderr, "    -c, --control-sample <string>      optional control sample name to highlight differences\n");
+    fprintf(stderr, "    -f, --AF-file <file>               read allele frequencies from file (CHR\\tPOS\\tREF,ALT\\tAF)\n");
+    fprintf(stderr, "    -o, --output-dir <path>            \n");
+    fprintf(stderr, "    -p, --plot-threshold <float>       plot aberrant chromosomes with quality at least 'float'\n");
+    fprintf(stderr, "    -r, --regions <region>             restrict to comma-separated list of regions\n");
+    fprintf(stderr, "    -R, --regions-file <file>          restrict to regions listed in a file\n");
+    fprintf(stderr, "    -s, --query-sample <string>        query samply name\n");
+    fprintf(stderr, "    -t, --targets <region>             similar to -r but streams rather than index-jumps\n");
+    fprintf(stderr, "    -T, --targets-file <file>          similar to -R but streams rather than index-jumps\n");
+    fprintf(stderr, "HMM Options:\n");
+    fprintf(stderr, "    -b, --BAF-weight <float>           relative contribution from BAF [1]\n");
+    fprintf(stderr, "    -e, --err-prob <float>             probability of error [1e-4]\n");
+    fprintf(stderr, "    -l, --LRR-weight <float>           relative contribution from LRR [0.2]\n");
+    fprintf(stderr, "    -P, --same-prob <float>            prior probability of -s/-c being same [1e-1]\n");
+    fprintf(stderr, "    -x, --xy-prob <float>              P(x|y) transition probability [1e-8]\n");
+    fprintf(stderr, "\n");
+    exit(1);
+}
+
+int main_vcfcnv(int argc, char *argv[])
+{
+    int c;
+    args_t *args    = (args_t*) calloc(1,sizeof(args_t));
+    args->argc      = argc; args->argv = argv;
+    args->files     = bcf_sr_init();
+    args->plot_th   = 1e9;   // by default plot none
+
+    // How much FORMAT/LRR and FORMAT/BAF matter
+    args->lrr_bias  = 0.2;
+    args->baf_bias  = 1.0;
+    args->err_prob  = 1e-4;
+
+    // Transition probability to a different state and the prior of both samples being the same
+    args->ij_prob   = 1e-8;
+    args->same_prob = 1e-1;
+
+    // Squared std dev of BAF and LRR values (gaussian noise), estimated from real data (hets, one sample, one chr)
+    args->baf_sigma2 = 0.08*0.08;   // illumina: 0.03
+    args->lrr_sigma2 = 0.4*0.4; //0.20*0.20;   // illumina: 0.18
+
+    // Priors for RR, RA, AA genotypes
+    args->pRR_dflt = 0.76;
+    args->pRA_dflt = 0.14;
+    args->pAA_dflt = 0.098;
+    // args->pRR = 0.69;
+    // args->pRA = 0.18;
+    // args->pAA = 0.11;
+
+    int regions_is_file = 0, targets_is_file = 0;
+    static struct option loptions[] = 
+    {
+        {"AF-file",1,0,'f'},
+        {"baum-welch",1,0,'W'},
+        {"err-prob",1,0,'e'},
+        {"BAF-weight",1,0,'b'},
+        {"LRR-weight",1,0,'l'},
+        {"same-prob",1,0,'P'},
+        {"xy-prob",1,0,'x'},
+        {"sample",1,0,'s'},
+        {"control",1,0,'c'},
+        {"targets",1,0,'t'},
+        {"targets-file",1,0,'T'},
+        {"regions",1,0,'r'},
+        {"regions-file",1,0,'R'},
+        {"plot",1,0,'p'},
+        {"output-dir",1,0,'o'},
+        {0,0,0,0}
+    };
+    char *tmp = NULL;
+    while ((c = getopt_long(argc, argv, "h?r:R:t:T:s:o:p:l:T:c:b:P:x:e:W:f:",loptions,NULL)) >= 0) {
+        switch (c) {
+            case 'f': args->af_fname = optarg; break;
+            case 'W':
+                args->baum_welch_th = strtod(optarg,&tmp);
+                if ( *tmp ) error("Could not parse: -W %s\n", optarg);
+                break;
+            case 'e': 
+                args->err_prob = strtod(optarg,&tmp);
+                if ( *tmp ) error("Could not parse: -e %s\n", optarg);
+                break;
+            case 'b': 
+                args->baf_bias = strtod(optarg,&tmp);
+                if ( *tmp ) error("Could not parse: -b %s\n", optarg);
+                break;
+            case 'x': 
+                args->ij_prob = strtod(optarg,&tmp);
+                if ( *tmp ) error("Could not parse: -x %s\n", optarg);
+                break;
+            case 'P': 
+                args->same_prob = strtod(optarg,&tmp);
+                if ( *tmp ) error("Could not parse: -P %s\n", optarg);
+                break;
+            case 'l': 
+                args->lrr_bias = strtod(optarg,&tmp);
+                if ( *tmp ) error("Could not parse: -l %s\n", optarg);
+                break;
+            case 'p': 
+                args->plot_th = strtod(optarg,&tmp);
+                if ( *tmp ) error("Could not parse: -p %s\n", optarg);
+                break;
+            case 'o': args->output_dir = optarg; break;
+            case 's': args->query_sample.name = strdup(optarg); break;
+            case 'c': args->control_sample.name = optarg; break;
+            case 't': args->targets_list = optarg; break;
+            case 'T': args->targets_list = optarg; targets_is_file = 1; break;
+            case 'r': args->regions_list = optarg; break;
+            case 'R': args->regions_list = optarg; regions_is_file = 1; break;
+            case 'h': 
+            case '?': usage(args); break;
+            default: error("Unknown argument: %s\n", optarg);
+        }
+    }
+
+    char *fname = NULL;
+    if ( optind>=argc )
+    {
+        if ( !isatty(fileno((FILE *)stdin)) ) fname = "-";
+    }
+    else fname = argv[optind];
+    if ( !fname ) usage(args);
+
+    if ( args->plot_th<=100 && !args->output_dir ) error("Expected -o option with -p\n");
+    if ( args->regions_list )
+    {
+        if ( bcf_sr_set_regions(args->files, args->regions_list, regions_is_file)<0 )
+            error("Failed to read the regions: %s\n", args->regions_list);
+    }
+    if ( args->targets_list )
+    {
+        if ( bcf_sr_set_targets(args->files, args->targets_list, targets_is_file, 0)<0 )
+            error("Failed to read the targets: %s\n", args->targets_list);
+    }
+    if ( args->af_fname )
+    {
+        if ( bcf_sr_set_targets(args->files, args->af_fname, 1, 3)<0 )
+            error("Failed to read the targets: %s\n", args->af_fname);
+    }
+    if ( !bcf_sr_add_reader(args->files, fname) ) error("Failed to open %s: %s\n", fname,bcf_sr_strerror(args->files->errnum));
+    
+    init_data(args);
+    while ( bcf_sr_next_line(args->files) )
+    {
+        bcf1_t *line = bcf_sr_get_line(args->files,0);
+        cnv_next_line(args, line);
+    }
+    cnv_next_line(args, NULL);
+    create_plots(args);
+    fprintf(stderr,"Number of lines: total/processed: %d/%d\n", args->ntot,args->nused);
+    destroy_data(args);
+    free(args);
+    return 0;
+}
+
+
diff --git a/vcfconcat.c b/vcfconcat.c
new file mode 100644
index 0000000..aa46b10
--- /dev/null
+++ b/vcfconcat.c
@@ -0,0 +1,608 @@
+/*  vcfconcat.c -- Concatenate or combine VCF/BCF files.
+
+    Copyright (C) 2013-2014 Genome Research Ltd.
+
+    Author: Petr Danecek <pd3 at sanger.ac.uk>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.  */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <getopt.h>
+#include <string.h>
+#include <errno.h>
+#include <math.h>
+#include <htslib/vcf.h>
+#include <htslib/synced_bcf_reader.h>
+#include <htslib/kseq.h>
+#include "bcftools.h"
+
+typedef struct _args_t
+{
+    bcf_srs_t *files;
+    htsFile *out_fh;
+    int output_type;
+    bcf_hdr_t *out_hdr;
+    int *seen_seq;
+
+    // phasing
+    int *start_pos, start_tid, ifname;
+    int *swap_phase, nswap, *nmatch, *nmism;
+    bcf1_t **buf;
+    int nbuf, mbuf, prev_chr, min_PQ, prev_pos_check;
+    int32_t *GTa, *GTb, mGTa, mGTb, *phase_qual, *phase_set;
+
+    char **argv, *output_fname, *file_list, **fnames, *regions_list;
+    int argc, nfnames, allow_overlaps, phased_concat, remove_dups, regions_is_file;
+}
+args_t;
+
+static void init_data(args_t *args)
+{
+    bcf1_t *line = NULL;
+
+    // With phased concat, the chunks overlap and come in the right order.  To
+    // avoid opening all files at once, store start positions to recognise need
+    // for the next one. This way we can keep only two open chunks at once.
+    if ( args->phased_concat )
+    {
+        args->start_pos = (int*) malloc(sizeof(int)*args->nfnames);
+        line = bcf_init();
+    }
+
+    kstring_t str = {0,0,0};
+    int i, prev_chrid = -1;
+    for (i=0; i<args->nfnames; i++)
+    {
+        htsFile *fp = hts_open(args->fnames[i], "r"); if ( !fp ) error("Failed to open: %s\n", args->fnames[i]);
+        bcf_hdr_t *hdr = bcf_hdr_read(fp); if ( !hdr ) error("Failed to parse header: %s\n", args->fnames[i]);
+        if ( !args->out_hdr )
+            args->out_hdr = bcf_hdr_dup(hdr);
+        else
+        {
+            bcf_hdr_combine(args->out_hdr, hdr);
+
+            if ( bcf_hdr_nsamples(hdr) != bcf_hdr_nsamples(args->out_hdr) )
+                error("Different number of samples in %s. Perhaps \"bcftools merge\" is what you are looking for?\n", args->fnames[i]);
+
+            int j;
+            for (j=0; j<bcf_hdr_nsamples(hdr); j++)
+                if ( strcmp(args->out_hdr->samples[j],hdr->samples[j]) )
+                    error("Different sample names in %s. Perhaps \"bcftools merge\" is what you are looking for?\n", args->fnames[i]);
+        }
+        if ( args->phased_concat )
+        {
+            int ret = bcf_read(fp, hdr, line);
+            if ( ret!=0 ) args->start_pos[i] = -2;  // empty file
+            else
+            {
+                int chrid = bcf_hdr_id2int(args->out_hdr,BCF_DT_CTG,bcf_seqname(hdr,line));
+                args->start_pos[i] = chrid==prev_chrid ? line->pos : -1;
+                prev_chrid = chrid;
+            }
+        }
+        bcf_hdr_destroy(hdr);
+        hts_close(fp);
+    }
+    free(str.s);
+    if ( line ) bcf_destroy(line);
+
+    args->seen_seq = (int*) calloc(args->out_hdr->n[BCF_DT_CTG],sizeof(int));
+
+    if ( args->phased_concat )
+    {
+        bcf_hdr_append(args->out_hdr,"##FORMAT=<ID=PQ,Number=1,Type=Integer,Description=\"Phasing Quality (bigger is better)\">");
+        bcf_hdr_append(args->out_hdr,"##FORMAT=<ID=PS,Number=1,Type=Integer,Description=\"Phase Set\">");
+    }
+    bcf_hdr_append_version(args->out_hdr, args->argc, args->argv, "bcftools_concat");
+    args->out_fh = hts_open(args->output_fname,hts_bcf_wmode(args->output_type));
+    if ( args->out_fh == NULL ) error("Can't write to \"%s\": %s\n", args->output_fname, strerror(errno));
+
+    bcf_hdr_write(args->out_fh, args->out_hdr);
+
+    if ( args->allow_overlaps )
+    {
+        args->files = bcf_sr_init();
+        args->files->require_index = 1;
+        if ( args->regions_list )
+        {
+            if ( bcf_sr_set_regions(args->files, args->regions_list, args->regions_is_file)<0 )
+                error("Failed to read the regions: %s\n", args->regions_list);
+        }
+        for (i=0; i<args->nfnames; i++)
+            if ( !bcf_sr_add_reader(args->files,args->fnames[i]) ) error("Failed to open %s: %s\n", args->fnames[i],bcf_sr_strerror(args->files->errnum));
+    }
+    else if ( args->phased_concat )
+    {
+        // Remove empty files from the list
+        int nok = 0;
+        while (1)
+        {
+            while ( nok<args->nfnames && args->start_pos[nok]!=-2 ) nok++;
+            if ( nok==args->nfnames ) break;
+
+            i = nok;
+            while ( i<args->nfnames && args->start_pos[i]==-2 ) i++;
+            if ( i==args->nfnames ) break;
+
+            int tmp = args->start_pos[nok]; args->start_pos[nok] = args->start_pos[i]; args->start_pos[i] = tmp;
+            char *str = args->fnames[nok]; args->fnames[nok] = args->fnames[i]; args->fnames[i] = str;
+        }
+        for (i=nok; i<args->nfnames; i++) free(args->fnames[i]);
+        args->nfnames = nok;
+
+        for (i=1; i<args->nfnames; i++)
+            if ( args->start_pos[i-1]!=-1 && args->start_pos[i]!=-1 && args->start_pos[i]<args->start_pos[i-1] )
+                error("The files not in ascending order: %d in %s, %d in %s\n", args->start_pos[i-1]+1,args->fnames[i-1],args->start_pos[i]+1,args->fnames[i]);
+
+        args->prev_chr = -1;
+        args->swap_phase = (int*) calloc(bcf_hdr_nsamples(args->out_hdr),sizeof(int));
+        args->nmatch = (int*) calloc(bcf_hdr_nsamples(args->out_hdr),sizeof(int));
+        args->nmism  = (int*) calloc(bcf_hdr_nsamples(args->out_hdr),sizeof(int));
+        args->phase_qual = (int32_t*) malloc(bcf_hdr_nsamples(args->out_hdr)*sizeof(int32_t));
+        args->phase_set  = (int32_t*) malloc(bcf_hdr_nsamples(args->out_hdr)*sizeof(int32_t));
+        args->files = bcf_sr_init();
+        args->files->require_index = 1;
+        args->ifname = 0;
+    }
+}
+
+static void destroy_data(args_t *args)
+{
+    int i;
+    for (i=0; i<args->nfnames; i++) free(args->fnames[i]);
+    free(args->fnames);
+    if ( args->files ) bcf_sr_destroy(args->files);
+    if ( hts_close(args->out_fh)!=0 ) error("hts_close error\n");
+    bcf_hdr_destroy(args->out_hdr);
+    free(args->seen_seq);
+    free(args->start_pos);
+    free(args->swap_phase);
+    for (i=0; i<args->mbuf; i++) bcf_destroy(args->buf[i]);
+    free(args->buf);
+    free(args->GTa);
+    free(args->GTb);
+    free(args->nmatch);
+    free(args->nmism);
+    free(args->phase_qual);
+    free(args->phase_set);
+}
+
+int vcf_write_line(htsFile *fp, kstring_t *line);
+
+#define SWAP(type_t, a, b) { type_t t = a; a = b; b = t; }
+static void phase_update(args_t *args, bcf_hdr_t *hdr, bcf1_t *rec)
+{
+    int i, nGTs = bcf_get_genotypes(hdr, rec, &args->GTa, &args->mGTa);
+    for (i=0; i<bcf_hdr_nsamples(hdr); i++)
+    {
+        if ( !args->swap_phase[i] ) continue;
+        int *gt = &args->GTa[i*2];
+        if ( bcf_gt_is_missing(gt[0]) || gt[1]==bcf_int32_vector_end ) continue;
+        SWAP(int, gt[0], gt[1]);
+        gt[1] |= 1;
+    }
+    bcf_update_genotypes(hdr,rec,args->GTa,nGTs);
+}
+
+static void phased_flush(args_t *args)
+{
+    if ( !args->nbuf ) return;
+
+    bcf_hdr_t *ahdr = args->files->readers[0].header;
+    bcf_hdr_t *bhdr = args->files->readers[1].header;
+
+    int i, j, nsmpl = bcf_hdr_nsamples(args->out_hdr);
+
+    for (i=0; i<args->nbuf; i+=2)
+    {
+        bcf1_t *arec = args->buf[i];
+        bcf1_t *brec = args->buf[i+1];
+
+        int nGTs = bcf_get_genotypes(ahdr, arec, &args->GTa, &args->mGTa);
+        if ( nGTs < 0 ) error("GT is not present at %s:%d\n", bcf_seqname(ahdr,arec), arec->pos+1);
+        if ( nGTs != 2*nsmpl ) continue;    // not diploid
+        nGTs = bcf_get_genotypes(bhdr, brec, &args->GTb, &args->mGTb);
+        if ( nGTs < 0 ) error("GT is not present at %s:%d\n", bcf_seqname(bhdr,brec), brec->pos+1);
+        if ( nGTs != 2*nsmpl ) continue;    // not diploid
+
+        for (j=0; j<nsmpl; j++)
+        {
+            int *gta = &args->GTa[j*2];
+            int *gtb = &args->GTb[j*2];
+            if ( gta[1]==bcf_int32_vector_end || gtb[1]==bcf_int32_vector_end ) continue;
+            if ( bcf_gt_is_missing(gta[0]) || bcf_gt_is_missing(gta[1]) || bcf_gt_is_missing(gtb[0]) || bcf_gt_is_missing(gtb[1]) ) continue;
+            if ( !bcf_gt_is_phased(gta[1]) || !bcf_gt_is_phased(gtb[1]) ) continue;
+            if ( bcf_gt_allele(gta[0])==bcf_gt_allele(gta[1]) || bcf_gt_allele(gtb[0])==bcf_gt_allele(gtb[1]) ) continue;
+            if ( bcf_gt_allele(gta[0])==bcf_gt_allele(gtb[0]) && bcf_gt_allele(gta[1])==bcf_gt_allele(gtb[1]) )
+            {
+                if ( args->swap_phase[j] ) args->nmism[j]++; else args->nmatch[j]++;
+            }
+            if ( bcf_gt_allele(gta[0])==bcf_gt_allele(gtb[1]) && bcf_gt_allele(gta[1])==bcf_gt_allele(gtb[0]) )
+            {
+                if ( args->swap_phase[j] ) args->nmatch[j]++; else args->nmism[j]++;
+            }
+        }
+    }
+    for (i=0; i<args->nbuf/2; i+=2)
+    {
+        bcf1_t *arec = args->buf[i];
+        bcf_translate(args->out_hdr, args->files->readers[0].header, arec);
+        if ( args->nswap )
+            phase_update(args, args->out_hdr, arec);
+        bcf_update_format_int32(args->out_hdr,arec,"PS",args->phase_set,nsmpl);
+        bcf_write(args->out_fh, args->out_hdr, arec);
+
+        if ( arec->pos < args->prev_pos_check ) error("FIXME, disorder: %s:%d vs %d  [1]\n", bcf_seqname(args->files->readers[0].header,arec),arec->pos+1,args->prev_pos_check+1);
+        args->prev_pos_check = arec->pos;
+    }
+    args->nswap = 0;
+    for (j=0; j<nsmpl; j++)
+    {
+        if ( args->nmatch[j] >= args->nmism[j] )
+            args->swap_phase[j] = 0;
+        else
+        {
+            args->swap_phase[j] = 1;
+            args->nswap++;
+        }
+        if ( args->nmatch[j] && args->nmism[j] )
+        {
+            // Entropy-inspired quality. The factor 0.7 shifts and scales to (0,1)
+            double f = (double)args->nmatch[j]/(args->nmatch[j]+args->nmism[j]);
+            args->phase_qual[j] = 99*(0.7 + f*log(f) + (1-f)*log(1-f))/0.7;
+        }
+        else
+            args->phase_qual[j] = 99;
+        args->nmatch[j] = 0;
+        args->nmism[j]  = 0;
+    }
+    int PQ_printed = 0;
+    for (; i<args->nbuf; i+=2)
+    {
+        bcf1_t *brec = args->buf[i+1];
+        bcf_translate(args->out_hdr, args->files->readers[1].header, brec);
+        if ( !PQ_printed )
+        {
+            bcf_update_format_int32(args->out_hdr,brec,"PQ",args->phase_qual,nsmpl);
+            PQ_printed = 1;
+            for (j=0; j<nsmpl; j++)
+                if ( args->phase_qual[j] < args->min_PQ ) args->phase_set[j] = brec->pos+1;
+        }
+        if ( args->nswap )
+            phase_update(args, args->out_hdr, brec);
+        bcf_update_format_int32(args->out_hdr,brec,"PS",args->phase_set,nsmpl);
+        bcf_write(args->out_fh, args->out_hdr, brec);
+
+        if ( brec->pos < args->prev_pos_check ) error("FIXME, disorder: %s:%d vs %d  [2]\n", bcf_seqname(args->files->readers[1].header,brec),brec->pos+1,args->prev_pos_check+1);
+        args->prev_pos_check = brec->pos;
+    }
+    args->nbuf = 0;
+}
+
+static void phased_push(args_t *args, bcf1_t *arec, bcf1_t *brec)
+{
+    if ( arec && arec->errcode )
+        error("Parse error at %s:%d, cannot proceed: %s\n", bcf_seqname(args->files->readers[0].header,arec),arec->pos+1, args->files->readers[0].fname);
+    if ( brec && brec->errcode )
+        error("Parse error at %s:%d, cannot proceed: %s\n", bcf_seqname(args->files->readers[1].header,brec),brec->pos+1, args->files->readers[1].fname);
+
+    int i, nsmpl = bcf_hdr_nsamples(args->out_hdr);
+    int chr_id = bcf_hdr_name2id(args->out_hdr, bcf_seqname(args->files->readers[0].header,arec));
+    if ( args->prev_chr<0 || args->prev_chr!=chr_id )
+    {
+        if ( args->prev_chr>=0 ) phased_flush(args);
+
+        for (i=0; i<nsmpl; i++)
+            args->phase_set[i] = arec->pos+1;
+
+        if ( args->seen_seq[chr_id] ) error("The chromosome block %s is not contiguous\n", bcf_seqname(args->files->readers[0].header,arec));
+        args->seen_seq[chr_id] = 1;
+        args->prev_chr = chr_id;
+        args->prev_pos_check = -1;
+    }
+
+    if ( !brec )
+    {
+        bcf_translate(args->out_hdr, args->files->readers[0].header, arec);
+        if ( args->nswap )
+            phase_update(args, args->out_hdr, arec);
+        bcf_update_format_int32(args->out_hdr,arec,"PS",args->phase_set,nsmpl);
+        bcf_write(args->out_fh, args->out_hdr, arec);
+
+        if ( arec->pos < args->prev_pos_check )
+            error("FIXME, disorder: %s:%d in %s vs %d written  [3]\n", bcf_seqname(args->files->readers[0].header,arec), arec->pos+1,args->files->readers[0].fname, args->prev_pos_check+1);
+        args->prev_pos_check = arec->pos;
+        return;
+    }
+
+    int m = args->mbuf;
+    args->nbuf += 2;
+    hts_expand(bcf1_t*,args->nbuf,args->mbuf,args->buf);
+    for (i=m; i<args->mbuf; i++)
+        args->buf[i] = bcf_init1();
+
+    SWAP(bcf1_t*, args->files->readers[0].buffer[0], args->buf[args->nbuf-2]);
+    SWAP(bcf1_t*, args->files->readers[1].buffer[0], args->buf[args->nbuf-1]);
+}
+
+static void concat(args_t *args)
+{
+    int i;
+    if ( args->phased_concat )  // phased concat
+    {
+        // keep only two open files at a time
+        while ( args->ifname < args->nfnames )
+        {
+            int new_file = 0;
+            while ( args->files->nreaders < 2 && args->ifname < args->nfnames )
+            {
+                if ( !bcf_sr_add_reader(args->files,args->fnames[args->ifname]) ) error("Failed to open %s: %s\n", args->fnames[args->ifname],bcf_sr_strerror(args->files->errnum));
+                new_file = 1;
+
+                args->ifname++;
+                if ( args->start_pos[args->ifname-1]==-1 ) break;   // new chromosome, start with only one file open
+                if ( args->ifname < args->nfnames && args->start_pos[args->ifname]==-1 ) break; // next file starts on a different chromosome
+            }
+
+            // is there a line from the previous run? Seek the newly opened reader to that position
+            int seek_pos = -1;
+            int seek_chr = -1;
+            if ( bcf_sr_has_line(args->files,0) )
+            {
+                bcf1_t *line = bcf_sr_get_line(args->files,0);
+                bcf_sr_seek(args->files, bcf_seqname(args->files->readers[0].header,line), line->pos);
+                seek_pos = line->pos;
+                seek_chr = bcf_hdr_name2id(args->out_hdr, bcf_seqname(args->files->readers[0].header,line));
+            }
+            else if ( new_file )
+                bcf_sr_seek(args->files,NULL,0);  // set to start
+
+            int nret;
+            while ( (nret = bcf_sr_next_line(args->files)) )
+            {
+                if ( !bcf_sr_has_line(args->files,0) )  // no input from the first reader
+                {
+                    // We are assuming that there is a perfect overlap, sites which are not present in both files are dropped
+                    if ( ! bcf_sr_region_done(args->files,0) ) continue;
+
+                    phased_flush(args);
+                    bcf_sr_remove_reader(args->files, 0);
+                }
+
+                // Get a line to learn about current position
+                for (i=0; i<args->files->nreaders; i++)
+                    if ( bcf_sr_has_line(args->files,i) ) break;
+                bcf1_t *line = bcf_sr_get_line(args->files,i);
+
+                // This can happen after bcf_sr_seek: indel may start before the coordinate which we seek to.
+                if ( seek_chr>=0 && seek_pos>line->pos && seek_chr==bcf_hdr_name2id(args->out_hdr, bcf_seqname(args->files->readers[i].header,line)) ) continue;
+                seek_pos = seek_chr = -1;
+
+                //  Check if the position overlaps with the next, yet unopened, reader
+                int must_seek = 0;
+                while ( args->ifname < args->nfnames && args->start_pos[args->ifname]!=-1 && line->pos >= args->start_pos[args->ifname] )
+                {
+                    must_seek = 1;
+                    if ( !bcf_sr_add_reader(args->files,args->fnames[args->ifname]) ) error("Failed to open %s: %s\n", args->fnames[args->ifname],bcf_sr_strerror(args->files->errnum));
+                    args->ifname++;
+                }
+                if ( must_seek )
+                {
+                    bcf_sr_seek(args->files, bcf_seqname(args->files->readers[i].header,line), line->pos);
+                    seek_pos = line->pos;
+                    seek_chr = bcf_hdr_name2id(args->out_hdr, bcf_seqname(args->files->readers[i].header,line));
+                    continue;
+                }
+
+                // We are assuming that there is a perfect overlap, sites which are not present in both files are dropped
+                if ( args->files->nreaders>1 && !bcf_sr_has_line(args->files,1) && !bcf_sr_region_done(args->files,1) ) continue;
+
+                phased_push(args, bcf_sr_get_line(args->files,0), args->files->nreaders>1 ? bcf_sr_get_line(args->files,1) : NULL);
+            }
+
+            if ( args->files->nreaders )
+            {
+                phased_flush(args);
+                while ( args->files->nreaders )
+                    bcf_sr_remove_reader(args->files, 0);
+            }
+        }
+    }
+    else if ( args->files )  // combining overlapping files, using synced reader
+    {
+        while ( bcf_sr_next_line(args->files) )
+        {
+            for (i=0; i<args->files->nreaders; i++)
+            {
+                bcf1_t *line = bcf_sr_get_line(args->files,i);
+                if ( !line ) continue;
+                bcf_translate(args->out_hdr, args->files->readers[i].header, line);
+                bcf_write1(args->out_fh, args->out_hdr, line);
+                if ( args->remove_dups ) break;
+            }
+        }
+    }
+    else    // concatenating
+    {
+        kstring_t tmp = {0,0,0};
+        int prev_chr_id = -1, prev_pos;
+        bcf1_t *line = bcf_init();
+        for (i=0; i<args->nfnames; i++)
+        {
+            htsFile *fp = hts_open(args->fnames[i], "r"); if ( !fp ) error("Failed to open: %s\n", args->fnames[i]);
+            bcf_hdr_t *hdr = bcf_hdr_read(fp); if ( !hdr ) error("Failed to parse header: %s\n", args->fnames[i]);
+            if ( !fp->is_bin && args->output_type&FT_VCF )
+            {
+                line->max_unpack = BCF_UN_STR;
+                // if VCF is on both input and output, avoid VCF to BCF conversion
+                while ( hts_getline(fp, KS_SEP_LINE, &fp->line) >=0 )
+                {
+                    char *str = fp->line.s;
+                    while ( *str && *str!='\t' ) str++;
+                    tmp.l = 0;
+                    kputsn(fp->line.s,str-fp->line.s,&tmp);
+                    int chr_id = bcf_hdr_name2id(args->out_hdr, tmp.s);
+                    if ( chr_id<0 ) error("The sequence \"%s\" not defined in the header: %s\n(Quick workaround: index the file.)\n", tmp.s, args->fnames[i]);
+                    if ( prev_chr_id!=chr_id )
+                    {
+                        prev_pos = -1;
+                        if ( args->seen_seq[chr_id] )
+                            error("\nThe chromosome block %s is not contiguous, consider running with -a.\n", tmp.s);
+                    }
+                    char *end;
+                    int pos = strtol(str+1,&end,10) - 1;
+                    if ( end==str+1 ) error("Could not parse line: %s\n", fp->line.s);
+                    if ( prev_pos > pos )
+                        error("The chromosome block %s is not sorted, consider running with -a.\n", tmp.s);
+                    args->seen_seq[chr_id] = 1;
+                    prev_chr_id = chr_id;
+
+                    if ( vcf_write_line(args->out_fh, &fp->line)!=0 ) error("Failed to write %d bytes\n", fp->line.l);
+                }
+            }
+            else
+            {
+                // BCF conversion is required
+                line->max_unpack = 0;
+                while ( bcf_read(fp, hdr, line)==0 )
+                {
+                    bcf_translate(args->out_hdr, hdr, line);
+
+                    if ( prev_chr_id!=line->rid )
+                    {
+                        prev_pos = -1;
+                        if ( args->seen_seq[line->rid] )
+                            error("\nThe chromosome block %s is not contiguous, consider running with -a.\n", bcf_seqname(args->out_hdr, line));
+                    }
+                    if ( prev_pos > line->pos )
+                        error("The chromosome block %s is not sorted, consider running with -a.\n", bcf_seqname(args->out_hdr, line));
+                    args->seen_seq[line->rid] = 1;
+                    prev_chr_id = line->rid;
+
+                    if ( bcf_write(args->out_fh, args->out_hdr, line)!=0 ) error("Failed to write\n");
+                }
+            }
+            bcf_hdr_destroy(hdr);
+            hts_close(fp);
+        }
+        bcf_destroy(line);
+        free(tmp.s);
+    }
+}
+
+static void usage(args_t *args)
+{
+    fprintf(stderr, "\n");
+    fprintf(stderr, "About:   Concatenate or combine VCF/BCF files. All source files must have the same sample\n");
+    fprintf(stderr, "         columns appearing in the same order. Can be used, for example, to\n");
+    fprintf(stderr, "         concatenate chromosome VCFs into one VCF, or combine a SNP VCF and an indel\n");
+    fprintf(stderr, "         VCF into one. The input files must be sorted by chr and position. The files\n");
+    fprintf(stderr, "         must be given in the correct order to produce sorted VCF on output unless\n");
+    fprintf(stderr, "         the -a, --allow-overlaps option is specified.\n");
+    fprintf(stderr, "Usage:   bcftools concat [options] <A.vcf.gz> [<B.vcf.gz> [...]]\n");
+    fprintf(stderr, "\n");
+    fprintf(stderr, "Options:\n");
+    fprintf(stderr, "   -a, --allow-overlaps           First coordinate of the next file can precede last record of the current file.\n");
+    fprintf(stderr, "   -D, --remove-duplicates        Output only once records present in multiple files.\n");
+    fprintf(stderr, "   -f, --file-list <file>         Read the list of files from a file.\n");
+    fprintf(stderr, "   -l, --ligate                   Ligate phased VCFs by matching phase at overlapping haplotypes\n");
+    fprintf(stderr, "   -q, --min-PQ <int>             Break phase set if phasing quality is lower than <int> [30]\n");
+    fprintf(stderr, "   -o, --output <file>            Write output to a file [standard output]\n");
+    fprintf(stderr, "   -O, --output-type <b|u|z|v>    b: compressed BCF, u: uncompressed BCF, z: compressed VCF, v: uncompressed VCF [v]\n");
+    fprintf(stderr, "   -r, --regions <region>         restrict to comma-separated list of regions\n");
+    fprintf(stderr, "   -R, --regions-file <file>      restrict to regions listed in a file\n");
+    fprintf(stderr, "\n");
+    exit(1);
+}
+
+int main_vcfconcat(int argc, char *argv[])
+{
+    int c;
+    args_t *args  = (args_t*) calloc(1,sizeof(args_t));
+    args->argc    = argc; args->argv = argv;
+    args->output_fname = "-";
+    args->output_type = FT_VCF;
+    args->min_PQ  = 30;
+
+    static struct option loptions[] =
+    {
+        {"regions",1,0,'r'},
+        {"regions-file",1,0,'R'},
+        {"remove-duplicates",0,0,'D'},
+        {"allow-overlaps",0,0,'a'},
+        {"ligate",0,0,'l'},
+        {"output",1,0,'o'},
+        {"output-type",1,0,'O'},
+        {"file-list",1,0,'f'},
+        {"min-PQ",1,0,'q'},
+        {0,0,0,0}
+    };
+    char *tmp;
+    while ((c = getopt_long(argc, argv, "h:?o:O:f:alq:Dr:R:",loptions,NULL)) >= 0)
+    {
+        switch (c) {
+            case 'r': args->regions_list = optarg; break;
+            case 'R': args->regions_list = optarg; args->regions_is_file = 1; break;
+            case 'D': args->remove_dups = 1; break;
+            case 'q': 
+                args->min_PQ = strtol(optarg,&tmp,10);
+                if ( *tmp ) error("Could not parse argument: --min-PQ %s\n", optarg);
+                break;
+            case 'a': args->allow_overlaps = 1; break;
+            case 'l': args->phased_concat = 1; break;
+            case 'f': args->file_list = optarg; break;
+            case 'o': args->output_fname = optarg; break;
+            case 'O':
+                switch (optarg[0]) {
+                    case 'b': args->output_type = FT_BCF_GZ; break;
+                    case 'u': args->output_type = FT_BCF; break;
+                    case 'z': args->output_type = FT_VCF_GZ; break;
+                    case 'v': args->output_type = FT_VCF; break;
+                    default: error("The output type \"%s\" not recognised\n", optarg);
+                };
+                break;
+            case 'h':
+            case '?': usage(args); break;
+            default: error("Unknown argument: %s\n", optarg);
+        }
+    }
+    while ( optind<argc )
+    {
+        args->nfnames++;
+        args->fnames = (char **)realloc(args->fnames,sizeof(char*)*args->nfnames);
+        args->fnames[args->nfnames-1] = strdup(argv[optind]);
+        optind++;
+    }
+    if ( args->allow_overlaps && args->phased_concat ) args->allow_overlaps = 0;
+    if ( args->file_list )
+    {
+        if ( args->nfnames ) error("Cannot combine -l with file names on command line.\n");
+        args->fnames = hts_readlines(args->file_list, &args->nfnames);
+        if ( !args->fnames ) error("Could not read the file: %s\n", args->file_list);
+    }
+    if ( !args->nfnames ) usage(args);
+    if ( args->remove_dups && !args->allow_overlaps ) error("The -D option is supported only with -a\n");
+    if ( args->regions_list && !args->allow_overlaps ) error("The -r/-R option is supported only with -a\n");
+    init_data(args);
+    concat(args);
+    destroy_data(args);
+    free(args);
+    return 0;
+}
diff --git a/vcfconvert.c b/vcfconvert.c
new file mode 100644
index 0000000..34b12f3
--- /dev/null
+++ b/vcfconvert.c
@@ -0,0 +1,1369 @@
+/*  vcfconvert.c -- convert between VCF/BCF and related formats.
+
+    Copyright (C) 2013-2014 Genome Research Ltd.
+
+    Author: Petr Danecek <pd3 at sanger.ac.uk>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.  */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <getopt.h>
+#include <ctype.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <htslib/faidx.h>
+#include <htslib/vcf.h>
+#include <htslib/bgzf.h>
+#include <htslib/synced_bcf_reader.h>
+#include <htslib/vcfutils.h>
+#include <htslib/kseq.h>
+#include "bcftools.h"
+#include "filter.h"
+#include "convert.h"
+#include "tsv2vcf.h"
+
+// Logic of the filters: include or exclude sites which match the filters?
+#define FLT_INCLUDE 1
+#define FLT_EXCLUDE 2
+
+typedef struct _args_t args_t;
+struct _args_t
+{
+    faidx_t *ref;
+    filter_t *filter;
+    char *filter_str;
+    int filter_logic;   // include or exclude sites which match the filters? One of FLT_INCLUDE/FLT_EXCLUDE
+    convert_t *convert;
+    bcf_srs_t *files;
+    bcf_hdr_t *header;
+    void (*convert_func)(struct _args_t *);
+    struct {
+        int total, skipped, hom_rr, het_ra, hom_aa, het_aa, missing; 
+    } n;
+    kstring_t str;
+    int32_t *gts;
+    float *flt;
+    int rev_als, output_vcf_ids, hap2dip, output_chrom_first_col;
+    int nsamples, *samples, sample_is_file, targets_is_file, regions_is_file, output_type;
+    char **argv, *sample_list, *targets_list, *regions_list, *tag, *columns;
+    char *outfname, *infname, *ref_fname;
+    int argc;
+};
+
+static void destroy_data(args_t *args)
+{
+    if ( args->convert) convert_destroy(args->convert);
+    if ( args->filter ) filter_destroy(args->filter);
+    free(args->samples);
+    if ( args->files ) bcf_sr_destroy(args->files);
+}
+
+static void open_vcf(args_t *args, const char *format_str)
+{
+    args->files = bcf_sr_init();
+    if ( args->regions_list )
+    {
+        if ( bcf_sr_set_regions(args->files, args->regions_list, args->regions_is_file)<0 )
+            error("Failed to read the regions: %s\n", args->regions_list);
+    }
+    if ( args->targets_list )
+    {
+        if ( bcf_sr_set_targets(args->files, args->targets_list, args->targets_is_file, 0)<0 )
+            error("Failed to read the targets: %s\n", args->targets_list);
+    }
+    if ( !bcf_sr_add_reader(args->files, args->infname) )
+        error("Failed to open %s: %s\n", args->infname,bcf_sr_strerror(args->files->errnum));
+    if ( args->filter_str )
+        args->filter = filter_init(args->header, args->filter_str);
+
+    args->header = args->files->readers[0].header;
+
+    int i, nsamples = 0, *samples = NULL;
+    if ( args->sample_list && strcmp("-",args->sample_list) )
+    {
+        for (i=0; i<args->files->nreaders; i++)
+        {
+            int ret = bcf_hdr_set_samples(args->files->readers[i].header,args->sample_list,args->sample_is_file);
+            if ( ret<0 ) error("Error parsing the sample list\n");
+            else if ( ret>0 ) error("Sample name mismatch: sample #%d not found in the header\n", ret);
+        }
+
+        if ( args->sample_list[0]!='^' )
+        {
+            // the sample ordering may be different if not negated
+            int n;
+            char **smpls = hts_readlist(args->sample_list, args->sample_is_file, &n);
+            if ( !smpls ) error("Could not parse %s\n", args->sample_list);
+            if ( n!=bcf_hdr_nsamples(args->files->readers[0].header) )
+                error("The number of samples does not match, perhaps some are present multiple times?\n");
+            nsamples = bcf_hdr_nsamples(args->files->readers[0].header);
+            samples = (int*) malloc(sizeof(int)*nsamples);
+            for (i=0; i<n; i++)
+            {
+                samples[i] = bcf_hdr_id2int(args->files->readers[0].header, BCF_DT_SAMPLE,smpls[i]);
+                free(smpls[i]);
+            }
+            free(smpls);
+        }
+    }
+    if ( format_str ) args->convert = convert_init(args->header, samples, nsamples, format_str);
+    free(samples);
+
+    if ( args->filter_str )
+        args->filter = filter_init(args->header, args->filter_str);
+}
+
+static int tsv_setter_chrom_pos_ref_alt(tsv_t *tsv, bcf1_t *rec, void *usr)
+{
+    args_t *args = (args_t*) usr;
+
+    char tmp, *se = tsv->ss, *ss = tsv->ss;
+    while ( se < tsv->se && *se!=':' ) se++;
+    if ( *se!=':' ) error("Could not parse CHROM in CHROM:POS_REF_ALT id: %s\n", tsv->ss);
+    tmp = *se; *se = 0;
+    rec->rid = bcf_hdr_name2id(args->header,ss); 
+    if ( rec->rid<0 ) error("Could not determine sequence name or multiple sequences present: %s\n", tsv->ss);
+    *se = tmp;
+
+    // POS
+    rec->pos = strtol(se+1,&ss,10);
+    if ( ss==se+1 ) error("Could not parse POS in CHROM:POS_REF_ALT: %s\n", tsv->ss);
+    rec->pos--;
+
+    // REF,ALT
+    args->str.l = 0;
+    se = ++ss;
+    while ( se < tsv->se && *se!='_' ) se++; 
+    if ( *se!='_' ) error("Could not parse REF in CHROM:POS_REF_ALT id: %s\n", tsv->ss);
+    kputsn(ss,se-ss,&args->str);
+    ss = ++se;
+    while ( se < tsv->se && *se!=':' ) se++;
+    if ( se < tsv->se && *se!=':' ) error("Could not parse ALT in CHROM:POS_REF_ALT id: %s\n", tsv->ss);
+    kputc(',',&args->str);
+    kputsn(ss,se-ss,&args->str);
+    bcf_update_alleles_str(args->header, rec, args->str.s);
+    return 0;
+}
+static int tsv_setter_verify_pos(tsv_t *tsv, bcf1_t *rec, void *usr)
+{
+    char *se;
+    int pos = strtol(tsv->ss,&se,10);
+    if ( tsv->ss==se ) error("Could not parse POS: %s\n", tsv->ss);
+    if ( rec->pos != pos-1 ) error("POS mismatch: %s\n", tsv->ss);
+    return 0;
+}
+static int tsv_setter_verify_ref_alt(tsv_t *tsv, bcf1_t *rec, void *usr)
+{
+    args_t *args = (args_t*) usr;
+    args->rev_als = 0;
+    char tmp = *tsv->se; *tsv->se = 0;
+    if ( strcmp(tsv->ss,rec->d.allele[0]) )
+    {
+        if ( strcmp(tsv->ss,rec->d.allele[1]) ) { *tsv->se = tmp; error("REF/ALT mismatch: [%s][%s]\n", tsv->ss,rec->d.allele[1]); }
+        args->rev_als = 1;
+    }
+    *tsv->se = tmp;
+    while ( *tsv->se && isspace(*tsv->se) ) tsv->se++;
+    tsv->ss = tsv->se;
+    while ( *tsv->se && !isspace(*tsv->se) ) tsv->se++;
+    tmp = *tsv->se; *tsv->se = 0;
+    if ( !args->rev_als && strcmp(tsv->ss,rec->d.allele[1]) ) { *tsv->se = tmp; error("REF/ALT mismatch: [%s][%s]\n", tsv->ss,rec->d.allele[1]); }
+    else if ( args->rev_als && strcmp(tsv->ss,rec->d.allele[0]) ) { *tsv->se = tmp; error("REF/ALT mismatch: [%s][%s]\n", tsv->ss,rec->d.allele[0]); }
+    *tsv->se = tmp;
+    return 0;
+}
+static int tsv_setter_gt_gp(tsv_t *tsv, bcf1_t *rec, void *usr)
+{
+    args_t *args = (args_t*) usr;
+    int i, nsamples = bcf_hdr_nsamples(args->header);
+    for (i=0; i<nsamples; i++)
+    {
+        float aa,ab,bb;
+        aa = strtod(tsv->ss, &tsv->se);
+        if ( tsv->ss==tsv->se ) { fprintf(stderr,"Could not parse first value of %d-th sample\n", i+1); return -1; }
+        tsv->ss = tsv->se+1;
+        ab = strtod(tsv->ss, &tsv->se);
+        if ( tsv->ss==tsv->se ) { fprintf(stderr,"Could not parse second value of %d-th sample\n", i+1); return -1; }
+        tsv->ss = tsv->se+1;
+        bb = strtod(tsv->ss, &tsv->se);
+        if ( tsv->ss==tsv->se ) { fprintf(stderr,"Could not parse third value of %d-th sample\n", i+1); return -1; }
+        tsv->ss = tsv->se+1;
+
+        if ( args->rev_als ) { float tmp = bb; bb = aa; aa = tmp; }
+        args->flt[3*i+0] = aa;
+        args->flt[3*i+1] = ab;
+        args->flt[3*i+2] = bb;
+
+        if ( aa >= ab )
+        {
+            if ( aa >= bb ) args->gts[2*i+0] = args->gts[2*i+1] = bcf_gt_unphased(0);
+            else args->gts[2*i+0] = args->gts[2*i+1] = bcf_gt_unphased(1); 
+        }
+        else if ( ab >= bb ) 
+        {
+            args->gts[2*i+0] = bcf_gt_unphased(0);
+            args->gts[2*i+1] = bcf_gt_unphased(1); 
+        }
+        else args->gts[2*i+0] = args->gts[2*i+1] = bcf_gt_unphased(1);
+    }
+    if ( *tsv->se ) error("Could not parse: %s\n", tsv->ss);
+    if ( bcf_update_genotypes(args->header,rec,args->gts,nsamples*2) ) error("Could not update GT field\n");
+    if ( bcf_update_format_float(args->header,rec,"GP",args->flt,nsamples*3) ) error("Could not update GP field\n");
+    return 0;
+}
+static int tsv_setter_haps(tsv_t *tsv, bcf1_t *rec, void *usr)
+{
+    args_t *args = (args_t*) usr;
+    int i, nsamples = bcf_hdr_nsamples(args->header);
+
+    int32_t a0, a1;
+    if ( args->rev_als ) { a0 = bcf_gt_phased(1); a1 = bcf_gt_phased(0); }
+    else { a0 = bcf_gt_phased(0); a1 = bcf_gt_phased(1); }
+
+    for (i=0; i<nsamples; i++)
+    {
+        char *ss = tsv->ss + 4*i;
+
+        if ( !ss[0] || !ss[1] || !ss[2] )
+        {
+            fprintf(stderr,"Wrong number of fields at %d-th sample ([%c][%c][%c]). ",i+1,ss[0],ss[1],ss[2]);
+            return -1;
+        }
+
+        if ( ss[0]=='0' ) args->gts[2*i] = a0;
+        else if ( ss[0]=='1' ) args->gts[2*i] = a1;
+        else { fprintf(stderr,"Could not parse: [%c][%s]\n", ss[0],tsv->ss); return -1; }
+
+        if ( ss[2]=='0' ) args->gts[2*i+1] = a0;
+        else if ( ss[2]=='1' ) args->gts[2*i+1] = a1;
+        else { fprintf(stderr,"Could not parse: [%c][%s]\n", ss[2],tsv->ss); return -1; }
+    }
+    if ( tsv->ss[(nsamples-1)*4+3] )
+    {
+        fprintf(stderr,"Wrong number of fields (%d-th column = [%c]). ", nsamples*2,tsv->ss[(nsamples-1)*4+1]);
+        return -1;
+    }
+
+    if ( bcf_update_genotypes(args->header,rec,args->gts,nsamples*2) ) error("Could not update GT field\n");
+    return 0;
+}
+static void gensample_to_vcf(args_t *args)
+{
+    /*
+     *  Inpute: IMPUTE2 output (indentation changed here for clarity): 
+     *
+     *      20:62116619_C_T 20:62116619     62116619 C T 0.969 0.031 0 ...
+     *      ---             20:62116698_C_A 62116698 C A 1     0     0 ...
+     *
+     *  Second column is expected in the form of CHROM:POS_REF_ALT. We use second
+     *  column because the first can be empty ("--") when filling sites from reference 
+     *  panel.
+     *
+     *  Output: VCF with filled GT,GP
+     *
+     */
+    kstring_t line = {0,0,0};
+
+    char *gen_fname = NULL, *sample_fname = NULL;
+    sample_fname = strchr(args->infname,',');
+    if ( !sample_fname )
+    {
+        args->str.l = 0;
+        ksprintf(&args->str,"%s.gen.gz", args->infname);
+        gen_fname = strdup(args->str.s);
+        args->str.l = 0;
+        ksprintf(&args->str,"%s.samples", args->infname);
+        sample_fname = strdup(args->str.s);
+    }
+    else
+    {
+        *sample_fname = 0;
+        gen_fname = strdup(args->infname);
+        sample_fname = strdup(sample_fname+1);
+    }
+    htsFile *gen_fh = hts_open(gen_fname, "r");
+    if ( !gen_fh ) error("Could not read: %s\n", gen_fname);
+    if ( hts_getline(gen_fh, KS_SEP_LINE, &line) <= 0 ) error("Empty file: %s\n", gen_fname);
+
+    // Find out the chromosome name, sample names, init and print the VCF header
+    args->str.l = 0;
+    char *ss, *se = line.s;
+    while ( *se && !isspace(*se) ) se++;
+    if ( !*se ) error("Could not parse %s: %s\n", gen_fname,line.s);
+    ss = se+1;
+    se = strchr(ss,':');
+    if ( !se ) error("Expected CHROM:POS_REF_ALT in second column of %s\n", gen_fname);
+    kputsn(ss, se-ss, &args->str);
+
+    tsv_t *tsv = tsv_init("-,CHROM_POS_REF_ALT,POS,REF_ALT,GT_GP");
+    tsv_register(tsv, "CHROM_POS_REF_ALT", tsv_setter_chrom_pos_ref_alt, args);
+    tsv_register(tsv, "POS", tsv_setter_verify_pos, NULL);
+    tsv_register(tsv, "REF_ALT", tsv_setter_verify_ref_alt, args);
+    tsv_register(tsv, "GT_GP", tsv_setter_gt_gp, args);
+
+    args->header = bcf_hdr_init("w");
+    bcf_hdr_append(args->header, "##FORMAT=<ID=GT,Number=1,Type=String,Description=\"Genotype\">");
+    bcf_hdr_append(args->header, "##FORMAT=<ID=GP,Number=G,Type=Float,Description=\"Genotype Probabilities\">");
+    bcf_hdr_printf(args->header, "##contig=<ID=%s,length=%d>", args->str.s,0x7fffffff);   // MAX_CSI_COOR
+    bcf_hdr_append_version(args->header, args->argc, args->argv, "bcftools_convert");
+
+    int i, nsamples;
+    char **samples = hts_readlist(sample_fname, 1, &nsamples);
+    for (i=2; i<nsamples; i++)
+    {
+        se = samples[i]; while ( *se && !isspace(*se) ) se++;
+        *se = 0;
+        bcf_hdr_add_sample(args->header,samples[i]);
+    }
+    for (i=0; i<nsamples; i++) free(samples[i]);
+    free(samples);
+
+    htsFile *out_fh = hts_open(args->outfname,hts_bcf_wmode(args->output_type));
+    bcf_hdr_write(out_fh,args->header);
+    bcf1_t *rec = bcf_init();
+
+    nsamples -= 2;
+    args->gts = (int32_t *) malloc(sizeof(int32_t)*nsamples*2);
+    args->flt = (float *) malloc(sizeof(float)*nsamples*3);
+
+    do
+    {
+        bcf_clear(rec);
+        args->n.total++;
+        if ( !tsv_parse(tsv, rec, line.s) )
+            bcf_write(out_fh, args->header, rec);
+        else
+            error("Error occurred while parsing: %s\n", line.s);
+    }
+    while ( hts_getline(gen_fh, KS_SEP_LINE, &line)>0 );
+
+    if ( hts_close(out_fh) ) error("Close failed: %s\n", args->outfname);
+    if ( hts_close(gen_fh) ) error("Close failed: %s\n", gen_fname);
+    bcf_hdr_destroy(args->header);
+    bcf_destroy(rec);
+    free(sample_fname);
+    free(gen_fname);
+    free(args->str.s);
+    free(line.s);
+    free(args->gts);
+    free(args->flt);
+    tsv_destroy(tsv);
+
+    fprintf(stderr,"Number of processed rows: \t%d\n", args->n.total);
+}
+
+static void haplegendsample_to_vcf(args_t *args)
+{
+    /*
+     *  Convert from IMPUTE2 hap/legend/sample output files to VCF
+     *
+     *      hap:
+     *          0 1 0 1 1 1
+     *      legend:
+     *          id position a0 a1
+     *          1:186946386_G_T 186946386 G T
+     *      sample:
+     *          QTL190044
+     *          QTL190053
+     *
+     *  Output: VCF with filled GT
+     */
+    kstring_t line = {0,0,0};
+
+    char *hap_fname = NULL, *leg_fname = NULL, *sample_fname = NULL;
+    sample_fname = strchr(args->infname,',');
+    if ( !sample_fname )
+    {
+        args->str.l = 0;
+        ksprintf(&args->str,"%s.hap.gz", args->infname);
+        hap_fname = strdup(args->str.s);
+        args->str.l = 0;
+        ksprintf(&args->str,"%s.samples", args->infname);
+        sample_fname = strdup(args->str.s);
+        args->str.l = 0;
+        ksprintf(&args->str,"%s.legend.gz", args->infname);
+        leg_fname = strdup(args->str.s);
+    }
+    else
+    {
+        char *ss = sample_fname, *se = strchr(ss+1,',');
+        if ( !se ) error("Could not parse hap/legend/sample file names: %s\n", args->infname);
+        *ss = 0;
+        *se = 0;
+        hap_fname = strdup(args->infname);
+        leg_fname = strdup(ss+1);
+        sample_fname = strdup(se+1);
+    }
+    htsFile *hap_fh = hts_open(hap_fname, "r");
+    if ( !hap_fh ) error("Could not read: %s\n", hap_fname);
+
+    htsFile *leg_fh = hts_open(leg_fname,"r");
+    if ( !leg_fh ) error("Could not read: %s\n", leg_fname);
+
+    // Eat up first legend line, then determine chromosome name
+    if ( hts_getline(leg_fh, KS_SEP_LINE, &line) <= 0 ) error("Empty file: %s\n", leg_fname);
+    if ( hts_getline(leg_fh, KS_SEP_LINE, &line) <= 0 ) error("Empty file: %s\n", leg_fname);
+
+    // Find out the chromosome name, sample names, init and print the VCF header
+    args->str.l = 0;
+    char *se = strchr(line.s,':');
+    if ( !se ) error("Expected CHROM:POS_REF_ALT in first column of %s\n", leg_fname);
+    kputsn(line.s, se-line.s, &args->str);
+
+    tsv_t *leg_tsv = tsv_init("CHROM_POS_REF_ALT,POS,REF_ALT");
+    tsv_register(leg_tsv, "CHROM_POS_REF_ALT", tsv_setter_chrom_pos_ref_alt, args);
+    tsv_register(leg_tsv, "POS", tsv_setter_verify_pos, NULL);
+    tsv_register(leg_tsv, "REF_ALT", tsv_setter_verify_ref_alt, args);
+
+    tsv_t *hap_tsv = tsv_init("HAPS");
+    tsv_register(hap_tsv, "HAPS", tsv_setter_haps, args);
+
+    args->header = bcf_hdr_init("w");
+    bcf_hdr_append(args->header, "##FORMAT=<ID=GT,Number=1,Type=String,Description=\"Genotype\">");
+    bcf_hdr_printf(args->header, "##contig=<ID=%s,length=%d>", args->str.s,0x7fffffff);   // MAX_CSI_COOR
+    bcf_hdr_append_version(args->header, args->argc, args->argv, "bcftools_convert");
+
+    int i, nsamples;
+    char **samples = hts_readlist(sample_fname, 1, &nsamples);
+    for (i=0; i<nsamples; i++)
+    {
+        se = samples[i]; while ( *se && !isspace(*se) ) se++;
+        *se = 0;
+        bcf_hdr_add_sample(args->header,samples[i]);
+    }
+    bcf_hdr_add_sample(args->header,NULL);
+    for (i=0; i<nsamples; i++) free(samples[i]);
+    free(samples);
+
+    htsFile *out_fh = hts_open(args->outfname,hts_bcf_wmode(args->output_type));
+    bcf_hdr_write(out_fh,args->header);
+    bcf1_t *rec = bcf_init();
+
+    args->gts = (int32_t *) malloc(sizeof(int32_t)*nsamples*2);
+
+    while (1)
+    {
+        bcf_clear(rec);
+        args->n.total++;
+        if ( tsv_parse(leg_tsv, rec, line.s) )
+            error("Error occurred while parsing %s: %s\n", leg_fname,line.s);
+
+        if ( hts_getline(hap_fh,  KS_SEP_LINE, &line)<=0 )
+            error("Different number of records in %s and %s?\n", leg_fname,hap_fname);
+
+        if ( tsv_parse(hap_tsv, rec, line.s) )
+            error("Error occurred while parsing %s: %s\n", hap_fname,line.s);
+
+        bcf_write(out_fh, args->header, rec);
+
+        if ( hts_getline(leg_fh, KS_SEP_LINE, &line)<=0 )
+        {
+            if ( hts_getline(hap_fh, KS_SEP_LINE, &line)>0 )
+                error("Different number of records in %s and %s?\n", leg_fname,hap_fname);
+            break;
+        }
+    }
+
+    if ( hts_close(out_fh) ) error("Close failed: %s\n", args->outfname);
+    if ( hts_close(hap_fh) ) error("Close failed: %s\n", hap_fname);
+    if ( hts_close(leg_fh) ) error("Close failed: %s\n", leg_fname);
+    bcf_hdr_destroy(args->header);
+    bcf_destroy(rec);
+    free(sample_fname);
+    free(hap_fname);
+    free(leg_fname);
+    free(args->str.s);
+    free(line.s);
+    free(args->gts);
+    tsv_destroy(hap_tsv);
+    tsv_destroy(leg_tsv);
+
+    fprintf(stderr,"Number of processed rows: \t%d\n", args->n.total);
+}
+
+static void hapsample_to_vcf(args_t *args)
+{
+    /*
+     *  Input: SHAPEIT output
+     *
+     *      20:19995888_A_G 20:19995888 19995888 A G 0 0 0 0 ...
+     *
+     *  First column is expected in the form of CHROM:POS_REF_ALT
+     *
+     *  Output: VCF with filled GT
+     *
+     */
+    kstring_t line = {0,0,0};
+
+    char *hap_fname = NULL, *sample_fname = NULL;
+    sample_fname = strchr(args->infname,',');
+    if ( !sample_fname )
+    {
+        args->str.l = 0;
+        ksprintf(&args->str,"%s.hap.gz", args->infname);
+        hap_fname = strdup(args->str.s);
+        args->str.l = 0;
+        ksprintf(&args->str,"%s.samples", args->infname);
+        sample_fname = strdup(args->str.s);
+    }
+    else
+    {
+        *sample_fname = 0;
+        hap_fname = strdup(args->infname);
+        sample_fname = strdup(sample_fname+1);
+    }
+    htsFile *hap_fh = hts_open(hap_fname, "r");
+    if ( !hap_fh ) error("Could not read: %s\n", hap_fname);
+    if ( hts_getline(hap_fh, KS_SEP_LINE, &line) <= 0 ) error("Empty file: %s\n", hap_fname);
+
+    // Find out the chromosome name, sample names, init and print the VCF header
+    args->str.l = 0;
+    char *se = strchr(line.s,':');
+    if ( !se ) error("Expected CHROM:POS_REF_ALT in first column of %s\n", hap_fname);
+    kputsn(line.s, se-line.s, &args->str);
+
+    tsv_t *tsv = tsv_init("CHROM_POS_REF_ALT,-,POS,REF_ALT,HAPS");
+    tsv_register(tsv, "CHROM_POS_REF_ALT", tsv_setter_chrom_pos_ref_alt, args);
+    tsv_register(tsv, "POS", tsv_setter_verify_pos, NULL);
+    tsv_register(tsv, "REF_ALT", tsv_setter_verify_ref_alt, args);
+    tsv_register(tsv, "HAPS", tsv_setter_haps, args);
+
+    args->header = bcf_hdr_init("w");
+    bcf_hdr_append(args->header, "##FORMAT=<ID=GT,Number=1,Type=String,Description=\"Genotype\">");
+    bcf_hdr_printf(args->header, "##contig=<ID=%s,length=%d>", args->str.s,0x7fffffff);   // MAX_CSI_COOR
+    bcf_hdr_append_version(args->header, args->argc, args->argv, "bcftools_convert");
+
+    int i, nsamples;
+    char **samples = hts_readlist(sample_fname, 1, &nsamples);
+    for (i=2; i<nsamples; i++)
+    {
+        se = samples[i]; while ( *se && !isspace(*se) ) se++;
+        *se = 0;
+        bcf_hdr_add_sample(args->header,samples[i]);
+    }
+    bcf_hdr_add_sample(args->header,NULL);
+    for (i=0; i<nsamples; i++) free(samples[i]);
+    free(samples);
+
+    htsFile *out_fh = hts_open(args->outfname,hts_bcf_wmode(args->output_type));
+    bcf_hdr_write(out_fh,args->header);
+    bcf1_t *rec = bcf_init();
+
+    nsamples -= 2;
+    args->gts = (int32_t *) malloc(sizeof(int32_t)*nsamples*2);
+
+    do
+    {
+        bcf_clear(rec);
+        args->n.total++;
+        if ( !tsv_parse(tsv, rec, line.s) )
+            bcf_write(out_fh, args->header, rec);
+        else
+            error("Error occurred while parsing: %s\n", line.s);
+    }
+    while ( hts_getline(hap_fh, KS_SEP_LINE, &line)>0 );
+
+    if ( hts_close(out_fh) ) error("Close failed: %s\n", args->outfname);
+    if ( hts_close(hap_fh) ) error("Close failed: %s\n", hap_fname);
+    bcf_hdr_destroy(args->header);
+    bcf_destroy(rec);
+    free(sample_fname);
+    free(hap_fname);
+    free(args->str.s);
+    free(line.s);
+    free(args->gts);
+    tsv_destroy(tsv);
+
+    fprintf(stderr,"Number of processed rows: \t%d\n", args->n.total);
+}
+
+static void vcf_to_gensample(args_t *args)
+{
+    kstring_t str = {0,0,0};
+
+    // insert chrom as first column if needed
+    if(args->output_chrom_first_col)
+        kputs("%CHROM ", &str);
+    else
+        kputs("%CHROM:%POS\\_%REF\\_%FIRST_ALT ", &str);
+
+    // insert rsid as second column if needed
+    if(args->output_vcf_ids)
+        kputs("%ID ", &str);
+    else
+        kputs("%CHROM:%POS\\_%REF\\_%FIRST_ALT ", &str);
+
+    kputs("%POS %REF %FIRST_ALT", &str);
+    if ( !args->tag || !strcmp(args->tag,"GT") ) kputs("%_GT_TO_PROB3",&str);
+    else if ( !strcmp(args->tag,"PL") ) kputs("%_PL_TO_PROB3",&str);
+    else if ( !strcmp(args->tag,"GP") ) kputs("%_GP_TO_PROB3",&str);
+    else error("todo: --tag %s\n", args->tag);
+    kputs("\n", &str);
+    open_vcf(args,str.s);
+
+    int ret, gen_compressed = 1, sample_compressed = 0;
+    char *gen_fname = NULL, *sample_fname = NULL;
+    str.l = 0;
+    kputs(args->outfname,&str);
+    int n_files, i;
+    char **files = hts_readlist(str.s, 0, &n_files);
+    if ( n_files==1 )
+    {
+        int l = str.l;
+        kputs(".samples",&str);
+        sample_fname = strdup(str.s);
+        str.l = l;
+        kputs(".gen.gz",&str);
+        gen_fname = strdup(str.s);
+    }
+    else if ( n_files==2 )
+    {
+        if (strlen(files[0]) && strcmp(files[0],".")!=0) gen_fname = strdup(files[0]);
+        if (strlen(files[1]) && strcmp(files[1],".")!=0) sample_fname = strdup(files[1]);
+    }
+    else
+    {
+        error("Error parsing --gensample filenames: %s\n", args->outfname);
+    }
+    for (i=0; i<n_files; i++) free(files[i]);
+    free(files);
+
+    if ( gen_fname && (strlen(gen_fname)<3 || strcasecmp(".gz",gen_fname+strlen(gen_fname)-3)) ) gen_compressed = 0;
+    if ( sample_fname && strlen(sample_fname)>3 && strcasecmp(".gz",sample_fname+strlen(sample_fname)-3)==0 ) sample_compressed = 0;
+
+    if (gen_fname) fprintf(stderr, "Gen file: %s\n", gen_fname);
+    if (sample_fname) fprintf(stderr, "Sample file: %s\n", sample_fname);
+
+    // write samples file
+    if (sample_fname) {
+        int i;
+        BGZF *sout = bgzf_open(sample_fname, sample_compressed ? "wg" : "wu");
+        str.l = 0;
+        kputs("ID_1 ID_2 missing\n0 0 0\n", &str);
+        ret = bgzf_write(sout, str.s, str.l);
+        if ( ret != str.l ) error("Error writing %s: %s\n", sample_fname, strerror(errno));
+        for (i=0; i<bcf_hdr_nsamples(args->header); i++)
+        {
+            str.l = 0;
+            ksprintf(&str, "%s %s 0\n", args->header->samples[i],args->header->samples[i]);
+            ret = bgzf_write(sout, str.s, str.l);
+            if ( ret != str.l ) error("Error writing %s: %s\n", sample_fname, strerror(errno));
+        }
+        if ( bgzf_close(sout)!=0 ) error("Error closing %s: %s\n", sample_fname, strerror(errno));
+        free(sample_fname);
+    }
+    if (!gen_fname) {
+        if ( str.m ) free(str.s);
+        return;
+    }
+
+    int prev_rid = -1, prev_pos = -1;
+    int no_alt = 0, non_biallelic = 0, filtered = 0, ndup = 0;
+    BGZF *gout = bgzf_open(gen_fname, gen_compressed ? "wg" : "wu");
+    while ( bcf_sr_next_line(args->files) )
+    {
+        bcf1_t *line = bcf_sr_get_line(args->files,0);
+        if ( args->filter )
+        {
+            int pass = filter_test(args->filter, line, NULL);
+            if ( args->filter_logic & FLT_EXCLUDE ) pass = pass ? 0 : 1;
+            if ( !pass ) { filtered++; continue; }
+        }
+
+        // ALT allele is required
+        if ( line->n_allele<2 ) { no_alt++; continue; }
+
+        // biallelic required
+        if ( line->n_allele>2 ) {
+            if (!non_biallelic)
+                fprintf(stderr, "Warning: non-biallelic records are skipped. Consider splitting multi-allelic records into biallelic records using 'bcftools norm -m-'.\n");
+            non_biallelic++;
+            continue;
+        }
+
+        // skip duplicate lines, or otherwise shapeit complains
+        if ( prev_rid==line->rid && prev_pos==line->pos ) { ndup++; continue; }
+        prev_rid = line->rid;
+        prev_pos = line->pos;
+
+        str.l = 0;
+        convert_line(args->convert, line, &str);
+        if ( str.l )
+        {
+            int ret = bgzf_write(gout, str.s, str.l);
+            if ( ret!= str.l ) error("Error writing %s: %s\n", gen_fname,strerror(errno));
+        }
+    }
+    fprintf(stderr, "%d records skipped: %d/%d/%d/%d no-ALT/non-biallelic/filtered/duplicated\n", 
+        no_alt+non_biallelic+filtered+ndup, no_alt, non_biallelic, filtered, ndup);
+
+    if ( str.m ) free(str.s);
+    if ( bgzf_close(gout)!=0 ) error("Error closing %s: %s\n", gen_fname,strerror(errno));
+    free(gen_fname);
+}
+
+static void vcf_to_haplegendsample(args_t *args)
+{
+    kstring_t str = {0,0,0};
+    if ( args->hap2dip )
+        kputs("%_GT_TO_HAP2\n", &str);
+    else
+        kputs("%_GT_TO_HAP\n", &str);
+    open_vcf(args,str.s);
+
+    int ret, hap_compressed = 1, legend_compressed = 1, sample_compressed = 0;
+    char *hap_fname = NULL, *legend_fname = NULL, *sample_fname = NULL;
+    str.l = 0;
+    kputs(args->outfname,&str);
+    int n_files, i;
+    char **files = hts_readlist(str.s, 0, &n_files);
+    if ( n_files==1 )
+    {
+        int l = str.l;
+        kputs(".samples",&str);
+        sample_fname = strdup(str.s);
+        str.l = l;
+        kputs(".legend.gz",&str);
+        legend_fname = strdup(str.s);
+        str.l = l;
+        kputs(".hap.gz",&str);
+        hap_fname = strdup(str.s);
+    }
+    else if ( n_files==3 )
+    {
+        if (strlen(files[0]) && strcmp(files[0],".")!=0) hap_fname = strdup(files[0]);
+        if (strlen(files[1]) && strcmp(files[1],".")!=0) legend_fname = strdup(files[1]);
+        if (strlen(files[2]) && strcmp(files[2],".")!=0) sample_fname = strdup(files[2]);
+    }
+    else
+    {
+        error("Error parsing --hapslegendsample filenames: %s\n", args->outfname);
+    }
+    for (i=0; i<n_files; i++) free(files[i]);
+    free(files);
+
+    if ( hap_fname && (strlen(hap_fname)<3 || strcasecmp(".gz",hap_fname+strlen(hap_fname)-3)) ) hap_compressed = 0;
+    if ( legend_fname && (strlen(legend_fname)<3 || strcasecmp(".gz",legend_fname+strlen(legend_fname)-3)) ) legend_compressed = 0;
+    if ( sample_fname && strlen(sample_fname)>3 && strcasecmp(".gz",sample_fname+strlen(sample_fname)-3)==0 ) sample_compressed = 0;
+
+    if (hap_fname) fprintf(stderr, "Haps file: %s\n", hap_fname);
+    if (legend_fname) fprintf(stderr, "Legend file: %s\n", legend_fname);
+    if (sample_fname) fprintf(stderr, "Sample file: %s\n", sample_fname);
+
+    // write samples file
+    if (sample_fname) {
+        int i;
+        BGZF *sout = bgzf_open(sample_fname, sample_compressed ? "wg" : "wu");
+        str.l = 0;
+        kputs("sample population group sex\n", &str);
+        ret = bgzf_write(sout, str.s, str.l);
+        if ( ret != str.l ) error("Error writing %s: %s\n", sample_fname, strerror(errno));
+        for (i=0; i<bcf_hdr_nsamples(args->header); i++)
+        {
+            str.l = 0;
+            ksprintf(&str, "%s %s %s 2\n", args->header->samples[i], args->header->samples[i], args->header->samples[i]);
+            ret = bgzf_write(sout, str.s, str.l);
+            if ( ret != str.l ) error("Error writing %s: %s\n", sample_fname, strerror(errno));
+        }
+        if ( bgzf_close(sout)!=0 ) error("Error closing %s: %s\n", sample_fname, strerror(errno));
+        free(sample_fname);
+    }
+    if (!hap_fname && !legend_fname) {
+        if ( str.m ) free(str.s);
+        return;
+    }
+
+    // open haps and legend outputs
+    BGZF *hout = hap_fname ? bgzf_open(hap_fname, hap_compressed ? "wg" : "wu") : NULL;
+    BGZF *lout = legend_fname ? bgzf_open(legend_fname, legend_compressed ? "wg" : "wu") : NULL;
+    if (legend_fname) {
+        str.l = 0;
+        kputs("id position a0 a1\n", &str);
+        ret = bgzf_write(lout, str.s, str.l);
+        if ( ret != str.l ) error("Error writing %s: %s\n", legend_fname, strerror(errno));
+    }
+
+    int no_alt = 0, non_biallelic = 0, filtered = 0;
+    while ( bcf_sr_next_line(args->files) )
+    {
+        bcf1_t *line = bcf_sr_get_line(args->files,0);
+        if ( args->filter )
+        {
+            int pass = filter_test(args->filter, line, NULL);
+            if ( args->filter_logic & FLT_EXCLUDE ) pass = pass ? 0 : 1;
+            if ( !pass ) { filtered++; continue; }
+        }
+
+        // ALT allele is required
+        if ( line->n_allele<2 ) { no_alt++; continue; }
+        // biallelic required
+        if ( line->n_allele>2 ) {
+            if (!non_biallelic)
+                fprintf(stderr, "Warning: non-biallelic records are skipped. Consider splitting multi-allelic records into biallelic records using 'bcftools norm -m-'.\n");
+            non_biallelic++;
+            continue;
+        }
+
+        str.l = 0;
+        convert_line(args->convert, line, &str);
+        if ( !str.l ) continue;
+
+        // write haps file
+        if (hap_fname) {
+            ret = bgzf_write(hout, str.s, str.l); // write hap file
+            if ( ret != str.l ) error("Error writing %s: %s\n", hap_fname, strerror(errno));
+        }
+        if (legend_fname) {
+            str.l = 0;
+            if ( args->output_vcf_ids && (line->d.id[0]!='.' || line->d.id[1]!=0) )
+                ksprintf(&str, "%s %d %s %s\n", line->d.id, line->pos+1, line->d.allele[0], line->d.allele[1]);
+            else
+                ksprintf(&str, "%s:%d_%s_%s %d %s %s\n", bcf_seqname(args->header, line), line->pos+1, line->d.allele[0], line->d.allele[1], line->pos+1, line->d.allele[0], line->d.allele[1]);
+
+            // write legend file
+            ret = bgzf_write(lout, str.s, str.l);
+            if ( ret != str.l ) error("Error writing %s: %s\n", legend_fname, strerror(errno));
+        }
+    }
+    fprintf(stderr, "%d records skipped: %d/%d/%d no-ALT/non-biallelic/filtered\n", no_alt+non_biallelic+filtered, no_alt, non_biallelic, filtered);
+    if ( str.m ) free(str.s);
+    if ( hout && bgzf_close(hout)!=0 ) error("Error closing %s: %s\n", hap_fname, strerror(errno));
+    if ( lout && bgzf_close(lout)!=0 ) error("Error closing %s: %s\n", legend_fname, strerror(errno));
+    if (hap_fname) free(hap_fname);
+    if (legend_fname) free(legend_fname);
+}
+
+static void vcf_to_hapsample(args_t *args)
+{
+    /*
+     *  WTCCC style haplotypes file
+     *  see https://mathgen.stats.ox.ac.uk/genetics_software/shapeit/shapeit.html#hapsample
+     *
+     *  These are essentially the haplotypes from the impute2 format with some
+     *  legend info tacked on to the first 5 columns
+     *
+     */
+    kstring_t str = {0,0,0};
+
+    // print ID instead of CHROM:POS_REF_ALT1
+    if ( args->output_vcf_ids )
+        kputs("%CHROM %ID %POS %REF %FIRST_ALT ", &str);
+    else
+        kputs("%CHROM %CHROM:%POS\\_%REF\\_%FIRST_ALT %POS %REF %FIRST_ALT ", &str);
+    
+    if ( args->hap2dip )
+        kputs("%_GT_TO_HAP2\n", &str);
+    else
+        kputs("%_GT_TO_HAP\n", &str);
+    open_vcf(args,str.s);
+
+    int ret, hap_compressed = 1, sample_compressed = 0;
+    char *hap_fname = NULL, *sample_fname = NULL;
+    str.l = 0;
+    kputs(args->outfname,&str);
+    int n_files, i;
+    char **files = hts_readlist(str.s, 0, &n_files);
+    if ( n_files==1 )
+    {
+        int l = str.l;
+        kputs(".sample",&str);
+        sample_fname = strdup(str.s);
+        str.l = l;
+        kputs(".hap.gz",&str);
+        hap_fname = strdup(str.s);
+    }
+    else if ( n_files==2 )
+    {
+        if (strlen(files[0]) && strcmp(files[0],".")!=0) hap_fname = strdup(files[0]);
+        if (strlen(files[1]) && strcmp(files[1],".")!=0) sample_fname = strdup(files[1]);
+    }
+    else
+    {
+        error("Error parsing --hapsample filenames: %s\n", args->outfname);
+    }
+    for (i=0; i<n_files; i++) free(files[i]);
+    free(files);
+
+    if ( hap_fname && (strlen(hap_fname)<3 || strcasecmp(".gz",hap_fname+strlen(hap_fname)-3)) ) hap_compressed = 0;
+    if ( sample_fname && strlen(sample_fname)>3 && strcasecmp(".gz",sample_fname+strlen(sample_fname)-3)==0 ) sample_compressed = 0;
+
+    if (hap_fname) fprintf(stderr, "Haps file: %s\n", hap_fname);
+    if (sample_fname) fprintf(stderr, "Sample file: %s\n", sample_fname);
+
+    // write samples file
+    if (sample_fname) {
+        int i;
+        BGZF *sout = bgzf_open(sample_fname, sample_compressed ? "wg" : "wu");
+        str.l = 0;
+        kputs("ID_1 ID_2 missing\n0 0 0\n", &str);
+        ret = bgzf_write(sout, str.s, str.l);
+        if ( ret != str.l ) error("Error writing %s: %s\n", sample_fname, strerror(errno));
+        for (i=0; i<bcf_hdr_nsamples(args->header); i++)
+        {
+            str.l = 0;
+            ksprintf(&str, "%s %s 0\n", args->header->samples[i], args->header->samples[i]);
+            ret = bgzf_write(sout, str.s, str.l);
+            if ( ret != str.l ) error("Error writing %s: %s\n", sample_fname, strerror(errno));
+        }
+        if ( bgzf_close(sout)!=0 ) error("Error closing %s: %s\n", sample_fname, strerror(errno));
+        free(sample_fname);
+    }
+    if (!hap_fname) {
+        if ( str.m ) free(str.s);
+        return;
+    }
+
+    // open haps output
+    BGZF *hout = hap_fname ? bgzf_open(hap_fname, hap_compressed ? "wg" : "wu") : NULL;
+
+    int no_alt = 0, non_biallelic = 0, filtered = 0;
+    while ( bcf_sr_next_line(args->files) )
+    {
+        bcf1_t *line = bcf_sr_get_line(args->files,0);
+        if ( args->filter )
+        {
+            int pass = filter_test(args->filter, line, NULL);
+            if ( args->filter_logic & FLT_EXCLUDE ) pass = pass ? 0 : 1;
+            if ( !pass ) { filtered++; continue; }
+        }
+
+        // ALT allele is required
+        if ( line->n_allele<2 ) { no_alt++; continue; }
+        // biallelic required
+        if ( line->n_allele>2 ) {
+            if (!non_biallelic)
+                fprintf(stderr, "Warning: non-biallelic records are skipped. Consider splitting multi-allelic records into biallelic records using 'bcftools norm -m-'.\n");
+            non_biallelic++;
+            continue;
+        }
+
+        str.l = 0;
+        convert_line(args->convert, line, &str);
+        if ( !str.l ) continue;
+
+        // write haps file
+        if (hap_fname) {
+            ret = bgzf_write(hout, str.s, str.l); // write hap file
+            if ( ret != str.l ) error("Error writing %s: %s\n", hap_fname, strerror(errno));
+        }
+    }
+    fprintf(stderr, "%d records skipped: %d/%d/%d no-ALT/non-biallelic/filtered\n", no_alt+non_biallelic+filtered, no_alt, non_biallelic, filtered);
+    if ( str.m ) free(str.s);
+    if ( hout && bgzf_close(hout)!=0 ) error("Error closing %s: %s\n", hap_fname, strerror(errno));
+    if (hap_fname) free(hap_fname);
+}
+
+static void bcf_hdr_set_chrs(bcf_hdr_t *hdr, faidx_t *fai)
+{
+    int i, n = faidx_nseq(fai);
+    for (i=0; i<n; i++)
+    {
+        const char *seq = faidx_iseq(fai,i);
+        int len = faidx_seq_len(fai, seq);
+        bcf_hdr_printf(hdr, "##contig=<ID=%s,length=%d>", seq,len);
+    }
+}
+static inline int acgt_to_5(char base)
+{
+    if ( base=='A' ) return 0;
+    if ( base=='C' ) return 1;
+    if ( base=='G' ) return 2;
+    if ( base=='T' ) return 3;
+    return 4;
+}
+static inline int tsv_setter_aa1(args_t *args, char *ss, char *se, int alleles[], int *nals, int ref, int32_t *gts)
+{
+    if ( se - ss > 2 ) return -1;   // currently only SNPs
+
+    if ( ss[0]=='-' )
+    {
+        // missing GT
+        gts[0] = bcf_gt_missing;
+        gts[1] = bcf_int32_vector_end;
+        args->n.missing++;
+        return 0;
+    }
+    if ( ss[0]=='I' ) return -2;    // skip insertions/deletions for now
+    if ( ss[0]=='D' ) return -2;
+
+    int a0 = acgt_to_5(toupper(ss[0]));
+    int a1 = ss[1] ? acgt_to_5(toupper(ss[1])) : a0;
+    if ( alleles[a0]<0 ) alleles[a0] = (*nals)++;
+    if ( alleles[a1]<0 ) alleles[a1] = (*nals)++;
+
+    gts[0] = bcf_gt_unphased(alleles[a0]); 
+    gts[1] = ss[1] ? bcf_gt_unphased(alleles[a1]) : bcf_int32_vector_end;
+
+    if ( ref==a0 && ref==a1  ) args->n.hom_rr++;    // hom ref: RR
+    else if ( ref==a0 ) args->n.het_ra++;           // het: RA
+    else if ( ref==a1 ) args->n.het_ra++;           // het: AR
+    else if ( a0==a1 ) args->n.hom_aa++;            // hom-alt: AA
+    else args->n.het_aa++;                          // non-ref het: AA
+
+    return 0;
+}
+static int tsv_setter_aa(tsv_t *tsv, bcf1_t *rec, void *usr)
+{
+    args_t *args = (args_t*) usr;
+
+    int len;
+    char *ref = faidx_fetch_seq(args->ref, (char*)bcf_hdr_id2name(args->header,rec->rid), rec->pos, rec->pos, &len);
+    if ( !ref ) error("faidx_fetch_seq failed at %s:%d\n", bcf_hdr_id2name(args->header,rec->rid), rec->pos+1);
+
+    int nals = 1, alleles[5] = { -1, -1, -1, -1, -1 };    // a,c,g,t,n
+    ref[0] = toupper(ref[0]);
+    int iref = acgt_to_5(ref[0]);
+    alleles[iref] = 0;
+
+    rec->n_sample = bcf_hdr_nsamples(args->header);
+
+    int i, ret;
+    for (i=0; i<rec->n_sample; i++)
+    {
+        if ( i>0 )
+        {
+            ret = tsv_next(tsv);
+            if ( ret==-1 ) error("Too few columns for %d samples at %s:%d\n", rec->n_sample,bcf_hdr_id2name(args->header,rec->rid), rec->pos+1);
+        }
+        ret = tsv_setter_aa1(args, tsv->ss, tsv->se, alleles, &nals, iref, args->gts+i*2);
+        if ( ret==-1 ) error("Error parsing the site %s:%d, expected two characters\n", bcf_hdr_id2name(args->header,rec->rid), rec->pos+1);
+        if ( ret==-2 ) 
+        {
+            // something else than a SNP
+            free(ref);
+            return -1;
+        }
+    }
+
+    args->str.l = 0;
+    kputc(ref[0], &args->str);
+    for (i=0; i<5; i++) 
+    {
+        if ( alleles[i]>0 )
+        {
+            kputc(',', &args->str);
+            kputc("ACGTN"[i], &args->str);
+        }
+    }
+    bcf_update_alleles_str(args->header, rec, args->str.s);
+    if ( bcf_update_genotypes(args->header,rec,args->gts,rec->n_sample*2) ) error("Could not update the GT field\n");
+
+    free(ref);
+    return 0;
+}
+
+static void tsv_to_vcf(args_t *args)
+{
+    if ( !args->ref_fname ) error("Missing the --ref option\n");
+    if ( !args->sample_list ) error("Missing the --samples option\n");
+
+    args->ref = fai_load(args->ref_fname);
+    if ( !args->ref ) error("Could not load the reference %s\n", args->ref_fname);
+
+    args->header = bcf_hdr_init("w");
+    bcf_hdr_set_chrs(args->header, args->ref);
+    bcf_hdr_append(args->header, "##FORMAT=<ID=GT,Number=1,Type=String,Description=\"Genotype\">");
+    bcf_hdr_append_version(args->header, args->argc, args->argv, "bcftools_convert");
+
+    int i, n;
+    char **smpls = hts_readlist(args->sample_list, args->sample_is_file, &n);
+    if ( !smpls ) error("Could not parse %s\n", args->sample_list);
+    for (i=0; i<n; i++)
+    {
+        bcf_hdr_add_sample(args->header, smpls[i]);
+        free(smpls[i]);
+    }
+    free(smpls);
+    bcf_hdr_add_sample(args->header, NULL);
+    args->gts = (int32_t *) malloc(sizeof(int32_t)*n*2);
+
+    htsFile *out_fh = hts_open(args->outfname,hts_bcf_wmode(args->output_type));
+    bcf_hdr_write(out_fh,args->header);
+
+    tsv_t *tsv = tsv_init(args->columns ? args->columns : "ID,CHROM,POS,AA");
+    if ( tsv_register(tsv, "CHROM", tsv_setter_chrom, args->header) < 0 ) error("Expected CHROM column\n");
+    if ( tsv_register(tsv, "POS", tsv_setter_pos, NULL) < 0 ) error("Expected POS column\n");
+    if ( tsv_register(tsv, "ID", tsv_setter_id, args->header) < 0 && !args->columns ) error("Expected ID column\n");
+    if ( tsv_register(tsv, "AA", tsv_setter_aa, args) < 0 ) error("Expected AA column\n");
+
+    bcf1_t *rec = bcf_init();
+    bcf_float_set_missing(rec->qual);
+
+    kstring_t line = {0,0,0};
+    htsFile *in_fh = hts_open(args->infname, "r");
+    if ( !in_fh ) error("Could not read: %s\n", args->infname);
+    while ( hts_getline(in_fh, KS_SEP_LINE, &line) > 0 )
+    {
+        if ( line.s[0]=='#' ) continue;     // skip comments
+        bcf_clear(rec);
+
+        args->n.total++;
+        if ( !tsv_parse(tsv, rec, line.s) )
+            bcf_write(out_fh, args->header, rec);
+        else
+            args->n.skipped++;
+    }
+    if ( hts_close(in_fh) ) error("Close failed: %s\n", args->infname);
+    free(line.s);
+
+    fai_destroy(args->ref);
+    bcf_hdr_destroy(args->header);
+    hts_close(out_fh);
+    tsv_destroy(tsv);
+    bcf_destroy(rec);
+    free(args->str.s);
+    free(args->gts);
+
+    fprintf(stderr,"Rows total: \t%d\n", args->n.total);
+    fprintf(stderr,"Rows skipped: \t%d\n", args->n.skipped);
+    fprintf(stderr,"Missing GTs: \t%d\n", args->n.missing);
+    fprintf(stderr,"Hom RR: \t%d\n", args->n.hom_rr);
+    fprintf(stderr,"Het RA: \t%d\n", args->n.het_ra);
+    fprintf(stderr,"Hom AA: \t%d\n", args->n.hom_aa);
+    fprintf(stderr,"Het AA: \t%d\n", args->n.het_aa);
+}
+
+static void vcf_to_vcf(args_t *args)
+{
+    open_vcf(args,NULL);
+    htsFile *out_fh = hts_open(args->outfname,hts_bcf_wmode(args->output_type));
+    if ( !out_fh ) error("Failed to open: %s\n", args->outfname);
+
+    bcf_hdr_t *hdr = bcf_sr_get_header(args->files,0);
+    bcf_hdr_write(out_fh,hdr);
+
+    while ( bcf_sr_next_line(args->files) )
+    {
+        bcf1_t *line = bcf_sr_get_line(args->files,0);
+        if ( args->filter )
+        {
+            int pass = filter_test(args->filter, line, NULL);
+            if ( args->filter_logic & FLT_EXCLUDE ) pass = pass ? 0 : 1;
+            if ( !pass ) continue;
+        }
+        bcf_write(out_fh,hdr,line);
+    }
+    hts_close(out_fh);
+}
+
+static void gvcf_to_vcf(args_t *args)
+{
+    open_vcf(args,NULL);
+    htsFile *out_fh = hts_open(args->outfname,hts_bcf_wmode(args->output_type));
+    if ( !out_fh ) error("Failed to open: %s\n", args->outfname);
+
+    bcf_hdr_t *hdr = bcf_sr_get_header(args->files,0);
+    bcf_hdr_append_version(hdr, args->argc, args->argv, "bcftools_convert");
+    bcf_hdr_write(out_fh,hdr);
+
+    int32_t *itmp = NULL, nitmp = 0;
+
+    while ( bcf_sr_next_line(args->files) )
+    {
+        bcf1_t *line = bcf_sr_get_line(args->files,0);
+        if ( args->filter )
+        {
+            int pass = filter_test(args->filter, line, NULL);
+            if ( args->filter_logic & FLT_EXCLUDE ) pass = pass ? 0 : 1;
+            if ( !pass ) continue;
+        }
+
+        if ( line->n_allele!=1 || !bcf_has_filter(hdr,line,"PASS") )
+        {
+            // Assuming that only ALT=. sites can be blocks and skipping sites which don't PASS
+            bcf_write(out_fh,hdr,line);
+            continue;
+        }
+
+        int nend = bcf_get_info_int32(hdr,line,"END",&itmp,&nitmp);
+        if ( nend!=1 )
+        {
+            // No END lineord
+            bcf_write(out_fh,hdr,line);
+            continue;
+        }
+        bcf_update_info_int32(hdr,line,"END",NULL,0);
+        int pos;
+        for (pos=line->pos; pos<=itmp[0]; pos++)
+        {
+            line->pos = pos;
+            bcf_write(out_fh,hdr,line);
+        }
+    }
+    free(itmp);
+    hts_close(out_fh);
+}
+
+static void usage(void)
+{
+    fprintf(stderr, "\n");
+    fprintf(stderr, "About:   Converts VCF/BCF to other formats and back. See man page for file\n");
+    fprintf(stderr, "         formats details. When specifying output files explicitly instead\n");
+    fprintf(stderr, "         of with <prefix>, one can use '-' for stdout and '.' to suppress.\n");
+    fprintf(stderr, "Usage:   bcftools convert [OPTIONS] <input_file>\n");
+    fprintf(stderr, "\n");
+    fprintf(stderr, "VCF input options:\n");
+    fprintf(stderr, "   -e, --exclude <expr>        exclude sites for which the expression is true\n");
+    fprintf(stderr, "   -i, --include <expr>        select sites for which the expression is true\n");
+    fprintf(stderr, "   -r, --regions <region>      restrict to comma-separated list of regions\n");
+    fprintf(stderr, "   -R, --regions-file <file>   restrict to regions listed in a file\n");
+    fprintf(stderr, "   -s, --samples <list>        list of samples to include\n");
+    fprintf(stderr, "   -S, --samples-file <file>   file of samples to include\n");
+    fprintf(stderr, "   -t, --targets <region>      similar to -r but streams rather than index-jumps\n");
+    fprintf(stderr, "   -T, --targets-file <file>   similar to -R but streams rather than index-jumps\n");
+    fprintf(stderr, "\n");
+    fprintf(stderr, "VCF output options:\n");
+    fprintf(stderr, "   -o, --output <file>            output file name [stdout]\n");
+    fprintf(stderr, "   -O, --output-type <b|u|z|v>    b: compressed BCF, u: uncompressed BCF, z: compressed VCF, v: uncompressed VCF [v]\n");
+    fprintf(stderr, "\n");
+    fprintf(stderr, "GEN/SAMPLE conversion (input/output from IMPUTE2):\n");
+    fprintf(stderr, "   -G, --gensample2vcf <...>   <prefix>|<gen-file>,<sample-file>\n");
+    fprintf(stderr, "   -g, --gensample <...>       <prefix>|<gen-file>,<sample-file>\n");
+    fprintf(stderr, "       --tag <string>          tag to take values for .gen file: GT,PL,GL,GP [GT]\n");
+    fprintf(stderr, "       --chrom                 output chromosome in first column instead of CHROM:POS_REF_ALT\n");
+    fprintf(stderr, "       --vcf-ids               output VCF IDs in second column instead of CHROM:POS_REF_ALT\n");
+    fprintf(stderr, "\n");
+    fprintf(stderr, "gVCF conversion:\n");
+    fprintf(stderr, "       --gvcf2vcf              \n");
+    fprintf(stderr, "\n");
+    fprintf(stderr, "HAP/SAMPLE conversion (output from SHAPEIT):\n");
+    fprintf(stderr, "       --hapsample2vcf <...>   <prefix>|<haps-file>,<sample-file>\n");
+    fprintf(stderr, "       --hapsample <...>       <prefix>|<haps-file>,<sample-file>\n");
+    fprintf(stderr, "       --haploid2diploid       convert haploid genotypes to diploid homozygotes\n");
+    fprintf(stderr, "       --vcf-ids               output VCF IDs instead of CHROM:POS_REF_ALT\n");
+    fprintf(stderr, "\n");
+    fprintf(stderr, "HAP/LEGEND/SAMPLE conversion:\n");
+    fprintf(stderr, "   -H, --haplegendsample2vcf <...>  <prefix>|<hap-file>,<legend-file>,<sample-file>\n");
+    fprintf(stderr, "   -h, --haplegendsample <...>      <prefix>|<hap-file>,<legend-file>,<sample-file>\n");
+    fprintf(stderr, "       --haploid2diploid            convert haploid genotypes to diploid homozygotes\n");
+    fprintf(stderr, "       --vcf-ids                    output VCF IDs instead of CHROM:POS_REF_ALT\n");
+    fprintf(stderr, "\n");
+    fprintf(stderr, "TSV conversion:\n");
+    fprintf(stderr, "       --tsv2vcf <file>        \n");
+    fprintf(stderr, "   -c, --columns <string>      columns of the input tsv file [ID,CHROM,POS,AA]\n");
+    fprintf(stderr, "   -f, --fasta-ref <file>      reference sequence in fasta format\n");
+    fprintf(stderr, "   -s, --samples <list>        list of sample names\n");
+    fprintf(stderr, "   -S, --samples-file <file>   file of sample names\n");
+    fprintf(stderr, "\n");
+    // fprintf(stderr, "PLINK options:\n");
+    // fprintf(stderr, "   -p, --plink <prefix>|<ped>,<map>,<fam>|<bed>,<bim>,<fam>|<tped>,<tfam>\n");
+    // fprintf(stderr, "       --tped              make tped file instead\n");
+    // fprintf(stderr, "       --bin               make binary bed/fam/bim files\n");
+    // fprintf(stderr, "\n");
+    // fprintf(stderr, "PBWT options:\n");
+    // fprintf(stderr, "   -b, --pbwt          <prefix> or <pbwt>,<sites>,<sample>,<missing>\n");
+    // fprintf(stderr, "\n");
+    exit(1);
+}
+
+int main_vcfconvert(int argc, char *argv[])
+{
+    int c;
+    args_t *args = (args_t*) calloc(1,sizeof(args_t));
+    args->argc   = argc; args->argv = argv;
+    args->outfname = "-";
+    args->output_type = FT_VCF;
+
+    static struct option loptions[] =
+    {
+        {"include",required_argument,NULL,'i'},
+        {"exclude",required_argument,NULL,'e'},
+        {"output",required_argument,NULL,'o'},
+        {"output-type",required_argument,NULL,'O'},
+        {"regions",required_argument,NULL,'r'},
+        {"regions-file",required_argument,NULL,'R'},
+        {"targets",required_argument,NULL,'t'},
+        {"targets-file",required_argument,NULL,'T'},
+        {"samples",required_argument,NULL,'s'},
+        {"samples-file",required_argument,NULL,'S'},
+        {"gensample",required_argument,NULL,'g'},
+        {"gensample2vcf",required_argument,NULL,'G'},
+        {"tag",required_argument,NULL,1},
+        {"chrom",no_argument,NULL,8},        
+        {"tsv2vcf",required_argument,NULL,2},
+        {"hapsample",required_argument,NULL,7},
+        {"hapsample2vcf",required_argument,NULL,3},
+        {"vcf-ids",no_argument,NULL,4},
+        {"haploid2diploid",no_argument,NULL,5},
+        {"gvcf2vcf",no_argument,NULL,6},
+        {"haplegendsample",required_argument,NULL,'h'},
+        {"haplegendsample2vcf",required_argument,NULL,'H'},
+        {"columns",required_argument,NULL,'c'},
+        {"fasta-ref",required_argument,NULL,'f'},
+        {0,0,0,0}
+    };
+    while ((c = getopt_long(argc, argv, "?h:r:R:s:S:t:T:i:e:g:G:o:O:c:f:H:",loptions,NULL)) >= 0) {
+        switch (c) {
+            case 'e': args->filter_str = optarg; args->filter_logic |= FLT_EXCLUDE; break;
+            case 'i': args->filter_str = optarg; args->filter_logic |= FLT_INCLUDE; break;
+            case 'r': args->regions_list = optarg; break;
+            case 'R': args->regions_list = optarg; args->regions_is_file = 1; break;
+            case 't': args->targets_list = optarg; break;
+            case 'T': args->targets_list = optarg; args->targets_is_file = 1; break;
+            case 's': args->sample_list = optarg; break;
+            case 'S': args->sample_list = optarg; args->sample_is_file = 1; break;
+            case 'g': args->convert_func = vcf_to_gensample; args->outfname = optarg; break;
+            case 'G': args->convert_func = gensample_to_vcf; args->infname = optarg; break;
+            case  1 : args->tag = optarg; break;
+            case  2 : args->convert_func = tsv_to_vcf; args->infname = optarg; break;
+            case  3 : args->convert_func = hapsample_to_vcf; args->infname = optarg; break;
+            case  4 : args->output_vcf_ids = 1; break;
+            case  5 : args->hap2dip = 1; break;
+            case  6 : args->convert_func = gvcf_to_vcf; break;
+            case  7 : args->convert_func = vcf_to_hapsample; args->outfname = optarg; break;
+            case  8 : args->output_chrom_first_col = 1; break;
+            case 'H': args->convert_func = haplegendsample_to_vcf; args->infname = optarg; break;
+            case 'f': args->ref_fname = optarg; break;
+            case 'c': args->columns = optarg; break;
+            case 'o': args->outfname = optarg; break;
+            case 'O':
+                switch (optarg[0]) {
+                    case 'b': args->output_type = FT_BCF_GZ; break;
+                    case 'u': args->output_type = FT_BCF; break;
+                    case 'z': args->output_type = FT_VCF_GZ; break;
+                    case 'v': args->output_type = FT_VCF; break;
+                    default: error("The output type \"%s\" not recognised\n", optarg);
+                }
+                break;
+            case 'h': args->convert_func = vcf_to_haplegendsample; args->outfname = optarg; break;
+            case '?': usage();
+            default: error("Unknown argument: %s\n", optarg);
+        }
+    }
+
+    if ( !args->infname )
+    {
+        if ( optind>=argc )
+        {
+            if ( !isatty(fileno((FILE *)stdin)) ) args->infname = "-";
+        }
+        else args->infname = argv[optind];
+    }
+    if ( !args->infname ) usage();
+    
+    if ( args->convert_func ) args->convert_func(args);
+    else vcf_to_vcf(args);
+
+    destroy_data(args);
+    free(args);
+    return 0;
+}
diff --git a/vcffilter.c b/vcffilter.c
new file mode 100644
index 0000000..481941c
--- /dev/null
+++ b/vcffilter.c
@@ -0,0 +1,563 @@
+/*  vcffilter.c -- Apply fixed-threshold filters.
+
+    Copyright (C) 2013-2014 Genome Research Ltd.
+
+    Author: Petr Danecek <pd3 at sanger.ac.uk>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.  */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <getopt.h>
+#include <ctype.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <math.h>
+#include <htslib/vcf.h>
+#include <htslib/synced_bcf_reader.h>
+#include <htslib/vcfutils.h>
+#include "bcftools.h"
+#include "filter.h"
+#include "rbuf.h"
+
+// Logic of the filters: include or exclude sites which match the filters?
+#define FLT_INCLUDE 1
+#define FLT_EXCLUDE 2
+
+// FILTER columns annotation: replace or add to existing FILTERs; set FILTER to PASS at good sites?
+#define ANNOT_ADD   1
+#define ANNOT_RESET 2
+
+// Set genotypes of filtered samples
+#define SET_GTS_MISSING 1
+#define SET_GTS_REF 2
+
+typedef struct _args_t
+{
+    filter_t *filter;
+    char *filter_str;
+    int filter_logic;   // include or exclude sites which match the filters? One of FLT_INCLUDE/FLT_EXCLUDE
+    const uint8_t *smpl_pass;
+    int set_gts;
+    char *soft_filter;  // drop failed sites or annotate FILTER column?
+    int annot_mode;     // add to existing FILTER annotation or replace? Otherwise reset FILTER to PASS or leave as it is?
+    int flt_fail, flt_pass;     // BCF ids of fail and pass filters
+    int snp_gap, indel_gap, IndelGap_id, SnpGap_id;
+    int32_t ntmpi, *tmpi, ntmp_ac, *tmp_ac;
+    rbuf_t rbuf;
+    bcf1_t **rbuf_lines;
+
+    bcf_srs_t *files;
+    bcf_hdr_t *hdr;
+    htsFile *out_fh;
+    int output_type;
+
+    char **argv, *output_fname, *targets_list, *regions_list;
+    int argc;
+}
+args_t;
+
+static void init_data(args_t *args)
+{
+    args->out_fh = hts_open(args->output_fname,hts_bcf_wmode(args->output_type));
+    if ( args->out_fh == NULL ) error("Can't write to \"%s\": %s\n", args->output_fname, strerror(errno));
+
+    args->hdr = args->files->readers[0].header;
+    args->flt_pass = bcf_hdr_id2int(args->hdr,BCF_DT_ID,"PASS"); assert( !args->flt_pass );  // sanity check: required by BCF spec
+
+    // -i or -e: append FILTER line
+    if ( args->soft_filter && args->filter_logic )
+    {
+        kstring_t flt_name = {0,0,0};
+        if ( strcmp(args->soft_filter,"+") )
+            kputs(args->soft_filter, &flt_name);
+        else
+        {
+            // Make up a filter name
+            int i = 0, id = -1;
+            do
+            {
+                ksprintf(&flt_name,"Filter%d", ++i);
+                id = bcf_hdr_id2int(args->hdr,BCF_DT_ID,flt_name.s);
+            }
+            while ( bcf_hdr_idinfo_exists(args->hdr,BCF_HL_FLT,id) );
+        }
+        // escape quotes
+        kstring_t tmp = {0,0,0};
+        char *t = args->filter_str;
+        while ( *t )
+        {
+            if ( *t=='"' ) kputc('\\',&tmp);
+            kputc(*t,&tmp);
+            t++;
+        }
+        int ret = bcf_hdr_printf(args->hdr, "##FILTER=<ID=%s,Description=\"Set if %s: %s\">", flt_name.s,args->filter_logic & FLT_INCLUDE ? "not true" : "true", tmp.s);
+        if ( ret!=0 )
+            error("Failed to append header line: ##FILTER=<ID=%s,Description=\"Set if %s: %s\">\n", flt_name.s,args->filter_logic & FLT_INCLUDE ? "not true" : "true", tmp.s);
+        args->flt_fail = bcf_hdr_id2int(args->hdr,BCF_DT_ID,flt_name.s); assert( args->flt_fail>=0 );
+        free(flt_name.s);
+        free(tmp.s);
+    }
+
+    if ( args->snp_gap || args->indel_gap )
+    {
+        if ( !args->filter_logic && args->soft_filter && strcmp(args->soft_filter,"+") )
+        {
+            kstring_t tmp = {0,0,0};
+            if ( args->snp_gap ) kputs("\"SnpGap\"", &tmp);
+            if ( args->indel_gap )
+            {
+                if ( tmp.s ) kputs(" and ", &tmp);
+                kputs("\"IndelGap\"", &tmp);
+            }
+            fprintf(stderr,"Warning: using %s filter name instead of \"%s\"\n", tmp.s,args->soft_filter);
+            free(tmp.s);
+        }
+
+        rbuf_init(&args->rbuf, 64);
+        args->rbuf_lines = (bcf1_t**) calloc(args->rbuf.m, sizeof(bcf1_t*));
+        if ( args->snp_gap )
+        {
+            bcf_hdr_printf(args->hdr, "##FILTER=<ID=SnpGap,Description=\"SNP within %d bp of an indel\">", args->snp_gap);
+            args->SnpGap_id = bcf_hdr_id2int(args->hdr, BCF_DT_ID, "SnpGap");
+            assert( args->SnpGap_id>=0 );
+        }
+        if ( args->indel_gap )
+        {
+            bcf_hdr_printf(args->hdr, "##FILTER=<ID=IndelGap,Description=\"Indel within %d bp of an indel\">", args->indel_gap);
+            args->IndelGap_id = bcf_hdr_id2int(args->hdr, BCF_DT_ID, "IndelGap");
+            assert( args->IndelGap_id>=0 );
+        }
+    }
+
+    bcf_hdr_append_version(args->hdr, args->argc, args->argv, "bcftools_filter");
+
+    if ( args->filter_str )
+        args->filter = filter_init(args->hdr, args->filter_str);
+}
+
+static void destroy_data(args_t *args)
+{
+    if ( args->rbuf_lines )
+    {
+        int i;
+        for (i=0; i<args->rbuf.m; i++)
+            if ( args->rbuf_lines[i] ) bcf_destroy1(args->rbuf_lines[i]);
+        free(args->rbuf_lines);
+    }
+    if ( args->filter )
+        filter_destroy(args->filter);
+    free(args->tmpi);
+    free(args->tmp_ac);
+}
+
+static void flush_buffer(args_t *args, int n)
+{
+    int i, j;
+    for (i=0; i<n; i++)
+    {
+        int k = rbuf_shift(&args->rbuf);
+        bcf1_t *rec = args->rbuf_lines[k];
+
+        int pass = 1;
+        if ( !args->soft_filter )
+        {
+            for (j=0; j<rec->d.n_flt; j++)
+            {
+                if ( args->indel_gap && rec->d.flt[j]==args->IndelGap_id ) { pass = 0; break; }
+                if ( args->snp_gap && rec->d.flt[j]==args->SnpGap_id ) { pass = 0; break; }
+            }
+        }
+        if ( pass ) bcf_write1(args->out_fh, args->hdr, rec);
+    }
+}
+
+#define SWAP(type_t, a, b) { type_t t = a; a = b; b = t; }
+static void buffered_filters(args_t *args, bcf1_t *line)
+{
+    /**
+     *  The logic of SnpGap=3. The SNPs at positions 1 and 7 are filtered,
+     *  positions 0 and 8 are not:
+     *           0123456789
+     *      ref  .G.GT..G..
+     *      del  .A.G-..A..
+     *  Here the positions 1 and 6 are filtered, 0 and 7 are not:
+     *           0123-456789
+     *      ref  .G.G-..G..
+     *      ins  .A.GT..A..
+     *
+     *  The logic of IndelGap=2. The second indel is filtered:
+     *           012345678901
+     *      ref  .GT.GT..GT..
+     *      del  .G-.G-..G-..
+     *  And similarly here, the second is filtered:
+     *           01 23 456 78
+     *      ref  .A-.A-..A-..
+     *      ins  .AT.AT..AT..
+     */
+
+    // To avoid additional data structure, we abuse bcf1_t's var and var_type records.
+    const int SnpGap_set     = VCF_OTHER<<1;
+    const int IndelGap_set   = VCF_OTHER<<2;
+    const int IndelGap_flush = VCF_OTHER<<3;
+
+    int var_type = 0, i;
+    if ( line )
+    {
+        // Still on the same chromosome?
+        int ilast = rbuf_last(&args->rbuf);
+        if ( ilast>=0 && line->rid != args->rbuf_lines[ilast]->rid )
+            flush_buffer(args, args->rbuf.n); // new chromosome, flush everything
+
+        if ( args->rbuf.n >= args->rbuf.m ) rbuf_expand0(&args->rbuf,bcf1_t*,args->rbuf_lines);
+
+        // Insert the new record in the buffer. The line would be overwritten in
+        // the next bcf_sr_next_line call, therefore we need to swap it with an
+        // unused one
+        ilast = rbuf_append(&args->rbuf);
+        if ( !args->rbuf_lines[ilast] ) args->rbuf_lines[ilast] = bcf_init1();
+        SWAP(bcf1_t*, args->files->readers[0].buffer[0], args->rbuf_lines[ilast]);
+
+        var_type = bcf_get_variant_types(line);
+
+        // Find out the size of an indel. The indel boundaries are based on REF
+        // (POS+1,POS+rlen-1). This is not entirely correct: mpileup likes to
+        // output REF=CAGAGAGAGA, ALT=CAGAGAGAGAGA where REF=C,ALT=CGA could be
+        // used. This filter is therefore more strict and may remove some valid
+        // SNPs.
+        int len = 1;
+        if ( var_type & VCF_INDEL )
+        {
+            for (i=1; i<line->n_allele; i++)
+                if ( len < 1-line->d.var[i].n ) len = 1-line->d.var[i].n;
+        }
+
+        // Set the REF allele's length to max deletion length or to 1 if a SNP or an insertion.
+        line->d.var[0].n = len;
+    }
+
+    int k_flush = 1;
+    if ( args->indel_gap )
+    {
+        k_flush = 0;
+        // Find indels which are too close to each other
+        int last_to = -1;
+        for (i=-1; rbuf_next(&args->rbuf,&i); )
+        {
+            bcf1_t *rec  = args->rbuf_lines[i];
+            int rec_from = rec->pos;
+            if ( last_to!=-1 && last_to < rec_from ) break;
+
+            k_flush++;
+            if ( !(rec->d.var_type & VCF_INDEL) ) continue;
+
+            rec->d.var_type |= IndelGap_set;
+            last_to = args->indel_gap + rec->pos + rec->d.var[0].n - 1;
+        }
+        if ( i==args->rbuf.f && line && last_to!=-1 ) k_flush = 0;
+        if ( k_flush || !line )
+        {
+            // Select the best indel from the cluster of k_flush indels
+            int k = 0, max_ac = -1, imax_ac = -1;
+            for (i=-1; rbuf_next(&args->rbuf,&i) && k<k_flush; )
+            {
+                k++;
+                bcf1_t *rec  = args->rbuf_lines[i];
+                if ( !(rec->d.var_type & IndelGap_set) ) continue;
+                hts_expand(int, rec->n_allele, args->ntmpi, args->tmpi);
+                int ret = bcf_calc_ac(args->hdr, rec, args->tmpi, BCF_UN_ALL);
+                if ( imax_ac==-1 || (ret && max_ac < args->tmpi[1]) ) { max_ac = args->tmpi[1]; imax_ac = i; }
+            }
+
+            // Filter all but the best indel (with max AF or first if AF not available)
+            k = 0;
+            for (i=-1; rbuf_next(&args->rbuf,&i) && k<k_flush; )
+            {
+                k++;
+                bcf1_t *rec = args->rbuf_lines[i];
+                if ( !(rec->d.var_type & IndelGap_set) ) continue;
+                rec->d.var_type |= IndelGap_flush;
+                if ( i!=imax_ac ) bcf_add_filter(args->hdr, args->rbuf_lines[i], args->IndelGap_id);
+            }
+        }
+    }
+
+    if ( !line )
+    {
+        // Finished: flush everything
+        flush_buffer(args, args->rbuf.n);
+        return;
+    }
+
+    int j_flush = 1;
+    if ( args->snp_gap )
+    {
+        j_flush = 0;
+        int last_from = line->pos;
+        for (i=-1; rbuf_next(&args->rbuf,&i); )
+        {
+            bcf1_t *rec = args->rbuf_lines[i];
+            int rec_to  = rec->pos + rec->d.var[0].n - 1;   // last position affected by the variant
+            if ( rec_to + args->snp_gap < last_from )
+                j_flush++;
+            else if ( (var_type & VCF_INDEL) && (rec->d.var_type & VCF_SNP) && !(rec->d.var_type & SnpGap_set) )
+            {
+                // this SNP has not been SnpGap-filtered yet
+                rec->d.var_type |= SnpGap_set;
+                bcf_add_filter(args->hdr, rec, args->SnpGap_id);
+            }
+            else if ( (var_type & VCF_SNP) && (rec->d.var_type & VCF_INDEL) )
+            {
+                // the line which we are adding is a SNP and needs to be filtered
+                line->d.var_type |= SnpGap_set;
+                bcf_add_filter(args->hdr, line, args->SnpGap_id);
+                break;
+            }
+        }
+    }
+    flush_buffer(args, j_flush < k_flush ? j_flush : k_flush);
+}
+
+static void set_genotypes(args_t *args, bcf1_t *line, int pass_site)
+{
+    int i,j;
+    if ( !bcf_hdr_nsamples(args->hdr) ) return;
+    if ( args->smpl_pass )
+    {
+        int npass = 0;
+        for (i=0; i<bcf_hdr_nsamples(args->hdr); i++) npass += args->smpl_pass[i];
+
+        // return if all samples pass
+        if ( npass==bcf_hdr_nsamples(args->hdr) && (args->filter_logic & FLT_INCLUDE) ) return;
+        if ( npass==0 && (args->filter_logic & FLT_EXCLUDE) ) return;
+    }
+    else if ( pass_site ) return;
+
+    int an = 0, has_an = bcf_get_info_int32(args->hdr, line, "AN", &args->tmp_ac, &args->ntmp_ac);
+    if ( has_an==1 ) an = args->tmp_ac[0];
+    else has_an = 0;
+
+    int has_ac = bcf_get_info_int32(args->hdr, line, "AC", &args->tmp_ac, &args->ntmp_ac);
+    has_ac = has_ac==line->n_allele-1 ? 1 : 0;
+
+    int new_gt = 0, ngts = bcf_get_format_int32(args->hdr, line, "GT", &args->tmpi, &args->ntmpi);
+    ngts /= bcf_hdr_nsamples(args->hdr);
+    if ( args->set_gts==SET_GTS_MISSING ) new_gt = bcf_gt_missing;
+    else if ( args->set_gts==SET_GTS_REF ) new_gt = bcf_gt_unphased(0);
+    else error("todo: set_gts=%d\n", args->set_gts);
+    for (i=0; i<bcf_hdr_nsamples(args->hdr); i++)
+    {
+        if ( args->smpl_pass )
+        {
+            int pass = args->smpl_pass[i];
+            if ( args->filter_logic & FLT_EXCLUDE ) pass = pass ? 0 : 1;
+            if ( pass ) continue;
+        }
+        int32_t *gts = args->tmpi + ngts*i;
+        for (j=0; j<ngts; j++)
+        {
+            if ( gts[j]==bcf_int32_vector_end ) break;
+            if ( args->set_gts==SET_GTS_MISSING && !bcf_gt_is_missing(gts[j]) )
+            {
+                int ial = bcf_gt_allele(gts[j]);
+                if ( has_ac && ial>0 && ial<=line->n_allele ) args->tmp_ac[ ial-1 ]--;
+                an--;
+            }
+            else if ( args->set_gts==SET_GTS_REF )
+            {
+                int ial = bcf_gt_allele(gts[j]);
+                if ( bcf_gt_is_missing(gts[j]) ) an++;
+                else if ( has_ac && ial>0 && ial<=line->n_allele ) args->tmp_ac[ ial-1 ]--;
+            }
+            gts[j] = new_gt;
+        }
+    }
+    bcf_update_genotypes(args->hdr,line,args->tmpi,ngts*bcf_hdr_nsamples(args->hdr));
+    if ( has_an ) bcf_update_info_int32(args->hdr,line,"AN",&an,1);
+    if ( has_ac )  bcf_update_info_int32(args->hdr,line,"AC",args->tmp_ac,line->n_allele-1);
+}
+
+static void usage(args_t *args)
+{
+    fprintf(stderr, "\n");
+    fprintf(stderr, "About:   Apply fixed-threshold filters.\n");
+    fprintf(stderr, "Usage:   bcftools filter [options] <in.vcf.gz>\n");
+    fprintf(stderr, "\n");
+    fprintf(stderr, "Options:\n");
+    fprintf(stderr, "    -e, --exclude <expr>          exclude sites for which the expression is true (see man page for details)\n");
+    fprintf(stderr, "    -g, --SnpGap <int>            filter SNPs within <int> base pairs of an indel\n");
+    fprintf(stderr, "    -G, --IndelGap <int>          filter clusters of indels separated by <int> or fewer base pairs allowing only one to pass\n");
+    fprintf(stderr, "    -i, --include <expr>          include only sites for which the expression is true (see man page for details\n");
+    fprintf(stderr, "    -m, --mode [+x]               \"+\": do not replace but add to existing FILTER; \"x\": reset filters at sites which pass\n");
+    fprintf(stderr, "    -o, --output <file>           write output to a file [standard output]\n");
+    fprintf(stderr, "    -O, --output-type <b|u|z|v>   b: compressed BCF, u: uncompressed BCF, z: compressed VCF, v: uncompressed VCF [v]\n");
+    fprintf(stderr, "    -r, --regions <region>        restrict to comma-separated list of regions\n");
+    fprintf(stderr, "    -R, --regions-file <file>     restrict to regions listed in a file\n");
+    fprintf(stderr, "    -s, --soft-filter <string>    annotate FILTER column with <string> or unique filter name (\"Filter%%d\") made up by the program (\"+\")\n");
+    fprintf(stderr, "    -S, --set-GTs <.|0>           set genotypes of failed samples to missing (.) or ref (0)\n");
+    fprintf(stderr, "    -t, --targets <region>        similar to -r but streams rather than index-jumps\n");
+    fprintf(stderr, "    -T, --targets-file <file>     similar to -R but streams rather than index-jumps\n");
+    fprintf(stderr, "\n");
+    exit(1);
+}
+
+int main_vcffilter(int argc, char *argv[])
+{
+    int c;
+    args_t *args  = (args_t*) calloc(1,sizeof(args_t));
+    args->argc    = argc; args->argv = argv;
+    args->files   = bcf_sr_init();
+    args->output_fname = "-";
+    args->output_type = FT_VCF;
+    int regions_is_file = 0, targets_is_file = 0;
+
+    static struct option loptions[] =
+    {
+        {"set-GTs",1,0,'S'},
+        {"mode",1,0,'m'},
+        {"soft-filter",1,0,'s'},
+        {"exclude",1,0,'e'},
+        {"include",1,0,'i'},
+        {"targets",1,0,'t'},
+        {"targets-file",1,0,'T'},
+        {"regions",1,0,'r'},
+        {"regions-file",1,0,'R'},
+        {"output",1,0,'o'},
+        {"output-type",1,0,'O'},
+        {"SnpGap",1,0,'g'},
+        {"IndelGap",1,0,'G'},
+        {0,0,0,0}
+    };
+    char *tmp;
+    while ((c = getopt_long(argc, argv, "e:i:t:T:r:R:h?s:m:o:O:g:G:S:",loptions,NULL)) >= 0) {
+        switch (c) {
+            case 'g': 
+                args->snp_gap = strtol(optarg,&tmp,10); 
+                if ( *tmp ) error("Could not parse argument: --SnpGap %s\n", optarg);
+                break;
+            case 'G':
+                args->indel_gap = strtol(optarg,&tmp,10);
+                if ( *tmp ) error("Could not parse argument: --IndelGap %s\n", optarg);
+                break;
+            case 'o': args->output_fname = optarg; break;
+            case 'O':
+                switch (optarg[0]) {
+                    case 'b': args->output_type = FT_BCF_GZ; break;
+                    case 'u': args->output_type = FT_BCF; break;
+                    case 'z': args->output_type = FT_VCF_GZ; break;
+                    case 'v': args->output_type = FT_VCF; break;
+                    default: error("The output type \"%s\" not recognised\n", optarg);
+                }
+                break;
+            case 's': args->soft_filter = optarg; break;
+            case 'm':
+                if ( strchr(optarg,'x') ) args->annot_mode |= ANNOT_RESET;
+                if ( strchr(optarg,'+') ) args->annot_mode |= ANNOT_ADD;
+                break;
+            case 't': args->targets_list = optarg; break;
+            case 'T': args->targets_list = optarg; targets_is_file = 1; break;
+            case 'r': args->regions_list = optarg; break;
+            case 'R': args->regions_list = optarg; regions_is_file = 1; break;
+            case 'e': args->filter_str = optarg; args->filter_logic |= FLT_EXCLUDE; break;
+            case 'i': args->filter_str = optarg; args->filter_logic |= FLT_INCLUDE; break;
+            case 'S':
+                if ( !strcmp(".",optarg) ) args->set_gts = SET_GTS_MISSING;
+                else if ( !strcmp("0",optarg) ) args->set_gts = SET_GTS_REF;
+                else error("The argument to -S not recognised: %s\n", optarg);
+                break;
+            case 'h':
+            case '?': usage(args);
+            default: error("Unknown argument: %s\n", optarg);
+        }
+    }
+
+    if ( args->filter_logic == (FLT_EXCLUDE|FLT_INCLUDE) ) error("Only one of -i or -e can be given.\n");
+    char *fname = NULL;
+    if ( optind>=argc )
+    {
+        if ( !isatty(fileno((FILE *)stdin)) ) fname = "-";  // reading from stdin
+        else usage(args);
+    }
+    else fname = argv[optind];
+
+    // read in the regions from the command line
+    if ( args->regions_list )
+    {
+        args->files->require_index = 1;
+        if ( bcf_sr_set_regions(args->files, args->regions_list, regions_is_file)<0 )
+            error("Failed to read the regions: %s\n", args->regions_list);
+    }
+    else if ( optind+1 < argc )
+    {
+        int i;
+        kstring_t tmp = {0,0,0};
+        kputs(argv[optind+1],&tmp);
+        for (i=optind+2; i<argc; i++) { kputc(',',&tmp); kputs(argv[i],&tmp); }
+        args->files->require_index = 1;
+        if ( bcf_sr_set_regions(args->files, tmp.s, regions_is_file)<0 )
+            error("Failed to read the regions: %s\n", args->regions_list);
+        free(tmp.s);
+    }
+    if ( args->targets_list )
+    {
+        if ( bcf_sr_set_targets(args->files, args->targets_list,targets_is_file, 0)<0 )
+            error("Failed to read the targets: %s\n", args->targets_list);
+    }
+    if ( !bcf_sr_add_reader(args->files, fname) ) error("Failed to open %s: %s\n", fname,bcf_sr_strerror(args->files->errnum));
+
+    init_data(args);
+    bcf_hdr_write(args->out_fh, args->hdr);
+    while ( bcf_sr_next_line(args->files) )
+    {
+        bcf1_t *line = bcf_sr_get_line(args->files, 0);
+        int pass = 1;
+        if ( args->filter )
+        {
+            pass = filter_test(args->filter, line, &args->smpl_pass);
+            if ( args->filter_logic & FLT_EXCLUDE ) pass = pass ? 0 : 1;
+        }
+        if ( args->soft_filter || args->set_gts || pass )
+        {
+            if ( pass )
+            {
+                bcf_unpack(line,BCF_UN_FLT);
+                if ( args->annot_mode & ANNOT_RESET || !line->d.n_flt ) bcf_add_filter(args->hdr, line, args->flt_pass);
+            }
+            else if ( args->soft_filter )
+            {
+                if ( (args->annot_mode & ANNOT_ADD) ) bcf_add_filter(args->hdr, line, args->flt_fail);
+                else bcf_update_filter(args->hdr, line, &args->flt_fail, 1);
+            }
+            if ( args->set_gts ) set_genotypes(args, line, pass);
+            if ( !args->rbuf_lines )
+                bcf_write1(args->out_fh, args->hdr, line);
+            else
+                buffered_filters(args, line);
+        }
+    }
+    buffered_filters(args, NULL);
+
+    hts_close(args->out_fh);
+    destroy_data(args);
+    bcf_sr_destroy(args->files);
+    free(args);
+    return 0;
+}
diff --git a/vcfgtcheck.c b/vcfgtcheck.c
new file mode 100644
index 0000000..e3f03cc
--- /dev/null
+++ b/vcfgtcheck.c
@@ -0,0 +1,790 @@
+/*  vcfgtcheck.c -- Check sample identity.
+
+    Copyright (C) 2013-2014 Genome Research Ltd.
+
+    Author: Petr Danecek <pd3 at sanger.ac.uk>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.  */
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <unistd.h>
+#include <getopt.h>
+#include <ctype.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <math.h>
+#include <htslib/vcf.h>
+#include <htslib/synced_bcf_reader.h>
+#include <htslib/vcfutils.h>
+#include "bcftools.h"
+
+typedef struct
+{
+    bcf_srs_t *files;           // first reader is the query VCF - single sample normally or multi-sample for cross-check
+    bcf_hdr_t *gt_hdr, *sm_hdr; // VCF with genotypes to compare against and the query VCF
+    int ntmp_arr, npl_arr;
+    int32_t *tmp_arr, *pl_arr;
+    double *lks, *sites;
+    int *cnts, *dps, hom_only, cross_check, all_sites;
+    char *cwd, **argv, *gt_fname, *plot, *query_sample, *target_sample;
+    int argc, no_PLs;
+}
+args_t;
+
+FILE *open_file(char **fname, const char *mode, const char *fmt, ...);
+char *msprintf(const char *fmt, ...);
+void mkdir_p(const char *fmt, ...);
+
+void py_plot(char *script)
+{
+    mkdir_p(script);
+    int len = strlen(script);
+    char *cmd = !strcmp(".py",script+len-3) ? msprintf("python %s", script) : msprintf("python %s.py", script);
+    int ret = system(cmd);
+    if ( ret ) fprintf(stderr, "The command returned non-zero status %d: %s\n", ret, cmd);
+    free(cmd);
+}
+
+static void plot_check(args_t *args, char *target_sample, char *query_sample)
+{
+    char *fname;
+    FILE *fp = open_file(&fname, "w", "%s.py", args->plot);
+    fprintf(fp,
+            "import matplotlib as mpl\n"
+            "mpl.use('Agg')\n"
+            "import matplotlib.pyplot as plt\n"
+            "import matplotlib.gridspec as gridspec\n"
+            "import csv\n"
+            "csv.register_dialect('tab', delimiter='\\t', quoting=csv.QUOTE_NONE)\n"
+            "\n"
+            "sample_ids = False\n"
+            "\n"
+            "dat = []\n"
+            "with open('%s.tab', 'rb') as f:\n"
+            "    reader = csv.reader(f, 'tab')\n"
+            "    for row in reader:\n"
+            "        if row[0][0]=='#': continue\n"
+            "        if row[0]!='CN': continue\n"
+            "        tgt = 0\n"
+            "        if row[4]=='%s': tgt = 1\n"
+            "        dat.append([float(row[1]), float(row[2]), float(row[3]), tgt, row[4]])\n"
+            "\n"
+            "dat = sorted(dat, reverse=True)\n"
+            "\n"
+            "iq = -1; dp = 0\n"
+            "for i in range(len(dat)):\n"
+            "    if iq==-1 and dat[i][3]==1: iq = i\n"
+            "    dp += dat[i][2]\n"
+            "dp /= len(dat)\n"
+            "\n"
+            "fig,ax1 = plt.subplots(figsize=(8,5))\n"
+            "ax2 = ax1.twinx()\n"
+            "plots  = ax1.plot([x[0] for x in dat],'o-', ms=3, color='g', mec='g', label='Discordance (total)')\n"
+            "plots += ax1.plot([x[1] for x in dat], '^', ms=3, color='r', mec='r', label='Discordance (per site)')\n"
+            "plots += ax2.plot([x[2] for x in dat],'v', ms=3, color='k', label='Number of sites')\n"
+            "if iq!=-1:\n"
+            "   ax1.plot([iq],[dat[iq][0]],'o',color='orange', ms=9)\n"
+            "   ax1.annotate('%s',xy=(iq,dat[iq][0]), xytext=(5,5), textcoords='offset points',fontsize='xx-small',rotation=45,va='bottom',ha='left')\n"
+            "   ax1.plot([iq],[dat[iq][1]],'^',color='red', ms=5)\n"
+            "for tl in ax1.get_yticklabels(): tl.set_color('g')\n"
+            "for tl in ax2.get_yticklabels(): tl.set_color('k'); tl.set_fontsize(9)\n"
+            "ax1.set_title('Discordance with %s')\n"
+            "ax1.set_xlim(-0.05*len(dat),1.05*(len(dat)-1))\n"
+            "ax1.set_xlabel('Sample ID')\n"
+            "plt.subplots_adjust(left=0.1,right=0.9,bottom=0.1,top=0.9)\n"
+            "if sample_ids:\n"
+            "   ax1.set_xticks(range(len(dat)))\n"
+            "   ax1.set_xticklabels([x[4] for x in dat],**{'rotation':45, 'ha':'right', 'fontsize':8})\n"
+            "   plt.subplots_adjust(bottom=0.2)\n"
+            "ax1.set_ylabel('Discordance',color='g')\n"
+            "ax2.set_ylabel('Number of sites',color='k')\n"
+            "ax2.ticklabel_format(style='sci', scilimits=(-3,2), axis='y')\n"
+            "ax1.ticklabel_format(style='sci', scilimits=(-3,2), axis='y')\n"
+            "labels = [l.get_label() for l in plots]\n"
+            "plt.legend(plots,labels,numpoints=1,markerscale=1,loc='best',prop={'size':10},frameon=False)\n"
+            "plt.savefig('%s.png')\n"
+            "plt.close()\n"
+            "\n", args->plot, target_sample, target_sample, query_sample, args->plot
+           );
+    fclose(fp);
+    py_plot(fname);
+    free(fname);
+}
+
+static void plot_cross_check(args_t *args)
+{
+    char *fname;
+    FILE *fp = open_file(&fname, "w", "%s.py", args->plot);
+    fprintf(fp,
+            "import matplotlib as mpl\n"
+            "mpl.use('Agg')\n"
+            "import matplotlib.pyplot as plt\n"
+            "import matplotlib.gridspec as gridspec\n"
+            "import csv\n"
+            "csv.register_dialect('tab', delimiter='\\t', quoting=csv.QUOTE_NONE)\n"
+            "avg   = []\n"
+            "dp    = []\n"
+            "sm2id = {}\n"
+            "dat   = None\n"
+            "min   = None\n"
+            "max   = None\n"
+            "with open('%s.tab', 'rb') as f:\n"
+            "   reader = csv.reader(f, 'tab')\n"
+            "   i = 0\n"
+            "   for row in reader:\n"
+            "       if row[0]=='SM':\n"
+            "           sm2id[row[4]] = i\n"
+            "           avg.append([i,float(row[1])])\n"
+            "           dp.append([i,float(row[2])])\n"
+            "           i += 1\n"
+            "       elif row[0]=='CN':\n"
+            "           val = 0\n"
+            "           if int(row[2])!=0: val = float(row[1])/int(row[2])\n"
+            "           if not dat:\n"
+            "               dat = [[0]*len(sm2id) for x in xrange(len(sm2id))]\n"
+            "               min = val\n"
+            "               max = val\n"
+            "           id_i = sm2id[row[4]]\n"
+            "           id_j = sm2id[row[5]]\n"
+            "           dat[id_i][id_j] = val\n"
+            "           dat[id_j][id_i] = val\n"
+            "           if min > val: min = val\n"
+            "           if max < val: max = val\n"
+            "\n"
+            "if len(sm2id)<=1: exit(1)\n"
+            "if min==max: exit(1)\n"
+            "\n"
+            "fig = plt.figure(figsize=(6,7))\n"
+            "gs  = gridspec.GridSpec(2, 1, height_ratios=[1, 1.5])\n"
+            "ax1 = plt.subplot(gs[0])\n"
+            "ax2 = plt.subplot(gs[1])\n"
+            "\n"
+            "ax1.plot([x[0] for x in avg],[x[1] for x in avg],'^-', ms=3, color='k')\n"
+            "ax3 = ax1.twinx()\n"
+            "ax3.plot([x[0] for x in dp],[x[1] for x in dp],'^-', ms=3, color='r',mec='r')\n"
+            "for tl in ax3.get_yticklabels():\n"
+            "   tl.set_color('r')\n"
+            "   tl.set_fontsize(9)\n"
+            "\n"
+            "im = ax2.imshow(dat,clim=(min),interpolation='nearest',origin='lower')\n"
+            "cb1  = plt.colorbar(im,ax=ax2)\n"
+            "cb1.set_label('Pairwise discordance')\n"
+            "for t in cb1.ax.get_yticklabels(): t.set_fontsize(9)\n"
+            "\n"
+            "ax1.tick_params(axis='both', which='major', labelsize=9)\n"
+            "ax1.tick_params(axis='both', which='minor', labelsize=9)\n"
+            "ax2.tick_params(axis='both', which='major', labelsize=9)\n"
+            "ax2.tick_params(axis='both', which='minor', labelsize=9)\n"
+            "\n"
+            "ax1.set_title('Sample Discordance Score')\n"
+            "ax2.set_ylabel('Sample ID')\n"
+            "ax2.set_xlabel('Sample ID')\n"
+            "ax3.set_ylabel('Average Depth',color='r')\n"
+            "ax1.set_xlabel('Sample ID')\n"
+            "ax1.set_ylabel('Average discordance')\n"
+            "\n"
+            "plt.subplots_adjust(left=0.15,right=0.87,bottom=0.08,top=0.93,hspace=0.25)\n"
+            "plt.savefig('%s.png')\n"
+            "plt.close()\n"
+            "\n", args->plot,args->plot
+           );
+    fclose(fp);
+    py_plot(fname);
+    free(fname);
+}
+
+static void init_data(args_t *args)
+{
+    args->sm_hdr = args->files->readers[0].header;
+    if ( !bcf_hdr_nsamples(args->sm_hdr) ) error("No samples in %s?\n", args->files->readers[0].fname);
+
+    if ( !args->cross_check )
+    {
+        args->gt_hdr = args->files->readers[1].header;
+        int nsamples = bcf_hdr_nsamples(args->gt_hdr);
+        if ( !nsamples ) error("No samples in %s?\n", args->files->readers[1].fname);
+        args->lks   = (double*) calloc(nsamples,sizeof(double));
+        args->cnts  = (int*) calloc(nsamples,sizeof(int));
+        args->sites = (double*) calloc(nsamples,sizeof(double));
+        args->dps   = (int*) calloc(nsamples,sizeof(int));
+    }
+    else
+    {
+        int nsamples = bcf_hdr_nsamples(args->sm_hdr);
+        int narr = (nsamples-1)*nsamples/2;
+        args->lks  = (double*) calloc(narr,sizeof(double));
+        args->cnts = (int*) calloc(narr,sizeof(int));
+        args->dps  = (int*) calloc(narr,sizeof(int));
+    }
+}
+
+static void destroy_data(args_t *args)
+{
+    free(args->lks); free(args->cnts); free(args->dps); free(args->cwd); free(args->sites);
+}
+
+static int allele_to_int(bcf1_t *line, char *allele)
+{
+    int i;
+    for (i=0; i<line->n_allele; i++)
+        if ( !strcmp(allele,line->d.allele[i]) ) return i;
+    if ( strcmp(line->d.allele[i-1],"X") ) return -1;
+    return i-1;
+}
+
+static int init_gt2ipl(args_t *args, bcf1_t *gt_line, bcf1_t *sm_line, int *gt2ipl, int n_gt2ipl)
+{
+    int i, j;
+    for (i=0; i<n_gt2ipl; i++) gt2ipl[i] = -1;
+    for (i=0; i<gt_line->n_allele; i++)
+    {
+        // find which of the sm_alleles (k) corresponds to the gt_allele (i)
+        int k = allele_to_int(sm_line, gt_line->d.allele[i]);
+        if ( k<0 ) return 0;
+        for (j=0; j<=i; j++)
+        {
+            int l = allele_to_int(sm_line, gt_line->d.allele[j]);
+            if ( l<0 ) return 0;
+            gt2ipl[ bcf_ij2G(j,i) ] = k<=l ? bcf_ij2G(k,l) : bcf_ij2G(l,k);
+        }
+    }
+    //for (i=0; i<n_gt2ipl; i++) printf("%d .. %d\n", i,gt2ipl[i]);
+    return 1;
+}
+
+static void set_cwd(args_t *args)
+{
+    int i;
+    char *buf;
+    size_t nbuf = 500;
+    args->cwd = (char*) malloc(sizeof(char)*nbuf);
+    for (i=0; i<5; i++)
+    {
+        if ( (buf = getcwd(args->cwd, nbuf)) ) break;
+        nbuf *= 2;
+        args->cwd = (char*) realloc(args->cwd, sizeof(char)*nbuf);
+    }
+    assert(buf);
+}
+
+static void print_header(args_t *args, FILE *fp)
+{
+    fprintf(fp, "# This file was produced by bcftools (%s+htslib-%s), the command line was:\n", bcftools_version(), hts_version());
+    fprintf(fp, "# \t bcftools %s ", args->argv[0]);
+    int i;
+    for (i=1; i<args->argc; i++)
+        fprintf(fp, " %s",args->argv[i]);
+    fprintf(fp, "\n# and the working directory was:\n");
+    fprintf(fp, "# \t %s\n#\n", args->cwd);
+}
+
+static int fake_PLs(args_t *args, bcf_hdr_t *hdr, bcf1_t *line)
+{
+    // PLs not present, use GTs instead.
+    int fake_PL = args->no_PLs ? args->no_PLs : 99;    // with 1, discordance is the number of non-matching GTs
+    int nsm_gt, i;
+    if ( (nsm_gt=bcf_get_genotypes(hdr, line, &args->tmp_arr, &args->ntmp_arr)) <= 0 )
+        error("GT not present at %s:%d?\n", hdr->id[BCF_DT_CTG][line->rid].key, line->pos+1);
+    nsm_gt /= bcf_hdr_nsamples(hdr);
+    int npl = line->n_allele*(line->n_allele+1)/2;
+    hts_expand(int,npl*bcf_hdr_nsamples(hdr),args->npl_arr,args->pl_arr);
+    for (i=0; i<bcf_hdr_nsamples(hdr); i++)
+    {
+        int *gt_ptr = args->tmp_arr + i*nsm_gt;
+        int j, *pl_ptr = args->pl_arr + i*npl;
+        if ( bcf_gt_is_missing(gt_ptr[0]) || bcf_gt_is_missing(gt_ptr[1]) ) // missing genotype
+        {
+            for (j=0; j<npl; j++) pl_ptr[j] = -1;
+        }
+        else
+        {
+            int a = bcf_gt_allele(gt_ptr[0]);
+            int b = bcf_gt_allele(gt_ptr[1]);
+            for (j=0; j<npl; j++) pl_ptr[j] = fake_PL;
+            int idx = bcf_alleles2gt(a,b);
+            pl_ptr[idx] = 0;
+        }
+    }
+    return npl;
+}
+
+static int cmp_doubleptr(const void *_a, const void *_b)
+{
+    double *a = *((double**)_a);
+    double *b = *((double**)_b);
+    if ( *a < *b ) return -1;
+    else if ( *a == *b ) return 0;
+    return 1;
+}
+
+static void check_gt(args_t *args)
+{
+    int i,ret, *gt2ipl = NULL, m_gt2ipl = 0, *gt_arr = NULL, ngt_arr = 0;
+    int fake_pls = args->no_PLs;
+
+    // Initialize things: check which tags are defined in the header, sample names etc.
+    if ( bcf_hdr_id2int(args->gt_hdr, BCF_DT_ID, "GT")<0 ) error("[E::%s] GT not present in the header of %s?\n", __func__, args->files->readers[1].fname);
+    if ( bcf_hdr_id2int(args->sm_hdr, BCF_DT_ID, "PL")<0 )
+    {
+        if ( bcf_hdr_id2int(args->sm_hdr, BCF_DT_ID, "GT")<0 )
+            error("[E::%s] Neither PL nor GT present in the header of %s\n", __func__, args->files->readers[0].fname);
+        if ( !args->no_PLs )
+            fprintf(stderr,"Warning: PL not present in the header of %s, using GT instead\n", args->files->readers[0].fname);
+        fake_pls = 1;
+    }
+
+    FILE *fp = args->plot ? open_file(NULL, "w", "%s.tab", args->plot) : stdout;
+    print_header(args, fp);
+
+    int tgt_isample = -1, query_isample = 0;
+    if ( args->target_sample )
+    {
+        tgt_isample = bcf_hdr_id2int(args->gt_hdr, BCF_DT_SAMPLE, args->target_sample);
+        if ( tgt_isample<0 ) error("No such sample in %s: [%s]\n", args->files->readers[1].fname, args->target_sample);
+    }
+    if ( args->all_sites )
+    {
+        if ( tgt_isample==-1 )
+        {
+            fprintf(stderr,"No target sample selected for comparison, using the first sample in %s: %s\n", args->gt_fname,args->gt_hdr->samples[0]);
+            tgt_isample = 0;
+        }
+    }
+    if ( args->query_sample )
+    {
+        query_isample = bcf_hdr_id2int(args->sm_hdr, BCF_DT_SAMPLE, args->query_sample);
+        if ( query_isample<0 ) error("No such sample in %s: [%s]\n", args->files->readers[0].fname, args->query_sample);
+    }
+    if ( args->all_sites )
+        fprintf(fp, "# [1]SC, Site by Site Comparison\t[2]Chromosome\t[3]Position\t[4]-g alleles\t[5]-g GT (%s)\t[6]match log LK\t[7]Query alleles\t[8-]Query PLs (%s)\n",
+                args->gt_hdr->samples[tgt_isample],args->sm_hdr->samples[query_isample]);
+
+    // Main loop
+    float prev_lk = 0;
+    while ( (ret=bcf_sr_next_line(args->files)) )
+    {
+        if ( ret!=2 ) continue;
+        bcf1_t *sm_line = args->files->readers[0].buffer[0];    // the query file
+        bcf1_t *gt_line = args->files->readers[1].buffer[0];    // the -g target file
+        bcf_unpack(sm_line, BCF_UN_FMT);
+        bcf_unpack(gt_line, BCF_UN_FMT);
+
+        // Init mapping from target genotype index to the sample's PL fields
+        int n_gt2ipl = gt_line->n_allele*(gt_line->n_allele + 1)/2;
+        if ( n_gt2ipl > m_gt2ipl )
+        {
+            m_gt2ipl = n_gt2ipl;
+            gt2ipl   = (int*) realloc(gt2ipl, sizeof(int)*m_gt2ipl);
+        }
+        if ( !init_gt2ipl(args, gt_line, sm_line, gt2ipl, n_gt2ipl) ) continue;
+
+        // Target genotypes
+        int ngt, npl;
+        if ( (ngt=bcf_get_genotypes(args->gt_hdr, gt_line, &gt_arr, &ngt_arr)) <= 0 )
+            error("GT not present at %s:%d?", args->gt_hdr->id[BCF_DT_CTG][gt_line->rid].key, gt_line->pos+1);
+        ngt /= bcf_hdr_nsamples(args->gt_hdr);
+        if ( ngt!=2 ) continue; // checking only diploid genotypes
+
+        // Sample PLs
+        if ( !fake_pls )
+        {
+            if ( (npl=bcf_get_format_int32(args->sm_hdr, sm_line, "PL", &args->pl_arr, &args->npl_arr)) <= 0 )
+                error("PL not present at %s:%d?", args->sm_hdr->id[BCF_DT_CTG][sm_line->rid].key, sm_line->pos+1);
+            npl /= bcf_hdr_nsamples(args->sm_hdr);
+        }
+        else
+            npl = fake_PLs(args, args->sm_hdr, sm_line);
+
+        // Calculate likelihoods for all samples, assuming diploid genotypes
+
+        // For faster access to genotype likelihoods (PLs) of the query sample
+        int max_ipl, *pl_ptr = args->pl_arr + query_isample*npl;
+        double sum_pl = 0; // for converting PLs to probs
+        for (max_ipl=0; max_ipl<npl; max_ipl++)
+        {
+            if ( pl_ptr[max_ipl]==bcf_int32_vector_end ) break;
+            if ( pl_ptr[max_ipl]==bcf_int32_missing ) continue;
+            sum_pl += pow(10, -0.1*pl_ptr[max_ipl]);
+        }
+        if ( sum_pl==0 ) continue; // no PLs present
+        if ( fake_pls && args->no_PLs==1 ) sum_pl = -1;
+
+        // The main stats: concordance of the query sample with the target -g samples
+        for (i=0; i<bcf_hdr_nsamples(args->gt_hdr); i++)
+        {
+            int *gt_ptr = gt_arr + i*ngt;
+            if ( gt_ptr[1]==bcf_int32_vector_end ) continue;    // skip haploid genotypes
+            if ( bcf_gt_is_missing(gt_ptr[0]) || bcf_gt_is_missing(gt_ptr[1]) ) continue;
+            int a = bcf_gt_allele(gt_ptr[0]);
+            int b = bcf_gt_allele(gt_ptr[1]);
+            if ( args->hom_only && a!=b ) continue; // heterozygous genotype
+            int igt_tgt = igt_tgt = bcf_alleles2gt(a,b); // genotype index in the target file
+            int igt_qry = gt2ipl[igt_tgt];  // corresponding genotype in query file
+            if ( igt_qry>=max_ipl || pl_ptr[igt_qry]<0 ) continue;   // genotype not present in query sample: haploid or missing
+            args->lks[i] += sum_pl<0 ? -pl_ptr[igt_qry] : log(pow(10, -0.1*pl_ptr[igt_qry])/sum_pl);
+            args->sites[i]++;
+        }
+        if ( args->all_sites )
+        {
+            // Print LKs at all sites for debugging
+            int *gt_ptr = gt_arr + tgt_isample*ngt;
+            if ( gt_ptr[1]==bcf_int32_vector_end ) continue;    // skip haploid genotypes
+            int a = bcf_gt_allele(gt_ptr[0]);
+            int b = bcf_gt_allele(gt_ptr[1]);
+            if ( args->hom_only && a!=b ) continue; // heterozygous genotype
+            fprintf(fp, "SC\t%s\t%d", args->gt_hdr->id[BCF_DT_CTG][gt_line->rid].key, gt_line->pos+1);
+            for (i=0; i<gt_line->n_allele; i++) fprintf(fp, "%c%s", i==0?'\t':',', gt_line->d.allele[i]);
+            fprintf(fp, "\t%s/%s", a>=0 ? gt_line->d.allele[a] : ".", b>=0 ? gt_line->d.allele[b] : ".");
+            fprintf(fp, "\t%f", args->lks[query_isample]-prev_lk);
+            prev_lk = args->lks[query_isample];
+
+            int igt, *pl_ptr = args->pl_arr + query_isample*npl; // PLs of the query sample
+            for (i=0; i<sm_line->n_allele; i++) fprintf(fp, "%c%s", i==0?'\t':',', sm_line->d.allele[i]);
+            for (igt=0; igt<npl; igt++)
+                if ( pl_ptr[igt]==bcf_int32_vector_end ) break;
+                else if ( pl_ptr[igt]==bcf_int32_missing ) fprintf(fp, ".");
+                else fprintf(fp, "\t%d", pl_ptr[igt]);
+            fprintf(fp, "\n");
+        }
+    }
+    free(gt2ipl);
+    free(gt_arr);
+    free(args->pl_arr);
+    free(args->tmp_arr);
+
+    // To be able to plot total discordance (=number of mismatching GTs with -G1) in the same
+    // plot as discordance per site, the latter must be scaled to the same range
+    int nsamples = bcf_hdr_nsamples(args->gt_hdr);
+    double extreme_lk = 0, extreme_lk_per_site = 0;
+    for (i=0; i<nsamples; i++)
+    {
+        if ( args->lks[i] < extreme_lk ) extreme_lk = args->lks[i];
+        if ( args->sites[i] && args->lks[i]/args->sites[i] < extreme_lk_per_site ) extreme_lk_per_site = args->lks[i]/args->sites[i];
+    }
+
+    // Sorted output
+    double **p = (double**) malloc(sizeof(double*)*nsamples);
+    for (i=0; i<nsamples; i++) p[i] = &args->lks[i];
+    qsort(p, nsamples, sizeof(int*), cmp_doubleptr);
+
+    fprintf(fp, "# [1]CN\t[2]Discordance with %s (total)\t[3]Discordance (score per site)\t[4]Number of sites compared\t[5]Sample\t[6]Sample ID\n", args->sm_hdr->samples[query_isample]);
+    for (i=0; i<nsamples; i++)
+    {
+        int idx = p[i] - args->lks;
+        double per_site = 0;
+        if ( args->sites[idx] )
+        {
+            if ( args->sites[idx] && extreme_lk_per_site )
+            {
+                per_site = args->lks[idx]/args->sites[idx];
+                per_site *= extreme_lk / extreme_lk_per_site;
+            }
+            else
+                per_site = 0;
+        }
+        fprintf(fp, "CN\t%e\t%e\t%.0f\t%s\t%d\n", fabs(args->lks[idx]), fabs(per_site), args->sites[idx], args->gt_hdr->samples[idx], i);
+    }
+
+    if ( args->plot )
+    {
+        fclose(fp);
+        plot_check(args, args->target_sample ? args->target_sample : "", args->sm_hdr->samples[query_isample]);
+    }
+}
+
+static inline int is_hom_most_likely(int nals, int *pls)
+{
+    int ia, ib, idx = 1, min_is_hom = 1, min_pl = pls[0];
+    for (ia=1; ia<nals; ia++)
+    {
+        for (ib=0; ib<ia; ib++)
+        {
+            if ( pls[idx] < min_pl ) { min_pl = pls[idx]; min_is_hom = 0; }
+            idx++;
+        }
+        if ( pls[idx] < min_pl ) { min_pl = pls[idx]; min_is_hom = 1; }
+        idx++;
+    }
+    return min_is_hom;
+}
+
+static void cross_check_gts(args_t *args)
+{
+    int nsamples = bcf_hdr_nsamples(args->sm_hdr), ndp_arr = 0;
+    unsigned int *dp = (unsigned int*) calloc(nsamples,sizeof(unsigned int)), *ndp = (unsigned int*) calloc(nsamples,sizeof(unsigned int)); // this will overflow one day...
+    int fake_pls = args->no_PLs, ignore_dp = 0;
+
+    int i,j,k,idx, pl_warned = 0, dp_warned = 0;
+    int32_t *dp_arr = NULL;
+    int *is_hom = args->hom_only ? (int*) malloc(sizeof(int)*nsamples) : NULL;
+    if ( bcf_hdr_id2int(args->sm_hdr, BCF_DT_ID, "PL")<0 )
+    {
+        if ( bcf_hdr_id2int(args->sm_hdr, BCF_DT_ID, "GT")<0 )
+            error("[E::%s] Neither PL nor GT present in the header of %s\n", __func__, args->files->readers[0].fname);
+        if ( !args->no_PLs )
+            fprintf(stderr,"Warning: PL not present in the header of %s, using GT instead\n", args->files->readers[0].fname);
+        fake_pls = 1;
+    }
+    if ( bcf_hdr_id2int(args->sm_hdr, BCF_DT_ID, "DP")<0 ) ignore_dp = 1;
+
+    FILE *fp = args->plot ? open_file(NULL, "w", "%s.tab", args->plot) : stdout;
+    print_header(args, fp);
+    if ( args->all_sites ) fprintf(fp,"# [1]SD, Average Site Discordance\t[2]Chromosome\t[3]Position\t[4]Number of available pairs\t[5]Average discordance\n");
+
+    while ( bcf_sr_next_line(args->files) )
+    {
+        bcf1_t *line = args->files->readers[0].buffer[0];
+        bcf_unpack(line, BCF_UN_FMT);
+
+        int npl;
+        if ( !fake_pls )
+        {
+            npl = bcf_get_format_int32(args->sm_hdr, line, "PL", &args->pl_arr, &args->npl_arr);
+            if ( npl<=0 ) { pl_warned++; continue; }
+            npl /= nsamples;
+        }
+        else
+            npl = fake_PLs(args, args->sm_hdr, line);
+        if ( !ignore_dp && bcf_get_format_int32(args->sm_hdr, line, "DP", &dp_arr, &ndp_arr) <= 0 ) { dp_warned++; continue; }
+
+        if ( args->hom_only )
+        {
+            for (i=0; i<nsamples; i++)
+                is_hom[i] = is_hom_most_likely(line->n_allele, args->pl_arr+i*npl);
+        }
+
+        double sum = 0; int nsum = 0;
+        idx = 0;
+        for (i=0; i<nsamples; i++)
+        {
+            int *ipl = &args->pl_arr[i*npl];
+            if ( *ipl==-1 ) { idx += i; continue; } // missing genotype
+            if ( !ignore_dp && (dp_arr[i]==bcf_int32_missing || !dp_arr[i]) ) { idx += i; continue; }
+            if ( args->hom_only && !is_hom[i] ) { idx += i; continue; }
+
+            for (j=0; j<i; j++)
+            {
+                int *jpl = &args->pl_arr[j*npl];
+                if ( *jpl==-1 ) { idx++; continue; } // missing genotype
+                if ( !ignore_dp && (dp_arr[j]==bcf_int32_missing || !dp_arr[j]) ) { idx++; continue; }
+                if ( args->hom_only && !is_hom[j] ) { idx++; continue; }
+
+                int min_pl = INT_MAX;
+                for (k=0; k<npl; k++)
+                {
+                    if ( ipl[k]==bcf_int32_missing || jpl[k]==bcf_int32_missing ) break;
+                    if ( ipl[k]==bcf_int32_vector_end || jpl[k]==bcf_int32_vector_end ) { k = npl; break; }
+                    if ( min_pl > ipl[k]+jpl[k] ) min_pl = ipl[k]+jpl[k];
+                }
+                if ( k!=npl ) { idx++; continue; }
+
+                if ( args->all_sites ) { sum += min_pl; nsum++; }
+                args->lks[idx] += min_pl;
+                args->cnts[idx]++;
+
+                if ( !ignore_dp )
+                {
+                    args->dps[idx] += dp_arr[i] < dp_arr[j] ? dp_arr[i] : dp_arr[j];
+                    dp[i] += dp_arr[i]; ndp[i]++;
+                    dp[j] += dp_arr[j]; ndp[j]++;
+                }
+                else
+                {
+                    args->dps[idx]++;
+                    dp[i]++; ndp[i]++;
+                    dp[j]++; ndp[j]++;
+                }
+                idx++;
+            }
+        }
+        if ( args->all_sites )
+            fprintf(fp,"SD\t%s\t%d\t%d\t%.0f\n", args->sm_hdr->id[BCF_DT_CTG][line->rid].key, line->pos+1, nsum, nsum?sum/nsum:0);
+    }
+    if ( dp_arr ) free(dp_arr);
+    if ( args->pl_arr ) free(args->pl_arr);
+    if ( args->tmp_arr ) free(args->tmp_arr);
+    if ( is_hom ) free(is_hom);
+
+    if ( pl_warned ) fprintf(stderr, "[W::%s] PL was not found at %d site(s)\n", __func__, pl_warned);
+    if ( dp_warned ) fprintf(stderr, "[W::%s] DP was not found at %d site(s)\n", __func__, dp_warned);
+
+    // Output samples sorted by average discordance
+    double *score  = (double*) calloc(nsamples,sizeof(double));
+    args->sites = (double*) calloc(nsamples,sizeof(double));
+    idx = 0;
+    for (i=0; i<nsamples; i++)
+    {
+        for (j=0; j<i; j++)
+        {
+            score[i] += args->lks[idx];
+            score[j] += args->lks[idx];
+            args->sites[i] += args->cnts[idx];
+            args->sites[j] += args->cnts[idx];
+            idx++;
+        }
+    }
+    for (i=0; i<nsamples; i++)
+        if ( args->sites[i] ) score[i] /= args->sites[i];
+    double **p = (double**) malloc(sizeof(double*)*nsamples), avg_score = 0;
+    for (i=0; i<nsamples; i++) p[i] = &score[i];
+    qsort(p, nsamples, sizeof(int*), cmp_doubleptr);
+    // The average discordance gives the number of differing sites in % with -G1
+    fprintf(fp, "# [1]SM\t[2]Average Discordance\t[3]Average depth\t[4]Average number of sites\t[5]Sample\t[6]Sample ID\n");
+    for (i=0; i<nsamples; i++)
+    {
+        idx = p[i] - score;
+        double adp = ndp[idx] ? (double)dp[idx]/ndp[idx] : 0;
+        double nsites = args->sites[idx]/(nsamples-1);
+        avg_score += score[idx];
+        fprintf(fp, "SM\t%f\t%.2lf\t%.0lf\t%s\t%d\n", score[idx]*100., adp, nsites, args->sm_hdr->samples[idx],i);
+    }
+
+    //  // Overall score: maximum absolute deviation from the average score
+    //  fprintf(fp, "# [1] MD\t[2]Maximum deviation\t[3]The culprit\n");
+    //  fprintf(fp, "MD\t%f\t%s\n", (score[idx] - avg_score/nsamples)*100., args->sm_hdr->samples[idx]);    // idx still set
+    free(p);
+    free(score);
+    free(dp);
+    free(ndp);
+
+    // Pairwise discordances
+    fprintf(fp, "# [1]CN\t[2]Discordance\t[3]Number of sites\t[4]Average minimum depth\t[5]Sample i\t[6]Sample j\n");
+    idx = 0;
+    for (i=0; i<nsamples; i++)
+    {
+        for (j=0; j<i; j++)
+        {
+            fprintf(fp, "CN\t%.0f\t%d\t%.2f\t%s\t%s\n", args->lks[idx], args->cnts[idx], args->cnts[idx]?(double)args->dps[idx]/args->cnts[idx]:0.0,
+                    args->sm_hdr->samples[i],args->sm_hdr->samples[j]);
+            idx++;
+        }
+    }
+    fclose(fp);
+    if ( args->plot )
+        plot_cross_check(args);
+}
+
+static char *init_prefix(char *prefix)
+{
+    int len = strlen(prefix);
+    if ( prefix[len-1] == '/' || prefix[len-1] == '\\' )
+        return msprintf("%sgtcheck", prefix);
+    return strdup(prefix);
+}
+
+static void usage(void)
+{
+    fprintf(stderr, "\n");
+    fprintf(stderr, "About:   Check sample identity. With no -g BCF given, multi-sample cross-check is performed.\n");
+    fprintf(stderr, "Usage:   bcftools gtcheck [options] [-g <genotypes.vcf.gz>] <query.vcf.gz>\n");
+    fprintf(stderr, "\n");
+    fprintf(stderr, "Options:\n");
+    fprintf(stderr, "    -a, --all-sites                 output comparison for all sites\n");
+    fprintf(stderr, "    -g, --genotypes <file>          genotypes to compare against\n");
+    fprintf(stderr, "    -G, --GTs-only <int>            use GTs, ignore PLs, using <int> for unseen genotypes [99]\n");
+    fprintf(stderr, "    -H, --homs-only                 homozygous genotypes only (useful for low coverage data)\n");
+    fprintf(stderr, "    -p, --plot <prefix>             plot\n");
+    fprintf(stderr, "    -r, --regions <region>          restrict to comma-separated list of regions\n");
+    fprintf(stderr, "    -R, --regions-file <file>       restrict to regions listed in a file\n");
+    fprintf(stderr, "    -s, --query-sample <string>     query sample (by default the first sample is checked)\n");
+    fprintf(stderr, "    -S, --target-sample <string>    target sample in the -g file (used only for plotting)\n");
+    fprintf(stderr, "    -t, --targets <region>          similar to -r but streams rather than index-jumps\n");
+    fprintf(stderr, "    -T, --targets-file <file>       similar to -R but streams rather than index-jumps\n");
+    fprintf(stderr, "\n");
+    exit(1);
+}
+
+int main_vcfgtcheck(int argc, char *argv[])
+{
+    int c;
+    args_t *args = (args_t*) calloc(1,sizeof(args_t));
+    args->files  = bcf_sr_init();
+    args->argc   = argc; args->argv = argv; set_cwd(args);
+    char *regions = NULL, *targets = NULL;
+    int regions_is_file = 0, targets_is_file = 0;
+
+    static struct option loptions[] =
+    {
+        {"GTs-only",1,0,'G'},
+        {"all-sites",0,0,'a'},
+        {"homs-only",0,0,'H'},
+        {"help",0,0,'h'},
+        {"genotypes",1,0,'g'},
+        {"plot",1,0,'p'},
+        {"target-sample",1,0,'S'},
+        {"query-sample",1,0,'s'},
+        {"regions",1,0,'r'},
+        {"regions-file",1,0,'R'},
+        {"targets",1,0,'t'},
+        {"targets-file",1,0,'T'},
+        {0,0,0,0}
+    };
+    char *tmp;
+    while ((c = getopt_long(argc, argv, "hg:p:s:S:Hr:R:at:T:G:",loptions,NULL)) >= 0) {
+        switch (c) {
+            case 'G':
+                args->no_PLs = strtol(optarg,&tmp,10);
+                if ( *tmp ) error("Could not parse argument: --GTs-only %s\n", optarg);
+                break;
+            case 'a': args->all_sites = 1; break;
+            case 'H': args->hom_only = 1; break;
+            case 'g': args->gt_fname = optarg; break;
+            case 'p': args->plot = optarg; break;
+            case 'S': args->target_sample = optarg; break;
+            case 's': args->query_sample = optarg; break;
+            case 'r': regions = optarg; break;
+            case 'R': regions = optarg; regions_is_file = 1; break;
+            case 't': targets = optarg; break;
+            case 'T': targets = optarg; targets_is_file = 1; break;
+            case 'h':
+            case '?': usage();
+            default: error("Unknown argument: %s\n", optarg);
+        }
+    }
+    char *fname = NULL;
+    if ( optind==argc )
+    {
+        if ( !isatty(fileno((FILE *)stdin)) ) fname = "-";  // reading from stdin
+        else usage();   // no files given
+    }
+    else fname = argv[optind];
+    if ( argc>optind+1 )  usage();  // too many files given
+    if ( !args->gt_fname ) args->cross_check = 1;   // no genotype file, run in cross-check mode
+    else args->files->require_index = 1;
+    if ( regions && bcf_sr_set_regions(args->files, regions, regions_is_file)<0 ) error("Failed to read the regions: %s\n", regions);
+    if ( targets && bcf_sr_set_targets(args->files, targets, targets_is_file, 0)<0 ) error("Failed to read the targets: %s\n", targets);
+    if ( !bcf_sr_add_reader(args->files, fname) ) error("Failed to open %s: %s\n", fname,bcf_sr_strerror(args->files->errnum));
+    if ( args->gt_fname && !bcf_sr_add_reader(args->files, args->gt_fname) ) error("Failed to open %s: %s\n", args->gt_fname,bcf_sr_strerror(args->files->errnum));
+    args->files->collapse = COLLAPSE_SNPS|COLLAPSE_INDELS;
+    if ( args->plot ) args->plot = init_prefix(args->plot);
+    init_data(args);
+    if ( args->cross_check )
+        cross_check_gts(args);
+    else
+        check_gt(args);
+    destroy_data(args);
+    bcf_sr_destroy(args->files);
+    if (args->plot) free(args->plot);
+    free(args);
+    return 0;
+}
+
diff --git a/vcfindex.c b/vcfindex.c
new file mode 100644
index 0000000..24ac8a8
--- /dev/null
+++ b/vcfindex.c
@@ -0,0 +1,246 @@
+
+/*  vcfindex.c -- Index bgzip compressed VCF/BCF files for random access.
+
+    Copyright (C) 2014 Genome Research Ltd.
+
+    Author: Shane McCarthy <sm15 at sanger.ac.uk>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.  */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <getopt.h>
+#include <htslib/vcf.h>
+#include <htslib/tbx.h>
+#include <sys/stat.h>
+#define __STDC_FORMAT_MACROS
+#include <inttypes.h>
+#include "bcftools.h"
+
+#define BCF_LIDX_SHIFT    14
+
+static void usage(void)
+{
+    fprintf(stderr, "\n");
+    fprintf(stderr, "About:   Index bgzip compressed VCF/BCF files for random access.\n");
+    fprintf(stderr, "Usage:   bcftools index [options] <in.bcf>|<in.vcf.gz>\n");
+    fprintf(stderr, "\n");
+    fprintf(stderr, "Indexing options:\n");
+    fprintf(stderr, "    -c, --csi            generate CSI-format index for VCF/BCF files [default]\n");
+    fprintf(stderr, "    -f, --force          overwrite index if it already exists\n");
+    fprintf(stderr, "    -m, --min-shift INT  set minimal interval size for CSI indices to 2^INT [14]\n");
+    fprintf(stderr, "    -t, --tbi            generate TBI-format index for VCF files\n");
+    fprintf(stderr, "\n");
+    fprintf(stderr, "Stats options:\n");
+    fprintf(stderr, "    -n, --nrecords       print number of records based on existing index file\n");
+    fprintf(stderr, "    -s, --stats   print per contig stats based on existing index file\n");
+    fprintf(stderr, "\n");
+    exit(1);
+}
+
+int vcf_index_stats(char *fname, int stats)
+{
+    char *fn_out = NULL;
+    FILE *out;
+    out = fn_out ? fopen(fn_out, "w") : stdout;
+
+    const char **seq;
+    int i, nseq;
+    tbx_t *tbx = NULL;
+    hts_idx_t *idx = NULL;
+
+    htsFile *fp = hts_open(fname,"r");
+    if ( !fp ) { fprintf(stderr,"Could not read %s\n", fname); return 1; }
+    bcf_hdr_t *hdr = bcf_hdr_read(fp);
+    if ( !hdr ) { fprintf(stderr,"Could not read the header: %s\n", fname); return 1; }
+
+    if ( hts_get_format(fp)->format==vcf )
+    {
+        tbx = tbx_index_load(fname);
+        if ( !tbx ) { fprintf(stderr,"Could not load TBI index: %s\n", fname); return 1; }
+    }
+    else if ( hts_get_format(fp)->format==bcf )
+    {
+        idx = bcf_index_load(fname);
+        if ( !idx ) { fprintf(stderr,"Could not load CSI index: %s\n", fname); return 1; }
+    }
+    else
+    {
+        fprintf(stderr,"Could not detect the file type as VCF or BCF: %s\n", fname);
+        return 1;
+    }
+
+    seq = tbx ? tbx_seqnames(tbx, &nseq) : bcf_index_seqnames(idx, hdr, &nseq);
+    uint64_t sum = 0;
+    for (i=0; i<nseq; i++)
+    {
+        uint64_t records, v;
+        hts_idx_get_stat(tbx ? tbx->idx : idx, i, &records, &v);
+        sum+=records;
+        if (stats&2 || !records) continue;
+        bcf_hrec_t *hrec = bcf_hdr_get_hrec(hdr, BCF_HL_CTG, "ID", seq[i], NULL);
+        int hkey = hrec ? bcf_hrec_find_key(hrec, "length") : -1;
+        if (hkey<0)
+        {
+            fprintf(stderr,"could not get contig length for %s\n", seq[i]);
+            return 1;
+        }
+        fprintf(out, "%s\t%s", seq[i], strcmp(hrec->vals[hkey], "2147483647")==0 ? "." : hrec->vals[hkey]);
+        fprintf(out, "\t%" PRIu64 "\n", records);
+    }
+    if (!sum)
+    {
+        // No counts found.
+        // Is this because index version has no stored count data, or no records?
+        bcf1_t *rec = bcf_init1();
+        if (bcf_read1(fp, hdr, rec) >= 0)
+        {
+            fprintf(stderr,"%s index of %s does not contain any count metadata. Please re-index with a newer version of bcftools or tabix.\n", tbx ? "TBI" : "CSI", fname);
+            return 1;
+        }
+        bcf_destroy1(rec);
+    }
+    if (stats&2) fprintf(out, "%" PRIu64 "\n", sum);
+    free(seq);
+    fclose(out);
+    hts_close(fp);
+    bcf_hdr_destroy(hdr);
+    if (tbx)
+        tbx_destroy(tbx);
+    if (idx)
+        hts_idx_destroy(idx);
+    return 0;
+}
+
+int main_vcfindex(int argc, char *argv[])
+{
+    int c, force = 0, tbi = 0, stats = 0;
+    int min_shift = BCF_LIDX_SHIFT;
+
+    static struct option loptions[] =
+    {
+        {"csi",no_argument,NULL,'c'},
+        {"tbi",no_argument,NULL,'t'},
+        {"force",no_argument,NULL,'f'},
+        {"min-shift",required_argument,NULL,'m'},
+        {"stats",no_argument,NULL,'s'},
+        {"nrecords",no_argument,NULL,'n'},
+        {NULL, 0, NULL, 0}
+    };
+
+    char *tmp;
+    while ((c = getopt_long(argc, argv, "ctfm:sn", loptions, NULL)) >= 0)
+    {
+        switch (c)
+        {
+            case 'c': tbi = 0; break;
+            case 't': tbi = 1; min_shift = 0; break;
+            case 'f': force = 1; break;
+            case 'm': 
+                min_shift = strtol(optarg,&tmp,10);
+                if ( *tmp ) error("Could not parse argument: --min-shift %s\n", optarg);
+                break;
+            case 's': stats |= 1; break;
+            case 'n': stats |= 2; break;
+            default: usage();
+        }
+    }
+    if ( optind==argc ) usage();
+    if (stats>2)
+    {
+        fprintf(stderr, "[E::%s] expected only one of --stats or --nrecords options\n", __func__);
+        return 1;
+    }
+    if (tbi && min_shift>0)
+    {
+        fprintf(stderr, "[E::%s] min-shift option only expected for CSI indices \n", __func__);
+        return 1;
+    }
+    if (min_shift < 0 || min_shift > 30)
+    {
+        fprintf(stderr, "[E::%s] expected min_shift in range [0,30] (%d)\n", __func__, min_shift);
+        return 1;
+    }
+
+    char *fname = argv[optind];
+    if (stats) return vcf_index_stats(fname, stats);
+
+    htsFile *fp = hts_open(fname,"r"); 
+    htsFormat type = *hts_get_format(fp);
+    hts_close(fp);
+
+    if ( (type.format!=bcf && type.format!=vcf) || type.compression!=bgzf )
+    {
+        fprintf(stderr, "[E::%s] unknown filetype; expected bgzip compressed VCF or BCF\n", __func__);
+        if ( type.compression!=bgzf )
+            fprintf(stderr, "[E::%s] was the VCF/BCF compressed with bgzip?\n", __func__);
+        return 1;
+    }
+    if (tbi && type.format==bcf)
+    {
+        fprintf(stderr, "[Warning] TBI-index does not work for BCF files. Generating CSI instead.\n");
+        tbi = 0; min_shift = BCF_LIDX_SHIFT;
+    }
+    if (min_shift == 0 && type.format==bcf)
+    {
+        fprintf(stderr, "[E::%s] Require min_shift>0 for BCF files.\n", __func__);
+        return 1;
+    }
+    if (!tbi && type.format==vcf && min_shift == 0)
+    {
+        fprintf(stderr, "[Warning] min-shift set to 0 for VCF file. Generating TBI file.\n");
+        tbi = 1;
+    }
+
+    if (!force)
+    {
+        // Before complaining about existing index, check if the VCF file isn't newer.
+        char *idx_fname = (char*)alloca(strlen(fname) + 5);
+        strcat(strcpy(idx_fname, fname), tbi ? ".tbi" : ".csi");
+        struct stat stat_tbi, stat_file;
+        if ( stat(idx_fname, &stat_tbi)==0 )
+        {
+            stat(fname, &stat_file);
+            if ( stat_file.st_mtime <= stat_tbi.st_mtime )
+            {
+                fprintf(stderr,"[E::%s] the index file exists. Please use '-f' to overwrite.\n", __func__);
+                return 1;
+            }
+        }
+    }
+
+    if (type.format==bcf)
+    {
+        if ( bcf_index_build(fname, min_shift) != 0 )
+        {
+            fprintf(stderr,"[E::%s] bcf_index_build failed for %s\n", __func__, fname);
+            return 1;
+        }
+    }
+    else
+    {
+        if ( tbx_index_build(fname, min_shift, &tbx_conf_vcf) != 0 )
+        {
+            fprintf(stderr,"[E::%s] tbx_index_build failed for %s\n", __func__, fname);
+            return 1;
+        }
+    }
+    return 0;
+}
diff --git a/vcfisec.c b/vcfisec.c
new file mode 100644
index 0000000..27b8129
--- /dev/null
+++ b/vcfisec.c
@@ -0,0 +1,579 @@
+/*  vcfisec.c -- Create intersections, unions and complements of VCF files.
+
+    Copyright (C) 2012-2014 Genome Research Ltd.
+
+    Author: Petr Danecek <pd3 at sanger.ac.uk>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.  */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <getopt.h>
+#include <ctype.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <htslib/vcf.h>
+#include <htslib/synced_bcf_reader.h>
+#include <htslib/vcfutils.h>
+#include "bcftools.h"
+#include "filter.h"
+
+#define OP_PLUS 1
+#define OP_MINUS 2
+#define OP_EQUAL 3
+#define OP_VENN 4
+#define OP_COMPLEMENT 5
+
+// Logic of the filters: include or exclude sites which match the filters?
+#define FLT_INCLUDE 1
+#define FLT_EXCLUDE 2
+
+typedef struct
+{
+    int isec_op, isec_n, *write, iwrite, nwrite, output_type;
+    int nflt, *flt_logic;
+    filter_t **flt;
+    char **flt_expr;
+    bcf_srs_t *files;
+    FILE *fh_log, *fh_sites;
+    htsFile **fh_out;
+    char **argv, *prefix, *output_fname, **fnames, *write_files, *targets_list, *regions_list;
+    int argc;
+}
+args_t;
+
+/**
+ *  mkdir_p() - create new directory for a file $fname
+ *  @fname:   the file name to create the directory for, the part after last "/" is ignored
+ */
+void mkdir_p(const char *fmt, ...)
+{
+    va_list ap;
+    va_start(ap, fmt);
+    int n = vsnprintf(NULL, 0, fmt, ap) + 2;
+    va_end(ap);
+
+    char *path = (char*)malloc(n);
+    va_start(ap, fmt);
+    vsnprintf(path, n, fmt, ap);
+    va_end(ap);
+
+    char *tmp = strdup(path), *p = tmp+1;
+    while (*p)
+    {
+        while (*p && *p!='/') p++;
+        if ( *p )
+        {
+            *p = 0;
+            mkdir(tmp,S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
+            *p = '/';
+            p++;
+        }
+    }
+    free(tmp);
+    free(path);
+}
+
+/**
+ *  open_file() - open new file creating the file name using vsnprintf
+ *  @fname:  if not NULL, on output will point to newly allocated fname string
+ *  @mode:   if NULL, only the file name string will be created
+ *  @fmt:    vsnprintf format and args
+ *
+ *  Returns open file descriptor or NULL if mode is NULL.
+ */
+FILE *open_file(char **fname, const char *mode, const char *fmt, ...)
+{
+    va_list ap;
+    va_start(ap, fmt);
+    int n = vsnprintf(NULL, 0, fmt, ap) + 2;
+    va_end(ap);
+
+    char *str = (char*)malloc(n);
+    va_start(ap, fmt);
+    vsnprintf(str, n, fmt, ap);
+    va_end(ap);
+
+    mkdir_p(str);
+    if ( !mode )
+    {
+        if ( !fname ) error("Uh: expected fname or mode\n");
+        *fname = str;
+        return NULL;
+    }
+
+    FILE *fp = fopen(str,mode);
+    if ( fname ) *fname = str;
+    else free(str);
+    return fp;
+}
+
+const char *hts_bcf_wmode(int file_type)
+{
+    if ( file_type == FT_BCF ) return "wbu";    // uncompressed BCF
+    if ( file_type & FT_BCF ) return "wb";      // compressed BCF
+    if ( file_type & FT_GZ ) return "wz";       // compressed VCF
+    return "w";                                 // uncompressed VCF
+}
+
+void isec_vcf(args_t *args)
+{
+    bcf_srs_t *files = args->files;
+    kstring_t str = {0,0,0};
+    htsFile *out_fh = NULL;
+
+    // When only one VCF is output, print VCF to stdout or -o file
+    int out_std = 0;
+    if ( args->nwrite==1 && !args->prefix ) out_std = 1;
+    if ( args->targets_list && files->nreaders==1 ) out_std = 1;
+    if ( out_std )
+    {
+        out_fh = hts_open(args->output_fname? args->output_fname : "-",hts_bcf_wmode(args->output_type));
+        if ( out_fh == NULL ) error("Can't write to %s: %s\n", args->output_fname? args->output_fname : "standard output", strerror(errno));
+        bcf_hdr_append_version(files->readers[args->iwrite].header,args->argc,args->argv,"bcftools_isec");
+        bcf_hdr_write(out_fh, files->readers[args->iwrite].header);
+    }
+    if ( !args->nwrite && !out_std && !args->prefix )
+        fprintf(stderr,"Note: -w option not given, printing list of sites...\n");
+
+    int n;
+    while ( (n=bcf_sr_next_line(files)) )
+    {
+        bcf_sr_t *reader = NULL;
+        bcf1_t *line = NULL;
+        int i, ret = 0;
+        for (i=0; i<files->nreaders; i++)
+        {
+            if ( !bcf_sr_has_line(files,i) ) continue;
+
+            if ( args->nflt && args->flt[i] )
+            {
+                bcf1_t *rec = bcf_sr_get_line(files, i);
+                int pass = filter_test(args->flt[i], rec, NULL);
+                if ( args->flt_logic[i] & FLT_EXCLUDE ) pass = pass ? 0 : 1;
+                if ( !pass )
+                {
+                    files->has_line[i] = 0;
+                    n--;
+                    continue;
+                }
+            }
+
+            if ( !line )
+            {
+                line = files->readers[i].buffer[0];
+                reader = &files->readers[i];
+            }
+            ret |= 1<<i;    // this may overflow for many files, but will be used only with two (OP_VENN)
+        }
+
+        switch (args->isec_op)
+        {
+            case OP_COMPLEMENT: if ( n!=1 || !bcf_sr_has_line(files,0) ) continue; break;
+            case OP_EQUAL: if ( n != args->isec_n ) continue; break;
+            case OP_PLUS: if ( n < args->isec_n ) continue; break;
+            case OP_MINUS: if ( n > args->isec_n ) continue;
+        }
+
+        if ( out_std )
+        {
+            if ( bcf_sr_has_line(files,args->iwrite) )
+                bcf_write1(out_fh, files->readers[args->iwrite].header, files->readers[args->iwrite].buffer[0]);
+            continue;
+        }
+        else if ( args->fh_sites )
+        {
+            str.l = 0;
+            kputs(reader->header->id[BCF_DT_CTG][line->rid].key, &str); kputc('\t', &str);
+            kputw(line->pos+1, &str); kputc('\t', &str);
+            if (line->n_allele > 0) kputs(line->d.allele[0], &str);
+            else kputc('.', &str);
+            kputc('\t', &str);
+            if (line->n_allele > 1) kputs(line->d.allele[1], &str);
+            else kputc('.', &str);
+            for (i=2; i<line->n_allele; i++)
+            {
+                kputc(',', &str);
+                kputs(line->d.allele[i], &str);
+            }
+            kputc('\t', &str);
+            for (i=0; i<files->nreaders; i++)
+                kputc(bcf_sr_has_line(files,i)?'1':'0', &str);
+            kputc('\n', &str);
+            fwrite(str.s,sizeof(char),str.l,args->fh_sites);
+        }
+
+        if ( args->prefix )
+        {
+            if ( args->isec_op==OP_VENN && ret==3 )
+            {
+                if ( !args->nwrite || args->write[0] )
+                    bcf_write1(args->fh_out[2], bcf_sr_get_header(files,0), bcf_sr_get_line(files,0));
+                if ( !args->nwrite || args->write[1] )
+                    bcf_write1(args->fh_out[3], bcf_sr_get_header(files,1), bcf_sr_get_line(files,1));
+            }
+            else
+            {
+                for (i=0; i<files->nreaders; i++)
+                {
+                    if ( !bcf_sr_has_line(files,i) ) continue;
+                    if ( args->write && !args->write[i] ) continue;
+                    bcf_write1(args->fh_out[i], files->readers[i].header, files->readers[i].buffer[0]);
+                }
+            }
+        }
+    }
+    if ( str.s ) free(str.s);
+    if ( out_fh ) hts_close(out_fh);
+}
+
+static void add_filter(args_t *args, char *expr, int logic)
+{
+    args->nflt++;
+    args->flt_expr = (char**) realloc(args->flt_expr,sizeof(char*)*args->nflt);
+    args->flt_logic = (int*) realloc(args->flt_logic,sizeof(int)*args->nflt);
+    args->flt = (filter_t**) realloc(args->flt,sizeof(filter_t*)*args->nflt);
+    if ( expr[0]=='-' && expr[1]==0 )
+    {
+        args->flt_expr[args->nflt-1] = NULL;
+        args->flt[args->nflt-1] = NULL;
+    }
+    else
+        args->flt_expr[args->nflt-1] = expr;
+    args->flt_logic[args->nflt-1] = logic;
+}
+
+static void destroy_data(args_t *args);
+static void init_data(args_t *args)
+{
+    int i;
+    if ( args->nflt )
+    {
+        if ( args->nflt > 1 && args->nflt!=args->files->nreaders )
+            error("Error: expected either one -i/-e option or as many as there are input files\n");
+        if ( args->nflt < args->files->nreaders )
+        {
+            if ( !args->flt_expr[0] ) error("Error: useless use of -i/-e\n");
+            args->nflt = args->files->nreaders;
+            args->flt_expr = (char**) realloc(args->flt_expr,sizeof(char*)*args->nflt);
+            args->flt_logic = (int*) realloc(args->flt_logic,sizeof(int)*args->nflt);
+            args->flt = (filter_t**) realloc(args->flt,sizeof(filter_t*)*args->nflt);
+            for (i=1; i<args->nflt; i++)
+            {
+                args->flt_expr[i]  = args->flt_expr[0];
+                args->flt_logic[i] = args->flt_logic[0];
+                args->flt[i] = filter_init(args->files->readers[i].header,args->flt_expr[i]);
+            }
+            args->flt[0] = filter_init(args->files->readers[0].header,args->flt_expr[0]);
+        }
+        else
+        {
+            for (i=0; i<args->files->nreaders; i++)
+            {
+                if ( !args->flt_expr[i] ) continue;
+                args->flt[i] = filter_init(args->files->readers[i].header,args->flt_expr[i]);
+            }
+        }
+    }
+
+    // Which files to write: parse the string passed with -w
+    char *p = args->write_files;
+    while (p && *p)
+    {
+        if ( !args->write ) args->write = (int*) calloc(args->files->nreaders,sizeof(int));
+        if ( sscanf(p,"%d",&i)!=1 ) error("Could not parse --write %s\n", args->write_files);
+        if ( i<0 || i>args->files->nreaders ) error("The index is out of range: %d (%s)\n", i, args->write_files);
+        args->write[i-1] = 1;
+        args->iwrite = i-1;
+        args->nwrite++;
+        while (*p && *p!=',') p++;
+        if ( *p==',' ) p++;
+    }
+    if ( args->nwrite>1 && !args->prefix ) error("Expected -p when mutliple output files given: --write %s\n", args->write_files);
+    if ( args->isec_op==OP_COMPLEMENT && args->nwrite )
+    {
+        if ( args->nwrite>1 ) error("Multiple files to -w make no sense with -C\n");
+        if ( !args->write[0] ) error("Only -w1 makes sense with -C\n");
+    }
+
+    if ( args->prefix )
+    {
+        // Init output directory and create the readme file
+        args->fh_log = open_file(NULL,"w","%s/README.txt", args->prefix);
+        if ( !args->fh_log ) error("%s/README.txt: %s\n", args->prefix, strerror(errno));
+
+        fprintf(args->fh_log,"This file was produced by vcfisec.\n");
+        fprintf(args->fh_log,"The command line was:\tbcftools %s ", args->argv[0]);
+        int i;
+        for (i=1; i<args->argc; i++) fprintf(args->fh_log," %s",args->argv[i]);
+        fprintf(args->fh_log,"\n\nUsing the following file names:\n");
+
+        const char *suffix = "vcf";
+        if ( args->output_type & FT_BCF ) suffix = "bcf";
+        else if ( args->output_type & FT_GZ ) suffix = "vcf.gz";
+
+        // Open output files and write the legend
+        if ( args->isec_op==OP_VENN )
+        {
+            args->fh_out = (htsFile**) malloc(sizeof(htsFile*)*4);
+            args->fnames = (char**) calloc(4,sizeof(char*));
+
+            #define OPEN_FILE(i,j) { \
+                open_file(&args->fnames[i], NULL, "%s/%04d.%s", args->prefix, i, suffix); \
+                args->fh_out[i] = hts_open(args->fnames[i], hts_bcf_wmode(args->output_type));  \
+                if ( !args->fh_out[i] ) error("Could not open %s\n", args->fnames[i]); \
+                bcf_hdr_append_version(args->files->readers[j].header,args->argc,args->argv,"bcftools_isec"); \
+                bcf_hdr_write(args->fh_out[i], args->files->readers[j].header); \
+            }
+            if ( !args->nwrite || args->write[0] )
+            {
+                OPEN_FILE(0,0);
+                fprintf(args->fh_log,"%s\tfor records private to\t%s\n", args->fnames[0], args->files->readers[0].fname);
+            }
+            if ( !args->nwrite || args->write[1] )
+            {
+                OPEN_FILE(1,1);
+                fprintf(args->fh_log,"%s\tfor records private to\t%s\n", args->fnames[1], args->files->readers[1].fname);
+            }
+            if ( !args->nwrite || args->write[0] )
+            {
+                OPEN_FILE(2,0);
+                fprintf(args->fh_log,"%s\tfor records from %s shared by both\t%s %s\n", args->fnames[2], args->files->readers[0].fname, args->files->readers[0].fname, args->files->readers[1].fname);
+            }
+            if ( !args->nwrite || args->write[1] )
+            {
+                OPEN_FILE(3,1);
+                fprintf(args->fh_log,"%s\tfor records from %s shared by both\t%s %s\n", args->fnames[3], args->files->readers[1].fname, args->files->readers[0].fname, args->files->readers[1].fname);
+            }
+        }
+        else
+        {
+            // Init one output file for each reader
+            args->fh_out = (htsFile**) calloc(args->files->nreaders, sizeof(htsFile*));
+            args->fnames = (char**) calloc(args->files->nreaders, sizeof(char*));
+
+            for (i=0; i<args->files->nreaders; i++)
+            {
+                if ( args->write && !args->write[i] ) continue;
+                if ( args->isec_op==OP_COMPLEMENT && i>0 ) break;
+                OPEN_FILE(i,i);
+                fprintf(args->fh_log,"%s\tfor stripped\t%s\n", args->fnames[i], args->files->readers[i].fname);
+            }
+            #undef OPEN_FILE
+
+            args->fh_sites = open_file(NULL, "w", "%s/sites.txt", args->prefix);
+            if ( !args->fh_sites ) error("%s/sites.txt: %s\n", args->prefix, strerror(errno));
+        }
+    }
+    else {
+        if (args->output_fname) {
+            args->fh_sites = fopen(args->output_fname, "w");
+            if ( args->fh_sites == NULL ) error("Can't write to \"%s\": %s\n", args->output_fname, strerror(errno));
+        }
+        else
+            args->fh_sites = stdout;
+    }
+}
+
+static void destroy_data(args_t *args)
+{
+    int i;
+    if ( args->nflt )
+    {
+        for (i=0; i<args->nflt; i++)
+        {
+            if ( !args->flt[i] ) continue;
+            filter_destroy(args->flt[i]);
+        }
+        free(args->flt_expr);
+        free(args->flt);
+        free(args->flt_logic);
+    }
+    if ( args->prefix )
+    {
+        fclose(args->fh_log);
+        int n = args->isec_op==OP_VENN ? 4 : args->files->nreaders;
+        for (i=0; i<n; i++)
+        {
+            if ( !args->fnames[i] ) continue;
+            hts_close(args->fh_out[i]);
+            if ( args->output_type==FT_VCF_GZ )
+            {
+                tbx_conf_t conf = tbx_conf_vcf;
+                tbx_index_build(args->fnames[i], -1, &conf);
+            }
+            else if ( args->output_type==FT_BCF_GZ )
+            {
+                if ( bcf_index_build(args->fnames[i],14) ) error("Could not index %s\n", args->fnames[i]);
+            }
+            free(args->fnames[i]);
+        }
+        free(args->fh_out);
+        free(args->fnames);
+        if ( args->fh_sites ) fclose(args->fh_sites);
+        if ( args->write ) free(args->write);
+    }
+}
+
+static void usage(void)
+{
+    fprintf(stderr, "\n");
+    fprintf(stderr, "About:   Create intersections, unions and complements of VCF files.\n");
+    fprintf(stderr, "Usage:   bcftools isec [options] <A.vcf.gz> <B.vcf.gz> [...]\n");
+    fprintf(stderr, "\n");
+    fprintf(stderr, "Options:\n");
+    fprintf(stderr, "    -c, --collapse <string>       treat as identical records with <snps|indels|both|all|some|none>, see man page for details [none]\n");
+    fprintf(stderr, "    -C, --complement              output positions present only in the first file but missing in the others\n");
+    fprintf(stderr, "    -e, --exclude <expr>          exclude sites for which the expression is true\n");
+    fprintf(stderr, "    -f, --apply-filters <list>    require at least one of the listed FILTER strings (e.g. \"PASS,.\")\n");
+    fprintf(stderr, "    -i, --include <expr>          include only sites for which the expression is true\n");
+    fprintf(stderr, "    -n, --nfiles [+-=]<int>       output positions present in this many (=), this many or more (+), or this many or fewer (-) files\n");
+    fprintf(stderr, "    -o, --output <file>           write output to a file [standard output]\n");
+    fprintf(stderr, "    -O, --output-type <b|u|z|v>   b: compressed BCF, u: uncompressed BCF, z: compressed VCF, v: uncompressed VCF [v]\n");
+    fprintf(stderr, "    -p, --prefix <dir>            if given, subset each of the input files accordingly, see also -w\n");
+    fprintf(stderr, "    -r, --regions <region>        restrict to comma-separated list of regions\n");
+    fprintf(stderr, "    -R, --regions-file <file>     restrict to regions listed in a file\n");
+    fprintf(stderr, "    -t, --targets <region>        similar to -r but streams rather than index-jumps\n");
+    fprintf(stderr, "    -T, --targets-file <file>     similar to -R but streams rather than index-jumps\n");
+    fprintf(stderr, "    -w, --write <list>            list of files to write with -p given as 1-based indexes. By default, all files are written\n");
+    fprintf(stderr, "\n");
+    fprintf(stderr, "Examples:\n");
+    fprintf(stderr, "   # Create intersection and complements of two sets saving the output in dir/*\n");
+    fprintf(stderr, "   bcftools isec A.vcf.gz B.vcf.gz -p dir\n");
+    fprintf(stderr, "\n");
+    fprintf(stderr, "   # Filter sites in A and B (but not in C) and create intersection\n");
+    fprintf(stderr, "   bcftools isec -e'MAF<0.01' -i'dbSNP=1' -e - A.vcf.gz B.vcf.gz C.vcf.gz -p dir\n");
+    fprintf(stderr, "\n");
+    fprintf(stderr, "   # Extract and write records from A shared by both A and B using exact allele match\n");
+    fprintf(stderr, "   bcftools isec A.vcf.gz B.vcf.gz -p dir -n =2 -w 1\n");
+    fprintf(stderr, "\n");
+    fprintf(stderr, "   # Extract records private to A or B comparing by position only\n");
+    fprintf(stderr, "   bcftools isec A.vcf.gz B.vcf.gz -p dir -n -1 -c all\n");
+    fprintf(stderr, "\n");
+    exit(1);
+}
+
+int main_vcfisec(int argc, char *argv[])
+{
+    int c;
+    args_t *args = (args_t*) calloc(1,sizeof(args_t));
+    args->files  = bcf_sr_init();
+    args->argc   = argc; args->argv = argv;
+    args->output_fname = NULL;
+    args->output_type = FT_VCF;
+    int targets_is_file = 0, regions_is_file = 0;
+
+    static struct option loptions[] =
+    {
+        {"help",0,0,'h'},
+        {"exclude",1,0,'e'},
+        {"include",1,0,'i'},
+        {"collapse",1,0,'c'},
+        {"complement",0,0,'C'},
+        {"apply-filters",1,0,'f'},
+        {"nfiles",1,0,'n'},
+        {"prefix",1,0,'p'},
+        {"write",1,0,'w'},
+        {"targets",1,0,'t'},
+        {"targets-file",1,0,'T'},
+        {"regions",1,0,'r'},
+        {"regions-file",1,0,'R'},
+        {"output",1,0,'o'},
+        {"output-type",1,0,'O'},
+        {0,0,0,0}
+    };
+    while ((c = getopt_long(argc, argv, "hc:r:R:p:n:w:t:T:Cf:o:O:i:e:",loptions,NULL)) >= 0) {
+        switch (c) {
+            case 'o': args->output_fname = optarg; break;
+            case 'O':
+                switch (optarg[0]) {
+                    case 'b': args->output_type = FT_BCF_GZ; break;
+                    case 'u': args->output_type = FT_BCF; break;
+                    case 'z': args->output_type = FT_VCF_GZ; break;
+                    case 'v': args->output_type = FT_VCF; break;
+                    default: error("The output type \"%s\" not recognised\n", optarg);
+                }
+                break;
+            case 'c':
+                if ( !strcmp(optarg,"snps") ) args->files->collapse |= COLLAPSE_SNPS;
+                else if ( !strcmp(optarg,"indels") ) args->files->collapse |= COLLAPSE_INDELS;
+                else if ( !strcmp(optarg,"both") ) args->files->collapse |= COLLAPSE_SNPS | COLLAPSE_INDELS;
+                else if ( !strcmp(optarg,"any") ) args->files->collapse |= COLLAPSE_ANY;
+                else if ( !strcmp(optarg,"all") ) args->files->collapse |= COLLAPSE_ANY;
+                else if ( !strcmp(optarg,"some") ) args->files->collapse |= COLLAPSE_SOME;
+                else if ( !strcmp(optarg,"none") ) args->files->collapse = COLLAPSE_NONE;
+                else error("The --collapse string \"%s\" not recognised.\n", optarg);
+                break;
+            case 'f': args->files->apply_filters = optarg; break;
+            case 'C': args->isec_op = OP_COMPLEMENT; break;
+            case 'r': args->regions_list = optarg; break;
+            case 'R': args->regions_list = optarg; regions_is_file = 1; break;
+            case 't': args->targets_list = optarg; break;
+            case 'T': args->targets_list = optarg; targets_is_file = 1; break;
+            case 'p': args->prefix = optarg; break;
+            case 'w': args->write_files = optarg; break;
+            case 'i': add_filter(args, optarg, FLT_INCLUDE); break;
+            case 'e': add_filter(args, optarg, FLT_EXCLUDE); break;
+            case 'n':
+                {
+                    char *p = optarg;
+                    if ( *p=='-' ) { args->isec_op = OP_MINUS; p++; }
+                    else if ( *p=='+' ) { args->isec_op = OP_PLUS; p++; }
+                    else if ( *p=='=' ) { args->isec_op = OP_EQUAL; p++; }
+                    else if ( isdigit(*p) ) args->isec_op = OP_EQUAL;
+                    else error("Could not parse --nfiles %s\n", optarg);
+                    if ( sscanf(p,"%d",&args->isec_n)!=1 ) error("Could not parse --nfiles %s\n", optarg);
+                }
+                break;
+            case 'h':
+            case '?': usage();
+            default: error("Unknown argument: %s\n", optarg);
+        }
+    }
+    if ( argc-optind<1 ) usage();   // no file given
+    if ( args->targets_list && bcf_sr_set_targets(args->files, args->targets_list, targets_is_file,0)<0 )
+        error("Failed to read the targets: %s\n", args->targets_list);
+    if ( args->regions_list && bcf_sr_set_regions(args->files, args->regions_list, regions_is_file)<0 )
+        error("Failed to read the regions: %s\n", args->regions_list);
+    if ( argc-optind==2 && !args->isec_op )
+    {
+        args->isec_op = OP_VENN;
+        if ( !args->prefix ) error("Expected the -p option\n");
+    }
+    if ( !args->targets_list )
+    {
+        if ( argc-optind<2  ) error("Expected multiple files or the --targets option\n");
+        if ( !args->isec_op ) error("Expected two file names or one of the options --complement, --nfiles or --targets\n");
+    }
+    args->files->require_index = 1;
+    while (optind<argc)
+    {
+        if ( !bcf_sr_add_reader(args->files, argv[optind]) ) error("Failed to open %s: %s\n", argv[optind],bcf_sr_strerror(args->files->errnum));
+        optind++;
+    }
+    init_data(args);
+    isec_vcf(args);
+    destroy_data(args);
+    bcf_sr_destroy(args->files);
+    free(args);
+    return 0;
+}
+
diff --git a/vcfmerge.c b/vcfmerge.c
new file mode 100644
index 0000000..ea26903
--- /dev/null
+++ b/vcfmerge.c
@@ -0,0 +1,2063 @@
+/*  vcfmerge.c -- Merge multiple VCF/BCF files to create one multi-sample file.
+
+    Copyright (C) 2012-2014 Genome Research Ltd.
+
+    Author: Petr Danecek <pd3 at sanger.ac.uk>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.  */
+
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <getopt.h>
+#include <htslib/vcf.h>
+#include <htslib/synced_bcf_reader.h>
+#include <htslib/vcfutils.h>
+#include <math.h>
+#include <ctype.h>
+#include "bcftools.h"
+#include "vcmp.h"
+
+#include <htslib/khash.h>
+KHASH_MAP_INIT_STR(strdict, int)
+typedef khash_t(strdict) strdict_t;
+
+#define SKIP_DONE 1
+#define SKIP_DIFF 2
+
+#define IS_VL_G(hdr,id) (bcf_hdr_id2length(hdr,BCF_HL_FMT,id) == BCF_VL_G)
+#define IS_VL_A(hdr,id) (bcf_hdr_id2length(hdr,BCF_HL_FMT,id) == BCF_VL_A)
+#define IS_VL_R(hdr,id) (bcf_hdr_id2length(hdr,BCF_HL_FMT,id) == BCF_VL_R)
+
+// For merging INFO Number=A,G,R tags
+typedef struct
+{
+    const char *hdr_tag;
+    int type, nvals;
+    int nbuf, mbuf;
+    uint8_t *buf;
+}
+AGR_info_t;
+
+// Rules for merging arbitrary INFO tags
+typedef struct _info_rule_t
+{
+    char *hdr_tag;
+    void (*merger)(bcf_hdr_t *hdr, bcf1_t *line, struct _info_rule_t *rule);
+    int type;           // one of BCF_HT_*
+    int block_size;     // number of values in a block
+    int nblocks;        // number of blocks in nvals (the number of merged files)
+    int nvals, mvals;   // used and total size of vals array
+    void *vals;         // the info tag values
+}
+info_rule_t;
+
+// Auxiliary merge data for selecting the right combination
+//  of buffered records across multiple readers. maux1_t
+//  corresponds to one buffered line.
+typedef struct
+{
+    int skip;
+    int *map;   // mapping from input alleles to the output array
+    int mmap;   // size of map array (only buffer[i].n_allele is actually used)
+    int als_differ;
+}
+maux1_t;
+typedef struct
+{
+    int n;  // number of readers
+    char **als, **out_als;  // merged alleles (temp, may contain empty records) and merged alleles ready for output
+    int nals, mals, nout_als, mout_als; // size of the output array
+    int *cnt, ncnt; // number of records that refer to the alleles
+    int *nbuf;      // readers have buffers of varying lengths
+    int *smpl_ploidy, *smpl_nGsize; // ploidy and derived number of values in Number=G tags, updated for each line (todo: cache for missing cases)
+    int *flt, mflt, minf;
+    bcf_info_t *inf;// out_line's INFO fields
+    bcf_fmt_t **fmt_map; // i-th output FORMAT field corresponds in j-th reader to i*nreader+j, first row is reserved for GT
+    int nfmt_map;        // number of rows in the fmt_map array
+    int *agr_map, nagr_map, magr_map;   // mapping between Number=AGR element indexes
+    void *tmp_arr;
+    int ntmp_arr;
+    maux1_t **d;    // d[i][j] i-th reader, j-th buffer line
+    AGR_info_t *AGR_info;
+    int nAGR_info, mAGR_info;
+    bcf_srs_t *files;
+    int *has_line;  // which files are being merged
+}
+maux_t;
+
+typedef struct
+{
+    vcmp_t *vcmp;
+    maux_t *maux;
+    int header_only, collapse, output_type, force_samples, merge_by_id;
+    char *header_fname, *output_fname, *regions_list, *info_rules, *file_list;
+    info_rule_t *rules;
+    int nrules;
+    strdict_t *tmph;
+    kstring_t tmps;
+    bcf_srs_t *files;
+    bcf1_t *out_line;
+    htsFile *out_fh;
+    bcf_hdr_t *out_hdr;
+    char **argv;
+    int argc;
+}
+args_t;
+
+static void info_rules_merge_sum(bcf_hdr_t *hdr, bcf1_t *line, info_rule_t *rule)
+{
+    if ( !rule->nvals ) return;
+    int i, j, ndim = rule->block_size;
+    #define BRANCH(type_t,is_missing) { \
+        type_t *ptr = (type_t*) rule->vals; \
+        for (i=0; i<rule->nvals; i++) if ( is_missing ) ptr[i] = 0; \
+        for (i=1; i<rule->nblocks; i++) \
+        { \
+            for (j=0; j<ndim; j++) ptr[j] += ptr[j+i*ndim]; \
+        } \
+    }
+    switch (rule->type) {
+        case BCF_HT_INT:  BRANCH(int32_t, ptr[i]==bcf_int32_missing); break;
+        case BCF_HT_REAL: BRANCH(float, bcf_float_is_missing(ptr[i])); break;
+        default: error("TODO: %s:%d .. type=%d\n", __FILE__,__LINE__, rule->type);
+    }
+    #undef BRANCH
+
+    bcf_update_info(hdr,line,rule->hdr_tag,rule->vals,ndim,rule->type);
+}
+static void info_rules_merge_avg(bcf_hdr_t *hdr, bcf1_t *line, info_rule_t *rule)
+{
+    if ( !rule->nvals ) return;
+    int i, j, ndim = rule->block_size;
+    #define BRANCH(type_t,is_missing) { \
+        type_t *ptr = (type_t*) rule->vals; \
+        for (i=0; i<rule->nvals; i++) if ( is_missing ) ptr[i] = 0; \
+        for (j=0; j<ndim; j++) \
+        { \
+            double sum = 0; \
+            for (i=0; i<rule->nblocks; i++) sum += ptr[j+i*ndim]; \
+            ptr[j] = sum / rule->nblocks; \
+        } \
+    }
+    switch (rule->type) {
+        case BCF_HT_INT:  BRANCH(int32_t, ptr[i]==bcf_int32_missing); break;
+        case BCF_HT_REAL: BRANCH(float, bcf_float_is_missing(ptr[i])); break;
+        default: error("TODO: %s:%d .. type=%d\n", __FILE__,__LINE__, rule->type);
+    }
+    #undef BRANCH
+
+    bcf_update_info(hdr,line,rule->hdr_tag,rule->vals,ndim,rule->type);
+}
+static void info_rules_merge_min(bcf_hdr_t *hdr, bcf1_t *line, info_rule_t *rule)
+{
+    if ( !rule->nvals ) return;
+    int i, j, ndim = rule->block_size;
+    #define BRANCH(type_t,is_missing,set_missing,huge_val) { \
+        type_t *ptr = (type_t*) rule->vals; \
+        for (i=0; i<rule->nvals; i++) if ( is_missing ) ptr[i] = huge_val; \
+        for (i=1; i<rule->nblocks; i++) \
+        { \
+            for (j=0; j<ndim; j++) if ( ptr[j] > ptr[j+i*ndim] ) ptr[j] = ptr[j+i*ndim]; \
+        } \
+        for (i=0; i<rule->nvals; i++) if ( ptr[i]==huge_val ) set_missing; \
+    }
+    switch (rule->type) {
+        case BCF_HT_INT:  BRANCH(int32_t, ptr[i]==bcf_int32_missing, ptr[i]=bcf_int32_missing, INT32_MAX); break;
+        case BCF_HT_REAL: BRANCH(float, bcf_float_is_missing(ptr[i]), bcf_float_set_missing(ptr[i]), HUGE_VAL); break;
+        default: error("TODO: %s:%d .. type=%d\n", __FILE__,__LINE__, rule->type);
+    }
+    #undef BRANCH
+
+    bcf_update_info(hdr,line,rule->hdr_tag,rule->vals,ndim,rule->type);
+}
+static void info_rules_merge_max(bcf_hdr_t *hdr, bcf1_t *line, info_rule_t *rule)
+{
+    if ( !rule->nvals ) return;
+    int i, j, ndim = rule->block_size;
+    #define BRANCH(type_t,is_missing,set_missing,huge_val) { \
+        type_t *ptr = (type_t*) rule->vals; \
+        for (i=0; i<rule->nvals; i++) if ( is_missing ) ptr[i] = huge_val; \
+        for (i=1; i<rule->nblocks; i++) \
+        { \
+            for (j=0; j<ndim; j++) if ( ptr[j] < ptr[j+i*ndim] ) ptr[j] = ptr[j+i*ndim]; \
+        } \
+        for (i=0; i<rule->nvals; i++) if ( ptr[i]==huge_val ) set_missing; \
+    }
+    switch (rule->type) {
+        case BCF_HT_INT:  BRANCH(int32_t, ptr[i]==bcf_int32_missing, ptr[i]=bcf_int32_missing, INT32_MIN); break;
+        case BCF_HT_REAL: BRANCH(float, bcf_float_is_missing(ptr[i]), bcf_float_set_missing(ptr[i]), -HUGE_VAL); break;
+        default: error("TODO: %s:%d .. type=%d\n", __FILE__,__LINE__, rule->type);
+    }
+    #undef BRANCH
+
+    bcf_update_info(hdr,line,rule->hdr_tag,rule->vals,ndim,rule->type);
+}
+static void info_rules_merge_join(bcf_hdr_t *hdr, bcf1_t *line, info_rule_t *rule)
+{
+    if ( !rule->nvals ) return;
+    if ( rule->type==BCF_HT_STR )
+    {
+        ((char*)rule->vals)[rule->nvals] = 0;
+        bcf_update_info_string(hdr,line,rule->hdr_tag,rule->vals);
+    }
+    else
+        bcf_update_info(hdr,line,rule->hdr_tag,rule->vals,rule->nvals,rule->type);
+}
+
+static int info_rules_comp_key2(const void *a, const void *b)
+{
+    info_rule_t *rule1 = (info_rule_t*) a;
+    info_rule_t *rule2 = (info_rule_t*) b;
+    return strcmp(rule1->hdr_tag, rule2->hdr_tag);
+}
+static int info_rules_comp_key(const void *a, const void *b)
+{
+    char *key = (char*) a;
+    info_rule_t *rule = (info_rule_t*) b;
+    return strcmp(key, rule->hdr_tag);
+}
+static void info_rules_init(args_t *args)
+{
+    if ( args->info_rules && !strcmp("-",args->info_rules) ) return;
+
+    kstring_t str = {0,0,0};
+    if ( !args->info_rules )
+    {
+        if ( bcf_hdr_idinfo_exists(args->out_hdr,BCF_HL_INFO,bcf_hdr_id2int(args->out_hdr, BCF_DT_ID, "DP")) ) kputs("DP:sum",&str);
+        if ( bcf_hdr_idinfo_exists(args->out_hdr,BCF_HL_INFO,bcf_hdr_id2int(args->out_hdr, BCF_DT_ID, "DP4")) )
+        {
+            if ( str.l ) kputc(',',&str);
+            kputs("DP4:sum",&str);
+        }
+        if ( !str.l ) return;
+        args->info_rules = str.s;
+    }
+
+    args->nrules = 1;
+    char *ss = strdup(args->info_rules), *tmp = ss;
+    int n = 0;
+    while ( *ss )
+    {
+        if ( *ss==':' ) { *ss = 0; n++; if ( n%2==0 ) error("Could not parse INFO rules: \"%s\"\n", args->info_rules); }
+        else if ( *ss==',' ) { *ss = 0; args->nrules++; n++; if ( n%2==1 ) error("Could not parse INFO rules: \"%s\"\n", args->info_rules); }
+        ss++;
+    }
+    if ( n%2==0 ) error("Could not parse INFO rules: \"%s\"\n", args->info_rules);
+    args->rules = (info_rule_t*) calloc(args->nrules,sizeof(info_rule_t));
+
+    n = 0;
+    ss = tmp;
+    while ( n < args->nrules )
+    {
+        info_rule_t *rule = &args->rules[n];
+        rule->hdr_tag = strdup(ss);
+        int id = bcf_hdr_id2int(args->out_hdr, BCF_DT_ID, rule->hdr_tag);
+        if ( !bcf_hdr_idinfo_exists(args->out_hdr,BCF_HL_INFO,id) ) error("The tag is not defined in the header: \"%s\"\n", rule->hdr_tag);
+        rule->type = bcf_hdr_id2type(args->out_hdr,BCF_HL_INFO,id);
+        if ( rule->type!=BCF_HT_INT && rule->type!=BCF_HT_REAL && rule->type!=BCF_HT_STR ) error("The type is not supported: \"%s\"\n", rule->hdr_tag);
+
+        while ( *ss ) ss++; ss++;
+        if ( !*ss ) error("Could not parse INFO rules, missing logic of \"%s\"\n", rule->hdr_tag);
+
+        int is_join = 0;
+        if ( !strcasecmp(ss,"sum") ) rule->merger = info_rules_merge_sum;
+        else if ( !strcasecmp(ss,"avg") ) rule->merger = info_rules_merge_avg;
+        else if ( !strcasecmp(ss,"min") ) rule->merger = info_rules_merge_min;
+        else if ( !strcasecmp(ss,"max") ) rule->merger = info_rules_merge_max;
+        else if ( !strcasecmp(ss,"join") ) { rule->merger = info_rules_merge_join; is_join = 1; }
+        else error("The rule logic \"%s\" not recognised\n", ss);
+
+        if ( !is_join && rule->type==BCF_HT_STR )
+            error("Numeric operation \"%s\" requested on non-numeric field: %s\n", ss, rule->hdr_tag);
+        if ( bcf_hdr_id2number(args->out_hdr,BCF_HL_INFO,id)==0xfffff )
+        {
+            int is_agr = (
+                    bcf_hdr_id2length(args->out_hdr,BCF_HL_INFO,id)==BCF_VL_A ||
+                    bcf_hdr_id2length(args->out_hdr,BCF_HL_INFO,id)==BCF_VL_G ||
+                    bcf_hdr_id2length(args->out_hdr,BCF_HL_INFO,id)==BCF_VL_R
+                    ) ? 1 : 0;
+            if ( is_join && is_agr )
+                error("Cannot -i %s:join on Number=[AGR] tags is not supported.\n", rule->hdr_tag);
+            if ( !is_join && !is_agr )
+                error("Only fixed-length vectors are supported with -i %s:%s\n", ss, rule->hdr_tag);
+        }
+
+        while ( *ss ) ss++; ss++; n++;
+    }
+    free(str.s);
+    free(tmp);
+
+    qsort(args->rules, args->nrules, sizeof(*args->rules), info_rules_comp_key2);
+}
+static void info_rules_destroy(args_t *args)
+{
+    int i;
+    for (i=0; i<args->nrules; i++)
+    {
+        info_rule_t *rule = &args->rules[i];
+        free(rule->hdr_tag);
+        free(rule->vals);
+    }
+    free(args->rules);
+}
+static void info_rules_reset(args_t *args)
+{
+    int i;
+    for (i=0; i<args->nrules; i++)
+        args->rules[i].nblocks = args->rules[i].nvals = args->rules[i].block_size = 0;
+}
+static int info_rules_add_values(args_t *args, bcf_hdr_t *hdr, bcf1_t *line, info_rule_t *rule, maux1_t *als, int var_len)
+{
+    int ret = bcf_get_info_values(hdr, line, rule->hdr_tag, &args->maux->tmp_arr, &args->maux->ntmp_arr, rule->type);
+    if ( ret<=0 ) error("FIXME: error parsing %s at %s:%d .. %d\n", rule->hdr_tag,bcf_seqname(hdr,line),line->pos+1,ret);
+
+    rule->nblocks++;
+
+    if ( rule->type==BCF_HT_STR )
+    {
+        int need_comma = rule->nblocks==1 ? 0 : 1;
+        hts_expand(char,rule->nvals+ret+need_comma+1,rule->mvals,rule->vals);            // 1 for null-termination
+        char *tmp = (char*) rule->vals + rule->nvals;
+        if ( rule->nvals>0 ) { *tmp = ','; tmp++; }
+        strncpy(tmp,(char*)args->maux->tmp_arr,ret);
+        rule->nvals += ret + need_comma;
+        return 1;
+    }
+
+    int i, j;
+    if ( var_len==BCF_VL_A )
+    {
+        assert( ret==line->n_allele-1 );
+        args->maux->nagr_map = ret;
+        hts_expand(int,args->maux->nagr_map,args->maux->magr_map,args->maux->agr_map);
+        // create mapping from source file ALT indexes to dst file indexes
+        for (i=0; i<ret; i++) args->maux->agr_map[i] = als->map[i+1] - 1;
+        rule->block_size = args->maux->nout_als - 1;
+    }
+    else if ( var_len==BCF_VL_R )
+    {
+        assert( ret==line->n_allele );
+        args->maux->nagr_map = ret;
+        hts_expand(int,args->maux->nagr_map,args->maux->magr_map,args->maux->agr_map);
+        for (i=0; i<ret; i++) args->maux->agr_map[i] = als->map[i];
+        rule->block_size = args->maux->nout_als;
+    }
+    else if ( var_len==BCF_VL_G )
+    {
+        args->maux->nagr_map = bcf_alleles2gt(line->n_allele-1,line->n_allele-1)+1;
+        assert( ret==line->n_allele || ret==args->maux->nagr_map );
+        if ( ret==line->n_allele ) // haploid
+        {
+            args->maux->nagr_map = line->n_allele;
+            hts_expand(int,args->maux->nagr_map,args->maux->magr_map,args->maux->agr_map);
+            for (i=0; i<ret; i++) args->maux->agr_map[i] = als->map[i];
+            rule->block_size = args->maux->nout_als;
+        }
+        else
+        {
+            hts_expand(int,args->maux->nagr_map,args->maux->magr_map,args->maux->agr_map);
+            int k_src = 0;
+            for (i=0; i<line->n_allele; i++)
+            {
+                for (j=0; j<=i; j++)
+                {
+                    args->maux->agr_map[k_src] = bcf_alleles2gt(als->map[i],als->map[j]);
+                    k_src++;
+                }
+            }
+            rule->block_size = bcf_alleles2gt(args->maux->nout_als-1,args->maux->nout_als-1)+1;
+        }
+    }
+    else
+    {
+        if ( rule->nblocks>1 && ret!=rule->block_size )
+            error("Mismatch in number of values for INFO/%s at %s:%d\n", rule->hdr_tag,bcf_seqname(hdr,line),line->pos+1);
+        rule->block_size = ret;
+        args->maux->nagr_map = 0;
+    }
+
+    #define BRANCH(src_type_t,dst_type_t,set_missing) { \
+        src_type_t *src = (src_type_t *) args->maux->tmp_arr; \
+        hts_expand0(dst_type_t,(rule->nvals+rule->block_size),rule->mvals,rule->vals); \
+        dst_type_t *dst = (dst_type_t *) rule->vals + rule->nvals; \
+        rule->nvals += rule->block_size; \
+        if ( !args->maux->nagr_map ) \
+        { \
+            for (i=0; i<ret; i++) dst[i] = src[i]; \
+        } \
+        else \
+        { \
+            for (i=0; i<rule->block_size; i++) set_missing; \
+            for (i=0; i<ret; i++) dst[args->maux->agr_map[i]] = src[i]; \
+        } \
+    }
+    switch (rule->type) {
+        case BCF_HT_INT:  BRANCH(int, int32_t, dst[i] = bcf_int32_missing); break;
+        case BCF_HT_REAL: BRANCH(float, float, bcf_float_set_missing(dst[i])); break;
+        default: error("TODO: %s:%d .. type=%d\n", __FILE__,__LINE__, rule->type);
+    }
+    #undef BRANCH
+
+    return 1;
+}
+
+int bcf_hdr_sync(bcf_hdr_t *h);
+
+void bcf_hdr_merge(bcf_hdr_t *hw, const bcf_hdr_t *hr, const char *clash_prefix, int force_samples)
+{
+    // header lines
+    int ret = bcf_hdr_combine(hw, hr);
+    if ( ret!=0 ) error("Error occurred while merging the headers.\n");
+
+    // samples
+    int i;
+    for (i=0; i<bcf_hdr_nsamples(hr); i++)
+    {
+        char *name = hr->samples[i];
+        if ( bcf_hdr_id2int(hw, BCF_DT_SAMPLE, name)!=-1 )
+        {
+            // there is a sample with the same name
+            if ( !force_samples ) error("Error: Duplicate sample names (%s), use --force-samples to proceed anyway.\n", name);
+
+            int len = strlen(hr->samples[i]) + strlen(clash_prefix) + 1;
+            name = (char*) malloc(sizeof(char)*(len+1));
+            sprintf(name,"%s:%s",clash_prefix,hr->samples[i]);
+            bcf_hdr_add_sample(hw,name);
+            free(name);
+        }
+        else
+            bcf_hdr_add_sample(hw,name);
+    }
+}
+
+void debug_als(char **als, int nals)
+{
+    int k; for (k=0; k<nals; k++) fprintf(stderr,"%s ", als[k]);
+    fprintf(stderr,"\n");
+}
+
+/**
+ * normalize_alleles() - create smallest possible representation of the alleles
+ * @als:    alleles to be merged, first is REF (rw)
+ * @nals:   number of $a alleles
+ *
+ * Best explained on an example:
+ *      In:  REF=GTTT  ALT=GTT
+ *      Out: REF=GT    ALT=G
+ *
+ * Note: the als array will be modified
+ */
+void normalize_alleles(char **als, int nals)
+{
+    if ( !als[0][1] ) return;   // ref is 1base long, we're done
+
+    int j, i = 1, done = 0;
+    int *lens = (int*) malloc(sizeof(int)*nals);
+    for (j=0; j<nals; j++) lens[j] = strlen(als[j]);
+
+    while ( i<lens[0] )
+    {
+        for (j=1; j<nals; j++)
+        {
+            if ( i>=lens[j] ) done = 1;
+            if ( als[j][lens[j]-i] != als[0][lens[0]-i] ) { done = 1; break; }
+        }
+        if ( done ) break;
+        i++;
+    }
+    if ( i>1 )
+    {
+        i--;
+        als[0][lens[0]-i] = 0;
+        for (j=1; j<nals; j++) als[j][lens[j]-i] = 0;
+    }
+    free(lens);
+}
+
+ /**
+ * merge_alleles() - merge two REF,ALT records, $a and $b into $b.
+ * @a:      alleles to be merged, first is REF
+ * @na:     number of $a alleles
+ * @map:    map from the original $a indexes to new $b indexes (0-based)
+ * @b:      alleles to be merged, the array will be expanded as required
+ * @nb:     number of $b alleles
+ * @mb:     size of $b
+ *
+ * Returns NULL on error or $b expanded to incorporate $a alleles and sets
+ * $map. Best explained on an example:
+ *      In:     REF   ALT
+ *           a: ACG,  AC,A    (1bp and 2bp deletion)
+ *           b: ACGT, A       (3bp deletion)
+ *      Out:
+ *           b: ACGT, A,ACT,AT (3bp, 1bp and 2bp deletion)
+ *           map: 0,2,3
+ * Here the mapping from the original $a alleles to the new $b alleles is 0->0,
+ * 1->2, and 2->3.
+ */
+char **merge_alleles(char **a, int na, int *map, char **b, int *nb, int *mb)
+{
+    // reference allele never changes
+    map[0] = 0;
+
+    int i,j;
+    int rla = !a[0][1] ? 1 : strlen(a[0]);
+    int rlb = !b[0][1] ? 1 : strlen(b[0]);
+
+    // the most common case: same SNPs
+    if ( na==2 && *nb==2 && rla==1 && rlb==1 && a[1][0]==b[1][0] && !a[1][1] && !b[1][1] )
+    {
+        map[1] = 1;
+        return b;
+    }
+
+    // Sanity check: reference prefixes must be identical
+    if ( strncmp(a[0],b[0],rla<rlb?rla:rlb) )
+    {
+        if ( strncasecmp(a[0],b[0],rla<rlb?rla:rlb) )
+        {
+            fprintf(stderr, "The REF prefixes differ: %s vs %s (%d,%d)\n", a[0],b[0],rla,rlb);
+            return NULL;
+        }
+        // Different case, change to uppercase
+        for (i=0; i<na; i++)
+        {
+            int len = strlen(a[i]);
+            for (j=0; j<len; j++) a[i][j] = toupper(a[i][j]);
+        }
+        for (i=0; i<*nb; i++)
+        {
+            int len = strlen(b[i]);
+            for (j=0; j<len; j++) b[i][j] = toupper(b[i][j]);
+        }
+    }
+
+    int n = *nb + na;
+    hts_expand0(char*,n,*mb,b);
+
+    // $b alleles need expanding
+    if ( rla>rlb )
+    {
+        for (i=0; i<*nb; i++)
+        {
+            int l = strlen(b[i]);
+            b[i] = (char*) realloc(b[i],l+rla-rlb+1);
+            memcpy(b[i]+l,a[0]+rlb,rla-rlb+1);
+        }
+    }
+
+    // now check if the $a alleles are present and if not add them
+    for (i=1; i<na; i++)
+    {
+        char *ai;
+        if ( rlb>rla )  // $a alleles need expanding
+        {
+            int l = strlen(a[i]);
+            ai = (char*) malloc(l+rlb-rla+1);
+            memcpy(ai,a[i],l);
+            memcpy(ai+l,b[0]+rla,rlb-rla+1);
+        }
+        else
+            ai = a[i];
+
+        for (j=1; j<*nb; j++)
+            if ( !strcmp(ai,b[j]) ) break;
+
+        if ( j<*nb ) // $b already has the same allele
+        {
+            map[i] = j;
+            if ( rlb>rla ) free(ai);
+            continue;
+        }
+        // new allele
+        map[i] = *nb;
+        b[*nb] = rlb>rla ? ai : strdup(ai);
+        (*nb)++;
+    }
+    return b;
+}
+
+maux_t *maux_init(bcf_srs_t *files)
+{
+    maux_t *ma = (maux_t*) calloc(1,sizeof(maux_t));
+    ma->n      = files->nreaders;
+    ma->nbuf   = (int *) calloc(ma->n,sizeof(int));
+    ma->d      = (maux1_t**) calloc(ma->n,sizeof(maux1_t*));
+    ma->files  = files;
+    int i, n_smpl = 0;
+    for (i=0; i<ma->n; i++)
+        n_smpl += bcf_hdr_nsamples(files->readers[i].header);
+    ma->smpl_ploidy = (int*) calloc(n_smpl,sizeof(int));
+    ma->smpl_nGsize = (int*) malloc(n_smpl*sizeof(int));
+    ma->has_line = (int*) malloc(ma->n*sizeof(int));
+    return ma;
+}
+void maux_destroy(maux_t *ma)
+{
+    int i;
+    for (i=0; i<ma->n; i++) // for each reader
+    {
+        if ( !ma->d[i] ) continue;
+        int j;
+        for (j=0; j<ma->nbuf[i]; j++)  // for each buffered line
+            if ( ma->d[i][j].map ) free(ma->d[i][j].map);
+        free(ma->d[i]);
+    }
+    for (i=0; i<ma->mAGR_info; i++)
+        free(ma->AGR_info[i].buf);
+    free(ma->agr_map);
+    free(ma->AGR_info);
+    if (ma->ntmp_arr) free(ma->tmp_arr);
+    if (ma->nfmt_map) free(ma->fmt_map);
+    // ma->inf freed in bcf_destroy1
+    free(ma->d);
+    free(ma->nbuf);
+    for (i=0; i<ma->mals; i++) free(ma->als[i]);
+    if (ma->mout_als) free(ma->out_als);
+    free(ma->als);
+    free(ma->cnt);
+    free(ma->smpl_ploidy);
+    free(ma->smpl_nGsize);
+    free(ma->has_line);
+    free(ma);
+}
+void maux_expand1(maux_t *ma, int i)
+{
+    if ( ma->nbuf[i] <= ma->files->readers[i].nbuffer )
+    {
+        int n = ma->files->readers[i].nbuffer + 1;
+        ma->d[i] = (maux1_t*) realloc(ma->d[i], sizeof(maux1_t)*n);
+        memset(ma->d[i]+ma->nbuf[i],0,sizeof(maux1_t)*(n-ma->nbuf[i]));
+        ma->nbuf[i] = n;
+    }
+}
+void maux_reset(maux_t *ma)
+{
+    int i;
+    for (i=0; i<ma->n; i++) maux_expand1(ma, i);
+    for (i=1; i<ma->ncnt; i++) ma->cnt[i] = 0;
+}
+void maux_debug(maux_t *ma, int ir, int ib)
+{
+    printf("[%d,%d]\t", ir,ib);
+    int i;
+    for (i=0; i<ma->nals; i++)
+    {
+        printf(" %s [%d]", ma->als[i], ma->cnt[i]);
+    }
+    printf("\n");
+}
+
+void merge_chrom2qual(args_t *args, bcf1_t *out)
+{
+    bcf_srs_t *files = args->files;
+    bcf_hdr_t *out_hdr = args->out_hdr;
+
+    int i, ret;
+    khiter_t kitr;
+    strdict_t *tmph = args->tmph;
+    kh_clear(strdict, tmph);
+    kstring_t *tmps = &args->tmps;
+    tmps->l = 0;
+
+    maux_t *ma = args->maux;
+    int *al_idxs = (int*) calloc(ma->nals,sizeof(int));
+    bcf_float_set_missing(out->qual);
+
+    // CHROM, POS, ID, QUAL
+    out->pos = -1;
+    for (i=0; i<files->nreaders; i++)
+    {
+        if ( !ma->has_line[i] ) continue;
+
+        bcf_sr_t *reader = &files->readers[i];
+        bcf1_t *line = reader->buffer[0];
+        bcf_hdr_t *hdr = reader->header;
+
+        // alleles
+        int j;
+        for (j=1; j<line->n_allele; j++)
+            al_idxs[ ma->d[i][0].map[j] ] = 1;
+
+        // position
+        if ( out->pos==-1 )
+        {
+            const char *chr = hdr->id[BCF_DT_CTG][line->rid].key;
+            out->rid = bcf_hdr_name2id(out_hdr, chr);
+            if ( strcmp(chr,out_hdr->id[BCF_DT_CTG][out->rid].key) ) error("Uh\n");
+            out->pos = line->pos;
+        }
+
+        // ID
+        if ( line->d.id[0]!='.' || line->d.id[1] )
+        {
+            kitr = kh_get(strdict, tmph, line->d.id);
+            if ( kitr == kh_end(tmph) )
+            {
+                if ( tmps->l ) kputc(';', tmps);
+                kputs(line->d.id, tmps);
+                kh_put(strdict, tmph, line->d.id, &ret);
+            }
+        }
+
+        // set QUAL to the max qual value. Not exactly correct, but good enough for now
+        if ( !bcf_float_is_missing(files->readers[i].buffer[0]->qual) )
+        {
+            if ( bcf_float_is_missing(out->qual) || out->qual < files->readers[i].buffer[0]->qual ) out->qual = files->readers[i].buffer[0]->qual;
+        }
+    }
+
+    // set ID
+    if ( !tmps->l ) kputs(".", tmps);
+    if ( out->d.id ) free(out->d.id);
+    out->d.id = strdup(tmps->s);
+
+    // set alleles
+    ma->nout_als = 0;
+    for (i=1; i<ma->nals; i++)
+    {
+        if ( !al_idxs[i] ) continue;
+        ma->nout_als++;
+
+        // Adjust the indexes, the allele map could be created for multiple collapsed records,
+        //  some of which might be unused for this output line
+        int ir, j;
+        for (ir=0; ir<files->nreaders; ir++)
+        {
+            if ( !ma->has_line[ir] ) continue;
+            bcf1_t *line = files->readers[ir].buffer[0];
+            for (j=1; j<line->n_allele; j++)
+                if ( ma->d[ir][0].map[j]==i ) ma->d[ir][0].map[j] = ma->nout_als;
+        }
+    }
+    // Expand the arrays and realloc the alleles string. Note that all alleles are in a single allocated block.
+    ma->nout_als++;
+    hts_expand0(char*, ma->nout_als, ma->mout_als, ma->out_als);
+    int k = 0;
+    for (i=0; i<ma->nals; i++)
+        if ( i==0 || al_idxs[i] ) ma->out_als[k++] = strdup(ma->als[i]);
+    assert( k==ma->nout_als );
+    normalize_alleles(ma->out_als, ma->nout_als);
+    bcf_update_alleles(out_hdr, out, (const char**) ma->out_als, ma->nout_als);
+    free(al_idxs);
+    for (i=0; i<ma->nout_als; i++) free(ma->out_als[i]);
+}
+
+void merge_filter(args_t *args, bcf1_t *out)
+{
+    bcf_srs_t *files = args->files;
+    bcf_hdr_t *out_hdr = args->out_hdr;
+
+    int i, ret;
+    khiter_t kitr;
+    strdict_t *tmph = args->tmph;
+    kh_clear(strdict, tmph);
+
+    maux_t *ma = args->maux;
+    out->d.n_flt = 0;
+    for (i=0; i<files->nreaders; i++)
+    {
+        if ( !ma->has_line[i]) continue;
+
+        bcf_sr_t *reader = &files->readers[i];
+        bcf1_t *line = reader->buffer[0];
+        bcf_hdr_t *hdr = reader->header;
+        bcf_unpack(line, BCF_UN_ALL);
+
+        int k;
+        for (k=0; k<line->d.n_flt; k++)
+        {
+            const char *flt = hdr->id[BCF_DT_ID][line->d.flt[k]].key;
+            kitr = kh_get(strdict, tmph, flt);
+            if ( kitr == kh_end(tmph) )
+            {
+                int id = bcf_hdr_id2int(out_hdr, BCF_DT_ID, flt);
+                if ( id==-1 ) error("The filter not defined: %s\n", flt);
+                hts_expand(int,out->d.n_flt+1,ma->mflt,ma->flt);
+                ma->flt[out->d.n_flt] = id;
+                out->d.n_flt++;
+                kh_put(strdict, tmph, flt, &ret);
+            }
+        }
+    }
+    // Check if PASS is not mixed with other filters
+    if ( out->d.n_flt>1 )
+    {
+        int id = bcf_hdr_id2int(out_hdr, BCF_DT_ID, "PASS");
+        for (i=0; i<out->d.n_flt; i++)
+            if ( ma->flt[i]==id ) break;
+        if ( i<out->d.n_flt )
+        {
+            out->d.n_flt--;
+            for (; i<out->d.n_flt; i++) ma->flt[i] = ma->flt[i+1];
+        }
+    }
+    out->d.flt = ma->flt;
+}
+
+static void bcf_info_set_id(bcf1_t *line, bcf_info_t *info, int id, kstring_t *tmp_str)
+{
+    assert( !info->vptr_free );
+
+    uint8_t *ptr = info->vptr - info->vptr_off;
+    bcf_dec_typed_int1(ptr, &ptr);
+
+    tmp_str->l = 0;
+    bcf_enc_int1(tmp_str, id);
+
+    if ( tmp_str->l == ptr - info->vptr + info->vptr_off )
+    {
+        // the new id is represented with the same number of bytes
+        memcpy(info->vptr - info->vptr_off, tmp_str->s, tmp_str->l);
+        return;
+    }
+
+    kputsn_(ptr, info->vptr - ptr, tmp_str);
+    info->vptr_off = tmp_str->l;
+    kputsn_(info->vptr, info->len << bcf_type_shift[info->type], tmp_str);
+
+    info->vptr = (uint8_t*) tmp_str->s + info->vptr_off;
+    info->vptr_free = 1;
+    line->d.shared_dirty |= BCF1_DIRTY_INF;
+    tmp_str->s = NULL;
+    tmp_str->m = 0;
+    tmp_str->l = 0;
+}
+
+/*
+ *  copy_string_field() - copy a comma-separated field
+ *  @param src:     source string
+ *  @param isrc:    index of the field to copy 
+ *  @param src_len: length of source string (excluding the terminating \0) 
+ *  @param dst:     destination kstring (must be initialized)
+ *  @param idst:    index of the destination field
+ */
+int copy_string_field(char *src, int isrc, int src_len, kstring_t *dst, int idst)
+{
+    int ith_src = 0, start_src = 0;    // i-th field in src string
+    while ( ith_src<isrc && start_src<src_len )
+    {
+        if ( src[start_src]==',' ) { ith_src++; }
+        start_src++;
+    }
+    if ( ith_src!=isrc ) return -1; // requested field not found
+    int end_src = start_src;
+    while ( end_src<src_len && src[end_src]!=',' ) end_src++;
+
+    int nsrc_cpy = end_src - start_src;
+    if ( nsrc_cpy==1 && src[start_src]=='.' ) return 0;   // don't write missing values, dst is already initialized
+
+    int ith_dst = 0, start_dst = 0;
+    while ( ith_dst<idst && start_dst<dst->l )
+    {
+        if ( dst->s[start_dst]==',' ) { ith_dst++; }
+        start_dst++;
+    }
+    if ( ith_dst!=idst ) return -2;
+    int end_dst = start_dst;
+    while ( end_dst<dst->l && dst->s[end_dst]!=',' ) end_dst++;
+
+    if ( end_dst - start_dst>1 || dst->s[start_dst]!='.' ) return 0;   // do not overwrite non-empty values
+
+    // Now start_dst and end_dst are indexes to the destination memory area
+    // which needs to be replaced with nsrc_cpy
+    // source bytes, end_dst points just after.
+    int ndst_shift = nsrc_cpy - (end_dst - start_dst);
+    int ndst_move  = dst->l - end_dst + 1;  // how many bytes must be moved (including \0)
+    if ( ndst_shift )
+    {
+        ks_resize(dst, dst->l + ndst_shift + 1);    // plus \0
+        memmove(dst->s+end_dst+ndst_shift, dst->s+end_dst, ndst_move);
+    }
+    memcpy(dst->s+start_dst, src+start_src, nsrc_cpy);
+    dst->l += ndst_shift;
+    return 0;
+}
+
+static void merge_AGR_info_tag(bcf_hdr_t *hdr, bcf1_t *line, bcf_info_t *info, int len, maux1_t *als, AGR_info_t *agr)
+{
+    int i;
+    if ( !agr->nbuf )
+    {
+        if ( info->type==BCF_BT_INT8 || info->type==BCF_BT_INT16 || info->type==BCF_BT_INT32 || info->type==BCF_BT_FLOAT )
+        {
+            agr->nbuf = 4 * agr->nvals;
+            hts_expand(uint8_t,agr->nbuf,agr->mbuf,agr->buf);
+            if ( info->type!=BCF_BT_FLOAT )
+            {
+                int32_t *tmp = (int32_t*) agr->buf;
+                for (i=0; i<agr->nvals; i++) tmp[i] = bcf_int32_missing;
+            }
+            else
+            {
+                float *tmp = (float*) agr->buf;
+                for (i=0; i<agr->nvals; i++) bcf_float_set_missing(tmp[i]);
+            }
+        }
+        else if ( info->type==BCF_BT_CHAR )
+        {
+            kstring_t tmp; tmp.l = 0; tmp.m = agr->mbuf; tmp.s = (char*)agr->buf;
+            kputc('.',&tmp);
+            for (i=1; i<agr->nvals; i++) kputs(",.",&tmp);
+            agr->mbuf = tmp.m; agr->nbuf = tmp.l; agr->buf = (uint8_t*)tmp.s;
+        }
+        else
+            error("Not ready for type [%d]: %s at %d\n", info->type,agr->hdr_tag,line->pos+1);
+    }
+
+    if ( info->type==BCF_BT_INT8 || info->type==BCF_BT_INT16 || info->type==BCF_BT_INT32 || info->type==BCF_BT_FLOAT )
+    {
+        if ( len==BCF_VL_A || len==BCF_VL_R )
+        {
+            int ifrom = len==BCF_VL_A ? 1 : 0;
+            #define BRANCH(type_t, is_missing, is_vector_end, out_type_t) { \
+                type_t *src = (type_t *) info->vptr; \
+                out_type_t *tgt = (out_type_t *) agr->buf; \
+                int iori, inew; \
+                for (iori=ifrom; iori<line->n_allele; iori++) \
+                { \
+                    if ( is_vector_end ) break; \
+                    if ( is_missing ) continue; \
+                    inew = als->map[iori] - ifrom; \
+                    tgt[inew] = *src; \
+                    src++; \
+                } \
+            }
+            switch (info->type) {
+                case BCF_BT_INT8:  BRANCH(int8_t,  *src==bcf_int8_missing,  *src==bcf_int8_vector_end,  int); break;
+                case BCF_BT_INT16: BRANCH(int16_t, *src==bcf_int16_missing, *src==bcf_int16_vector_end, int); break;
+                case BCF_BT_INT32: BRANCH(int32_t, *src==bcf_int32_missing, *src==bcf_int32_vector_end, int); break;
+                case BCF_BT_FLOAT: BRANCH(float,   bcf_float_is_missing(*src), bcf_float_is_vector_end(*src), float); break;
+                default: fprintf(stderr,"TODO: %s:%d .. info->type=%d\n", __FILE__,__LINE__, info->type); exit(1);
+            }
+            #undef BRANCH
+        }
+        else
+        {
+            #define BRANCH(type_t, is_missing, is_vector_end, out_type_t) { \
+                type_t *src = (type_t *) info->vptr; \
+                out_type_t *tgt = (out_type_t *) agr->buf; \
+                int iori,jori, inew,jnew; \
+                for (iori=0; iori<line->n_allele; iori++) \
+                { \
+                    inew = als->map[iori]; \
+                    for (jori=0; jori<=iori; jori++) \
+                    { \
+                        jnew = als->map[jori]; \
+                        int kori = iori*(iori+1)/2 + jori; \
+                        if ( is_vector_end ) break; \
+                        if ( is_missing ) continue; \
+                        int knew = inew>jnew ? inew*(inew+1)/2 + jnew : jnew*(jnew+1)/2 + inew; \
+                        tgt[knew] = src[kori]; \
+                    } \
+                    if ( jori<=iori ) break; \
+                } \
+            }
+            switch (info->type) {
+                case BCF_BT_INT8:  BRANCH(int8_t,  src[kori]==bcf_int8_missing,  src[kori]==bcf_int8_vector_end,  int); break;
+                case BCF_BT_INT16: BRANCH(int16_t, src[kori]==bcf_int16_missing, src[kori]==bcf_int16_vector_end, int); break;
+                case BCF_BT_INT32: BRANCH(int32_t, src[kori]==bcf_int32_missing, src[kori]==bcf_int32_vector_end, int); break;
+                case BCF_BT_FLOAT: BRANCH(float,   bcf_float_is_missing(src[kori]), bcf_float_is_vector_end(src[kori]), float); break;
+                default: fprintf(stderr,"TODO: %s:%d .. info->type=%d\n", __FILE__,__LINE__, info->type); exit(1);
+            }
+            #undef BRANCH
+        }
+    }
+    else
+    {
+        kstring_t tmp; tmp.l = agr->nbuf; tmp.m = agr->mbuf; tmp.s = (char*)agr->buf;
+        if ( len==BCF_VL_A || len==BCF_VL_R )
+        {
+            int iori, ifrom = len==BCF_VL_A ? 1 : 0;
+            for (iori=ifrom; iori<line->n_allele; iori++)
+            {
+                int ret = copy_string_field((char*)info->vptr, iori-ifrom, info->len, &tmp, als->map[iori]-ifrom);
+                if ( ret )
+                    error("Error at %s:%d: wrong number of fields in %s?\n", bcf_seqname(hdr,line),line->pos+1,agr->hdr_tag);
+            }
+        }
+        else
+        {
+            int iori,jori, inew,jnew;
+            for (iori=0; iori<line->n_allele; iori++)
+            {
+                inew = als->map[iori];
+                for (jori=0; jori<=iori; jori++)
+                {
+                    jnew = als->map[jori];
+                    int kori = iori*(iori+1)/2 + jori;
+                    int knew = bcf_alleles2gt(inew,jnew);
+                    int ret  = copy_string_field((char*)info->vptr, kori, info->len, &tmp, knew);
+                    if ( ret )
+                        error("Error at %s:%d: wrong number of fields in %s?\n", bcf_seqname(hdr,line),line->pos+1,agr->hdr_tag);
+                }
+            }
+        }
+        agr->mbuf = tmp.m; agr->nbuf = tmp.l; agr->buf = (uint8_t*)tmp.s;
+    }
+}
+
+void merge_info(args_t *args, bcf1_t *out)
+{
+    bcf_srs_t *files = args->files;
+    bcf_hdr_t *out_hdr = args->out_hdr;
+
+    int i, j, ret;
+    khiter_t kitr;
+    strdict_t *tmph = args->tmph;
+    kh_clear(strdict, tmph);
+
+    maux_t *ma = args->maux;
+    ma->nAGR_info = 0;
+    out->n_info   = 0;
+    info_rules_reset(args);
+    for (i=0; i<files->nreaders; i++)
+    {
+        if ( !ma->has_line[i] ) continue;
+        bcf_sr_t *reader = &files->readers[i];
+        bcf1_t *line = reader->buffer[0];
+        bcf_hdr_t *hdr = reader->header;
+        for (j=0; j<line->n_info; j++)
+        {
+            bcf_info_t *inf = &line->d.info[j];
+
+            const char *key = hdr->id[BCF_DT_ID][inf->key].key;
+            if ( !strcmp("AC",key) || !strcmp("AN",key) ) continue;  // AC and AN are done in merge_format() after genotypes are done
+
+            int id = bcf_hdr_id2int(out_hdr, BCF_DT_ID, key);
+            if ( id==-1 ) error("Error: The INFO field is not defined in the header: %s\n", key);
+
+            kitr = kh_get(strdict, tmph, key);  // have we seen the tag in one of the readers?
+            int len = bcf_hdr_id2length(hdr,BCF_HL_INFO,inf->key);
+            if ( args->nrules )
+            {
+                info_rule_t *rule = (info_rule_t*) bsearch(key, args->rules, args->nrules, sizeof(*args->rules), info_rules_comp_key);
+                if ( rule )
+                {
+                    maux1_t *als = ( len==BCF_VL_A || len==BCF_VL_G || len==BCF_VL_R ) ? &ma->d[i][0] : NULL;
+                    if ( info_rules_add_values(args, hdr, line, rule, als, len) ) continue;
+                }
+            }
+
+            // Todo: Number=AGR tags should use the newer info_rules_* functions (info_rules_merge_first to be added)
+            // and merge_AGR_info_tag to be made obsolete.
+            if ( len==BCF_VL_A || len==BCF_VL_G || len==BCF_VL_R  ) // Number=R,G,A requires special treatment
+            {
+                if ( kitr == kh_end(tmph) )
+                {
+                    // first occurance in this reader, alloc arrays
+                    ma->nAGR_info++;
+                    hts_expand0(AGR_info_t,ma->nAGR_info,ma->mAGR_info,ma->AGR_info);
+                    kitr = kh_put(strdict, tmph, key, &ret);
+                    kh_val(tmph,kitr) = ma->nAGR_info - 1;
+                    ma->AGR_info[ma->nAGR_info-1].hdr_tag = key;
+                    ma->AGR_info[ma->nAGR_info-1].type  = bcf_hdr_id2type(hdr,BCF_HL_INFO,inf->key);
+                    ma->AGR_info[ma->nAGR_info-1].nbuf  = 0;    // size of the buffer
+                    switch (len)
+                    {
+                        case BCF_VL_A: ma->AGR_info[ma->nAGR_info-1].nvals = ma->nout_als - 1; break;
+                        case BCF_VL_G: ma->AGR_info[ma->nAGR_info-1].nvals = bcf_alleles2gt(ma->nout_als-1,ma->nout_als-1)+1; break;
+                        case BCF_VL_R: ma->AGR_info[ma->nAGR_info-1].nvals = ma->nout_als; break;
+                    }
+                }
+                kitr = kh_get(strdict, tmph, key);
+                int idx = kh_val(tmph, kitr);
+                if ( idx<0 ) error("Error occurred while processing INFO tag \"%s\" at %s:%d\n", key,bcf_seqname(hdr,line),line->pos+1);
+                merge_AGR_info_tag(hdr, line,inf,len,&ma->d[i][0],&ma->AGR_info[idx]);
+                continue;
+            }
+
+            if ( kitr == kh_end(tmph) )
+            {
+                hts_expand0(bcf_info_t,out->n_info+1,ma->minf,ma->inf);
+                ma->inf[out->n_info].key  = id;
+                ma->inf[out->n_info].type = inf->type;
+                ma->inf[out->n_info].len  = inf->len;
+                ma->inf[out->n_info].vptr = inf->vptr;
+                ma->inf[out->n_info].v1.i = inf->v1.i;
+                ma->inf[out->n_info].v1.f = inf->v1.f;
+                ma->inf[out->n_info].vptr_off  = inf->vptr_off;
+                ma->inf[out->n_info].vptr_len  = inf->vptr_len;
+                ma->inf[out->n_info].vptr_free = inf->vptr_free;
+                if ( (args->output_type & FT_BCF) && id!=bcf_hdr_id2int(hdr, BCF_DT_ID, key) )
+                {
+                    // The existing packed info cannot be reused. Change the id.
+                    // Although quite hacky, it's faster than anything else given
+                    // the data structures
+                    bcf_info_set_id(out, &ma->inf[out->n_info], id, &args->tmps);
+                }
+                out->n_info++;
+                kitr = kh_put(strdict, tmph, key, &ret);
+                kh_val(tmph,kitr) = -(out->n_info-1);   // arbitrary negative value
+            }
+        }
+    }
+    out->d.info = ma->inf;
+    out->d.m_info = ma->minf;
+    for (i=0; i<args->nrules; i++)
+        args->rules[i].merger(args->out_hdr, out, &args->rules[i]);
+    for (i=0; i<ma->nAGR_info; i++)
+    {
+        AGR_info_t *agr = &ma->AGR_info[i];
+        bcf_update_info(out_hdr,out,agr->hdr_tag,agr->buf,agr->nvals,agr->type);
+    }
+}
+
+void update_AN_AC(bcf_hdr_t *hdr, bcf1_t *line)
+{
+    int32_t an = 0, *tmp = (int32_t*) malloc(sizeof(int)*line->n_allele);
+    int ret = bcf_calc_ac(hdr, line, tmp, BCF_UN_FMT);
+    if ( ret>0 )
+    {
+        int i;
+        for (i=0; i<line->n_allele; i++) an += tmp[i];
+        bcf_update_info_int32(hdr, line, "AN", &an, 1);
+        bcf_update_info_int32(hdr, line, "AC", tmp+1, line->n_allele-1);
+    }
+    free(tmp);
+}
+
+void merge_GT(args_t *args, bcf_fmt_t **fmt_map, bcf1_t *out)
+{
+    bcf_srs_t *files = args->files;
+    bcf_hdr_t *out_hdr = args->out_hdr;
+    maux_t *ma = args->maux;
+    int i, ismpl = 0, nsamples = bcf_hdr_nsamples(out_hdr);
+
+    int nsize = 0, msize = sizeof(int32_t);
+    for (i=0; i<files->nreaders; i++)
+    {
+        if ( !fmt_map[i] ) continue;
+        if ( fmt_map[i]->n > nsize ) nsize = fmt_map[i]->n;
+    }
+
+    if ( ma->ntmp_arr < nsamples*nsize*msize )
+    {
+        ma->ntmp_arr = nsamples*nsize*msize;
+        ma->tmp_arr  = realloc(ma->tmp_arr, ma->ntmp_arr);
+    }
+    memset(ma->smpl_ploidy,0,nsamples*sizeof(int));
+
+    for (i=0; i<files->nreaders; i++)
+    {
+        bcf_sr_t *reader = &files->readers[i];
+        bcf_hdr_t *hdr = reader->header;
+        bcf_fmt_t *fmt_ori = fmt_map[i];
+        int32_t *tmp  = (int32_t *) ma->tmp_arr + ismpl*nsize;
+
+        int j, k;
+        if ( !fmt_ori )
+        {
+            // missing values: assume maximum ploidy
+            for (j=0; j<bcf_hdr_nsamples(hdr); j++)
+            {
+                for (k=0; k<nsize; k++) { tmp[k] = 0; ma->smpl_ploidy[ismpl+j]++; }
+                tmp += nsize;
+            }
+            ismpl += bcf_hdr_nsamples(hdr);
+            continue;
+        }
+
+        #define BRANCH(type_t, vector_end) { \
+            type_t *p_ori  = (type_t*) fmt_ori->p; \
+            if ( !ma->d[i][0].als_differ ) \
+            { \
+                /* the allele numbering is unchanged */ \
+                for (j=0; j<bcf_hdr_nsamples(hdr); j++) \
+                { \
+                    for (k=0; k<fmt_ori->n; k++) \
+                    { \
+                        if ( p_ori[k]==vector_end ) break; /* smaller ploidy */ \
+                        ma->smpl_ploidy[ismpl+j]++; \
+                        if ( bcf_gt_is_missing(p_ori[k]) ) tmp[k] = 0; /* missing allele */ \
+                        else tmp[k] = p_ori[k]; \
+                    } \
+                    for (; k<nsize; k++) tmp[k] = bcf_int32_vector_end; \
+                    tmp += nsize; \
+                    p_ori += fmt_ori->n; \
+                } \
+                ismpl += bcf_hdr_nsamples(hdr); \
+                continue; \
+            } \
+            /* allele numbering needs to be changed */ \
+            for (j=0; j<bcf_hdr_nsamples(hdr); j++) \
+            { \
+                for (k=0; k<fmt_ori->n; k++) \
+                { \
+                    if ( p_ori[k]==vector_end ) break; /* smaller ploidy */ \
+                    ma->smpl_ploidy[ismpl+j]++; \
+                    if ( bcf_gt_is_missing(p_ori[k]) ) tmp[k] = 0; /* missing allele */ \
+                    else \
+                    { \
+                        int al = (p_ori[k]>>1) - 1; \
+                        al = al<=0 ? al + 1 : ma->d[i][0].map[al] + 1; \
+                        tmp[k] = (al << 1) | ((p_ori[k])&1); \
+                    } \
+                } \
+                for (; k<nsize; k++) tmp[k] = bcf_int32_vector_end; \
+                tmp += nsize; \
+                p_ori += fmt_ori->n; \
+            } \
+            ismpl += bcf_hdr_nsamples(hdr); \
+        }
+        switch (fmt_ori->type)
+        {
+            case BCF_BT_INT8: BRANCH(int8_t,   bcf_int8_vector_end); break;
+            case BCF_BT_INT16: BRANCH(int16_t, bcf_int16_vector_end); break;
+            case BCF_BT_INT32: BRANCH(int32_t, bcf_int32_vector_end); break;
+            default: error("Unexpected case: %d\n", fmt_ori->type);
+        }
+        #undef BRANCH
+    }
+    bcf_update_format_int32(out_hdr, out, "GT", (int32_t*)ma->tmp_arr, nsamples*nsize);
+}
+
+void merge_format_field(args_t *args, bcf_fmt_t **fmt_map, bcf1_t *out)
+{
+    bcf_srs_t *files = args->files;
+    bcf_hdr_t *out_hdr = args->out_hdr;
+    maux_t *ma = args->maux;
+    int i, ismpl = 0, nsamples = bcf_hdr_nsamples(out_hdr);
+
+    const char *key = NULL;
+    int nsize = 0, length = BCF_VL_FIXED, type = -1;
+    for (i=0; i<files->nreaders; i++)
+    {
+        if ( !ma->has_line[i] ) continue;
+        if ( !fmt_map[i] ) continue;
+        if ( !key ) key = files->readers[i].header->id[BCF_DT_ID][fmt_map[i]->id].key;
+        type = fmt_map[i]->type;
+        if ( IS_VL_G(files->readers[i].header, fmt_map[i]->id) )
+        {
+            length = BCF_VL_G;
+            nsize = out->n_allele*(out->n_allele + 1)/2;
+            break;
+        }
+        if ( IS_VL_A(files->readers[i].header, fmt_map[i]->id) )
+        {
+            length = BCF_VL_A;
+            nsize = out->n_allele - 1;
+            break;
+        }
+        if ( IS_VL_R(files->readers[i].header, fmt_map[i]->id) )
+        {
+            length = BCF_VL_R;
+            nsize = out->n_allele;
+            break;
+        }
+        if ( fmt_map[i]->n > nsize ) nsize = fmt_map[i]->n;
+    }
+
+    int msize = sizeof(float)>sizeof(int32_t) ? sizeof(float) : sizeof(int32_t);
+    if ( ma->ntmp_arr < nsamples*nsize*msize )
+    {
+        ma->ntmp_arr = nsamples*nsize*msize;
+        ma->tmp_arr  = realloc(ma->tmp_arr, ma->ntmp_arr);
+    }
+
+    // Fill the temp array for all samples by collecting values from all files
+    for (i=0; i<files->nreaders; i++)
+    {
+        bcf_sr_t *reader = &files->readers[i];
+        bcf_hdr_t *hdr = reader->header;
+        bcf_fmt_t *fmt_ori = fmt_map[i];
+        if ( fmt_ori )
+        {
+            type = fmt_ori->type;
+            int nals_ori = reader->buffer[0]->n_allele;
+            if ( length==BCF_VL_G )
+            {
+                // if all fields are missing then n==1 is valid
+                if ( fmt_ori->n!=1 && fmt_ori->n != nals_ori*(nals_ori+1)/2 && fmt_map[i]->n != nals_ori )
+                    error("Incorrect number of %s fields (%d) at %s:%d, cannot merge.\n", key,fmt_ori->n,bcf_seqname(args->out_hdr,out),out->pos+1);
+            }
+            else if ( length==BCF_VL_A )
+            {
+                if ( fmt_ori->n!=1 && fmt_ori->n != nals_ori-1 )
+                    error("Incorrect number of %s fields (%d) at %s:%d, cannot merge.\n", key,fmt_ori->n,bcf_seqname(args->out_hdr,out),out->pos+1);
+            }
+            else if ( length==BCF_VL_R )
+            {
+                if ( fmt_ori->n!=1 && fmt_ori->n != nals_ori )
+                    error("Incorrect number of %s fields (%d) at %s:%d, cannot merge.\n", key,fmt_ori->n,bcf_seqname(args->out_hdr,out),out->pos+1);
+            }
+        }
+
+        // set the values
+        #define BRANCH(tgt_type_t, src_type_t, src_is_missing, src_is_vector_end, tgt_set_missing, tgt_set_vector_end) { \
+            int j, l, k; \
+            tgt_type_t *tgt = (tgt_type_t *) ma->tmp_arr + ismpl*nsize; \
+            if ( !fmt_ori ) \
+            { \
+                /* the field is not present in this file, set missing values */ \
+                for (j=0; j<bcf_hdr_nsamples(hdr); j++) \
+                { \
+                    tgt_set_missing; tgt++; for (l=1; l<nsize; l++) { tgt_set_vector_end; tgt++; } \
+                } \
+                ismpl += bcf_hdr_nsamples(hdr); \
+                continue; \
+            } \
+            assert( ma->has_line[i] ); \
+            bcf1_t *line    = reader->buffer[0]; \
+            src_type_t *src = (src_type_t*) fmt_ori->p; \
+            if ( (length!=BCF_VL_G && length!=BCF_VL_A && length!=BCF_VL_R) || (line->n_allele==out->n_allele && !ma->d[i][0].als_differ) ) \
+            { \
+                /* alleles unchanged, copy over */ \
+                for (j=0; j<bcf_hdr_nsamples(hdr); j++) \
+                { \
+                    for (l=0; l<fmt_ori->n; l++) \
+                    { \
+                        if ( src_is_vector_end ) break; \
+                        else if ( src_is_missing ) tgt_set_missing; \
+                        else *tgt = *src; \
+                        tgt++; src++; \
+                    } \
+                    for (k=l; k<nsize; k++) { tgt_set_vector_end; tgt++; } \
+                    src += fmt_ori->n - l; \
+                } \
+                ismpl += bcf_hdr_nsamples(hdr); \
+                continue; \
+            } \
+            /* allele numbering needs to be changed */ \
+            if ( length==BCF_VL_G ) \
+            { \
+                /* Number=G tags */ \
+                for (j=0; j<bcf_hdr_nsamples(hdr); j++) \
+                { \
+                    tgt = (tgt_type_t *) ma->tmp_arr + (ismpl+j)*nsize; \
+                    src = (src_type_t*) fmt_ori->p + j*fmt_ori->n; \
+                    if ( (src_is_missing && fmt_ori->n==1) || (++src && src_is_vector_end) ) \
+                    { \
+                        /* tag with missing value "." */ \
+                        tgt_set_missing; \
+                        for (l=1; l<nsize; l++) { tgt++; tgt_set_vector_end; } \
+                        continue; \
+                    } \
+                    int ngsize = ma->smpl_ploidy[ismpl+j]==1 ? out->n_allele : out->n_allele*(out->n_allele + 1)/2; \
+                    for (l=0; l<ngsize; l++) { tgt_set_missing; tgt++; } \
+                    for (; l<nsize; l++) { tgt_set_vector_end; tgt++; } \
+                    if ( ma->smpl_ploidy[ismpl+j]==1 ) \
+                    { \
+                        /* Haploid */ \
+                        int iori, inew; \
+                        for (iori=0; iori<line->n_allele; iori++) \
+                        { \
+                            inew = ma->d[i][0].map[iori]; \
+                            src = (src_type_t*) fmt_ori->p + j*fmt_ori->n + iori; \
+                            tgt = (tgt_type_t *) ma->tmp_arr + (ismpl+j)*nsize + inew; \
+                            if ( src_is_vector_end ) break; \
+                            if ( src_is_missing ) tgt_set_missing; \
+                            else *tgt = *src; \
+                        } \
+                    } \
+                    else \
+                    { \
+                        /* Diploid */ \
+                        int iori,jori, inew,jnew; \
+                        for (iori=0; iori<line->n_allele; iori++) \
+                        { \
+                            inew = ma->d[i][0].map[iori]; \
+                            for (jori=0; jori<=iori; jori++) \
+                            { \
+                                jnew = ma->d[i][0].map[jori]; \
+                                int kori = iori*(iori+1)/2 + jori; \
+                                int knew = inew>jnew ? inew*(inew+1)/2 + jnew : jnew*(jnew+1)/2 + inew; \
+                                src = (src_type_t*) fmt_ori->p + j*fmt_ori->n + kori; \
+                                tgt = (tgt_type_t *) ma->tmp_arr + (ismpl+j)*nsize + knew; \
+                                if ( src_is_vector_end ) \
+                                { \
+                                    iori = line->n_allele; \
+                                    break; \
+                                } \
+                                if ( src_is_missing ) tgt_set_missing; \
+                                else *tgt = *src; \
+                            } \
+                        } \
+                    } \
+                } \
+            } \
+            else \
+            { \
+                /* Number=A or Number=R tags */ \
+                int ifrom = length==BCF_VL_A ? 1 : 0; \
+                for (j=0; j<bcf_hdr_nsamples(hdr); j++) \
+                { \
+                    tgt = (tgt_type_t *) ma->tmp_arr + (ismpl+j)*nsize; \
+                    src = (src_type_t*) (fmt_ori->p + j*fmt_ori->size); \
+                    if ( (src_is_missing && fmt_ori->n==1) || (++src && src_is_vector_end) ) \
+                    { \
+                        /* tag with missing value "." */ \
+                        tgt_set_missing; \
+                        for (l=1; l<nsize; l++) { tgt++; tgt_set_vector_end; } \
+                        continue; \
+                    } \
+                    src = (src_type_t*) (fmt_ori->p + j*fmt_ori->size); \
+                    for (l=0; l<nsize; l++) { tgt_set_missing; tgt++; } \
+                    int iori,inew; \
+                    for (iori=ifrom; iori<line->n_allele; iori++) \
+                    { \
+                        inew = ma->d[i][0].map[iori] - ifrom; \
+                        tgt = (tgt_type_t *) ma->tmp_arr + (ismpl+j)*nsize + inew; \
+                        if ( src_is_vector_end ) break; \
+                        if ( src_is_missing ) tgt_set_missing; \
+                        else *tgt = *src; \
+                        src++; \
+                    } \
+                } \
+            } \
+            ismpl += bcf_hdr_nsamples(hdr); \
+        }
+        switch (type)
+        {
+            case BCF_BT_INT8:  BRANCH(int32_t,  int8_t, *src==bcf_int8_missing,  *src==bcf_int8_vector_end,  *tgt=bcf_int32_missing, *tgt=bcf_int32_vector_end); break;
+            case BCF_BT_INT16: BRANCH(int32_t, int16_t, *src==bcf_int16_missing, *src==bcf_int16_vector_end, *tgt=bcf_int32_missing, *tgt=bcf_int32_vector_end); break;
+            case BCF_BT_INT32: BRANCH(int32_t, int32_t, *src==bcf_int32_missing, *src==bcf_int32_vector_end, *tgt=bcf_int32_missing, *tgt=bcf_int32_vector_end); break;
+            case BCF_BT_FLOAT: BRANCH(float, float, bcf_float_is_missing(*src), bcf_float_is_vector_end(*src), bcf_float_set_missing(*tgt), bcf_float_set_vector_end(*tgt)); break;
+            case BCF_BT_CHAR:  BRANCH(uint8_t, uint8_t, *src==bcf_str_missing, *src==bcf_str_vector_end, *tgt=bcf_str_missing, *tgt=bcf_str_vector_end); break;
+            default: error("Unexpected case: %d, %s\n", type, key);
+        }
+        #undef BRANCH
+    }
+    if ( type==BCF_BT_FLOAT )
+        bcf_update_format_float(out_hdr, out, key, (float*)ma->tmp_arr, nsamples*nsize);
+    else if ( type==BCF_BT_CHAR )
+        bcf_update_format_char(out_hdr, out, key, (float*)ma->tmp_arr, nsamples*nsize);
+    else
+        bcf_update_format_int32(out_hdr, out, key, (int32_t*)ma->tmp_arr, nsamples*nsize);
+}
+
+void merge_format(args_t *args, bcf1_t *out)
+{
+    bcf_srs_t *files = args->files;
+    bcf_hdr_t *out_hdr = args->out_hdr;
+    maux_t *ma = args->maux;
+    if ( !ma->nfmt_map )
+    {
+        ma->nfmt_map = 2;
+        ma->fmt_map  = (bcf_fmt_t**) calloc(ma->nfmt_map*files->nreaders, sizeof(bcf_fmt_t*));
+    }
+    else
+        memset(ma->fmt_map, 0, ma->nfmt_map*files->nreaders*sizeof(bcf_fmt_t**));
+
+    khiter_t kitr;
+    strdict_t *tmph = args->tmph;
+    kh_clear(strdict, tmph);
+    int i, j, ret, has_GT = 0, max_ifmt = 0; // max fmt index
+    for (i=0; i<files->nreaders; i++)
+    {
+        if ( !ma->has_line[i] ) continue;
+        bcf_sr_t *reader = &files->readers[i];
+        bcf1_t *line = reader->buffer[0];
+        bcf_hdr_t *hdr = reader->header;
+        for (j=0; j<line->n_fmt; j++)
+        {
+            // Wat this tag already seen?
+            bcf_fmt_t *fmt = &line->d.fmt[j];
+            const char *key = hdr->id[BCF_DT_ID][fmt->id].key;
+            kitr = kh_get(strdict, tmph, key);
+
+            int ifmt;
+            if ( kitr != kh_end(tmph) )
+                ifmt = kh_value(tmph, kitr);    // seen
+            else
+            {
+                // new FORMAT tag
+                if ( key[0]=='G' && key[1]=='T' && key[2]==0 ) { has_GT = 1; ifmt = 0; }
+                else
+                {
+                    ifmt = ++max_ifmt;
+                    if ( max_ifmt >= ma->nfmt_map )
+                    {
+                        ma->fmt_map = (bcf_fmt_t**) realloc(ma->fmt_map, sizeof(bcf_fmt_t*)*(max_ifmt+1)*files->nreaders);
+                        memset(ma->fmt_map+ma->nfmt_map*files->nreaders, 0, (max_ifmt-ma->nfmt_map+1)*files->nreaders*sizeof(bcf_fmt_t*));
+                        ma->nfmt_map = max_ifmt+1;
+                    }
+                }
+                kitr = kh_put(strdict, tmph, key, &ret);
+                kh_value(tmph, kitr) = ifmt;
+            }
+            ma->fmt_map[ifmt*files->nreaders+i] = fmt;
+        }
+        // Check if the allele numbering must be changed
+        for (j=1; j<reader->buffer[0]->n_allele; j++)
+            if ( ma->d[i][0].map[j]!=j ) break;
+        ma->d[i][0].als_differ = j==reader->buffer[0]->n_allele ? 0 : 1;
+    }
+
+    out->n_sample = bcf_hdr_nsamples(out_hdr);
+    if ( has_GT )
+        merge_GT(args, ma->fmt_map, out);
+    update_AN_AC(out_hdr, out);
+
+    if ( out->d.info!=ma->inf )
+    {
+        // hacky, we rely on htslib internals: bcf_update_info() reallocated the info
+        ma->inf  = out->d.info;
+        ma->minf = out->d.m_info;
+    }
+
+    for (i=1; i<=max_ifmt; i++)
+        merge_format_field(args, &ma->fmt_map[i*files->nreaders], out);
+    out->d.indiv_dirty = 1;
+}
+
+// The core merging function, one or none line from each reader
+void merge_line(args_t *args)
+{
+    bcf1_t *out = args->out_line;
+    bcf_clear1(out);
+    out->unpacked = BCF_UN_ALL;
+
+    merge_chrom2qual(args, out);
+    merge_filter(args, out);
+    merge_info(args, out);
+    merge_format(args, out);
+
+    bcf_write1(args->out_fh, args->out_hdr, out);
+}
+
+
+void debug_buffers(FILE *fp, bcf_srs_t *files);
+void debug_buffer(FILE *fp, bcf_sr_t *reader);
+
+#define SWAP(type_t,a,b) { type_t tmp = (a); (a) = (b); (b) = tmp; }
+
+// Clean the reader's buffer to and make it ready for the next next_line() call.
+// Moves finished records (SKIP_DONE flag set) at the end of the buffer and put
+// the rest to the beggining. Then shorten the buffer so that the last element
+// points to the last unfinished record. There are two special cases: the last
+// line of the buffer typically has a different position and must stay at the
+// end; next, the first record of the buffer must be one of those already
+// printed, as it will be discarded by next_line().
+//
+void shake_buffer(maux_t *maux, int ir, int pos)
+{
+    bcf_sr_t *reader = &maux->files->readers[ir];
+    maux1_t *m = maux->d[ir];
+
+    if ( !reader->buffer ) return;
+
+    int i;
+    // FILE *fp = stdout;
+    // fprintf(fp,"<going to shake> nbuf=%d\t", reader->nbuffer); for (i=0; i<reader->nbuffer; i++) fprintf(fp," %d", skip[i]); fprintf(fp,"\n");
+    // debug_buffer(fp,reader);
+    // fprintf(fp,"--\n");
+
+    int a = 1, b = reader->nbuffer;
+    if ( reader->buffer[b]->pos != pos ) b--;   // move the last line separately afterwards
+
+    while ( a<b )
+    {
+        if ( !(m[a].skip&SKIP_DONE) ) { a++; continue; }
+        if ( m[b].skip&SKIP_DONE ) { b--; continue; }
+        SWAP(bcf1_t*, reader->buffer[a], reader->buffer[b]);
+        SWAP(maux1_t, m[a], m[b]);
+        a++;
+        b--;
+    }
+
+    // position $a to the after the first unfinished record
+    while ( a<=reader->nbuffer && !(m[a].skip&SKIP_DONE) ) a++;
+
+    if ( a<reader->nbuffer )
+    {
+        // there is a gap between the unfinished lines at the beggining and the
+        // last line. The last line must be brought forward to fill the gap
+        if ( reader->buffer[reader->nbuffer]->pos != pos )
+        {
+            SWAP(bcf1_t*, reader->buffer[a], reader->buffer[reader->nbuffer]);
+            SWAP(maux1_t, m[a], m[reader->nbuffer]);
+            reader->nbuffer = a;
+        }
+    }
+
+    if ( !(m[0].skip&SKIP_DONE) && reader->buffer[0]->pos==pos )
+    {
+        // the first record is unfinished, replace it with an empty line
+        // from the end of the buffer or else next_line will remove it
+        if ( reader->nbuffer + 1 >= maux->nbuf[ir] )
+        {
+            reader->nbuffer++;
+            maux_expand1(maux, ir);
+            reader->nbuffer--;
+            m = maux->d[ir];
+        }
+        if ( reader->nbuffer+1 >= reader->mbuffer )
+            error("Uh, did not expect this: %d vs %d\n", reader->nbuffer,reader->mbuffer);
+
+        if ( reader->buffer[reader->nbuffer]->pos!=pos )
+        {
+            // 4way swap
+            bcf1_t *tmp = reader->buffer[0];
+            reader->buffer[0] = reader->buffer[reader->nbuffer+1];
+            reader->buffer[reader->nbuffer+1] = reader->buffer[reader->nbuffer];
+            reader->buffer[reader->nbuffer] = tmp;
+            m[reader->nbuffer].skip   = m[0].skip;
+            m[reader->nbuffer+1].skip = SKIP_DIFF;
+            reader->nbuffer++;
+        }
+        else
+        {
+            SWAP(bcf1_t*, reader->buffer[0], reader->buffer[reader->nbuffer+1]);
+            SWAP(maux1_t, m[0], m[reader->nbuffer+1]);
+        }
+    }
+
+    // debug_buffer(fp,reader);
+    // fprintf(fp,"<shaken>\t"); for (i=0; i<reader->nbuffer; i++) fprintf(fp," %d", skip[i]);
+    // fprintf(fp,"\n\n");
+
+    // set position of finished buffer[0] line to -1, otherwise swapping may
+    // bring it back after next_line()
+    reader->buffer[0]->pos = -1;
+
+    // trim the buffer, remove finished lines from the end
+    i = reader->nbuffer;
+    while ( i>=1 && m[i--].skip&SKIP_DONE )
+        reader->nbuffer--;
+}
+
+void debug_maux(args_t *args, int pos, int var_type)
+{
+    bcf_srs_t *files = args->files;
+    maux_t *maux = args->maux;
+    int j,k,l;
+
+    fprintf(stderr,"Alleles to merge at %d\n", pos+1);
+    for (j=0; j<files->nreaders; j++)
+    {
+        bcf_sr_t *reader = &files->readers[j];
+        fprintf(stderr," reader %d: ", j);
+        for (k=0; k<=reader->nbuffer; k++)
+        {
+            if ( maux->d[j][k].skip==SKIP_DONE ) continue;
+            bcf1_t *line = reader->buffer[k];
+            if ( line->pos!=pos ) continue;
+            fprintf(stderr,"\t");
+            if ( maux->d[j][k].skip ) fprintf(stderr,"[");  // this record will not be merged in this round
+            for (l=0; l<line->n_allele; l++)
+                fprintf(stderr,"%s%s", l==0?"":",", line->d.allele[l]);
+            if ( maux->d[j][k].skip ) fprintf(stderr,"]");
+        }
+        fprintf(stderr,"\n");
+    }
+    fprintf(stderr," counts: ");
+    for (j=0; j<maux->nals; j++) fprintf(stderr,"%s   %dx %s", j==0?"":",",maux->cnt[j], maux->als[j]); fprintf(stderr,"\n");
+    for (j=0; j<files->nreaders; j++)
+    {
+        bcf_sr_t *reader = &files->readers[j];
+        fprintf(stderr," out %d: ", j);
+        for (k=0; k<=reader->nbuffer; k++)
+        {
+            if ( maux->d[j][k].skip==SKIP_DONE ) continue;
+            bcf1_t *line = reader->buffer[k];
+            if ( line->pos!=pos ) continue;
+            if ( maux->d[j][k].skip ) continue;
+            fprintf(stderr,"\t");
+            for (l=0; l<line->n_allele; l++)
+                fprintf(stderr,"%s%s", l==0?"":",", maux->als[maux->d[j][k].map[l]]);
+        }
+        fprintf(stderr,"\n");
+    }
+    fprintf(stderr,"\n");
+}
+
+// Determine which line should be merged from which reader: go through all
+// readers and all buffered lines, expand REF,ALT and try to match lines with
+// the same ALTs. A step towards output independent on input ordering of the
+// lines.
+void merge_buffer(args_t *args)
+{
+    bcf_srs_t *files = args->files;
+    int i, pos = -1, var_type = 0;
+    char *id = NULL;
+    maux_t *maux = args->maux;
+    maux_reset(maux);
+
+    // set the current position
+    for (i=0; i<files->nreaders; i++)
+    {
+        if ( bcf_sr_has_line(files,i) )
+        {
+            bcf1_t *line = bcf_sr_get_line(files,i);
+            pos = line->pos;
+            var_type = bcf_get_variant_types(line);
+            id = line->d.id;
+            break;
+        }
+    }
+
+    // In this loop we select from each reader compatible candidate lines.
+    // (i.e. SNPs or indels). Go through all files and all lines at this
+    // position and normalize relevant alleles.
+    // REF-only sites may be associated with both SNPs and indels.
+    for (i=0; i<files->nreaders; i++)
+    {
+        bcf_sr_t *reader = &files->readers[i];
+        if ( !reader->buffer ) continue;
+        int j, k;
+        for (j=0; j<=reader->nbuffer; j++)
+        {
+            bcf1_t *line = reader->buffer[j];
+            int line_type = bcf_get_variant_types(line);
+            // select relevant lines
+            maux->d[i][j].skip = SKIP_DIFF;
+            if ( pos!=line->pos )
+            {
+                if ( j==0 ) maux->d[i][j].skip |= SKIP_DONE; // left from previous run, force to ignore
+                continue;
+            }
+            if ( args->merge_by_id )
+            {
+                if ( strcmp(id,line->d.id) ) continue;
+            }
+            else
+            {
+                if ( args->collapse==COLLAPSE_NONE && maux->nals )
+                {
+                    // All alleles of the tested record must be present in the
+                    // selected maux record plus variant types must be the same
+                    if ( var_type!=line->d.var_type ) continue;
+                    if ( vcmp_set_ref(args->vcmp,maux->als[0],line->d.allele[0]) < 0 ) continue;   // refs not compatible
+                    for (k=1; k<line->n_allele; k++)
+                    {
+                        if ( vcmp_find_allele(args->vcmp,maux->als+1,maux->nals-1,line->d.allele[k])>=0 ) break;
+                    }
+                    if ( k==line->n_allele ) continue;  // no matching allele
+                }
+                if ( !(args->collapse&COLLAPSE_ANY) )
+                {
+                    int compatible = 0;
+                    if ( line_type==var_type ) compatible = 1;
+                    else if ( line_type==VCF_REF ) compatible = 1;   // REF can go with anything
+                    else if ( var_type&VCF_SNP && line_type&VCF_SNP ) compatible = 1;
+                    else if ( var_type&VCF_INDEL && line_type&VCF_INDEL ) compatible = 1;
+                    else if ( var_type&VCF_MNP && line_type&VCF_MNP ) compatible = 1;
+                    else if ( var_type&VCF_SNP && line_type&VCF_MNP ) compatible = 1;
+                    else if ( var_type&VCF_MNP && line_type&VCF_SNP ) compatible = 1;
+                    if ( !compatible ) continue;
+                }
+            }
+            maux->d[i][j].skip = 0;
+
+            hts_expand(int, line->n_allele, maux->d[i][j].mmap, maux->d[i][j].map);
+            if ( !maux->nals )    // first record, copy the alleles to the output
+            {
+                maux->nals = line->n_allele;
+                hts_expand0(char*, maux->nals, maux->mals, maux->als);
+                hts_expand0(int, maux->nals, maux->ncnt, maux->cnt);
+                for (k=0; k<maux->nals; k++)
+                {
+                    maux->als[k] = strdup(line->d.allele[k]);
+                    maux->d[i][j].map[k] = k;
+                    maux->cnt[k] = 1;
+                }
+                pos = line->pos;
+                continue;
+            }
+
+            // normalize alleles
+            maux->als = merge_alleles(line->d.allele, line->n_allele, maux->d[i][j].map, maux->als, &maux->nals, &maux->mals);
+            if ( !maux->als ) error("Failed to merge alleles at %s:%d in %s\n",bcf_seqname(args->out_hdr,line),line->pos+1,reader->fname);
+            hts_expand0(int, maux->nals, maux->ncnt, maux->cnt);
+            for (k=1; k<line->n_allele; k++)
+                maux->cnt[ maux->d[i][j].map[k] ]++;    // how many times an allele appears in the files
+            maux->cnt[0]++;
+        }
+    }
+
+    // debug_maux(args, pos, var_type);
+
+    // Select records that have the same alleles; the input ordering of indels
+    // must not matter. Multiple VCF lines can be emitted from this loop.
+    // We expect only very few alleles and not many records with the same
+    // position in the buffers, therefore the nested loops should not slow us
+    // much.
+    while (1)
+    {
+        // take the most frequent allele present in multiple files
+        int icnt = 0;
+        for (i=1; i<maux->nals; i++)
+            if ( maux->cnt[i] > maux->cnt[icnt] ) icnt = i;
+        if ( maux->cnt[icnt]<0 ) break;
+
+        int nmask = 0;
+        for (i=0; i<files->nreaders; i++)
+        {
+            maux->has_line[i] = 0;
+
+            bcf_sr_t *reader = &files->readers[i];
+            if ( !reader->buffer ) continue;
+
+            // find lines with the same allele
+            int j;
+            for (j=0; j<=reader->nbuffer; j++)
+            {
+                if ( maux->d[i][j].skip ) continue;
+                int k;
+                for (k=0; k<reader->buffer[j]->n_allele; k++)
+                    if ( icnt==maux->d[i][j].map[k] ) break;
+                if ( k<reader->buffer[j]->n_allele ) break;
+            }
+            if ( j>reader->nbuffer )
+            {
+                // no matching allele found in this file
+                if ( args->collapse==COLLAPSE_NONE ) continue;
+
+                for (j=0; j<=reader->nbuffer; j++)
+                {
+                    if ( maux->d[i][j].skip ) continue;
+                    if ( args->collapse&COLLAPSE_ANY ) break;
+                    int line_type = bcf_get_variant_types(reader->buffer[j]);
+                    if ( var_type&VCF_SNP && line_type&VCF_SNP && (args->collapse&COLLAPSE_SNPS) ) break;
+                    if ( var_type&VCF_INDEL && line_type&VCF_INDEL && (args->collapse&COLLAPSE_INDELS) ) break;
+                    if ( line_type==VCF_REF )
+                    {
+                        if ( var_type&VCF_SNP && (args->collapse&COLLAPSE_SNPS) ) break;
+                        if ( var_type&VCF_INDEL && (args->collapse&COLLAPSE_INDELS) ) break;
+                    }
+                    else if ( var_type==VCF_REF )
+                    {
+                        if ( line_type&VCF_SNP && (args->collapse&COLLAPSE_SNPS) ) break;
+                        if ( line_type&VCF_INDEL && (args->collapse&COLLAPSE_INDELS) ) break;
+                    }
+                }
+            }
+            if ( j<=reader->nbuffer )
+            {
+                // found a suitable line for merging, place it at the beggining
+                if ( j>0 )
+                {
+                    SWAP(bcf1_t*, reader->buffer[0], reader->buffer[j]);
+                    SWAP(maux1_t, maux->d[i][0], maux->d[i][j]);
+                }
+                // mark as finished so that it's ignored next time
+                maux->d[i][0].skip |= SKIP_DONE;
+                maux->has_line[i] = 1;
+                nmask++;
+            }
+        }
+        if ( !nmask ) break;    // done, no more lines suitable for merging found
+        merge_line(args);       // merge and output the line
+        maux->cnt[icnt] = -1;   // do not pick this allele again, mark it as finished
+    }
+
+    // clean the alleles
+    for (i=0; i<maux->nals; i++)
+    {
+        free(maux->als[i]);
+        maux->als[i] = 0;
+    }
+    maux->nals = 0;
+
+    // get the buffers ready for the next next_line() call
+    for (i=0; i<files->nreaders; i++)
+        shake_buffer(maux, i, pos);
+}
+
+void bcf_hdr_append_version(bcf_hdr_t *hdr, int argc, char **argv, const char *cmd)
+{
+    kstring_t str = {0,0,0};
+    ksprintf(&str,"##%sVersion=%s+htslib-%s\n", cmd, bcftools_version(), hts_version());
+    bcf_hdr_append(hdr,str.s);
+
+    str.l = 0;
+    ksprintf(&str,"##%sCommand=%s", cmd, argv[0]);
+    int i;
+    for (i=1; i<argc; i++)
+    {
+        if ( strchr(argv[i],' ') )
+            ksprintf(&str, " '%s'", argv[i]);
+        else
+            ksprintf(&str, " %s", argv[i]);
+    }
+    kputc('\n', &str);
+    bcf_hdr_append(hdr,str.s);
+    free(str.s);
+
+    bcf_hdr_sync(hdr);
+}
+
+void merge_vcf(args_t *args)
+{
+    args->out_fh  = hts_open(args->output_fname, hts_bcf_wmode(args->output_type));
+    if ( args->out_fh == NULL ) error("Can't write to \"%s\": %s\n", args->output_fname, strerror(errno));
+    args->out_hdr = bcf_hdr_init("w");
+
+    if ( args->header_fname )
+    {
+        if ( bcf_hdr_set(args->out_hdr,args->header_fname) ) error("Could not read/parse the header: %s\n", args->header_fname);
+    }
+    else
+    {
+        int i;
+        for (i=0; i<args->files->nreaders; i++)
+        {
+            char buf[10]; snprintf(buf,10,"%d",i+1);
+            bcf_hdr_merge(args->out_hdr, args->files->readers[i].header,buf,args->force_samples);
+        }
+        bcf_hdr_append_version(args->out_hdr, args->argc, args->argv, "bcftools_merge");
+        bcf_hdr_sync(args->out_hdr);
+    }
+    info_rules_init(args);
+
+    bcf_hdr_set_version(args->out_hdr, bcf_hdr_get_version(args->files->readers[0].header));
+    bcf_hdr_write(args->out_fh, args->out_hdr);
+    if ( args->header_only )
+    {
+        bcf_hdr_destroy(args->out_hdr);
+        hts_close(args->out_fh);
+        return;
+    }
+
+    if ( args->collapse==COLLAPSE_NONE ) args->vcmp = vcmp_init();
+    args->maux = maux_init(args->files);
+    args->out_line = bcf_init1();
+    args->tmph = kh_init(strdict);
+    int ret;
+    while ( (ret=bcf_sr_next_line(args->files)) )
+    {
+        merge_buffer(args);
+    }
+    info_rules_destroy(args);
+    maux_destroy(args->maux);
+    bcf_hdr_destroy(args->out_hdr);
+    hts_close(args->out_fh);
+    bcf_destroy1(args->out_line);
+    kh_destroy(strdict, args->tmph);
+    if ( args->tmps.m ) free(args->tmps.s);
+    if ( args->vcmp ) vcmp_destroy(args->vcmp);
+}
+
+static void usage(void)
+{
+    fprintf(stderr, "\n");
+    fprintf(stderr, "About:   Merge multiple VCF/BCF files from non-overlapping sample sets to create one multi-sample file.\n");
+    fprintf(stderr, "         Note that only records from different files can be merged, never from the same file. For\n");
+    fprintf(stderr, "         \"vertical\" merge take a look at \"bcftools norm\" instead.\n");
+    fprintf(stderr, "Usage:   bcftools merge [options] <A.vcf.gz> <B.vcf.gz> [...]\n");
+    fprintf(stderr, "\n");
+    fprintf(stderr, "Options:\n");
+    fprintf(stderr, "        --force-samples                resolve duplicate sample names\n");
+    fprintf(stderr, "        --print-header                 print only the merged header and exit\n");
+    fprintf(stderr, "        --use-header <file>            use the provided header\n");
+    fprintf(stderr, "    -f, --apply-filters <list>         require at least one of the listed FILTER strings (e.g. \"PASS,.\")\n");
+    fprintf(stderr, "    -i, --info-rules <tag:method,..>   rules for merging INFO fields (method is one of sum,avg,min,max,join) or \"-\" to turn off the default [DP:sum,DP4:sum]\n");
+    fprintf(stderr, "    -l, --file-list <file>             read file names from the file\n");
+    fprintf(stderr, "    -m, --merge <string>               allow multiallelic records for <snps|indels|both|all|none|id>, see man page for details [both]\n");
+    fprintf(stderr, "    -o, --output <file>                write output to a file [standard output]\n");
+    fprintf(stderr, "    -O, --output-type <b|u|z|v>        'b' compressed BCF; 'u' uncompressed BCF; 'z' compressed VCF; 'v' uncompressed VCF [v]\n");
+    fprintf(stderr, "    -r, --regions <region>             restrict to comma-separated list of regions\n");
+    fprintf(stderr, "    -R, --regions-file <file>          restrict to regions listed in a file\n");
+    fprintf(stderr, "\n");
+    exit(1);
+}
+
+int main_vcfmerge(int argc, char *argv[])
+{
+    int c;
+    args_t *args = (args_t*) calloc(1,sizeof(args_t));
+    args->files  = bcf_sr_init();
+    args->argc   = argc; args->argv = argv;
+    args->output_fname = "-";
+    args->output_type = FT_VCF;
+    args->collapse = COLLAPSE_BOTH;
+    int regions_is_file = 0;
+
+    static struct option loptions[] =
+    {
+        {"help",0,0,'h'},
+        {"merge",1,0,'m'},
+        {"file-list",1,0,'l'},
+        {"apply-filters",1,0,'f'},
+        {"use-header",1,0,1},
+        {"print-header",0,0,2},
+        {"force-samples",0,0,3},
+        {"output",1,0,'o'},
+        {"output-type",1,0,'O'},
+        {"regions",1,0,'r'},
+        {"regions-file",1,0,'R'},
+        {"info-rules",1,0,'i'},
+        {0,0,0,0}
+    };
+    while ((c = getopt_long(argc, argv, "hm:f:r:R:o:O:i:l:",loptions,NULL)) >= 0) {
+        switch (c) {
+            case 'l': args->file_list = optarg; break;
+            case 'i': args->info_rules = optarg; break;
+            case 'o': args->output_fname = optarg; break;
+            case 'O':
+                switch (optarg[0]) {
+                    case 'b': args->output_type = FT_BCF_GZ; break;
+                    case 'u': args->output_type = FT_BCF; break;
+                    case 'z': args->output_type = FT_VCF_GZ; break;
+                    case 'v': args->output_type = FT_VCF; break;
+                    default: error("The output type \"%s\" not recognised\n", optarg);
+                }
+                break;
+            case 'm':
+                args->collapse = COLLAPSE_NONE;
+                if ( !strcmp(optarg,"snps") ) args->collapse |= COLLAPSE_SNPS;
+                else if ( !strcmp(optarg,"indels") ) args->collapse |= COLLAPSE_INDELS;
+                else if ( !strcmp(optarg,"both") ) args->collapse |= COLLAPSE_BOTH;
+                else if ( !strcmp(optarg,"any") ) args->collapse |= COLLAPSE_ANY;
+                else if ( !strcmp(optarg,"all") ) args->collapse |= COLLAPSE_ANY;
+                else if ( !strcmp(optarg,"none") ) args->collapse = COLLAPSE_NONE;
+                else if ( !strcmp(optarg,"id") ) { args->collapse = COLLAPSE_NONE; args->merge_by_id = 1; }
+                else error("The -m type \"%s\" is not recognised.\n", optarg);
+                break;
+            case 'f': args->files->apply_filters = optarg; break;
+            case 'r': args->regions_list = optarg; break;
+            case 'R': args->regions_list = optarg; regions_is_file = 1; break;
+            case  1 : args->header_fname = optarg; break;
+            case  2 : args->header_only = 1; break;
+            case  3 : args->force_samples = 1; break;
+            case 'h':
+            case '?': usage();
+            default: error("Unknown argument: %s\n", optarg);
+        }
+    }
+    if ( argc==optind && !args->file_list ) usage();
+    if ( argc-optind<2 && !args->file_list ) usage();
+
+    args->files->require_index = 1;
+    if ( args->regions_list && bcf_sr_set_regions(args->files, args->regions_list, regions_is_file)<0 )
+        error("Failed to read the regions: %s\n", args->regions_list);
+
+    while (optind<argc)
+    {
+        if ( !bcf_sr_add_reader(args->files, argv[optind]) ) error("Failed to open %s: %s\n", argv[optind],bcf_sr_strerror(args->files->errnum));
+        optind++;
+    }
+    if ( args->file_list )
+    {
+        int nfiles, i;
+        char **files = hts_readlines(args->file_list, &nfiles);
+        if ( !files ) error("Failed to read from %s\n", args->file_list);
+        for (i=0;i<nfiles; i++)
+            if ( !bcf_sr_add_reader(args->files, files[i]) ) error("Failed to open %s: %s\n", files[i],bcf_sr_strerror(args->files->errnum));
+        for (i=0; i<nfiles; i++) free(files[i]);
+        free(files);
+    }
+    merge_vcf(args);
+    bcf_sr_destroy(args->files);
+    free(args);
+    return 0;
+}
+
diff --git a/vcfnorm.c b/vcfnorm.c
new file mode 100644
index 0000000..37b668b
--- /dev/null
+++ b/vcfnorm.c
@@ -0,0 +1,1965 @@
+/*  vcfnorm.c -- Left-align and normalize indels.
+
+    Copyright (C) 2013-2014 Genome Research Ltd.
+
+    Author: Petr Danecek <pd3 at sanger.ac.uk>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.  */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <getopt.h>
+#include <ctype.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <htslib/vcf.h>
+#include <htslib/synced_bcf_reader.h>
+#include <htslib/faidx.h>
+#include "bcftools.h"
+#include "rbuf.h"
+
+#define CHECK_REF_EXIT 0
+#define CHECK_REF_WARN 1
+#define CHECK_REF_SKIP 2
+
+#define MROWS_SPLIT 1
+#define MROWS_MERGE  2
+
+typedef struct
+{
+    int32_t dir:4, val:28;
+}
+cell_t;
+typedef struct
+{
+    int nmat, nref, nseq;
+    int ipos, lref, lseq;
+    cell_t *mat;
+    char *ref, *seq;
+    int m_arr, *ipos_arr, *lref_arr, *lseq_arr;
+}
+aln_aux_t;
+
+// for -m+, mapping from allele indexes of a single input record
+// to allele indexes of output record
+typedef struct
+{
+    int nals, mals, *map;
+}
+map_t;
+
+typedef struct
+{
+    aln_aux_t aln;
+    char *tseq, *seq;
+    int mseq;
+    bcf1_t **lines, **tmp_lines, **alines, **blines, *mrow_out;
+    int ntmp_lines, mtmp_lines, nalines, malines, nblines, mblines;
+    map_t *maps;     // mrow map for each buffered record
+    char **als;
+    int mmaps, nals, mals;
+    uint8_t *tmp_arr1, *tmp_arr2;
+    int ntmp_arr1, ntmp_arr2;
+    kstring_t *tmp_str;
+    kstring_t *tmp_als, tmp_als_str;
+    int ntmp_als;
+    rbuf_t rbuf;
+    int buf_win;            // maximum distance between two records to consider
+    int aln_win;            // the realignment window size (maximum repeat size)
+    bcf_srs_t *files;       // using the synced reader only for -r option
+    bcf_hdr_t *hdr;
+    faidx_t *fai;
+    char **argv, *output_fname, *ref_fname, *vcf_fname, *region, *targets;
+    int argc, rmdup, output_type, check_ref, strict_filter;
+    int nchanged, nskipped, ntotal, mrows_op, mrows_collapse, parsimonious;
+}
+args_t;
+
+#if OLD_WAY
+void _vcfnorm_debug_print(aln_aux_t *aux)
+{
+    cell_t *mat = aux->mat;
+    char *ref = aux->ref;
+    char *seq = aux->seq;
+    int nref  = aux->nref;
+    int nseq  = aux->nseq;
+    int k     = (nref+1)*(nseq+1)-1;
+    int kd    = nref+2;
+    int i = k/(nref+1);
+    int j = k - i*(nref+1);
+    assert(i>0 && j>0);
+    int l = k, ialn = 0, nout_ref = 0, nout_seq = 0, ipos = 0;
+    char *aln_ref = (char*) malloc(sizeof(char)*(k+1));
+    char *aln_seq = (char*) malloc(sizeof(char)*(k+1));
+    while ( l>0 )
+    {
+        if ( j<=0 || mat[l].dir==1 )    // i
+        {
+            aln_ref[ialn] = '-';
+            aln_seq[ialn] = seq[nseq-i];
+            ipos = 0;
+            nout_seq++;
+            l -= kd - 1;
+            i--;
+        }
+        else if ( i<=0 || mat[l].dir==-1 )  // d
+        {
+            aln_ref[ialn] = ref[nref-j];
+            aln_seq[ialn] = '-';
+            ipos = 0;
+            nout_ref++;
+            l--;
+            j--;
+        }
+        else     // match or mismatch
+        {
+            aln_ref[ialn] = ref[nref-j];
+            aln_seq[ialn] = seq[nseq-i];
+            ipos = ref[nref-j+1]==seq[nseq-i+1] ? ipos+1 : 1;
+            nout_seq++;
+            nout_ref++;
+            l -= kd;
+            i--;
+            j--;
+        }
+        ialn++;
+    }
+    aln_ref[ialn] = aln_seq[ialn] = 0;
+    fprintf(stderr, "ref: %s\n", ref);
+    fprintf(stderr, "seq: %s\n", seq);
+    fprintf(stderr, "-> %s\n", aln_ref);
+    fprintf(stderr, "-> %s\n", aln_seq);
+    free(aln_ref);
+    free(aln_seq);
+
+    fprintf(stderr, "      ");
+    for (j=0; j<nref; j++) fprintf(stderr, "   %c ", ref[nref-j-1]); fprintf(stderr, "\n");
+    for (i=0; i<=nseq; i++)
+    {
+        fprintf(stderr, "%c", i==0 ? ' ' : seq[nseq-i]);
+        for (j=0; j<=nref; j++)
+        {
+            char dir = ' ';
+            if ( mat[i*(nref+1)+j].dir==1 ) dir = 'i';
+            else if ( mat[i*(nref+1)+j].dir==-1 ) dir = 'd';
+            fprintf(stderr, " %3d%c", (int)mat[i*(nref+1)+j].val, dir);
+        }
+        fprintf(stderr,"\n");
+    }
+}
+
+static int align(args_t *args, aln_aux_t *aux)
+{
+    // Needleman-Wunsch global alignment. Note that the sequences are aligned from
+    //  the end where matches are preferred, gaps are pushed to the front (left-aligned)
+    char *ref = aux->ref;
+    char *seq = aux->seq;
+    int nref  = aux->nref;
+    int nseq  = aux->nseq;
+    if ( (nref+1)*(nseq+1) > aux->nmat )
+    {
+        aux->nmat = (nref+1)*(nseq+1);
+        aux->mat  = (cell_t *) realloc(aux->mat, sizeof(cell_t)*aux->nmat);
+        if ( !aux->mat )
+            error("Could not allocate %ld bytes of memory at %d\n", sizeof(cell_t)*aux->nmat, args->files->readers[0].buffer[0]->pos+1);
+    }
+    const int GAP_OPEN = -1, GAP_CLOSE = -1, GAP_EXT = 0, MATCH = 1, MISM = -1, DI = 1, DD = -1, DM = 0;
+    cell_t *mat = aux->mat;
+    int i, j, k = nref+2, kd = nref+2;
+    mat[0].val = 20; mat[0].dir = DM;   // the last ref and alt bases match
+    for (j=1; j<=nref; j++) { mat[j].val = 0; mat[j].dir = DM; }
+    for (i=1; i<=nseq; i++)
+    {
+        mat[k-1].val = 0;
+        mat[k-1].dir = DM;
+        int jmax = i-1 < nref ? i-1 : nref;
+        for (j=1; j<=jmax; j++)
+        {
+            // prefer insertions to deletions and mismatches
+            int max, dir, score;
+            if ( ref[nref-j]==seq[nseq-i] )
+            {
+                // match
+                max = mat[k-kd].val + MATCH;
+                if ( mat[k-kd].dir!=DM ) max += GAP_CLOSE;
+                dir = DM;
+
+                // insertion
+                score = mat[k-kd+1].dir == DI ? mat[k-kd+1].val + GAP_EXT: mat[k-kd+1].val + GAP_OPEN;
+                if ( max < score )  { max = score; dir = DI; }
+
+                // deletion
+                score = mat[k-1].dir == DD ? mat[k-1].val + GAP_EXT : mat[k-1].val + GAP_OPEN;
+                if ( max < score ) { max = score; dir = DD; }
+            }
+            else
+            {
+                // insertion
+                max = mat[k-kd+1].dir == DI ? mat[k-kd+1].val + GAP_EXT : mat[k-kd+1].val + GAP_OPEN;
+                dir = DI;
+
+                // deletion
+                score = mat[k-1].dir == DD ? mat[k-1].val + GAP_EXT : mat[k-1].val + GAP_OPEN;
+                if ( max < score ) { max = score; dir = DD; }
+
+                // mismatch
+                score = mat[k-kd].val + MISM;
+                if ( mat[k-kd].dir!=DM ) score += GAP_CLOSE;
+                if ( max < score ) { max = score; dir = DM; }
+            }
+            mat[k].val = max;
+            mat[k].dir = dir;
+            k++;
+        }
+        for (j=jmax+1; j<=nref; j++)
+        {
+            // prefer deletions to insertions and mismatches
+            int max, dir, score;
+            if ( ref[nref-j]==seq[nseq-i] )
+            {
+                // match
+                max = mat[k-kd].val + MATCH;
+                if ( mat[k-kd].dir!=DM ) max += GAP_CLOSE;
+                dir = DM;
+
+                // deletion
+                score = mat[k-1].dir == DD ? mat[k-1].val + GAP_EXT: mat[k-1].val + GAP_OPEN;
+                if ( max < score ) { max = score; dir = DD; }
+
+                // insertion
+                score = mat[k-kd+1].dir == DI ? mat[k-kd+1].val + GAP_EXT : mat[k-kd+1].val + GAP_OPEN;
+                if ( max < score )  { max = score; dir = DI; }
+            }
+            else
+            {
+                // deletion
+                max = mat[k-1].dir == DD ? mat[k-1].val + GAP_EXT : mat[k-1].val + GAP_OPEN;
+                dir = DD;
+
+                // insertion
+                score = mat[k-kd+1].dir == DI ? mat[k-kd+1].val + GAP_EXT : mat[k-kd+1].val + GAP_OPEN;
+                if ( max < score ) { max = score; dir = DI; }
+
+                // mismatch
+                score = mat[k-kd].val + MISM;
+                if ( mat[k-kd].dir!=DM ) score += GAP_CLOSE;
+                if ( max < score ) { max = score; dir = DM; }
+            }
+            mat[k].val = max;
+            mat[k].dir = dir;
+            k++;
+        }
+        k++;
+    }
+
+    // _vcfnorm_debug_print(aux);
+
+    // Skip as much of the matching sequence at the beggining as possible. (Note, the sequence
+    // is reversed, thus skipping from the end.)
+    k = (nref+1)*(nseq+1)-1;
+    int kmin = nref>nseq ? 2*(nref+1) - nseq : (nseq-nref)*(nref+1);    // skip the first row and column of the matrix, which are 0s
+    int ipos = 0;
+    while (k>kmin && mat[k].dir==DM && ref[ipos]==seq[ipos]) { k -= kd; ipos++; }
+
+    i = k/(nref+1);             // seq[nseq-i]
+    j = k - i*(nref+1);         // ref[nref-j]
+
+    if ( !i && !j )
+    {
+        // no gaps: this is a legitimate case, consider MNPs
+        int l = 0;
+        while ( l<nseq && l<nref && ref[l]==seq[l] ) l++;
+        if ( l==nseq || l==nref ) return -2;    // ALT is identical to REF
+        assert( l>0 );
+        while ( ipos>l && ref[ipos]==seq[ipos] ) ipos--;
+        aux->ipos = l;          // position of the last matching base (buffer coordinates)
+        aux->lref = ipos + 1;   // position of the first base in the suffix
+        aux->lseq = ipos + 1;
+        return 0;
+    }
+    assert(i>0 && j>0);
+
+    int l = k, nout_ref = ipos, nout_seq = ipos, nsuffix = 0;
+    while ( l>0 )
+    {
+        if ( j<=0 || mat[l].dir==DI )    // insertion
+        {
+            nsuffix = 0;
+            nout_seq++;
+            l -= kd - 1;
+            i--;
+        }
+        else if ( i<=0 || mat[l].dir==DD )  // deletion
+        {
+            nsuffix = 0;
+            nout_ref++;
+            l--;
+            j--;
+        }
+        else     // match/mismatch
+        {
+            nsuffix = ref[nref-j]==seq[nseq-i] ? nsuffix + 1 : 0;
+            nout_seq++;
+            nout_ref++;
+            l -= kd;
+            i--;
+            j--;
+        }
+    }
+    if ( !ipos ) return -1; // the window is too small
+
+    aux->ipos = ipos - 1;
+    aux->lref = nout_ref - nsuffix;
+    aux->lseq = nout_seq - nsuffix;
+
+    // The indels and complex events do not have to be padded
+    if ( aux->lref - aux->ipos > 1 && aux->lseq - aux->ipos > 1 && ref[aux->ipos]==seq[aux->ipos] ) aux->ipos++;
+    return 0;
+}
+
+int realign(args_t *args, bcf1_t *line)
+{
+    bcf_unpack(line, BCF_UN_STR);
+
+    char *tmp;
+    int i, ref_len = strlen(line->d.allele[0]), len = ref_len;
+    for (i=1; i<line->n_allele; i++)
+    {
+        int l = strlen(line->d.allele[i]);
+        if ( len < l ) len = l;
+    }
+    for (i=0; i<line->n_allele; i++)
+    {
+        tmp = line->d.allele[i];
+        while (*tmp) { *tmp = toupper(*tmp); tmp++; }
+    }
+
+    int ref_winlen;
+    char *ref = NULL;
+    if ( len==1 || line->n_allele==1 )
+    {
+        // SNP
+        int reflen = strlen(line->d.allele[0]);
+        ref = faidx_fetch_seq(args->fai, (char*)args->hdr->id[BCF_DT_CTG][line->rid].key, line->pos, line->pos+reflen-1, &ref_winlen);
+        if ( !ref ) error("faidx_fetch_seq failed at %s:%d\n", args->hdr->id[BCF_DT_CTG][line->rid].key, line->pos+1);
+        if ( !strncmp(ref,line->d.allele[0],reflen) )
+        {
+            free(ref);
+            return 0;
+        }
+        if ( args->check_ref==CHECK_REF_EXIT )
+            error("Reference allele mismatch at %s:%d .. '%c' vs '%c'\n", bcf_seqname(args->hdr,line),line->pos+1,ref[0],line->d.allele[0][0]);
+        if ( args->check_ref & CHECK_REF_WARN )
+            fprintf(stderr,"REF_MISMATCH\t%s\t%d\t%s\n", bcf_seqname(args->hdr,line),line->pos+1,line->d.allele[0]);
+        free(ref);
+        return -1;
+    }
+
+    // Sanity check: exclude broken VCFs with long stretches of N's
+    if ( len>1000 )
+    {
+        for (i=0; i<ref_len; i++)
+            if ( line->d.allele[0][i]=='N' ) return -1;
+    }
+
+    int win = line->pos < args->aln_win ? line->pos : args->aln_win;
+    len += win + 2;
+    if ( args->mseq < len*(line->n_allele-1) )
+    {
+        args->mseq = len*(line->n_allele-1);
+        args->seq  = (char*) realloc(args->seq, sizeof(char)*args->mseq);
+    }
+    ref = faidx_fetch_seq(args->fai, (char*)args->hdr->id[BCF_DT_CTG][line->rid].key, line->pos-win, line->pos+ref_len, &ref_winlen);
+    if ( !ref ) error("faidx_fetch_seq failed at %s:%d\n", args->hdr->id[BCF_DT_CTG][line->rid].key, line->pos-win);
+    assert( ref_winlen==ref_len+win+1 );
+
+    for (i=0; i<ref_len; i++) ref[i] = toupper(ref[i]);
+
+    // Sanity check: the reference sequence must match the REF allele
+    if ( strncmp(&ref[win],line->d.allele[0],ref_len) )
+    {
+        for (i=0; i<ref_len; i++)
+            if ( ref[win+i]!=line->d.allele[0][i] ) break;
+        if ( args->check_ref==CHECK_REF_EXIT )
+            error("\nSanity check failed, the reference sequence differs at %s:%d[%d] .. '%c' vs '%c'\n",
+                    args->hdr->id[BCF_DT_CTG][line->rid].key, line->pos+1, i+1,ref[win+i],line->d.allele[0][i]);
+        if ( args->check_ref & CHECK_REF_WARN )
+            fprintf(stderr,"REF_MISMATCH\t%s\t%d\t%s\n", bcf_seqname(args->hdr,line),line->pos+1,line->d.allele[0]);
+        free(ref);
+        return -1;
+    }
+
+    if ( args->aln.m_arr < line->n_allele )
+    {
+        args->aln.m_arr = line->n_allele;
+        args->aln.ipos_arr = (int*) realloc(args->aln.ipos_arr, sizeof(int)*args->aln.m_arr);
+        args->aln.lref_arr = (int*) realloc(args->aln.lref_arr, sizeof(int)*args->aln.m_arr);
+        args->aln.lseq_arr = (int*) realloc(args->aln.lseq_arr, sizeof(int)*args->aln.m_arr);
+    }
+    int *ipos = args->aln.ipos_arr;
+    int *iref = args->aln.lref_arr;
+    int *iseq = args->aln.lseq_arr;
+    int min_pos = INT_MAX, max_ref = 0;
+
+    static int aln_win_warned = 0;
+    int j, k;
+    for (j=1; j<line->n_allele; j++)
+    {
+        // get the ALT ready for alignment
+        args->tseq = args->seq + (j-1)*len;
+        for (i=0; i<win; i++) args->tseq[i] = ref[i];
+        char *t = line->d.allele[j];
+        while (*t) { args->tseq[i++] = *t; t++; }
+        args->tseq[i++] = ref[ref_winlen-1];
+        args->tseq[i]   = 0;
+
+        args->aln.ref  = ref;
+        args->aln.seq  = args->tseq;
+        args->aln.nref = ref_winlen;    // reflen which goes into realignment: VCF ref + #win bases which precede
+        args->aln.nseq = i;             // same as reflen but for alt
+
+        int ret = align(args, &args->aln);
+        if ( ret<0 )
+        {
+            free(ref);
+            if ( ret==-1 )
+            {
+                // todo: better error analysis, see 2:1 in test/norm.vcf
+                // fprintf(stderr,"Warning: The -w alignment window too small for %s:%d\n", bcf_seqname(args->hdr,line),line->pos+1);
+                return 0;   // leave as is
+            }
+            if ( ret==-2 ) fprintf(stderr,"Warning: REF allele is identical to ALT at %s:%d\n", bcf_seqname(args->hdr,line),line->pos+1);
+            return -1;
+        }
+
+        #if 0
+            fprintf(stderr, "%s  \t nref=%d\n", ref, ref_winlen);
+            fprintf(stderr, "%s  \t nseq=%d\n", args->tseq, i);
+            fprintf(stderr, "pos=%d win=%d  ipos=%d lref=%d lseq=%d\n", line->pos+1, win, args->aln.ipos, args->aln.lref, args->aln.lseq);
+            fprintf(stderr, "-> "); for (k=args->aln.ipos; k<args->aln.lref; k++) fprintf(stderr, "%c", ref[k]); fprintf(stderr, "\n");
+            fprintf(stderr, "-> "); for (k=args->aln.ipos; k<args->aln.lseq; k++) fprintf(stderr, "%c", args->tseq[k]); fprintf(stderr, "\n");
+            fprintf(stderr, "\n");
+        #endif
+
+        if ( !args->aln.ipos && !aln_win_warned )
+        {
+            fprintf(stderr,"Warning: bigger -w is needed [todo: improve me, %s:%d %s,%s]\n",
+                    bcf_seqname(args->hdr,line),line->pos+1, line->d.allele[0],line->d.allele[j]);
+            aln_win_warned = 1;
+        }
+        ipos[j] = args->aln.ipos;   // 0-based position before the first difference (w.r.t. the window)
+        iref[j] = args->aln.lref;   // length of the REF alignment (or the index after the last aligned position)
+        iseq[j] = args->aln.lseq;
+        if ( max_ref < iref[j] ) max_ref = iref[j];
+        if ( min_pos > ipos[j] ) min_pos = ipos[j];
+        assert( iseq[j]<=len );
+    }
+
+    // Check if the record's position must be changed
+    int nmv = win - min_pos;
+    // This assertion that we will never want align more to the right is too
+    // strong, consider cases like GATG -> GACT
+    //  assert( nmv>=0 );
+    line->pos -= nmv;
+
+    hts_expand0(kstring_t,line->n_allele,args->ntmp_als,args->tmp_als);
+    // REF
+    args->tmp_als[0].l = 0;
+    kputsn(&ref[min_pos], max_ref-min_pos, &args->tmp_als[0]);
+    // ALTs
+    int min_len = args->tmp_als[0].l;
+    for (k=1; k<line->n_allele; k++)
+    {
+        args->tmp_als[k].l = 0;
+
+        // prefix the sequence with REF bases if the other alleles were aligned more to the left
+        int nprefix = ipos[k] - min_pos;
+        if ( nprefix ) kputsn(&ref[min_pos], nprefix, &args->tmp_als[k]);
+
+        // the ALT sequence
+        int nseq = iseq[k] - ipos[k];
+        if ( nseq )
+        {
+            char *alt = args->seq + (k-1)*len + ipos[k];
+            kputsn(alt, nseq, &args->tmp_als[k]);
+        }
+
+        // suffix invoked by other deletions which must be added to match the REF
+        int nsuffix = max_ref - iref[k];
+        if ( nsuffix ) kputsn(&ref[iref[k]], nsuffix, &args->tmp_als[k]);
+
+        if ( min_len > args->tmp_als[k].l ) min_len = args->tmp_als[k].l;
+    }
+    free(ref);
+
+    // create new block of alleles
+    args->tmp_als_str.l = 0;
+    if ( args->parsimonious )
+    {
+        // check if we can trim from the left
+        for (i=0; i<args->tmp_als[0].l; i++)
+        {
+            for (k=1; k<line->n_allele; k++)
+                if ( args->tmp_als[0].s[i]!=args->tmp_als[k].s[i] ) break;
+            if ( k!=line->n_allele ) break;
+        }
+        if ( i>=min_len ) i = min_len - 1;
+        if ( i>0 )  // can be left trimmed
+        {
+            for (k=0; k<line->n_allele; k++)
+            {
+                if (k>0) kputc(',',&args->tmp_als_str);
+                kputsn(args->tmp_als[k].s+i,args->tmp_als[k].l-i,&args->tmp_als_str);
+            }
+            kputc(0,&args->tmp_als_str);
+            line->pos += i;
+        }
+        // if REF allele has not changed, ALTs must be unchanged as well
+        else if ( !strcmp(line->d.allele[0],args->tmp_als[0].s) ) return 1;
+    }
+    else if ( !strcmp(line->d.allele[0],args->tmp_als[0].s) ) return 1;
+    if ( !args->tmp_als_str.l )
+    {
+        for (k=0; k<line->n_allele; k++)
+        {
+            if (k>0) kputc(',',&args->tmp_als_str);
+            kputsn(args->tmp_als[k].s,args->tmp_als[k].l,&args->tmp_als_str);
+        }
+    }
+    args->nchanged++;
+    bcf_update_alleles_str(args->hdr,line,args->tmp_als_str.s);
+
+    return 1;
+}
+#else
+
+static int realign(args_t *args, bcf1_t *line)
+{
+    bcf_unpack(line, BCF_UN_STR);
+
+    // Sanity check REF
+    int nref, reflen = strlen(line->d.allele[0]);
+    char *ref = faidx_fetch_seq(args->fai, (char*)args->hdr->id[BCF_DT_CTG][line->rid].key, line->pos, line->pos+reflen-1, &nref);
+    if ( !ref ) error("faidx_fetch_seq failed at %s:%d\n", args->hdr->id[BCF_DT_CTG][line->rid].key, line->pos+1);
+    if ( strcasecmp(ref,line->d.allele[0]) )
+    {
+        if ( args->check_ref==CHECK_REF_EXIT )
+            error("Reference allele mismatch at %s:%d .. '%s' vs '%s'\n", bcf_seqname(args->hdr,line),line->pos+1,ref,line->d.allele[0]);
+        if ( args->check_ref & CHECK_REF_WARN )
+            fprintf(stderr,"REF_MISMATCH\t%s\t%d\t%s\n", bcf_seqname(args->hdr,line),line->pos+1,line->d.allele[0]);
+        free(ref);
+        return -1;
+    }
+    free(ref);
+    ref = NULL;
+
+    if ( line->n_allele == 1 ) return 0;    // a REF
+
+    // make a copy of each allele for trimming
+    int i;
+    hts_expand0(kstring_t,line->n_allele,args->ntmp_als,args->tmp_als);
+    kstring_t *als = args->tmp_als;
+    for (i=0; i<line->n_allele; i++)
+    {
+        if ( line->d.allele[i][0]=='<' ) return 0;  // symbolic allele
+
+        als[i].l = 0;
+        kputs(line->d.allele[i], &als[i]);
+    }
+
+
+    // trim from right
+    int ori_pos = line->pos;
+    while (1)
+    {
+        // is the rightmost base identical in all alleles?
+        for (i=1; i<line->n_allele; i++)
+        {
+            if ( als[0].s[ als[0].l-1 ]!=als[i].s[ als[i].l-1 ] ) break;
+        }
+        if ( i!=line->n_allele ) break; // there are differences, cannot be trimmed
+
+        int pad_from_left = 0;
+        for (i=0; i<line->n_allele; i++) // trim all alleles
+        {
+            als[i].l--;
+            if ( !als[i].l ) pad_from_left = 1;
+        }
+        if ( pad_from_left )
+        {
+            int npad = line->pos >= args->aln_win ? args->aln_win : line->pos;
+            free(ref);
+            ref = faidx_fetch_seq(args->fai, (char*)args->hdr->id[BCF_DT_CTG][line->rid].key, line->pos-npad, line->pos-1, &nref);
+            if ( !ref ) error("faidx_fetch_seq failed at %s:%d\n", args->hdr->id[BCF_DT_CTG][line->rid].key, line->pos-npad+1);
+            for (i=0; i<line->n_allele; i++)
+            {
+                ks_resize(&als[i], als[i].l + npad);
+                if ( als[i].l ) memmove(als[i].s+npad,als[i].s,als[i].l);
+                memcpy(als[i].s,ref,npad);
+                als[i].l += npad;
+            }
+            line->pos -= npad;
+        }
+    }
+    free(ref);
+
+    // trim from left
+    int ntrim_left = 0;
+    while (1)
+    {
+        // is the first base identical in all alleles?
+        int min_len = als[0].l - ntrim_left;
+        for (i=1; i<line->n_allele; i++)
+        {
+            if ( als[0].s[ntrim_left]!=als[i].s[ntrim_left] ) break;
+            if ( min_len > als[i].l - ntrim_left ) min_len = als[i].l - ntrim_left;
+        }
+        if ( i!=line->n_allele || min_len==1 ) break; // there are differences, cannot be trimmed
+        ntrim_left++;
+    }
+    if ( ntrim_left )
+    {
+        for (i=0; i<line->n_allele; i++)
+        {
+            memmove(als[i].s,als[i].s+ntrim_left,als[i].l-ntrim_left);
+            als[i].l -= ntrim_left;
+        }
+        line->pos += ntrim_left;
+    }
+
+    // Have the alleles changed?
+    als[0].s[ als[0].l ] = 0;  // in order for strcmp to work
+    if ( ori_pos==line->pos && !strcasecmp(line->d.allele[0],als[0].s) ) return 1;
+
+    // Create new block of alleles and update
+    args->tmp_als_str.l = 0;
+    for (i=0; i<line->n_allele; i++)
+    {
+        if (i>0) kputc(',',&args->tmp_als_str);
+        kputsn(als[i].s,als[i].l,&args->tmp_als_str);
+    }
+    args->tmp_als_str.s[ args->tmp_als_str.l ] = 0;
+    bcf_update_alleles_str(args->hdr,line,args->tmp_als_str.s);
+    args->nchanged++;
+
+    return 1;
+}
+
+#endif
+
+static void split_info_numeric(args_t *args, bcf1_t *src, bcf_info_t *info, int ialt, bcf1_t *dst)
+{
+    #define BRANCH_NUMERIC(type,type_t) \
+    { \
+        const char *tag = bcf_hdr_int2id(args->hdr,BCF_DT_ID,info->key); \
+        int ntmp = args->ntmp_arr1 / sizeof(type_t); \
+        int ret = bcf_get_info_##type(args->hdr,src,tag,&args->tmp_arr1,&ntmp); \
+        args->ntmp_arr1 = ntmp * sizeof(type_t); \
+        assert( ret>0 ); \
+        type_t *vals = (type_t*) args->tmp_arr1; \
+        int len = bcf_hdr_id2length(args->hdr,BCF_HL_INFO,info->key); \
+        if ( len==BCF_VL_A ) \
+        { \
+            assert( ret==src->n_allele-1); \
+            bcf_update_info_##type(args->hdr,dst,tag,vals+ialt,1); \
+        } \
+        else if ( len==BCF_VL_R ) \
+        { \
+            assert( ret==src->n_allele); \
+            if ( ialt!=0 ) vals[1] = vals[ialt+1]; \
+            bcf_update_info_##type(args->hdr,dst,tag,vals,2); \
+        } \
+        else if ( len==BCF_VL_G ) \
+        { \
+            assert( ret==src->n_allele*(src->n_allele+1)/2 ); \
+            if ( ialt!=0 ) \
+            { \
+                vals[1] = vals[bcf_alleles2gt(0,ialt+1)]; \
+                vals[2] = vals[bcf_alleles2gt(ialt+1,ialt+1)]; \
+            } \
+            bcf_update_info_##type(args->hdr,dst,tag,vals,3); \
+        } \
+        else \
+            bcf_update_info_##type(args->hdr,dst,tag,vals,ret); \
+    }
+    switch (bcf_hdr_id2type(args->hdr,BCF_HL_INFO,info->key))
+    {
+        case BCF_HT_INT:  BRANCH_NUMERIC(int32, int32_t); break;
+        case BCF_HT_REAL: BRANCH_NUMERIC(float, float); break;
+    }
+    #undef BRANCH_NUMERIC
+}
+// Find n-th field in a comma-separated list and move it to dst.
+// The memory areas may overlap.
+#define STR_MOVE_NTH(dst,src,end,nth,len) \
+{ \
+    char *ss = src, *se = src; \
+    int j = 0; \
+    while ( *se && se<(end) ) \
+    { \
+        if ( *se==',' ) \
+        { \
+            if ( j==nth ) break; \
+            j++; \
+            ss = se+1; \
+        } \
+        se++; \
+    } \
+    if ( j==nth ) \
+    { \
+        int n = se - ss; \
+        memmove((dst),ss,n); \
+        src = se; \
+        len += n; \
+    } \
+    else len = -1; \
+}
+static void split_info_string(args_t *args, bcf1_t *src, bcf_info_t *info, int ialt, bcf1_t *dst)
+{
+    const char *tag = bcf_hdr_int2id(args->hdr,BCF_DT_ID,info->key);
+    int ret = bcf_get_info_string(args->hdr,src,tag,&args->tmp_arr1,&args->ntmp_arr1);
+    assert( ret>0 );
+
+    kstring_t str;
+    str.m = args->ntmp_arr1;
+    str.l = ret;
+    str.s = (char*) args->tmp_arr1;
+
+    int len = bcf_hdr_id2length(args->hdr,BCF_HL_INFO,info->key);
+    if ( len==BCF_VL_A )
+    {
+        char *tmp = str.s;
+        int len = 0;
+        STR_MOVE_NTH(str.s,tmp,str.s+str.l,ialt,len);
+        if ( len<0 ) return;   // wrong number of fields: skip
+        str.s[len] = 0;
+        bcf_update_info_string(args->hdr,dst,tag,str.s);
+    }
+    else if ( len==BCF_VL_R )
+    {
+        char *tmp = str.s;
+        int len = 0;
+        STR_MOVE_NTH(str.s,tmp,str.s+str.l,0,len);
+        str.s[len]=','; tmp++; len++;
+        STR_MOVE_NTH(&str.s[len],tmp,str.s+str.l,ialt,len);
+        if ( len<0 ) return;   // wrong number of fields: skip
+        str.s[len] = 0;
+        bcf_update_info_string(args->hdr,dst,tag,str.s);
+    }
+    else if ( len==BCF_VL_G )
+    {
+        int i0a = bcf_alleles2gt(0,ialt+1), iaa = bcf_alleles2gt(ialt+1,ialt+1);
+        char *tmp = str.s;
+        int len = 0;
+        STR_MOVE_NTH(str.s,tmp,str.s+str.l,0,len);
+        str.s[len]=','; tmp++; len++;
+        STR_MOVE_NTH(&str.s[len],tmp,str.s+str.l,i0a-1,len);
+        if ( len<0 ) return;   // wrong number of fields: skip
+        str.s[len]=','; tmp++; len++;
+        STR_MOVE_NTH(&str.s[len],tmp,str.s+str.l,iaa-i0a-1,len);
+        if ( len<0 ) return;   // wrong number of fields: skip
+        str.s[len] = 0;
+        bcf_update_info_string(args->hdr,dst,tag,str.s);
+    }
+    else
+        bcf_update_info_string(args->hdr,dst,tag,str.s);
+}
+static void split_info_flag(args_t *args, bcf1_t *src, bcf_info_t *info, int ialt, bcf1_t *dst)
+{
+    const char *tag = bcf_hdr_int2id(args->hdr,BCF_DT_ID,info->key);
+    int ret = bcf_get_info_flag(args->hdr,src,tag,&args->tmp_arr1,&args->ntmp_arr1);
+    bcf_update_info_flag(args->hdr,dst,tag,NULL,ret);
+}
+
+static void split_format_genotype(args_t *args, bcf1_t *src, bcf_fmt_t *fmt, int ialt, bcf1_t *dst)
+{
+    int ntmp = args->ntmp_arr1 / 4;
+    int ngts = bcf_get_genotypes(args->hdr,src,&args->tmp_arr1,&ntmp);
+    args->ntmp_arr1 = ntmp * 4;
+    assert( ngts >0 );
+
+    int32_t *gt = (int32_t*) args->tmp_arr1;
+    int i, j, nsmpl = bcf_hdr_nsamples(args->hdr);
+    ngts /= nsmpl;
+    for (i=0; i<nsmpl; i++)
+    {
+        for (j=0; j<ngts; j++)
+        {
+            if ( gt[j]==bcf_int32_vector_end ) break;
+            if ( bcf_gt_is_missing(gt[j]) || bcf_gt_allele(gt[j])==0 ) continue; // missing allele or ref: leave as is
+            if ( bcf_gt_allele(gt[j])==ialt+1 )
+                gt[j] = bcf_gt_unphased(1) | bcf_gt_is_phased(gt[j]); // set to first ALT
+            else
+                gt[j] = bcf_gt_unphased(0) | bcf_gt_is_phased(gt[j]); // set to REF
+        }
+        gt += ngts;
+    }
+    bcf_update_genotypes(args->hdr,dst,args->tmp_arr1,ngts*nsmpl);
+}
+static void split_format_numeric(args_t *args, bcf1_t *src, bcf_fmt_t *fmt, int ialt, bcf1_t *dst)
+{
+    #define BRANCH_NUMERIC(type,type_t,is_vector_end,set_vector_end) \
+    { \
+        const char *tag = bcf_hdr_int2id(args->hdr,BCF_DT_ID,fmt->id); \
+        int ntmp = args->ntmp_arr1 / sizeof(type_t); \
+        int nvals = bcf_get_format_##type(args->hdr,src,tag,&args->tmp_arr1,&ntmp); \
+        args->ntmp_arr1 = ntmp * sizeof(type_t); \
+        assert( nvals>0 ); \
+        type_t *vals = (type_t *) args->tmp_arr1; \
+        int len = bcf_hdr_id2length(args->hdr,BCF_HL_FMT,fmt->id); \
+        int i, nsmpl = bcf_hdr_nsamples(args->hdr); \
+        if ( nvals==nsmpl ) /* all values are missing */ \
+        { \
+            bcf_update_format_##type(args->hdr,dst,tag,vals,nsmpl); \
+            return; \
+        } \
+        if ( len==BCF_VL_A ) \
+        { \
+            assert( nvals==(src->n_allele-1)*nsmpl); \
+            nvals /= nsmpl; \
+            type_t *src_vals = vals, *dst_vals = vals; \
+            for (i=0; i<nsmpl; i++) \
+            { \
+                dst_vals[0] = src_vals[ialt]; \
+                dst_vals += 1; \
+                src_vals += nvals; \
+            } \
+            bcf_update_format_##type(args->hdr,dst,tag,vals,nsmpl); \
+        } \
+        else if ( len==BCF_VL_R ) \
+        { \
+            assert( nvals==src->n_allele*nsmpl); \
+            nvals /= nsmpl; \
+            type_t *src_vals = vals, *dst_vals = vals; \
+            for (i=0; i<nsmpl; i++) \
+            { \
+                dst_vals[0] = src_vals[0]; \
+                dst_vals[1] = src_vals[ialt+1]; \
+                dst_vals += 2; \
+                src_vals += nvals; \
+            } \
+            bcf_update_format_##type(args->hdr,dst,tag,vals,nsmpl*2); \
+        } \
+        else if ( len==BCF_VL_G ) \
+        { \
+            if ( nvals!=src->n_allele*(src->n_allele+1)/2*nsmpl && nvals!=src->n_allele*nsmpl ) \
+                error("Error at %s:%d, the tag %s has wrong number of fields\n", bcf_seqname(args->hdr,src),src->pos+1,bcf_hdr_int2id(args->hdr,BCF_DT_ID,fmt->id)); \
+            nvals /= nsmpl; \
+            int all_haploid = nvals==src->n_allele ? 1 : 0; \
+            type_t *src_vals = vals, *dst_vals = vals; \
+            for (i=0; i<nsmpl; i++) \
+            { \
+                int haploid = all_haploid; \
+                if ( !haploid ) \
+                { \
+                    int j; \
+                    for (j=0; j<nvals; j++) if ( is_vector_end ) break; \
+                    if ( j!=nvals ) haploid = 1; \
+                } \
+                dst_vals[0] = src_vals[0]; \
+                if ( haploid ) \
+                { \
+                    dst_vals[1] = src_vals[ialt+1]; \
+                    if ( !all_haploid ) set_vector_end; \
+                } \
+                else \
+                { \
+                    dst_vals[1] = src_vals[bcf_alleles2gt(0,ialt+1)]; \
+                    dst_vals[2] = src_vals[bcf_alleles2gt(ialt+1,ialt+1)]; \
+                } \
+                dst_vals += all_haploid ? 2 : 3; \
+                src_vals += nvals; \
+            } \
+            bcf_update_format_##type(args->hdr,dst,tag,vals,all_haploid ? nsmpl*2 : nsmpl*3); \
+        } \
+        else \
+            bcf_update_format_##type(args->hdr,dst,tag,vals,nvals); \
+    }
+    switch (bcf_hdr_id2type(args->hdr,BCF_HL_FMT,fmt->id))
+    {
+        case BCF_HT_INT:  BRANCH_NUMERIC(int32, int32_t, src_vals[j]==bcf_int32_vector_end, dst_vals[2]=bcf_int32_vector_end); break;
+        case BCF_HT_REAL: BRANCH_NUMERIC(float, float, bcf_float_is_vector_end(src_vals[j]), bcf_float_set_vector_end(dst_vals[2])); break;
+    }
+    #undef BRANCH_NUMERIC
+}
+static void squeeze_format_char(char *str, int src_blen, int dst_blen, int n)
+{
+    int i, isrc = 0, idst = 0;
+    for (i=0; i<n; i++)
+    {
+        memmove(str+idst,str+isrc,dst_blen);
+        idst += dst_blen;
+        isrc += src_blen;
+    }
+}
+static void split_format_string(args_t *args, bcf1_t *src, bcf_fmt_t *fmt, int ialt, bcf1_t *dst)
+{
+    const char *tag = bcf_hdr_int2id(args->hdr,BCF_DT_ID,fmt->id);
+    int ret = bcf_get_format_char(args->hdr,src,tag,&args->tmp_arr1,&args->ntmp_arr1);
+    assert( ret>0 );
+
+    kstring_t str;
+    str.m = args->ntmp_arr1;
+    str.l = ret;
+    str.s = (char*) args->tmp_arr1;
+
+    int nsmpl = bcf_hdr_nsamples(args->hdr);
+    int len = bcf_hdr_id2length(args->hdr,BCF_HL_FMT,fmt->id);
+    if ( len==BCF_VL_A )
+    {
+        int i, blen = ret/nsmpl, maxlen = 0;
+        char *ptr = str.s;
+        for (i=0; i<nsmpl; i++)
+        {
+            char *tmp = ptr;
+            int len = 0;
+            STR_MOVE_NTH(tmp,tmp,ptr+blen,ialt,len);
+            if ( len<0 ) return;   // wrong number of fields: skip
+            if ( maxlen < len ) maxlen = len;
+            ptr += blen;
+        }
+        if ( maxlen<blen ) squeeze_format_char(str.s,blen,maxlen,nsmpl);
+        bcf_update_format_char(args->hdr,dst,tag,str.s,nsmpl*maxlen);
+    }
+    else if ( len==BCF_VL_R )
+    {
+        int i, blen = ret/nsmpl, maxlen = 0;
+        char *ptr = str.s;
+        for (i=0; i<nsmpl; i++)
+        {
+            char *tmp = ptr;
+            int len = 0;
+            STR_MOVE_NTH(ptr,tmp,ptr+blen,0,len);
+            ptr[len]=','; tmp++; len++;
+            STR_MOVE_NTH(&ptr[len],tmp,ptr+blen,ialt,len);
+            if ( len<0 ) return;   // wrong number of fields: skip
+            if ( maxlen < len ) maxlen = len;
+            ptr += blen;
+        }
+        if ( maxlen<blen ) squeeze_format_char(str.s,blen,maxlen,nsmpl);
+        bcf_update_format_char(args->hdr,dst,tag,str.s,nsmpl*maxlen);
+    }
+    else if ( len==BCF_VL_G )
+    {
+        int i, blen = ret/nsmpl, maxlen = 0, i0a = bcf_alleles2gt(0,ialt+1), iaa = bcf_alleles2gt(ialt+1,ialt+1);
+        char *ptr = str.s;
+        for (i=0; i<nsmpl; i++)
+        {
+            char *se = ptr, *sx = ptr+blen;
+            int nfields = 1;
+            while ( *se && se<sx )
+            {
+                if ( *se==',' ) nfields++;
+                se++;
+            }
+            assert( nfields==src->n_allele*(src->n_allele+1)/2 || nfields==src->n_allele );
+            int len = 0;
+            if ( nfields==src->n_allele )   // haploid
+            {
+                char *tmp = ptr;
+                STR_MOVE_NTH(&ptr[len],tmp,ptr+blen,0,len);
+                ptr[len]=','; tmp++; len++;
+                STR_MOVE_NTH(&ptr[len],tmp,ptr+blen,ialt,len);
+                if ( len<0 ) return;   // wrong number of fields: skip
+            }
+            else    // diploid
+            {
+                char *tmp = ptr;
+                STR_MOVE_NTH(&ptr[len],tmp,ptr+blen,0,len);
+                ptr[len]=','; tmp++; len++;
+                STR_MOVE_NTH(&ptr[len],tmp,ptr+blen,i0a-1,len);
+                if ( len<0 ) return;   // wrong number of fields: skip
+                ptr[len]=','; tmp++; len++;
+                STR_MOVE_NTH(&ptr[len],tmp,ptr+blen,iaa-i0a-1,len);
+                if ( len<0 ) return;   // wrong number of fields: skip
+            }
+            if ( maxlen < len ) maxlen = len;
+            ptr += blen;
+        }
+        if ( maxlen<blen ) squeeze_format_char(str.s,blen,maxlen,nsmpl);
+        bcf_update_format_char(args->hdr,dst,tag,str.s,nsmpl*maxlen);
+    }
+    else
+        bcf_update_format_char(args->hdr,dst,tag,str.s,str.l);
+}
+
+
+static void split_multiallelic_to_biallelics(args_t *args, bcf1_t *line)
+{
+    int i;
+
+    bcf_unpack(line, BCF_UN_ALL);
+
+    // Init the target biallelic lines
+    args->ntmp_lines = line->n_allele-1;
+    if ( args->mtmp_lines < args->ntmp_lines )
+    {
+        args->tmp_lines = (bcf1_t **)realloc(args->tmp_lines,sizeof(bcf1_t*)*args->ntmp_lines);
+        for (i=args->mtmp_lines; i<args->ntmp_lines; i++)
+            args->tmp_lines[i] = bcf_init1();
+        args->mtmp_lines = args->ntmp_lines;
+    }
+    kstring_t tmp = {0,0,0};
+    kputs(line->d.allele[0], &tmp);
+    kputc(',', &tmp);
+    int rlen  = tmp.l;
+    int gt_id = bcf_hdr_id2int(args->hdr,BCF_DT_ID,"GT");
+    for (i=0; i<args->ntmp_lines; i++)  // for each ALT allele
+    {
+        bcf1_t *dst = args->tmp_lines[i];
+        bcf_clear(dst);
+
+        dst->rid  = line->rid;
+        dst->pos  = line->pos;
+        dst->qual = line->qual;
+
+        tmp.l = rlen;
+        kputs(line->d.allele[i+1],&tmp);
+        bcf_update_alleles_str(args->hdr,dst,tmp.s);
+
+        if ( line->d.n_flt ) bcf_update_filter(args->hdr, dst, line->d.flt, line->d.n_flt);
+
+        int j;
+        for (j=0; j<line->n_info; j++)
+        {
+            bcf_info_t *info = &line->d.info[j];
+            int type = bcf_hdr_id2type(args->hdr,BCF_HL_INFO,info->key);
+            if ( type==BCF_HT_INT || type==BCF_HT_REAL ) split_info_numeric(args, line, info, i, dst);
+            else if ( type==BCF_HT_FLAG ) split_info_flag(args, line, info, i, dst);
+            else split_info_string(args, line, info, i, dst);
+        }
+
+        dst->n_sample = line->n_sample;
+        for (j=0; j<line->n_fmt; j++)
+        {
+            bcf_fmt_t *fmt = &line->d.fmt[j];
+            int type = bcf_hdr_id2type(args->hdr,BCF_HL_FMT,fmt->id);
+            if ( fmt->id==gt_id ) split_format_genotype(args, line, fmt, i, dst);
+            else if ( type==BCF_HT_INT || type==BCF_HT_REAL ) split_format_numeric(args, line, fmt, i, dst);
+            else split_format_string(args, line, fmt, i, dst);
+        }
+    }
+    free(tmp.s);
+}
+
+// Enlarge FORMAT array containing nsmpl samples each with nals_ori values
+// to accommodate nvals values for each sample, filling the gaps with missing
+// values. Works also for INFO arrays, with nsmpl set to 1.
+#define ENLARGE_ARRAY(type_t,set_missing,arr,narr_bytes,nsmpl,nvals_ori,nvals) \
+{ \
+    int nbytes_new = (nsmpl)*(nvals)*sizeof(type_t); \
+    hts_expand(uint8_t,nbytes_new,narr_bytes,arr); \
+    int ismpl, k; \
+    for (ismpl=nsmpl-1; ismpl>=0; ismpl--) \
+    { \
+        type_t *dst_ptr = ((type_t*)arr) + ismpl*(nvals); \
+        type_t *src_ptr = ((type_t*)arr) + ismpl*nvals_ori; \
+        memmove(dst_ptr,src_ptr,sizeof(type_t)*nvals_ori); \
+        for (k=nvals_ori; k<nvals; k++) set_missing; \
+    } \
+}
+static void merge_info_numeric(args_t *args, bcf1_t **lines, int nlines, bcf_info_t *info, bcf1_t *dst)
+{
+    #define BRANCH_NUMERIC(type,type_t,set_missing,is_vector_end) \
+    { \
+        const char *tag = bcf_hdr_int2id(args->hdr,BCF_DT_ID,info->key); \
+        int ntmp = args->ntmp_arr1 / sizeof(type_t); \
+        int nvals_ori = bcf_get_info_##type(args->hdr,lines[0],tag,&args->tmp_arr1,&ntmp); \
+        args->ntmp_arr1 = ntmp * sizeof(type_t); \
+        assert( nvals_ori>0 ); \
+        type_t *vals = (type_t*) args->tmp_arr1, *vals2; \
+        int i,k,len = bcf_hdr_id2length(args->hdr,BCF_HL_INFO,info->key);  \
+        if ( len==BCF_VL_A ) \
+        { \
+            assert( nvals_ori==lines[0]->n_allele - 1); \
+            int nvals = dst->n_allele - 1; \
+            ENLARGE_ARRAY(type_t,set_missing,args->tmp_arr1,args->ntmp_arr1,1,nvals_ori,nvals); \
+            vals = (type_t*) args->tmp_arr1; \
+            for (i=1; i<nlines; i++) \
+            { \
+                int ntmp2 = args->ntmp_arr2 / sizeof(type_t); \
+                int nvals2 = bcf_get_info_##type(args->hdr,lines[i],tag,&args->tmp_arr2,&ntmp2); \
+                args->ntmp_arr2 = ntmp2 * sizeof(type_t); \
+                assert( nvals2==lines[i]->n_allele-1 ); \
+                vals2 = (type_t*) args->tmp_arr2; \
+                for (k=0; k<nvals2; k++) \
+                { \
+                    if ( is_vector_end ) break; \
+                    vals[ args->maps[i].map[k+1] - 1 ] = vals2[k]; \
+                } \
+            } \
+            bcf_update_info_##type(args->hdr,dst,tag,args->tmp_arr1,nvals); \
+        } \
+        else if ( len==BCF_VL_R ) \
+        { \
+            assert( nvals_ori==lines[0]->n_allele ); \
+            int nvals = dst->n_allele; \
+            ENLARGE_ARRAY(type_t,set_missing,args->tmp_arr1,args->ntmp_arr1,1,nvals_ori,nvals); \
+            vals = (type_t*) args->tmp_arr1; \
+            for (i=1; i<nlines; i++) \
+            { \
+                int ntmp2 = args->ntmp_arr2 / sizeof(type_t); \
+                int nvals2 = bcf_get_info_##type(args->hdr,lines[i],tag,&args->tmp_arr2,&ntmp2); \
+                args->ntmp_arr2 = ntmp2 * sizeof(type_t); \
+                assert( nvals2==lines[i]->n_allele ); \
+                vals2 = (type_t*) args->tmp_arr2; \
+                for (k=0; k<nvals2; k++) \
+                { \
+                    if ( is_vector_end ) break; \
+                    vals[ args->maps[i].map[k] ] = vals2[k]; \
+                } \
+            } \
+            bcf_update_info_##type(args->hdr,dst,tag,args->tmp_arr1,nvals); \
+        } \
+        else if ( len==BCF_VL_G ) \
+        { \
+            assert( nvals_ori==lines[0]->n_allele*(lines[0]->n_allele+1)/2 );   /* expecting diploid gt in INFO */ \
+            int nvals = dst->n_allele*(dst->n_allele+1)/2; \
+            ENLARGE_ARRAY(type_t,set_missing,args->tmp_arr1,args->ntmp_arr1,1,nvals_ori,nvals); \
+            vals = (type_t*) args->tmp_arr1; \
+            for (i=1; i<nlines; i++) \
+            { \
+                int ntmp2 = args->ntmp_arr2 / sizeof(type_t); \
+                int nvals2 = bcf_get_info_##type(args->hdr,lines[i],tag,&args->tmp_arr2,&ntmp2); \
+                args->ntmp_arr2 = ntmp2 * sizeof(type_t); \
+                assert( nvals2==lines[i]->n_allele*(lines[i]->n_allele+1)/2 ); \
+                vals2 = (type_t*) args->tmp_arr2; \
+                int ia,ib; \
+                k = 0; \
+                for (ia=0; ia<lines[i]->n_allele; ia++) \
+                { \
+                    for (ib=0; ib<=ia; ib++) \
+                    { \
+                        if ( is_vector_end ) break; \
+                        int l = bcf_alleles2gt(args->maps[i].map[ia],args->maps[i].map[ib]); \
+                        vals[l] = vals2[k];  \
+                        k++; \
+                    } \
+                } \
+            } \
+            bcf_update_info_##type(args->hdr,dst,tag,args->tmp_arr1,nvals); \
+        } \
+        else \
+            bcf_update_info_##type(args->hdr,dst,tag,vals,nvals_ori); \
+    }
+    switch (bcf_hdr_id2type(args->hdr,BCF_HL_INFO,info->key))
+    {
+        case BCF_HT_INT:  BRANCH_NUMERIC(int32, int32_t, dst_ptr[k]=bcf_int32_missing, vals2[k]==bcf_int32_vector_end); break;
+        case BCF_HT_REAL: BRANCH_NUMERIC(float, float, bcf_float_set_missing(dst_ptr[k]), bcf_float_is_vector_end(vals2[k])); break;
+    }
+    #undef BRANCH_NUMERIC
+}
+static void merge_info_flag(args_t *args, bcf1_t **lines, int nlines, bcf_info_t *info, bcf1_t *dst)
+{
+    const char *tag = bcf_hdr_int2id(args->hdr,BCF_DT_ID,info->key);
+    int ret = bcf_get_info_flag(args->hdr,lines[0],tag,&args->tmp_arr1,&args->ntmp_arr1);
+    bcf_update_info_flag(args->hdr,dst,tag,NULL,ret);
+}
+int copy_string_field(char *src, int isrc, int src_len, kstring_t *dst, int idst); // see vcfmerge.c
+static void merge_info_string(args_t *args, bcf1_t **lines, int nlines, bcf_info_t *info, bcf1_t *dst)
+{
+    const char *tag = bcf_hdr_int2id(args->hdr,BCF_DT_ID,info->key);
+
+    kstring_t str;
+    str.m = args->ntmp_arr1;
+    str.l = 0;
+    str.s = (char*) args->tmp_arr1;
+
+    int i, j, len = bcf_hdr_id2length(args->hdr,BCF_HL_INFO,info->key);
+    if ( len==BCF_VL_A || len==BCF_VL_R )
+    {
+        int jfrom = len==BCF_VL_A ? 1 : 0;
+        kputc('.',&str);
+        for (i=jfrom+1; i<dst->n_allele; i++) kputs(",.",&str);
+        for (i=0; i<nlines; i++)
+        {
+            bcf_info_t *src = bcf_get_info(args->hdr,lines[i],tag);
+            for (j=jfrom; j<lines[i]->n_allele; j++)
+                copy_string_field((char*)src->vptr, j-jfrom, src->len, &str, args->maps[i].map[j]-jfrom);
+        }
+        str.s[str.l] = 0;
+        args->tmp_arr1  = (uint8_t*) str.s;
+        args->ntmp_arr1 = str.m;
+        bcf_update_info_string(args->hdr,dst,tag,str.s);
+    }
+    else if ( len==BCF_VL_G )
+    {
+        int ngts = dst->n_allele*(dst->n_allele+1)/2;
+        kputc('.',&str);
+        for (i=1; i<ngts; i++) kputs(",.",&str);
+        for (i=0; i<nlines; i++)
+        {
+            bcf_info_t *src = bcf_get_info(args->hdr,lines[i],tag);
+            int iori, jori, kori = 0;
+            for (iori=0; iori<lines[i]->n_allele; iori++)
+            {
+                int inew = args->maps[i].map[iori];
+                for (jori=0; jori<=iori; jori++)
+                {
+                    int jnew = args->maps[i].map[jori];
+                    int knew = bcf_alleles2gt(inew,jnew);
+                    copy_string_field((char*)src->vptr,kori,src->len,&str,knew);
+                    kori++;
+                }
+            }
+        }
+        str.s[str.l] = 0;
+        args->tmp_arr1  = (uint8_t*) str.s;
+        args->ntmp_arr1 = str.m;
+        bcf_update_info_string(args->hdr,dst,tag,str.s);
+    }
+    else
+    {
+        bcf_get_info_string(args->hdr,lines[0],tag,&args->tmp_arr1,&args->ntmp_arr1);
+        bcf_update_info_string(args->hdr,dst,tag,args->tmp_arr1);
+    }
+
+}
+static void merge_format_genotype(args_t *args, bcf1_t **lines, int nlines, bcf_fmt_t *fmt, bcf1_t *dst)
+{
+    int ntmp = args->ntmp_arr1 / 4;
+    int ngts = bcf_get_genotypes(args->hdr,lines[0],&args->tmp_arr1,&ntmp);
+    args->ntmp_arr1 = ntmp * 4;
+    assert( ngts >0 );
+
+    int nsmpl = bcf_hdr_nsamples(args->hdr);
+    ngts /= nsmpl;
+
+    int i, j, k;
+    for (i=1; i<nlines; i++)
+    {
+        int ntmp2 = args->ntmp_arr2 / 4;
+        int ngts2 = bcf_get_genotypes(args->hdr,lines[i],&args->tmp_arr2,&ntmp2);
+        args->ntmp_arr2 = ntmp2 * 4;
+        ngts2 /= nsmpl;
+        assert( ngts==ngts2 );
+
+        int32_t *gt  = (int32_t*) args->tmp_arr1;
+        int32_t *gt2 = (int32_t*) args->tmp_arr2;
+        for (j=0; j<nsmpl; j++)
+        {
+            for (k=0; k<ngts; k++)
+            {
+                if ( gt2[k]==bcf_int32_vector_end ) break;
+                if ( bcf_gt_is_missing(gt2[k]) || bcf_gt_allele(gt2[k])==0 ) continue;
+                if ( gt2[k]==0 ) gt[k] = 0; // missing genotype
+                else
+                {
+                    int ial = bcf_gt_allele(gt2[k]);
+                    assert( ial<args->maps[i].nals );
+                    gt[k] = bcf_gt_unphased( args->maps[i].map[ial] ) | bcf_gt_is_phased(gt[k]);
+                }
+            }
+            gt  += ngts;
+            gt2 += ngts;
+        }
+    }
+    bcf_update_genotypes(args->hdr,dst,args->tmp_arr1,ngts*nsmpl);
+}
+static void merge_format_numeric(args_t *args, bcf1_t **lines, int nlines, bcf_fmt_t *fmt, bcf1_t *dst)
+{
+    #define BRANCH_NUMERIC(type,type_t,set_missing,is_vector_end) \
+    { \
+        const char *tag = bcf_hdr_int2id(args->hdr,BCF_DT_ID,fmt->id); \
+        int ntmp = args->ntmp_arr1 / sizeof(type_t); \
+        int nvals_ori = bcf_get_format_##type(args->hdr,lines[0],tag,&args->tmp_arr1,&ntmp); \
+        args->ntmp_arr1 = ntmp * sizeof(type_t); \
+        assert( nvals_ori>0 ); \
+        type_t *vals2, *vals = (type_t *) args->tmp_arr1; \
+        int len = bcf_hdr_id2length(args->hdr,BCF_HL_FMT,fmt->id); \
+        int i, j, k, nsmpl = bcf_hdr_nsamples(args->hdr); \
+        nvals_ori /= nsmpl; \
+        if ( len==BCF_VL_A ) \
+        { \
+            int nvals = dst->n_allele - 1; \
+            ENLARGE_ARRAY(type_t,set_missing,args->tmp_arr1,args->ntmp_arr1,nsmpl,nvals_ori,nvals); \
+            for (i=1; i<nlines; i++) \
+            { \
+                int ntmp2 = args->ntmp_arr2 / sizeof(type_t); \
+                int nvals2 = bcf_get_format_##type(args->hdr,lines[i],tag,&args->tmp_arr2,&ntmp2); \
+                args->ntmp_arr2 = ntmp2 * sizeof(type_t); \
+                nvals2 /= nsmpl; \
+                assert( nvals2==lines[i]->n_allele-1 ); \
+                vals  = (type_t*) args->tmp_arr1; \
+                vals2 = (type_t*) args->tmp_arr2; \
+                for (j=0; j<nsmpl; j++) \
+                { \
+                    for (k=0; k<nvals2; k++) \
+                    { \
+                        if ( is_vector_end ) break; \
+                        vals[ args->maps[i].map[k+1] - 1 ] = vals2[k]; \
+                    } \
+                    vals  += nvals; \
+                    vals2 += nvals2; \
+                } \
+            } \
+            bcf_update_format_##type(args->hdr,dst,tag,args->tmp_arr1,nvals*nsmpl); \
+        } \
+        else if ( len==BCF_VL_R ) \
+        { \
+            int nvals = dst->n_allele; \
+            ENLARGE_ARRAY(type_t,set_missing,args->tmp_arr1,args->ntmp_arr1,nsmpl,nvals_ori,nvals); \
+            for (i=1; i<nlines; i++) \
+            { \
+                int ntmp2 = args->ntmp_arr2 / sizeof(type_t); \
+                int nvals2 = bcf_get_format_##type(args->hdr,lines[i],tag,&args->tmp_arr2,&ntmp2); \
+                args->ntmp_arr2 = ntmp2 * sizeof(type_t); \
+                nvals2 /= nsmpl; \
+                assert( nvals2==lines[i]->n_allele ); \
+                vals  = (type_t*) args->tmp_arr1; \
+                vals2 = (type_t*) args->tmp_arr2; \
+                for (j=0; j<nsmpl; j++) \
+                { \
+                    for (k=0; k<nvals2; k++) \
+                    { \
+                        if ( is_vector_end ) break; \
+                        vals[ args->maps[i].map[k] ] = vals2[k]; \
+                    } \
+                    vals  += nvals; \
+                    vals2 += nvals2; \
+                } \
+            } \
+            bcf_update_format_##type(args->hdr,dst,tag,args->tmp_arr1,nvals*nsmpl); \
+        } \
+        else if ( len==BCF_VL_G ) \
+        { \
+            int all_haploid = nvals_ori==lines[0]->n_allele ? 1 : 0; \
+            int nvals = all_haploid ? dst->n_allele : dst->n_allele*(dst->n_allele+1)/2; \
+            ENLARGE_ARRAY(type_t,set_missing,args->tmp_arr1,args->ntmp_arr1,nsmpl,nvals_ori,nvals); \
+            for (i=1; i<nlines; i++) \
+            { \
+                int ntmp2 = args->ntmp_arr2 / sizeof(type_t); \
+                int nvals2 = bcf_get_format_##type(args->hdr,lines[i],tag,&args->tmp_arr2,&ntmp2); \
+                args->ntmp_arr2 = ntmp2 * sizeof(type_t); \
+                nvals2 /= nsmpl; \
+                assert( nvals2==lines[i]->n_allele || nvals2==lines[i]->n_allele*(lines[i]->n_allele+1)/2); \
+                vals  = (type_t*) args->tmp_arr1; \
+                vals2 = (type_t*) args->tmp_arr2; \
+                for (j=0; j<nsmpl; j++) \
+                { \
+                    int haploid = all_haploid; \
+                    if ( !haploid ) \
+                    { \
+                        for (k=0; k<nvals2; k++) if ( is_vector_end ) break; \
+                        if ( k!=nvals2 ) haploid = 1; \
+                    } \
+                    if ( haploid ) \
+                    { \
+                        for (k=0; k<nvals2; k++) \
+                        { \
+                            if ( is_vector_end ) break; \
+                            vals[ args->maps[i].map[k] ] = vals2[k]; \
+                        } \
+                    } \
+                    else \
+                    { \
+                        k = 0; \
+                        int ia,ib; \
+                        for (ia=0; ia<lines[i]->n_allele; ia++) \
+                        { \
+                            for (ib=0; ib<=ia; ib++) \
+                            { \
+                                int l = bcf_alleles2gt(args->maps[i].map[ia],args->maps[i].map[ib]); \
+                                vals[l] = vals2[k]; \
+                                k++; \
+                            } \
+                        } \
+                    } \
+                    vals  += nvals; \
+                    vals2 += nvals2; \
+                } \
+            } \
+            bcf_update_format_##type(args->hdr,dst,tag,args->tmp_arr1,nvals*nsmpl); \
+        } \
+        else \
+            bcf_update_format_##type(args->hdr,dst,tag,args->tmp_arr1,nvals_ori*nsmpl); \
+    }
+    switch (bcf_hdr_id2type(args->hdr,BCF_HL_FMT,fmt->id))
+    {
+        case BCF_HT_INT:  BRANCH_NUMERIC(int32, int32_t, dst_ptr[k]=bcf_int32_missing, vals2[k]==bcf_int32_vector_end); break;
+        case BCF_HT_REAL: BRANCH_NUMERIC(float, float, bcf_float_set_missing(dst_ptr[k]), bcf_float_is_vector_end(vals2[k])); break;
+    }
+    #undef BRANCH_NUMERIC
+}
+static void merge_format_string(args_t *args, bcf1_t **lines, int nlines, bcf_fmt_t *fmt, bcf1_t *dst)
+{
+    const char *tag = bcf_hdr_int2id(args->hdr,BCF_DT_ID,fmt->id);
+
+    int i, j, k, len = bcf_hdr_id2length(args->hdr,BCF_HL_FMT,fmt->id);
+    if ( len!=BCF_VL_A && len!=BCF_VL_R && len!=BCF_VL_G )
+    {
+        int nret = bcf_get_format_char(args->hdr,lines[0],tag,&args->tmp_arr1,&args->ntmp_arr1);
+        bcf_update_format_char(args->hdr,dst,tag,args->tmp_arr1,nret);
+        return;
+    }
+
+    int nsmpl = bcf_hdr_nsamples(args->hdr);
+    for (i=0; i<nsmpl; i++) args->tmp_str[i].l = 0;
+
+    if ( len==BCF_VL_A || len==BCF_VL_R )
+    {
+        int jfrom = len==BCF_VL_A ? 1 : 0;
+        for (i=0; i<nsmpl; i++)
+        {
+            kstring_t *tmp = &args->tmp_str[i];
+            kputc('.',tmp);
+            for (k=jfrom+1; k<dst->n_allele; k++) kputs(",.",tmp);
+        }
+        for (i=0; i<nlines; i++)
+        {
+            int nret = bcf_get_format_char(args->hdr,lines[i],tag,&args->tmp_arr1,&args->ntmp_arr1);
+            nret /= nsmpl;
+            for (k=0; k<nsmpl; k++)
+            {
+                kstring_t *tmp = &args->tmp_str[k];
+                char *src = (char*)args->tmp_arr1 + k*nret;
+                for (j=jfrom; j<lines[i]->n_allele; j++)
+                    copy_string_field(src, j-jfrom, nret, tmp, args->maps[i].map[j]-jfrom);
+            }
+        }
+    }
+    else if ( len==BCF_VL_G )
+    {
+        hts_expand(uint8_t,nsmpl,args->ntmp_arr2,args->tmp_arr2);
+        uint8_t *haploid = args->tmp_arr2;
+        int nret = bcf_get_format_char(args->hdr,lines[0],tag,&args->tmp_arr1,&args->ntmp_arr1);
+        nret /= nsmpl;
+        for (i=0; i<nsmpl; i++)
+        {
+            char *ss = (char*)args->tmp_arr1 + i*nret, *se = ss+nret;
+            int nfields = 1;
+            while ( *ss && ss<se )
+            {
+                if ( *ss==',' ) nfields++;
+                ss++;
+            }
+            if ( nfields==lines[0]->n_allele )
+            {
+                haploid[i] = 1;
+                nfields = dst->n_allele;
+            }
+            else if ( nfields==lines[0]->n_allele*(lines[0]->n_allele+1)/2 )
+            {
+                haploid[i] = 0;
+                nfields = dst->n_allele*(dst->n_allele+1)/2;
+            }
+            else error("The field %s at %s:%d neither diploid nor haploid?\n", tag,bcf_seqname(args->hdr,dst),dst->pos+1);
+
+            kstring_t *tmp = &args->tmp_str[i];
+            kputc('.',tmp);
+            for (j=1; j<nfields; j++) kputs(",.",tmp);
+        }
+        for (i=0; i<nlines; i++)
+        {
+            if ( i ) // we already have a copy
+            {
+                nret = bcf_get_format_char(args->hdr,lines[i],tag,&args->tmp_arr1,&args->ntmp_arr1);
+                nret /= nsmpl;
+            }
+            for (k=0; k<nsmpl; k++)
+            {
+                kstring_t *tmp = &args->tmp_str[k];
+                char *src = (char*)args->tmp_arr1 + k*nret;
+                if ( haploid[k] )
+                {
+                    for (j=0; j<lines[i]->n_allele; j++)
+                        copy_string_field(src,j,nret, tmp, args->maps[i].map[j]);
+                }
+                else
+                {
+                    int iori, jori, kori = 0;
+                    for (iori=0; iori<lines[i]->n_allele; iori++)
+                    {
+                        int inew = args->maps[i].map[iori];
+                        for (jori=0; jori<=iori; jori++)
+                        {
+                            int jnew = args->maps[i].map[jori];
+                            int knew = bcf_alleles2gt(inew,jnew);
+                            copy_string_field(src,kori,nret,tmp,knew);
+                            kori++;
+                        }
+                    }
+                }
+            }
+        }
+    }
+    kstring_t str;
+    str.m = args->ntmp_arr2;
+    str.l = 0;
+    str.s = (char*) args->tmp_arr2;
+
+    int max_len = 0;
+    for (i=0; i<nsmpl; i++)
+        if ( max_len < args->tmp_str[i].l ) max_len = args->tmp_str[i].l;
+    for (i=0; i<nsmpl; i++)
+    {
+        kstring_t *tmp = &args->tmp_str[i];
+        kputsn(tmp->s,tmp->l,&str);
+        for (j=tmp->l; j<max_len; j++) kputc(0,tmp);
+    }
+    args->ntmp_arr2 = str.m;
+    args->tmp_arr2  = (uint8_t*)str.s;
+    bcf_update_format_char(args->hdr,dst,tag,str.s,str.l);
+}
+
+char **merge_alleles(char **a, int na, int *map, char **b, int *nb, int *mb);   // see vcfmerge.c
+static void merge_biallelics_to_multiallelic(args_t *args, bcf1_t *dst, bcf1_t **lines, int nlines)
+{
+    int i;
+    for (i=0; i<nlines; i++)
+        bcf_unpack(lines[i], BCF_UN_ALL);
+
+    dst->rid  = lines[0]->rid;
+    dst->pos  = lines[0]->pos;
+
+    // take max for QUAL
+    bcf_float_set_missing(dst->qual);
+    for (i=0; i<nlines; i++) {
+        if (bcf_float_is_missing(lines[i]->qual)) continue;
+        if (bcf_float_is_missing(dst->qual) || dst->qual<lines[i]->qual)
+            dst->qual = lines[i]->qual;
+    }
+
+    bcf_update_id(args->hdr, dst, lines[0]->d.id);
+
+    // Merge and set the alleles, create a mapping from source allele indexes to dst idxs
+    hts_expand0(map_t,nlines,args->mmaps,args->maps);   // a mapping for each line
+    args->nals = args->maps[0].nals = lines[0]->n_allele;
+    hts_expand(int,args->maps[0].nals,args->maps[0].mals,args->maps[0].map);
+    hts_expand(char*,args->nals,args->mals,args->als);
+    for (i=0; i<args->maps[0].nals; i++)
+    {
+        args->maps[0].map[i] = i;
+        args->als[i] = strdup(lines[0]->d.allele[i]);
+    }
+    for (i=1; i<nlines; i++)
+    {
+        if (lines[i]->d.id[0]!='.' || lines[i]->d.id[1]) {
+            kstring_t tmp = {0,0,0};
+            if (dst->d.id[0]=='.' && !dst->d.id[1])
+                kputs(lines[i]->d.id, &tmp);
+            else
+                ksprintf(&tmp, "%s;%s", dst->d.id, lines[i]->d.id);
+            bcf_update_id(args->hdr, dst, tmp.s);
+            free(tmp.s);
+        }
+        args->maps[i].nals = lines[i]->n_allele;
+        hts_expand(int,args->maps[i].nals,args->maps[i].mals,args->maps[i].map);
+        args->als = merge_alleles(lines[i]->d.allele, lines[i]->n_allele, args->maps[i].map, args->als, &args->nals, &args->mals);
+        if ( !args->als ) error("Failed to merge alleles at %s:%d\n", bcf_seqname(args->hdr,dst),dst->pos+1);
+    }
+    bcf_update_alleles(args->hdr, dst, (const char**)args->als, args->nals);
+    for (i=0; i<args->nals; i++) free(args->als[i]);
+
+    if ( lines[0]->d.n_flt ) bcf_update_filter(args->hdr, dst, lines[0]->d.flt, lines[0]->d.n_flt);
+    for (i=1; i<nlines; i++) {
+        int j;
+        for (j=0; j<lines[i]->d.n_flt; j++) {
+            // if strict_filter, set FILTER to PASS if any site PASS
+            // otherwise accumulate FILTERs
+            if (lines[i]->d.flt[j] == bcf_hdr_id2int(args->hdr, BCF_DT_ID, "PASS")) {
+                if (args->strict_filter) {
+                    bcf_update_filter(args->hdr, dst, lines[i]->d.flt, lines[i]->d.n_flt);
+                    break;
+                }
+                else
+                    continue;
+            }
+            bcf_add_filter(args->hdr, dst, lines[i]->d.flt[j]);
+        }
+    }
+
+    // merge info
+    for (i=0; i<lines[0]->n_info; i++)
+    {
+        bcf_info_t *info = &lines[0]->d.info[i];
+        int type = bcf_hdr_id2type(args->hdr,BCF_HL_INFO,info->key);
+        if ( type==BCF_HT_INT || type==BCF_HT_REAL ) merge_info_numeric(args, lines, nlines, info, dst);
+        else if ( type==BCF_HT_FLAG ) merge_info_flag(args, lines, nlines, info, dst);
+        else merge_info_string(args, lines, nlines, info, dst);
+    }
+
+    // merge format
+    int gt_id = bcf_hdr_id2int(args->hdr,BCF_DT_ID,"GT");
+    dst->n_sample = lines[0]->n_sample;
+    for (i=0; i<lines[0]->n_fmt; i++)
+    {
+        bcf_fmt_t *fmt = &lines[0]->d.fmt[i];
+        int type = bcf_hdr_id2type(args->hdr,BCF_HL_FMT,fmt->id);
+        if ( fmt->id==gt_id ) merge_format_genotype(args, lines, nlines, fmt, dst);
+        else if ( type==BCF_HT_INT || type==BCF_HT_REAL ) merge_format_numeric(args, lines, nlines, fmt, dst);
+        else merge_format_string(args, lines, nlines, fmt, dst);
+    }
+}
+
+#define SWAP(type_t, a, b) { type_t t = a; a = b; b = t; }
+static void mrows_schedule(args_t *args, bcf1_t **line)
+{
+    int i,m;
+    if ( args->mrows_collapse==COLLAPSE_ANY ||  bcf_get_variant_types(*line)&COLLAPSE_SNPS )
+    {
+        args->nalines++;
+        m = args->malines;
+        hts_expand(bcf1_t*,args->nalines,args->malines,args->alines);
+        for (i=m; i<args->malines; i++) args->alines[i] = bcf_init1();
+        SWAP(bcf1_t*, args->alines[args->nalines-1], *line);
+    }
+    else
+    {
+        args->nblines++;
+        m = args->mblines;
+        hts_expand(bcf1_t*,args->nblines,args->mblines,args->blines);
+        for (i=m; i<args->mblines; i++) args->blines[i] = bcf_init1();
+        SWAP(bcf1_t*, args->blines[args->nblines-1], *line);
+    }
+}
+static int mrows_ready_to_flush(args_t *args, bcf1_t *line)
+{
+    if ( args->nalines && (args->alines[0]->rid!=line->rid || args->alines[0]->pos!=line->pos) ) return 1;
+    if ( args->nblines && (args->blines[0]->rid!=line->rid || args->blines[0]->pos!=line->pos) ) return 1;
+    return 0;
+}
+static bcf1_t *mrows_flush(args_t *args)
+{
+    if ( args->nalines )
+    {
+        if ( args->nalines==1 )
+        {
+            args->nalines = 0;
+            return args->alines[0];
+        }
+        bcf_clear(args->mrow_out);
+        merge_biallelics_to_multiallelic(args, args->mrow_out, args->alines, args->nalines);
+        args->nalines = 0;
+        return args->mrow_out;
+    }
+    else if ( args->nblines )
+    {
+        if ( args->nblines==1 )
+        {
+            args->nblines = 0;
+            return args->blines[0];
+        }
+        bcf_clear(args->mrow_out);
+        merge_biallelics_to_multiallelic(args, args->mrow_out, args->blines, args->nblines);
+        args->nblines = 0;
+        return args->mrow_out;
+    }
+    return NULL;
+}
+static void flush_buffer(args_t *args, htsFile *file, int n)
+{
+    bcf1_t *line;
+    int i, k, prev_rid = -1, prev_pos = 0, prev_type = 0;
+    for (i=0; i<n; i++)
+    {
+        k = rbuf_shift(&args->rbuf);
+        if ( args->mrows_op==MROWS_SPLIT )
+        {
+            int split = 1;
+            if ( args->mrows_collapse!=COLLAPSE_BOTH && args->mrows_collapse!=COLLAPSE_ANY )
+            {
+                if ( !(bcf_get_variant_types(args->lines[k]) & args->mrows_collapse) ) split = 0;
+            }
+            if ( split && args->lines[k]->n_allele>2 )
+            {
+                split_multiallelic_to_biallelics(args, args->lines[k]);
+                int j;
+                for (j=0; j<args->ntmp_lines; j++)
+                    bcf_write1(file, args->hdr, args->tmp_lines[j]);
+                continue;
+            }
+        }
+        if ( args->mrows_op==MROWS_MERGE )
+        {
+            if ( mrows_ready_to_flush(args, args->lines[k]) )
+            {
+                while ( (line=mrows_flush(args)) ) bcf_write1(file, args->hdr, line);
+            }
+            int merge = 1;
+            if ( args->mrows_collapse!=COLLAPSE_BOTH && args->mrows_collapse!=COLLAPSE_ANY )
+            {
+                if ( !(bcf_get_variant_types(args->lines[k]) & args->mrows_collapse) ) merge = 0;
+            }
+            if ( merge )
+            {
+                mrows_schedule(args, &args->lines[k]);
+                continue;
+            }
+        }
+        // todo: merge with next record if POS and the type are same. For now, just discard if asked to do so.
+        if ( args->rmdup )
+        {
+            int line_type = bcf_get_variant_types(args->lines[k]);
+            if ( prev_rid>=0 && prev_rid==args->lines[k]->rid && prev_pos==args->lines[k]->pos && prev_type==line_type )
+                continue;
+            prev_rid  = args->lines[k]->rid;
+            prev_pos  = args->lines[k]->pos;
+            prev_type = line_type;
+        }
+        bcf_write1(file, args->hdr, args->lines[k]);
+    }
+    if ( args->mrows_op==MROWS_MERGE && !args->rbuf.n )
+    {
+        while ( (line=mrows_flush(args)) ) bcf_write1(file, args->hdr, line);
+    }
+}
+
+static void init_data(args_t *args)
+{
+    args->hdr = args->files->readers[0].header;
+    rbuf_init(&args->rbuf, 100);
+    args->lines = (bcf1_t**) calloc(args->rbuf.m, sizeof(bcf1_t*));
+    if ( args->ref_fname )
+    {
+        args->fai = fai_load(args->ref_fname);
+        if ( !args->fai ) error("Failed to load the fai index: %s\n", args->ref_fname);
+    }
+    if ( args->mrows_op==MROWS_MERGE )
+    {
+        args->mrow_out = bcf_init1();
+        args->tmp_str = (kstring_t*) calloc(bcf_hdr_nsamples(args->hdr),sizeof(kstring_t));
+    }
+}
+
+static void destroy_data(args_t *args)
+{
+    int i;
+    for (i=0; i<args->rbuf.m; i++)
+        if ( args->lines[i] ) bcf_destroy1(args->lines[i]);
+    free(args->lines);
+    for (i=0; i<args->mtmp_lines; i++)
+        bcf_destroy1(args->tmp_lines[i]);
+    free(args->tmp_lines);
+    for (i=0; i<args->nalines; i++)
+        bcf_destroy1(args->alines[i]);
+    free(args->alines);
+    for (i=0; i<args->nblines; i++)
+        bcf_destroy1(args->blines[i]);
+    free(args->blines);
+    for (i=0; i<args->mmaps; i++)
+        free(args->maps[i].map);
+    for (i=0; i<args->ntmp_als; i++)
+        free(args->tmp_als[i].s);
+    free(args->tmp_als);
+    free(args->tmp_als_str.s);
+    if ( args->tmp_str )
+    {
+        for (i=0; i<bcf_hdr_nsamples(args->hdr); i++) free(args->tmp_str[i].s);
+        free(args->tmp_str);
+    }
+    free(args->maps);
+    free(args->als);
+    free(args->tmp_arr1);
+    free(args->tmp_arr2);
+    if ( args->mrow_out ) bcf_destroy1(args->mrow_out);
+    if ( args->fai ) fai_destroy(args->fai);
+    if ( args->mseq ) free(args->seq);
+    if ( args->aln.nmat ) free(args->aln.mat);
+    if ( args->aln.m_arr ) { free(args->aln.ipos_arr); free(args->aln.lref_arr); free(args->aln.lseq_arr); }
+}
+
+
+static void normalize_vcf(args_t *args)
+{
+    htsFile *out = hts_open(args->output_fname, hts_bcf_wmode(args->output_type));
+    if ( out == NULL ) error("Can't write to \"%s\": %s\n", args->output_fname, strerror(errno));
+    bcf_hdr_append_version(args->hdr, args->argc, args->argv, "bcftools_norm");
+    bcf_hdr_write(out, args->hdr);
+
+    while ( bcf_sr_next_line(args->files) )
+    {
+        args->ntotal++;
+
+        bcf1_t *line = args->files->readers[0].buffer[0];
+        if ( args->fai )
+        {
+            if ( realign(args, line)<0 && args->check_ref & CHECK_REF_SKIP )
+            {
+                args->nskipped++;
+                continue;   // exclude broken VCF lines
+            }
+        }
+
+        // still on the same chromosome?
+        int i, j, ilast = rbuf_last(&args->rbuf);
+        if ( ilast>=0 && line->rid != args->lines[ilast]->rid ) flush_buffer(args, out, args->rbuf.n); // new chromosome
+
+        // insert into sorted buffer
+        i = j = ilast = rbuf_append(&args->rbuf);
+        if ( !args->lines[i] ) args->lines[i] = bcf_init1();
+        SWAP(bcf1_t*, args->files->readers[0].buffer[0], args->lines[i]);
+        while ( rbuf_prev(&args->rbuf,&i) )
+        {
+            if ( args->lines[i]->pos > args->lines[j]->pos ) SWAP(bcf1_t*, args->lines[i], args->lines[j]);
+            j = i;
+        }
+
+        // find out how many sites to flush
+        j = 0;
+        for (i=-1; rbuf_next(&args->rbuf,&i); )
+        {
+            if ( args->lines[ilast]->pos - args->lines[i]->pos < args->buf_win ) break;
+            j++;
+        }
+        if ( args->rbuf.n==args->rbuf.m ) j = 1;
+        if ( j>0 ) flush_buffer(args, out, j);
+    }
+    flush_buffer(args, out, args->rbuf.n);
+    hts_close(out);
+
+    fprintf(stderr,"Lines total/modified/skipped:\t%d/%d/%d\n", args->ntotal,args->nchanged,args->nskipped);
+}
+
+static void usage(void)
+{
+    fprintf(stderr, "\n");
+    fprintf(stderr, "About:   Left-align and normalize indels; check if REF alleles match the reference;\n");
+    fprintf(stderr, "         split multiallelic sites into multiple rows; recover multiallelics from\n");
+    fprintf(stderr, "         multiple rows.\n");
+    fprintf(stderr, "Usage:   bcftools norm [options] <in.vcf.gz>\n");
+    fprintf(stderr, "\n");
+    fprintf(stderr, "Options:\n");
+    fprintf(stderr, "    -c, --check-ref <e|w|x>           check REF alleles and exit (e), warn (w), exclude (x) bad sites [e]\n");
+    fprintf(stderr, "    -D, --remove-duplicates           remove duplicate lines of the same type.\n");
+    fprintf(stderr, "    -f, --fasta-ref <file>            reference sequence\n");
+    fprintf(stderr, "    -m, --multiallelics <-|+>[type]   split multiallelics (-) or join biallelics (+), type: snps|indels|both|any [both]\n");
+    fprintf(stderr, "    -o, --output <file>               write output to a file [standard output]\n");
+    fprintf(stderr, "    -O, --output-type <type>          'b' compressed BCF; 'u' uncompressed BCF; 'z' compressed VCF; 'v' uncompressed VCF [v]\n");
+    fprintf(stderr, "    -r, --regions <region>            restrict to comma-separated list of regions\n");
+    fprintf(stderr, "    -R, --regions-file <file>         restrict to regions listed in a file\n");
+    fprintf(stderr, "    -s, --strict-filter               when merging (-m+), merged site is PASS only if all sites being merged PASS\n");
+    fprintf(stderr, "    -t, --targets <region>            similar to -r but streams rather than index-jumps\n");
+    fprintf(stderr, "    -T, --targets-file <file>         similar to -R but streams rather than index-jumps\n");
+    fprintf(stderr, "    -w, --site-win <int>              buffer for sorting lines which changed position during realignment [1000]\n");
+    fprintf(stderr, "\n");
+    exit(1);
+}
+
+int main_vcfnorm(int argc, char *argv[])
+{
+    int c;
+    args_t *args  = (args_t*) calloc(1,sizeof(args_t));
+    args->argc    = argc; args->argv = argv;
+    args->files   = bcf_sr_init();
+    args->output_fname = "-";
+    args->output_type = FT_VCF;
+    args->aln_win = 100;
+    args->buf_win = 1000;
+    args->mrows_collapse = COLLAPSE_BOTH;
+    int region_is_file  = 0;
+    int targets_is_file = 0;
+
+    static struct option loptions[] =
+    {
+        {"help",0,0,'h'},
+        {"fasta-ref",1,0,'f'},
+        {"multiallelics",1,0,'m'},
+        {"regions",1,0,'r'},
+        {"regions-file",1,0,'R'},
+        {"targets",1,0,'t'},
+        {"targets-file",1,0,'T'},
+        {"site-win",1,0,'W'},
+        {"remove-duplicates",0,0,'D'},
+        {"output",1,0,'o'},
+        {"output-type",1,0,'O'},
+        {"check-ref",1,0,'c'},
+        {"strict-filter",0,0,'s'},
+        {0,0,0,0}
+    };
+    char *tmp;
+    while ((c = getopt_long(argc, argv, "hr:R:f:w:Do:O:c:m:t:T:s",loptions,NULL)) >= 0) {
+        switch (c) {
+            case 'm':
+                if ( optarg[0]=='-' ) args->mrows_op = MROWS_SPLIT;
+                else if ( optarg[0]=='+' ) args->mrows_op = MROWS_MERGE;
+                else error("Expected '+' or '-' with -m\n");
+                if ( optarg[1]!=0 )
+                {
+                    if ( !strcmp("snps",optarg+1) ) args->mrows_collapse = COLLAPSE_SNPS;
+                    else if ( !strcmp("indels",optarg+1) ) args->mrows_collapse = COLLAPSE_INDELS;
+                    else if ( !strcmp("both",optarg+1) ) args->mrows_collapse = COLLAPSE_BOTH;
+                    else if ( !strcmp("any",optarg+1) ) args->mrows_collapse = COLLAPSE_ANY;
+                    else error("The argument to -m not recognised: %s\n", optarg);
+                }
+                break;
+            case 'c':
+                if ( strchr(optarg,'w') ) args->check_ref |= CHECK_REF_WARN;
+                if ( strchr(optarg,'x') ) args->check_ref |= CHECK_REF_SKIP;
+                if ( strchr(optarg,'e') ) args->check_ref = CHECK_REF_EXIT; // overrides the above
+                break;
+            case 'O':
+                switch (optarg[0]) {
+                    case 'b': args->output_type = FT_BCF_GZ; break;
+                    case 'u': args->output_type = FT_BCF; break;
+                    case 'z': args->output_type = FT_VCF_GZ; break;
+                    case 'v': args->output_type = FT_VCF; break;
+                    default: error("The output type \"%s\" not recognised\n", optarg);
+                }
+                break;
+            case 'o': args->output_fname = optarg; break;
+            case 'D': args->rmdup = 1; break;
+            case 's': args->strict_filter = 1; break;
+            case 'f': args->ref_fname = optarg; break;
+            case 'r': args->region = optarg; break;
+            case 'R': args->region = optarg; region_is_file = 1; break;
+            case 't': args->targets = optarg; break;
+            case 'T': args->targets = optarg; targets_is_file = 1; break;
+            case 'w':
+                args->buf_win = strtol(optarg,&tmp,10);
+                if ( *tmp ) error("Could not parse argument: --site-win %s\n", optarg);
+                break;
+            case 'h':
+            case '?': usage();
+            default: error("Unknown argument: %s\n", optarg);
+        }
+    }
+    if ( argc>optind+1 ) usage();
+    if ( !args->ref_fname && !args->mrows_op && !args->rmdup ) usage();
+    char *fname = NULL;
+    if ( optind>=argc )
+    {
+        if ( !isatty(fileno((FILE *)stdin)) ) fname = "-";  // reading from stdin
+        else usage();
+    }
+    else fname = argv[optind];
+
+    if ( args->region )
+    {
+        if ( bcf_sr_set_regions(args->files, args->region,region_is_file)<0 )
+            error("Failed to read the regions: %s\n", args->region);
+    }
+    if ( args->targets )
+    {
+        if ( bcf_sr_set_targets(args->files, args->targets,targets_is_file, 0)<0 )
+            error("Failed to read the targets: %s\n", args->targets);
+    }
+
+    if ( !bcf_sr_add_reader(args->files, fname) ) error("Failed to open %s: %s\n", fname,bcf_sr_strerror(args->files->errnum));
+    if ( args->mrows_op&MROWS_SPLIT && args->rmdup ) error("Cannot combine -D and -m-\n");
+    init_data(args);
+    normalize_vcf(args);
+    destroy_data(args);
+    bcf_sr_destroy(args->files);
+    free(args);
+    return 0;
+}
+
diff --git a/vcfplugin.c b/vcfplugin.c
new file mode 100644
index 0000000..9e2ee39
--- /dev/null
+++ b/vcfplugin.c
@@ -0,0 +1,562 @@
+/*  vcfannotate.c -- Annotate and edit VCF/BCF files.
+
+    Copyright (C) 2013-2014 Genome Research Ltd.
+
+    Author: Petr Danecek <pd3 at sanger.ac.uk>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.  */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <getopt.h>
+#include <ctype.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <dirent.h>
+#include <math.h>
+#include <htslib/vcf.h>
+#include <htslib/synced_bcf_reader.h>
+#include <htslib/kseq.h>
+#include <htslib/khash_str2int.h>
+#include <dlfcn.h>
+#include "bcftools.h"
+#include "vcmp.h"
+#include "filter.h"
+
+typedef struct _plugin_t plugin_t;
+
+/**
+ *   Plugin API:
+ *   ----------
+ *   const char *about(void)
+ *      - short description used by 'bcftools plugin -l'
+ *
+ *   const char *usage(void)
+ *      - longer description used by 'bcftools +name -h'
+ *
+ *   int run(int argc, char **argv)
+ *      - if implemented, the control is immediately handed over to the plugin,
+ *      none of the init/process/destroy functions is called.  Return 0 on
+ *      success or non-zero value on error.
+ *
+ *   int init(int argc, char **argv, bcf_hdr_t *in_hdr, bcf_hdr_t *out_hdr)
+ *      - called once at startup, allows to initialize local variables.
+ *      Return 1 to suppress normal VCF/BCF header output, -1 on critical
+ *      errors, 0 otherwise.
+ *
+ *   bcf1_t *process(bcf1_t *rec)
+ *      - called for each VCF record, return NULL for no output
+ *
+ *   void destroy(void)
+ *      - called after all lines have been processed to clean up
+ */
+typedef void (*dl_version_f) (const char **, const char **);
+typedef int (*dl_run_f) (int, char **);
+typedef int (*dl_init_f) (int, char **, bcf_hdr_t *, bcf_hdr_t *);
+typedef char* (*dl_about_f) (void);
+typedef char* (*dl_usage_f) (void);
+typedef bcf1_t* (*dl_process_f) (bcf1_t *);
+typedef void (*dl_destroy_f) (void);
+
+struct _plugin_t
+{
+    int argc;
+    char *name, **argv;
+    dl_version_f version;
+    dl_run_f run;
+    dl_init_f init;
+    dl_about_f about;
+    dl_usage_f usage;
+    dl_process_f process;
+    dl_destroy_f destroy;
+    void *handle;
+};
+
+
+struct _args_t;
+
+typedef struct _rm_tag_t
+{
+    char *key;
+    int hdr_id;
+    void (*handler)(struct _args_t *, bcf1_t *, struct _rm_tag_t *);
+}
+rm_tag_t;
+
+typedef struct
+{
+    char **cols;
+    int ncols, mcols;
+    char **als;
+    int nals, mals;
+    kstring_t line;
+    int rid, start, end;
+}
+annot_line_t;
+
+typedef struct _annot_col_t
+{
+    int icol, replace;
+    char *hdr_key;
+    int (*setter)(struct _args_t *, bcf1_t *, struct _annot_col_t *, void*);
+}
+annot_col_t;
+
+// Logic of the filters: include or exclude sites which match the filters?
+#define FLT_INCLUDE 1
+#define FLT_EXCLUDE 2
+
+typedef struct _args_t
+{
+    bcf_srs_t *files;
+    bcf_hdr_t *hdr, *hdr_out;
+    htsFile *out_fh;
+    int output_type;
+
+    filter_t *filter;
+    char *filter_str;
+    int filter_logic;   // include or exclude sites which match the filters? One of FLT_INCLUDE/FLT_EXCLUDE
+
+    plugin_t plugin;
+    int nplugin_paths;
+    char **plugin_paths;
+
+    char **argv, *output_fname, *regions_list, *targets_list;
+    int argc, drop_header, verbose;
+}
+args_t;
+
+char *msprintf(const char *fmt, ...);
+
+static void init_plugin_paths(args_t *args)
+{
+    if ( args->nplugin_paths!=-1 ) return;
+
+    char *path = getenv("BCFTOOLS_PLUGINS");
+    if ( path )
+    {
+        args->nplugin_paths = 1;
+        args->plugin_paths  = (char**) malloc(sizeof(char*));
+        char *ss = args->plugin_paths[0] = strdup(path);
+        while ( *ss )
+        {
+            if ( *ss==':' )
+            {
+                *ss = 0;
+                args->plugin_paths = (char**) realloc(args->plugin_paths,sizeof(char*)*(args->nplugin_paths+1));
+                args->plugin_paths[args->nplugin_paths] = ss+1;
+                args->nplugin_paths++;
+            }
+            ss++;
+        }
+    }
+    else
+        args->nplugin_paths = 0;
+}
+
+static void *dlopen_plugin(args_t *args, const char *fname)
+{
+    init_plugin_paths(args);
+
+    void *handle;
+    char *tmp;
+    if ( fname[0]!='/' )    // not an absolute path
+    {
+        int i;
+        for (i=0; i<args->nplugin_paths; i++)
+        {
+            tmp = msprintf("%s/%s.so", args->plugin_paths[i],fname);
+            handle = dlopen(tmp, RTLD_NOW); // valgrind complains about unfreed memory, not our problem though
+            if ( args->verbose )
+            {
+                if ( !handle ) fprintf(stderr,"%s:\n\tdlopen   .. %s\n", tmp,dlerror());
+                else fprintf(stderr,"%s:\n\tdlopen   .. ok\n", tmp);
+            }
+            free(tmp);
+            if ( handle ) return handle;
+        }
+    }
+
+    handle = dlopen(fname, RTLD_NOW);
+    if ( args->verbose )
+    {
+        if ( !handle ) fprintf(stderr,"%s:\n\tdlopen   .. %s\n", fname,dlerror());
+        else fprintf(stderr,"%s:\n\tdlopen   .. ok\n", fname);
+    }
+
+    return handle;
+}
+
+static void print_plugin_usage_hint(void)
+{
+    fprintf(stderr, "\nNo functional bcftools plugins were found");
+    if ( !getenv("BCFTOOLS_PLUGINS") )
+        fprintf(stderr,". The environment variable BCFTOOLS_PLUGINS is not set.\n\n");
+    else
+        fprintf(stderr,
+                " in\n\tBCFTOOLS_PLUGINS=\"%s\".\n\n"
+                "- Is the plugin path correct?\n\n"
+                "- Are all shared libraries, namely libhts.so, accessible? Verify with\n"
+                "   on Mac OS X: `otool -L your/plugin.so` and set DYLD_LIBRARY_PATH if they are not\n"
+                "   on Linux:    `ldd your/plugin.so` and set LD_LIBRARY_PATH if they are not\n"
+                "\n"
+                "- If not installed systemwide, set the environment variable LD_LIBRARY_PATH (linux) or\n"
+                "DYLD_LIBRARY_PATH (mac) to include directory where *libhts.so* is located.\n"
+                "\n"
+                "- Run \"bcftools plugin -lv\" for more detailed error output.\n"
+                "\n",
+                getenv("BCFTOOLS_PLUGINS")
+               );
+}
+
+static int load_plugin(args_t *args, const char *fname, int exit_on_error, plugin_t *plugin)
+{
+    plugin->name = strdup(fname);
+
+    plugin->handle = dlopen_plugin(args, fname);
+    if ( !plugin->handle )
+    {
+        if ( exit_on_error )
+        {
+            print_plugin_usage_hint();
+            error("Could not load \"%s\".\n\n", fname);
+        }
+        return -1;
+    }
+
+    dlerror();
+    plugin->init = (dl_init_f) dlsym(plugin->handle, "init");
+    char *ret = dlerror();
+    if ( ret )
+        plugin->init = NULL;
+    else 
+        if ( args->verbose ) fprintf(stderr,"\tinit     .. ok\n");
+
+    plugin->run = (dl_run_f) dlsym(plugin->handle, "run");
+    ret = dlerror();
+    if ( ret )
+        plugin->run = NULL;
+    else
+        if ( args->verbose ) fprintf(stderr,"\trun      .. ok\n");
+
+    if ( !plugin->init && !plugin->run )
+    {
+        if ( exit_on_error ) error("Could not initialize %s, neither run or init found \n", plugin->name);
+        else if ( args->verbose ) fprintf(stderr,"\tinit/run .. not found\n");
+        return -1;
+    }
+
+    plugin->version = (dl_version_f) dlsym(plugin->handle, "version");
+    ret = dlerror();
+    if ( ret )
+    {
+        if ( exit_on_error ) error("Could not initialize %s, version string not found\n", plugin->name);
+        else if ( args->verbose ) fprintf(stderr,"\tversion  .. not found\n");
+        return -1;
+    }
+
+    plugin->about = (dl_about_f) dlsym(plugin->handle, "about");
+    ret = dlerror();
+    if ( ret )
+    {
+        if ( exit_on_error ) error("Could not initialize %s: %s\n", plugin->name, ret);
+        return -1;
+    }
+
+    plugin->usage = (dl_about_f) dlsym(plugin->handle, "usage");
+    ret = dlerror();
+    if ( ret )
+        plugin->usage = plugin->about;
+
+    if ( plugin->run ) return 0;
+
+    plugin->process = (dl_process_f) dlsym(plugin->handle, "process");
+    ret = dlerror();
+    if ( ret )
+    {
+        if ( exit_on_error ) error("Could not initialize %s: %s\n", plugin->name, ret);
+        return -1;
+    }
+
+    plugin->destroy = (dl_destroy_f) dlsym(plugin->handle, "destroy");
+    ret = dlerror();
+    if ( ret )
+    {
+        if ( exit_on_error ) error("Could not initialize %s: %s\n", plugin->name, ret);
+        return -1;
+    }
+
+    return 0;
+}
+
+static void init_plugin(args_t *args)
+{
+    static int warned_bcftools = 0, warned_htslib = 0;
+
+    int ret = args->plugin.init(args->plugin.argc,args->plugin.argv,args->hdr,args->hdr_out);
+    if ( ret<0 ) error("The plugin exited with an error.\n");
+    const char *bver, *hver;
+    args->plugin.version(&bver, &hver);
+    if ( strcmp(bver,bcftools_version()) && !warned_bcftools )
+    {
+        fprintf(stderr,"WARNING: bcftools version mismatch .. bcftools at %s, the plugin \"%s\" at %s\n", bcftools_version(),args->plugin.name,bver);
+        warned_bcftools = 1;
+    }
+    if ( strcmp(hver,hts_version()) && !warned_htslib )
+    {
+        fprintf(stderr,"WARNING: htslib version mismatch .. bcftools at %s, the plugin \"%s\" at %s\n", hts_version(),args->plugin.name,hver);
+        warned_htslib = 1;
+    }
+    args->drop_header += ret;
+}
+
+static int cmp_plugin_name(const void *p1, const void *p2)
+{
+    plugin_t *a = (plugin_t*) p1;
+    plugin_t *b = (plugin_t*) p2;
+    return strcmp(a->name,b->name);
+}
+
+static int list_plugins(args_t *args)
+{
+    plugin_t *plugins = NULL;
+    int nplugins = 0, mplugins = 0;
+
+    init_plugin_paths(args);
+
+    kstring_t str = {0,0,0};
+    int i;
+    for (i=0; i<args->nplugin_paths; i++)
+    {
+        DIR *dp = opendir(args->plugin_paths[i]);
+        if ( dp==NULL ) continue;
+
+        struct dirent *ep;
+        while ( (ep=readdir(dp)) )
+        {
+            int len = strlen(ep->d_name);
+            if ( strcasecmp(".so",ep->d_name+len-3) ) continue;
+            str.l = 0;
+            ksprintf(&str,"%s/%s", args->plugin_paths[i],ep->d_name);
+            hts_expand(plugin_t, nplugins+1, mplugins, plugins);
+            if ( load_plugin(args, str.s, 0, &plugins[nplugins]) < 0 ) continue;
+            nplugins++;
+            str.l = 0;
+            kputs(ep->d_name, &str);
+            int l = str.l - 1;
+            while ( l>=0 && str.s[l]!='.' ) l--;
+            if ( l>=0 ) str.s[l] = 0;
+            free(plugins[nplugins-1].name);
+            plugins[nplugins-1].name = strdup(str.s);  // use a short name
+        }
+        closedir(dp);
+    }
+    if ( nplugins )
+    {
+        qsort(plugins, nplugins, sizeof(plugins[0]), cmp_plugin_name);
+
+        for (i=0; i<nplugins; i++)
+            printf("\n-- %s --\n%s", plugins[i].name, plugins[i].about());
+        printf("\n");
+    }
+    else
+        print_plugin_usage_hint();
+    free(str.s);
+    return nplugins ? 0 : 1;
+}
+
+static void init_data(args_t *args)
+{
+    args->hdr = args->files->readers[0].header;
+    args->hdr_out = bcf_hdr_dup(args->hdr);
+
+    init_plugin(args);
+
+    if ( args->filter_str )
+        args->filter = filter_init(args->hdr, args->filter_str);
+
+    bcf_hdr_append_version(args->hdr_out, args->argc, args->argv, "bcftools_plugin");
+    if ( !args->drop_header )
+    {
+        args->out_fh = hts_open(args->output_fname,hts_bcf_wmode(args->output_type));
+        if ( args->out_fh == NULL ) error("Can't write to \"%s\": %s\n", args->output_fname, strerror(errno));
+        bcf_hdr_write(args->out_fh, args->hdr_out);
+    }
+}
+
+static void destroy_data(args_t *args)
+{
+    free(args->plugin.name);
+    if ( args->plugin.destroy ) args->plugin.destroy();
+    dlclose(args->plugin.handle);
+    if ( args->hdr_out ) bcf_hdr_destroy(args->hdr_out);
+    if ( args->nplugin_paths>0 )
+    {
+        free(args->plugin_paths[0]);
+        free(args->plugin_paths);
+    }
+    if ( args->filter )
+        filter_destroy(args->filter);
+    if (args->out_fh) hts_close(args->out_fh);
+}
+
+static void usage(args_t *args)
+{
+    fprintf(stderr, "\n");
+    fprintf(stderr, "About:   Run user defined plugin\n");
+    fprintf(stderr, "Usage:   bcftools plugin <name> [OPTIONS] <file> [-- PLUGIN_OPTIONS]\n");
+    fprintf(stderr, "         bcftools +name [OPTIONS] <file>  [-- PLUGIN_OPTIONS]\n");
+    fprintf(stderr, "\n");
+    fprintf(stderr, "VCF input options:\n");
+    fprintf(stderr, "   -e, --exclude <expr>        exclude sites for which the expression is true\n");
+    fprintf(stderr, "   -i, --include <expr>        select sites for which the expression is true\n");
+    fprintf(stderr, "   -r, --regions <region>      restrict to comma-separated list of regions\n");
+    fprintf(stderr, "   -R, --regions-file <file>   restrict to regions listed in a file\n");
+    fprintf(stderr, "   -t, --targets <region>      similar to -r but streams rather than index-jumps\n");
+    fprintf(stderr, "   -T, --targets-file <file>   similar to -R but streams rather than index-jumps\n");
+    fprintf(stderr, "VCF output options:\n");
+    fprintf(stderr, "   -o, --output <file>         write output to a file [standard output]\n");
+    fprintf(stderr, "   -O, --output-type <type>    'b' compressed BCF; 'u' uncompressed BCF; 'z' compressed VCF; 'v' uncompressed VCF [v]\n");
+    fprintf(stderr, "Plugin options:\n");
+    fprintf(stderr, "   -h, --help                  list plugin's options\n");
+    fprintf(stderr, "   -l, --list-plugins          list available plugins. See BCFTOOLS_PLUGINS environment variable and man page for details\n");
+    fprintf(stderr, "   -v, --verbose               print debugging information on plugin failure\n");
+    fprintf(stderr, "\n");
+    exit(1);
+}
+
+int main_plugin(int argc, char *argv[])
+{
+    int c;
+    args_t *args  = (args_t*) calloc(1,sizeof(args_t));
+    args->argc    = argc; args->argv = argv;
+    args->output_fname = "-";
+    args->output_type = FT_VCF;
+    args->nplugin_paths = -1;
+    int regions_is_file = 0, targets_is_file = 0, plist_only = 0;
+
+    if ( argc==1 ) usage(args);
+    char *plugin_name = NULL;
+    if ( argv[1][0]!='-' ) { plugin_name = argv[1]; argc--; argv++; }
+
+    static struct option loptions[] =
+    {
+        {"verbose",0,0,'v'},
+        {"help",0,0,'h'},
+        {"list-plugins",0,0,'l'},
+        {"output",1,0,'o'},
+        {"output-type",1,0,'O'},
+        {"include",1,0,'i'},
+        {"exclude",1,0,'e'},
+        {"regions",1,0,'r'},
+        {"regions-file",1,0,'R'},
+        {"targets",1,0,'t'},
+        {"targets-file",1,0,'T'},
+        {0,0,0,0}
+    };
+    while ((c = getopt_long(argc, argv, "h?o:O:r:R:li:e:v",loptions,NULL)) >= 0)
+    {
+        switch (c) {
+            case 'v': args->verbose = 1; break;
+            case 'o': args->output_fname = optarg; break;
+            case 'O':
+                switch (optarg[0]) {
+                    case 'b': args->output_type = FT_BCF_GZ; break;
+                    case 'u': args->output_type = FT_BCF; break;
+                    case 'z': args->output_type = FT_VCF_GZ; break;
+                    case 'v': args->output_type = FT_VCF; break;
+                    default: error("The output type \"%s\" not recognised\n", optarg);
+                };
+                break;
+            case 'e': args->filter_str = optarg; args->filter_logic |= FLT_EXCLUDE; break;
+            case 'i': args->filter_str = optarg; args->filter_logic |= FLT_INCLUDE; break;
+            case 'r': args->regions_list = optarg; break;
+            case 'R': args->regions_list = optarg; regions_is_file = 1; break;
+            case 't': args->targets_list = optarg; break;
+            case 'T': args->targets_list = optarg; targets_is_file = 1; break;
+            case 'l': plist_only = 1; break;
+            case '?':
+            case 'h': load_plugin(args, plugin_name, 1, &args->plugin); fprintf(stderr,"%s",args->plugin.usage()); return 0; break;
+            default: error("Unknown argument: %s\n", optarg);
+        }
+    }
+    if ( plist_only )  return list_plugins(args);
+
+    load_plugin(args, plugin_name, 1, &args->plugin);
+    if ( args->plugin.run )
+    {
+        int iopt = optind; optind = 0;
+        int ret = args->plugin.run(argc-iopt, argv+iopt);
+        destroy_data(args);
+        free(args);
+        return ret;
+    }
+
+    char *fname = NULL;
+    if ( optind>=argc || argv[optind][0]=='-' )
+    {
+        if ( !isatty(fileno((FILE *)stdin)) ) fname = "-";  // reading from stdin
+        else usage(args);
+        args->plugin.argc = argc - optind + 1;
+        args->plugin.argv = argv + optind - 1;
+    }
+    else
+    {
+        fname = argv[optind];
+        args->plugin.argc = argc - optind;
+        args->plugin.argv = argv + optind;
+    }
+    optind = 0;
+    args->plugin.argv[0] = plugin_name;
+
+    args->files = bcf_sr_init();
+    if ( args->regions_list )
+    {
+        if ( bcf_sr_set_regions(args->files, args->regions_list, regions_is_file)<0 )
+            error("Failed to read the regions: %s\n", args->regions_list);
+    }
+    if ( args->targets_list )
+    {
+        if ( bcf_sr_set_targets(args->files, args->targets_list, targets_is_file, 0)<0 )
+            error("Failed to read the targets: %s\n", args->targets_list);
+        args->files->collapse |= COLLAPSE_SOME;
+    }
+    if ( !bcf_sr_add_reader(args->files, fname) ) error("Failed to open %s: %s\n", fname,bcf_sr_strerror(args->files->errnum));
+
+    init_data(args);
+    while ( bcf_sr_next_line(args->files) )
+    {
+        bcf1_t *line = bcf_sr_get_line(args->files,0);
+        if ( args->filter )
+        {
+            int pass = filter_test(args->filter, line, NULL);
+            if ( args->filter_logic & FLT_EXCLUDE ) pass = pass ? 0 : 1;
+            if ( !pass ) continue;
+        }
+        line = args->plugin.process(line);
+        if ( line ) bcf_write1(args->out_fh, args->hdr_out, line);
+    }
+    destroy_data(args);
+    bcf_sr_destroy(args->files);
+    free(args);
+    return 0;
+}
+
diff --git a/vcfquery.c b/vcfquery.c
new file mode 100644
index 0000000..7e72a1b
--- /dev/null
+++ b/vcfquery.c
@@ -0,0 +1,364 @@
+/*  vcfquery.c -- Extracts fields from VCF/BCF file.
+
+    Copyright (C) 2013-2014 Genome Research Ltd.
+
+    Author: Petr Danecek <pd3 at sanger.ac.uk>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.  */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <getopt.h>
+#include <ctype.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <htslib/vcf.h>
+#include <htslib/synced_bcf_reader.h>
+#include <htslib/vcfutils.h>
+#include "bcftools.h"
+#include "filter.h"
+#include "convert.h"
+
+
+// Logic of the filters: include or exclude sites which match the filters?
+#define FLT_INCLUDE 1
+#define FLT_EXCLUDE 2
+
+typedef struct
+{
+    filter_t *filter;
+    char *filter_str;
+    int filter_logic;   // include or exclude sites which match the filters? One of FLT_INCLUDE/FLT_EXCLUDE
+    convert_t *convert;
+    bcf_srs_t *files;
+    bcf_hdr_t *header;
+    int nsamples, *samples, sample_is_file;
+    char **argv, *format_str, *sample_list, *targets_list, *regions_list, *vcf_list, *fn_out;
+    int argc, list_columns, print_header;
+    FILE *out;
+}
+args_t;
+
+static void destroy_list(char **list, int n)
+{
+    int i;
+    for (i=0; i<n; i++)
+        free(list[i]);
+    free(list);
+}
+
+static void init_data(args_t *args)
+{
+    args->header = args->files->readers[0].header;
+
+    int i, nsamples = 0, *samples = NULL;
+    if ( args->sample_list && strcmp("-",args->sample_list) )
+    {
+        for (i=0; i<args->files->nreaders; i++)
+        {
+            int ret = bcf_hdr_set_samples(args->files->readers[i].header,args->sample_list,args->sample_is_file);
+            if ( ret<0 ) error("Error parsing the sample list\n");
+            else if ( ret>0 ) error("Sample name mismatch: sample #%d not found in the header\n", ret);
+        }
+
+        if ( args->sample_list[0]!='^' )
+        {
+            // the sample ordering may be different if not negated
+            int n;
+            char **smpls = hts_readlist(args->sample_list, args->sample_is_file, &n);
+            if ( !smpls ) error("Could not parse %s\n", args->sample_list);
+            if ( n!=bcf_hdr_nsamples(args->files->readers[0].header) )
+                error("The number of samples does not match, perhaps some are present multiple times?\n");
+            nsamples = bcf_hdr_nsamples(args->files->readers[0].header);
+            samples = (int*) malloc(sizeof(int)*nsamples);
+            for (i=0; i<n; i++)
+            {
+                samples[i] = bcf_hdr_id2int(args->files->readers[0].header, BCF_DT_SAMPLE,smpls[i]);
+                free(smpls[i]);
+            }
+            free(smpls);
+        }
+    }
+    args->convert = convert_init(args->header, samples, nsamples, args->format_str);
+    free(samples);
+
+    if ( args->filter_str )
+        args->filter = filter_init(args->header, args->filter_str);
+}
+
+static void destroy_data(args_t *args)
+{
+    convert_destroy(args->convert);
+    if ( args->filter )
+        filter_destroy(args->filter);
+    free(args->samples);
+}
+
+static void query_vcf(args_t *args)
+{
+    kstring_t str = {0,0,0};
+
+    if ( args->print_header )
+    {
+        convert_header(args->convert,&str);
+        fwrite(str.s, str.l, 1, args->out);
+    }
+
+    while ( bcf_sr_next_line(args->files) )
+    {
+        if ( !bcf_sr_has_line(args->files,0) ) continue;
+        bcf1_t *line = args->files->readers[0].buffer[0];
+        bcf_unpack(line, args->files->max_unpack);
+
+        if ( args->filter )
+        {
+            int pass = filter_test(args->filter, line, NULL);
+            if ( args->filter_logic & FLT_EXCLUDE ) pass = pass ? 0 : 1;
+            if ( !pass ) continue;
+        }
+
+        str.l = 0;
+        convert_line(args->convert, line, &str);
+        if ( str.l )
+            fwrite(str.s, str.l, 1, args->out);
+    }
+    if ( str.m ) free(str.s);
+}
+
+static void list_columns(args_t *args)
+{
+    int i;
+    bcf_sr_t *reader = &args->files->readers[0];
+    for (i=0; i<bcf_hdr_nsamples(reader->header); i++)
+        printf("%s\n", reader->header->samples[i]);
+}
+
+static char **copy_header(bcf_hdr_t *hdr, char **src, int nsrc)
+{
+    char **dst = (char**) malloc(sizeof(char*)*nsrc);
+    int i;
+    for (i=0; i<nsrc; i++) dst[i] = strdup(src[i]);
+    return dst;
+}
+static int compare_header(bcf_hdr_t *hdr, char **a, int na, char **b, int nb)
+{
+    if ( na!=nb ) return na-nb;
+    int i;
+    for (i=0; i<na; i++)
+        if ( strcmp(a[i],b[i]) ) return 1;
+    return 0;
+}
+
+
+static void usage(void)
+{
+    fprintf(stderr, "\n");
+    fprintf(stderr, "About:   Extracts fields from VCF/BCF file and prints them in user-defined format\n");
+    fprintf(stderr, "Usage:   bcftools query [options] <A.vcf.gz> [<B.vcf.gz> [...]]\n");
+    fprintf(stderr, "\n");
+    fprintf(stderr, "Options:\n");
+    fprintf(stderr, "    -c, --collapse <string>           collapse lines with duplicate positions for <snps|indels|both|all|some|none>, see man page [none]\n");
+    fprintf(stderr, "    -e, --exclude <expr>              exclude sites for which the expression is true (see man page for details)\n");
+    fprintf(stderr, "    -f, --format <string>             see man page for details\n");
+    fprintf(stderr, "    -H, --print-header                print header\n");
+    fprintf(stderr, "    -i, --include <expr>              select sites for which the expression is true (see man page for details)\n");
+    fprintf(stderr, "    -l, --list-samples                print the list of samples and exit\n");
+    fprintf(stderr, "    -o, --output-file <file>          output file name [stdout]\n");
+    fprintf(stderr, "    -r, --regions <region>            restrict to comma-separated list of regions\n");
+    fprintf(stderr, "    -R, --regions-file <file>         restrict to regions listed in a file\n");
+    fprintf(stderr, "    -s, --samples <list>              list of samples to include\n");
+    fprintf(stderr, "    -S, --samples-file <file>         file of samples to include\n");
+    fprintf(stderr, "    -t, --targets <region>            similar to -r but streams rather than index-jumps\n");
+    fprintf(stderr, "    -T, --targets-file <file>         similar to -R but streams rather than index-jumps\n");
+    fprintf(stderr, "    -v, --vcf-list <file>             process multiple VCFs listed in the file\n");
+    fprintf(stderr, "\n");
+    fprintf(stderr, "Examples:\n");
+    fprintf(stderr, "\tbcftools query -f '%%CHROM\\t%%POS\\t%%REF\\t%%ALT[\\t%%SAMPLE=%%GT]\\n' file.vcf.gz\n");
+    fprintf(stderr, "\n");
+    exit(1);
+}
+
+int main_vcfquery(int argc, char *argv[])
+{
+    int c, collapse = 0;
+    args_t *args = (args_t*) calloc(1,sizeof(args_t));
+    args->argc   = argc; args->argv = argv;
+    int regions_is_file = 0, targets_is_file = 0;
+
+    static struct option loptions[] =
+    {
+        {"help",0,0,'h'},
+        {"list-samples",0,0,'l'},
+        {"include",1,0,'i'},
+        {"exclude",1,0,'e'},
+        {"format",1,0,'f'},
+        {"output-file",1,0,'o'},
+        {"regions",1,0,'r'},
+        {"regions-file",1,0,'R'},
+        {"targets",1,0,'t'},
+        {"targets-file",1,0,'T'},
+        {"annots",1,0,'a'},
+        {"samples",1,0,'s'},
+        {"samples-file",1,0,'S'},
+        {"print-header",0,0,'H'},
+        {"collapse",1,0,'c'},
+        {"vcf-list",1,0,'v'},
+        {0,0,0,0}
+    };
+    while ((c = getopt_long(argc, argv, "hlr:R:f:a:s:S:Ht:T:c:v:i:e:o:",loptions,NULL)) >= 0) {
+        switch (c) {
+            case 'o': args->fn_out = optarg; break;
+            case 'f': args->format_str = strdup(optarg); break;
+            case 'H': args->print_header = 1; break;
+            case 'v': args->vcf_list = optarg; break;
+            case 'c':
+                if ( !strcmp(optarg,"snps") ) collapse |= COLLAPSE_SNPS;
+                else if ( !strcmp(optarg,"indels") ) collapse |= COLLAPSE_INDELS;
+                else if ( !strcmp(optarg,"both") ) collapse |= COLLAPSE_SNPS | COLLAPSE_INDELS;
+                else if ( !strcmp(optarg,"any") ) collapse |= COLLAPSE_ANY;
+                else if ( !strcmp(optarg,"all") ) collapse |= COLLAPSE_ANY;
+                else if ( !strcmp(optarg,"some") ) args->files->collapse |= COLLAPSE_SOME;
+                else error("The --collapse string \"%s\" not recognised.\n", optarg);
+                break;
+            case 'a':
+                {
+                    kstring_t str = {0,0,0};
+                    kputs("%CHROM\t%POS\t%MASK\t%REF\t%ALT\t%", &str);
+                    char *p = optarg;
+                    while ( *p )
+                    {
+                        if ( *p==',' )
+                            kputs("\t%", &str);
+                        else
+                            kputc(*p, &str);
+                        p++;
+                    }
+                    kputc('\n', &str);
+                    args->format_str = str.s;
+                    break;
+                }
+            case 'e': args->filter_str = optarg; args->filter_logic |= FLT_EXCLUDE; break;
+            case 'i': args->filter_str = optarg; args->filter_logic |= FLT_INCLUDE; break;
+            case 'r': args->regions_list = optarg; break;
+            case 'R': args->regions_list = optarg; regions_is_file = 1; break;
+            case 't': args->targets_list = optarg; break;
+            case 'T': args->targets_list = optarg; targets_is_file = 1; break;
+            case 'l': args->list_columns = 1; break;
+            case 's': args->sample_list = optarg; break;
+            case 'S': args->sample_list = optarg; args->sample_is_file = 1; break;
+            case 'h':
+            case '?': usage();
+            default: error("Unknown argument: %s\n", optarg);
+        }
+    }
+
+    char *fname = NULL;
+    if ( optind>=argc )
+    {
+        if ( !isatty(fileno((FILE *)stdin)) ) fname = "-";
+    }
+    else fname = argv[optind];
+
+    if ( args->list_columns )
+    {
+        if ( !fname ) error("Missing the VCF file name\n");
+        args->files = bcf_sr_init();
+        if ( !bcf_sr_add_reader(args->files, fname) ) error("Failed to open %s: %s\n", fname,bcf_sr_strerror(args->files->errnum));
+        list_columns(args);
+        bcf_sr_destroy(args->files);
+        free(args);
+        return 0;
+    }
+
+    if ( !args->format_str ) usage();
+    args->out = args->fn_out ? fopen(args->fn_out, "w") : stdout;
+    if ( !args->out ) error("%s: %s\n", args->fn_out,strerror(errno));
+
+    if ( !args->vcf_list )
+    {
+        if ( !fname ) usage();
+        args->files = bcf_sr_init();
+        args->files->collapse = collapse;
+        if ( optind+1 < argc ) args->files->require_index = 1;
+        if ( args->regions_list && bcf_sr_set_regions(args->files, args->regions_list, regions_is_file)<0 )
+            error("Failed to read the regions: %s\n", args->regions_list);
+        if ( args->targets_list )
+        {
+            if ( bcf_sr_set_targets(args->files, args->targets_list, targets_is_file, 0)<0 )
+                error("Failed to read the targets: %s\n", args->targets_list);
+        }
+        while ( fname )
+        {
+            if ( !bcf_sr_add_reader(args->files, fname) ) error("Failed to open %s: %s\n", fname,bcf_sr_strerror(args->files->errnum));
+            fname = ++optind < argc ? argv[optind] : NULL;
+        }
+        init_data(args);
+        query_vcf(args);
+        free(args->format_str);
+        destroy_data(args);
+        bcf_sr_destroy(args->files);
+        fclose(args->out);
+        free(args);
+        return 0;
+    }
+
+    // multiple VCFs
+    int i, k, nfiles, prev_nsamples = 0;
+    char **fnames, **prev_samples = NULL;
+    fnames = hts_readlist(args->vcf_list, 1, &nfiles);
+    if ( !nfiles ) error("No files in %s?\n", args->vcf_list);
+    for (i=0; i<nfiles; i++)
+    {
+        args->files = bcf_sr_init();
+        args->files->collapse = collapse;
+        if ( args->regions_list && bcf_sr_set_regions(args->files, args->regions_list, regions_is_file)<0 )
+            error("Failed to read the regions: %s\n", args->regions_list);
+        if ( optind < argc ) args->files->require_index = 1;
+        if ( args->targets_list )
+        {
+            if ( bcf_sr_set_targets(args->files, args->targets_list,targets_is_file, 0)<0 )
+                error("Failed to read the targets: %s\n", args->targets_list);
+        }
+        if ( !bcf_sr_add_reader(args->files, fnames[i]) ) error("Failed to open %s: %s\n", fnames[i],bcf_sr_strerror(args->files->errnum));
+        for (k=optind; k<argc; k++)
+            if ( !bcf_sr_add_reader(args->files, argv[k]) ) error("Failed to open %s: %s\n", argv[k],bcf_sr_strerror(args->files->errnum));
+        init_data(args);
+        if ( i==0 )
+            prev_samples = copy_header(args->header, args->files->readers[0].header->samples, bcf_hdr_nsamples(args->files->readers[0].header));
+        else
+        {
+            args->print_header = 0;
+            if ( compare_header(args->header, args->files->readers[0].header->samples, bcf_hdr_nsamples(args->files->readers[0].header), prev_samples, prev_nsamples) )
+                error("Different samples in %s and %s\n", fnames[i-1],fnames[i]);
+        }
+        query_vcf(args);
+        destroy_data(args);
+        bcf_sr_destroy(args->files);
+    }
+    fclose(args->out);
+    destroy_list(fnames, nfiles);
+    destroy_list(prev_samples, prev_nsamples);
+    free(args->format_str);
+    free(args);
+    return 0;
+}
+
+
diff --git a/vcfroh.c b/vcfroh.c
new file mode 100644
index 0000000..6ab2fc0
--- /dev/null
+++ b/vcfroh.c
@@ -0,0 +1,775 @@
+/*  vcfroh.c -- HMM model for detecting runs of autozygosity.
+
+    Copyright (C) 2013-2014 Genome Research Ltd.
+
+    Author: Petr Danecek <pd3 at sanger.ac.uk>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.  */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <getopt.h>
+#include <math.h>
+#include <htslib/vcf.h>
+#include <htslib/synced_bcf_reader.h>
+#include <htslib/kstring.h>
+#include <htslib/kseq.h>
+#include "bcftools.h"
+#include "HMM.h"
+
+#define STATE_HW 0        // normal state, follows Hardy-Weinberg allele frequencies
+#define STATE_AZ 1        // autozygous state
+
+/** Genetic map */
+typedef struct
+{
+    int pos;
+    double rate;
+}
+genmap_t;
+
+typedef struct _args_t
+{
+    bcf_srs_t *files;
+    bcf_hdr_t *hdr;
+    double t2AZ, t2HW;      // P(AZ|HW) and P(HW|AZ) parameters
+    double unseen_PL;
+
+    char *genmap_fname;
+    genmap_t *genmap;
+    int ngenmap, mgenmap, igenmap;
+    double rec_rate;        // constant recombination rate if > 0
+
+    hmm_t *hmm;
+    double *eprob;          // emission probs [2*nsites,msites]
+    uint32_t *sites;        // positions [nsites,msites]
+    int nsites, msites;
+    int nrids, *rids, *rid_offs;    // multiple chroms with vi_training
+
+    int32_t *itmp;
+    int nitmp, mitmp;
+    float *AFs;
+    int mAFs;
+
+    double pl2p[256], *pdg;
+    int32_t skip_rid, prev_rid, prev_pos;
+
+    int ntot, nused;            // some stats to detect if things didn't go awfully wrong
+    int ismpl, nsmpl;           // index of query sample
+    char *estimate_AF, *sample; // list of samples for AF estimate and query sample
+    char **argv, *targets_list, *regions_list, *af_fname, *af_tag;
+    int argc, fake_PLs, snps_only, vi_training;
+}
+args_t;
+
+void set_tprob_genmap(hmm_t *hmm, uint32_t prev_pos, uint32_t pos, void *data);
+void set_tprob_recrate(hmm_t *hmm, uint32_t prev_pos, uint32_t pos, void *data);
+
+void *smalloc(size_t size)
+{
+    void *mem = malloc(size);
+    if ( !mem ) error("malloc: Could not allocate %d bytes\n", (int)size);
+    return mem;
+}
+
+static void init_data(args_t *args)
+{
+    args->prev_rid = args->skip_rid = -1;
+    args->hdr = args->files->readers[0].header;
+
+    if ( !args->sample )
+    {
+        if ( bcf_hdr_nsamples(args->hdr)>1 ) error("Missing the option -s, --sample\n");
+        args->sample = strdup(args->hdr->samples[0]);
+    }
+    if ( !bcf_hdr_nsamples(args->hdr) ) error("No samples in the VCF?\n");
+
+    // Set samples
+    kstring_t str = {0,0,0};
+    if ( args->estimate_AF && strcmp("-",args->estimate_AF) )
+    {
+        int i, n;
+        char **smpls = hts_readlist(args->estimate_AF, 1, &n);
+
+        // Make sure the query sample is included
+        for (i=0; i<n; i++)
+            if ( !strcmp(args->sample,smpls[i]) ) break;
+
+        // Add the query sample if not present
+        if ( i!=n ) kputs(args->sample, &str);
+
+        for (i=0; i<n; i++)
+        {
+            if ( str.l ) kputc(',', &str);
+            kputs(smpls[i], &str);
+            free(smpls[i]);
+        }
+        free(smpls);
+    }
+    else
+        kputs(args->sample, &str);
+
+    int ret = bcf_hdr_set_samples(args->hdr, str.s, 0);
+    if ( ret<0 ) error("Error parsing the list of samples: %s\n", str.s);
+    else if ( ret>0 ) error("The %d-th sample not found in the VCF\n", ret);
+
+    if ( args->af_tag )
+        if ( !bcf_hdr_idinfo_exists(args->hdr,BCF_HL_INFO,bcf_hdr_id2int(args->hdr,BCF_DT_ID,args->af_tag)) )
+            error("No such INFO tag in the VCF: %s\n", args->af_tag);
+
+    if ( !bcf_sr_set_samples(args->files, str.s, 0) )
+        error("Error: could not set the samples %s\n", str.s);
+    args->nsmpl = args->files->n_smpl;
+    args->ismpl = bcf_hdr_id2int(args->hdr, BCF_DT_SAMPLE, args->sample);
+    free(str.s);
+
+    int i;
+    for (i=0; i<256; i++) args->pl2p[i] = pow(10., -i/10.);
+
+    // Init transition matrix and HMM
+    double tprob[4];
+    MAT(tprob,2,STATE_HW,STATE_HW) = 1 - args->t2AZ;
+    MAT(tprob,2,STATE_HW,STATE_AZ) = args->t2HW;
+    MAT(tprob,2,STATE_AZ,STATE_HW) = args->t2AZ;
+    MAT(tprob,2,STATE_AZ,STATE_AZ) = 1 - args->t2HW; 
+
+    if ( args->genmap_fname ) 
+    {
+        args->hmm = hmm_init(2, tprob, 0);
+        hmm_set_tprob_func(args->hmm, set_tprob_genmap, args);
+    }
+    else if ( args->rec_rate > 0 )
+    {
+        args->hmm = hmm_init(2, tprob, 0);
+        hmm_set_tprob_func(args->hmm, set_tprob_recrate, args);
+
+    }
+    else
+        args->hmm = hmm_init(2, tprob, 10000);
+
+    // print header
+    printf("# This file was produced by: bcftools roh(%s+htslib-%s)\n", bcftools_version(),hts_version());
+    printf("# The command line was:\tbcftools %s", args->argv[0]);
+    for (i=1; i<args->argc; i++)
+        printf(" %s",args->argv[i]);
+    printf("\n#\n");
+    printf("# [1]Chromosome\t[2]Position\t[3]State (0:HW, 1:AZ)\t[4]Quality\n");
+}
+
+static void destroy_data(args_t *args)
+{
+    free(args->sites);
+    free(args->eprob);
+    free(args->sample);
+    free(args->rids);
+    free(args->rid_offs);
+    hmm_destroy(args->hmm);
+    bcf_sr_destroy(args->files);
+    free(args->itmp); free(args->AFs); free(args->pdg);
+    free(args->genmap);
+}
+
+static int load_genmap(args_t *args, bcf1_t *line)
+{
+    if ( !args->genmap_fname ) { args->ngenmap = 0; return 0; }
+
+    kstring_t str = {0,0,0};
+    char *fname = strstr(args->genmap_fname,"{CHROM}");
+    if ( fname )
+    {
+        kputsn(args->genmap_fname, fname - args->genmap_fname, &str);
+        kputs(bcf_seqname(args->hdr,line), &str);
+        kputs(fname+7,&str);
+        fname = str.s;
+    }
+    else
+        fname = args->genmap_fname;
+
+    htsFile *fp = hts_open(fname, "rb");
+    if ( !fp )
+    {
+        args->ngenmap = 0;
+        return -1;
+    }
+
+    hts_getline(fp, KS_SEP_LINE, &str);
+    if ( strcmp(str.s,"position COMBINED_rate(cM/Mb) Genetic_Map(cM)") )
+        error("Unexpected header, found:\n\t[%s], but expected:\n\t[position COMBINED_rate(cM/Mb) Genetic_Map(cM)]\n", fname, str.s);
+
+    args->ngenmap = args->igenmap = 0;
+    while ( hts_getline(fp, KS_SEP_LINE, &str) > 0 )
+    {
+        args->ngenmap++;
+        hts_expand(genmap_t,args->ngenmap,args->mgenmap,args->genmap);
+        genmap_t *gm = &args->genmap[args->ngenmap-1];
+
+        char *tmp, *end;
+        gm->pos = strtol(str.s, &tmp, 10);
+        if ( str.s==tmp ) error("Could not parse %s: %s\n", fname, str.s);
+
+        // skip second column
+        tmp++;
+        while ( *tmp && !isspace(*tmp) ) tmp++;
+
+        // read the genetic map in cM
+        gm->rate = strtod(tmp+1, &end);
+        if ( tmp+1==end ) error("Could not parse %s: %s\n", fname, str.s);
+    }
+    if ( !args->ngenmap ) error("Genetic map empty?\n");
+    int i;
+    for (i=0; i<args->ngenmap; i++) args->genmap[i].rate /= args->genmap[args->ngenmap-1].rate; // scale to 1
+    if ( hts_close(fp) ) error("Close failed\n");
+    free(str.s);
+    return 0;
+}
+
+static double get_genmap_rate(args_t *args, int start, int end)
+{
+    // position i to be equal to or smaller than start
+    int i = args->igenmap;
+    if ( args->genmap[i].pos > start )
+    {
+        while ( i>0 && args->genmap[i].pos > start ) i--;
+    }
+    else
+    {
+        while ( i+1<args->ngenmap && args->genmap[i+1].pos < start ) i++;
+    }
+    // position j to be equal or larger than end
+    int j = i;
+    while ( j+1<args->ngenmap && args->genmap[j].pos < end ) j++;
+
+    if ( i==j )
+    {
+        args->igenmap = i;
+        return 0;
+    }
+
+    if ( start <  args->genmap[i].pos ) start = args->genmap[i].pos;
+    if ( end >  args->genmap[j].pos ) end = args->genmap[j].pos;
+    double rate = (args->genmap[j].rate - args->genmap[i].rate)/(args->genmap[j].pos - args->genmap[i].pos) * (end-start);
+    args->igenmap = j;
+    return rate;
+}
+
+void set_tprob_genmap(hmm_t *hmm, uint32_t prev_pos, uint32_t pos, void *data)
+{
+    args_t *args = (args_t*) data;
+    double ci = get_genmap_rate(args, pos - prev_pos, pos);
+    MAT(hmm->curr_tprob,2,STATE_HW,STATE_HW) *= 1-ci;
+    MAT(hmm->curr_tprob,2,STATE_HW,STATE_AZ) *= ci;
+    MAT(hmm->curr_tprob,2,STATE_AZ,STATE_HW) *= ci;
+    MAT(hmm->curr_tprob,2,STATE_AZ,STATE_AZ) *= 1-ci;
+}
+
+void set_tprob_recrate(hmm_t *hmm, uint32_t prev_pos, uint32_t pos, void *data)
+{
+    args_t *args = (args_t*) data;
+    double ci = (pos - prev_pos) * args->rec_rate;
+    MAT(hmm->curr_tprob,2,STATE_HW,STATE_HW) *= 1-ci;
+    MAT(hmm->curr_tprob,2,STATE_HW,STATE_AZ) *= ci;
+    MAT(hmm->curr_tprob,2,STATE_AZ,STATE_HW) *= ci;
+    MAT(hmm->curr_tprob,2,STATE_AZ,STATE_AZ) *= 1-ci;
+}
+
+
+/**
+ *  This function implements the HMM model:
+ *    D = Data, AZ = autozygosity, HW = Hardy-Weinberg (non-autozygosity),
+ *    f = non-ref allele frequency
+ *
+ *  Emission probabilities:
+ *    oAZ = P_i(D|AZ) = (1-f)*P(D|RR) + f*P(D|AA)
+ *    oHW = P_i(D|HW) = (1-f)^2 * P(D|RR) + f^2 * P(D|AA) + 2*f*(1-f)*P(D|RA)
+ *
+ *  Transition probabilities:
+ *    tAZ = P(AZ|HW)  .. parameter
+ *    tHW = P(HW|AZ)  .. parameter
+ *    P(AZ|AZ) = 1 - P(HW|AZ) = 1 - tHW
+ *    P(HW|HW) = 1 - P(AZ|HW) = 1 - tAZ
+ *
+ *    ci  = P_i(C)    .. probability of cross-over at site i, from genetic map
+ *
+ *    AZi = P_i(AZ)   .. probability of site i being AZ/non-AZ, scaled so that AZi+HWi = 1
+ *    HWi = P_i(HW)
+ *
+ *    P_i(AZ|AZ) = P(AZ|AZ) * (1-ci) * AZ{i-1} = (1-tHW) * (1-ci) * AZ{i-1}
+ *    P_i(AZ|HW) = P(AZ|HW) * ci * HW{i-1}     = tAZ * ci * (1 - AZ{i-1})
+ *
+ *    P_i(HW|HW) = P(HW|HW) * (1-ci) * HW{i-1} = (1-tAZ) * (1-ci) * (1 - AZ{i-1})
+ *    P_i(HW|AZ) = P(HW|AZ) * ci * AZ{i-1}     = tHW * ci * AZ{i-1}
+ */
+
+static void flush_viterbi(args_t *args)
+{
+    int i,j;
+
+    if ( !args->nsites ) return; 
+
+    if ( !args->vi_training )
+    {
+        // single viterbi pass, one chromsome
+        hmm_run_viterbi(args->hmm, args->nsites, args->eprob, args->sites);
+
+        const char *chr = bcf_hdr_id2name(args->hdr,args->prev_rid);
+        for (i=0; i<args->nsites; i++)
+        {
+            printf("%s\t%d\t%d\t..\n", chr,args->sites[i]+1,args->hmm->vpath[i*2]==STATE_AZ ? 1 : 0);
+        }
+        return;
+    }
+
+    // viterbi training, multiple chromosomes
+    double t2az_prev, t2hw_prev;
+    double deltaz, delthw;
+    int niter = 0;
+    do
+    {
+        t2az_prev = MAT(args->hmm->tprob_arr,2,1,0); //args->t2AZ;
+        t2hw_prev = MAT(args->hmm->tprob_arr,2,0,1); //args->t2HW;
+        double tcounts[] = { 0,0,0,0 };
+        for (i=0; i<args->nrids; i++)
+        {
+            // run viterbi for each chromosomes. eprob and sites contain
+            // multiple chromosomes, rid_offs mark the boundaries
+            int ioff = args->rid_offs[i];
+            int nsites = (i+1==args->nrids ? args->nsites : args->rid_offs[i+1]) - ioff;
+            hmm_run_viterbi(args->hmm, nsites, args->eprob+ioff*2, args->sites+ioff);
+
+            // what transitions were observed: add to the total counts
+            for (j=1; j<nsites; j++)
+            {
+                // count the number of transitions
+                int prev_state = args->hmm->vpath[2*(j-1)];
+                int curr_state = args->hmm->vpath[2*j];
+                MAT(tcounts,2,curr_state,prev_state) += 1;
+            }
+        }
+
+        // update the transition matrix tprob
+        for (i=0; i<2; i++)
+        {
+            int n = 0;
+            for (j=0; j<2; j++) n += MAT(tcounts,2,i,j);
+            error("fixme: state %d not observed\n", i+1);
+            for (j=0; j<2; j++) MAT(tcounts,2,i,j) /= n;
+        }
+        if ( args->genmap_fname || args->rec_rate > 0 )
+            hmm_set_tprob(args->hmm, tcounts, 0);
+        else
+            hmm_set_tprob(args->hmm, tcounts, 10000);
+
+        deltaz = fabs(MAT(args->hmm->tprob_arr,2,1,0)-t2az_prev);
+        delthw = fabs(MAT(args->hmm->tprob_arr,2,0,1)-t2hw_prev);
+        niter++;
+
+        fprintf(stderr,"%d: %f %f\n", niter,deltaz,delthw);
+    }
+    while ( deltaz > 0.0 || delthw > 0.0 );
+    fprintf(stderr, "Viterbi training converged in %d iterations to", niter);
+    for (i=0; i<2; i++) for (j=0; j<2; j++) fprintf(stderr, " %f", MAT(args->hmm->tprob_arr,2,i,j));
+    fprintf(stderr, "\n");
+    
+    // output the results
+    for (i=0; i<args->nrids; i++)
+    {
+        int ioff = args->rid_offs[i];
+        int nsites = (i+1==args->nrids ? args->nsites : args->rid_offs[i+1]) - ioff;
+        hmm_run_viterbi(args->hmm, nsites, args->eprob+ioff*2, args->sites+ioff);
+
+        const char *chr = bcf_hdr_id2name(args->hdr,args->rids[i]);
+        for (j=0; j<nsites; j++)
+        {
+            printf("%s\t%d\t%d\t..\n", chr,args->sites[ioff+j]+1,args->hmm->vpath[j*2]==STATE_AZ ? 1 : 0);
+        }
+    }
+}
+
+static void push_rid(args_t *args, int rid)
+{
+    args->nrids++;
+    args->rids = (int*) realloc(args->rids, args->nrids*sizeof(int));
+    args->rid_offs = (int*) realloc(args->rid_offs, args->nrids*sizeof(int));
+    args->rids[ args->nrids-1 ] = rid;
+    args->rid_offs[ args->nrids-1 ] = args->nsites;
+}
+
+int read_AF(bcf_sr_regions_t *tgt, bcf1_t *line, double *alt_freq)
+{
+    if ( tgt->nals != line->n_allele ) return -1;    // number of alleles does not match
+
+    int i;
+    for (i=0; i<tgt->nals; i++)
+        if ( strcmp(line->d.allele[i],tgt->als[i]) ) break; // we could be smarter, see vcmp
+    if ( i<tgt->nals ) return -1;
+
+    char *tmp, *str = tgt->line.s;
+    i = 0;
+    while ( *str && i<3 ) 
+    {
+        if ( *str=='\t' ) i++;
+        str++;
+    }
+    *alt_freq = strtod(str, &tmp);
+    if ( *tmp && !isspace(*tmp) )
+    {
+        if ( str[0]=='.' && (!str[1] || isspace(str[1])) ) return -1; // missing value
+        error("Could not parse: [%s]\n", tgt->line.s);
+    }
+    if ( *alt_freq<0 || *alt_freq>1 ) error("Could not parse AF: [%s]\n", tgt->line.s);
+    return 0;
+}
+
+int estimate_AF(args_t *args, bcf1_t *line, double *alt_freq)
+{
+    if ( !args->nitmp )
+    {
+        args->nitmp = bcf_get_genotypes(args->hdr, line, &args->itmp, &args->mitmp);
+        if ( args->nitmp != 2*args->nsmpl ) return -1;     // not diploid?
+        args->nitmp /= args->nsmpl;
+    }
+
+    int i, nalt = 0, nref = 0;
+    for (i=0; i<args->nsmpl; i++)
+    {
+        int32_t *gt = &args->itmp[i*args->nitmp];
+
+        if ( bcf_gt_is_missing(gt[0]) || bcf_gt_is_missing(gt[1]) ) continue;
+
+        if ( bcf_gt_allele(gt[0]) ) nalt++;
+        else nref++;
+
+        if ( bcf_gt_allele(gt[1]) ) nalt++;
+        else nref++;
+    }
+    if ( !nalt && !nref ) return -1;
+
+    *alt_freq = (double)nalt / (nalt + nref);
+    return 0;
+}
+
+
+int parse_line(args_t *args, bcf1_t *line, double *alt_freq, double *pdg)
+{
+    args->nitmp = 0;
+
+    // Set allele frequency
+    int ret;
+    if ( args->af_tag )
+    {
+        // Use an INFO tag provided by the user
+        ret = bcf_get_info_float(args->hdr, line, args->af_tag, &args->AFs, &args->mAFs);
+        if ( ret==1 )
+            *alt_freq = args->AFs[0];
+        if ( ret==-2 )
+            error("Type mismatch for INFO/%s tag at %s:%d\n", args->af_tag, bcf_seqname(args->hdr,line), line->pos+1);
+    }
+    else if ( args->af_fname ) 
+    {
+        // Read AF from a file
+        ret = read_AF(args->files->targets, line, alt_freq);
+    }
+    else
+    {
+        // Use GTs or AC/AN: GTs when AC/AN not present or when GTs explicitly requested by --estimate-AF
+        ret = -1;
+        if ( !args->estimate_AF )
+        {
+            int AC = -1, AN = 0;
+            ret = bcf_get_info_int32(args->hdr, line, "AN", &args->itmp, &args->mitmp);
+            if ( ret==1 )
+            {
+                AN = args->itmp[0];
+                ret = bcf_get_info_int32(args->hdr, line, "AC", &args->itmp, &args->mitmp);
+                if ( ret>0 )
+                    AC = args->itmp[0];
+            }
+            if ( AN<=0 || AC<0 ) 
+                ret = -1;
+            else 
+                *alt_freq = (double) AC/AN;
+        }
+        if ( ret==-1 )
+            ret = estimate_AF(args, line, alt_freq);    // reads GTs into args->itmp
+    }
+
+    if ( ret<0 ) return ret;
+
+
+    // Set P(D|G)
+    if ( args->fake_PLs )
+    {
+        if ( !args->nitmp )
+        {
+            args->nitmp = bcf_get_genotypes(args->hdr, line, &args->itmp, &args->mitmp);
+            if ( args->nitmp != 2*args->nsmpl ) return -1;     // not diploid?
+            args->nitmp /= args->nsmpl;
+        }
+
+        int32_t *gt = &args->itmp[args->ismpl*args->nitmp];
+        if ( bcf_gt_is_missing(gt[0]) || bcf_gt_is_missing(gt[1]) ) return -1;
+
+        int a = bcf_gt_allele(gt[0]);
+        int b = bcf_gt_allele(gt[1]);
+        if ( a!=b )
+        {
+            pdg[0] = pdg[2] = args->unseen_PL;
+            pdg[1] = 1 - 2*args->unseen_PL;
+        }
+        else if ( a==0 )
+        {
+            pdg[0] = 1 - 2*args->unseen_PL;
+            pdg[1] = pdg[2] = args->unseen_PL;
+        }
+        else
+        {
+            pdg[0] = pdg[1] = args->unseen_PL;
+            pdg[2] = 1 - 2*args->unseen_PL;
+        }
+    }
+    else
+    {
+        args->nitmp = bcf_get_format_int32(args->hdr, line, "PL", &args->itmp, &args->mitmp);
+        if ( args->nitmp != args->nsmpl*line->n_allele*(line->n_allele+1)/2. ) return -1;     // not diploid?
+        args->nitmp /= args->nsmpl;
+
+        int32_t *pl = &args->itmp[args->ismpl*args->nitmp];
+        pdg[0] = pl[0] < 256 ? args->pl2p[ pl[0] ] : 1.0;
+        pdg[1] = pl[1] < 256 ? args->pl2p[ pl[1] ] : 1.0;
+        pdg[2] = pl[2] < 256 ? args->pl2p[ pl[2] ] : 1.0;
+
+        double sum = pdg[0] + pdg[1] + pdg[2];
+        if ( !sum ) return -1;
+        pdg[0] /= sum;
+        pdg[1] /= sum;
+        pdg[2] /= sum;
+    }
+
+    return 0;
+}
+
+static void vcfroh(args_t *args, bcf1_t *line)
+{
+    // Are we done?
+    if ( !line )
+    { 
+        flush_viterbi(args);
+        return; 
+    }
+    args->ntot++;
+
+    // Skip unwanted lines
+    if ( line->rid == args->skip_rid ) return;
+    if ( line->n_allele==1 ) return;    // no ALT allele
+    if ( line->n_allele!=2 ) return;    // only biallelic sites
+    if ( args->snps_only && !bcf_is_snp(line) ) return;
+
+    // Initialize genetic map
+    int skip_rid = 0;
+    if ( args->prev_rid<0 )
+    {
+        args->prev_rid = line->rid;
+        args->prev_pos = line->pos;
+        skip_rid = load_genmap(args, line);
+        if ( !skip_rid && args->vi_training ) push_rid(args, line->rid);
+    }
+
+    // New chromosome?
+    if ( args->prev_rid!=line->rid )
+    {
+        skip_rid = load_genmap(args, line);
+        if ( args->vi_training )
+        {
+            if ( !skip_rid ) push_rid(args, line->rid);
+        }
+        else
+        {
+            flush_viterbi(args);
+            args->nsites = 0;
+        }
+        args->prev_rid = line->rid;
+        args->prev_pos = line->pos;
+    }
+
+    if ( skip_rid )
+    {
+        fprintf(stderr,"Skipping the sequence, no genmap for %s\n", bcf_seqname(args->hdr,line));
+        args->skip_rid = line->rid;
+        return;
+    }
+    if ( args->prev_pos > line->pos ) error("The file is not sorted?!\n");
+
+    args->prev_rid = line->rid;
+    args->prev_pos = line->pos;
+
+
+    // Ready for the new site
+    int m = args->msites;
+    hts_expand(uint32_t,args->nsites+1,args->msites,args->sites);
+    if ( args->msites!=m )
+        args->eprob = (double*) realloc(args->eprob,sizeof(double)*args->msites*2);
+
+    // Set likelihoods and alternate allele frequencies
+    double alt_freq, pdg[3];
+    if ( parse_line(args, line, &alt_freq, pdg)<0 ) return; // something went wrong
+
+    args->nused++;
+
+    // Calculate emission probabilities P(D|AZ) and P(D|HW)
+    double *eprob = &args->eprob[2*args->nsites];
+    eprob[STATE_AZ] = pdg[0]*(1-alt_freq) + pdg[2]*alt_freq;
+    eprob[STATE_HW] = pdg[0]*(1-alt_freq)*(1-alt_freq) + 2*pdg[1]*(1-alt_freq)*alt_freq + pdg[2]*alt_freq*alt_freq;
+
+    args->sites[args->nsites] = line->pos;
+    args->nsites++;
+}
+
+static void usage(args_t *args)
+{
+    fprintf(stderr, "\n");
+    fprintf(stderr, "About:   HMM model for detecting runs of autozygosity.\n");
+    fprintf(stderr, "Usage:   bcftools roh [options] <in.vcf.gz>\n");
+    fprintf(stderr, "\n");
+    fprintf(stderr, "General Options:\n");
+    fprintf(stderr, "        --AF-tag <TAG>                 use TAG for allele frequency\n");
+    fprintf(stderr, "        --AF-file <file>               read allele frequencies from file (CHR\\tPOS\\tREF,ALT\\tAF)\n");
+    fprintf(stderr, "    -e, --estimate-AF <file>           calculate AC,AN counts on the fly, using either all samples (\"-\") or samples listed in <file>\n");
+    fprintf(stderr, "    -G, --GTs-only <float>             use GTs, ignore PLs, use <float> for PL of unseen genotypes. Safe value to use is 30 to account for GT errors.\n");
+    fprintf(stderr, "    -I, --skip-indels                  skip indels as their genotypes are enriched for errors\n");
+    fprintf(stderr, "    -m, --genetic-map <file>           genetic map in IMPUTE2 format, single file or mask, where string \"{CHROM}\" is replaced with chromosome name\n");
+    fprintf(stderr, "    -M, --rec-rate <float>             constant recombination rate per bp\n");
+    fprintf(stderr, "    -r, --regions <region>             restrict to comma-separated list of regions\n");
+    fprintf(stderr, "    -R, --regions-file <file>          restrict to regions listed in a file\n");
+    fprintf(stderr, "    -s, --sample <sample>              sample to analyze\n");
+    fprintf(stderr, "    -t, --targets <region>             similar to -r but streams rather than index-jumps\n");
+    fprintf(stderr, "    -T, --targets-file <file>          similar to -R but streams rather than index-jumps\n");
+    fprintf(stderr, "\n");
+    fprintf(stderr, "HMM Options:\n");
+    fprintf(stderr, "    -a, --hw-to-az <float>             P(AZ|HW) transition probability from AZ (autozygous) to HW (Hardy-Weinberg) state [1e-8]\n");
+    fprintf(stderr, "    -H, --az-to-hw <float>             P(HW|AZ) transition probability from HW to AZ state [1e-7]\n");
+    fprintf(stderr, "    -V, --viterbi-training             perform Viterbi training to estimate transition probabilities\n");
+    fprintf(stderr, "\n");
+    exit(1);
+}
+
+int main_vcfroh(int argc, char *argv[])
+{
+    int c;
+    args_t *args  = (args_t*) calloc(1,sizeof(args_t));
+    args->argc    = argc; args->argv = argv;
+    args->files   = bcf_sr_init();
+    args->t2AZ    = 1e-1;
+    args->t2HW    = 1e-1;
+    args->rec_rate = 0;
+    int regions_is_file = 0, targets_is_file = 0;
+
+    static struct option loptions[] =
+    {
+        {"AF-tag",1,0,0},
+        {"AF-file",1,0,1},
+        {"estimate-AF",1,0,'e'},
+        {"GTs-only",1,0,'G'},
+        {"sample",1,0,'s'},
+        {"hw-to-az",1,0,'a'},
+        {"az-to-hw",1,0,'H'},
+        {"viterbi-training",0,0,'V'},
+        {"targets",1,0,'t'},
+        {"targets-file",1,0,'T'},
+        {"regions",1,0,'r'},
+        {"regions-file",1,0,'R'},
+        {"genetic-map",1,0,'m'},
+        {"rec-rate",1,0,'M'},
+        {"skip-indels",0,0,'I'},
+        {0,0,0,0}
+    };
+
+    int naf_opts = 0;
+    char *tmp;
+    while ((c = getopt_long(argc, argv, "h?r:R:t:T:H:a:s:m:M:G:Ia:e:V",loptions,NULL)) >= 0) {
+        switch (c) {
+            case 0: args->af_tag = optarg; naf_opts++; break;
+            case 1: args->af_fname = optarg; naf_opts++; break;
+            case 'e': args->estimate_AF = optarg; naf_opts++; break;
+            case 'I': args->snps_only = 1; break;
+            case 'G':
+                args->fake_PLs = 1; 
+                args->unseen_PL = strtod(optarg,&tmp);
+                if ( *tmp ) error("Could not parse: -G %s\n", optarg);
+                args->unseen_PL = pow(10,-args->unseen_PL/10.); 
+                break;
+            case 'm': args->genmap_fname = optarg; break;
+            case 'M':
+                args->rec_rate = strtod(optarg,&tmp);
+                if ( *tmp ) error("Could not parse: -M %s\n", optarg);
+                break;
+            case 's': args->sample = strdup(optarg); break;
+            case 'a':
+                args->t2AZ = strtod(optarg,&tmp);
+                if ( *tmp ) error("Could not parse: -a %s\n", optarg);
+                break;
+            case 'H':
+                args->t2HW = strtod(optarg,&tmp);
+                if ( *tmp ) error("Could not parse: -H %s\n", optarg);
+                break;
+            case 't': args->targets_list = optarg; break;
+            case 'T': args->targets_list = optarg; targets_is_file = 1; break;
+            case 'r': args->regions_list = optarg; break;
+            case 'R': args->regions_list = optarg; regions_is_file = 1; break;
+            case 'V': args->vi_training = 1; break;
+            case 'h': 
+            case '?': usage(args); break;
+            default: error("Unknown argument: %s\n", optarg);
+        }
+    }
+
+    if ( argc<optind+1 ) usage(args);
+    if ( args->t2AZ<0 || args->t2AZ>1 ) error("Error: The parameter --hw-to-az is not in [0,1]\n", args->t2AZ);
+    if ( args->t2HW<0 || args->t2HW>1 ) error("Error: The parameter --az-to-hw is not in [0,1]\n", args->t2HW);
+    if ( naf_opts>1 ) error("Error: The options --AF-tag, --AF-file and -e are mutually exclusive\n");
+    if ( args->af_fname && args->targets_list ) error("Error: The options --AF-file and -t are mutually exclusive\n");
+    if ( args->regions_list )
+    {
+        if ( bcf_sr_set_regions(args->files, args->regions_list, regions_is_file)<0 )
+            error("Failed to read the regions: %s\n", args->regions_list);
+    }
+    if ( args->targets_list )
+    {
+        if ( bcf_sr_set_targets(args->files, args->targets_list, targets_is_file, 0)<0 )
+            error("Failed to read the targets: %s\n", args->targets_list);
+    }
+    if ( args->af_fname )
+    {
+        if ( bcf_sr_set_targets(args->files, args->af_fname, 1, 3)<0 )
+            error("Failed to read the targets: %s\n", args->af_fname);
+    }
+    if ( !bcf_sr_add_reader(args->files, argv[optind]) ) error("Failed to open %s: %s\n", argv[optind],bcf_sr_strerror(args->files->errnum));
+
+    init_data(args);
+    while ( bcf_sr_next_line(args->files) )
+    {
+        vcfroh(args, args->files->readers[0].buffer[0]);
+    }
+    vcfroh(args, NULL);
+    fprintf(stderr,"Number of lines: total/processed: %d/%d\n", args->ntot,args->nused);
+    destroy_data(args);
+    free(args);
+    return 0;
+}
+
+
diff --git a/vcfsom.c b/vcfsom.c
new file mode 100644
index 0000000..03181e9
--- /dev/null
+++ b/vcfsom.c
@@ -0,0 +1,715 @@
+/*  vcfsom.c -- SOM (Self-Organizing Map) filtering.
+
+    Copyright (C) 2013-2014 Genome Research Ltd.
+
+    Author: Petr Danecek <pd3 at sanger.ac.uk>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.  */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <getopt.h>
+#include <ctype.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <math.h>
+#include <time.h>
+#include <htslib/vcf.h>
+#include <htslib/synced_bcf_reader.h>
+#include <htslib/vcfutils.h>
+#include <inttypes.h>
+#include "bcftools.h"
+
+#define SOM_TRAIN    1
+#define SOM_CLASSIFY 2
+
+typedef struct
+{
+    int ndim;       // dimension of the map (2D, 3D, ...)
+    int nbin;       // number of bins in th map
+    int size;       // pow(nbin,ndim)
+    int kdim;       // dimension of the input vectors
+    int nt, t;      // total number of learning cycles and the current cycle
+    double *w, *c;  // weights and counts (sum of learning influence)
+    double learn;   // learning rate
+    double bmu_th;  // best-matching unit threshold
+    int *a_idx, *b_idx; // temp arrays for traversing variable number of nested loops
+    double *div;        // dtto
+}
+som_t;
+
+typedef struct
+{
+    // SOM parameters
+    double bmu_th, learn;
+    int ndim, nbin, ntrain, t;
+    int nfold;                  // n-fold cross validation = the number of SOMs
+    som_t **som;
+
+    // annots reader's data
+    htsFile *file;              // reader
+    kstring_t str;              // temporary string for the reader
+    int dclass, mvals;
+    double *vals;
+
+    // training data
+    double *train_dat;
+    int *train_class, mtrain_class, mtrain_dat;
+
+    int rand_seed, good_class, bad_class;
+    char **argv, *fname, *prefix;
+    int argc, action, train_bad, merge;
+}
+args_t;
+
+static void usage(void);
+FILE *open_file(char **fname, const char *mode, const char *fmt, ...);
+void mkdir_p(const char *fmt, ...);
+
+char *msprintf(const char *fmt, ...)
+{
+    va_list ap;
+    va_start(ap, fmt);
+    int n = vsnprintf(NULL, 0, fmt, ap) + 2;
+    va_end(ap);
+
+    char *str = (char*)malloc(n);
+    va_start(ap, fmt);
+    vsnprintf(str, n, fmt, ap);
+    va_end(ap);
+
+    return str;
+}
+
+/*
+ *  char *t, *p = str;
+ *  t = column_next(p, '\t');
+ *  if ( strlen("<something>")==t-p && !strncmp(p,"<something>",t-p) ) printf("found!\n");
+ *
+ *  char *t;
+ *  t = column_next(str, '\t'); if ( !*t ) error("expected field\n", str);
+ *  t = column_next(t+1, '\t'); if ( !*t ) error("expected field\n", str);
+ */
+static inline char *column_next(char *start, char delim)
+{
+    char *end = start;
+    while (*end && *end!=delim) end++;
+    return end;
+}
+/**
+ *  annots_reader_next() - reads next line from annots.tab.gz and sets: class, vals
+ *   Returns 1 on successful read or 0 if no further record could be read.
+ */
+int annots_reader_next(args_t *args)
+{
+    args->str.l = 0;
+    if ( hts_getline(args->file,'\n',&args->str)<=0 ) return 0;
+
+    char *t, *line = args->str.s;
+
+    if ( !args->mvals )
+    {
+        t = line;
+        while ( *t )
+        {
+            if ( *t=='\t' ) args->mvals++;
+            t++;
+        }
+        args->vals = (double*) malloc(args->mvals*sizeof(double));
+    }
+
+    // class
+    args->dclass = atoi(line);
+    t = column_next(line, '\t');
+
+    // values
+    int i;
+    for (i=0; i<args->mvals; i++)
+    {
+        if ( !*t ) error("Could not parse %d-th data field: is the line truncated?\nThe line was: [%s]\n",i+2,line);
+        args->vals[i] = atof(++t);
+        t = column_next(t,'\t');
+    }
+    return 1;
+}
+void annots_reader_reset(args_t *args)
+{
+    if ( args->file ) hts_close(args->file);
+    if ( !args->fname ) error("annots_reader_reset: no fname\n");
+    args->file = hts_open(args->fname, "r");
+}
+void annots_reader_close(args_t *args)
+{
+    hts_close(args->file);
+}
+
+static void som_write_map(char *prefix, som_t **som, int nsom)
+{
+    FILE *fp = open_file(NULL,"w","%s.som",prefix);
+    fwrite("SOMv1",5,1,fp);
+    fwrite(&nsom,sizeof(int),1,fp);
+    int i;
+    for (i=0; i<nsom; i++)
+    {
+        fwrite(&som[i]->size,sizeof(int),1,fp);
+        fwrite(&som[i]->kdim,sizeof(int),1,fp);
+        fwrite(som[i]->w,sizeof(double),som[i]->size*som[i]->kdim,fp);
+        fwrite(som[i]->c,sizeof(double),som[i]->size,fp);
+    }
+    if ( fclose(fp) ) error("%s.som: fclose failed\n",prefix);
+}
+static som_t** som_load_map(char *prefix, int *nsom)
+{
+    FILE *fp = open_file(NULL,"r","%s.som",prefix);
+    char buf[5];
+    if ( fread(buf,5,1,fp)!=1 || strncmp(buf,"SOMv1",5) ) error("Could not parse %s.som\n", prefix);
+
+    if ( fread(nsom,sizeof(int),1,fp)!=1 ) error("Could not read %s.som\n", prefix);
+    som_t **som = (som_t**)malloc(*nsom*sizeof(som_t*));
+
+    int i;
+    for (i=0; i<*nsom; i++)
+    {
+        som[i] = (som_t*) calloc(1,sizeof(som_t));
+        if ( fread(&som[i]->size,sizeof(int),1,fp) != 1 ) error("Could not read %s.som\n", prefix);
+        if ( fread(&som[i]->kdim,sizeof(int),1,fp) != 1 ) error("Could not read %s.som\n", prefix);
+        som[i]->w = (double*) malloc(sizeof(double)*som[i]->size*som[i]->kdim);
+        som[i]->c = (double*) malloc(sizeof(double)*som[i]->size);
+        if ( fread(som[i]->w,sizeof(double),som[i]->size*som[i]->kdim,fp) != som[i]->size*som[i]->kdim ) error("Could not read from %s.som\n", prefix);
+        if ( fread(som[i]->c,sizeof(double),som[i]->size,fp) != som[i]->size ) error("Could not read from %s.som\n", prefix);
+    }
+    if ( fclose(fp) ) error("%s.som: fclose failed\n",prefix);
+    return som;
+}
+static void som_create_plot(som_t *som, char *prefix)
+{
+    if ( som->ndim!=2 ) return;
+
+    char *fname;
+    FILE *fp = open_file(&fname,"w","%s.py",prefix);
+    fprintf(fp,
+            "import matplotlib as mpl\n"
+            "mpl.use('Agg')\n"
+            "import matplotlib.pyplot as plt\n"
+            "\n"
+            "dat = [\n"
+           );
+    int i,j;
+    double *val = som->c;
+    for (i=0; i<som->nbin; i++)
+    {
+        fprintf(fp,"[");
+        for (j=0; j<som->nbin; j++)
+        {
+            if ( j>0 ) fprintf(fp,",");
+            fprintf(fp,"%e", *val);
+            val++;
+        }
+        fprintf(fp,"],\n");
+    }
+    fprintf(fp,
+            "]\n"
+            "fig = plt.figure()\n"
+            "ax1 = plt.subplot(111)\n"
+            "im1 = ax1.imshow(dat)\n"
+            "fig.colorbar(im1)\n"
+            "plt.savefig('%s.png')\n"
+            "plt.close()\n"
+            "\n", prefix
+           );
+    fclose(fp);
+    free(fname);
+}
+// Find the best matching unit: the node with minimum distance from the input vector
+static inline int som_find_bmu(som_t *som, double *vec, double *dist)
+{
+    double *ptr = som->w;
+    double min_dist = HUGE_VAL;
+    int min_idx = 0;
+
+    int i, k;
+    for (i=0; i<som->size; i++)
+    {
+        double dist = 0;
+        for (k=0; k<som->kdim; k++)
+            dist += (vec[k] - ptr[k]) * (vec[k] - ptr[k]);
+        if ( dist < min_dist )
+        {
+            min_dist = dist;
+            min_idx  = i;
+        }
+        ptr += som->kdim;
+    }
+
+    if ( dist ) *dist = min_dist;
+    return min_idx;
+}
+static inline double som_get_score(som_t *som, double *vec, double bmu_th)
+{
+    double *ptr = som->w;
+    double min_dist = HUGE_VAL;
+
+    int i, k;
+    for (i=0; i<som->size; i++)
+    {
+        if ( som->c[i] >= bmu_th )
+        {
+            double dist = 0;
+            for (k=0; k<som->kdim; k++)
+                dist += (vec[k] - ptr[k]) * (vec[k] - ptr[k]);
+            if ( dist < min_dist ) min_dist = dist;
+        }
+        ptr += som->kdim;
+    }
+    return sqrt(min_dist);
+}
+// Convert flat index to that of a k-dimensional cube
+static inline void som_idx_to_ndim(som_t *som, int idx, int *ndim)
+{
+    int i;
+    double sub = 0;
+
+    ndim[0] = idx/som->div[0];
+    for (i=1; i<som->ndim; i++)
+    {
+        sub += ndim[i-1] * som->div[i-1];
+        ndim[i] = (idx - sub)/som->div[i];
+    }
+}
+static void som_train_site(som_t *som, double *vec, int update_counts)
+{
+    // update learning rate and learning radius
+    som->t++;
+    double dt = exp(-som->t/som->nt);
+    double learning_rate = som->learn * dt;
+    double radius = som->nbin * dt; radius *= radius;
+
+    // find the best matching unit and its indexes
+    int min_idx = som_find_bmu(som, vec, NULL);
+    som_idx_to_ndim(som, min_idx, som->a_idx);
+
+    // update the weights: traverse the map and make all nodes within the
+    // radius more similar to the input vector
+    double *ptr = som->w;
+    double *cnt = som->c;
+    int i, j, k;
+    for (i=0; i<som->size; i++)
+    {
+        som_idx_to_ndim(som, i, som->b_idx);
+        double dist = 0;
+        for (j=0; j<som->ndim; j++)
+            dist += (som->a_idx[j] - som->b_idx[j]) * (som->a_idx[j] - som->b_idx[j]);
+        if ( dist <= radius )
+        {
+            double influence = exp(-dist*dist*0.5/radius) * learning_rate;
+            for (k=0; k<som->kdim; k++)
+                ptr[k] += influence * (vec[k] - ptr[k]);
+
+            // Bad sites may help to shape the map, but only nodes with big enough
+            // influence will be used for classification.
+            if ( update_counts ) *cnt += influence;
+        }
+        ptr += som->kdim;
+        cnt++;
+    }
+}
+static void som_norm_counts(som_t *som)
+{
+    int i;
+    double max = 0;
+    for (i=0; i<som->size; i++)
+        if ( max < som->c[i] ) max = som->c[i];
+    for (i=0; i<som->size; i++)
+        som->c[i] /= max;
+}
+static som_t *som_init(args_t *args)
+{
+    som_t *som  = (som_t*) calloc(1,sizeof(som_t));
+    som->ndim   = args->ndim;
+    som->nbin   = args->nbin;
+    som->kdim   = args->mvals;
+    som->nt     = args->ntrain;
+    som->learn  = args->learn;
+    som->bmu_th = args->bmu_th;
+    som->size   = pow(som->nbin,som->ndim);
+    som->w = (double*) malloc(sizeof(double)*som->size*som->kdim);
+    if ( !som->w ) error("Could not alloc %d bytes [nbin=%d ndim=%d kdim=%d]\n", sizeof(double)*som->size*som->kdim,som->nbin,som->ndim,som->kdim);
+    som->c = (double*) calloc(som->size,sizeof(double));
+    if ( !som->w ) error("Could not alloc %d bytes [nbin=%d ndim=%d]\n", sizeof(double)*som->size,som->nbin,som->ndim);
+    int i;
+    for (i=0; i<som->size*som->kdim; i++)
+        som->w[i] = (double)random()/RAND_MAX;
+    som->a_idx = (int*) malloc(sizeof(int)*som->ndim);
+    som->b_idx = (int*) malloc(sizeof(int)*som->ndim);
+    som->div   = (double*) malloc(sizeof(double)*som->ndim);
+    for (i=0; i<som->ndim; i++)
+        som->div[i] = pow(som->nbin,som->ndim-i-1);
+    return som;
+}
+static void som_destroy(som_t *som)
+{
+    free(som->a_idx); free(som->b_idx); free(som->div);
+    free(som->w); free(som->c);
+    free(som);
+}
+
+static void init_data(args_t *args)
+{
+    // Get first line to learn the vector size
+    annots_reader_reset(args);
+    annots_reader_next(args);
+
+    if ( args->action==SOM_CLASSIFY )
+        args->som = som_load_map(args->prefix,&args->nfold);
+}
+static void destroy_data(args_t *args)
+{
+    int i;
+    if ( args->som )
+    {
+        for (i=0; i<args->nfold; i++) som_destroy(args->som[i]);
+    }
+    free(args->train_dat);
+    free(args->train_class);
+    free(args->som);
+    free(args->vals);
+    free(args->str.s);
+}
+
+#define MERGE_MIN 0
+#define MERGE_MAX 1
+#define MERGE_AVG 2
+static double get_min_score(args_t *args, int iskip)
+{
+    int i;
+    double score, min_score = HUGE_VAL;
+    for (i=0; i<args->nfold; i++)
+    {
+        if ( i==iskip ) continue;
+        score = som_get_score(args->som[i], args->vals, args->bmu_th);
+        if ( i==0 || score < min_score ) min_score = score;
+    }
+    return min_score;
+}
+static double get_max_score(args_t *args, int iskip)
+{
+    int i;
+    double score, max_score = -HUGE_VAL;
+    for (i=0; i<args->nfold; i++)
+    {
+        if ( i==iskip ) continue;
+        score = som_get_score(args->som[i], args->vals, args->bmu_th);
+        if ( i==0 || max_score < score ) max_score = score;
+    }
+    return max_score;
+}
+static double get_avg_score(args_t *args, int iskip)
+{
+    int i, n = 0;
+    double score = 0;
+    for (i=0; i<args->nfold; i++)
+    {
+        if ( i==iskip ) continue;
+        score += som_get_score(args->som[i], args->vals, args->bmu_th);
+        n++;
+    }
+    return score/n;
+}
+static int cmpfloat_desc(const void *a, const void *b)
+{
+    float fa = *((float*)a);
+    float fb = *((float*)b);
+    if ( fa<fb ) return 1;
+    if ( fa>fb ) return -1;
+    return 0;
+}
+
+static void create_eval_plot(args_t *args)
+{
+    FILE *fp = open_file(NULL,"w","%s.eval.py", args->prefix);
+    fprintf(fp,
+            "import matplotlib as mpl\n"
+            "mpl.use('Agg')\n"
+            "import matplotlib.pyplot as plt\n"
+            "\n"
+            "import csv\n"
+            "csv.register_dialect('tab', delimiter='\\t', quoting=csv.QUOTE_NONE)\n"
+            "dat = []\n"
+            "with open('%s.eval', 'rb') as f:\n"
+            "\treader = csv.reader(f, 'tab')\n"
+            "\tfor row in reader:\n"
+            "\t\tif row[0][0]!='#': dat.append(row)\n"
+            "\n"
+            "fig = plt.figure()\n"
+            "ax1 = plt.subplot(111)\n"
+            "ax1.plot([x[0] for x in dat],[x[1] for x in dat],'g',label='Good')\n"
+            "ax1.plot([x[0] for x in dat],[x[2] for x in dat],'r',label='Bad')\n"
+            "ax1.set_xlabel('SOM score')\n"
+            "ax1.set_ylabel('Number of training sites')\n"
+            "ax1.legend(loc='best',prop={'size':8},frameon=False)\n"
+            "plt.savefig('%s.eval.png')\n"
+            "plt.close()\n"
+            "\n", args->prefix,args->prefix
+           );
+    fclose(fp);
+}
+
+static void do_train(args_t *args)
+{
+    // read training sites
+    int i, igood = 0, ibad = 0, ngood = 0, nbad = 0, ntrain = 0;
+    annots_reader_reset(args);
+    while ( annots_reader_next(args) )
+    {
+        // determine which of the nfold's SOMs to train
+        int isom = 0;
+        if ( args->dclass == args->good_class )
+        {
+            if ( ++igood >= args->nfold ) igood = 0;
+            isom = igood;
+            ngood++;
+        }
+        else if ( args->dclass == args->bad_class )
+        {
+            if ( ++ibad >= args->nfold ) ibad = 0;
+            isom = ibad;
+            nbad++;
+        }
+        else
+            error("Could not determine the class: %d (vs %d and %d)\n", args->dclass,args->good_class,args->bad_class);
+
+        // save the values for evaluation
+        ntrain++;
+        hts_expand(double, ntrain*args->mvals, args->mtrain_dat, args->train_dat);
+        hts_expand(int, ntrain, args->mtrain_class, args->train_class);
+        memcpy(args->train_dat+(ntrain-1)*args->mvals, args->vals, args->mvals*sizeof(double));
+        args->train_class[ntrain-1] = (args->dclass==args->good_class ? 1 : 0) | isom<<1;  // store class + chunk used for training
+    }
+    annots_reader_close(args);
+
+    // init maps
+    if ( !args->ntrain ) args->ntrain = ngood/args->nfold;
+    srandom(args->rand_seed);
+    args->som = (som_t**) malloc(sizeof(som_t*)*args->nfold);
+    for (i=0; i<args->nfold; i++) args->som[i] = som_init(args);
+
+    // train
+    for (i=0; i<ntrain; i++)
+    {
+        int is_good = args->train_class[i] & 1;
+        int isom    = args->train_class[i] >> 1;
+        if ( is_good || args->train_bad )
+            som_train_site(args->som[isom], args->train_dat+i*args->mvals, is_good);
+    }
+
+    // norm and create plots
+    for (i=0; i<args->nfold; i++)
+    {
+        som_norm_counts(args->som[i]);
+        if ( args->prefix )
+        {
+            char *bname = msprintf("%s.som.%d", args->prefix,i);
+            som_create_plot(args->som[i], bname);
+            free(bname);
+        }
+    }
+
+    // evaluate
+    float *good = (float*) malloc(sizeof(float)*ngood); assert(good);
+    float *bad  = (float*) malloc(sizeof(float)*nbad); assert(bad);
+    igood = ibad = 0;
+    double max_score = sqrt(args->som[0]->kdim);
+    for (i=0; i<ntrain; i++)
+    {
+        double score = 0;
+        int is_good = args->train_class[i] & 1;
+        int isom    = args->train_class[i] >> 1;    // this vector was used for training isom-th SOM, skip
+        if ( args->nfold==1 ) isom = -1;
+        memcpy(args->vals, args->train_dat+i*args->mvals, args->mvals*sizeof(double));
+        switch (args->merge)
+        {
+            case MERGE_MIN: score = get_min_score(args, isom); break;
+            case MERGE_MAX: score = get_max_score(args, isom); break;
+            case MERGE_AVG: score = get_avg_score(args, isom); break;
+        }
+        score = 1.0 - score/max_score;
+        if ( is_good )
+            good[igood++] = score;
+        else
+            bad[ibad++] = score;
+    }
+    qsort(good, ngood, sizeof(float), cmpfloat_desc);
+    qsort(bad, nbad, sizeof(float), cmpfloat_desc);
+    FILE *fp = NULL;
+    if ( args->prefix ) fp = open_file(NULL,"w","%s.eval", args->prefix);
+    igood = 0;
+    ibad  = 0;
+    float prev_score = good[0]>bad[0] ? good[0] : bad[0];
+    int printed = 0;
+    while ( igood<ngood || ibad<nbad )
+    {
+        if ( igood<ngood && good[igood]==prev_score ) { igood++; continue; }
+        if ( ibad<nbad && bad[ibad]==prev_score ) { ibad++; continue; }
+        if ( fp )
+            fprintf(fp,"%e\t%f\t%f\n", prev_score, (float)igood/ngood, (float)ibad/nbad);
+        if ( !printed && (float)igood/ngood > 0.9 )
+        {
+            printf("%.2f\t%.2f\t%e\t# %% of bad [1] and good [2] sites at a cutoff [3]\n", 100.*ibad/nbad,100.*igood/ngood,prev_score);
+            printed = 1;
+        }
+
+        if ( igood<ngood && ibad<nbad ) prev_score = good[igood]>bad[ibad] ? good[igood] : bad[ibad];
+        else if ( igood<ngood ) prev_score = good[igood];
+        else prev_score = bad[ibad];
+    }
+    if ( !printed ) printf("%.2f\t%.2f\t%e\t# %% of bad [1] and good [2] sites at a cutoff [3]\n", 100.*ibad/nbad,100.*igood/ngood,prev_score);
+    if ( fp )
+    {
+        if ( fclose(fp) ) error("%s.eval: fclose failed: %s\n",args->prefix,strerror(errno));
+        create_eval_plot(args);
+        som_write_map(args->prefix, args->som, args->nfold);
+    }
+
+    free(good);
+    free(bad);
+}
+
+static void do_classify(args_t *args)
+{
+    annots_reader_reset(args);
+    double max_score = sqrt(args->som[0]->kdim);
+    while ( annots_reader_next(args) )
+    {
+        double score = 0;
+        switch (args->merge)
+        {
+            case MERGE_MIN: score = get_min_score(args, -1); break;
+            case MERGE_MAX: score = get_max_score(args, -1); break;
+            case MERGE_AVG: score = get_avg_score(args, -1); break;
+        }
+        printf("%e\n", 1.0 - score/max_score);
+    }
+    annots_reader_close(args);
+}
+
+static void usage(void)
+{
+    fprintf(stderr, "\n");
+    fprintf(stderr, "About:   SOM (Self-Organizing Map) filtering.\n");
+    fprintf(stderr, "Usage:   bcftools som --train    [options] <annots.tab.gz>\n");
+    fprintf(stderr, "         bcftools som --classify [options]\n");
+    fprintf(stderr, "\n");
+    fprintf(stderr, "Model training options:\n");
+    fprintf(stderr, "    -f, --nfold <int>                  n-fold cross-validation (number of maps) [5]\n");
+    fprintf(stderr, "    -p, --prefix <string>              prefix of output files\n");
+    fprintf(stderr, "    -s, --size <int>                   map size [20]\n");
+    fprintf(stderr, "    -t, --train                        \n");
+    fprintf(stderr, "\n");
+    fprintf(stderr, "Classifying options:\n");
+    fprintf(stderr, "    -c, --classify                     \n");
+    fprintf(stderr, "\n");
+    fprintf(stderr, "Experimental training options (no reason to change):\n");
+    fprintf(stderr, "    -b, --bmu-threshold <float>        threshold for selection of best-matching unit [0.9]\n");
+    fprintf(stderr, "    -d, --som-dimension <int>          SOM dimension [2]\n");
+    fprintf(stderr, "    -e, --exclude-bad                  exclude bad sites from training, use for evaluation only\n");
+    fprintf(stderr, "    -l, --learning-rate <float>        learning rate [1.0]\n");
+    fprintf(stderr, "    -m, --merge <min|max|avg>          -f merge algorithm [avg]\n");
+    fprintf(stderr, "    -n, --ntrain-sites <int>           effective number of training sites [number of good sites]\n");
+    fprintf(stderr, "    -r, --random-seed <int>            random seed, 0 for time() [1]\n");
+    fprintf(stderr, "\n");
+    exit(1);
+}
+
+int main_vcfsom(int argc, char *argv[])
+{
+    int c;
+    args_t *args     = (args_t*) calloc(1,sizeof(args_t));
+    args->argc       = argc; args->argv = argv;
+    args->nbin       = 20;
+    args->learn      = 1.0;
+    args->bmu_th     = 0.9;
+    args->nfold      = 5;
+    args->rand_seed  = 1;
+    args->ndim       = 2;
+    args->bad_class  = 1;
+    args->good_class = 2;
+    args->merge      = MERGE_AVG;
+    args->train_bad  = 1;
+
+    static struct option loptions[] =
+    {
+        {"help",0,0,'h'},
+        {"prefix",1,0,'p'},
+        {"ntrain-sites",1,0,'n'},
+        {"random-seed",1,0,'r'},
+        {"bmu-threshold",1,0,'b'},
+        {"exclude-bad",0,0,'e'},
+        {"learning-rate",1,0,'l'},
+        {"size",1,0,'s'},
+        {"som-dimension",1,0,'d'},
+        {"nfold",1,0,'f'},
+        {"merge",1,0,'m'},
+        {"train",0,0,'t'},
+        {"classify",0,0,'c'},
+        {0,0,0,0}
+    };
+    while ((c = getopt_long(argc, argv, "htcp:n:r:b:l:s:f:d:m:e",loptions,NULL)) >= 0) {
+        switch (c) {
+            case 'e': args->train_bad = 0; break;
+            case 'm':
+                if ( !strcmp(optarg,"min") ) args->merge = MERGE_MIN;
+                else if ( !strcmp(optarg,"max") ) args->merge = MERGE_MAX;
+                else if ( !strcmp(optarg,"avg") ) args->merge = MERGE_AVG;
+                else error("The -m method not recognised: %s\n", optarg);
+                break;
+            case 'p': args->prefix = optarg; break;
+            case 'n': args->ntrain = atoi(optarg); break;
+            case 'r': args->rand_seed = atoi(optarg); break;
+            case 'b': args->bmu_th = atof(optarg); break;
+            case 'l': args->learn = atof(optarg); break;
+            case 's': args->nbin = atoi(optarg); break;
+            case 'f': args->nfold = atoi(optarg); break;
+            case 'd':
+                args->ndim = atoi(optarg);
+                if ( args->ndim<2 ) error("Expected -d >=2, got %d\n", args->ndim);
+                if ( args->ndim>3 ) fprintf(stderr,"Warning: This will take a long time and is not going to make the results better: -d %d\n", args->ndim);
+                break;
+            case 't': args->action = SOM_TRAIN; break;
+            case 'c': args->action = SOM_CLASSIFY; break;
+            case 'h':
+            case '?': usage();
+            default: error("Unknown argument: %s\n", optarg);
+        }
+    }
+
+    if ( !args->rand_seed ) args->rand_seed = time(NULL);
+    if ( argc!=optind+1 ) usage();
+    args->fname = argv[optind];
+    init_data(args);
+
+    if ( args->action == SOM_TRAIN ) do_train(args);
+    else if ( args->action == SOM_CLASSIFY ) do_classify(args);
+
+    destroy_data(args);
+    free(args);
+    return 0;
+}
+
diff --git a/vcfstats.c b/vcfstats.c
new file mode 100644
index 0000000..a5caed4
--- /dev/null
+++ b/vcfstats.c
@@ -0,0 +1,1474 @@
+/*  vcfstats.c -- Produces stats which can be plotted using plot-vcfstats.
+
+    Copyright (C) 2012-2014 Genome Research Ltd.
+
+    Author: Petr Danecek <pd3 at sanger.ac.uk>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.  */
+
+/*
+    Notes and known issues:
+        - SN ts/tv calculation includes all non-ref alleles listed in ALT while per-sample ts/tv
+        takes the first non-ref allele only, something to consider with many non-ref HETs.
+*/
+#include <stdio.h>
+#include <stdarg.h>
+#include <unistd.h>
+#include <getopt.h>
+#include <math.h>
+#include <htslib/vcf.h>
+#include <htslib/synced_bcf_reader.h>
+#include <htslib/vcfutils.h>
+#include <htslib/faidx.h>
+#include <inttypes.h>
+#include "bcftools.h"
+
+#define HWE_STATS 1
+#define QUAL_STATS 1
+#define IRC_STATS 1
+#define IRC_RLEN 10
+
+typedef struct
+{
+    char *tag;
+    float min, max;
+    uint64_t *vals_ts, *vals_tv;
+    void *val;
+    int nbins, type, m_val;
+}
+user_stats_t;
+
+typedef struct
+{
+    int min, max, step, m_vals;
+    uint64_t *vals;
+}
+idist_t;
+
+typedef struct
+{
+    int n_snps, n_indels, n_mnps, n_others, n_mals, n_snp_mals, n_records;
+    int *af_ts, *af_tv, *af_snps;   // first bin of af_* stats are singletons
+    #if HWE_STATS
+        int *af_hwe;
+    #endif
+    #if IRC_STATS
+        int n_repeat[IRC_RLEN][4], n_repeat_na;    // number of indels which are repeat-consistent, repeat-inconsistent (dels and ins), and not applicable
+        int *af_repeats[3];
+    #endif
+    int ts_alt1, tv_alt1;
+    #if QUAL_STATS
+        int *qual_ts, *qual_tv, *qual_snps, *qual_indels;
+    #endif
+    int *insertions, *deletions, m_indel;   // maximum indel length
+    int in_frame, out_frame, na_frame, in_frame_alt1, out_frame_alt1, na_frame_alt1;
+    int subst[15];
+    int *smpl_hets, *smpl_homRR, *smpl_homAA, *smpl_ts, *smpl_tv, *smpl_indels, *smpl_ndp, *smpl_sngl;
+    int *smpl_frm_shifts; // not-applicable, in-frame, out-frame
+    unsigned long int *smpl_dp;
+    idist_t dp, dp_sites;
+    int nusr;
+    user_stats_t *usr;
+}
+stats_t;
+
+typedef struct
+{
+    uint64_t m[3], mm[3];        // number of hom, het and non-ref hom matches and mismatches
+    float r2sum;
+    uint32_t r2n;
+}
+gtcmp_t;
+
+typedef struct
+{
+    char *seq;
+    int pos, cnt, len;
+}
+_idc1_t;
+typedef struct
+{
+    faidx_t *ref;
+    _idc1_t *dat;
+    int ndat, mdat;
+}
+indel_ctx_t;
+
+typedef struct
+{
+    // stats
+    stats_t stats[3];
+    int *tmp_iaf, ntmp_iaf, m_af, m_qual, naf_hwe, mtmp_frm;
+    uint8_t *tmp_frm;
+    int dp_min, dp_max, dp_step;
+    gtcmp_t *af_gts_snps, *af_gts_indels, *smpl_gts_snps, *smpl_gts_indels; // first bin of af_* stats are singletons
+
+    // indel context
+    indel_ctx_t *indel_ctx;
+    char *ref_fname;
+
+    // user stats
+    int nusr;
+    user_stats_t *usr;
+
+    // other
+    bcf_srs_t *files;
+    bcf_sr_regions_t *exons;
+    char **argv, *exons_fname, *regions_list, *samples_list, *targets_list;
+    int argc, verbose_sites, first_allele_only, samples_is_file;
+    int split_by_id, nstats;
+}
+args_t;
+
+static int type2dosage[6], type2ploidy[6], type2stats[6];
+
+static void idist_init(idist_t *d, int min, int max, int step)
+{
+    d->min = min; d->max = max; d->step = step;
+    d->m_vals = 4 + (d->max - d->min)/d->step;
+    d->vals = (uint64_t*) calloc(d->m_vals,sizeof(uint64_t));
+}
+static void idist_destroy(idist_t *d)
+{
+    if ( d->vals ) free(d->vals);
+}
+static inline uint64_t *idist(idist_t *d, int val)
+{
+    if ( val < d->min ) return &d->vals[0];
+    if ( val > d->max ) return &d->vals[d->m_vals-1];
+    return &d->vals[1 + (val - d->min) / d->step];
+}
+static inline int idist_i2bin(idist_t *d, int i)
+{
+    if ( i<=0 ) return d->min;
+    if ( i>= d->m_vals ) return d->max;
+    return i-1+d->min;
+}
+
+
+#define IC_DBG 0
+#if IC_DBG
+static void _indel_ctx_print1(_idc1_t *idc)
+{
+    int i;
+    fprintf(stdout, "%d\t", idc->cnt);
+    for (i=0; i<idc->len; i++)
+        fputc(idc->seq[i], stdout);
+    fputc('\n', stdout);
+}
+static void _indel_ctx_print(indel_ctx_t *ctx)
+{
+    int i;
+    for (i=0; i<ctx->ndat; i++)
+        _indel_ctx_print1(&ctx->dat[i]);
+    fputc('\n',stdout);
+}
+#endif
+static int _indel_ctx_lookup(indel_ctx_t *ctx, char *seq, int seq_len, int *hit)
+{
+    // binary search
+    int min = 0, max = ctx->ndat - 1;
+    while ( min<=max )
+    {
+        int i = (min+max)/2;
+        int cmp = strncmp(seq, ctx->dat[i].seq, seq_len);
+        if ( cmp<0 ) max = i - 1;
+        else if ( cmp>0 ) min = i + 1;
+        else
+        {
+            if ( seq_len==ctx->dat[i].len )
+            {
+                *hit = 1;
+                return i;
+            }
+            else if ( seq_len<ctx->dat[i].len ) max = i - 1;
+            else min = i + 1;
+        }
+    }
+    *hit = 0;
+    return max;
+}
+static void _indel_ctx_insert(indel_ctx_t *ctx, char *seq, int seq_len, int pos)
+{
+    int idat, hit, i;
+    idat = _indel_ctx_lookup(ctx, seq, seq_len, &hit);
+    if ( !hit )
+    {
+        if ( pos>0 ) return;
+        idat++;
+        ctx->ndat++;
+        hts_expand(_idc1_t, ctx->ndat+1, ctx->mdat, ctx->dat);
+        if ( idat<ctx->ndat && ctx->ndat>1 )
+            memmove(&ctx->dat[idat+1], &ctx->dat[idat], (ctx->ndat - idat - 1)*sizeof(_idc1_t));
+        ctx->dat[idat].len = seq_len;
+        ctx->dat[idat].cnt = 1;
+        ctx->dat[idat].pos = pos;
+        ctx->dat[idat].seq = (char*) malloc(sizeof(char)*(seq_len+1));
+        for (i=0; i<seq_len; i++) ctx->dat[idat].seq[i] = seq[i];
+        ctx->dat[idat].seq[i] = 0;
+        return;
+    }
+    if ( ctx->dat[idat].pos + seq_len == pos )
+    {
+        ctx->dat[idat].cnt++;
+        ctx->dat[idat].pos = pos;
+    }
+}
+indel_ctx_t *indel_ctx_init(char *fa_ref_fname)
+{
+    indel_ctx_t *ctx = (indel_ctx_t *) calloc(1,sizeof(indel_ctx_t));
+    ctx->ref = fai_load(fa_ref_fname);
+    if ( !ctx->ref )
+    {
+        free(ctx);
+        return NULL;
+    }
+    return ctx;
+}
+void indel_ctx_destroy(indel_ctx_t *ctx)
+{
+    fai_destroy(ctx->ref);
+    if ( ctx->mdat ) free(ctx->dat);
+    free(ctx);
+}
+/**
+ * indel_ctx_type() - determine indel context type
+ * @ctx:
+ * @chr:    chromosome name
+ * @pos:    position of the first @ref base, 1-based
+ * @ref:    reference allele
+ * @alt:    alternate allele. Only first of multiple comma-separated alleles is
+ *          considered
+ * @nrep:   number of repeated elements (w)
+ * @nlen:   length of a single repeat element (w)
+ *
+ * Returns the INDEL length, negative for deletions, positive for insertions
+ */
+int indel_ctx_type(indel_ctx_t *ctx, char *chr, int pos, char *ref, char *alt, int *nrep, int *nlen)
+{
+    const int win_size = 50;             // hard-wired for now
+    const int rep_len  = IRC_RLEN;       // hard-wired for now
+
+    int ref_len = strlen(ref);
+    int alt_len = 0;
+    while ( alt[alt_len] && alt[alt_len]!=',' ) alt_len++;
+
+    int i, fai_ref_len;
+    char *fai_ref = faidx_fetch_seq(ctx->ref, chr, pos-1, pos+win_size, &fai_ref_len);
+    for (i=0; i<fai_ref_len; i++)
+        if ( (int)fai_ref[i]>96 ) fai_ref[i] -= 32;
+
+    // Sanity check: the reference sequence must match the REF allele
+    for (i=0; i<fai_ref_len && i<ref_len; i++)
+        if ( ref[i] != fai_ref[i] && ref[i] - 32 != fai_ref[i] )
+            error("\nSanity check failed, the reference sequence differs: %s:%d+%d .. %c vs %c\n", chr, pos, i, ref[i],fai_ref[i]);
+
+    // Count occurrences of all possible kmers
+    ctx->ndat = 0;
+    for (i=0; i<win_size; i++)
+    {
+        int k, kmax = rep_len <= i ? rep_len : i+1;
+        for (k=0; k<kmax; k++)
+            _indel_ctx_insert(ctx, &fai_ref[i-k+1], k+1, i-k);
+    }
+
+    #if IC_DBG
+    fprintf(stdout,"ref: %s\n", ref);
+    fprintf(stdout,"alt: %s\n", alt);
+    fprintf(stdout,"ctx: %s\n", fai_ref);
+    _indel_ctx_print(ctx);
+    #endif
+
+    int max_cnt = 0, max_len = 0;
+    for (i=0; i<ctx->ndat; i++)
+    {
+        if ( max_cnt < ctx->dat[i].cnt || (max_cnt==ctx->dat[i].cnt && max_len < ctx->dat[i].len) )
+        {
+            max_cnt = ctx->dat[i].cnt;
+            max_len = ctx->dat[i].len;
+        }
+        free(ctx->dat[i].seq);
+    }
+    free(fai_ref);
+
+    *nrep = max_cnt;
+    *nlen = max_len;
+    return alt_len - ref_len;
+}
+
+static void add_user_stats(args_t *args, char *str)
+{
+    args->nusr++;
+    args->usr = (user_stats_t*) realloc(args->usr,sizeof(user_stats_t)*args->nusr);
+    user_stats_t *usr = &args->usr[args->nusr-1];
+    memset(usr,0,sizeof(*usr));
+    usr->min  = 0;
+    usr->max  = 1;
+    usr->nbins = 100;
+
+    char *tmp = str;
+    while ( *tmp && *tmp!=':' ) tmp++;
+    usr->tag = (char*)calloc(tmp-str+2,sizeof(char));
+    memcpy(usr->tag,str,tmp-str);
+
+    if ( *tmp )
+    {
+        char *ptr = ++tmp;
+        usr->min = strtod(tmp, &ptr);
+        if ( tmp==ptr ) error("Could not parse %s\n", str);
+        tmp = ptr+1;
+    }
+    if ( *tmp )
+    {
+        char *ptr = tmp;
+        usr->max = strtod(tmp, &ptr);
+        if ( tmp==ptr ) error("Could not parse %s\n", str);
+        tmp = ptr+1;
+    }
+    if ( *tmp )
+    {
+        char *ptr = tmp;
+        usr->nbins = strtol(tmp, &ptr, 10);
+        if ( tmp==ptr ) error("Could not parse %s\n", str);
+        if ( usr->nbins<=0 ) error("Number of bins does not make sense (%d): %s.\n", usr->nbins, str);
+    }
+}
+static void init_user_stats(args_t *args, bcf_hdr_t *hdr, stats_t *stats)
+{
+    stats->nusr = args->nusr;
+    stats->usr = (user_stats_t*)malloc(sizeof(user_stats_t)*args->nusr);
+    memcpy(stats->usr,args->usr,args->nusr*sizeof(user_stats_t));
+    int i;
+    for (i=0; i<stats->nusr; i++)
+    {
+        user_stats_t *usr = &stats->usr[i];
+        usr->vals_ts = (uint64_t*)calloc(usr->nbins,sizeof(uint64_t));
+        usr->vals_tv = (uint64_t*)calloc(usr->nbins,sizeof(uint64_t));
+        int id = bcf_hdr_id2int(hdr,BCF_DT_ID,usr->tag);
+        if ( !bcf_hdr_idinfo_exists(hdr,BCF_HL_INFO,id) ) error("The INFO tag \"%s\" is not defined in the header\n", usr->tag);
+        usr->type = bcf_hdr_id2type(hdr,BCF_HL_INFO,id);
+        if ( usr->type!=BCF_HT_REAL && usr->type!=BCF_HT_INT ) error("The INFO tag \"%s\" is not of Float or Integer type (%d)\n", usr->type);
+    }
+}
+static void init_stats(args_t *args)
+{
+    int i;
+    args->nstats = args->files->nreaders==1 ? 1 : 3;
+    if ( args->split_by_id ) args->nstats = 2;
+
+    // AF corresponds to AC but is more robust for mixture of haploid and diploid GTs
+    args->m_af = 101;
+    for (i=0; i<args->files->nreaders; i++)
+        if ( bcf_hdr_nsamples(args->files->readers[i].header) + 1> args->m_af )
+            args->m_af = bcf_hdr_nsamples(args->files->readers[i].header) + 1;
+
+    #if QUAL_STATS
+        args->m_qual = 999;
+    #endif
+    #if HWE_STATS
+        args->naf_hwe = 100;
+    #endif
+
+    if ( args->samples_list )
+    {
+        if ( !bcf_sr_set_samples(args->files,args->samples_list,args->samples_is_file) )
+        {
+            if ( !bcf_hdr_nsamples(args->files->readers[0].header) )
+                error("No sample columns in %s\n", args->files->readers[0].fname);
+            error("Unable to parse the samples: \"%s\"\n", args->samples_list);
+        }
+        args->af_gts_snps     = (gtcmp_t *) calloc(args->m_af,sizeof(gtcmp_t));
+        args->af_gts_indels   = (gtcmp_t *) calloc(args->m_af,sizeof(gtcmp_t));
+        args->smpl_gts_snps   = (gtcmp_t *) calloc(args->files->n_smpl,sizeof(gtcmp_t));
+        args->smpl_gts_indels = (gtcmp_t *) calloc(args->files->n_smpl,sizeof(gtcmp_t));
+    }
+    for (i=0; i<args->nstats; i++)
+    {
+        stats_t *stats = &args->stats[i];
+        stats->m_indel     = 60;
+        stats->insertions  = (int*) calloc(stats->m_indel,sizeof(int));
+        stats->deletions   = (int*) calloc(stats->m_indel,sizeof(int));
+        stats->af_ts       = (int*) calloc(args->m_af,sizeof(int));
+        stats->af_tv       = (int*) calloc(args->m_af,sizeof(int));
+        stats->af_snps     = (int*) calloc(args->m_af,sizeof(int));
+        int j;
+        for (j=0; j<3; j++) stats->af_repeats[j] = (int*) calloc(args->m_af,sizeof(int));
+        #if QUAL_STATS
+            stats->qual_ts     = (int*) calloc(args->m_qual,sizeof(int));
+            stats->qual_tv     = (int*) calloc(args->m_qual,sizeof(int));
+            stats->qual_snps   = (int*) calloc(args->m_qual,sizeof(int));
+            stats->qual_indels = (int*) calloc(args->m_qual,sizeof(int));
+        #endif
+        if ( args->files->n_smpl )
+        {
+            stats->smpl_hets   = (int *) calloc(args->files->n_smpl,sizeof(int));
+            stats->smpl_homAA  = (int *) calloc(args->files->n_smpl,sizeof(int));
+            stats->smpl_homRR  = (int *) calloc(args->files->n_smpl,sizeof(int));
+            stats->smpl_ts     = (int *) calloc(args->files->n_smpl,sizeof(int));
+            stats->smpl_tv     = (int *) calloc(args->files->n_smpl,sizeof(int));
+            stats->smpl_indels = (int *) calloc(args->files->n_smpl,sizeof(int));
+            stats->smpl_dp     = (unsigned long int *) calloc(args->files->n_smpl,sizeof(unsigned long int));
+            stats->smpl_ndp    = (int *) calloc(args->files->n_smpl,sizeof(int));
+            stats->smpl_sngl   = (int *) calloc(args->files->n_smpl,sizeof(int));
+            #if HWE_STATS
+                stats->af_hwe  = (int*) calloc(args->m_af*args->naf_hwe,sizeof(int));
+            #endif
+            if ( args->exons_fname )
+                stats->smpl_frm_shifts = (int*) calloc(args->files->n_smpl*3,sizeof(int));
+        }
+        idist_init(&stats->dp, args->dp_min,args->dp_max,args->dp_step);
+        idist_init(&stats->dp_sites, args->dp_min,args->dp_max,args->dp_step);
+        init_user_stats(args, i!=1 ? args->files->readers[0].header : args->files->readers[1].header, stats);
+    }
+
+    if ( args->exons_fname )
+    {
+        args->exons = bcf_sr_regions_init(args->exons_fname,1,0,1,2);
+        if ( !args->exons )
+            error("Error occurred while reading, was the file compressed with bgzip: %s?\n", args->exons_fname);
+    }
+
+    #if IRC_STATS
+    if ( args->ref_fname )
+        args->indel_ctx = indel_ctx_init(args->ref_fname);
+    #endif
+
+    type2dosage[GT_HOM_RR] = 0;
+    type2dosage[GT_HET_RA] = 1;
+    type2dosage[GT_HOM_AA] = 2;
+    type2dosage[GT_HET_AA] = 2;
+    type2dosage[GT_HAPL_R] = 0;
+    type2dosage[GT_HAPL_A] = 1;
+
+    type2ploidy[GT_HOM_RR] = 1;
+    type2ploidy[GT_HET_RA] = 1;
+    type2ploidy[GT_HOM_AA] = 1;
+    type2ploidy[GT_HET_AA] = 1;
+    type2ploidy[GT_HAPL_R] = -1;
+    type2ploidy[GT_HAPL_A] = -1;
+
+    type2stats[GT_HOM_RR] = 0;
+    type2stats[GT_HET_RA] = 1;
+    type2stats[GT_HOM_AA] = 2;
+    type2stats[GT_HET_AA] = 1;
+    type2stats[GT_HAPL_R] = 0;
+    type2stats[GT_HAPL_A] = 2;
+
+}
+static void destroy_stats(args_t *args)
+{
+    int id, j;
+    for (id=0; id<args->nstats; id++)
+    {
+        stats_t *stats = &args->stats[id];
+        if (stats->af_ts) free(stats->af_ts);
+        if (stats->af_tv) free(stats->af_tv);
+        if (stats->af_snps) free(stats->af_snps);
+        for (j=0; j<3; j++)
+            if (stats->af_repeats[j]) free(stats->af_repeats[j]);
+        #if QUAL_STATS
+            if (stats->qual_ts) free(stats->qual_ts);
+            if (stats->qual_tv) free(stats->qual_tv);
+            if (stats->qual_snps) free(stats->qual_snps);
+            if (stats->qual_indels) free(stats->qual_indels);
+        #endif
+        #if HWE_STATS
+            //if ( args->files->n_smpl ) free(stats->af_hwe);
+            free(stats->af_hwe);
+        #endif
+        free(stats->insertions);
+        free(stats->deletions);
+        if (stats->smpl_hets) free(stats->smpl_hets);
+        if (stats->smpl_homAA) free(stats->smpl_homAA);
+        if (stats->smpl_homRR) free(stats->smpl_homRR);
+        if (stats->smpl_ts) free(stats->smpl_ts);
+        if (stats->smpl_tv) free(stats->smpl_tv);
+        if (stats->smpl_indels) free(stats->smpl_indels);
+        if (stats->smpl_dp) free(stats->smpl_dp);
+        if (stats->smpl_ndp) free(stats->smpl_ndp);
+        if (stats->smpl_sngl) free(stats->smpl_sngl);
+        idist_destroy(&stats->dp);
+        idist_destroy(&stats->dp_sites);
+        for (j=0; j<stats->nusr; j++)
+        {
+            free(stats->usr[j].vals_ts);
+            free(stats->usr[j].vals_tv);
+            free(stats->usr[j].val);
+        }
+        free(stats->usr);
+        if ( args->exons ) free(stats->smpl_frm_shifts);
+    }
+    for (j=0; j<args->nusr; j++) free(args->usr[j].tag);
+    free(args->usr);
+    free(args->tmp_frm);
+    if (args->tmp_iaf) free(args->tmp_iaf);
+    if (args->exons) bcf_sr_regions_destroy(args->exons);
+    if (args->af_gts_snps) free(args->af_gts_snps);
+    if (args->af_gts_indels) free(args->af_gts_indels);
+    if (args->smpl_gts_snps) free(args->smpl_gts_snps);
+    if (args->smpl_gts_indels) free(args->smpl_gts_indels);
+    if (args->indel_ctx) indel_ctx_destroy(args->indel_ctx);
+}
+
+static void init_iaf(args_t *args, bcf_sr_t *reader)
+{
+    bcf1_t *line = reader->buffer[0];
+    if ( args->ntmp_iaf < line->n_allele )
+    {
+        args->tmp_iaf = (int*)realloc(args->tmp_iaf, line->n_allele*sizeof(int));
+        args->ntmp_iaf = line->n_allele;
+    }
+    // tmp_iaf is first filled with AC counts in calc_ac and then transformed to
+    //  an index to af_gts_snps
+    int i, ret = bcf_calc_ac(reader->header, line, args->tmp_iaf, args->samples_list ? BCF_UN_INFO|BCF_UN_FMT : BCF_UN_INFO);
+    if ( ret )
+    {
+        int an=0;
+        for (i=0; i<line->n_allele; i++)
+            an += args->tmp_iaf[i];
+
+        args->tmp_iaf[0] = 0;
+        for (i=1; i<line->n_allele; i++)
+        {
+            if ( args->tmp_iaf[i]==1 )
+                args->tmp_iaf[i] = 0; // singletons into the first bin
+            else if ( !an )
+                args->tmp_iaf[i] = 1;   // no genotype at all, put to the AF=0 bin
+            else
+                args->tmp_iaf[i] = 1 + args->tmp_iaf[i] * (args->m_af-2.0) / an;
+        }
+    }
+    else
+        for (i=0; i<line->n_allele; i++)
+            args->tmp_iaf[i] = 0;
+
+    // todo: otherwise use AF
+}
+
+static inline void do_mnp_stats(args_t *args, stats_t *stats, bcf_sr_t *reader)
+{
+    stats->n_mnps++;
+}
+
+static inline void do_other_stats(args_t *args, stats_t *stats, bcf_sr_t *reader)
+{
+    stats->n_others++;
+}
+
+static void do_indel_stats(args_t *args, stats_t *stats, bcf_sr_t *reader)
+{
+    stats->n_indels++;
+
+    bcf1_t *line = reader->buffer[0];
+
+    #if QUAL_STATS
+        int iqual = line->qual >= args->m_qual || isnan(line->qual) ? args->m_qual - 1 : line->qual;
+        stats->qual_indels[iqual]++;
+    #endif
+
+    // Check if the indel is near an exon for the frameshift statistics
+    int i, exon_overlap = 0;
+    if ( args->exons )
+    {
+        if ( !bcf_sr_regions_overlap(args->exons, bcf_seqname(reader->header,line),line->pos,line->pos) ) exon_overlap = 1;
+        hts_expand(uint8_t,line->n_allele,args->mtmp_frm,args->tmp_frm);
+        for (i=0; i<line->n_allele; i++) args->tmp_frm[i] = 0;
+    }
+
+    for (i=1; i<line->n_allele; i++)
+    {
+        if ( args->first_allele_only && i>1 ) break;
+        if ( bcf_get_variant_type(line,i)!=VCF_INDEL ) continue;
+        int len = line->d.var[i].n;
+
+        #if IRC_STATS
+        // Indel repeat consistency
+        if ( args->indel_ctx )
+        {
+            int nrep, nlen, ndel;
+            ndel = indel_ctx_type(args->indel_ctx, (char*)reader->header->id[BCF_DT_CTG][line->rid].key, line->pos+1, line->d.allele[0], line->d.allele[i], &nrep, &nlen);
+            if ( nlen<=1 || nrep<=1 )
+            {
+                // not a repeat or a single base repeat
+                stats->n_repeat_na++;
+                stats->af_repeats[2][ args->tmp_iaf[i] ]++;
+            }
+            else
+            {
+                if ( abs(ndel) % nlen )
+                {
+                    // the length of the inserted/deleted sequence is not consistent with the repeat element
+                    stats->n_repeat[nlen-1][ndel<0 ? 1 : 3]++;
+                    stats->af_repeats[1][ args->tmp_iaf[i] ]++;
+                }
+                else
+                {
+                    // the length consistent with the repeat
+                    stats->n_repeat[nlen-1][ndel<0 ? 0 : 2]++;
+                    stats->af_repeats[0][ args->tmp_iaf[i] ]++;
+                }
+            }
+        }
+        else
+            stats->af_repeats[2][ args->tmp_iaf[i] ]++;
+        #endif
+
+        // Check the frameshifts
+        int tlen = 0;
+        if ( args->exons && exon_overlap )   // there is an exon
+        {
+            if ( len>0 )
+            {
+                // insertion
+                if ( args->exons->start <= line->pos && args->exons->end > line->pos ) tlen = abs(len);
+            }
+            else if ( args->exons->start <= line->pos + abs(len) )
+            {
+                // deletion
+                tlen = abs(len);
+                if ( line->pos < args->exons->start )              // trim the beginning
+                    tlen -= args->exons->start - line->pos + 1;
+                if ( args->exons->end < line->pos + abs(len) )     // trim the end
+                    tlen -= line->pos + abs(len) - args->exons->end;
+            }
+        }
+        if ( tlen )     // there are some deleted/inserted bases in the exon
+        {
+            if ( tlen%3 ) { stats->out_frame++; args->tmp_frm[i] = 2; }
+            else { stats->in_frame++; args->tmp_frm[i] = 1; }
+
+            if ( i==1 )
+            {
+                if ( tlen%3 ) stats->out_frame_alt1++;
+                else stats->in_frame_alt1++;
+            }
+        }
+        else            // no exon affected
+        {
+            if ( i==1 ) stats->na_frame_alt1++;
+            stats->na_frame++;
+        }
+
+
+        // Indel length distribution
+        int *ptr = stats->insertions;
+        if ( len<0 )
+        {
+            len *= -1;
+            ptr = stats->deletions;
+        }
+        if ( --len >= stats->m_indel ) len = stats->m_indel-1;
+        ptr[len]++;
+    }
+}
+
+static void do_user_stats(stats_t *stats, bcf_sr_t *reader, int is_ts)
+{
+    int i;
+    for (i=0; i<stats->nusr; i++)
+    {
+        user_stats_t *usr = &stats->usr[i];
+        uint64_t *vals = is_ts ? usr->vals_ts : usr->vals_tv;
+        float val;
+        if ( usr->type==BCF_HT_REAL )
+        {
+            if ( bcf_get_info_float(reader->header,reader->buffer[0],usr->tag,&usr->val,&usr->m_val)<=0 ) continue;
+            val = ((float*)usr->val)[0];
+        }
+        else
+        {
+            if ( bcf_get_info_int32(reader->header,reader->buffer[0],usr->tag,&usr->val,&usr->m_val)<=0 ) continue;
+            val = ((int32_t*)usr->val)[0];
+        }
+        int idx;
+        if ( val<=usr->min ) idx = 0;
+        else if ( val>=usr->max ) idx = usr->nbins - 1;
+        else idx = (val - usr->min)/(usr->max - usr->min) * (usr->nbins-1);
+        vals[idx]++;
+    }
+}
+
+static void do_snp_stats(args_t *args, stats_t *stats, bcf_sr_t *reader)
+{
+    stats->n_snps++;
+
+    bcf1_t *line = reader->buffer[0];
+    int ref = bcf_acgt2int(*line->d.allele[0]);
+    if ( ref<0 ) return;
+
+    #if QUAL_STATS
+        int iqual = line->qual >= args->m_qual || isnan(line->qual) ? args->m_qual - 1 : line->qual;
+        stats->qual_snps[iqual]++;
+    #endif
+
+    int i;
+    for (i=1; i<line->n_allele; i++)
+    {
+        if ( args->first_allele_only && i>1 ) break;
+        if ( !(bcf_get_variant_type(line,i)&VCF_SNP) ) continue;
+        int alt = bcf_acgt2int(*line->d.allele[i]);
+        if ( alt<0 || ref==alt ) continue;
+        stats->subst[ref<<2|alt]++;
+        int iaf = args->tmp_iaf[i];
+        stats->af_snps[iaf]++;
+        if ( abs(ref-alt)==2 )
+        {
+            if (i==1)
+            {
+                stats->ts_alt1++;
+                #if QUAL_STATS
+                    stats->qual_ts[iqual]++;
+                #endif
+                do_user_stats(stats, reader, 1);
+            }
+            stats->af_ts[iaf]++;
+        }
+        else
+        {
+            if (i==1)
+            {
+                stats->tv_alt1++;
+                #if QUAL_STATS
+                    stats->qual_tv[iqual]++;
+                #endif
+                do_user_stats(stats, reader, 0);
+            }
+            stats->af_tv[iaf]++;
+        }
+    }
+}
+
+static void do_sample_stats(args_t *args, stats_t *stats, bcf_sr_t *reader, int matched)
+{
+    bcf_srs_t *files = args->files;
+    bcf1_t *line = reader->buffer[0];
+    bcf_fmt_t *fmt_ptr;
+    int nref_tot = 0, nhet_tot = 0, nalt_tot = 0;
+    int line_type = bcf_get_variant_types(line);
+
+    if ( (fmt_ptr = bcf_get_fmt(reader->header,reader->buffer[0],"GT")) )
+    {
+        int ref = bcf_acgt2int(*line->d.allele[0]);
+        int is, n_nref = 0, i_nref = 0;
+        for (is=0; is<args->files->n_smpl; is++)
+        {
+            int ial, jal;
+            int gt = bcf_gt_type(fmt_ptr, reader->samples[is], &ial, &jal);
+            if ( gt==GT_UNKN ) continue;
+            if ( gt==GT_HAPL_R || gt==GT_HAPL_A )
+            {
+                if ( line_type&VCF_INDEL && stats->smpl_frm_shifts )
+                {
+                    assert( ial<line->n_allele );
+                    stats->smpl_frm_shifts[is*3 + args->tmp_frm[ial]]++;
+                }
+                continue;
+            }
+            if ( gt != GT_HOM_RR ) { n_nref++; i_nref = is; }
+            #if HWE_STATS
+                switch (gt)
+                {
+                    case GT_HOM_RR: nref_tot++; break;
+                    case GT_HET_RA: nhet_tot++; break;
+                    case GT_HET_AA:
+                    case GT_HOM_AA: nalt_tot++; break;
+                }
+            #endif
+            if ( line_type&VCF_SNP )
+            {
+                if ( gt == GT_HET_RA ) stats->smpl_hets[is]++;
+                else if ( gt == GT_HET_AA ) stats->smpl_hets[is]++;
+                else if ( gt == GT_HOM_RR ) stats->smpl_homRR[is]++;
+                else if ( gt == GT_HOM_AA ) stats->smpl_homAA[is]++;
+                if ( gt != GT_HOM_RR && line->d.var[ial].type&VCF_SNP ) // this is safe, bcf_get_variant_types has been already called
+                {
+                    int alt = bcf_acgt2int(*line->d.allele[ial]);
+                    if ( alt<0 ) continue;
+                    if ( abs(ref-alt)==2 )
+                        stats->smpl_ts[is]++;
+                    else
+                        stats->smpl_tv[is]++;
+                }
+            }
+            if ( line_type&VCF_INDEL )
+            {
+                if ( gt != GT_HOM_RR ) stats->smpl_indels[is]++;
+                if ( stats->smpl_frm_shifts )
+                {
+                    assert( ial<line->n_allele && jal<line->n_allele );
+                    stats->smpl_frm_shifts[is*3 + args->tmp_frm[ial]]++;
+                    stats->smpl_frm_shifts[is*3 + args->tmp_frm[jal]]++;
+                }
+            }
+        }
+        if ( n_nref==1 ) stats->smpl_sngl[i_nref]++;
+    }
+
+    #if HWE_STATS
+        if ( nhet_tot + nref_tot + nalt_tot )
+        {
+            float het_frac = (float)nhet_tot/(nhet_tot + nref_tot + nalt_tot);
+            int idx = het_frac*(args->naf_hwe - 1);
+            if ( line->n_allele>1 ) idx += args->naf_hwe*args->tmp_iaf[1];
+            stats->af_hwe[idx]++;
+        }
+    #endif
+
+    if ( (fmt_ptr = bcf_get_fmt(reader->header,reader->buffer[0],"DP")) )
+    {
+        #define BRANCH_INT(type_t,missing,vector_end) { \
+            int is; \
+            for (is=0; is<args->files->n_smpl; is++) \
+            { \
+                type_t *p = (type_t *) (fmt_ptr->p + fmt_ptr->size*is); \
+                if ( *p==vector_end ) continue; \
+                if ( *p!=missing ) \
+                { \
+                    (*idist(&stats->dp, *p))++; \
+                    stats->smpl_ndp[is]++; \
+                    stats->smpl_dp[is] += *p; \
+                } \
+            } \
+        }
+        switch (fmt_ptr->type) {
+            case BCF_BT_INT8:  BRANCH_INT(int8_t,  bcf_int8_missing, bcf_int8_vector_end); break;
+            case BCF_BT_INT16: BRANCH_INT(int16_t, bcf_int16_missing, bcf_int16_vector_end); break;
+            case BCF_BT_INT32: BRANCH_INT(int32_t, bcf_int32_missing, bcf_int32_vector_end); break;
+            default: fprintf(stderr, "[E::%s] todo: %d\n", __func__, fmt_ptr->type); exit(1); break;
+        }
+        #undef BRANCH_INT
+    }
+
+    if ( matched==3 )
+    {
+        int is;
+        bcf_fmt_t *fmt0, *fmt1;
+        fmt0 = bcf_get_fmt(files->readers[0].header,files->readers[0].buffer[0],"GT"); if ( !fmt0 ) return;
+        fmt1 = bcf_get_fmt(files->readers[1].header,files->readers[1].buffer[0],"GT"); if ( !fmt1 ) return;
+
+        // only the first ALT allele is considered
+        int iaf = line->n_allele>1 ? args->tmp_iaf[1] : 1;
+        int line_type = bcf_get_variant_types(files->readers[0].buffer[0]);
+        gtcmp_t *af_stats = line_type&VCF_SNP ? args->af_gts_snps : args->af_gts_indels;
+        gtcmp_t *smpl_stats = line_type&VCF_SNP ? args->smpl_gts_snps : args->smpl_gts_indels;
+
+        int r2n = 0;
+        float x = 0, y = 0, xy = 0, x2 = 0, y2 = 0;
+        for (is=0; is<files->n_smpl; is++)
+        {
+            // Simplified comparison: only 0/0, 0/1, 1/1 is looked at as the identity of
+            //  actual alleles can be enforced by running without the -c option.
+            int gt0 = bcf_gt_type(fmt0, files->readers[0].samples[is], NULL, NULL);
+            if ( gt0 == GT_UNKN ) continue;
+
+            int gt1 = bcf_gt_type(fmt1, files->readers[1].samples[is], NULL, NULL);
+            if ( gt1 == GT_UNKN ) continue;
+
+            if ( type2ploidy[gt0]*type2ploidy[gt1] == -1 ) continue;   // cannot compare diploid and haploid genotypes
+
+            int dsg0 = type2dosage[gt0];
+            int dsg1 = type2dosage[gt1];
+            x   += dsg0;
+            x2  += dsg0*dsg0;
+            y   += dsg1;
+            y2  += dsg1*dsg1;
+            xy  += dsg0*dsg1;
+            r2n++;
+
+            int idx = type2stats[gt0];
+            if ( gt0==gt1 )
+            {
+                af_stats[iaf].m[idx]++;
+                smpl_stats[is].m[idx]++;
+            }
+            else
+            {
+                af_stats[iaf].mm[idx]++;
+                smpl_stats[is].mm[idx]++;
+            }
+
+        }
+        if ( r2n )
+        {
+            x /= r2n; y /= r2n; x2 /= r2n; y2 /= r2n; xy /= r2n;
+            float cov  = xy - x*y;
+            float var2 = (x2 - x*x) * (y2 - y*y);
+            if ( var2!=0 )
+            {
+                af_stats[iaf].r2sum += cov*cov/var2;
+                af_stats[iaf].r2n++;
+            }
+        }
+
+        if ( args->verbose_sites )
+        {
+            int nm = 0, nmm = 0, nrefm = 0;
+            for (is=0; is<files->n_smpl; is++)
+            {
+                int gt = bcf_gt_type(fmt0, files->readers[0].samples[is], NULL, NULL);
+                if ( gt == GT_UNKN ) continue;
+                int gt2 = bcf_gt_type(fmt1, files->readers[1].samples[is], NULL, NULL);
+                if ( gt2 == GT_UNKN ) continue;
+                if ( gt != gt2 )
+                {
+                    nmm++;
+                    bcf_sr_t *reader = &files->readers[0];
+                    printf("DBG\t%s\t%d\t%s\t%d\t%d\n",reader->header->id[BCF_DT_CTG][reader->buffer[0]->rid].key,reader->buffer[0]->pos+1,files->samples[is],gt,gt2);
+                }
+                else
+                {
+                    if ( gt!=GT_HOM_RR ) nrefm++;
+                    nm++;
+                }
+            }
+            float nrd = nrefm+nmm ? 100.*nmm/(nrefm+nmm) : 0;
+            printf("PSD\t%s\t%d\t%d\t%d\t%f\n", reader->header->id[BCF_DT_CTG][reader->buffer[0]->rid].key,reader->buffer[0]->pos+1,nm,nmm,nrd);
+        }
+    }
+}
+
+static void do_vcf_stats(args_t *args)
+{
+    bcf_srs_t *files = args->files;
+    assert( sizeof(int)>files->nreaders );
+    while ( bcf_sr_next_line(files) )
+    {
+        bcf_sr_t *reader = NULL;
+        bcf1_t *line = NULL;
+        int ret = 0, i;
+        for (i=0; i<files->nreaders; i++)
+        {
+            if ( !bcf_sr_has_line(files,i) ) continue;
+            ret |= 1<<i;
+            if ( reader ) continue;
+            reader = &files->readers[i];
+            line = files->readers[i].buffer[0];
+        }
+        int line_type = bcf_get_variant_types(line);
+        init_iaf(args, reader);
+
+        stats_t *stats = &args->stats[ret-1];
+        if ( args->split_by_id && line->d.id[0]=='.' && !line->d.id[1] )
+            stats = &args->stats[1];
+
+        stats->n_records++;
+
+        if ( line_type&VCF_SNP )
+            do_snp_stats(args, stats, reader);
+        if ( line_type&VCF_INDEL )
+            do_indel_stats(args, stats, reader);
+        if ( line_type&VCF_MNP )
+            do_mnp_stats(args, stats, reader);
+        if ( line_type&VCF_OTHER )
+            do_other_stats(args, stats, reader);
+
+        if ( line->n_allele>2 )
+        {
+            stats->n_mals++;
+            if ( line_type == VCF_SNP ) stats->n_snp_mals++;
+        }
+
+        if ( files->n_smpl )
+            do_sample_stats(args, stats, reader, ret);
+
+        if ( bcf_get_info_int32(reader->header,line,"DP",&args->tmp_iaf,&args->ntmp_iaf)==1 )
+            (*idist(&stats->dp_sites, args->tmp_iaf[0]))++;    
+    }
+}
+
+static void print_header(args_t *args)
+{
+    int i;
+    printf("# This file was produced by bcftools stats (%s+htslib-%s) and can be plotted using plot-vcfstats.\n", bcftools_version(),hts_version());
+    printf("# The command line was:\tbcftools %s ", args->argv[0]);
+    for (i=1; i<args->argc; i++)
+        printf(" %s",args->argv[i]);
+    printf("\n#\n");
+
+    printf("# Definition of sets:\n# ID\t[2]id\t[3]tab-separated file names\n");
+    if ( args->files->nreaders==1 )
+    {
+        const char *fname = strcmp("-",args->files->readers[0].fname) ? args->files->readers[0].fname : "<STDIN>";
+        if ( args->split_by_id )
+        {
+            printf("ID\t0\t%s:known (sites with ID different from \".\")\n", fname);
+            printf("ID\t1\t%s:novel (sites where ID column is \".\")\n", fname);
+        }
+        else
+            printf("ID\t0\t%s\n", fname);
+    }
+    else
+    {
+        const char *fname0 = strcmp("-",args->files->readers[0].fname) ? args->files->readers[0].fname : "<STDIN>";
+        const char *fname1 = strcmp("-",args->files->readers[1].fname) ? args->files->readers[1].fname : "<STDIN>";
+        printf("ID\t0\t%s\n", fname0);
+        printf("ID\t1\t%s\n", fname1);
+        printf("ID\t2\t%s\t%s\n", fname0,fname1);
+
+        if ( args->verbose_sites )
+        {
+            printf(
+                    "# Verbose per-site discordance output.\n"
+                    "# PSD\t[2]CHROM\t[3]POS\t[4]Number of matches\t[5]Number of mismatches\t[6]NRD\n");
+            printf(
+                    "# Verbose per-site and per-sample output. Genotype codes: %d:HomRefRef, %d:HomAltAlt, %d:HetAltRef, %d:HetAltAlt, %d:haploidRef, %d:haploidAlt\n"
+                    "# DBG\t[2]CHROM\t[3]POS\t[4]Sample\t[5]GT in %s\t[6]GT in %s\n",
+                    GT_HOM_RR, GT_HOM_AA, GT_HET_RA, GT_HET_AA, GT_HAPL_R, GT_HAPL_A, fname0,fname1);
+        }
+    }
+}
+
+#define T2S(x) type2stats[x]
+static void print_stats(args_t *args)
+{
+    int i, id;
+    printf("# SN, Summary numbers:\n# SN\t[2]id\t[3]key\t[4]value\n");
+    for (id=0; id<args->files->nreaders; id++)
+        printf("SN\t%d\tnumber of samples:\t%d\n", id, bcf_hdr_nsamples(args->files->readers[id].header));
+    for (id=0; id<args->nstats; id++)
+    {
+        stats_t *stats = &args->stats[id];
+        printf("SN\t%d\tnumber of records:\t%d\n", id, stats->n_records);
+        printf("SN\t%d\tnumber of SNPs:\t%d\n", id, stats->n_snps);
+        printf("SN\t%d\tnumber of MNPs:\t%d\n", id, stats->n_mnps);
+        printf("SN\t%d\tnumber of indels:\t%d\n", id, stats->n_indels);
+        printf("SN\t%d\tnumber of others:\t%d\n", id, stats->n_others);
+        printf("SN\t%d\tnumber of multiallelic sites:\t%d\n", id, stats->n_mals);
+        printf("SN\t%d\tnumber of multiallelic SNP sites:\t%d\n", id, stats->n_snp_mals);
+    }
+    printf("# TSTV, transitions/transversions:\n# TSTV\t[2]id\t[3]ts\t[4]tv\t[5]ts/tv\t[6]ts (1st ALT)\t[7]tv (1st ALT)\t[8]ts/tv (1st ALT)\n");
+    for (id=0; id<args->nstats; id++)
+    {
+        stats_t *stats = &args->stats[id];
+        int ts=0,tv=0;
+        for (i=0; i<args->m_af; i++) { ts += stats->af_ts[i]; tv += stats->af_tv[i];  }
+        printf("TSTV\t%d\t%d\t%d\t%.2f\t%d\t%d\t%.2f\n", id,ts,tv,tv?(float)ts/tv:0, stats->ts_alt1,stats->tv_alt1,stats->tv_alt1?(float)stats->ts_alt1/stats->tv_alt1:0);
+    }
+    if ( args->exons_fname )
+    {
+        printf("# FS, Indel frameshifts:\n# FS\t[2]id\t[3]in-frame\t[4]out-frame\t[5]not applicable\t[6]out/(in+out) ratio\t[7]in-frame (1st ALT)\t[8]out-frame (1st ALT)\t[9]not applicable (1st ALT)\t[10]out/(in+out) ratio (1st ALT)\n");
+        for (id=0; id<args->nstats; id++)
+        {
+            int in=args->stats[id].in_frame, out=args->stats[id].out_frame, na=args->stats[id].na_frame;
+            int in1=args->stats[id].in_frame_alt1, out1=args->stats[id].out_frame_alt1, na1=args->stats[id].na_frame_alt1;
+            printf("FS\t%d\t%d\t%d\t%d\t%.2f\t%d\t%d\t%d\t%.2f\n", id, in,out,na,out?(float)out/(in+out):0,in1,out1,na1,out1?(float)out1/(in1+out1):0);
+        }
+    }
+    if ( args->indel_ctx )
+    {
+        printf("# ICS, Indel context summary:\n# ICS\t[2]id\t[3]repeat-consistent\t[4]repeat-inconsistent\t[5]not applicable\t[6]c/(c+i) ratio\n");
+        for (id=0; id<args->nstats; id++)
+        {
+            int nc = 0, ni = 0, na = args->stats[id].n_repeat_na;
+            for (i=0; i<IRC_RLEN; i++)
+            {
+                nc += args->stats[id].n_repeat[i][0] + args->stats[id].n_repeat[i][2];
+                ni += args->stats[id].n_repeat[i][1] + args->stats[id].n_repeat[i][3];
+            }
+            printf("ICS\t%d\t%d\t%d\t%d\t%.4f\n", id, nc,ni,na,nc+ni ? (float)nc/(nc+ni) : 0.0);
+        }
+        printf("# ICL, Indel context by length:\n# ICL\t[2]id\t[3]length of repeat element\t[4]repeat-consistent deletions)\t[5]repeat-inconsistent deletions\t[6]consistent insertions\t[7]inconsistent insertions\t[8]c/(c+i) ratio\n");
+        for (id=0; id<args->nstats; id++)
+        {
+            for (i=1; i<IRC_RLEN; i++)
+            {
+                int nc = args->stats[id].n_repeat[i][0]+args->stats[id].n_repeat[i][2], ni = args->stats[id].n_repeat[i][1]+args->stats[id].n_repeat[i][3];
+                printf("ICL\t%d\t%d\t%d\t%d\t%d\t%d\t%.4f\n", id, i+1,
+                    args->stats[id].n_repeat[i][0],args->stats[id].n_repeat[i][1],args->stats[id].n_repeat[i][2],args->stats[id].n_repeat[i][3],
+                    nc+ni ? (float)nc/(nc+ni) : 0.0);
+            }
+        }
+    }
+    printf("# SiS, Singleton stats:\n# SiS\t[2]id\t[3]allele count\t[4]number of SNPs\t[5]number of transitions\t[6]number of transversions\t[7]number of indels\t[8]repeat-consistent\t[9]repeat-inconsistent\t[10]not applicable\n");
+    for (id=0; id<args->nstats; id++)
+    {
+        stats_t *stats = &args->stats[id];
+        printf("SiS\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\n", id,1,stats->af_snps[0],stats->af_ts[0],stats->af_tv[0],
+            stats->af_repeats[0][0]+stats->af_repeats[1][0]+stats->af_repeats[2][0],stats->af_repeats[0][0],stats->af_repeats[1][0],stats->af_repeats[2][0]);
+        // put the singletons stats into the first AF bin, note that not all of the stats is transferred (i.e. nrd mismatches)
+        stats->af_snps[1]       += stats->af_snps[0];
+        stats->af_ts[1]         += stats->af_ts[0];
+        stats->af_tv[1]         += stats->af_tv[0];
+        stats->af_repeats[0][1] += stats->af_repeats[0][0];
+        stats->af_repeats[1][1] += stats->af_repeats[1][0];
+        stats->af_repeats[2][1] += stats->af_repeats[2][0];
+    }
+    printf("# AF, Stats by non-reference allele frequency:\n# AF\t[2]id\t[3]allele frequency\t[4]number of SNPs\t[5]number of transitions\t[6]number of transversions\t[7]number of indels\t[8]repeat-consistent\t[9]repeat-inconsistent\t[10]not applicable\n");
+    for (id=0; id<args->nstats; id++)
+    {
+        stats_t *stats = &args->stats[id];
+        for (i=1; i<args->m_af; i++) // note that af[1] now contains also af[0], see SiS stats output above
+        {
+            if ( stats->af_snps[i]+stats->af_ts[i]+stats->af_tv[i]+stats->af_repeats[0][i]+stats->af_repeats[1][i]+stats->af_repeats[2][i] == 0  ) continue;
+            printf("AF\t%d\t%f\t%d\t%d\t%d\t%d\t%d\t%d\t%d\n", id,100.*(i-1)/(args->m_af-1),stats->af_snps[i],stats->af_ts[i],stats->af_tv[i],
+                stats->af_repeats[0][i]+stats->af_repeats[1][i]+stats->af_repeats[2][i],stats->af_repeats[0][i],stats->af_repeats[1][i],stats->af_repeats[2][i]);
+        }
+    }
+    #if QUAL_STATS
+        printf("# QUAL, Stats by quality:\n# QUAL\t[2]id\t[3]Quality\t[4]number of SNPs\t[5]number of transitions (1st ALT)\t[6]number of transversions (1st ALT)\t[7]number of indels\n");
+        for (id=0; id<args->nstats; id++)
+        {
+            stats_t *stats = &args->stats[id];
+            for (i=0; i<args->m_qual; i++)
+            {
+                if ( stats->qual_snps[i]+stats->qual_ts[i]+stats->qual_tv[i]+stats->qual_indels[i] == 0  ) continue;
+                printf("QUAL\t%d\t%d\t%d\t%d\t%d\t%d\n", id,i,stats->qual_snps[i],stats->qual_ts[i],stats->qual_tv[i],stats->qual_indels[i]);
+            }
+        }
+    #endif
+    for (i=0; i<args->nusr; i++)
+    {
+        printf("# USR:%s, Stats by %s:\n# USR:%s\t[2]id\t[3]%s\t[4]number of SNPs\t[5]number of transitions (1st ALT)\t[6]number of transversions (1st ALT)\n",
+            args->usr[i].tag,args->usr[i].tag,args->usr[i].tag,args->usr[i].tag);
+        for (id=0; id<args->nstats; id++)
+        {
+            user_stats_t *usr = &args->stats[id].usr[i];
+            int j;
+            for (j=0; j<usr->nbins; j++)
+            {
+                if ( usr->vals_ts[j]+usr->vals_tv[j] == 0 ) continue;   // skip empty bins
+                float val = usr->min + (usr->max - usr->min)*j/(usr->nbins-1);
+                const char *fmt = usr->type==BCF_HT_REAL ? "USR:%s\t%d\t%e\t%d\t%d\t%d\n" : "USR:%s\t%d\t%.0f\t%d\t%d\t%d\n";
+                printf(fmt,usr->tag,id,val,usr->vals_ts[j]+usr->vals_tv[j],usr->vals_ts[j],usr->vals_tv[j]);
+            }
+        }
+    }
+    printf("# IDD, InDel distribution:\n# IDD\t[2]id\t[3]length (deletions negative)\t[4]count\n");
+    for (id=0; id<args->nstats; id++)
+    {
+        stats_t *stats = &args->stats[id];
+        for (i=stats->m_indel-1; i>=0; i--)
+            if ( stats->deletions[i] ) printf("IDD\t%d\t%d\t%d\n", id,-i-1,stats->deletions[i]);
+        for (i=0; i<stats->m_indel; i++)
+            if ( stats->insertions[i] ) printf("IDD\t%d\t%d\t%d\n", id,i+1,stats->insertions[i]);
+    }
+    printf("# ST, Substitution types:\n# ST\t[2]id\t[3]type\t[4]count\n");
+    for (id=0; id<args->nstats; id++)
+    {
+        int t;
+        for (t=0; t<15; t++)
+        {
+            if ( t>>2 == (t&3) ) continue;
+            printf("ST\t%d\t%c>%c\t%d\n", id, bcf_int2acgt(t>>2),bcf_int2acgt(t&3),args->stats[id].subst[t]);
+        }
+    }
+    if ( args->files->nreaders>1 && args->files->n_smpl )
+    {
+        printf("SN\t%d\tnumber of samples:\t%d\n", 2, args->files->n_smpl);
+
+        int x;
+        for (x=0; x<2; x++)
+        {
+            gtcmp_t *stats;
+            if ( x==0 )
+            {
+                printf("# GCsAF, Genotype concordance by non-reference allele frequency (SNPs)\n# GCsAF\t[2]id\t[3]allele frequency\t[4]RR Hom matches\t[5]RA Het matches\t[6]AA Hom matches\t[7]RR Hom mismatches\t[8]RA Het mismatches\t[9]AA Hom mismatches\t[10]dosage r-squared\t[11]number of sites\n");
+                stats = args->af_gts_snps;
+            }
+            else
+            {
+                printf("# GCiAF, Genotype concordance by non-reference allele frequency (indels)\n# GCiAF\t[2]id\t[3]allele frequency\t[4]RR Hom matches\t[5]RA Het matches\t[6]AA Hom matches\t[7]RR Hom mismatches\t[8]RA Het mismatches\t[9]AA Hom mismatches\t[10]dosage r-squared\t[11]number of sites\n");
+                stats = args->af_gts_indels;
+            }
+            uint64_t nrd_m[3] = {0,0,0}, nrd_mm[3] = {0,0,0};
+            for (i=0; i<args->m_af; i++)
+            {
+                int j, n = 0;
+                for (j=0; j<3; j++)
+                {
+                    n += stats[i].m[j] + stats[i].mm[j];
+                    nrd_m[j]  += stats[i].m[j];
+                    nrd_mm[j] += stats[i].mm[j];
+                }
+                if ( !i || !n ) continue;   // skip singleton stats and empty bins
+                printf("GC%cAF\t2\t%f", x==0 ? 's' : 'i', 100.*(i-1)/(args->m_af-1));
+                printf("\t%"PRId64"\t%"PRId64"\t%"PRId64"", stats[i].m[T2S(GT_HOM_RR)],stats[i].m[T2S(GT_HET_RA)],stats[i].m[T2S(GT_HOM_AA)]);
+                printf("\t%"PRId64"\t%"PRId64"\t%"PRId64"", stats[i].mm[T2S(GT_HOM_RR)],stats[i].mm[T2S(GT_HET_RA)],stats[i].mm[T2S(GT_HOM_AA)]);
+                printf("\t%f\t%"PRId32"\n", stats[i].r2n ? stats[i].r2sum/stats[i].r2n : -1.0, stats[i].r2n);
+            }
+
+            if ( x==0 )
+            {
+                printf("# NRD and discordance is calculated as follows:\n");
+                printf("#   m .. number of matches\n");
+                printf("#   x .. number of mismatches\n");
+                printf("#   NRD = (xRR + xRA + xAA) / (xRR + xRA + xAA + mRA + mAA)\n");
+                printf("#   RR discordance = xRR / (xRR + mRR)\n");
+                printf("#   RA discordance = xRA / (xRA + mRA)\n");
+                printf("#   AA discordance = xAA / (xAA + mAA)\n");
+                printf("# Non-Reference Discordance (NRD), SNPs\n# NRDs\t[2]id\t[3]NRD\t[4]Ref/Ref discordance\t[5]Ref/Alt discordance\t[6]Alt/Alt discordance\n");
+            }
+            else
+                printf("# Non-Reference Discordance (NRD), indels\n# NRDi\t[2]id\t[3]NRD\t[4]Ref/Ref discordance\t[5]Ref/Alt discordance\t[6]Alt/Alt discordance\n");
+            uint64_t m  = nrd_m[T2S(GT_HET_RA)] + nrd_m[T2S(GT_HOM_AA)];
+            uint64_t mm = nrd_mm[T2S(GT_HOM_RR)] + nrd_mm[T2S(GT_HET_RA)] + nrd_mm[T2S(GT_HOM_AA)];
+            printf("NRD%c\t2\t%f\t%f\t%f\t%f\n", x==0 ? 's' : 'i',
+                    m+mm ? mm*100.0/(m+mm) : 0,
+                    nrd_m[T2S(GT_HOM_RR)]+nrd_mm[T2S(GT_HOM_RR)] ? nrd_mm[T2S(GT_HOM_RR)]*100.0/(nrd_m[T2S(GT_HOM_RR)]+nrd_mm[T2S(GT_HOM_RR)]) : 0,
+                    nrd_m[T2S(GT_HET_RA)]+nrd_mm[T2S(GT_HET_RA)] ? nrd_mm[T2S(GT_HET_RA)]*100.0/(nrd_m[T2S(GT_HET_RA)]+nrd_mm[T2S(GT_HET_RA)]) : 0,
+                    nrd_m[T2S(GT_HOM_AA)]+nrd_mm[T2S(GT_HOM_AA)] ? nrd_mm[T2S(GT_HOM_AA)]*100.0/(nrd_m[T2S(GT_HOM_AA)]+nrd_mm[T2S(GT_HOM_AA)]) : 0
+                  );
+        }
+
+        for (x=0; x<2; x++)
+        {
+            gtcmp_t *stats;
+            if ( x==0 )
+            {
+                printf("# GCcS, Genotype concordance by sample (SNPs)\n# GCsS\t[2]id\t[3]sample\t[4]non-reference discordance rate\t[5]RR Hom matches\t[6]RA Het matches\t[7]AA Hom matches\t[8]RR Hom mismatches\t[9]RA Het mismatches\t[10]AA Hom mismatches\n");
+                stats = args->smpl_gts_snps;
+            }
+            else
+            {
+                printf("# GCiS, Genotype concordance by sample (indels)\n# GCiS\t[2]id\t[3]sample\t[4]non-reference discordance rate\t[5]RR Hom matches\t[6]RA Het matches\t[7]AA Hom matches\t[8]RR Hom mismatches\t[9]RA Het mismatches\t[10]AA Hom mismatches\n");
+                stats = args->smpl_gts_indels;
+            }
+            for (i=0; i<args->files->n_smpl; i++)
+            {
+                uint64_t m  = stats[i].m[T2S(GT_HET_RA)] + stats[i].m[T2S(GT_HOM_AA)];
+                uint64_t mm = stats[i].mm[T2S(GT_HOM_RR)] + stats[i].mm[T2S(GT_HET_RA)] + stats[i].mm[T2S(GT_HOM_AA)];
+                printf("GC%cS\t2\t%s\t%.3f",  x==0 ? 's' : 'i', args->files->samples[i], m+mm ? mm*100.0/(m+mm) : 0);
+                printf("\t%"PRId64"\t%"PRId64"\t%"PRId64"", stats[i].m[T2S(GT_HOM_RR)],stats[i].m[T2S(GT_HET_RA)],stats[i].m[T2S(GT_HOM_AA)]);
+                printf("\t%"PRId64"\t%"PRId64"\t%"PRId64"\n", stats[i].mm[T2S(GT_HOM_RR)],stats[i].mm[T2S(GT_HET_RA)],stats[i].mm[T2S(GT_HOM_AA)]);
+            }
+        }
+    }
+
+    printf("# DP, Depth distribution\n# DP\t[2]id\t[3]bin\t[4]number of genotypes\t[5]fraction of genotypes (%%)\t[6]number of sites\t[7]fraction of sites (%%)\n");
+    for (id=0; id<args->nstats; id++)
+    {
+        stats_t *stats = &args->stats[id];
+        long unsigned int sum = 0, sum_sites = 0;
+        for (i=0; i<stats->dp.m_vals; i++) { sum += stats->dp.vals[i]; sum_sites += stats->dp_sites.vals[i]; }
+        for (i=0; i<stats->dp.m_vals; i++)
+        {
+            if ( stats->dp.vals[i]==0 && stats->dp_sites.vals[i]==0 ) continue;
+            printf("DP\t%d\t", id);
+            if ( i==0 ) printf("<%d", stats->dp.min);
+            else if ( i+1==stats->dp.m_vals ) printf(">%d", stats->dp.max);
+            else printf("%d", idist_i2bin(&stats->dp,i));
+            printf("\t%"PRId64"\t%f", stats->dp.vals[i], sum ? stats->dp.vals[i]*100./sum : 0);
+            printf("\t%"PRId64"\t%f\n", stats->dp_sites.vals[i], sum_sites ? stats->dp_sites.vals[i]*100./sum_sites : 0);
+        }
+    }
+
+    if ( args->files->n_smpl )
+    {
+        printf("# PSC, Per-sample counts\n# PSC\t[2]id\t[3]sample\t[4]nRefHom\t[5]nNonRefHom\t[6]nHets\t[7]nTransitions\t[8]nTransversions\t[9]nIndels\t[10]average depth\t[11]nSingletons\n");
+        for (id=0; id<args->nstats; id++)
+        {
+            stats_t *stats = &args->stats[id];
+            for (i=0; i<args->files->n_smpl; i++)
+            {
+                float dp = stats->smpl_ndp[i] ? stats->smpl_dp[i]/(float)stats->smpl_ndp[i] : 0;
+                printf("PSC\t%d\t%s\t%d\t%d\t%d\t%d\t%d\t%d\t%.1f\t%d\n", id,args->files->samples[i],
+                    stats->smpl_homRR[i], stats->smpl_homAA[i], stats->smpl_hets[i], stats->smpl_ts[i],
+                    stats->smpl_tv[i], stats->smpl_indels[i],dp, stats->smpl_sngl[i]);
+            }
+        }
+
+
+        if ( args->exons )
+        {
+            printf("# PSI, Per-Sample Indels\n# PSI\t[2]id\t[3]sample\t[4]in-frame\t[5]out-frame\t[6]not applicable\t[7]out/(in+out) ratio\n");
+            for (id=0; id<args->nstats; id++)
+            {
+                stats_t *stats = &args->stats[id];
+                for (i=0; i<args->files->n_smpl; i++)
+                {
+                    int na  = stats->smpl_frm_shifts[i*3 + 0];
+                    int in  = stats->smpl_frm_shifts[i*3 + 1];
+                    int out = stats->smpl_frm_shifts[i*3 + 2];
+                    printf("PSI\t%d\t%s\t%d\t%d\t%d\t%.2f\n", id,args->files->samples[i], in,out,na,in+out?1.0*out/(in+out):0);
+                }
+            }
+        }
+
+        #ifdef HWE_STATS
+        printf("# HWE\n# HWE\t[2]id\t[3]1st ALT allele frequency\t[4]Number of observations\t[5]25th percentile\t[6]median\t[7]75th percentile\n");
+        for (id=0; id<args->nstats; id++)
+        {
+            stats_t *stats = &args->stats[id];
+            for (i=0; i<args->naf_hwe; i++) stats->af_hwe[i+args->naf_hwe] += stats->af_hwe[i]; // singletons
+            for (i=1; i<args->m_af; i++)
+            {
+                unsigned int sum_tot = 0, sum_tmp = 0;
+                int j, *ptr = &stats->af_hwe[i*args->naf_hwe];
+                for (j=0; j<args->naf_hwe; j++) sum_tot += ptr[j];
+                if ( !sum_tot ) continue;
+
+                int nprn = 3;
+                printf("HWE\t%d\t%f\t%d",id,100.*(i-1)/(args->m_af-1),sum_tot);
+                for (j=0; j<args->naf_hwe; j++)
+                {
+                    sum_tmp += ptr[j];
+                    float frac = (float)sum_tmp/sum_tot;
+                    if ( frac >= 0.75 )
+                    {
+                        while (nprn>0) { printf("\t%f", (float)j/args->naf_hwe); nprn--; }
+                        break;
+                    }
+                    if ( frac >= 0.5 )
+                    {
+                        while (nprn>1) { printf("\t%f", (float)j/args->naf_hwe); nprn--; }
+                        continue;
+                    }
+                    if ( frac >= 0.25 )
+                    {
+                        while (nprn>2) { printf("\t%f", (float)j/args->naf_hwe); nprn--; }
+                    }
+                }
+                assert(nprn==0);
+                printf("\n");
+            }
+        }
+        #endif
+    }
+}
+
+static void usage(void)
+{
+    fprintf(stderr, "\n");
+    fprintf(stderr, "About:   Parses VCF or BCF and produces stats which can be plotted using plot-vcfstats.\n");
+    fprintf(stderr, "         When two files are given, the program generates separate stats for intersection\n");
+    fprintf(stderr, "         and the complements. By default only sites are compared, -s/-S must given to include\n");
+    fprintf(stderr, "         also sample columns.\n");
+    fprintf(stderr, "Usage:   bcftools stats [options] <A.vcf.gz> [<B.vcf.gz>]\n");
+    fprintf(stderr, "\n");
+    fprintf(stderr, "Options:\n");
+    fprintf(stderr, "    -1, --1st-allele-only              include only 1st allele at multiallelic sites\n");
+    fprintf(stderr, "    -c, --collapse <string>            treat as identical records with <snps|indels|both|all|some|none>, see man page for details [none]\n");
+    fprintf(stderr, "    -d, --depth <int,int,int>          depth distribution: min,max,bin size [0,500,1]\n");
+    fprintf(stderr, "    -e, --exons <file.gz>              tab-delimited file with exons for indel frameshifts (chr,from,to; 1-based, inclusive, bgzip compressed)\n");
+    fprintf(stderr, "    -f, --apply-filters <list>         require at least one of the listed FILTER strings (e.g. \"PASS,.\")\n");
+    fprintf(stderr, "    -F, --fasta-ref <file>             faidx indexed reference sequence file to determine INDEL context\n");
+    fprintf(stderr, "    -i, --split-by-ID                  collect stats for sites with ID separately (known vs novel)\n");
+    fprintf(stderr, "    -r, --regions <region>             restrict to comma-separated list of regions\n");
+    fprintf(stderr, "    -R, --regions-file <file>          restrict to regions listed in a file\n");
+    fprintf(stderr, "    -s, --samples <list>               list of samples for sample stats, \"-\" to include all samples\n");
+    fprintf(stderr, "    -S, --samples-file <file>          file of samples to include\n");
+    fprintf(stderr, "    -t, --targets <region>             similar to -r but streams rather than index-jumps\n");
+    fprintf(stderr, "    -T, --targets-file <file>          similar to -R but streams rather than index-jumps\n");
+    fprintf(stderr, "    -u, --user-tstv <TAG[:min:max:n]>  collect Ts/Tv stats for any tag using the given binning [0:1:100]\n");
+    fprintf(stderr, "    -v, --verbose                      produce verbose per-site and per-sample output\n");
+    fprintf(stderr, "\n");
+    exit(1);
+}
+
+int main_vcfstats(int argc, char *argv[])
+{
+    int c;
+    args_t *args = (args_t*) calloc(1,sizeof(args_t));
+    args->files  = bcf_sr_init();
+    args->argc   = argc; args->argv = argv;
+    args->dp_min = 0; args->dp_max = 500; args->dp_step = 1;
+    int regions_is_file = 0, targets_is_file = 0;
+
+    static struct option loptions[] =
+    {
+        {"1st-allele-only",0,0,'1'},
+        {"help",0,0,'h'},
+        {"collapse",1,0,'c'},
+        {"regions",1,0,'r'},
+        {"regions-file",1,0,'R'},
+        {"verbose",0,0,'v'},
+        {"depth",1,0,'d'},
+        {"apply-filters",1,0,'f'},
+        {"exons",1,0,'e'},
+        {"samples",1,0,'s'},
+        {"samples-file",1,0,'S'},
+        {"split-by-ID",0,0,'i'},
+        {"targets",1,0,'t'},
+        {"targets-file",1,0,'T'},
+        {"fasta-ref",1,0,'F'},
+        {"user-tstv",1,0,'u'},
+        {0,0,0,0}
+    };
+    while ((c = getopt_long(argc, argv, "hc:r:R:e:s:S:d:it:T:F:f:1u:v",loptions,NULL)) >= 0) {
+        switch (c) {
+            case 'u': add_user_stats(args,optarg); break;
+            case '1': args->first_allele_only = 1; break;
+            case 'F': args->ref_fname = optarg; break;
+            case 't': args->targets_list = optarg; break;
+            case 'T': args->targets_list = optarg; targets_is_file = 1; break;
+            case 'c':
+                if ( !strcmp(optarg,"snps") ) args->files->collapse |= COLLAPSE_SNPS;
+                else if ( !strcmp(optarg,"indels") ) args->files->collapse |= COLLAPSE_INDELS;
+                else if ( !strcmp(optarg,"both") ) args->files->collapse |= COLLAPSE_SNPS | COLLAPSE_INDELS;
+                else if ( !strcmp(optarg,"any") ) args->files->collapse |= COLLAPSE_ANY;
+                else if ( !strcmp(optarg,"all") ) args->files->collapse |= COLLAPSE_ANY;
+                else if ( !strcmp(optarg,"some") ) args->files->collapse |= COLLAPSE_SOME;
+                else if ( !strcmp(optarg,"none") ) args->files->collapse = COLLAPSE_NONE;
+                else error("The --collapse string \"%s\" not recognised.\n", optarg);
+                break;
+            case 'v': args->verbose_sites = 1; break;
+            case 'd':
+                if ( sscanf(optarg,"%d,%d,%d",&args->dp_min,&args->dp_max,&args->dp_step)!=3 )
+                    error("Could not parse --depth %s\n", optarg);
+                if ( args->dp_min<0 || args->dp_min >= args->dp_max || args->dp_step > args->dp_max - args->dp_min + 1 )
+                    error("Is this a typo? --depth %s\n", optarg);
+                break;
+            case 'f': args->files->apply_filters = optarg; break;
+            case 'r': args->regions_list = optarg; break;
+            case 'R': args->regions_list = optarg; regions_is_file = 1; break;
+            case 'e': args->exons_fname = optarg; break;
+            case 's': args->samples_list = optarg; break;
+            case 'S': args->samples_list = optarg; args->samples_is_file = 1; break;
+            case 'i': args->split_by_id = 1; break;
+            case 'h':
+            case '?': usage();
+            default: error("Unknown argument: %s\n", optarg);
+        }
+    }
+    char *fname = NULL;
+    if ( optind==argc )
+    {
+        if ( !isatty(fileno((FILE *)stdin)) ) fname = "-";  // reading from stdin
+        else usage();
+    }
+    else fname = argv[optind];
+
+    if ( argc-optind>2 ) usage();
+    if ( argc-optind>1 )
+    {
+        args->files->require_index = 1;
+        if ( args->split_by_id ) error("Only one file can be given with -i.\n");
+    }
+    if ( !args->samples_list ) args->files->max_unpack = BCF_UN_INFO;
+    if ( args->targets_list && bcf_sr_set_targets(args->files, args->targets_list, targets_is_file, 0)<0 )
+        error("Failed to read the targets: %s\n", args->targets_list);
+    if ( args->regions_list && bcf_sr_set_regions(args->files, args->regions_list, regions_is_file)<0 )
+        error("Failed to read the regions: %s\n", args->regions_list);
+    while (fname)
+    {
+        if ( !bcf_sr_add_reader(args->files, fname) )
+            error("Failed to open %s: %s\n", fname,bcf_sr_strerror(args->files->errnum));
+        fname = ++optind < argc ? argv[optind] : NULL;
+    }
+
+    init_stats(args);
+    print_header(args);
+    do_vcf_stats(args);
+    print_stats(args);
+    destroy_stats(args);
+    bcf_sr_destroy(args->files);
+    free(args);
+    return 0;
+}
+
diff --git a/vcfutils.pl b/vcfutils.pl
new file mode 100755
index 0000000..03839ae
--- /dev/null
+++ b/vcfutils.pl
@@ -0,0 +1,588 @@
+#!/usr/bin/perl -w
+#
+#   Copyright (C) 2010 Broad Institute.
+#   Copyright (C) 2011, 2014 Genome Research Ltd.
+#
+#   Author: Heng Li <lh3 at sanger.ac.uk>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+
+use strict;
+use warnings;
+use Getopt::Std;
+
+&main;
+exit;
+
+sub main {
+  &usage if (@ARGV < 1);
+  my $command = shift(@ARGV);
+  my %func = (subsam=>\&subsam, listsam=>\&listsam, fillac=>\&fillac, qstats=>\&qstats, varFilter=>\&varFilter,
+              hapmap2vcf=>\&hapmap2vcf, ucscsnp2vcf=>\&ucscsnp2vcf, filter4vcf=>\&varFilter, ldstats=>\&ldstats,
+              gapstats=>\&gapstats, splitchr=>\&splitchr, vcf2fq=>\&vcf2fq);
+  die("Unknown command \"$command\".\n") if (!defined($func{$command}));
+  &{$func{$command}};
+}
+
+sub splitchr {
+  my %opts = (l=>5000000);
+  getopts('l:', \%opts);
+  my $l = $opts{l};
+  die(qq/Usage: vcfutils.pl splitchr [-l $opts{l}] <in.fa.fai>\n/) if (@ARGV == 0 && -t STDIN);
+  while (<>) {
+    my @t = split;
+    my $last = 0;
+    for (my $i = 0; $i < $t[1];) {
+      my $e = ($t[1] - $i) / $l < 1.1? $t[1] : $i + $l;
+      print "$t[0]:".($i+1)."-$e\n";
+      $i = $e;
+    }
+  }
+}
+
+sub subsam {
+  die(qq/Usage: vcfutils.pl subsam <in.vcf> [samples]\n/) if (@ARGV == 0);
+  my ($fh, %h);
+  my $fn = shift(@ARGV);
+  my @col;
+  open($fh, ($fn =~ /\.gz$/)? "gzip -dc $fn |" : $fn) || die;
+  $h{$_} = 1 for (@ARGV);
+  while (<$fh>) {
+    if (/^##/) {
+      print;
+    } elsif (/^#/) {
+      my @t = split;
+      my @s = @t[0..8]; # all fixed fields + FORMAT
+      for (9 .. $#t) {
+        if ($h{$t[$_]}) {
+          push(@s, $t[$_]);
+          push(@col, $_);
+        }
+      }
+      pop(@s) if (@s == 9); # no sample selected; remove the FORMAT field
+      print join("\t", @s), "\n";
+    } else {
+      my @t = split;
+      if (@col == 0) {
+        print join("\t", @t[0..7]), "\n";
+      } else {
+        print join("\t", @t[0..8], map {$t[$_]} @col), "\n";
+      }
+    }
+  }
+  close($fh);
+}
+
+sub listsam {
+  die(qq/Usage: vcfutils.pl listsam <in.vcf>\n/) if (@ARGV == 0 && -t STDIN);
+  while (<>) {
+    if (/^#/ && !/^##/) {
+      my @t = split;
+      print join("\n", @t[9..$#t]), "\n";
+      exit;
+    }
+  }
+}
+
+sub fillac {
+  die(qq/Usage: vcfutils.pl fillac <in.vcf>\n\nNote: The GT field MUST BE present and always appear as the first field.\n/) if (@ARGV == 0 && -t STDIN);
+  while (<>) {
+    if (/^#/) {
+      print;
+    } else {
+      my @t = split;
+      my @c = (0, 0);
+      my $n = 0;
+      my $s = -1;
+      @_ = split(":", $t[8]);
+      for (0 .. $#_) {
+        if ($_[$_] eq 'GT') { $s = $_; last; }
+      }
+      if ($s < 0) {
+        print join("\t", @t), "\n";
+        next;
+      }
+      for (9 .. $#t) {
+        if ($t[$_] =~ /^0,0,0/) {
+        } elsif ($t[$_] =~ /^([^\s:]+:){$s}(\d+).(\d+)/) {
+          ++$c[$2]; ++$c[$3];
+          $n += 2;
+        }
+      }
+      my $AC = "AC=" . join("\t", @c[1..$#c]) . ";AN=$n";
+      my $info = $t[7];
+      $info =~ s/(;?)AC=(\d+)//;
+      $info =~ s/(;?)AN=(\d+)//;
+      if ($info eq '.') {
+        $info = $AC;
+      } else {
+        $info .= ";$AC";
+      }
+      $t[7] = $info;
+      print join("\t", @t), "\n";
+    }
+  }
+}
+
+sub ldstats {
+  my %opts = (t=>0.9);
+  getopts('t:', \%opts);
+  die("Usage: vcfutils.pl ldstats [-t $opts{t}] <in.vcf>\n") if (@ARGV == 0 && -t STDIN);
+  my $cutoff = $opts{t};
+  my ($last, $lastchr) = (0x7fffffff, '');
+  my ($x, $y, $n) = (0, 0, 0);
+  while (<>) {
+    if (/^([^#\s]+)\s(\d+)/) {
+      my ($chr, $pos) = ($1, $2);
+      if (/NEIR=([\d\.]+)/) {
+        ++$n;
+        ++$y, $x += $pos - $last if ($lastchr eq $chr && $pos > $last && $1 > $cutoff);
+      }
+      $last = $pos; $lastchr = $chr;
+    }
+  }
+  print "Number of SNP intervals in strong LD (r > $opts{t}): $y\n";
+  print "Fraction: ", $y/$n, "\n";
+  print "Length: $x\n";
+}
+
+sub qstats {
+  my %opts = (r=>'', s=>0.02, v=>undef);
+  getopts('r:s:v', \%opts);
+  die("Usage: vcfutils.pl qstats [-r ref.vcf] <in.vcf>\n
+Note: This command discards indels. Output: QUAL #non-indel #SNPs #transitions #joint ts/tv #joint/#ref #joint/#non-indel \n") if (@ARGV == 0 && -t STDIN);
+  my %ts = (AG=>1, GA=>1, CT=>1, TC=>1);
+  my %h = ();
+  my $is_vcf = defined($opts{v})? 1 : 0;
+  if ($opts{r}) { # read the reference positions
+    my $fh;
+    open($fh, $opts{r}) || die;
+    while (<$fh>) {
+      next if (/^#/);
+      if ($is_vcf) {
+        my @t = split;
+        $h{$t[0],$t[1]} = $t[4];
+      } else {
+        $h{$1,$2} = 1 if (/^(\S+)\s+(\d+)/);
+      }
+    }
+    close($fh);
+  }
+  my $hsize = scalar(keys %h);
+  my @a;
+  while (<>) {
+    next if (/^#/);
+    my @t = split;
+    next if (length($t[3]) != 1 || uc($t[3]) eq 'N');
+    $t[3] = uc($t[3]); $t[4] = uc($t[4]);
+    my @s = split(',', $t[4]);
+    $t[5] = 3 if ($t[5] eq '.' || $t[5] < 0);
+    next if (length($s[0]) != 1);
+    my $hit;
+    if ($is_vcf) {
+      $hit = 0;
+      my $aa = $h{$t[0],$t[1]};
+      if (defined($aa)) {
+        my @aaa = split(",", $aa);
+        for (@aaa) {
+          $hit = 1 if ($_ eq $s[0]);
+        }
+      }
+    } else {
+      $hit = defined($h{$t[0],$t[1]})? 1 : 0;
+    }
+    push(@a, [$t[5], ($t[4] eq '.' || $t[4] eq $t[3])? 0 : 1, $ts{$t[3].$s[0]}? 1 : 0, $hit]);
+  }
+  push(@a, [-1, 0, 0, 0]); # end marker
+  die("[qstats] No SNP data!\n") if (@a == 0);
+  @a = sort {$b->[0]<=>$a->[0]} @a;
+  my $next = $opts{s};
+  my $last = $a[0];
+  my @c = (0, 0, 0, 0);
+  my @lc;
+  $lc[1] = $lc[2] = 0;
+  for my $p (@a) {
+    if ($p->[0] == -1 || ($p->[0] != $last && $c[0]/@a > $next)) {
+      my @x;
+      $x[0] = sprintf("%.4f", $c[1]-$c[2]? $c[2] / ($c[1] - $c[2]) : 100);
+      $x[1] = sprintf("%.4f", $hsize? $c[3] / $hsize : 0);
+      $x[2] = sprintf("%.4f", $c[3] / $c[1]);
+      my $a = $c[1] - $lc[1];
+      my $b = $c[2] - $lc[2];
+      $x[3] = sprintf("%.4f", $a-$b? $b / ($a-$b) : 100);
+      print join("\t", $last, @c, @x), "\n";
+      $next = $c[0]/@a + $opts{s};
+      $lc[1] = $c[1]; $lc[2] = $c[2];
+    }
+    ++$c[0]; $c[1] += $p->[1]; $c[2] += $p->[2]; $c[3] += $p->[3];
+    $last = $p->[0];
+  }
+}
+
+sub varFilter {
+  my %opts = (d=>2, D=>10000000, a=>2, W=>10, Q=>10, w=>3, p=>undef, 1=>1e-4, 2=>1e-100, 3=>0, 4=>1e-4, G=>0, S=>1000, e=>1e-4);
+  getopts('pd:D:W:Q:w:a:1:2:3:4:G:S:e:', \%opts);
+  die(qq/
+Usage:   vcfutils.pl varFilter [options] <in.vcf>
+
+Options: -Q INT    minimum RMS mapping quality for SNPs [$opts{Q}]
+         -d INT    minimum read depth [$opts{d}]
+         -D INT    maximum read depth [$opts{D}]
+         -a INT    minimum number of alternate bases [$opts{a}]
+         -w INT    SNP within INT bp around a gap to be filtered [$opts{w}]
+         -W INT    window size for filtering adjacent gaps [$opts{W}]
+         -1 FLOAT  min P-value for strand bias (given PV4) [$opts{1}]
+         -2 FLOAT  min P-value for baseQ bias [$opts{2}]
+         -3 FLOAT  min P-value for mapQ bias [$opts{3}]
+         -4 FLOAT  min P-value for end distance bias [$opts{4}]
+         -e FLOAT  min P-value for HWE (plus F<0) [$opts{e}]
+         -p        print filtered variants
+
+Note: Some of the filters rely on annotations generated by SAMtools\/BCFtools.
+\n/) if (@ARGV == 0 && -t STDIN);
+
+  # calculate the window size
+  my ($ol, $ow) = ($opts{W}, $opts{w});
+  my $max_dist = $ol > $ow? $ol : $ow;
+  # the core loop
+  my @staging; # (indel_filtering_score, flt_tag, indel_span; chr, pos, ...)
+  while (<>) {
+    my @t = split;
+    if (/^#/) {
+      print; next;
+    }
+    next if ($t[4] eq '.'); # skip non-var sites
+    next if ($t[3] eq 'N'); # skip sites with unknown ref ('N')
+    # check if the site is a SNP
+    my $type = 1; # SNP
+    if (length($t[3]) > 1) {
+      $type = 2; # MNP
+      my @s = split(',', $t[4]);
+      for (@s) {
+        $type = 3 if (length != length($t[3]));
+      }
+    } else {
+      my @s = split(',', $t[4]);
+      for (@s) {
+        $type = 3 if (length > 1);
+      }
+    }
+    # clear the out-of-range elements
+    while (@staging) {
+      # Still on the same chromosome and the first element's window still affects this position?
+      last if ($staging[0][3] eq $t[0] && $staging[0][4] + $staging[0][2] + $max_dist >= $t[1]);
+      varFilter_aux(shift(@staging), $opts{p}); # calling a function is a bit slower, not much
+    }
+    my $flt = 0;
+    # parse annotations
+    my ($dp, $mq, $dp_alt) = (-1, -1, -1);
+    if ($t[7] =~ /DP4=(\d+),(\d+),(\d+),(\d+)/i) {
+      $dp = $1 + $2 + $3 + $4;
+      $dp_alt = $3 + $4;
+    }
+    if ($t[7] =~ /DP=(\d+)/i) {
+      $dp = $1;
+    }
+    $mq = $1 if ($t[7] =~ /MQ=(\d+)/i);
+    # the depth and mapQ filter
+    if ($dp >= 0) {
+      if ($dp < $opts{d}) {
+        $flt = 2;
+      } elsif ($dp > $opts{D}) {
+        $flt = 3;
+      }
+    }
+    $flt = 4 if ($dp_alt >= 0 && $dp_alt < $opts{a});
+    $flt = 1 if ($flt == 0 && $mq >= 0 && $mq < $opts{Q});
+    $flt = 7 if ($flt == 0 && /PV4=([^,]+),([^,]+),([^,]+),([^,;\t]+)/
+                 && ($1<$opts{1} || $2<$opts{2} || $3<$opts{3} || $4<$opts{4}));
+    $flt = 8 if ($flt == 0 && ((/MXGQ=(\d+)/ && $1 < $opts{G}) || (/MXSP=(\d+)/ && $1 >= $opts{S})));
+    # HWE filter
+    if ($t[7] =~ /G3=([^;,]+),([^;,]+),([^;,]+).*HWE=([^;,]+)/ && $4 < $opts{e}) {
+        my $p = 2*$1 + $2;
+        my $f = ($p > 0 && $p < 1)? 1 - $2 / ($p * (1-$p)) : 0;
+        $flt = 9 if ($f < 0);
+    }
+
+    my $score = $t[5] * 100 + $dp_alt;
+    my $rlen = length($t[3]) - 1; # $indel_score<0 for SNPs
+    if ($flt == 0) {
+      if ($type == 3) { # an indel
+        # filtering SNPs and MNPs
+        for my $x (@staging) {
+          next if (($x->[0]&3) == 3 || $x->[1] || $x->[4] + $x->[2] + $ow < $t[1]);
+          $x->[1] = 5;
+        }
+        # check the staging list for indel filtering
+        for my $x (@staging) {
+          next if (($x->[0]&3) != 3 || $x->[1] || $x->[4] + $x->[2] + $ol < $t[1]);
+          if ($x->[0]>>2 < $score) {
+            $x->[1] = 6;
+          } else {
+            $flt = 6; last;
+          }
+        }
+      } else { # SNP or MNP
+        for my $x (@staging) {
+          next if (($x->[0]&3) != 3 || $x->[4] + $x->[2] + $ow < $t[1]);
+          if ($x->[4] + length($x->[7]) - 1 == $t[1] && substr($x->[7], -1, 1) eq substr($t[4], 0, 1)
+              && length($x->[7]) - length($x->[6]) == 1) {
+            $x->[1] = 5;
+          } else { $flt = 5; }
+          last;
+        }
+        # check MNP
+        for my $x (@staging) {
+          next if (($x->[0]&3) == 3 || $x->[4] + $x->[2] < $t[1]);
+          if ($x->[0]>>2 < $score) {
+            $x->[1] = 8;
+          } else {
+            $flt = 8; last;
+          }
+        }
+      }
+    }
+    push(@staging, [$score<<2|$type, $flt, $rlen, @t]);
+  }
+  # output the last few elements in the staging list
+  while (@staging) {
+    varFilter_aux(shift @staging, $opts{p});
+  }
+}
+
+sub varFilter_aux {
+  my ($first, $is_print) = @_;
+  if ($first->[1] == 0) {
+    print join("\t", @$first[3 .. @$first-1]), "\n";
+  } elsif ($is_print) {
+    print STDERR join("\t", substr("UQdDaGgPMS", $first->[1], 1), @$first[3 .. @$first-1]), "\n";
+  }
+}
+
+sub gapstats {
+  my (@c0, @c1);
+  $c0[$_] = $c1[$_] = 0 for (0 .. 10000);
+  while (<>) {
+    next if (/^#/);
+    my @t = split;
+    next if (length($t[3]) == 1 && $t[4] =~ /^[A-Za-z](,[A-Za-z])*$/); # not an indel
+    my @s = split(',', $t[4]);
+    for my $x (@s) {
+      my $l = length($x) - length($t[3]) + 5000;
+      if ($x =~ /^-/) {
+        $l = -(length($x) - 1) + 5000;
+      } elsif ($x =~ /^\+/) {
+        $l = length($x) - 1 + 5000;
+      }
+      $c0[$l] += 1 / @s;
+    }
+  }
+  for (my $i = 0; $i < 10000; ++$i) {
+    next if ($c0[$i] == 0);
+    $c1[0] += $c0[$i];
+    $c1[1] += $c0[$i] if (($i-5000)%3 == 0);
+    printf("C\t%d\t%.2f\n", ($i-5000), $c0[$i]);
+  }
+  printf("3\t%d\t%d\t%.3f\n", $c1[0], $c1[1], $c1[1]/$c1[0]);
+}
+
+sub ucscsnp2vcf {
+  die("Usage: vcfutils.pl <in.ucsc.snp>\n") if (@ARGV == 0 && -t STDIN);
+  print "##fileformat=VCFv4.0\n";
+  print join("\t", "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO"), "\n";
+  while (<>) {
+    my @t = split("\t");
+    my $indel = ($t[9] =~ /^[ACGT](\/[ACGT])+$/)? 0 : 1;
+    my $pos = $t[2] + 1;
+    my @alt;
+    push(@alt, $t[7]);
+    if ($t[6] eq '-') {
+      $t[9] = reverse($t[9]);
+      $t[9] =~ tr/ACGTRYMKWSNacgtrymkwsn/TGCAYRKMWSNtgcayrkmwsn/;
+    }
+    my @a = split("/", $t[9]);
+    for (@a) {
+      push(@alt, $_) if ($_ ne $alt[0]);
+    }
+    if ($indel) {
+      --$pos;
+      for (0 .. $#alt) {
+        $alt[$_] =~ tr/-//d;
+        $alt[$_] = "N$alt[$_]";
+      }
+    }
+    my $ref = shift(@alt);
+    my $af = $t[13] > 0? ";AF=$t[13]" : '';
+    my $valid = ($t[12] eq 'unknown')? '' : ";valid=$t[12]";
+    my $info = "molType=$t[10];class=$t[11]$valid$af";
+    print join("\t", $t[1], $pos, $t[4], $ref, join(",", @alt), 0, '.', $info), "\n";
+  }
+}
+
+sub hapmap2vcf {
+  die("Usage: vcfutils.pl <in.ucsc.snp> <in.hapmap>\n") if (@ARGV == 0);
+  my $fn = shift(@ARGV);
+  # parse UCSC SNP
+  warn("Parsing UCSC SNPs...\n");
+  my ($fh, %map);
+  open($fh, ($fn =~ /\.gz$/)? "gzip -dc $fn |" : $fn) || die;
+  while (<$fh>) {
+    my @t = split;
+    next if ($t[3] - $t[2] != 1); # not SNP
+    @{$map{$t[4]}} = @t[1,3,7];
+  }
+  close($fh);
+  # write VCF
+  warn("Writing VCF...\n");
+  print "##fileformat=VCFv4.0\n";
+  while (<>) {
+    my @t = split;
+    if ($t[0] eq 'rs#') { # the first line
+      print join("\t", "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT", @t[11..$#t]), "\n";
+    } else {
+      next unless ($map{$t[0]});
+      next if (length($t[1]) != 3); # skip non-SNPs
+      my $a = \@{$map{$t[0]}};
+      my $ref = $a->[2];
+      my @u = split('/', $t[1]);
+      if ($u[1] eq $ref) {
+        $u[1] = $u[0]; $u[0] = $ref;
+      } elsif ($u[0] ne $ref) { next; }
+      my $alt = $u[1];
+      my %w;
+      $w{$u[0]} = 0; $w{$u[1]} = 1;
+      my @s = (@$a[0,1], $t[0], $ref, $alt, 0, '.', '.', 'GT');
+      my $is_tri = 0;
+      for (@t[11..$#t]) {
+        if ($_ eq 'NN') {
+          push(@s, './.');
+        } else {
+          my @a = ($w{substr($_,0,1)}, $w{substr($_,1,1)});
+          if (!defined($a[0]) || !defined($a[1])) {
+            $is_tri = 1;
+            last;
+          }
+          push(@s, "$a[0]/$a[1]");
+        }
+      }
+      next if ($is_tri);
+      print join("\t", @s), "\n";
+    }
+  }
+}
+
+sub vcf2fq {
+  my %opts = (d=>3, D=>100000, Q=>10, l=>5);
+  getopts('d:D:Q:l:', \%opts);
+  die(qq/
+Usage:   vcfutils.pl vcf2fq [options] <all-site.vcf>
+
+Options: -d INT    minimum depth          [$opts{d}]
+         -D INT    maximum depth          [$opts{D}]
+         -Q INT    min RMS mapQ           [$opts{Q}]
+         -l INT    INDEL filtering window [$opts{l}]
+\n/) if (@ARGV == 0 && -t STDIN);
+
+  my ($last_chr, $seq, $qual, $last_pos, @gaps);
+  my $_Q = $opts{Q};
+  my $_d = $opts{d};
+  my $_D = $opts{D};
+
+  my %het = (AC=>'M', AG=>'R', AT=>'W', CA=>'M', CG=>'S', CT=>'Y',
+             GA=>'R', GC=>'S', GT=>'K', TA=>'W', TC=>'Y', TG=>'K');
+
+  $last_chr = '';
+  while (<>) {
+    next if (/^#/);
+    my @t = split;
+    if ($last_chr ne $t[0]) {
+      &v2q_post_process($last_chr, \$seq, \$qual, \@gaps, $opts{l}) if ($last_chr);
+      ($last_chr, $last_pos) = ($t[0], 0);
+      $seq = $qual = '';
+      @gaps = ();
+    }
+    die("[vcf2fq] unsorted input\n") if ($t[1] - $last_pos < 0);
+    if ($t[1] - $last_pos > 1) {
+      $seq .= 'n' x ($t[1] - $last_pos - 1);
+      $qual .= '!' x ($t[1] - $last_pos - 1);
+    }
+    if (length($t[3]) == 1 && $t[7] !~ /INDEL/ && $t[4] =~ /^([A-Za-z.])(,[A-Za-z])*$/) { # a SNP or reference
+      my ($ref, $alt) = ($t[3], $1);
+      my ($b, $q);
+      $q = $1 if ($t[7] =~ /FQ=(-?[\d\.]+)/);
+      if ($q < 0) {
+        $_ = ($t[7] =~ /AF1=([\d\.]+)/)? $1 : 0;
+        $b = ($_ < .5 || $alt eq '.')? $ref : $alt;
+        $q = -$q;
+      } else {
+        $b = $het{"$ref$alt"};
+        $b ||= 'N';
+      }
+      $b = lc($b);
+      $b = uc($b) if (($t[7] =~ /MQ=(\d+)/ && $1 >= $_Q) && ($t[7] =~ /DP=(\d+)/ && $1 >= $_d && $1 <= $_D));
+      $q = int($q + 33 + .499);
+      $q = chr($q <= 126? $q : 126);
+      $seq .= $b;
+      $qual .= $q;
+    } elsif ($t[4] ne '.') { # an INDEL
+      push(@gaps, [$t[1], length($t[3])]);
+    }
+    $last_pos = $t[1];
+  }
+  &v2q_post_process($last_chr, \$seq, \$qual, \@gaps, $opts{l});
+}
+
+sub v2q_post_process {
+  my ($chr, $seq, $qual, $gaps, $l) = @_;
+  for my $g (@$gaps) {
+    my $beg = $g->[0] > $l? $g->[0] - $l : 0;
+    my $end = $g->[0] + $g->[1] + $l;
+    $end = length($$seq) if ($end > length($$seq));
+    substr($$seq, $beg, $end - $beg) = lc(substr($$seq, $beg, $end - $beg));
+  }
+  print "\@$chr\n"; &v2q_print_str($seq);
+  print "+\n"; &v2q_print_str($qual);
+}
+
+sub v2q_print_str {
+  my ($s) = @_;
+  my $l = length($$s);
+  for (my $i = 0; $i < $l; $i += 60) {
+    print substr($$s, $i, 60), "\n";
+  }
+}
+
+sub usage {
+  die(qq/
+Usage:   vcfutils.pl <command> [<arguments>]\n
+Command: subsam       get a subset of samples
+         listsam      list the samples
+         fillac       fill the allele count field
+         qstats       SNP stats stratified by QUAL
+
+         hapmap2vcf   convert the hapmap format to VCF
+         ucscsnp2vcf  convert UCSC SNP SQL dump to VCF
+
+         varFilter    filtering short variants (*)
+         vcf2fq       VCF->fastq (**)
+
+Notes: Commands with description endting with (*) may need bcftools
+       specific annotations.
+\n/);
+}
diff --git a/vcfview.c b/vcfview.c
new file mode 100644
index 0000000..dd0e99b
--- /dev/null
+++ b/vcfview.c
@@ -0,0 +1,737 @@
+/*  vcfview.c -- VCF/BCF conversion, view, subset and filter VCF/BCF files.
+
+    Copyright (C) 2013-2014 Genome Research Ltd.
+
+    Author: Shane McCarthy <sm15 at sanger.ac.uk>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.  */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <getopt.h>
+#include <ctype.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <math.h>
+#include <htslib/vcf.h>
+#include <htslib/synced_bcf_reader.h>
+#include <htslib/vcfutils.h>
+#include "bcftools.h"
+#include "filter.h"
+#include "htslib/khash_str2int.h"
+
+#define FLT_INCLUDE 1
+#define FLT_EXCLUDE 2
+
+#define ALLELE_NONREF 1
+#define ALLELE_MINOR 2
+#define ALLELE_ALT1 3
+#define ALLELE_MAJOR 4
+#define ALLELE_NONMAJOR 5
+
+#define GT_NEED_HOM 1
+#define GT_NEED_HET 2
+#define GT_NO_HOM   3
+#define GT_NO_HET   4
+#define GT_NEED_MISSING 5
+#define GT_NO_MISSING 6
+
+typedef struct _args_t
+{
+    filter_t *filter;
+    char *filter_str;
+    int filter_logic;   // one of FLT_INCLUDE/FLT_EXCLUDE (-i or -e)
+
+    bcf_srs_t *files;
+    bcf_hdr_t *hdr, *hnull, *hsub; // original header, sites-only header, subset header
+    char **argv, *format, *sample_names, *subset_fname, *targets_list, *regions_list;
+    int argc, clevel, output_type, print_header, update_info, header_only, n_samples, *imap, calc_ac;
+    int trim_alts, sites_only, known, novel, min_alleles, max_alleles, private_vars, uncalled, phased;
+    int min_ac, min_ac_type, max_ac, max_ac_type, min_af_type, max_af_type, gt_type;
+    int *ac, mac;
+    float min_af, max_af;
+    char *fn_ref, *fn_out, **samples;
+    int sample_is_file, force_samples;
+    char *include_types, *exclude_types;
+    int include, exclude;
+    htsFile *out;
+}
+args_t;
+
+static void init_data(args_t *args)
+{
+    int i;
+    args->hdr = args->files->readers[0].header;
+
+    if (args->calc_ac && args->update_info)
+    {
+        bcf_hdr_append(args->hdr,"##INFO=<ID=AC,Number=A,Type=Integer,Description=\"Allele count in genotypes\">");
+        bcf_hdr_append(args->hdr,"##INFO=<ID=AN,Number=1,Type=Integer,Description=\"Total number of alleles in called genotypes\">");
+    }
+    bcf_hdr_append_version(args->hdr, args->argc, args->argv, "bcftools_view");
+
+    // setup sample data
+    if (args->sample_names)
+    {
+        void *hdr_samples = khash_str2int_init();
+        for (i=0; i<bcf_hdr_nsamples(args->hdr); i++)
+            khash_str2int_inc(hdr_samples, bcf_hdr_int2id(args->hdr,BCF_DT_SAMPLE,i));
+
+        void *exclude = (args->sample_names[0]=='^') ? khash_str2int_init() : NULL;
+        int nsmpl;
+        char **smpl = NULL;
+        args->samples = NULL; args->n_samples = 0;
+        smpl = hts_readlist(exclude ? &args->sample_names[1] : args->sample_names, args->sample_is_file, &nsmpl);
+        if ( !smpl )
+        {
+            error("Could not read the list: \"%s\"\n", exclude ? &args->sample_names[1] : args->sample_names);
+        }
+
+        if ( exclude )
+        {
+            for (i=0; i<nsmpl; i++) {
+                if (!khash_str2int_has_key(hdr_samples,smpl[i])) {
+                    if (args->force_samples) {
+                        fprintf(stderr, "Warn: exclude called for sample that does not exist in header: \"%s\"... skipping\n", smpl[i]);
+                    } else {
+                        error("Error: exclude called for sample that does not exist in header: \"%s\". Use \"--force-samples\" to ignore this error.\n", smpl[i]);
+                    }
+                }
+                khash_str2int_inc(exclude, smpl[i]);
+            }
+
+            for (i=0; i<bcf_hdr_nsamples(args->hdr); i++)
+            {
+                if ( exclude && khash_str2int_has_key(exclude,bcf_hdr_int2id(args->hdr,BCF_DT_SAMPLE,i))  ) continue;
+                args->samples = (char**) realloc(args->samples, (args->n_samples+1)*sizeof(const char*));
+                args->samples[args->n_samples++] = strdup(bcf_hdr_int2id(args->hdr,BCF_DT_SAMPLE,i));
+            }
+            khash_str2int_destroy(exclude);
+        }
+        else
+        {
+            for (i=0; i<nsmpl; i++) {
+                if (!khash_str2int_has_key(hdr_samples,smpl[i])) {
+                    if (args->force_samples) {
+                        fprintf(stderr, "Warn: subset called for sample that does not exist in header: \"%s\"... skipping\n", smpl[i]);
+                        continue;
+                    } else {
+                        error("Error: subset called for sample that does not exist in header: \"%s\". Use \"--force-samples\" to ignore this error.\n", smpl[i]);
+                    }
+                }
+                args->samples = (char**) realloc(args->samples, (args->n_samples+1)*sizeof(const char*));
+                args->samples[args->n_samples++] = strdup(smpl[i]);
+            }
+        }
+        for (i=0; i<nsmpl; i++) free(smpl[i]);
+        free(smpl);
+        khash_str2int_destroy(hdr_samples);
+        if (args->n_samples == 0) {
+            fprintf(stderr, "Warn: subsetting has removed all samples\n");
+            args->sites_only = 1;
+        }
+    }
+
+    if (args->n_samples)
+        args->imap = (int*)malloc(args->n_samples * sizeof(int));
+
+    // determine variant types to include/exclude
+    if (args->include_types || args->exclude_types) {
+        if (args->include_types && args->exclude_types) {
+            fprintf(stderr, "Error: only supply one of --include-types, --exclude-types options\n");
+            exit(1);
+        }
+        char **type_list = 0;
+        int m = 0, n = 0;
+        const char *q, *p;
+        for (q = p = args->include_types ? args->include_types : args->exclude_types;; ++p) {
+            if (*p == ',' || *p == 0) {
+                if (m == n) {
+                    m = m? m<<1 : 16;
+                    type_list = (char**)realloc(type_list, m * sizeof(char*));
+                }
+                type_list[n] = (char*)calloc(p - q + 1, 1);
+                strncpy(type_list[n++], q, p - q);
+                q = p + 1;
+                if (*p == 0) break;
+            }
+        }
+        type_list = (char**)realloc(type_list, n * sizeof(char*));
+
+        if (args->include_types) {
+            args->include = 0;
+            for (i = 0; i < n; ++i) {
+                if (strcmp(type_list[i], "snps") == 0) args->include |= VCF_SNP;
+                else if (strcmp(type_list[i], "indels") == 0) args->include |= VCF_INDEL;
+                else if (strcmp(type_list[i], "mnps") == 0) args->include |= VCF_MNP;
+                else if (strcmp(type_list[i], "other") == 0) args->include |= VCF_OTHER;
+                else {
+                    fprintf(stderr, "[E::%s] unknown type\n", type_list[i]);
+                    exit(1);
+                }
+            }
+        }
+        if (args->exclude_types) {
+            args->exclude = 0;
+            for (i = 0; i < n; ++i) {
+                if (strcmp(type_list[i], "snps") == 0) args->exclude |= VCF_SNP;
+                else if (strcmp(type_list[i], "indels") == 0) args->exclude |= VCF_INDEL;
+                else if (strcmp(type_list[i], "mnps") == 0) args->exclude |= VCF_MNP;
+                else if (strcmp(type_list[i], "other") == 0) args->exclude |= VCF_OTHER;
+                else {
+                    fprintf(stderr, "[E::%s] unknown type\n", type_list[i]);
+                    exit(1);
+                }
+            }
+        }
+        for (i = 0; i < n; ++i)
+            free(type_list[i]);
+        free(type_list);
+    }
+
+    // setup output
+    char modew[8];
+    strcpy(modew, "w");
+    if (args->clevel >= 0 && args->clevel <= 9) sprintf(modew + 1, "%d", args->clevel);
+    if (args->output_type==FT_BCF) strcat(modew, "bu");         // uncompressed BCF
+    else if (args->output_type & FT_BCF) strcat(modew, "b");    // compressed BCF
+    else if (args->output_type & FT_GZ) strcat(modew,"z");      // compressed VCF
+    args->out = hts_open(args->fn_out ? args->fn_out : "-", modew);
+    if ( !args->out ) error("%s: %s\n", args->fn_out,strerror(errno));
+
+    // headers: hdr=full header, hsub=subset header, hnull=sites only header
+    if (args->sites_only)
+        args->hnull = bcf_hdr_subset(args->hdr, 0, 0, 0);
+    if (args->n_samples > 0)
+    {
+        args->hsub = bcf_hdr_subset(args->hdr, args->n_samples, args->samples, args->imap);
+        if ( !args->hsub ) error("Error occurred while subsetting samples\n");
+        if ( args->n_samples != bcf_hdr_nsamples(args->hsub) )
+        {
+            int i;
+            for (i=0; i<args->n_samples; i++)
+                if ( args->imap[i]<0 ) error("Error: No such sample: \"%s\"\n", args->samples[i]);
+        }
+    }
+
+    if ( args->filter_str )
+        args->filter = filter_init(args->hdr, args->filter_str);
+}
+
+static void destroy_data(args_t *args)
+{
+    int i;
+    if ( args->imap ) {
+        for (i = 0; i < args->n_samples; ++i)
+            free(args->samples[i]);
+        free(args->samples);
+        free(args->imap);
+    }
+    if (args->hnull) bcf_hdr_destroy(args->hnull);
+    if (args->hsub) bcf_hdr_destroy(args->hsub);
+    if ( args->filter )
+        filter_destroy(args->filter);
+    free(args->ac);
+}
+
+// true if all samples are phased.
+// haploid genotypes are considered phased
+// ./. => not phased, .|. => phased
+int bcf_all_phased(const bcf_hdr_t *header, bcf1_t *line)
+{
+    bcf_unpack(line, BCF_UN_FMT);
+    bcf_fmt_t *fmt_ptr = bcf_get_fmt(header, line, "GT");
+    int all_phased = 1;
+    if ( fmt_ptr )
+    {
+        int i, isample;
+        for (isample=0; isample<line->n_sample; isample++)
+        {
+            int sample_phased = 0;
+            #define BRANCH_INT(type_t,vector_end) { \
+                type_t *p = (type_t*) (fmt_ptr->p + isample*fmt_ptr->size); \
+                for (i=0; i<fmt_ptr->n; i++) \
+                { \
+                    if (fmt_ptr->n == 1 || (p[i] == vector_end && i == 1)) { sample_phased = 1; break; } /* haploid phased by definition */ \
+                    if ( p[i] == vector_end ) { break; }; /* smaller ploidy */ \
+                    if ( bcf_gt_is_missing(p[i]) ) continue; /* missing allele */ \
+                    if ((p[i])&1) { \
+                        sample_phased = 1; \
+                        break; \
+                    } \
+                } \
+            }
+            switch (fmt_ptr->type) {
+                case BCF_BT_INT8:  BRANCH_INT(int8_t,  bcf_int8_vector_end); break;
+                case BCF_BT_INT16: BRANCH_INT(int16_t, bcf_int16_vector_end); break;
+                case BCF_BT_INT32: BRANCH_INT(int32_t, bcf_int32_vector_end); break;
+                default: fprintf(stderr, "[E::%s] todo: fmt_type %d\n", __func__, fmt_ptr->type); exit(1); break;
+            }
+            #undef BRANCH_INT
+            if (!sample_phased) {
+                all_phased = 0;
+                break;
+            }
+        }
+    }
+    return all_phased;
+}
+
+int subset_vcf(args_t *args, bcf1_t *line)
+{
+    if ( args->min_alleles && line->n_allele < args->min_alleles ) return 0; // min alleles
+    if ( args->max_alleles && line->n_allele > args->max_alleles ) return 0; // max alleles
+    if (args->novel || args->known)
+    {
+        if ( args->novel && (line->d.id[0]!='.' || line->d.id[1]!=0) ) return 0; // skip sites which are known, ID != '.'
+        if ( args->known && line->d.id[0]=='.' && line->d.id[1]==0 ) return 0;  // skip sites which are novel, ID == '.'
+    }
+
+    if (args->include || args->exclude)
+    {
+        int line_type = bcf_get_variant_types(line);
+        if ( args->include && !(line_type&args->include) ) return 0; // include only given variant types
+        if ( args->exclude &&   line_type&args->exclude  ) return 0; // exclude given variant types
+    }
+
+    if ( args->filter )
+    {
+        int ret = filter_test(args->filter, line, NULL);
+        if ( args->filter_logic==FLT_INCLUDE ) { if ( !ret ) return 0; }
+        else if ( ret ) return 0;
+    }
+
+    hts_expand(int, line->n_allele, args->mac, args->ac);
+    int i, an = 0, non_ref_ac = 0;
+    if (args->calc_ac) {
+        bcf_calc_ac(args->hdr, line, args->ac, BCF_UN_INFO|BCF_UN_FMT); // get original AC and AN values from INFO field if available, otherwise calculate
+        for (i=1; i<line->n_allele; i++)
+            non_ref_ac += args->ac[i];
+        for (i=0; i<line->n_allele; i++)
+            an += args->ac[i];
+    }
+
+    if (args->n_samples)
+    {
+        int non_ref_ac_sub = 0, *ac_sub = (int*) calloc(line->n_allele,sizeof(int));
+        bcf_subset(args->hdr, line, args->n_samples, args->imap);
+        if (args->calc_ac) {
+            bcf_calc_ac(args->hsub, line, ac_sub, BCF_UN_FMT); // recalculate AC and AN
+            an = 0;
+            for (i=0; i<line->n_allele; i++) {
+                args->ac[i] = ac_sub[i];
+                an += ac_sub[i];
+            }
+            for (i=1; i<line->n_allele; i++)
+                non_ref_ac_sub += ac_sub[i];
+            if (args->private_vars) {
+                if (args->private_vars == FLT_INCLUDE && !(non_ref_ac_sub > 0 && non_ref_ac == non_ref_ac_sub)) { free(ac_sub); return 0; } // select private sites
+                if (args->private_vars == FLT_EXCLUDE && non_ref_ac_sub > 0 && non_ref_ac == non_ref_ac_sub) { free(ac_sub); return 0; } // exclude private sites
+            }
+            non_ref_ac = non_ref_ac_sub;
+        }
+        free(ac_sub);
+    }
+
+    bcf_fmt_t *gt_fmt;
+    if ( args->gt_type && (gt_fmt=bcf_get_fmt(args->hdr,line,"GT")) )
+    {
+        int nhet = 0, nhom = 0, nmiss = 0;
+        for (i=0; i<bcf_hdr_nsamples(args->hdr); i++)
+        {
+            int type = bcf_gt_type(gt_fmt,i,NULL,NULL);
+            if ( type==GT_HET_RA || type==GT_HET_AA )
+            {
+                if ( args->gt_type==GT_NO_HET ) return 0;
+                nhet = 1;
+            }
+            else if ( type==GT_UNKN )
+            {
+                if ( args->gt_type==GT_NO_MISSING ) return 0;
+                nmiss = 1;
+            }
+            else
+            {
+                if ( args->gt_type==GT_NO_HOM ) return 0;
+                nhom = 1;
+            }
+        }
+        if ( args->gt_type==GT_NEED_HOM && !nhom ) return 0;
+        else if ( args->gt_type==GT_NEED_HET && !nhet ) return 0;
+        else if ( args->gt_type==GT_NEED_MISSING && !nmiss ) return 0;
+    }
+
+    int minor_ac = 0;
+    int major_ac = 0;
+    if ( args->calc_ac )
+    {
+        minor_ac = args->ac[0];
+        major_ac = args->ac[0];
+        for (i=1; i<line->n_allele; i++){
+            if (args->ac[i] < minor_ac) { minor_ac = args->ac[i]; }
+            if (args->ac[i] > major_ac) { major_ac = args->ac[i]; }
+        }
+    }
+
+    if (args->min_ac)
+    {
+        if (args->min_ac_type == ALLELE_NONREF && args->min_ac>non_ref_ac) return 0; // min AC
+        else if (args->min_ac_type == ALLELE_MINOR && args->min_ac>minor_ac) return 0; // min minor AC
+        else if (args->min_ac_type == ALLELE_ALT1 && args->min_ac>args->ac[1]) return 0; // min 1st alternate AC
+        else if (args->min_ac_type == ALLELE_MAJOR && args->min_ac > major_ac) return 0; // min major AC
+        else if (args->min_ac_type == ALLELE_NONMAJOR && args->min_ac > an-major_ac) return 0; // min non-major AC
+    }
+    if (args->max_ac)
+    {
+        if (args->max_ac_type == ALLELE_NONREF && args->max_ac<non_ref_ac) return 0; // max AC
+        else if (args->max_ac_type == ALLELE_MINOR && args->max_ac<minor_ac) return 0; // max minor AC
+        else if (args->max_ac_type == ALLELE_ALT1 && args->max_ac<args->ac[1]) return 0; // max 1st alternate AC
+        else if (args->max_ac_type == ALLELE_MAJOR && args->max_ac < major_ac) return 0; // max major AC
+        else if (args->max_ac_type == ALLELE_NONMAJOR && args->max_ac < an-major_ac) return 0; // max non-major AC
+    }
+    if (args->min_af)
+    {
+        if (an == 0) return 0; // freq not defined, skip site
+        if (args->min_af_type == ALLELE_NONREF && args->min_af>non_ref_ac/(double)an) return 0; // min AF
+        else if (args->min_af_type == ALLELE_MINOR && args->min_af>minor_ac/(double)an) return 0; // min minor AF
+        else if (args->min_af_type == ALLELE_ALT1 && args->min_af>args->ac[1]/(double)an) return 0; // min 1st alternate AF
+        else if (args->min_af_type == ALLELE_MAJOR && args->min_af > major_ac/(double)an) return 0; // min major AF
+        else if (args->min_af_type == ALLELE_NONMAJOR && args->min_af > (an-major_ac)/(double)an) return 0; // min non-major AF
+    }
+    if (args->max_af)
+    {
+        if (an == 0) return 0; // freq not defined, skip site
+        if (args->max_af_type == ALLELE_NONREF && args->max_af<non_ref_ac/(double)an) return 0; // max AF
+        else if (args->max_af_type == ALLELE_MINOR && args->max_af<minor_ac/(double)an) return 0; // max minor AF
+        else if (args->max_af_type == ALLELE_ALT1 && args->max_af<args->ac[1]/(double)an) return 0; // max 1st alternate AF
+        else if (args->max_af_type == ALLELE_MAJOR && args->max_af < major_ac/(double)an) return 0; // max major AF
+        else if (args->max_af_type == ALLELE_NONMAJOR && args->max_af < (an-major_ac)/(double)an) return 0; // max non-major AF
+    }
+    if (args->uncalled) {
+        if (args->uncalled == FLT_INCLUDE && an > 0) return 0; // select uncalled
+        if (args->uncalled == FLT_EXCLUDE && an == 0) return 0; // skip if uncalled
+    }
+    if (args->calc_ac && args->update_info) {
+        bcf_update_info_int32(args->hdr, line, "AC", &args->ac[1], line->n_allele-1);
+        bcf_update_info_int32(args->hdr, line, "AN", &an, 1);
+    }
+    if (args->trim_alts)
+    {
+        int ret = bcf_trim_alleles(args->hsub ? args->hsub : args->hdr, line);
+        if ( ret==-1 ) error("Error: some GT index is out of bounds at %s:%d\n", bcf_seqname(args->hsub ? args->hsub : args->hdr, line), line->pos+1);
+    }
+    if (args->phased) {
+        int phased = bcf_all_phased(args->hdr, line);
+        if (args->phased == FLT_INCLUDE && !phased) { return 0; } // skip unphased
+        if (args->phased == FLT_EXCLUDE && phased) { return 0; } // skip phased
+    }
+    if (args->sites_only) bcf_subset(args->hsub ? args->hsub : args->hdr, line, 0, 0);
+    return 1;
+}
+
+void set_allele_type (int *atype, char *atype_string)
+{
+    *atype = ALLELE_NONREF;
+    if (strcmp(atype_string, "minor") == 0) {
+        *atype = ALLELE_MINOR;
+    }
+    else if (strcmp(atype_string, "alt1") == 0) {
+        *atype = ALLELE_ALT1;
+    }
+    else if (strcmp(atype_string, "nref") == 0) {
+        *atype = ALLELE_NONREF;
+    }
+    else if (strcmp(atype_string, "major") == 0) {
+        *atype = ALLELE_MAJOR;
+    }
+    else if (strcmp(atype_string, "nonmajor") == 0) {
+        *atype = ALLELE_NONMAJOR;
+    }
+    else {
+        error("Error: allele type (%s) not recognised. Must be one of nref|alt1|minor|major|nonmajor: %s\n", atype_string);
+    }
+}
+
+static void usage(args_t *args)
+{
+    fprintf(stderr, "\n");
+    fprintf(stderr, "About:   VCF/BCF conversion, view, subset and filter VCF/BCF files.\n");
+    fprintf(stderr, "Usage:   bcftools view [options] <in.vcf.gz> [region1 [...]]\n");
+    fprintf(stderr, "\n");
+    fprintf(stderr, "Output options:\n");
+    fprintf(stderr, "    -G,   --drop-genotypes              drop individual genotype information (after subsetting if -s option set)\n");
+    fprintf(stderr, "    -h/H, --header-only/--no-header     print the header only/suppress the header in VCF output\n");
+    fprintf(stderr, "    -l,   --compression-level [0-9]     compression level: 0 uncompressed, 1 best speed, 9 best compression [%d]\n", args->clevel);
+    fprintf(stderr, "    -o,   --output-file <file>          output file name [stdout]\n");
+    fprintf(stderr, "    -O,   --output-type <b|u|z|v>       b: compressed BCF, u: uncompressed BCF, z: compressed VCF, v: uncompressed VCF [v]\n");
+    fprintf(stderr, "    -r, --regions <region>              restrict to comma-separated list of regions\n");
+    fprintf(stderr, "    -R, --regions-file <file>           restrict to regions listed in a file\n");
+    fprintf(stderr, "    -t, --targets [^]<region>           similar to -r but streams rather than index-jumps. Exclude regions with \"^\" prefix\n");
+    fprintf(stderr, "    -T, --targets-file [^]<file>        similar to -R but streams rather than index-jumps. Exclude regions with \"^\" prefix\n");
+    fprintf(stderr, "\n");
+    fprintf(stderr, "Subset options:\n");
+    fprintf(stderr, "    -a, --trim-alt-alleles        trim alternate alleles not seen in the subset\n");
+    fprintf(stderr, "    -I, --no-update               do not (re)calculate INFO fields for the subset (currently INFO/AC and INFO/AN)\n");
+    fprintf(stderr, "    -s, --samples [^]<list>       comma separated list of samples to include (or exclude with \"^\" prefix)\n");
+    fprintf(stderr, "    -S, --samples-file [^]<file>  file of samples to include (or exclude with \"^\" prefix)\n");
+    fprintf(stderr, "        --force-samples           only warn about unknown subset samples\n");
+    fprintf(stderr, "\n");
+    fprintf(stderr, "Filter options:\n");
+    fprintf(stderr, "    -c/C, --min-ac/--max-ac <int>[:<type>]      minimum/maximum count for non-reference (nref), 1st alternate (alt1), least frequent\n");
+    fprintf(stderr, "                                                   (minor), most frequent (major) or sum of all but most frequent (nonmajor) alleles [nref]\n");
+    fprintf(stderr, "    -f,   --apply-filters <list>                require at least one of the listed FILTER strings (e.g. \"PASS,.\")\n");
+    fprintf(stderr, "    -g,   --genotype [^]<hom|het|miss>          require one or more hom/het/missing genotype or, if prefixed with \"^\", exclude sites with hom/het/missing genotypes\n");
+    fprintf(stderr, "    -i/e, --include/--exclude <expr>            select/exclude sites for which the expression is true (see man page for details)\n");
+    fprintf(stderr, "    -k/n, --known/--novel                       select known/novel sites only (ID is not/is '.')\n");
+    fprintf(stderr, "    -m/M, --min-alleles/--max-alleles <int>     minimum/maximum number of alleles listed in REF and ALT (e.g. -m2 -M2 for biallelic sites)\n");
+    fprintf(stderr, "    -p/P, --phased/--exclude-phased             select/exclude sites where all samples are phased\n");
+    fprintf(stderr, "    -q/Q, --min-af/--max-af <float>[:<type>]    minimum/maximum frequency for non-reference (nref), 1st alternate (alt1), least frequent\n");
+    fprintf(stderr, "                                                   (minor), most frequent (major) or sum of all but most frequent (nonmajor) alleles [nref]\n");
+    fprintf(stderr, "    -u/U, --uncalled/--exclude-uncalled         select/exclude sites without a called genotype\n");
+    fprintf(stderr, "    -v/V, --types/--exclude-types <list>        select/exclude comma-separated list of variant types: snps,indels,mnps,other [null]\n");
+    fprintf(stderr, "    -x/X, --private/--exclude-private           select/exclude sites where the non-reference alleles are exclusive (private) to the subset samples\n");
+    fprintf(stderr, "\n");
+    exit(1);
+}
+
+int main_vcfview(int argc, char *argv[])
+{
+    int c;
+    args_t *args  = (args_t*) calloc(1,sizeof(args_t));
+    args->argc    = argc; args->argv = argv;
+    args->files   = bcf_sr_init();
+    args->clevel  = -1;
+    args->print_header = 1;
+    args->update_info = 1;
+    args->output_type = FT_VCF;
+    int targets_is_file = 0, regions_is_file = 0;
+
+    static struct option loptions[] =
+    {
+        {"genotype",1,0,'g'},
+        {"compression-level",1,0,'l'},
+        {"header-only",0,0,'h'},
+        {"no-header",0,0,'H'},
+        {"exclude",1,0,'e'},
+        {"include",1,0,'i'},
+        {"trim-alt-alleles",0,0,'a'},
+        {"no-update",0,0,'I'},
+        {"drop-genotypes",0,0,'G'},
+        {"private",0,0,'x'},
+        {"exclude-private",0,0,'X'},
+        {"uncalled",0,0,'u'},
+        {"exclude-uncalled",0,0,'U'},
+        {"apply-filters",1,0,'f'},
+        {"known",0,0,'k'},
+        {"novel",0,0,'n'},
+        {"min-alleles",1,0,'m'},
+        {"max-alleles",1,0,'M'},
+        {"samples",1,0,'s'},
+        {"samples-file",1,0,'S'},
+        {"force-samples",0,0,1},
+        {"output-type",1,0,'O'},
+        {"output-file",1,0,'o'},
+        {"types",1,0,'v'},
+        {"exclude-types",1,0,'V'},
+        {"targets",1,0,'t'},
+        {"targets-file",1,0,'T'},
+        {"regions",1,0,'r'},
+        {"regions-file",1,0,'R'},
+        {"min-ac",1,0,'c'},
+        {"max-ac",1,0,'C'},
+        {"min-af",1,0,'q'},
+        {"max-af",1,0,'Q'},
+        {"phased",0,0,'p'},
+        {"exclude-phased",0,0,'P'},
+        {0,0,0,0}
+    };
+    char *tmp;
+    while ((c = getopt_long(argc, argv, "l:t:T:r:R:o:O:s:S:Gf:knv:V:m:M:auUhHc:C:Ii:e:xXpPq:Q:g:",loptions,NULL)) >= 0)
+    {
+        char allele_type[8] = "nref";
+        switch (c)
+        {
+            case 'O':
+                switch (optarg[0]) {
+                    case 'b': args->output_type = FT_BCF_GZ; break;
+                    case 'u': args->output_type = FT_BCF; break;
+                    case 'z': args->output_type = FT_VCF_GZ; break;
+                    case 'v': args->output_type = FT_VCF; break;
+                    default: error("The output type \"%s\" not recognised\n", optarg);
+                };
+                break;
+            case 'l':
+                args->clevel = strtol(optarg,&tmp,10);
+                if ( *tmp ) error("Could not parse argument: --compression-level %s\n", optarg);
+                args->output_type |= FT_GZ; 
+                break;
+            case 'o': args->fn_out = optarg; break;
+            case 'H': args->print_header = 0; break;
+            case 'h': args->header_only = 1; break;
+
+            case 't': args->targets_list = optarg; break;
+            case 'T': args->targets_list = optarg; targets_is_file = 1; break;
+            case 'r': args->regions_list = optarg; break;
+            case 'R': args->regions_list = optarg; regions_is_file = 1; break;
+
+            case 's': args->sample_names = optarg; break;
+            case 'S': args->sample_names = optarg; args->sample_is_file = 1; break;
+            case  1 : args->force_samples = 1; break;
+            case 'a': args->trim_alts = 1; args->calc_ac = 1; break;
+            case 'I': args->update_info = 0; break;
+            case 'G': args->sites_only = 1; break;
+
+            case 'f': args->files->apply_filters = optarg; break;
+            case 'k': args->known = 1; break;
+            case 'n': args->novel = 1; break;
+            case 'm':
+                args->min_alleles = strtol(optarg,&tmp,10);
+                if ( *tmp ) error("Could not parse argument: --min-alleles %s\n", optarg);
+                break;
+            case 'M': 
+                args->max_alleles = strtol(optarg,&tmp,10);
+                if ( *tmp ) error("Could not parse argument: --max-alleles %s\n", optarg);
+                break;
+            case 'v': args->include_types = optarg; break;
+            case 'V': args->exclude_types = optarg; break;
+            case 'e': args->filter_str = optarg; args->filter_logic |= FLT_EXCLUDE; break;
+            case 'i': args->filter_str = optarg; args->filter_logic |= FLT_INCLUDE; break;
+
+            case 'c':
+            {
+                args->min_ac_type = ALLELE_NONREF;
+                if ( sscanf(optarg,"%d:%s",&args->min_ac, allele_type)!=2 && sscanf(optarg,"%d",&args->min_ac)!=1 )
+                    error("Error: Could not parse --min-ac %s\n", optarg);
+                set_allele_type(&args->min_ac_type, allele_type);
+                args->calc_ac = 1;
+                break;
+            }
+            case 'C':
+            {
+                args->max_ac_type = ALLELE_NONREF;
+                if ( sscanf(optarg,"%d:%s",&args->max_ac, allele_type)!=2 && sscanf(optarg,"%d",&args->max_ac)!=1 )
+                    error("Error: Could not parse --max-ac %s\n", optarg);
+                set_allele_type(&args->max_ac_type, allele_type);
+                args->calc_ac = 1;
+                break;
+            }
+            case 'q':
+            {
+                args->min_af_type = ALLELE_NONREF;
+                if ( sscanf(optarg,"%f:%s",&args->min_af, allele_type)!=2 && sscanf(optarg,"%f",&args->min_af)!=1 )
+                    error("Error: Could not parse --min_af %s\n", optarg);
+                set_allele_type(&args->min_af_type, allele_type);
+                args->calc_ac = 1;
+                break;
+            }
+            case 'Q':
+            {
+                args->max_af_type = ALLELE_NONREF;
+                if ( sscanf(optarg,"%f:%s",&args->max_af, allele_type)!=2 && sscanf(optarg,"%f",&args->max_af)!=1 )
+                    error("Error: Could not parse --min_af %s\n", optarg);
+                set_allele_type(&args->max_af_type, allele_type);
+                args->calc_ac = 1;
+                break;
+            }
+
+            case 'x': args->private_vars |= FLT_INCLUDE; args->calc_ac = 1; break;
+            case 'X': args->private_vars |= FLT_EXCLUDE; args->calc_ac = 1; break;
+            case 'u': args->uncalled |= FLT_INCLUDE; args->calc_ac = 1; break;
+            case 'U': args->uncalled |= FLT_EXCLUDE; args->calc_ac = 1; break;
+            case 'p': args->phased |= FLT_INCLUDE; break; // phased
+            case 'P': args->phased |= FLT_EXCLUDE; break; // exclude-phased
+            case 'g':
+            {
+                if ( !strcasecmp(optarg,"hom") ) args->gt_type = GT_NEED_HOM;
+                else if ( !strcasecmp(optarg,"het") ) args->gt_type = GT_NEED_HET;
+                else if ( !strcasecmp(optarg,"miss") ) args->gt_type = GT_NEED_MISSING;
+                else if ( !strcasecmp(optarg,"^hom") ) args->gt_type = GT_NO_HOM;
+                else if ( !strcasecmp(optarg,"^het") ) args->gt_type = GT_NO_HET;
+                else if ( !strcasecmp(optarg,"^miss") ) args->gt_type = GT_NO_MISSING;
+                else error("The argument to -g not recognised. Expected one of hom/het/^hom/^het, got \"%s\".\n", optarg);
+                break;
+            }
+            case '?': usage(args);
+            default: error("Unknown argument: %s\n", optarg);
+        }
+    }
+
+    if ( args->filter_logic == (FLT_EXCLUDE|FLT_INCLUDE) ) error("Only one of -i or -e can be given.\n");
+    if ( args->private_vars > FLT_EXCLUDE ) error("Only one of -x or -X can be given.\n");
+    if ( args->uncalled > FLT_EXCLUDE ) error("Only one of -u or -U can be given.\n");
+    if ( args->phased > FLT_EXCLUDE ) error("Only one of -p or -P can be given.\n");
+
+    if ( args->sample_names && args->update_info) args->calc_ac = 1;
+
+    char *fname = NULL;
+    if ( optind>=argc )
+    {
+        if ( !isatty(fileno((FILE *)stdin)) ) fname = "-";  // reading from stdin
+        else usage(args);
+    }
+    else fname = argv[optind];
+
+    // read in the regions from the command line
+    if ( args->regions_list )
+    {
+        if ( bcf_sr_set_regions(args->files, args->regions_list, regions_is_file)<0 )
+            error("Failed to read the regions: %s\n", args->regions_list);
+    }
+    else if ( optind+1 < argc )
+    {
+        int i;
+        kstring_t tmp = {0,0,0};
+        kputs(argv[optind+1],&tmp);
+        for (i=optind+2; i<argc; i++) { kputc(',',&tmp); kputs(argv[i],&tmp); }
+        if ( bcf_sr_set_regions(args->files, tmp.s, 0)<0 )
+            error("Failed to read the regions: %s\n", tmp.s);
+        free(tmp.s);
+    }
+    if ( args->targets_list )
+    {
+        if ( bcf_sr_set_targets(args->files, args->targets_list, targets_is_file, 0)<0 )
+            error("Failed to read the targets: %s\n", args->targets_list);
+    }
+
+    if ( !bcf_sr_add_reader(args->files, fname) ) error("Failed to open %s: %s\n", fname,bcf_sr_strerror(args->files->errnum));
+
+    init_data(args);
+    bcf_hdr_t *out_hdr = args->hnull ? args->hnull : (args->hsub ? args->hsub : args->hdr);
+    if (args->print_header)
+        bcf_hdr_write(args->out, out_hdr);
+    else if ( args->output_type & FT_BCF )
+        error("BCF output requires header, cannot proceed with -H\n");
+    if (!args->header_only)
+    {
+        while ( bcf_sr_next_line(args->files) )
+        {
+            bcf1_t *line = args->files->readers[0].buffer[0];
+            if ( line->errcode && out_hdr!=args->hdr ) error("Undefined tags in the header, cannot proceed in the sample subset mode.\n");
+            if ( subset_vcf(args, line) )
+                bcf_write1(args->out, out_hdr, line);
+        }
+    }
+    hts_close(args->out);
+    destroy_data(args);
+    bcf_sr_destroy(args->files);
+    free(args);
+    return 0;
+}
diff --git a/vcmp.c b/vcmp.c
new file mode 100644
index 0000000..a117cd3
--- /dev/null
+++ b/vcmp.c
@@ -0,0 +1,130 @@
+/*  vcmp.c -- reference allele utility functions.
+
+    Copyright (C) 2013 Genome Research Ltd.
+
+    Author: Petr Danecek <pd3 at sanger.ac.uk>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.  */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <htslib/hts.h>
+#include "vcmp.h"
+
+struct _vcmp_t
+{
+    char *dref;
+    int ndref, mdref;   // ndref: positive when ref1 longer, negative when ref2 is longer
+    int nmatch;
+    int *map, mmap;
+};
+
+vcmp_t *vcmp_init()
+{
+    return (vcmp_t*)calloc(1,sizeof(vcmp_t));
+}
+
+void vcmp_destroy(vcmp_t *vcmp)
+{
+    free(vcmp->map);
+    free(vcmp->dref);
+    free(vcmp);
+}
+
+int vcmp_set_ref(vcmp_t *vcmp, char *ref1, char *ref2)
+{
+    vcmp->ndref = 0;
+
+    char *a = ref1, *b = ref2;
+    while ( *a && *b && *a==*b ) { a++; b++; }
+    if ( !*a && !*b ) return 0;
+    if ( *a && *b ) return -1;  // refs not compatible
+
+    if ( *a )   // ref1 is longer
+    {
+        vcmp->nmatch = b-ref2;
+        while ( *a ) a++;
+        vcmp->ndref = (a-ref1) - vcmp->nmatch;
+        hts_expand(char,vcmp->ndref+1,vcmp->mdref,vcmp->dref);
+        memcpy(vcmp->dref,ref1+vcmp->nmatch,vcmp->ndref);
+        vcmp->dref[vcmp->ndref] = 0;
+        return 0;
+    }
+
+    // ref2 is longer
+    vcmp->nmatch = a-ref1;
+    while ( *b ) b++;
+    vcmp->ndref = (b-ref2) - vcmp->nmatch;
+    hts_expand(char,vcmp->ndref+1,vcmp->mdref,vcmp->dref);
+    memcpy(vcmp->dref,ref2+vcmp->nmatch,vcmp->ndref);
+    vcmp->dref[vcmp->ndref] = 0;
+    vcmp->ndref *= -1;
+    return 0;
+}
+
+int vcmp_find_allele(vcmp_t *vcmp, char **als1, int nals1, char *al2)
+{
+    int i, j;
+    for (i=0; i<nals1; i++)
+    {
+        char *a = als1[i], *b = al2;
+        while ( *a && *b && *a==*b ) { a++; b++; }
+        if ( *a && *b ) continue;   // mismatch
+        if ( !vcmp->ndref )
+        {
+            if ( !*a && !*b ) break;    // found
+            continue;
+        }
+
+        // the prefixes match
+        if ( *a )
+        {
+            if ( vcmp->ndref<0 ) continue;
+            for (j=0; j<vcmp->ndref; j++)
+                if ( !a[j] || a[j]!=vcmp->dref[j] ) break;
+            if ( j!=vcmp->ndref || a[j] ) continue;
+            break;  // found
+        }
+
+        if ( vcmp->ndref>0 ) continue;
+        for (j=0; j<-vcmp->ndref; j++)
+            if ( !b[j] || b[j]!=vcmp->dref[j] ) break;
+        if ( j!=-vcmp->ndref || b[j] ) continue;
+        break;  // found
+    }
+    if (i==nals1) return -1;
+    return i;
+}
+
+
+int *vcmp_map_ARvalues(vcmp_t *vcmp, int n, int nals1, char **als1, int nals2, char **als2)
+{
+    if ( vcmp_set_ref(vcmp,als1[0],als2[0]) < 0 ) return NULL;
+
+    vcmp->map = (int*) realloc(vcmp->map,sizeof(int)*n);
+
+    int i, ifrom = n==nals2 ? 0 : 1;
+    for (i=ifrom; i<nals2; i++)
+    {
+        vcmp->map[i-ifrom] = vcmp_find_allele(vcmp, als1+ifrom, nals1-ifrom, als2[i]);
+    }
+    return vcmp->map;
+}
+
diff --git a/vcmp.h b/vcmp.h
new file mode 100644
index 0000000..0317704
--- /dev/null
+++ b/vcmp.h
@@ -0,0 +1,62 @@
+/*  vcmp.h -- reference allele utility functions.
+
+    Copyright (C) 2013-2014 Genome Research Ltd.
+
+    Author: Petr Danecek <pd3 at sanger.ac.uk>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.  */
+
+#ifndef __VCMP_H__
+#define __VCMP_H__
+
+typedef struct _vcmp_t vcmp_t;
+
+vcmp_t *vcmp_init(void);
+void vcmp_destroy(vcmp_t *vcmp);
+
+/*
+ *  vcmp_set_ref() - sets and compares reference alleles
+ *  Returns 0 on success or -1 if alleles not compatible
+ */
+int vcmp_set_ref(vcmp_t *vcmp, char *ref1, char *ref2);
+
+/*
+ *  vcmp_find_allele()
+ *  @param als1:  alternate alleles to ref1 above
+ *  @param al2:   alternate allele to ref2 above
+ *  Returns -1 if not found or 0-based index to als1 of matching allele
+ */
+int vcmp_find_allele(vcmp_t *vcmp, char **als1, int nals1, char *al2);
+
+/*
+ *  vcmp_map_ARvalues() - Create mapping for Number=A,R tag values
+ *  @param number:  nals2 for Number=R, nals2-1 for Number=A
+ *  @param nals1:   number of alleles
+ *  @param als1:    alleles
+ *
+ *  Returns pointer to an array of size nals2 with mapping from als2
+ *  to als1 or NULL if REFs (als1[0] and als2[0]) are not compatible.
+ *  If i is the index of an allele in als2, ret[i] is the index of matching
+ *  allele in als1 or -1 if als2 does not have a matching allele.
+ *  The caller must not free the array.
+ */
+int *vcmp_map_ARvalues(vcmp_t *vcmp, int number, int nals1, char **als1, int nals2, char **als2);
+
+
+#endif
diff --git a/version.c b/version.c
new file mode 100644
index 0000000..4a2ea7d
--- /dev/null
+++ b/version.c
@@ -0,0 +1,47 @@
+/*  version.c -- report version numbers for plugins.
+
+    Copyright (C) 2014 Genome Research Ltd.
+
+    Author: Petr Danecek <pd3 at sanger.ac.uk>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.  */
+
+#include <stdarg.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <htslib/hts.h>
+#include "bcftools.h"
+#include "version.h"
+
+void version(const char **bcftools_version, const char **htslib_version)
+{
+    *bcftools_version = BCFTOOLS_VERSION;
+    *htslib_version = hts_version();
+}
+
+void error(const char *format, ...)
+{
+    va_list ap;
+    va_start(ap, format);
+    vfprintf(stderr, format, ap);
+    va_end(ap);
+    exit(-1);
+}
+
+

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/bcftools.git



More information about the debian-med-commit mailing list