6 #die "Usage: $0 <blood vcf.gz> <sperm vcf.gz>\n" if @ARGV < 2;
7 die "Usage: $0 <vcf1> <vcf2> [vcf3.gz ..]\n" if @ARGV < 2 or @ARGV > 32;
9 my $Length = scalar @INS;
15 if ($filename=~/.xz$/) {
16 open( $infile,"-|","xz -dc $filename") or die "Error opening $filename: $!\n";
17 } elsif ($filename=~/.gz$/) {
18 open( $infile,"-|","gzip -dc $filename") or die "Error opening $filename: $!\n";
19 } else {open( $infile,"<",$filename) or die "Error opening $filename: $!\n";}
26 print STDERR
"Reading [$id] ...";
27 my ($cntID,$totalID) = (0,0);
30 my ($chr,$pos,undef,$ref,$alt,$QUAL,undef,$INFO,undef,$data) = split /\t/;
31 next if $chr =~ /[XYM]/i;
32 next if $INFO =~ /INDEL;/;
34 if (defined $data and $id > 0) {
36 my $GQ = (split /:/,$data)[-1];
40 next unless $chr =~ /^\d+/;
42 #($chr,$pos,$GT) = @{getGT($_)};
44 $SNP{$chr}{$pos}{$id} = $GT;
47 print STDERR
"\b\b\b\b, done ! [$totalID -> $cntID]\n";
48 print OUT
"[$INS[$id]]:[$totalID -> $cntID]\n";
56 open OUT
,'>','stat.txt';
57 print OUT
"[@INS] -> [stat.txt]\n";
59 warn "[@INS] -> [stat.txt]\n";
61 readfile
($_) for (0 .. $#FH);
64 # chr1 245017123 1 1 0 0.31 0.69 0 0 rs880
65 #CHROM POS ID REF ALT QUAL FILTER INFO
66 #1 10019 rs376643643 TA T . . RS=376643643;RSPOS=10020;dbSNPBuildID=138;SSR=0;SAO=0;VP=0x050000020005000002000200;WGT=1;VC=DIV;R5;ASP;OTHERKG
69 for my $chr (keys %SNP) {
70 for my $pos (keys %{$SNP{$chr}}) {
71 my %Dat = %{$SNP{$chr}{$pos}};
73 for my $k (keys %Dat) {
77 #ddx $SNP{$chr}{$pos}; print "$flag\n\n";
81 for (sort {$a<=>$b} keys %Stat) {
82 my $v = sprintf("%0${Length}b",$_);
83 my $str = join("\t",$v,$Stat{$_},$_);
90 ./cntsnpn
.pl dbSNP132
.chr.All sperms0
{1,2,3}.5cf
.filter sperm2
{3,4,8}.5cf
.filter
91 ./cntsnpn
.pl human_9606_b142_GRCh37p13
.All
.vcf
.gz sperms0
{1,2,3}.5cf
.filter sperm2
{3,4,8}.5cf
.filter blood
.malbac5
.filter blood
.mda3
.filter