13 my $version = '0.1.0';
14 &usage if (@ARGV < 1);
15 my $command = shift(@ARGV);
16 my %func = (subsam=>\&subsam);
17 die("Unknown command \"$command\".\n") if (!defined($func{$command}));
22 die(qq/Usage: vcfutils.pl subsam <in.vcf> [samples]\n/) if (@ARGV == 0);
24 my $fn = shift(@ARGV);
26 open($fh, ($fn =~ /\.gz$/)? "gzip -dc $fn |" : $fn) || die;
27 $h{$_} = 1 for (@ARGV);
33 my @s = @t[0..8]; # all fixed fields + FORMAT
40 pop(@s) if (@s == 9); # no sample selected; remove the FORMAT field
41 print join("\t", @s), "\n";
45 print join("\t", @t[0..7]), "\n";
47 print join("\t", @t[0..8], map {$t[$_]} @col), "\n";
56 Usage: vcfutils.pl <command> [<arguments>]\n
57 Command: subsam get a subset of samples