From: Heng Li <lh3@live.co.uk>
Date: Tue, 5 Oct 2010 18:05:18 +0000 (+0000)
Subject:  * removed a comment line in kaln.c
X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=535d36c1f608b19e962422896365abeb4f48c6dd;p=samtools.git

 * removed a comment line in kaln.c
 * vcfutils.pl fillac works when GT is not the first field
---

diff --git a/bcftools/vcfutils.pl b/bcftools/vcfutils.pl
index 371e8d8..cdb96cb 100755
--- a/bcftools/vcfutils.pl
+++ b/bcftools/vcfutils.pl
@@ -70,12 +70,21 @@ sub fillac {
 	  print;
 	} else {
 	  my @t = split;
-	  my @c;
+	  my @c = (0);
 	  my $n = 0;
-	  $c[1] = 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[$_] =~ /^(\d+).(\d+)/) {
-		  ++$c[$1]; ++$c[$2];
+		if ($t[$_] =~ /^0,0,0/) {
+		} elsif ($t[$_] =~ /^([^\s:]+:){$s}(\d+).(\d+)/) {
+		  ++$c[$2]; ++$c[$3];
 		  $n += 2;
 		}
 	  }
diff --git a/kaln.c b/kaln.c
index 3aca09c..331fbb0 100644
--- a/kaln.c
+++ b/kaln.c
@@ -392,7 +392,6 @@ ka_probpar_t ka_probpar_def = { 0.001, 0.1, 10 };
                 \      \/        \/      \/      /
                  \     /\        /\      /\     /
                        -> D[k-1] -> D[k] ->
-                          \/        \/
 
    M[0] points to every {M,I}[k] and every {M,I}[k] points M[L+1].