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

Fix up adapter clipping tags after an adapter is selected #1020

Merged
merged 3 commits into from Dec 8, 2017

Conversation

jacarey
Copy link
Collaborator

@jacarey jacarey commented Dec 8, 2017

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

  • Added or modified tests to cover changes and any new functionality
  • Edited the README / documentation (if applicable)
  • All tests passing on Travis

Review

  • Final thumbs-up from reviewer
  • Rebase, squash and reword as applicable

For more detailed guidelines, see https://github.com/broadinstitute/picard/wiki/Guidelines-for-pull-requests

@jacarey jacarey force-pushed the jc_fix_non_determinisim_in_basecalls_to_sam branch from 2447484 to a23e396 Compare December 8, 2017 14:12
@@ -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
Copy link
Contributor

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);
}
Copy link
Contributor

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 -> {
Copy link
Contributor

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()?

@coveralls
Copy link

coveralls commented Dec 8, 2017

Coverage Status

Coverage increased (+0.0005%) to 77.221% when pulling a23e396 on jc_fix_non_determinisim_in_basecalls_to_sam into b0b9f78 on master.

@coveralls
Copy link

coveralls commented Dec 8, 2017

Coverage Status

Coverage increased (+0.0005%) to 77.221% when pulling a23e396 on jc_fix_non_determinisim_in_basecalls_to_sam into b0b9f78 on master.

@coveralls
Copy link

coveralls commented Dec 8, 2017

Coverage Status

Coverage increased (+0.0005%) to 77.221% when pulling a23e396 on jc_fix_non_determinisim_in_basecalls_to_sam into b0b9f78 on master.

import java.util.Map;
import java.util.Objects;
Copy link
Contributor

Choose a reason for hiding this comment

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

Unused import?

@coveralls
Copy link

coveralls commented Dec 8, 2017

Coverage Status

Coverage decreased (-0.003%) to 77.218% when pulling e5638f4 on jc_fix_non_determinisim_in_basecalls_to_sam into b0b9f78 on master.

@coveralls
Copy link

coveralls commented Dec 8, 2017

Coverage Status

Coverage decreased (-0.003%) to 77.218% when pulling e5638f4 on jc_fix_non_determinisim_in_basecalls_to_sam into b0b9f78 on master.

@jacarey jacarey merged commit 763d98e into master Dec 8, 2017
@jacarey jacarey deleted the jc_fix_non_determinisim_in_basecalls_to_sam branch January 26, 2018 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants