diff --git a/src/main/java/picard/illumina/MarkIlluminaAdapters.java b/src/main/java/picard/illumina/MarkIlluminaAdapters.java index 3c8449f332..ea137702db 100644 --- a/src/main/java/picard/illumina/MarkIlluminaAdapters.java +++ b/src/main/java/picard/illumina/MarkIlluminaAdapters.java @@ -140,13 +140,17 @@ public class MarkIlluminaAdapters extends CommandLineProgram { @Override protected String[] customCommandLineValidation() { - if ((FIVE_PRIME_ADAPTER != null && THREE_PRIME_ADAPTER == null) || (THREE_PRIME_ADAPTER != null && FIVE_PRIME_ADAPTER == null)) { + if (hasEitherAdapter()) { return new String[]{"THREE_PRIME_ADAPTER and FIVE_PRIME_ADAPTER must either both be null or both be set."}; } else { return null; } } + private boolean hasEitherAdapter() { + return (FIVE_PRIME_ADAPTER != null && THREE_PRIME_ADAPTER == null) || (THREE_PRIME_ADAPTER != null && FIVE_PRIME_ADAPTER == null); + } + @Override protected int doWork() { IOUtil.assertFileIsReadable(INPUT); @@ -167,7 +171,7 @@ protected int doWork() { { final List tmp = new ArrayList(); tmp.addAll(ADAPTERS); - if (FIVE_PRIME_ADAPTER != null && THREE_PRIME_ADAPTER != null) { + if (hasBothAdapters()) { tmp.add(new CustomAdapterPair(FIVE_PRIME_ADAPTER, THREE_PRIME_ADAPTER)); } adapters = tmp.toArray(new AdapterPair[tmp.size()]); @@ -246,4 +250,8 @@ protected int doWork() { CloserUtil.close(in); return 0; } + + private boolean hasBothAdapters(){ + return FIVE_PRIME_ADAPTER != null && THREE_PRIME_ADAPTER != null; + } }