7 #print STDERR Dumper($vcf_file);
9 open(my $F, "<", $vcf_file) || die "Can't find file $vcf_file";
11 open(my $G, ">", $vcf_file.".hmp") || die "Can't open $vcf_file.hmp";
16 if ($line =~ m/^\#\#/) {
17 print STDERR
"SKIPPING ## lines...\n";
29 my @keys = split("\t", $header);
30 #print STDERR Dumper($keys[1]);
32 for(my $n=0; $n <@keys; $n++) {
33 if ($keys[$n] =~ /\|CO\_/) {
34 $keys[$n] =~ s/\|CO\_.*//;
63 my @fields = split /\t/;
65 for(my $n=0; $n <@keys; $n++) {
66 if (exists($fields[$n]) && defined($fields[$n])) {
67 $line{$keys[$n]}=$fields[$n];
73 foreach my $line (@data) {
74 my @formats = split /\:/, $line->{FORMAT
};
76 for(my $n =0; $n<@formats; $n++) {
77 if ($formats[$n] eq 'GT') {
82 for(my $gt = 0; $gt < @keys; $gt++) {
83 my @scores = split /\:/, $line->{$gt};
85 if ($scores[$gtindex] eq '0/0') {
86 $genotype = $line->{REF
}."/".$line->{REF
};
88 if ($scores[$gtindex] eq '0/1') {
89 $genotype = $line->{REF
}."/".$line->{ALT
};
91 if ($scores[$gtindex] eq '1/1') {
92 $genotype = $line->{ALT
}."/".$line->{ALT
};
95 my $genotype_hmp = $nuconv{$genotype};