-
Notifications
You must be signed in to change notification settings - Fork 372
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
Fixes LiftoverVCF for indels (again) #1469
Fixes LiftoverVCF for indels (again) #1469
Conversation
- fixes (again) #1258 which was still broken due to the call to "make()" in the presence of a mismatching "END" attribute and "getEnd()" result.
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.
Java code looks ok; can't say I fully understand the fix or the test though.
public void testLiftOverIndels(final LiftOver liftOver, final ReferenceSequence reference, final VariantContext source, final VariantContext result) { | ||
|
||
final Interval target = liftOver.liftOver(new Interval(source.getContig(), source.getStart(), source.getEnd()), 1); | ||
|
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.
bingo
@nh13 while this PR was not intended to fix your other PR, I found the cause and I think I fixed it...care to test? (and review the PR while you're at it...) 😄 |
@pshapiro4broad the problem was that the old code called "build()" on a builder that was in an improper state, the end of the variant was not at the same place where the END attribute was (for a non symbolic variant), and this didn't validate. The changes to the tests simply adds the END attribute so that this problem is triggered, indeed the modified tests failed before I made the change. |
- Symbolic alleles are now lifted over as well, by simply carrying them along.
@nh13 you inspired me to make this work on symbolic alleles as well...and then I also figured out that I can simplify the code around the liftover that involves reverse-complementing....anyhow, no good deed will go unpunished....want to review this? |
@yfarjoun I can review if it helps. I won't be able to look at it until this weekend given my current workload. Is that allright? |
Fine with me. Thanks!
…On Thu, Feb 20, 2020 at 1:15 AM Nils Homer ***@***.***> wrote:
@yfarjoun <https://github.com/yfarjoun> I can review if it helps. I won't
be able to look at it until this weekend given my current workload. Is that
allright?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1469?email_source=notifications&email_token=AAU6JUSMAUFOAKLSJ7KVOGTRDW4RVA5CNFSM4KV37CV2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMKCSNY#issuecomment-588523831>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAU6JUREVBZEPQC4X56EFLDRDW4RVANCNFSM4KV37CVQ>
.
|
Any chance there has been an update to this? I'm encountering a similar error with the following genotype (test.b37.vcf.gz). For reference, I am trying to lift over genotypes from build 37 to build 38. I'm using the b37ToHg38 chain and GRCh38_full_analysis_set_plus_decoy_hla.fa found on the 1000 Genomes FTP
The error message is:
Thanks! |
Sorry, I'm extremely busy at work and haven't had time outside of work to look at this. Please do not wait on my review to hold this up, as I cannot commit to doing it in the next two weeks (work + vacation) |
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.
Looks OK to me, only some very minor formatting changes.
return true; | ||
} | ||
|
||
return vc.getAlleles().stream().filter(a -> !a.isSymbolic()).filter(a -> !a.equals(Allele.SPAN_DEL)). |
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.
Not sure if the sun/oracle java code guidelines cover streaming operations yet, but I think it's more readable if each stream segment starts a new line:
return vc.getAlleles().stream()
.filter(a -> !a.isSymbolic())
.filter(a -> !a.equals(Allele.SPAN_DEL))
.anyMatch(a -> a.length() != 1);
@@ -365,7 +359,9 @@ protected static void leftAlignVariant(final VariantContextBuilder builder, fina | |||
|
|||
// Put each allele into the alleleBasesMap unless it is a spanning deletion. | |||
// Spanning deletions are dealt with as a special case later in fixedAlleleMap. | |||
alleles.stream().filter(a->!a.equals(Allele.SPAN_DEL)).forEach(a -> alleleBasesMap.put(a, a.getBases())); | |||
alleles.stream() | |||
.filter(a->!a.equals(Allele.SPAN_DEL)&&!a.isSymbolic()) |
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.
whitespace
.filter(a->!a.equals(Allele.SPAN_DEL)&&!a.isSymbolic()) | |
.filter(a -> !a.equals(Allele.SPAN_DEL) && !a.isSymbolic()) |
also, above you write filter(a -> !a.isSymbolic()).filter(a -> !a.equals(Allele.SPAN_DEL)
. The version with one call to filter()
is probably clearer, either way I would use the same form in both places to be consistent.
|
||
for (final Allele oldAllele : originalAlleles) { | ||
alleles.add(LiftoverUtils.reverseComplement(oldAllele, target, refSeq, isIndel, addToStart)); | ||
private static boolean isIndelForLiftover(final VariantContext vc){ |
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.
whitespace
private static boolean isIndelForLiftover(final VariantContext vc){ | |
private static boolean isIndelForLiftover(final VariantContext vc) { |
fixes #1258
fixes #1280
Thanks to the several users who reported this is still a problem, and sorry for ignoring you for a year. @nh13, @kirannarta, and @duartemolha!
Description
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