Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed exception in SplitNCigarReads for non-reference consuming reads #5298

Merged
merged 1 commit into from
Oct 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,11 @@ public SplitRead(final GATKRead read) {

public void setRead(final GATKRead read) {
this.read = read;
if ( ! read.isUnmapped() ) {
unclippedLoc = genomeLocParser.createGenomeLoc(read.getContig(), read.getSoftStart(), read.getSoftEnd());
int softStart = read.getSoftStart();
int softEnd = read.getSoftEnd();
// Don't assign an unclipped loc if the read if it doesn't consume reference bases
if ( ! read.isUnmapped() && softStart < softEnd) {
unclippedLoc = genomeLocParser.createGenomeLoc(read.getContig(), softStart, softEnd);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,4 +285,19 @@ public void testReadWithDeletionsWindowSpanning() {
// Assert that no splitting happened (and no array exception) by asserting a copy of the read was not placed in split.read
Assert.assertTrue(split.read==read);
}

@Test
public void testReadWithOnlyInsertionInsideSpan() {
final OverhangFixingManager manager = new OverhangFixingManager(getHG19Header(), null, hg19GenomeLocParser, hg19ReferenceReader, 100, 100, 30, false, true);
// Create a splice that is going to overlap into the deletion of our read, forcing us to check for mismatches to the reference
OverhangFixingManager.Splice splice = manager.addSplicePosition("1",6816, 11247);
// Create a read that is entirely an insertion inside of the splice to demonstrate it is handled without creating an invalid loc
GATKRead read = ArtificialReadUtils.createArtificialRead(hg19Header, "read1", 0, 11244, new byte[100], new byte[100], "100I");
OverhangFixingManager.SplitRead split = manager.getSplitRead(read);
manager.fixSplit(split,splice);
// Assert that no splitting happened (and no array exception) by asserting a copy of the read was not placed in split.read
Assert.assertTrue(split.read==read);
}


}