5 my ($list,$store,$outdir) = @ARGV;
9 open LI
,"<$list" or die($!);
10 while (my $info = <LI
>){
12 next if ($info =~ /^#/);
13 my ($M,$F,$C) = split /\s+/,$info;
19 #########################################################
21 my ($C,$tag,$id) = @_;
22 open TE
,"<$store/p$C.$tag.tsv" or die($!);
23 open TOUT
,">$outdir/$id.txt" or die($!);
24 print TOUT
"#Sample ID: $id\n";
25 print TOUT
"MarkerID\tGenoType\tQUAL\tACGTdepths\n";
27 my @AllBase = qw{A C G T
};
28 while (my $line = <TE
>){
30 my @data = split /\t/,$line;
31 next if ($data[3] eq '.' or $data[3] < 100);
32 my @tM = splice @data,4;
35 my @bases = split /,/,$data[2];
38 my @Depinfo = split /[;,]/,$_;
39 for my $i (1..scalar @Depinfo - 1){
40 if ($Depinfo[$i] eq '.'){$Depinfo[$i] = 0;}
41 $Dep{$bases[$i - 1]} += $Depinfo[$i];
42 $depsum += $Depinfo[$i];
50 next if ($depcheck == 0);
52 my @sort = sort {$Dep{$b}<=>$Dep{$a}} keys %Dep;
54 if (scalar @sort == 1){
55 $genotype = join "/",$sort[0],$sort[0];
56 }elsif (scalar @sort > 1 && $Dep{$sort[1]} <= $Dep{$sort[0]} * 0.01){
57 $genotype = join "/",$sort[0],$sort[0];
58 }elsif (scalar @sort > 1 && $Dep{$sort[1]} >= $Dep{$sort[0]} * 0.1){
59 my @rKeys = sort @sort[0,1];
60 $genotype = join "/",@rKeys;
64 unless (defined $Dep{$_}){
68 if (defined $genotype && $genotype =~ /[ACGT]+/){
69 print TOUT
"$data[0]\t$genotype\t$data[3]\t$Dep{A},$Dep{C},$Dep{G},$Dep{T}\n";