From 89544c209c0344fbf9aca9f283daa0fa428f9398 Mon Sep 17 00:00:00 2001 From: Mauricio Carneiro Date: Wed, 28 Sep 2011 11:19:17 -0400 Subject: [PATCH 2/4] Fixing contracts changed return type to Pair, changing contracts accordingly. --- .../java/src/org/broadinstitute/sting/utils/sam/ReadUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/java/src/org/broadinstitute/sting/utils/sam/ReadUtils.java b/public/java/src/org/broadinstitute/sting/utils/sam/ReadUtils.java index 5fa410922..14ebbaa6f 100755 --- a/public/java/src/org/broadinstitute/sting/utils/sam/ReadUtils.java +++ b/public/java/src/org/broadinstitute/sting/utils/sam/ReadUtils.java @@ -825,7 +825,7 @@ public class ReadUtils { * @return the read coordinate corresponding to the requested reference coordinate. (see warning!) */ @Requires({"refCoord >= read.getUnclippedStart()", "refCoord <= read.getUnclippedEnd()"}) - @Ensures({"result >= 0", "result < read.getReadLength()"}) + @Ensures({"result.getFirst() >= 0", "result.getFirst() < read.getReadLength()"}) public static Pair getReadCoordinateForReferenceCoordinate(SAMRecord read, int refCoord) { int readBases = 0; int refBases = 0; From 1e32281a15dc773ec41aaf5a17342d37f181fb43 Mon Sep 17 00:00:00 2001 From: Mark DePristo Date: Wed, 28 Sep 2011 11:31:20 -0400 Subject: [PATCH 3/4] Fix to not show -null when missing short name argument --- .../utils/help/GenericDocumentationHandler.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/public/java/src/org/broadinstitute/sting/utils/help/GenericDocumentationHandler.java b/public/java/src/org/broadinstitute/sting/utils/help/GenericDocumentationHandler.java index 7ea77a939..b100b3e1b 100644 --- a/public/java/src/org/broadinstitute/sting/utils/help/GenericDocumentationHandler.java +++ b/public/java/src/org/broadinstitute/sting/utils/help/GenericDocumentationHandler.java @@ -432,11 +432,17 @@ public class GenericDocumentationHandler extends DocumentedGATKFeatureHandler { * Returns a Pair of (main, synonym) names for argument with fullName s1 and * shortName s2. The main is selected to be the longest of the two, provided * it doesn't exceed MAX_DISPLAY_NAME, in which case the shorter is taken. - * @param s1 - * @param s2 - * @return + * + * @param s1 the short argument name without -, or null if not provided + * @param s2 the long argument name without --, or null if not provided + * @return A pair of fully qualified names (with - or --) for the argument. The first + * element is the primary display name while the second (potentially null) is a + * synonymous name. */ Pair displayNames(String s1, String s2) { + s1 = s1 == null ? null : "-" + s1; + s2 = s2 == null ? null : "--" + s2; + if ( s1 == null ) return new Pair(s2, null); if ( s2 == null ) return new Pair(s1, null); @@ -510,7 +516,7 @@ public class GenericDocumentationHandler extends DocumentedGATKFeatureHandler { */ protected Map docForArgument(FieldDoc fieldDoc, ArgumentSource source, ArgumentDefinition def) { Map root = new HashMap(); - Pair names = displayNames("-" + def.shortName, "--" + def.fullName); + Pair names = displayNames(def.shortName, def.fullName); root.put("name", names.getFirst() ); From a5006831d7b52748a77aa86512979d220c9540a7 Mon Sep 17 00:00:00 2001 From: Mark DePristo Date: Wed, 28 Sep 2011 11:35:52 -0400 Subject: [PATCH 4/4] Shows "" not empty space when default string value is "" --- .../sting/utils/help/GenericDocumentationHandler.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/public/java/src/org/broadinstitute/sting/utils/help/GenericDocumentationHandler.java b/public/java/src/org/broadinstitute/sting/utils/help/GenericDocumentationHandler.java index b100b3e1b..20f9eccd3 100644 --- a/public/java/src/org/broadinstitute/sting/utils/help/GenericDocumentationHandler.java +++ b/public/java/src/org/broadinstitute/sting/utils/help/GenericDocumentationHandler.java @@ -325,11 +325,14 @@ public class GenericDocumentationHandler extends DocumentedGATKFeatureHandler { return Arrays.toString((Object[])value); else throw new RuntimeException("Unexpected array type in prettyPrintValue. Value was " + value + " type is " + type); - } else if ( RodBinding.class.isAssignableFrom(value.getClass() ) ) + } else if ( RodBinding.class.isAssignableFrom(value.getClass() ) ) { // annoying special case to handle the UnBound() constructor return "none"; - - return value.toString(); + } else if ( value instanceof String ) { + return value.equals("") ? "\"\"" : value; + } else { + return value.toString(); + } } /**