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

Fix SV QNameFinder to handle reads with negative unclipped starts #5864

Merged
merged 1 commit into from
Apr 6, 2019
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 @@ -45,7 +45,8 @@ public Iterator<QNameAndInterval> apply( final GATKRead read ) {
}
if ( intervalsIndex >= intervalsSize ) return noName;
final SVInterval indexedInterval = intervals.get(intervalsIndex);
final SVInterval unclippedReadInterval = new SVInterval(readContigId, read.getUnclippedStart(), read.getUnclippedEnd());
final SVInterval unclippedReadInterval = new SVInterval(readContigId,
Math.max(0, read.getUnclippedStart()), read.getUnclippedEnd());
if ( indexedInterval.isDisjointFrom(unclippedReadInterval) ) return noName;
final SVInterval clippedReadInterval = new SVInterval(readContigId, read.getStart(), read.getEnd());
if (filter.containedInRegionToIgnore(clippedReadInterval, highCoverageSubIntervals)) return noName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,36 @@ public void testHighDepthRegionFiltering() throws Exception {

}

@Test
public void testReadWithNegativeUnclippedStart() throws Exception {
final StructuralVariationDiscoveryArgumentCollection.FindBreakpointEvidenceSparkArgumentCollection params =
new StructuralVariationDiscoveryArgumentCollection.FindBreakpointEvidenceSparkArgumentCollection();
final SAMFileHeader header = ArtificialReadUtils.createArtificialSamHeaderWithGroups(3, 1, 10000000, 1);
final Set<Integer> crossContigIgnoreSet = new HashSet<>();
final ReadMetadata readMetadata = new ReadMetadata(crossContigIgnoreSet, header, LIBRARY_STATISTICS, null, 2L, 2L, 1);
final ArrayList<SVInterval> intervals = new ArrayList<>(2);
SVInterval interval1 = new SVInterval(0, 25, 125);
intervals.add(interval1);
final GATKRead read1 = ArtificialReadUtils.createArtificialRead(header, "read1", 0, 1,
ArtificialReadUtils.createRandomReadBases(151, false),
ArtificialReadUtils.createRandomReadQuals(151),
"50S101M");
read1.setIsReverseStrand(true);
final GATKRead read2 = ArtificialReadUtils.createArtificialRead(header, "read2", 0, 130,
ArtificialReadUtils.createRandomReadBases(151, false),
ArtificialReadUtils.createRandomReadQuals(151),
"40S111M");

final SVIntervalTree<SVInterval> highDepthIntervals = new SVIntervalTree<>();

final QNameFinder qNameFinder = new QNameFinder(readMetadata, intervals, new SVReadFilter(params), highDepthIntervals);

Iterator<QNameAndInterval> read1Result = qNameFinder.apply(read1);
Assert.assertTrue( read1Result.hasNext());

Iterator<QNameAndInterval> read2Result = qNameFinder.apply(read2);
Assert.assertFalse( read2Result.hasNext());

}

}