Skip to content
Permalink
Browse files

bugfix in VDJCObject#getIncompleteFeature

  • Loading branch information...
PoslavskySV committed Sep 10, 2019
1 parent f4a68c2 commit 268b7df28b033a0aa39116634c35852751e15a22
Showing with 18 additions and 3 deletions.
  1. +18 −3 src/main/java/com/milaboratory/mixcr/basictypes/VDJCObject.java
@@ -422,7 +422,7 @@ public CaseSensitiveNucleotideSequence getIncompleteFeature(GeneFeature geneFeat
assert lAl.getSequence1Range().containsBoundary(positionInRef);

IncompleteSequencePart part = new IncompleteSequencePart(lHit, false, iLeftTarget,
aabs(lAl.convertToSeq2Position(positionInRef)),
aabsLeft(positionInRef, lAl),
lAl.getSequence2Range().getTo());
if (part.begin != part.end)
leftParts.add(part);
@@ -471,7 +471,7 @@ public CaseSensitiveNucleotideSequence getIncompleteFeature(GeneFeature geneFeat

IncompleteSequencePart part = new IncompleteSequencePart(rHit, false, iRightTarget,
rAl.getSequence2Range().getFrom(),
aabs(rAl.convertToSeq2Position(positionInRef)));
aabsRight(positionInRef, rAl));
if (part.begin != part.end)
rightParts.add(part);

@@ -545,7 +545,10 @@ public CaseSensitiveNucleotideSequence getIncompleteFeature(GeneFeature geneFeat
rightParts.add(0, part);
}

assert same(leftParts, rightParts) : "\n" + leftParts + "\n" + rightParts;
assert same(leftParts, rightParts) :
"\n" + leftParts
+ "\n" + rightParts
+ "\n" + (this instanceof Clone ? ((Clone) this).id : ((VDJCAlignments) this).getAlignmentsIndex());
pieces = leftParts;
} else {
if (lLast.iTarget != rLast.iTarget)
@@ -595,6 +598,18 @@ public CaseSensitiveNucleotideSequence getIncompleteFeature(GeneFeature geneFeat
partition, partition.getTranslationParameters(geneFeature));
}

private static int aabsLeft(int positionInRef, Alignment<NucleotideSequence> lAl) {
if (lAl.getSequence1Range().getFrom() == positionInRef)
return lAl.getSequence2Range().getFrom();
return aabs(lAl.convertToSeq2Position(positionInRef));
}

private static int aabsRight(int positionInRef, Alignment<NucleotideSequence> rAl) {
if (rAl.getSequence1Range().getTo() == positionInRef)
return rAl.getSequence2Range().getTo();
return aabs(rAl.convertToSeq2Position(positionInRef));
}

private boolean same(IncompleteSequencePart a, IncompleteSequencePart b) {
return a.hit == b.hit &&
a.germline == b.germline &&

0 comments on commit 268b7df

Please sign in to comment.
You can’t perform that action at this time.