Fix for reads that are all insertions (e.g. 50I) and causing the IndelRealigner to error out.
This commit is contained in:
parent
69eaf7c82d
commit
32a96e3ab3
|
|
@ -81,7 +81,7 @@ class ReadBin implements HasGenomeLocation {
|
|||
final int readStart = read.getSoftStart();
|
||||
final int readStop = read.getSoftEnd();
|
||||
if ( loc == null )
|
||||
loc = parser.createGenomeLoc(read.getReferenceName(), readStart, readStop);
|
||||
loc = parser.createGenomeLoc(read.getReferenceName(), readStart, Math.max(readStop, readStart)); // in case it's all an insertion
|
||||
else if ( readStop > loc.getStop() )
|
||||
loc = parser.createGenomeLoc(loc.getContig(), loc.getStart(), readStop);
|
||||
|
||||
|
|
|
|||
|
|
@ -81,6 +81,7 @@ public class ReadBinUnitTest {
|
|||
{"20S80M", 80},
|
||||
{"80M20S", 1},
|
||||
{"20S60M20S", 50},
|
||||
{"50I", 60},
|
||||
{"100M", 500}
|
||||
};
|
||||
}
|
||||
|
|
@ -94,7 +95,7 @@ public class ReadBinUnitTest {
|
|||
@Test(enabled = true, dataProvider = "reads")
|
||||
public void testAddingReads(String cigarString, int alignmentStart) {
|
||||
final GATKSAMRecord read = createReadAndAddToBin(cigarString, alignmentStart);
|
||||
final GenomeLoc readLoc = parser.createGenomeLoc(read.getReferenceName(), read.getReferenceIndex(), read.getSoftStart(), read.getSoftEnd());
|
||||
final GenomeLoc readLoc = parser.createGenomeLoc(read.getReferenceName(), read.getReferenceIndex(), read.getSoftStart(), Math.max(read.getSoftStart(), read.getSoftEnd()));
|
||||
Assert.assertEquals(readBin.getLocation(), readLoc);
|
||||
readBin.clear();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue