]> git.donarmstrong.com Git - samtools.git/blobdiff - bcftools/vcfutils.pl
Make sure that the GT genotype field is the first
[samtools.git] / bcftools / vcfutils.pl
index 499a4e4ee5c8fd495898a0312ffbdc4765cab47b..63509e820fb2c56dc255e4ec6dbc6cea5fd74abb 100755 (executable)
@@ -455,7 +455,7 @@ sub hapmap2vcf {
 }
 
 sub vcf2fq {
-  my %opts = (d=>3, D=>100000, Q=>10, l=>10);
+  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>
@@ -484,11 +484,12 @@ Options: -d INT    minimum depth          [$opts{d}]
          $seq = $qual = '';
          @gaps = ();
        }
-       if ($t[1] - $last_pos != 1) {
+       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[4] =~ /^([A-Za-z.])(,[A-Za-z])*$/) { # a SNP or reference
+       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\.]+)/);
@@ -546,7 +547,7 @@ Command: subsam       get a subset of samples
          ucscsnp2vcf  convert UCSC SNP SQL dump to VCF
 
          varFilter    filtering short variants (*)
-         vcf2fq       VCF->fastq (*)
+         vcf2fq       VCF->fastq (**)
 
 Notes: Commands with description endting with (*) may need bcftools
        specific annotations.