Fix for Ryan: don't pull reference sequence for the portions of reads that extend beyond the contig boundaries
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@4551 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
9f76aed515
commit
181f901126
|
|
@ -453,9 +453,9 @@ public class UnifiedGenotyperEngine {
|
||||||
bitset.set(i);
|
bitset.set(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if a read is too long for the reference context, extend the context
|
// if a read is too long for the reference context, extend the context (being sure not to extend past the end of the chromosome)
|
||||||
if ( record.getAlignmentEnd() > refContext.getWindow().getStop() ) {
|
if ( record.getAlignmentEnd() > refContext.getWindow().getStop() ) {
|
||||||
GenomeLoc window = GenomeLocParser.createGenomeLoc(refContext.getLocus().getContig(), refContext.getWindow().getStart(), record.getAlignmentEnd());
|
GenomeLoc window = GenomeLocParser.createGenomeLoc(refContext.getLocus().getContig(), refContext.getWindow().getStart(), Math.min(record.getAlignmentEnd(), referenceReader.getSequenceDictionary().getSequence(refContext.getLocus().getContig()).getSequenceLength()));
|
||||||
byte[] bases = referenceReader.getSubsequenceAt(window.getContig(), window.getStart(), window.getStop()).getBases();
|
byte[] bases = referenceReader.getSubsequenceAt(window.getContig(), window.getStart(), window.getStop()).getBases();
|
||||||
StringUtil.toUpperCase(bases);
|
StringUtil.toUpperCase(bases);
|
||||||
refContext = new ReferenceContext(refContext.getLocus(), window, bases);
|
refContext = new ReferenceContext(refContext.getLocus(), window, bases);
|
||||||
|
|
|
||||||
|
|
@ -285,9 +285,9 @@ public class AlignmentUtils {
|
||||||
if ( currentReadPos++ < readStartPos )
|
if ( currentReadPos++ < readStartPos )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ( refIndex >= refBases.length ) {
|
// this is possible if reads extend beyond the contig end
|
||||||
throw new IllegalStateException("When calculating mismatches, we somehow don't have enough trailing reference context for read " + read.getReadName() + " at position " + ref.getLocus());
|
if ( refIndex >= refBases.length )
|
||||||
}
|
break;
|
||||||
|
|
||||||
byte refChr = refBases[refIndex];
|
byte refChr = refBases[refIndex];
|
||||||
byte readChr = readBases[readIndex];
|
byte readChr = readBases[readIndex];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue