From 21ae1046c4243577f30b80ca7c3eabb562ca1987 Mon Sep 17 00:00:00 2001 From: Brandi Cantarel <brandi.cantarel@utsouthwestern.edu> Date: Wed, 7 Oct 2020 11:01:34 -0500 Subject: [PATCH] account for LOH in CNVKit --- variants/filter_cnvkit.pl | 48 +++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/variants/filter_cnvkit.pl b/variants/filter_cnvkit.pl index 7a87800..4829d4a 100755 --- a/variants/filter_cnvkit.pl +++ b/variants/filter_cnvkit.pl @@ -102,26 +102,36 @@ while (my $line = <IN>) { print CNSO join("\t",$hash{chromosome},$hash{start},$hash{end}, $hash{log2},$hash{cn}),"\n"; - next if ($hash{cn} == 2) || scalar(keys %genes) < 1; + next if ($hash{cn} == 2 && $hash{cn1} ne '' && $hash{cn2} ne '' && $hash{cn1} > 0 && $hash{cn2} > 0) || scalar(keys %genes) < 1; + next if ($hash{cn} == 2 && $hash{cn1} eq '' && $hash{cn2} eq ''); my $abtype = 'amplification'; - $abtype = 'loss' if ($hash{cn} < 2); - $abtype = 'gain' if ($hash{cn} > 2 && $hash{cn} < 6); - foreach $gene (keys %genes) { - my @cytoband; - if ($cyto{$key}{'p'}) { - @nums = sort {$b <=> $a} @{$cyto{$key}{'p'}}; - push @cytoband, 'p'.$nums[0],'p'.$nums[-1]; - } if ($cyto{$key}{'q'}) { - @nums = sort {$a <=> $b} @{$cyto{$key}{'q'}}; - push @cytoband, 'q'.$nums[0],'q'.$nums[-1]; - } - if ($cytoband[0] eq $cytoband[-1]) { - $cband = $cytoband[0]; - }else { - $cband = join("-",$cytoband[0],$cytoband[-1]); + if ($hash{cn} != 2) { + $abtype = 'loss' if ($hash{cn} < 2); + if ($hash{cn} > 2 && $hash{cn} < 6) { + $abtype = 'gain' ; + if ($hash{cn1} ne '' && $hash{cn2} ne '' && ($hash{cn1} == 0 || $hash{cn2} == 0)) { + $abtype.= ' LOH'; } - print OUT join("\t",$gene,$hash{chromosome},$hash{start},$hash{end}, - $abtype,$hash{cn},$hash{weight},$cband),"\n"; + } + }else { + $abtype = 'cnLOH'; } -} + foreach $gene (keys %genes) { + my @cytoband; + if ($cyto{$key}{'p'}) { + @nums = sort {$b <=> $a} @{$cyto{$key}{'p'}}; + push @cytoband, 'p'.$nums[0],'p'.$nums[-1]; + } if ($cyto{$key}{'q'}) { + @nums = sort {$a <=> $b} @{$cyto{$key}{'q'}}; + push @cytoband, 'q'.$nums[0],'q'.$nums[-1]; + } + if ($cytoband[0] eq $cytoband[-1]) { + $cband = $cytoband[0]; + }else { + $cband = join("-",$cytoband[0],$cytoband[-1]); + } + print OUT join("\t",$gene,$hash{chromosome},$hash{start},$hash{end}, + $abtype,$hash{cn},$hash{weight},$cband),"\n"; + } + } close IN; -- GitLab