Skip to content
Snippets Groups Projects
Commit 09e71db1 authored by Brandi Cantarel's avatar Brandi Cantarel
Browse files

fixing platypus union format

parent 41a31528
Branches
Tags
No related merge requests found
...@@ -25,7 +25,7 @@ foreach $vcf (@vcffiles) { ...@@ -25,7 +25,7 @@ foreach $vcf (@vcffiles) {
($chromhd, $posd,$idhd,$refhd,$althd,$scorehd, ($chromhd, $posd,$idhd,$refhd,$althd,$scorehd,
$filterhd,$annothd,$formathd,@sampleids) = split(/\t/, $line); $filterhd,$annothd,$formathd,@sampleids) = split(/\t/, $line);
foreach $j (0..$#sampleids) { foreach $j (0..$#sampleids) {
$sampleids[$j] = (split(/\./,$sampleids[$j]))[0]; $sampleids[$j] = (split(/\./,$sampleids[$j]))[0];
} }
unless (@sampleorder) { unless (@sampleorder) {
@sampleorder = @sampleids; @sampleorder = @sampleids;
...@@ -43,6 +43,7 @@ foreach $vcf (@vcffiles) { ...@@ -43,6 +43,7 @@ foreach $vcf (@vcffiles) {
my ($key,$val) = split(/=/,$a); my ($key,$val) = split(/=/,$a);
$hash{$key} = $val; $hash{$key} = $val;
} }
#next if (($hash{FS} && $hash{FS} > 60) || $filter =~ m/strandBias/i);
my @deschead = split(/:/,$format); my @deschead = split(/:/,$format);
my $newformat = 'GT:DP:AD:AO:RO'; my $newformat = 'GT:DP:AD:AO:RO';
my %newgts; my %newgts;
...@@ -66,11 +67,11 @@ foreach $vcf (@vcffiles) { ...@@ -66,11 +67,11 @@ foreach $vcf (@vcffiles) {
next FG; next FG;
} }
if ($gtdata{DP4}) { #varscan uses this if ($gtdata{DP4}) { #varscan uses this
my ($ref_fwd,$ref_rev,$alt_fwd,$alt_rev) = split(',',$gtdata{DP4}); my ($ref_fwd,$ref_rev,$alt_fwd,$alt_rev) = split(',',$gtdata{DP4});
$gtdata{AO} = $alt_fwd+$alt_rev; $gtdata{AO} = $alt_fwd+$alt_rev;
$gtdata{RO} = $ref_fwd+$ref_rev; $gtdata{RO} = $ref_fwd+$ref_rev;
$gtdata{DP} = $ref_fwd+$ref_rev+$alt_fwd+$alt_rev; $gtdata{DP} = $ref_fwd+$ref_rev+$alt_fwd+$alt_rev;
$gtdata{AD} = join(",",$gtdata{RO},$gtdata{AO}); $gtdata{AD} = join(",",$gtdata{RO},$gtdata{AO});
}elsif ($gtdata{AD} && $gtdata{AD} =~ m/,/){ }elsif ($gtdata{AD} && $gtdata{AD} =~ m/,/){
($gtdata{RO},@alts) = split(/,/,$gtdata{AD}); ($gtdata{RO},@alts) = split(/,/,$gtdata{AD});
$gtdata{AO} = join(",",@alts); $gtdata{AO} = join(",",@alts);
...@@ -79,9 +80,12 @@ foreach $vcf (@vcffiles) { ...@@ -79,9 +80,12 @@ foreach $vcf (@vcffiles) {
$gtdata{DP} += $_; $gtdata{DP} += $_;
} }
} elsif (exists $gtdata{NR} && exists $gtdata{NV}) { #platypus uses this } elsif (exists $gtdata{NR} && exists $gtdata{NV}) { #platypus uses this
$gtdata{DP} = $gtdata{NR}; $gtdata{DP} = (split(/,/,$gtdata{NR}))[0];
$gtdata{AO} = $gtdata{NV}; $gtdata{AO} = $gtdata{NV};
$gtdata{RO} = $gtdata{DP} - $gtdata{AO}; $gtdata{RO} = $gtdata{DP};
foreach $altct (split(/,/,$gtdata{NV})) {
$gtdata{RO} -= $altct;
}
$gtdata{AD} = join(",",$gtdata{RO},$gtdata{AO}) $gtdata{AD} = join(",",$gtdata{RO},$gtdata{AO})
} elsif (exists $gtdata{AO} && exists $gtdata{RO}) { } elsif (exists $gtdata{AO} && exists $gtdata{RO}) {
$gtdata{AD} = join(',',$gtdata{RO},$gtdata{AO}); $gtdata{AD} = join(',',$gtdata{RO},$gtdata{AO});
...@@ -106,21 +110,21 @@ foreach $vcf (@vcffiles) { ...@@ -106,21 +110,21 @@ foreach $vcf (@vcffiles) {
} }
my @callers = ('ssvar','sam','gatk','strelka2','platypus','hotspot'); my @callers = ('ssvar','sam','gatk','strelka2','platypus','hotspot');
if (grep(/mutect/,@vcffiles)) { if (grep(/mutect/,@vcffiles)) {
@callers = ('sssom','pmutect','shimmer','strelka2','varscan','virmid'); @callers = ('sssom','pmutect','shimmer','strelka2','varscan','virmid');
} }
F1:foreach $chr (sort {$a cmp $b} keys %lines) { F1:foreach $chr (sort {$a cmp $b} keys %lines) {
F2:foreach $pos (sort {$a <=> $b} keys %{$lines{$chr}}) { F2:foreach $pos (sort {$a <=> $b} keys %{$lines{$chr}}) {
my $callset = join(",",keys %{$lines{$chr}{$pos}}); my $callset = join(",",keys %{$lines{$chr}{$pos}});
F3:foreach $caller (@callers) { F3:foreach $caller (@callers) {
if ($lines{$chr}{$pos}{$caller}) { if ($lines{$chr}{$pos}{$caller}) {
my ($chrom, $pos,$id,$ref,$alt,$score,$filter,$annot, my ($chrom, $pos,$id,$ref,$alt,$score,$filter,$annot,
$format,@gts) = split(/\t/,$lines{$chr}{$pos}{$caller}); $format,@gts) = split(/\t/,$lines{$chr}{$pos}{$caller});
$annot = $annot.";CallSet=".$callset; $annot = $annot.";CallSet=".$callset;
print OUT join("\t",$chrom,$pos,$id,$ref,$alt,$score, print OUT join("\t",$chrom,$pos,$id,$ref,$alt,$score,
$filter,$annot,$format,@gts),"\n"; $filter,$annot,$format,@gts),"\n";
last F3; last F3;
} }
} }
} }
} }
close OUT; close OUT;
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment