diff --git a/java/src/org/broadinstitute/sting/gatk/refdata/ReferenceOrderedData.java b/java/src/org/broadinstitute/sting/gatk/refdata/ReferenceOrderedData.java index 10a90684f..edfed5e50 100644 --- a/java/src/org/broadinstitute/sting/gatk/refdata/ReferenceOrderedData.java +++ b/java/src/org/broadinstitute/sting/gatk/refdata/ReferenceOrderedData.java @@ -284,7 +284,7 @@ public class ReferenceOrderedData implements } catch( MalformedGenomeLocException ex ) { if( firstFailure ) { - Utils.warnUser("Failed to parse contig on line '" + line + "'. Skipping ahead to the next recognized GenomeLoc."); + Utils.warnUser("Failed to parse contig on line '" + line + "'. The reason given was: " + ex.getMessage() + " Skipping ahead to the next recognized GenomeLoc. "); firstFailure = false; } if( !parser.hasNext() ) diff --git a/java/src/org/broadinstitute/sting/utils/GenomeLoc.java b/java/src/org/broadinstitute/sting/utils/GenomeLoc.java index b872f9da7..e6b0a39d1 100644 --- a/java/src/org/broadinstitute/sting/utils/GenomeLoc.java +++ b/java/src/org/broadinstitute/sting/utils/GenomeLoc.java @@ -137,7 +137,7 @@ public class GenomeLoc implements Comparable, Cloneable { */ public static GenomeLoc parseGenomeLoc( final String contig, long start, long stop ) { if( !isContigValid(contig) ) - throw new MalformedGenomeLocException("Contig " + contig + " is not within installed in the GATK sequence dictionary derived from the reference."); + throw new MalformedGenomeLocException("Contig " + contig + " does not match any contig in the GATK sequence dictionary derived from the reference."); return new GenomeLoc(contig,start,stop); } @@ -198,7 +198,7 @@ public class GenomeLoc implements Comparable, Cloneable { } if( !isContigValid(contig) ) - throw new MalformedGenomeLocException("Contig " + contig + " is not within installed in the GATK sequence dictionary derived from the reference."); + throw new MalformedGenomeLocException("Contig " + contig + " does not match any contig in the GATK sequence dictionary derived from the reference."); GenomeLoc loc = parseGenomeLoc(contig,start,stop); // System.out.printf(" => Parsed location '%s' into %s%n", str, loc); diff --git a/java/src/org/broadinstitute/sting/utils/Utils.java b/java/src/org/broadinstitute/sting/utils/Utils.java index a47ce0ab3..933a681c0 100755 --- a/java/src/org/broadinstitute/sting/utils/Utils.java +++ b/java/src/org/broadinstitute/sting/utils/Utils.java @@ -29,7 +29,7 @@ public class Utils { logger.warn(String.format("********************************************************************************")); logger.warn(String.format("* WARNING:")); logger.warn(String.format("*")); - logger.warn(String.format("* %s", msg)); + prettyPrintWarningMessage(msg); logger.warn(String.format("********************************************************************************")); } @@ -43,6 +43,22 @@ public class Utils { throw new RuntimeException(msg); } + /** + * pretty print the warning message supplied + * @param message the message + */ + private static void prettyPrintWarningMessage(String message) { + StringBuilder builder = new StringBuilder(message); + while (builder.length() > 70) { + int space = builder.lastIndexOf(" ", 70); + if (space <= 0) space = 70; + logger.warn(String.format("* %s", builder.substring(0,space))); + builder.delete(0,space + 1); + } + logger.warn(String.format("* %s", builder)); + } + + public static SAMFileWriter createSAMFileWriterWithCompression(SAMFileHeader header, boolean presorted, String file, int compression) { if (file.endsWith(".bam")) return new SAMFileWriterFactory().makeBAMWriter(header, presorted, new File(file), compression);