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);
|
CigarElement indel = cigar.getCigarElement(indexOfIndel);
|
||||||
int indelLength = indel.getLength();
|
int indelLength = indel.getLength();
|
||||||
|
|
||||||
// the indel-based reference string
|
int totalRefBases = 0;
|
||||||
byte[] alt = new byte[refSeq.length + (indelLength * (indel.getOperator() == CigarOperator.D ? -1 : 1))];
|
|
||||||
|
|
||||||
for ( int i = 0; i < indexOfIndel; i++ ) {
|
for ( int i = 0; i < indexOfIndel; i++ ) {
|
||||||
CigarElement ce = cigar.getCigarElement(i);
|
CigarElement ce = cigar.getCigarElement(i);
|
||||||
int length = ce.getLength();
|
int length = ce.getLength();
|
||||||
|
|
@ -429,18 +427,27 @@ public class AlignmentUtils {
|
||||||
case M:
|
case M:
|
||||||
readIndex += length;
|
readIndex += length;
|
||||||
refIndex += length;
|
refIndex += length;
|
||||||
|
totalRefBases += length;
|
||||||
break;
|
break;
|
||||||
case S:
|
case S:
|
||||||
readIndex += length;
|
readIndex += length;
|
||||||
break;
|
break;
|
||||||
case N:
|
case N:
|
||||||
refIndex += length;
|
refIndex += length;
|
||||||
|
totalRefBases += length;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
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
|
// add the bases before the indel
|
||||||
System.arraycopy(refSeq, 0, alt, 0, refIndex);
|
System.arraycopy(refSeq, 0, alt, 0, refIndex);
|
||||||
int currentPos = refIndex;
|
int currentPos = refIndex;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue