Skip to content

Commit

Permalink
Update pl list (#18)
Browse files Browse the repository at this point in the history
* Update code to allow for comma-separated allele frequencies when alt alleles exist

* Avoid collision in var names
  • Loading branch information
lcoombe authored May 17, 2024
1 parent 9891e54 commit a45b9f5
Showing 1 changed file with 24 additions and 18 deletions.
42 changes: 24 additions & 18 deletions ntRootAncestryPredictor.pl
Original file line number Diff line number Diff line change
Expand Up @@ -98,25 +98,31 @@ sub usage_page {
my @d=split(/\=/,$el);
if($d[0]=~/(\S+)\_AF/){
my $pop=$1;
if (! defined $populations->{$pop}) {
$populations->{$pop} = 1;
}
$s->{$d[0]}{'sum'}+=$d[1];

#chr winnum pop
$z->{$a[0]}{$wn}{$pop}{'sum'}+=$d[1];
$y->{$a[0]}{$wn}{'ct'}++;


if($d[1]){
$s->{$d[0]}{'ct'}++;
$z->{$a[0]}{$wn}{$pop}{'nzct'}++;
if($a[1]>$max){
$max=$a[1];
$maxpop=$pop;
my @AFalleles = split(/,/,$d[1]);
foreach my $afallele(@AFalleles){
if ($afallele !~ /\d+/) {
next;
}
if (! defined $populations->{$pop}) {
$populations->{$pop} = 1;
}
$s->{$d[0]}{'sum'}+=$afallele;

#chr winnum pop
$z->{$a[0]}{$wn}{$pop}{'sum'}+=$afallele;
$y->{$a[0]}{$wn}{'ct'}++;


if($afallele){
$s->{$d[0]}{'ct'}++;
$z->{$a[0]}{$wn}{$pop}{'nzct'}++;
if($a[1]>$max){
$max=$a[1];
$maxpop=$pop;
}
} else{
$afallele=1;
}
} else{
$d[1]=1;
}
}
}
Expand Down

0 comments on commit a45b9f5

Please sign in to comment.