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
Fix up adapter clipping tags after an adapter is selected #1020
Conversation
2447484
to
a23e396
Compare
@@ -66,6 +72,9 @@ | |||
private int numAdaptersSeen = 0; | |||
private final CollectionUtil.DefaultingMap<AdapterPair, Integer> seenCounts = new CollectionUtil.DefaultingMap<AdapterPair, Integer>(0); | |||
|
|||
//Store all the sam records we have seen prior to choosing and adapter so that we can go back and fix the ones |
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.
Typo: and
-> an
preAdapterPrunedRecords.get(ret).add(read1); | ||
preAdapterPrunedRecords.get(ret).add(read2); | ||
tallyFoundAdapter(ret); | ||
} |
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.
Is it worth pulling this block into a separate method, to avoid the duplication?
//remove all the reads for the selected adapters | ||
Arrays.stream(adapters.get()).forEach(adapter -> preAdapterPrunedRecords.remove(adapter)); | ||
//anything left is marked with the incorrect adapter and needs its XT tag removed | ||
(preAdapterPrunedRecords.values()).forEach(readList -> readList.parallelStream().forEach(read -> { |
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.
Unneeded parens around preAdapterPrunedRecords.values()
?
import java.util.Map; | ||
import java.util.Objects; |
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.
Unused import?
In a multi-threaded environment there is a chance that basecalls to sam is not deterministic depending on which adapters it sees prior to adapter selection and which adapter it selects. This PR is mean to cache all read seen pre adapter selection and then go back and remove XT tags from reads that were clipped due to adapters other than the selected on being found.
Give your PR a concise yet descriptive title
Please explain the changes you made here.
Explain the motivation for making this change. What existing problem does the pull request solve?
Mention any issues fixed, addressed or otherwise related to this pull request, including issue numbers or hard links for issues in other repos.
You can delete these instructions once you have written your PR description.
Checklist (never delete this)
Never delete this, it is our record that procedure was followed. If you find that for whatever reason one of the checklist points doesn't apply to your PR, you can leave it unchecked but please add an explanation below.
Content
Review
For more detailed guidelines, see https://github.com/broadinstitute/picard/wiki/Guidelines-for-pull-requests