Fix hgvsg for insertion with ref allele -
#1124
Open
+6
−5
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.
Problem
Here #1077 we have fixed hgvsg for multi-allelic variant. But it introduced a bug for insertion types.
We are not sending the end position during trimming -
https://github.com/nuno-agostinho/ensembl-variation/blob/3ed1013c5bfacb2416db9e67d50cb96fb2fcb0b6/modules/Bio/EnsEMBL/Variation/VariationFeature.pm#L1970
What it does for insertion is that it increase the end position by
length of reference sequence -1
-https://github.com/nuno-agostinho/ensembl-variation/blob/3ed1013c5bfacb2416db9e67d50cb96fb2fcb0b6/modules/Bio/EnsEMBL/Variation/Utils/Sequence.pm#L970
This becomes problematic if the
length of reference sequence -1
is not the same asend - start
and there is no trimming happening so that position sticks around. This happen only in the case when we have-
in ref allele for insertion.The end result is different position in slice and sub slice -
https://github.com/nuno-agostinho/ensembl-variation/blob/3ed1013c5bfacb2416db9e67d50cb96fb2fcb0b6/modules/Bio/EnsEMBL/Variation/VariationFeature.pm#L2016-L2019
and, terminating in a error here -
https://github.com/nuno-agostinho/ensembl-variation/blob/3ed1013c5bfacb2416db9e67d50cb96fb2fcb0b6/modules/Bio/EnsEMBL/Variation/Utils/Sequence.pm#L511
Fix
trim_sequences
do not try to calculate it.ref_end
position. Otherwise it will fail in trim on reverse direction.Test: