@@ -289,6 +289,26 @@ class PileupBuilderTest extends UnitSpec {
289
289
piler.safelyClose()
290
290
}
291
291
292
+ it should " not filter out single-end records when we are removing records outside the insert of FR pairs" in {
293
+ val builder = new SamBuilder (readLength = ReadLength , sd = Some (TestSequenceDictionary ), sort = Some (Coordinate ))
294
+
295
+ builder.addFrag(name = " q1" , contig = Chr1Index , start = 100 )
296
+
297
+ val source = builder.toSource
298
+ val piler = PileupBuilder (
299
+ source,
300
+ accessPattern = accessPattern,
301
+ mappedPairsOnly = false ,
302
+ includeMapPositionsOutsideFrInsert = true
303
+ )
304
+
305
+ piler.pileup(Chr1 , 100 ).depth shouldBe 1
306
+ piler.pileup(Chr1 , 100 + ReadLength - 1 ).depth shouldBe 1
307
+
308
+ source.safelyClose()
309
+ piler.safelyClose()
310
+ }
311
+
292
312
it should " filter out records where a position is outside the insert for an FR pair" in {
293
313
val builder = new SamBuilder (readLength = ReadLength , sd = Some (TestSequenceDictionary ), sort = Some (Coordinate ))
294
314
@@ -323,6 +343,24 @@ class PileupBuilderTest extends UnitSpec {
323
343
piler.safelyClose()
324
344
}
325
345
346
+ it should " exclude records that appear to be in an FR pair but are on different chromosomes" in {
347
+ val builder = new SamBuilder (readLength = ReadLength , sd = Some (TestSequenceDictionary ), sort = Some (Coordinate ))
348
+
349
+ builder.addPair(name = " q1" , contig = Chr1Index , contig2 = Some (Chr2Index ), start1 = 100 , start2 = 125 )
350
+
351
+ val source = builder.toSource
352
+ val piler = PileupBuilder (source, accessPattern = accessPattern, includeMapPositionsOutsideFrInsert = false )
353
+
354
+ piler.pileup(Chr1 , 100 ).depth shouldBe 0
355
+ piler.pileup(Chr1 , 100 + ReadLength - 1 ).depth shouldBe 0
356
+
357
+ piler.pileup(Chr2 , 125 ).depth shouldBe 0
358
+ piler.pileup(Chr2 , 125 + ReadLength - 1 ).depth shouldBe 0
359
+
360
+ source.safelyClose()
361
+ piler.safelyClose()
362
+ }
363
+
326
364
it should " not filter out records where a position is outside what might look like an 'insert' for a non-FR pair" in {
327
365
val builder = new SamBuilder (readLength = ReadLength , sd = Some (TestSequenceDictionary ), sort = Some (Coordinate ))
328
366
0 commit comments