deal with very large known indels that fall off our ref context
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3745 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
7ff6106c14
commit
bd2ba3eb37
|
|
@ -418,9 +418,7 @@ public class AlignmentUtils {
|
|||
CigarElement indel = cigar.getCigarElement(indexOfIndel);
|
||||
int indelLength = indel.getLength();
|
||||
|
||||
// the indel-based reference string
|
||||
byte[] alt = new byte[refSeq.length + (indelLength * (indel.getOperator() == CigarOperator.D ? -1 : 1))];
|
||||
|
||||
int totalRefBases = 0;
|
||||
for ( int i = 0; i < indexOfIndel; i++ ) {
|
||||
CigarElement ce = cigar.getCigarElement(i);
|
||||
int length = ce.getLength();
|
||||
|
|
@ -429,18 +427,27 @@ public class AlignmentUtils {
|
|||
case M:
|
||||
readIndex += length;
|
||||
refIndex += length;
|
||||
totalRefBases += length;
|
||||
break;
|
||||
case S:
|
||||
readIndex += length;
|
||||
break;
|
||||
case N:
|
||||
refIndex += length;
|
||||
totalRefBases += length;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// sometimes, when there are very large known indels, we won't have enough reference sequence to cover them
|
||||
if ( totalRefBases + indelLength > refSeq.length )
|
||||
indelLength -= (totalRefBases + indelLength - refSeq.length);
|
||||
|
||||
// the indel-based reference string
|
||||
byte[] alt = new byte[refSeq.length + (indelLength * (indel.getOperator() == CigarOperator.D ? -1 : 1))];
|
||||
|
||||
// add the bases before the indel
|
||||
System.arraycopy(refSeq, 0, alt, 0, refIndex);
|
||||
int currentPos = refIndex;
|
||||
|
|
|
|||
Loading…
Reference in New Issue