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
This commit is contained in:
aaron 2009-08-21 14:40:57 +00:00
parent df9133c90b
commit 647a367680
2 changed files with 24 additions and 9 deletions

View File

@ -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<GenomeLoc> 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<GenomeLoc>();
if (inputFile.exists() && inputFile.length() < 1) {
if (GenomeAnalysisEngine.instance.getArguments().unsafe)
return new ArrayList<GenomeLoc>();
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<GenomeLoc>();
}
}
IntervalList il = IntervalList.fromFile(inputFile);
// iterate through the list of merged intervals and add then as GenomeLocs
ret = new ArrayList<GenomeLoc>();
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) {

View File

@ -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;
}