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

merge in MNV fixes from hotfix 1.5.x branch #198

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -978,10 +978,15 @@ public static List<VariantKeyFields> decomposeAlignmentSingleVariants(String ref
VariantKeyFields keyFields = null;
char previousReferenceChar = 0;
char previousAlternateChar = 0;
int originalKeyFieldsIndex = 0;
// Assume that as a result of the alignment "reference" and "alternate" Strings are of the same length
for (int i = 0; i < reference.length(); i++) {
char referenceChar = reference.charAt(i);
char alternateChar = alternate.charAt(i);
if (referenceChar != '-') {
// keep track where we are in the original reference
originalKeyFieldsIndex++;
}
// Insertion
if (referenceChar == '-') {
// Assume there cannot be a '-' at the reference and alternate aligned sequences at the same position
Expand All @@ -1003,16 +1008,18 @@ public static List<VariantKeyFields> decomposeAlignmentSingleVariants(String ref
// Current character is a continuation of a deletion
if (previousAlternateChar == '-') {
keyFields.setReference(keyFields.getReference() + referenceChar);
keyFields.setEnd(keyFields.getEnd()+1);
keyFields.setEnd(keyFields.getEnd() + 1);
// New deletion found, create new keyFields
} else {
keyFields = new VariantKeyFields(genomicStart + i, genomicStart + i,
int originalPosition = genomicStart + originalKeyFieldsIndex - 1;
keyFields = new VariantKeyFields(originalPosition, originalPosition,
String.valueOf(referenceChar),"", originalKeyFields);
keyFieldsList.add(keyFields);
}
// SNV
} else if (referenceChar != alternateChar) {
keyFields = new VariantKeyFields(genomicStart + i, genomicStart + i,
int originalPosition = genomicStart + originalKeyFieldsIndex - 1;
keyFields = new VariantKeyFields(originalPosition, originalPosition,
String.valueOf(referenceChar), String.valueOf(alternateChar), originalKeyFields);
keyFieldsList.add(keyFields);
}
Expand Down
Loading