@Test public void testDerivePairs() throws Exception { final List<CanvasMatches> multipleGroupPairs = new ArrayList<>(); multipleGroupPairs.add(buildTestMatches(1.0, 2.0, 0, new int[] {21, 22, 23, 24, 25, 81, 82, 83, 84, 85})); multipleGroupPairs.add(buildTestMatches(2.0, 3.0, 0, new int[] {11, 12, 13, 14, 15})); multipleGroupPairs.add(buildTestMatches(2.0, 3.0, 1, new int[] {91, 92, 93, 94, 95})); multipleGroupPairs.add(buildTestMatches(2.0, 4.0, 0, new int[] {7, 8})); multipleGroupPairs.add(buildTestMatches(2.0, 4.0, 1, new int[] {18, 19})); multipleGroupPairs.add(buildTestMatches(2.0, 4.0, 2, new int[] {87, 88})); multipleGroupPairs.add(buildTestMatches(2.0, 4.0, 3, new int[] {98, 99})); final DerivedMatchGroup derivedMatchGroup = new DerivedMatchGroup("2.0", multipleGroupPairs); final List<CanvasMatches> derivedPairs = derivedMatchGroup.getDerivedPairs(); Assert.assertEquals("invalid number of derived match pairs", 10, derivedPairs.size()); }
private void derivePairs(final Collection<CanvasMatches> multiConsensusPairs) { String largestOutsideGroup = null; int largestOutsideGroupPairCount = 0; int originalTotalMatchPairCount = 0; final Map<String, List<CanvasMatches>> outsideGroupToPairs = new LinkedHashMap<>(); List<CanvasMatches> pairList; String outsideGroup; for (final CanvasMatches pair : multiConsensusPairs) { if (groupId.equals(pair.getpGroupId())) { outsideGroup = pair.getqGroupId(); } else if (groupId.equals(pair.getqGroupId())) { outsideGroup = pair.getpGroupId(); } else { continue; } pairList = outsideGroupToPairs.get(outsideGroup); if (pairList == null) { pairList = new ArrayList<>(); outsideGroupToPairs.put(outsideGroup, pairList); } pairList.add(pair); if (pairList.size() > largestOutsideGroupPairCount) { largestOutsideGroupPairCount = pairList.size(); largestOutsideGroup = outsideGroup; } originalTotalMatchPairCount++; } final List<CanvasMatches> largestSetPairs = outsideGroupToPairs.get(largestOutsideGroup); LOG.info("derivePairs: processing {} total pairs, largest set has {} pairs", originalTotalMatchPairCount, largestSetPairs.size()); final RealPointSampleList<ARGBType> largestSetIndexSamples = new RealPointSampleList<>(2); final List<String> largestSetCanvasIds = new ArrayList<>(); buildSamplesForLargestSet(largestSetPairs, largestSetIndexSamples, largestSetCanvasIds); derivedPairs.addAll(largestSetPairs); for (final String outGroup : outsideGroupToPairs.keySet()) { if (! outGroup.equals(largestOutsideGroup)) { final List<CanvasMatches> outsidePairs = outsideGroupToPairs.get(outGroup); for (final CanvasMatches outsidePair : outsidePairs) { final List<RealPoint> originalPoints = getPointList(outsidePair); final List<Integer> setIndexes = getSetIndexesForPoints(largestSetIndexSamples, originalPoints); final List<CanvasMatches> splitMatches = splitMatches(outsidePair, setIndexes, largestSetCanvasIds); derivedPairs.addAll(splitMatches); } } } LOG.info("derivePairs: exit, derived {} pairs", derivedPairs.size()); }
DerivedMatchGroup { private void derivePairs(final Collection<CanvasMatches> multiConsensusPairs) { String largestOutsideGroup = null; int largestOutsideGroupPairCount = 0; int originalTotalMatchPairCount = 0; final Map<String, List<CanvasMatches>> outsideGroupToPairs = new LinkedHashMap<>(); List<CanvasMatches> pairList; String outsideGroup; for (final CanvasMatches pair : multiConsensusPairs) { if (groupId.equals(pair.getpGroupId())) { outsideGroup = pair.getqGroupId(); } else if (groupId.equals(pair.getqGroupId())) { outsideGroup = pair.getpGroupId(); } else { continue; } pairList = outsideGroupToPairs.get(outsideGroup); if (pairList == null) { pairList = new ArrayList<>(); outsideGroupToPairs.put(outsideGroup, pairList); } pairList.add(pair); if (pairList.size() > largestOutsideGroupPairCount) { largestOutsideGroupPairCount = pairList.size(); largestOutsideGroup = outsideGroup; } originalTotalMatchPairCount++; } final List<CanvasMatches> largestSetPairs = outsideGroupToPairs.get(largestOutsideGroup); LOG.info("derivePairs: processing {} total pairs, largest set has {} pairs", originalTotalMatchPairCount, largestSetPairs.size()); final RealPointSampleList<ARGBType> largestSetIndexSamples = new RealPointSampleList<>(2); final List<String> largestSetCanvasIds = new ArrayList<>(); buildSamplesForLargestSet(largestSetPairs, largestSetIndexSamples, largestSetCanvasIds); derivedPairs.addAll(largestSetPairs); for (final String outGroup : outsideGroupToPairs.keySet()) { if (! outGroup.equals(largestOutsideGroup)) { final List<CanvasMatches> outsidePairs = outsideGroupToPairs.get(outGroup); for (final CanvasMatches outsidePair : outsidePairs) { final List<RealPoint> originalPoints = getPointList(outsidePair); final List<Integer> setIndexes = getSetIndexesForPoints(largestSetIndexSamples, originalPoints); final List<CanvasMatches> splitMatches = splitMatches(outsidePair, setIndexes, largestSetCanvasIds); derivedPairs.addAll(splitMatches); } } } LOG.info("derivePairs: exit, derived {} pairs", derivedPairs.size()); } }
DerivedMatchGroup { private void derivePairs(final Collection<CanvasMatches> multiConsensusPairs) { String largestOutsideGroup = null; int largestOutsideGroupPairCount = 0; int originalTotalMatchPairCount = 0; final Map<String, List<CanvasMatches>> outsideGroupToPairs = new LinkedHashMap<>(); List<CanvasMatches> pairList; String outsideGroup; for (final CanvasMatches pair : multiConsensusPairs) { if (groupId.equals(pair.getpGroupId())) { outsideGroup = pair.getqGroupId(); } else if (groupId.equals(pair.getqGroupId())) { outsideGroup = pair.getpGroupId(); } else { continue; } pairList = outsideGroupToPairs.get(outsideGroup); if (pairList == null) { pairList = new ArrayList<>(); outsideGroupToPairs.put(outsideGroup, pairList); } pairList.add(pair); if (pairList.size() > largestOutsideGroupPairCount) { largestOutsideGroupPairCount = pairList.size(); largestOutsideGroup = outsideGroup; } originalTotalMatchPairCount++; } final List<CanvasMatches> largestSetPairs = outsideGroupToPairs.get(largestOutsideGroup); LOG.info("derivePairs: processing {} total pairs, largest set has {} pairs", originalTotalMatchPairCount, largestSetPairs.size()); final RealPointSampleList<ARGBType> largestSetIndexSamples = new RealPointSampleList<>(2); final List<String> largestSetCanvasIds = new ArrayList<>(); buildSamplesForLargestSet(largestSetPairs, largestSetIndexSamples, largestSetCanvasIds); derivedPairs.addAll(largestSetPairs); for (final String outGroup : outsideGroupToPairs.keySet()) { if (! outGroup.equals(largestOutsideGroup)) { final List<CanvasMatches> outsidePairs = outsideGroupToPairs.get(outGroup); for (final CanvasMatches outsidePair : outsidePairs) { final List<RealPoint> originalPoints = getPointList(outsidePair); final List<Integer> setIndexes = getSetIndexesForPoints(largestSetIndexSamples, originalPoints); final List<CanvasMatches> splitMatches = splitMatches(outsidePair, setIndexes, largestSetCanvasIds); derivedPairs.addAll(splitMatches); } } } LOG.info("derivePairs: exit, derived {} pairs", derivedPairs.size()); } DerivedMatchGroup(final String groupId,
                             final Collection<CanvasMatches> multiConsensusPairs); }
DerivedMatchGroup { private void derivePairs(final Collection<CanvasMatches> multiConsensusPairs) { String largestOutsideGroup = null; int largestOutsideGroupPairCount = 0; int originalTotalMatchPairCount = 0; final Map<String, List<CanvasMatches>> outsideGroupToPairs = new LinkedHashMap<>(); List<CanvasMatches> pairList; String outsideGroup; for (final CanvasMatches pair : multiConsensusPairs) { if (groupId.equals(pair.getpGroupId())) { outsideGroup = pair.getqGroupId(); } else if (groupId.equals(pair.getqGroupId())) { outsideGroup = pair.getpGroupId(); } else { continue; } pairList = outsideGroupToPairs.get(outsideGroup); if (pairList == null) { pairList = new ArrayList<>(); outsideGroupToPairs.put(outsideGroup, pairList); } pairList.add(pair); if (pairList.size() > largestOutsideGroupPairCount) { largestOutsideGroupPairCount = pairList.size(); largestOutsideGroup = outsideGroup; } originalTotalMatchPairCount++; } final List<CanvasMatches> largestSetPairs = outsideGroupToPairs.get(largestOutsideGroup); LOG.info("derivePairs: processing {} total pairs, largest set has {} pairs", originalTotalMatchPairCount, largestSetPairs.size()); final RealPointSampleList<ARGBType> largestSetIndexSamples = new RealPointSampleList<>(2); final List<String> largestSetCanvasIds = new ArrayList<>(); buildSamplesForLargestSet(largestSetPairs, largestSetIndexSamples, largestSetCanvasIds); derivedPairs.addAll(largestSetPairs); for (final String outGroup : outsideGroupToPairs.keySet()) { if (! outGroup.equals(largestOutsideGroup)) { final List<CanvasMatches> outsidePairs = outsideGroupToPairs.get(outGroup); for (final CanvasMatches outsidePair : outsidePairs) { final List<RealPoint> originalPoints = getPointList(outsidePair); final List<Integer> setIndexes = getSetIndexesForPoints(largestSetIndexSamples, originalPoints); final List<CanvasMatches> splitMatches = splitMatches(outsidePair, setIndexes, largestSetCanvasIds); derivedPairs.addAll(splitMatches); } } } LOG.info("derivePairs: exit, derived {} pairs", derivedPairs.size()); } DerivedMatchGroup(final String groupId,
                             final Collection<CanvasMatches> multiConsensusPairs); List<CanvasMatches> getDerivedPairs(); }
DerivedMatchGroup { private void derivePairs(final Collection<CanvasMatches> multiConsensusPairs) { String largestOutsideGroup = null; int largestOutsideGroupPairCount = 0; int originalTotalMatchPairCount = 0; final Map<String, List<CanvasMatches>> outsideGroupToPairs = new LinkedHashMap<>(); List<CanvasMatches> pairList; String outsideGroup; for (final CanvasMatches pair : multiConsensusPairs) { if (groupId.equals(pair.getpGroupId())) { outsideGroup = pair.getqGroupId(); } else if (groupId.equals(pair.getqGroupId())) { outsideGroup = pair.getpGroupId(); } else { continue; } pairList = outsideGroupToPairs.get(outsideGroup); if (pairList == null) { pairList = new ArrayList<>(); outsideGroupToPairs.put(outsideGroup, pairList); } pairList.add(pair); if (pairList.size() > largestOutsideGroupPairCount) { largestOutsideGroupPairCount = pairList.size(); largestOutsideGroup = outsideGroup; } originalTotalMatchPairCount++; } final List<CanvasMatches> largestSetPairs = outsideGroupToPairs.get(largestOutsideGroup); LOG.info("derivePairs: processing {} total pairs, largest set has {} pairs", originalTotalMatchPairCount, largestSetPairs.size()); final RealPointSampleList<ARGBType> largestSetIndexSamples = new RealPointSampleList<>(2); final List<String> largestSetCanvasIds = new ArrayList<>(); buildSamplesForLargestSet(largestSetPairs, largestSetIndexSamples, largestSetCanvasIds); derivedPairs.addAll(largestSetPairs); for (final String outGroup : outsideGroupToPairs.keySet()) { if (! outGroup.equals(largestOutsideGroup)) { final List<CanvasMatches> outsidePairs = outsideGroupToPairs.get(outGroup); for (final CanvasMatches outsidePair : outsidePairs) { final List<RealPoint> originalPoints = getPointList(outsidePair); final List<Integer> setIndexes = getSetIndexesForPoints(largestSetIndexSamples, originalPoints); final List<CanvasMatches> splitMatches = splitMatches(outsidePair, setIndexes, largestSetCanvasIds); derivedPairs.addAll(splitMatches); } } } LOG.info("derivePairs: exit, derived {} pairs", derivedPairs.size()); } DerivedMatchGroup(final String groupId,
                             final Collection<CanvasMatches> multiConsensusPairs); List<CanvasMatches> getDerivedPairs();  }