Skip to content

Commit

Permalink
Ambiguous within thread gets only reset for better alignments
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixKrueger committed Jul 22, 2016
1 parent 60fb422 commit cde170c
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions bismark
Original file line number Diff line number Diff line change
Expand Up @@ -3039,10 +3039,14 @@ sub check_bowtie_results_single_end_bowtie2{
# 19 07 2016: changed this to >= so that equally good alignments are also added. Ambiguous alignments from different threads will be identified later on
$best_AS_so_far = $alignment_score;
$overwrite++;
# warn "Found better alignment score ($alignment_score), setting \$best_AS_so_far to $best_AS_so_far\n";
# resetting the ambiguous within thread memory (if applicable at all)
# warn "Resetting amb within thread value to 0\n";
$amb_same_thread = 0;
# warn "Found better or equal alignment score ($alignment_score), setting \$best_AS_so_far to $best_AS_so_far\n";

# resetting the ambiguous within thread memory (if applicable at all) only if the current alignment is really better than the previous one.
# 22 07 2016: ambiguous score within same read only resets if the current alignment is really better than the previous one
if ($alignment_score > $best_AS_so_far){
# warn "Resetting amb within thread value to 0\n";
$amb_same_thread = 0;
}

if ($ambig_bam){ # also setting a new first_ambig_alignment
$first_ambig_alignment = $fhs[$index]->{last_line};
Expand All @@ -3051,7 +3055,7 @@ sub check_bowtie_results_single_end_bowtie2{
}
}
else{
# warn "Current alignment (AS $alignment_score) isn't better than the best so far ($best_AS_so_far). Not changing anything\n";
warn "Current alignment (AS $alignment_score) isn't better than the best so far ($best_AS_so_far). Not changing anything\n";
}
}

Expand All @@ -3073,6 +3077,7 @@ sub check_bowtie_results_single_end_bowtie2{
else{
# warn "This read has a worse alignments score than the best alignment so far and will be ignored even though it is ambiguous in itself\n";
}

### if there is a better alignment later on -> fine. If not, the read will get booted altogether

## need to read and discard all additional ambiguous reads until we reach the next sequence
Expand Down Expand Up @@ -3980,10 +3985,14 @@ sub check_bowtie_results_paired_ends_bowtie2{
# 19 07 2016 Changed to >= so that equally good alignments to different positions get added as well. Ambiguous alignments are identified and removed later.
$best_AS_so_far = $sum_of_alignment_scores_1;
$overwrite = 1;
# warn "Found better sum of alignment scores ($sum_of_alignment_scores_1), setting \$best_AS_so_far to $best_AS_so_far\n";
# resetting the ambiguous within thread memory (if applicable at all)
# warn "Resetting amb within thread value to 0\n";
$amb_same_thread = 0;

# warn "Found better or equal sum of alignment scores ($sum_of_alignment_scores_1), setting \$best_AS_so_far to $best_AS_so_far\n";
# resetting the ambiguous within thread memory (if applicable at all) only if the current alignment is really better than the previous one.
# 22 07 2016: ambiguous score within same read only resets if the current alignment is really better than the previous one
if ($sum_of_alignment_scores_1 > $best_AS_so_far){
# warn "Resetting amb within thread value to 0\n";
$amb_same_thread = 0;
}

if ($ambig_bam){ # also setting a new first_ambig_alignment
# Read 1
Expand Down Expand Up @@ -10207,6 +10216,6 @@ Bismark SAM OUTPUT (default):
Each read of paired-end alignments is written out in a separate line in the above format.
Last edited on 20 July 2016
Last edited on 22 July 2016
HOW_TO
}

0 comments on commit cde170c

Please sign in to comment.