From 647a3676806be14335468ab3ab56ff7017d3054a Mon Sep 17 00:00:00 2001 From: aaron Date: Fri, 21 Aug 2009 14:40:57 +0000 Subject: [PATCH] Made the size zero interval file checker emit a warnUser if we're not in unsafe mode. Also changed the default logger level from error to warn. Does anyone object? It makes sense for users to always get their warn user statements in the default logging level. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@1451 348d0f76-0448-11de-a6fe-93d51630548a --- .../sting/utils/GenomeLocParser.java | 29 ++++++++++++++----- .../utils/cmdLine/CommandLineProgram.java | 4 +-- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/java/src/org/broadinstitute/sting/utils/GenomeLocParser.java b/java/src/org/broadinstitute/sting/utils/GenomeLocParser.java index f6af8b82d..03f5cf440 100644 --- a/java/src/org/broadinstitute/sting/utils/GenomeLocParser.java +++ b/java/src/org/broadinstitute/sting/utils/GenomeLocParser.java @@ -7,6 +7,7 @@ import net.sf.samtools.SAMRecord; import net.sf.samtools.SAMSequenceDictionary; import net.sf.samtools.SAMSequenceRecord; import org.apache.log4j.Logger; +import org.broadinstitute.sting.gatk.GenomeAnalysisEngine; import java.io.File; import java.util.ArrayList; @@ -322,11 +323,19 @@ public class GenomeLocParser { List ret = null; try { File inputFile = new File(file_name); - + // sometimes we see an empty file passed as a parameter, if so return an empty list - if (inputFile.exists() && inputFile.length() < 1) return new ArrayList(); + if (inputFile.exists() && inputFile.length() < 1) { + if (GenomeAnalysisEngine.instance.getArguments().unsafe) + return new ArrayList(); + else { + Utils.warnUser("The interval file " + file_name + " is empty. The GATK will continue processing but you " + + "may want to fix (or exclude) this file."); + return new ArrayList(); + } + } IntervalList il = IntervalList.fromFile(inputFile); - + // iterate through the list of merged intervals and add then as GenomeLocs ret = new ArrayList(); for (Interval interval : il.getUniqueIntervals()) { @@ -494,13 +503,14 @@ public class GenomeLocParser { checkSetup(); int index = -1; - if ( ( index = contigInfo.getSequenceIndex(contig) ) < 0 ) { + if ((index = contigInfo.getSequenceIndex(contig)) < 0) { throw new StingException("Contig name ( " + contig + " ) not in the set sequence dictionary."); } return verifyGenomeLoc(new GenomeLoc(contig, index, loc.start, loc.getStop())); } -/** Sets contig index. UNSAFE since it 1) does NOT update contig name; 2) does not validate the index + /** + * Sets contig index. UNSAFE since it 1) does NOT update contig name; 2) does not validate the index * * @param contig */ @@ -513,7 +523,6 @@ public class GenomeLocParser { } - /** * create a new genome loc from an existing loc, with a new start position * @@ -555,7 +564,9 @@ public class GenomeLocParser { /** * return a new genome loc, with an incremented position + * * @param loc the old location + * * @return a new genome loc */ public static GenomeLoc incPos(GenomeLoc loc) { @@ -564,8 +575,10 @@ public class GenomeLocParser { /** * return a new genome loc, with an incremented position + * * @param loc the old location - * @param by how much to move the start and stop by + * @param by how much to move the start and stop by + * * @return a new genome loc */ public static GenomeLoc incPos(GenomeLoc loc, long by) { @@ -574,7 +587,9 @@ public class GenomeLocParser { /** * create a new genome loc with an incremented position + * * @param loc the location + * * @return a new genome loc */ public static GenomeLoc nextLoc(GenomeLoc loc) { diff --git a/java/src/org/broadinstitute/sting/utils/cmdLine/CommandLineProgram.java b/java/src/org/broadinstitute/sting/utils/cmdLine/CommandLineProgram.java index 9af1e50fd..e309adc9b 100644 --- a/java/src/org/broadinstitute/sting/utils/cmdLine/CommandLineProgram.java +++ b/java/src/org/broadinstitute/sting/utils/cmdLine/CommandLineProgram.java @@ -35,7 +35,7 @@ public abstract class CommandLineProgram { /** * our log, which we want to capture anything from org.broadinstitute.sting */ - private static Logger logger = Logger.getRootLogger();// .getLogger(CommandLineProgram.class); + private static Logger logger = Logger.getRootLogger(); /** * the default log level @@ -303,7 +303,7 @@ public abstract class CommandLineProgram { */ private void setupLoggerLevel() { - Level par = Level.ERROR; + Level par = Level.WARN; if (logging_level.equals("DEBUG")) { par = Level.DEBUG; }