From 8e6845806ad31bb1f7b42714828d27eee6c20377 Mon Sep 17 00:00:00 2001 From: Mark DePristo Date: Wed, 5 Oct 2011 21:26:21 -0700 Subject: [PATCH] Allowing empty samples list in LIBS -- Right now we cannot process BAM files without read groups because we enforce the samples list to not be empty when there's a SAM record. Now if there are reads and there are no samples we add the "null" sample so that LIBS walks the reads properly --- .../sting/gatk/iterators/LocusIteratorByState.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/public/java/src/org/broadinstitute/sting/gatk/iterators/LocusIteratorByState.java b/public/java/src/org/broadinstitute/sting/gatk/iterators/LocusIteratorByState.java index 896d6e3a2..eb5b51b33 100755 --- a/public/java/src/org/broadinstitute/sting/gatk/iterators/LocusIteratorByState.java +++ b/public/java/src/org/broadinstitute/sting/gatk/iterators/LocusIteratorByState.java @@ -282,8 +282,12 @@ public class LocusIteratorByState extends LocusIterator { // currently the GATK expects this LocusIteratorByState to accept empty sample lists, when // there's no read data. So we need to throw this error only when samIterator.hasNext() is true - if ( this.samples.isEmpty() && samIterator.hasNext() ) - throw new IllegalArgumentException("samples list must not be empty"); + if ( this.samples.isEmpty() && samIterator.hasNext() ) { + // actually we cannot process BAMs without read groups unless we tolerate empty + // sample lists. In the empty case we need to add the null element to the samples + this.samples.add(null); + //throw new IllegalArgumentException("samples list must not be empty"); + } } /**