Skip to content

Commit

Permalink
requiring potential_match function misses some pairs with large diff …
Browse files Browse the repository at this point in the history
…in size
  • Loading branch information
nhansen committed Mar 15, 2021
1 parent 099ccae commit 00ef482
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions scripts/SVmerge
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,11 @@ sub open_files_and_sort {
my $this_command = ($vcf_file =~ /gz$/) ? "gunzip -c $vcf_file" : "cat $vcf_file";
push @commands, $this_command;
}
my $header_capture = ($vcf_files[0] =~ /gz$/) ? "gunzip -c $vcf_files[0] | grep \'#\'" : "grep \'#\' $vcf_files[0]";
my $header_capture = ($vcf_files[0] =~ /gz$/) ? "gunzip -c $vcf_files[0] | grep \'^#\'" : "grep \'^#\' $vcf_files[0]";
my $commandpipe = join ';', @commands;
$commandpipe = "(" . $header_capture . "; (" . $commandpipe . ") | grep -v '#' | sort -k1,1 -k2,2n ) |";
$commandpipe = "(" . $header_capture . "; (" . $commandpipe . ") | grep -v '^#' | sort -k1,1 -k2,2n ) |";
#$commandpipe = "(" . $commandpipe . ") | grep -v '^#' | sort -k1,1 -k2,2n |";
DEBUG("Command pipe:\n$commandpipe");
my $variant_fh = Open($commandpipe);

return $variant_fh;
Expand Down Expand Up @@ -293,8 +295,9 @@ sub calc_distances {
my $pos_diff = abs($rh_neighborhood_sv->{pos} - $rh_sv->{pos});
if (($rh_neighborhood_sv->{chrom} eq $rh_sv->{chrom}) && ($pos_diff <= $max_distance)) {
if ($Opt{'newdist'}) {
if (!($comp_obj->prohibitive_shift( -max_indel_rate => $Opt{maxindelrate} )) &&
($comp_obj->potential_match('-shiftfactor' => 1.0))) {
if (!($comp_obj->prohibitive_shift( -max_indel_rate => $Opt{maxindelrate} ))) {
##if (!($comp_obj->prohibitive_shift( -max_indel_rate => $Opt{maxindelrate} )) &&
#($comp_obj->potential_match('-shiftfactor' => 1.0))) { # second line disallows difference in size
my $rh_distance_metrics = $comp_obj->calc_distance( -printdist => $dist_fh );
next if (!(defined($rh_distance_metrics->{'edit_distance'})));
my $d_s = $rh_distance_metrics->{'d_s'};
Expand Down

0 comments on commit 00ef482

Please sign in to comment.