From 8d43ec3d7ece7fe84ef4a10479192d4c1e61ecda Mon Sep 17 00:00:00 2001 From: aaron Date: Mon, 11 May 2009 01:39:25 +0000 Subject: [PATCH] a fix for a situation where a chromosome on the reference file contains no reads, and doesn't align to the bam file. This came up using reference 18, which has chomosomes like chr1_random that aren't in all BAM files. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@649 348d0f76-0448-11de-a6fe-93d51630548a --- .../gatk/dataSources/simpleDataSources/SAMDataSource.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/java/src/org/broadinstitute/sting/gatk/dataSources/simpleDataSources/SAMDataSource.java b/java/src/org/broadinstitute/sting/gatk/dataSources/simpleDataSources/SAMDataSource.java index bf7f2622e..cd72550af 100755 --- a/java/src/org/broadinstitute/sting/gatk/dataSources/simpleDataSources/SAMDataSource.java +++ b/java/src/org/broadinstitute/sting/gatk/dataSources/simpleDataSources/SAMDataSource.java @@ -285,11 +285,13 @@ public class SAMDataSource implements SimpleDataSource { iter.queryContained(lastReadPos.getContig(), (int) lastReadPos.getStop(), -1); // move the number of reads we read from the last pos + boolean atLeastOneReadSeen = false; // we have a problem where some chomesomes don't have a single read (i.e. the chrN_random chrom.) while (iter.hasNext() && this.readsAtLastPos > 0) { iter.next(); --readsAtLastPos; + atLeastOneReadSeen = true; } - if (readsAtLastPos != 0) { + if (readsAtLastPos != 0 && atLeastOneReadSeen) { throw new SimpleDataSourceLoadException("Seek problem: reads at last position count != 0"); }