Source:
public boolean[] findOpticalDuplicates(final List<? extends PhysicalLocation> list, final PhysicalLocation keeper) { if (list.size() < 2) return new boolean[list.size()]; final int length = list.size(); final boolean[] opticalDuplicateFlags = new boolean[length]; final int distance = this.opticalDuplicatePixelDistance; final PhysicalLocation actualKeeper = keeperOrNull(list, keeper); final Log log = Log.getInstance(OpticalDuplicateFinder.class); ProgressLogger progressLogger = new ProgressLogger(log, 10000, "examined", "ReadEnds to keeper"); if(length > 1000) { log.info("Large duplicate set. size = " + length); log.debug("About to compare to keeper:" + actualKeeper); } if (actualKeeper != null) { for (int i = 0; i < length; ++i) { final PhysicalLocation other = list.get(i); opticalDuplicateFlags[i] = closeEnough(actualKeeper, other, distance); if (length > 1000) progressLogger.record(String.format("%d", other.getReadGroup()), other.getX()); } } if (length > 1000) { log.debug("Done with comparing to keeper, now the rest."); progressLogger = new ProgressLogger(log, 1000, "examined", "ReadEnds to others"); } for (int i = 0; i < length; ++i) { final PhysicalLocation lhs = list.get(i); if (lhs == actualKeeper) continue; if (length > 1000) progressLogger.record(String.format("%d", lhs.getReadGroup()), lhs.getX()); for (int j = i + 1; j < length; ++j) { final PhysicalLocation rhs = list.get(j); if (rhs == actualKeeper) continue; if (opticalDuplicateFlags[i] && opticalDuplicateFlags[j]) continue; if (closeEnough(lhs, rhs, distance)) { final int index = opticalDuplicateFlags[j] ? i : j; opticalDuplicateFlags[index] = true; } } } return opticalDuplicateFlags; }

Target:
public boolean[] findOpticalDuplicates(final List<? extends PhysicalLocation> list, final PhysicalLocation keeper) { if (list.size() < 2) return new boolean[list.size()]; final int length = list.size(); final boolean[] opticalDuplicateFlags = new boolean[length]; final int distance = this.opticalDuplicatePixelDistance; final PhysicalLocation actualKeeper = keeperOrNull(list, keeper); final Log log; final ProgressLogger progressLoggerForKeeper, progressLoggerForRest; final boolean logProgress = length > bigDuplicateSetSize; if (logProgress) { log = Log.getInstance(OpticalDuplicateFinder.class); progressLoggerForKeeper = new ProgressLogger(log, 10000, "compared", "ReadEnds to keeper"); progressLoggerForRest = new ProgressLogger(log, 1000, "compared", "ReadEnds to others"); log.info("Large duplicate set. size = " + length); log.debug("About to compare to keeper:" + actualKeeper); } else { log = null; progressLoggerForKeeper = null; progressLoggerForRest = null; } if (actualKeeper != null) { for (int i = 0; i < length; ++i) { final PhysicalLocation other = list.get(i); opticalDuplicateFlags[i] = closeEnough(actualKeeper, other, distance); if (logProgress) progressLoggerForKeeper.record(String.format("%d", other.getReadGroup()), other.getX()); } } if (logProgress) log.debug("Done with comparing to keeper, now the rest."); for (int i = 0; i < length; ++i) { final PhysicalLocation lhs = list.get(i); if (lhs == actualKeeper) continue; if (logProgress) progressLoggerForRest.record(String.format("%d", lhs.getReadGroup()), lhs.getX()); for (int j = i + 1; j < length; ++j) { final PhysicalLocation rhs = list.get(j); if (rhs == actualKeeper) continue; if (opticalDuplicateFlags[i] && opticalDuplicateFlags[j]) continue; if (closeEnough(lhs, rhs, distance)) { final int index = opticalDuplicateFlags[j] ? i : j; opticalDuplicateFlags[index] = true; } } } return opticalDuplicateFlags; }