From 39dcd4f11f4663953def5579cd2668f09246e53d Mon Sep 17 00:00:00 2001 From: asivache Date: Wed, 10 Jun 2009 19:53:50 +0000 Subject: [PATCH] an attempt to bail out when unmapped reads are reached at the end of the file(s). still testing... git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@973 348d0f76-0448-11de-a6fe-93d51630548a --- .../gatk/walkers/indels/IndelGenotyperWalker.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/java/src/org/broadinstitute/sting/playground/gatk/walkers/indels/IndelGenotyperWalker.java b/java/src/org/broadinstitute/sting/playground/gatk/walkers/indels/IndelGenotyperWalker.java index c765e799f..b87f13c2a 100644 --- a/java/src/org/broadinstitute/sting/playground/gatk/walkers/indels/IndelGenotyperWalker.java +++ b/java/src/org/broadinstitute/sting/playground/gatk/walkers/indels/IndelGenotyperWalker.java @@ -77,6 +77,12 @@ public class IndelGenotyperWalker extends ReadWalker { @Override public Integer map(char[] ref, SAMRecord read) { + if ( read.getReadUnmappedFlag() && read.getReferenceIndex() == SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX && + read.getAlignmentStart() == SAMRecord.NO_ALIGNMENT_START ) { + System.out.println("I think I reached unmapped reads at the end of the file(s) and I am done..."); + return -1; + } + if ( read.getReadUnmappedFlag() || read.getDuplicateReadFlag() || read.getNotPrimaryAlignmentFlag() || @@ -264,6 +270,10 @@ public class IndelGenotyperWalker extends ReadWalker { @Override public Integer reduce(Integer value, Integer sum) { + if ( value == -1 ) { + onTraversalDone(sum); + System.exit(1); + } sum += value; return sum; }