Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bismark: fixed bug for ambiguous alignments #58

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions bismark
Original file line number Diff line number Diff line change
Expand Up @@ -3035,8 +3035,7 @@ sub check_bowtie_results_single_end_bowtie2{
}
}
else{
if ($alignment_score >= $best_AS_so_far){ # AS are generally negative with a maximum of 0;
# 19 07 2016: changed this to >= so that equally good alignments are also added. Ambiguous alignments from different threads will be identified later on
if ($alignment_score > $best_AS_so_far){ # AS are generally negative with a maximum of 0;
$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";
Expand All @@ -3050,6 +3049,9 @@ sub check_bowtie_results_single_end_bowtie2{
# warn "$first_ambig_alignment\n"; sleep(1);
}
}
elsif ($alignment_score == $best_AS_so_far) {
$amb_same_thread = 1;
}
Copy link
Owner

@FelixKrueger FelixKrueger Jul 21, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is the right way to go about this because if this alignment has the same alignment score as the best AS so far then this is not ambiguous in the same thread. To be ambiguous within the same thread the AS and the second best hit have to have the same score.
If overwrite is specified the alignment will be added to an alignment data structure further down, and in a later step all alignments in that data structure will be sorted by their lowest AS. If two or more different locations have the same lowest AS the read is booted altogether.

else{
# warn "Current alignment (AS $alignment_score) isn't better than the best so far ($best_AS_so_far). Not changing anything\n";
}
Expand Down Expand Up @@ -3976,8 +3978,7 @@ sub check_bowtie_results_paired_ends_bowtie2{
}
}
else{
if ($sum_of_alignment_scores_1 >= $best_AS_so_far){ # AS are generally negative with a maximum of 0
# 19 07 2016 Changed to >= so that equally good alignments to different positions get added as well. Ambiguous alignments are identified and removed later.
if ($sum_of_alignment_scores_1 > $best_AS_so_far){ # AS are generally negative with a maximum of 0
$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";
Expand All @@ -3995,6 +3996,9 @@ sub check_bowtie_results_paired_ends_bowtie2{
# warn "$first_ambig_alignment_line1\n$first_ambig_alignment_line2\n\n"; sleep(1);
}
}
elsif ($sum_of_alignment_scores_1 == $best_AS_so_far){
$amb_same_thread = 1;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here.

}
else{
# warn "current alignment (AS $sum_of_alignment_scores) isn't better than the best so far ($best_AS_so_far). Not changing anything\n";
}
Expand Down