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

filter svaba to have 10kb + in fusion

parent 18c85217
No related merge requests found
...@@ -114,7 +114,7 @@ W1:while (my $line = <IN>) { ...@@ -114,7 +114,7 @@ W1:while (my $line = <IN>) {
} }
print VCFOUT join("\t",$chrom,$pos,$id,$ref,$alt,$score,$filter,$newannot, print VCFOUT join("\t",$chrom,$pos,$id,$ref,$alt,$score,$filter,$newannot,
$format,@gts),"\n"; $format,@gts),"\n";
}elsif ($hash{SVTYPE} eq 'DEL' && $hash{SPAN} && $hash{SPAN} > 9999) { } elsif ($hash{SVTYPE} eq 'DEL' && $hash{SPAN} && $hash{SPAN} > 9999) {
my ($allele,$effect,$impact,$gene,$geneid,$feature, my ($allele,$effect,$impact,$gene,$geneid,$feature,
$featureid,$biotype,$rank,$codon,$aa,$pos_dna,$len_cdna, $featureid,$biotype,$rank,$codon,$aa,$pos_dna,$len_cdna,
$cds_pos,$cds_len,$aapos,$aalen,$distance,$err) = split(/\|/,$keeptrx); $cds_pos,$cds_len,$aapos,$aalen,$distance,$err) = split(/\|/,$keeptrx);
...@@ -230,6 +230,9 @@ close IN; ...@@ -230,6 +230,9 @@ close IN;
foreach my $id (keys %svpairs) { foreach my $id (keys %svpairs) {
if ($id =~ m/815016443/) {
warn "debugging\n";
}
my $alt1 = $svpairs{$id}{1}{alt}; my $alt1 = $svpairs{$id}{1}{alt};
my $alt2 = $svpairs{$id}{2}{alt}; my $alt2 = $svpairs{$id}{2}{alt};
my $svtype; my $svtype;
...@@ -237,8 +240,10 @@ foreach my $id (keys %svpairs) { ...@@ -237,8 +240,10 @@ foreach my $id (keys %svpairs) {
$svtype = 'DEL'; $svtype = 'DEL';
}elsif ($alt2 =~ m/^\w\[/ && $alt1 =~ m/^\]/) { }elsif ($alt2 =~ m/^\w\[/ && $alt1 =~ m/^\]/) {
$svtype = 'INS'; $svtype = 'INS';
}else {
$svtype = 'UNK';
} }
if ($svtype eq 'INS' || ($svtype eq 'DEL' && $svpairs{$id}{1}{gene} !~ m/&/)) { if ($svtype eq 'INS' || ($svtype eq 'DEL' && $svpairs{$id}{1}{gene} !~ m/&/ && $svpairs{$id}{1}{span} < 9999)) {
if ($filter =~ m/LOWMAPQ|LowQual/i) { if ($filter =~ m/LOWMAPQ|LowQual/i) {
$filter = 'FailedQC'.$filter; $filter = 'FailedQC'.$filter;
} }
......
...@@ -123,7 +123,7 @@ then ...@@ -123,7 +123,7 @@ then
if [[ $filter == 1 ]] if [[ $filter == 1 ]]
then then
zgrep '#CHROM' ${pair_id}.svaba.sv.vcf.gz > ${pair_id}.svaba.genefusion.txt zgrep '#CHROM' ${pair_id}.svaba.sv.vcf.gz > ${pair_id}.svaba.genefusion.txt
zcat ${pair_id}.svaba.sv.vcf.gz | $SNPEFF_HOME/scripts/vcfEffOnePerLine.pl |java -jar $SNPEFF_HOME/SnpSift.jar extractFields - CHROM POS ALT ID ANN[*].EFFECT ANN[*].GENE ANN[*].BIOTYPE FILTER FORMAT GEN[*] |grep -E 'gene_fusion|feature_fusion' | sort -u >> ${pair_id}.sgf.txt zcat ${pair_id}.svaba.sv.vcf.gz | $SNPEFF_HOME/scripts/vcfEffOnePerLine.pl |java -jar $SNPEFF_HOME/SnpSift.jar extractFields - CHROM POS ALT ID ANN[*].EFFECT ANN[*].GENE ANN[*].BIOTYPE FILTER FORMAT GEN[*] |grep -E 'gene_fusion|feature_fusion' | sort -u > ${pair_id}.sgf.txt
mv ${pair_id}.svaba.vcf.gz ${pair_id}.svaba.ori.vcf.gz mv ${pair_id}.svaba.vcf.gz ${pair_id}.svaba.ori.vcf.gz
perl $baseDir/filter_svaba.pl -t $tid -p $pair_id -i ${pair_id}.svaba.ori.vcf.gz -s ${pair_id}.svaba.sv.vcf.gz perl $baseDir/filter_svaba.pl -t $tid -p $pair_id -i ${pair_id}.svaba.ori.vcf.gz -s ${pair_id}.svaba.sv.vcf.gz
bgzip ${pair_id}.svaba.vcf bgzip ${pair_id}.svaba.vcf
......
...@@ -27,15 +27,19 @@ while (my $line = <VCF>) { ...@@ -27,15 +27,19 @@ while (my $line = <VCF>) {
my ($key,$val) = split(/=/,$a); my ($key,$val) = split(/=/,$a);
$hash{$key} = $val; $hash{$key} = $val;
} }
if ($alt =~ m/^chr/) { if ($alt =~ m/chr(\w+):(\d+)/i) {
$chr2 =~ m/(chr\w+):(\d+)/; $chr2='chr'.$1;
$chr2=$1;
$p2 = $2; $p2 = $2;
$hash{CHR2} = $chr2; $hash{CHR2} = $chr2;
$hash{'END'} = $p2; $hash{'END'} = $p2;
$annot .= ";CHR2=$chr2;END=$p2"; $annot .= ";CHR2=$chr2;END=$p2";
}elsif ($alt =~ m/CHR(\w+):(\d+)/i) {
$chr2='chr'.$1;
$p2 = $2;
$hash{CHR2} = 'chr'.$1;
$hash{END} = $2;
$annot .= ";CHR2=$chr2;END=$p2";
} }
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 = ();
...@@ -61,6 +65,10 @@ while (my $line = <VCF>) { ...@@ -61,6 +65,10 @@ while (my $line = <VCF>) {
} elsif ($gtdata{AD} =~ m/^\d+$/){ } elsif ($gtdata{AD} =~ m/^\d+$/){
$gtdata{AO} = $gtdata{AD}; $gtdata{AO} = $gtdata{AD};
$gtdata{RO} = $gtdata{DP} - $gtdata{AO}; $gtdata{RO} = $gtdata{DP} - $gtdata{AO};
if ($gtdata{RO} < 0) {
$gtdata{DP} += $gtdata{AO};
$gtdata{RO} = $gtdata{DP} - $gtdata{AO};
}
$gtdata{AD} = join(',',$gtdata{RO},$gtdata{AO}); $gtdata{AD} = join(',',$gtdata{RO},$gtdata{AO});
} elsif (exists $gtdata{DV} && exists $gtdata{RV}) { } elsif (exists $gtdata{DV} && exists $gtdata{RV}) {
$gtdata{AO} = $gtdata{DV} + $gtdata{RV}; $gtdata{AO} = $gtdata{DV} + $gtdata{RV};
......
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