6 #die "Usage: $0 <blood vcf.gz> <sperm vcf.gz>\n" if @ARGV < 2;
7 die "Usage: $0 <spermA vcf> <spermB vcf> <spermC vcf>\n" if @ARGV < 3;
8 my ($inA,$inB,$inC)=@ARGV;
11 for ($inA,$inB,$inC) {
13 open $t,'<',$_ or die "$!";
19 my ($chr,$pos,undef,$ref,$alt,undef,undef,$INFO,undef,$data) = split /\t/,$str;
20 my @GeneTypes=split /,/,$alt;
21 unshift @GeneTypes,$ref;
22 my $GT = (split /:/,$data)[0];
23 my @GTs=split /[\/|]/,$GT;
24 my @ret = ( $chr, $pos, $GeneTypes[$GTs[0]] . $GeneTypes[$GTs[1]] );
28 sub readfile
($) { # 1 .. 3
30 my $fh = $FH[ $id - 1 ];
33 my ($chr,$pos,undef,$ref,$alt,$QUAL,undef,$INFO,undef,$data) = split /\t/;
34 next if $chr =~ /[XYM]/i;
35 next if $INFO =~ /INDEL;/;
37 my $GQ = (split /:/,$data)[-1];
39 next unless $chr =~ /^chr\d+/;
41 ($chr,$pos,$GT) = @
{getGT
($_)};
42 $SNP{$chr}{$pos}{$id} = $GT;
46 readfile
($_) for (1 .. 3);
50 # 141050953 => { 1 => "TT", 2 => "TT" },
53 for my $chr (keys %SNP) {
54 for my $pos (keys %{$SNP{$chr}}) {
55 my %Dat = %{$SNP{$chr}{$pos}};
57 for my $k (keys %Dat) {
61 #ddx $SNP{$chr}{$pos}; print "$flag\n\n";
65 print "$_\t",$Stat{$_},"\n" for sort {$a<=>$b} keys %Stat;
68 perl
./cntsnp3
.pl sperm23
.5cf
.filter sperm24
.5cf
.filter sperm28
.5cf
.filter
77 perl
./cntsnp3
.pl sperms01
.5cf
.filter sperms02
.5cf
.filter sperms03
.5cf
.filter