/usr/bin/fill-an-ac is in vcftools 0.1.15-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | #!/usr/bin/env perl
use strict;
use warnings;
use Carp;
use Vcf;
my $opts = parse_params();
fill_an_ac($$opts{file});
exit;
#--------------------------------
sub error
{
my (@msg) = @_;
if ( scalar @msg ) { confess @msg; }
die
"Usage: fill-an-ac [OPTIONS] < in.vcf >out.vcf\n",
"Options:\n",
" -h, -?, --help This help message.\n",
"\n";
}
sub parse_params
{
my $opts = {};
while (my $arg=shift(@ARGV))
{
if ( -e $arg ) { $$opts{file} = $arg; next }
if ( $arg eq '-?' || $arg eq '-h' || $arg eq '--help' ) { error(); }
error("Unknown parameter \"$arg\". Run -h for help.\n");
}
return $opts;
}
sub fill_an_ac
{
my ($file) = @_;
my $vcf = $file ? Vcf->new(file=>$file) : Vcf->new(fh=>\*STDIN);
$vcf->parse_header();
$vcf->add_header_line({key=>'INFO',ID=>'AC',Number=>-1,Type=>'Integer',Description=>'Allele count in genotypes'});
$vcf->add_header_line({key=>'INFO',ID=>'AN',Number=>1,Type=>'Integer',Description=>'Total number of alleles in called genotypes'});
print $vcf->format_header();
$vcf->recalc_ac_an(2);
while (my $rec=$vcf->next_data_hash())
{
print $vcf->format_line($rec);
}
}
|