-
Notifications
You must be signed in to change notification settings - Fork 103
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
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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"; | ||
|
@@ -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; | ||
} | ||
else{ | ||
# warn "Current alignment (AS $alignment_score) isn't better than the best so far ($best_AS_so_far). Not changing anything\n"; | ||
} | ||
|
@@ -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"; | ||
|
@@ -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; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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"; | ||
} | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.