2 fixes. For Mark: when insertions can be partially left-aligned, we were reading off the wrong bases. For GS post: the stored VariantContext.REFERENCE_BASE_FOR_INDEL_KEY needs to be updated when left-aligning because it can change.

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@5375 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
ebanks 2011-03-04 21:00:08 +00:00
parent b42005e7d7
commit 337b54136f
1 changed files with 6 additions and 1 deletions

View File

@ -139,10 +139,15 @@ public class LeftAlignVariants extends RodWalker<Integer, Integer> {
int indelIndex = originalIndex-difference;
byte[] newBases = new byte[indelLength];
System.arraycopy(refSeq, indelIndex, newBases, 0, indelLength);
System.arraycopy((vc.isDeletion() ? refSeq : originalIndel), indelIndex, newBases, 0, indelLength);
Allele newAllele = Allele.create(newBases, vc.isDeletion());
newVC = updateAllele(newVC, newAllele);
// we need to update the reference base just in case it changed
Map<String, Object> attrs = new HashMap<String, Object>(newVC.getAttributes());
attrs.put(VariantContext.REFERENCE_BASE_FOR_INDEL_KEY, refSeq[indelIndex-1]);
newVC = VariantContext.modifyAttributes(newVC, attrs);
writer.add(newVC, refSeq[indelIndex-1]);
return 1;
} else {